EX5_024.cs 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.EX5
  5. {
  6. public class EX5_024 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.None)
  12. {
  13. static bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.CardTraits.Contains("Deva") && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 5;
  16. }
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  18. }
  19. if (timing == EffectTiming.OnCounterTiming)
  20. {
  21. cardEffects.Add(CardEffectFactory.BlastDigivolveEffect(card: card, condition: null));
  22. }
  23. if (timing == EffectTiming.OnEnterFieldAnyone)
  24. {
  25. ActivateClass activateClass = new ActivateClass();
  26. activateClass.SetUpICardEffect("Return 1 level 5 or lower Digimon to hand and unsuspend 1 Digimon", CanUseCondition, card);
  27. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  28. cardEffects.Add(activateClass);
  29. string EffectDiscription()
  30. {
  31. return "[On Play] Return 1 of your opponent's level 5 or lower Digimon to the hand. Then, unsuspend 1 of your Digimon with the [Deva]/[Four Great Dragons]/[Four Sovereigns] trait.";
  32. }
  33. bool CanSelectPermanentCondition(Permanent permanent)
  34. {
  35. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  36. {
  37. if (permanent.Level <= 5)
  38. {
  39. if (permanent.TopCard.HasLevel)
  40. {
  41. return true;
  42. }
  43. }
  44. }
  45. return false;
  46. }
  47. bool CanSelectPermanentCondition1(Permanent permanent)
  48. {
  49. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  50. {
  51. if (permanent.TopCard.CardTraits.Contains("Deva"))
  52. {
  53. return true;
  54. }
  55. if (permanent.TopCard.CardTraits.Contains("Four Sovereigns"))
  56. {
  57. return true;
  58. }
  59. if (permanent.TopCard.CardTraits.Contains("FourSovereigns"))
  60. {
  61. return true;
  62. }
  63. if (permanent.TopCard.CardTraits.Contains("Four Great Dragons"))
  64. {
  65. return true;
  66. }
  67. if (permanent.TopCard.CardTraits.Contains("FourGreatDragons"))
  68. {
  69. return true;
  70. }
  71. }
  72. return false;
  73. }
  74. bool CanUseCondition(Hashtable hashtable)
  75. {
  76. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  77. }
  78. bool CanActivateCondition(Hashtable hashtable)
  79. {
  80. if (CardEffectCommons.IsExistOnBattleArea(card))
  81. {
  82. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  83. {
  84. return true;
  85. }
  86. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  87. {
  88. return true;
  89. }
  90. }
  91. return false;
  92. }
  93. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  94. {
  95. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  96. {
  97. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  98. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  99. selectPermanentEffect.SetUp(
  100. selectPlayer: card.Owner,
  101. canTargetCondition: CanSelectPermanentCondition,
  102. canTargetCondition_ByPreSelecetedList: null,
  103. canEndSelectCondition: null,
  104. maxCount: maxCount,
  105. canNoSelect: false,
  106. canEndNotMax: false,
  107. selectPermanentCoroutine: null,
  108. afterSelectPermanentCoroutine: null,
  109. mode: SelectPermanentEffect.Mode.Bounce,
  110. cardEffect: activateClass);
  111. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  112. }
  113. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  114. {
  115. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  116. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  117. selectPermanentEffect.SetUp(
  118. selectPlayer: card.Owner,
  119. canTargetCondition: CanSelectPermanentCondition1,
  120. canTargetCondition_ByPreSelecetedList: null,
  121. canEndSelectCondition: null,
  122. maxCount: maxCount,
  123. canNoSelect: false,
  124. canEndNotMax: false,
  125. selectPermanentCoroutine: null,
  126. afterSelectPermanentCoroutine: null,
  127. mode: SelectPermanentEffect.Mode.UnTap,
  128. cardEffect: activateClass);
  129. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  130. }
  131. }
  132. }
  133. if (timing == EffectTiming.OnEnterFieldAnyone)
  134. {
  135. ActivateClass activateClass = new ActivateClass();
  136. activateClass.SetUpICardEffect("Return 1 level 5 or lower Digimon to hand and unsuspend 1 Digimon", CanUseCondition, card);
  137. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  138. cardEffects.Add(activateClass);
  139. string EffectDiscription()
  140. {
  141. return "[When Digivolving] Return 1 of your opponent's level 5 or lower Digimon to the hand. Then, unsuspend 1 of your Digimon with the [Deva]/[Four Great Dragons]/[Four Sovereigns] trait.";
  142. }
  143. bool CanSelectPermanentCondition(Permanent permanent)
  144. {
  145. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  146. {
  147. if (permanent.Level <= 5)
  148. {
  149. if (permanent.TopCard.HasLevel)
  150. {
  151. return true;
  152. }
  153. }
  154. }
  155. return false;
  156. }
  157. bool CanSelectPermanentCondition1(Permanent permanent)
  158. {
  159. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  160. {
  161. if (permanent.TopCard.CardTraits.Contains("Deva"))
  162. {
  163. return true;
  164. }
  165. if (permanent.TopCard.CardTraits.Contains("Four Sovereigns"))
  166. {
  167. return true;
  168. }
  169. if (permanent.TopCard.CardTraits.Contains("FourSovereigns"))
  170. {
  171. return true;
  172. }
  173. if (permanent.TopCard.CardTraits.Contains("Four Great Dragons"))
  174. {
  175. return true;
  176. }
  177. if (permanent.TopCard.CardTraits.Contains("FourGreatDragons"))
  178. {
  179. return true;
  180. }
  181. }
  182. return false;
  183. }
  184. bool CanUseCondition(Hashtable hashtable)
  185. {
  186. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  187. }
  188. bool CanActivateCondition(Hashtable hashtable)
  189. {
  190. if (CardEffectCommons.IsExistOnBattleArea(card))
  191. {
  192. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  193. {
  194. return true;
  195. }
  196. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  197. {
  198. return true;
  199. }
  200. }
  201. return false;
  202. }
  203. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  204. {
  205. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  206. {
  207. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  208. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  209. selectPermanentEffect.SetUp(
  210. selectPlayer: card.Owner,
  211. canTargetCondition: CanSelectPermanentCondition,
  212. canTargetCondition_ByPreSelecetedList: null,
  213. canEndSelectCondition: null,
  214. maxCount: maxCount,
  215. canNoSelect: false,
  216. canEndNotMax: false,
  217. selectPermanentCoroutine: null,
  218. afterSelectPermanentCoroutine: null,
  219. mode: SelectPermanentEffect.Mode.Bounce,
  220. cardEffect: activateClass);
  221. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  222. }
  223. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  224. {
  225. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  226. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  227. selectPermanentEffect.SetUp(
  228. selectPlayer: card.Owner,
  229. canTargetCondition: CanSelectPermanentCondition1,
  230. canTargetCondition_ByPreSelecetedList: null,
  231. canEndSelectCondition: null,
  232. maxCount: maxCount,
  233. canNoSelect: false,
  234. canEndNotMax: false,
  235. selectPermanentCoroutine: null,
  236. afterSelectPermanentCoroutine: null,
  237. mode: SelectPermanentEffect.Mode.UnTap,
  238. cardEffect: activateClass);
  239. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  240. }
  241. }
  242. }
  243. if (timing == EffectTiming.OnDestroyedAnyone)
  244. {
  245. ActivateClass activateClass = new ActivateClass();
  246. activateClass.SetUpICardEffect("Delete opponent's all Digimon with the highest level", CanUseCondition, card);
  247. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  248. cardEffects.Add(activateClass);
  249. string EffectDiscription()
  250. {
  251. return "[On Deletion] Delete 1 of your opponent's Digimon with the highest level.";
  252. }
  253. bool CanSelectPermanentCondition(Permanent permanent)
  254. {
  255. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  256. {
  257. if (CardEffectCommons.IsMaxLevel(permanent, card.Owner.Enemy))
  258. {
  259. return true;
  260. }
  261. }
  262. return false;
  263. }
  264. bool CanUseCondition(Hashtable hashtable)
  265. {
  266. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  267. }
  268. bool CanActivateCondition(Hashtable hashtable)
  269. {
  270. if (CardEffectCommons.CanActivateOnDeletion(card, activateClass))
  271. {
  272. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  273. {
  274. return true;
  275. }
  276. }
  277. return false;
  278. }
  279. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  280. {
  281. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  282. {
  283. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  284. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  285. selectPermanentEffect.SetUp(
  286. selectPlayer: card.Owner,
  287. canTargetCondition: CanSelectPermanentCondition,
  288. canTargetCondition_ByPreSelecetedList: null,
  289. canEndSelectCondition: null,
  290. maxCount: maxCount,
  291. canNoSelect: false,
  292. canEndNotMax: false,
  293. selectPermanentCoroutine: null,
  294. afterSelectPermanentCoroutine: null,
  295. mode: SelectPermanentEffect.Mode.Destroy,
  296. cardEffect: activateClass);
  297. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  298. }
  299. }
  300. }
  301. return cardEffects;
  302. }
  303. }
  304. }