EX5_020.cs 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX5
  6. {
  7. public class EX5_020 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. if (timing == EffectTiming.None)
  13. {
  14. static bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. if (targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 4)
  17. {
  18. if (targetPermanent.TopCard.CardTraits.Contains("Light Fang"))
  19. {
  20. return true;
  21. }
  22. if (targetPermanent.TopCard.CardTraits.Contains("LightFang"))
  23. {
  24. return true;
  25. }
  26. if (targetPermanent.TopCard.CardTraits.Contains("Night Claw"))
  27. {
  28. return true;
  29. }
  30. if (targetPermanent.TopCard.CardTraits.Contains("NightClaw"))
  31. {
  32. return true;
  33. }
  34. }
  35. return false;
  36. }
  37. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  38. }
  39. if (timing == EffectTiming.None)
  40. {
  41. ChangeCostClass changeCostClass = new ChangeCostClass();
  42. changeCostClass.SetUpICardEffect($"Reduce Play Cost", CanUseCondition, card);
  43. changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
  44. cardEffects.Add(changeCostClass);
  45. bool PermanentCondition(Permanent permanent)
  46. {
  47. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  48. {
  49. if (permanent.DigivolutionCards.Count >= 3)
  50. {
  51. if (permanent.TopCard.CardTraits.Contains("Light Fang"))
  52. {
  53. return true;
  54. }
  55. if (permanent.TopCard.CardTraits.Contains("LightFung"))
  56. {
  57. return true;
  58. }
  59. if (permanent.TopCard.CardTraits.Contains("Night Claw"))
  60. {
  61. return true;
  62. }
  63. if (permanent.TopCard.CardTraits.Contains("NightClaw"))
  64. {
  65. return true;
  66. }
  67. if (permanent.TopCard.CardTraits.Contains("Galaxy"))
  68. {
  69. return true;
  70. }
  71. }
  72. }
  73. return false;
  74. }
  75. bool CanUseCondition(Hashtable hashtable)
  76. {
  77. if (card.PermanentOfThisCard() == null)
  78. {
  79. if (CardEffectCommons.HasMatchConditionPermanent(PermanentCondition))
  80. {
  81. return true;
  82. }
  83. }
  84. return false;
  85. }
  86. int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
  87. {
  88. if (CardSourceCondition(cardSource))
  89. {
  90. if (RootCondition(root))
  91. {
  92. if (PermanentsCondition(targetPermanents))
  93. {
  94. Cost -= 2;
  95. }
  96. }
  97. }
  98. return Cost;
  99. }
  100. bool PermanentsCondition(List<Permanent> targetPermanents)
  101. {
  102. if (targetPermanents == null)
  103. {
  104. return true;
  105. }
  106. else
  107. {
  108. if (targetPermanents.Count((targetPermanent) => targetPermanent != null) == 0)
  109. {
  110. return true;
  111. }
  112. }
  113. return false;
  114. }
  115. bool CardSourceCondition(CardSource cardSource)
  116. {
  117. return cardSource == card;
  118. }
  119. bool RootCondition(SelectCardEffect.Root root)
  120. {
  121. return true;
  122. }
  123. bool isUpDown()
  124. {
  125. return true;
  126. }
  127. }
  128. if (timing == EffectTiming.None)
  129. {
  130. bool PermanentCondition1(Permanent permanent)
  131. {
  132. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  133. {
  134. if (permanent.DigivolutionCards.Count >= 3)
  135. {
  136. if (permanent.TopCard.CardTraits.Contains("Light Fang"))
  137. {
  138. return true;
  139. }
  140. if (permanent.TopCard.CardTraits.Contains("LightFung"))
  141. {
  142. return true;
  143. }
  144. if (permanent.TopCard.CardTraits.Contains("Night Claw"))
  145. {
  146. return true;
  147. }
  148. if (permanent.TopCard.CardTraits.Contains("NightClaw"))
  149. {
  150. return true;
  151. }
  152. if (permanent.TopCard.CardTraits.Contains("Galaxy"))
  153. {
  154. return true;
  155. }
  156. }
  157. }
  158. return false;
  159. }
  160. bool Condition()
  161. {
  162. if (card.PermanentOfThisCard() == null)
  163. {
  164. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  165. {
  166. if (CardEffectCommons.HasMatchConditionPermanent(PermanentCondition1))
  167. {
  168. return true;
  169. }
  170. }
  171. }
  172. return false;
  173. }
  174. bool PermanentCondition(Permanent targetPermanent)
  175. {
  176. if (targetPermanent != null)
  177. {
  178. if (CardEffectCommons.IsOwnerPermanent(targetPermanent, card))
  179. {
  180. return true;
  181. }
  182. }
  183. return false;
  184. }
  185. bool CardSourceCondition(CardSource cardSource)
  186. {
  187. return cardSource == card;
  188. }
  189. bool RootCondition(SelectCardEffect.Root root)
  190. {
  191. return true;
  192. }
  193. cardEffects.Add(CardEffectFactory.ChangeDigivolutionCostStaticEffect(
  194. changeValue: -2,
  195. permanentCondition: PermanentCondition,
  196. cardCondition: CardSourceCondition,
  197. rootCondition: RootCondition,
  198. isInheritedEffect: false,
  199. card: card,
  200. condition: Condition,
  201. setFixedCost: false));
  202. }
  203. if (timing == EffectTiming.OnEnterFieldAnyone)
  204. {
  205. ActivateClass activateClass = new ActivateClass();
  206. activateClass.SetUpICardEffect("Opponent's 1 Digimon can't suspend", CanUseCondition, card);
  207. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  208. cardEffects.Add(activateClass);
  209. string EffectDiscription()
  210. {
  211. return "[On Play] 1 of your opponent's Digimon can't suspend until the end of your opponent's turn.";
  212. }
  213. bool CanSelectPermanentCondition(Permanent permanent)
  214. {
  215. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  216. }
  217. bool CanUseCondition(Hashtable hashtable)
  218. {
  219. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  220. }
  221. bool CanActivateCondition(Hashtable hashtable)
  222. {
  223. if (CardEffectCommons.IsExistOnBattleArea(card))
  224. {
  225. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  226. {
  227. return true;
  228. }
  229. }
  230. return false;
  231. }
  232. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  233. {
  234. if (card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition) >= 1)
  235. {
  236. int maxCount = Math.Min(1, card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition));
  237. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  238. selectPermanentEffect.SetUp(
  239. selectPlayer: card.Owner,
  240. canTargetCondition: CanSelectPermanentCondition,
  241. canTargetCondition_ByPreSelecetedList: null,
  242. canEndSelectCondition: null,
  243. maxCount: maxCount,
  244. canNoSelect: false,
  245. canEndNotMax: false,
  246. selectPermanentCoroutine: SelectPermanentCoroutine,
  247. afterSelectPermanentCoroutine: null,
  248. mode: SelectPermanentEffect.Mode.Custom,
  249. cardEffect: activateClass);
  250. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get unable to suspend.", "The opponent is selecting 1 Digimon that will get unable to suspend.");
  251. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  252. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  253. {
  254. Permanent selectedPermanent = permanent;
  255. if (selectedPermanent != null)
  256. {
  257. CanNotSuspendClass canNotSuspendClass = new CanNotSuspendClass();
  258. canNotSuspendClass.SetUpICardEffect("Can't Suspend", CanUseCondition1, card);
  259. canNotSuspendClass.SetUpCanNotSuspendClass(PermanentCondition: PermanentCondition);
  260. selectedPermanent.UntilOwnerTurnEndEffects.Add((_timing) => canNotSuspendClass);
  261. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  262. {
  263. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  264. }
  265. bool CanUseCondition1(Hashtable hashtable)
  266. {
  267. if (selectedPermanent.TopCard != null)
  268. {
  269. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  270. {
  271. return true;
  272. }
  273. }
  274. return false;
  275. }
  276. bool PermanentCondition(Permanent permanent)
  277. {
  278. if (permanent == selectedPermanent)
  279. {
  280. return true;
  281. }
  282. return false;
  283. }
  284. }
  285. }
  286. }
  287. }
  288. }
  289. if (timing == EffectTiming.OnEnterFieldAnyone)
  290. {
  291. ActivateClass activateClass = new ActivateClass();
  292. activateClass.SetUpICardEffect("Opponent's 1 Digimon can't suspend", CanUseCondition, card);
  293. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  294. cardEffects.Add(activateClass);
  295. string EffectDiscription()
  296. {
  297. return "[When Digivolving] 1 of your opponent's Digimon can't suspend until the end of your opponent's turn.";
  298. }
  299. bool CanSelectPermanentCondition(Permanent permanent)
  300. {
  301. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  302. }
  303. bool CanUseCondition(Hashtable hashtable)
  304. {
  305. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  306. }
  307. bool CanActivateCondition(Hashtable hashtable)
  308. {
  309. if (CardEffectCommons.IsExistOnBattleArea(card))
  310. {
  311. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  312. {
  313. return true;
  314. }
  315. }
  316. return false;
  317. }
  318. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  319. {
  320. if (card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition) >= 1)
  321. {
  322. int maxCount = Math.Min(1, card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition));
  323. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  324. selectPermanentEffect.SetUp(
  325. selectPlayer: card.Owner,
  326. canTargetCondition: CanSelectPermanentCondition,
  327. canTargetCondition_ByPreSelecetedList: null,
  328. canEndSelectCondition: null,
  329. maxCount: maxCount,
  330. canNoSelect: false,
  331. canEndNotMax: false,
  332. selectPermanentCoroutine: SelectPermanentCoroutine,
  333. afterSelectPermanentCoroutine: null,
  334. mode: SelectPermanentEffect.Mode.Custom,
  335. cardEffect: activateClass);
  336. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get unable to suspend.", "The opponent is selecting 1 Digimon that will get unable to suspend.");
  337. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  338. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  339. {
  340. Permanent selectedPermanent = permanent;
  341. if (selectedPermanent != null)
  342. {
  343. CanNotSuspendClass canNotSuspendClass = new CanNotSuspendClass();
  344. canNotSuspendClass.SetUpICardEffect("Can't Suspend", CanUseCondition1, card);
  345. canNotSuspendClass.SetUpCanNotSuspendClass(PermanentCondition: PermanentCondition);
  346. selectedPermanent.UntilOwnerTurnEndEffects.Add((_timing) => canNotSuspendClass);
  347. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  348. {
  349. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  350. }
  351. bool CanUseCondition1(Hashtable hashtable)
  352. {
  353. if (selectedPermanent.TopCard != null)
  354. {
  355. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  356. {
  357. return true;
  358. }
  359. }
  360. return false;
  361. }
  362. bool PermanentCondition(Permanent permanent)
  363. {
  364. if (permanent == selectedPermanent)
  365. {
  366. return true;
  367. }
  368. return false;
  369. }
  370. }
  371. }
  372. }
  373. }
  374. }
  375. if (timing == EffectTiming.None)
  376. {
  377. bool Condition()
  378. {
  379. if (CardEffectCommons.IsOpponentTurn(card))
  380. {
  381. return true;
  382. }
  383. return false;
  384. }
  385. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 2000, isInheritedEffect: true, card: card, condition: Condition));
  386. }
  387. return cardEffects;
  388. }
  389. }
  390. }