BT14_018.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using UnityEngine;
  5. namespace DCGO.CardEffects.BT14
  6. {
  7. public class BT14_018 : 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.OnEnterFieldAnyone)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Play tokens", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[On Play] Play 1 [Amon of Crimson Flame] (Digimon/Red/6000 DP/<Rush>) Token and 1 [Umon of Blue Thunder] (Digimon/Yellow/6000 DP/<Blocker>) Token.";
  21. }
  22. bool CanUseCondition(Hashtable hashtable)
  23. {
  24. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  25. }
  26. bool CanActivateCondition(Hashtable hashtable)
  27. {
  28. if (CardEffectCommons.IsExistOnBattleArea(card))
  29. {
  30. if (card.Owner.fieldCardFrames.Count((frame) => frame.IsEmptyFrame() && frame.IsBattleAreaFrame()) >= 1)
  31. {
  32. return true;
  33. }
  34. }
  35. return false;
  36. }
  37. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  38. {
  39. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayAmonToken(activateClass));
  40. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayUmonToken(activateClass));
  41. }
  42. }
  43. if (timing == EffectTiming.OnEnterFieldAnyone)
  44. {
  45. ActivateClass activateClass = new ActivateClass();
  46. activateClass.SetUpICardEffect("Play tokens", CanUseCondition, card);
  47. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  48. cardEffects.Add(activateClass);
  49. string EffectDiscription()
  50. {
  51. return "[When Digivolving] Play 1 [Amon of Crimson Flame] (Digimon/Red/6000 DP/<Rush>) Token and 1 [Umon of Blue Thunder] (Digimon/Yellow/6000 DP/<Blocker>) Token.";
  52. }
  53. bool CanUseCondition(Hashtable hashtable)
  54. {
  55. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  56. }
  57. bool CanActivateCondition(Hashtable hashtable)
  58. {
  59. if (CardEffectCommons.IsExistOnBattleArea(card))
  60. {
  61. if (card.Owner.fieldCardFrames.Count((frame) => frame.IsEmptyFrame() && frame.IsBattleAreaFrame()) >= 1)
  62. {
  63. return true;
  64. }
  65. }
  66. return false;
  67. }
  68. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  69. {
  70. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayAmonToken(activateClass));
  71. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayUmonToken(activateClass));
  72. }
  73. }
  74. if (timing == EffectTiming.BeforePayCost)
  75. {
  76. ActivateClass activateClass = new ActivateClass();
  77. activateClass.SetUpICardEffect("Delete tokens and Recovery +1 (Deck)", CanUseCondition, card);
  78. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  79. activateClass.SetHashString("Recovery1_BT14_018");
  80. cardEffects.Add(activateClass);
  81. string EffectDiscription()
  82. {
  83. return "[All Turns] When this Digimon would digivolve or leave the battle area, delete all of your [Amon of Crimson Flame] and [Umon of Blue Thunder]. If this effect deletes, <Recovery +1 (Deck)>.";
  84. }
  85. bool PermanentCondition(Permanent permanent)
  86. {
  87. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  88. {
  89. if (permanent.TopCard.CardNames.Contains("Amon of Crimson Flame"))
  90. {
  91. return true;
  92. }
  93. if (permanent.TopCard.CardNames.Contains("AmonofCrimsonFlame"))
  94. {
  95. return true;
  96. }
  97. }
  98. return false;
  99. }
  100. bool PermanentCondition1(Permanent permanent)
  101. {
  102. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  103. {
  104. if (permanent.TopCard.CardNames.Contains("Umon of Blue Thunder"))
  105. {
  106. return true;
  107. }
  108. if (permanent.TopCard.CardNames.Contains("UmonofBlueThunder"))
  109. {
  110. return true;
  111. }
  112. }
  113. return false;
  114. }
  115. bool CanUseCondition(Hashtable hashtable)
  116. {
  117. if (CardEffectCommons.IsExistOnBattleArea(card))
  118. {
  119. if (CardEffectCommons.CanTriggerWhenPermanentWouldDigivolveOfCard(hashtable, null, card))
  120. {
  121. return true;
  122. }
  123. }
  124. return false;
  125. }
  126. bool CanActivateCondition(Hashtable hashtable)
  127. {
  128. if (CardEffectCommons.IsExistOnBattleArea(card))
  129. {
  130. if (CardEffectCommons.HasMatchConditionPermanent(PermanentCondition))
  131. {
  132. return true;
  133. }
  134. if (CardEffectCommons.HasMatchConditionPermanent(PermanentCondition1))
  135. {
  136. return true;
  137. }
  138. }
  139. return false;
  140. }
  141. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  142. {
  143. List<Permanent> destroyTargetPermanents = card.Owner.GetBattleAreaPermanents()
  144. .Filter(permanent => PermanentCondition(permanent) || PermanentCondition1(permanent));
  145. DestroyPermanentsClass destroyPermanentsClass = new DestroyPermanentsClass(
  146. destroyTargetPermanents,
  147. CardEffectCommons.CardEffectHashtable(activateClass));
  148. yield return ContinuousController.instance.StartCoroutine(destroyPermanentsClass.Destroy());
  149. if (destroyPermanentsClass.DestroyedPermanents.Count >= 1)
  150. {
  151. yield return ContinuousController.instance.StartCoroutine(new IRecovery(card.Owner, 1, activateClass).Recovery());
  152. yield return new WaitForSeconds(0.4f);
  153. }
  154. }
  155. }
  156. if (timing == EffectTiming.WhenRemoveField)
  157. {
  158. ActivateClass activateClass = new ActivateClass();
  159. activateClass.SetUpICardEffect("Delete tokens and Recovery +1 (Deck)", CanUseCondition, card);
  160. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  161. activateClass.SetHashString("Recovery1_BT14_018");
  162. cardEffects.Add(activateClass);
  163. string EffectDiscription()
  164. {
  165. return "[All Turns] When this Digimon would digivolve or leave the battle area, delete all of your [Amon of Crimson Flame] and [Umon of Blue Thunder]. If this effect deletes, <Recovery +1 (Deck)>.";
  166. }
  167. bool PermanentCondition(Permanent permanent)
  168. {
  169. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  170. {
  171. if (permanent.TopCard.CardNames.Contains("Amon of Crimson Flame"))
  172. {
  173. return true;
  174. }
  175. if (permanent.TopCard.CardNames.Contains("AmonofCrimsonFlame"))
  176. {
  177. return true;
  178. }
  179. }
  180. return false;
  181. }
  182. bool PermanentCondition1(Permanent permanent)
  183. {
  184. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  185. {
  186. if (permanent.TopCard.CardNames.Contains("Umon of Blue Thunder"))
  187. {
  188. return true;
  189. }
  190. if (permanent.TopCard.CardNames.Contains("UmonofBlueThunder"))
  191. {
  192. return true;
  193. }
  194. }
  195. return false;
  196. }
  197. bool CanUseCondition(Hashtable hashtable)
  198. {
  199. if (CardEffectCommons.IsExistOnBattleArea(card))
  200. {
  201. if (CardEffectCommons.CanTriggerWhenRemoveField(hashtable, card))
  202. {
  203. return true;
  204. }
  205. }
  206. return false;
  207. }
  208. bool CanActivateCondition(Hashtable hashtable)
  209. {
  210. if (CardEffectCommons.IsExistOnBattleArea(card))
  211. {
  212. if (CardEffectCommons.HasMatchConditionPermanent(PermanentCondition))
  213. {
  214. return true;
  215. }
  216. if (CardEffectCommons.HasMatchConditionPermanent(PermanentCondition1))
  217. {
  218. return true;
  219. }
  220. }
  221. return false;
  222. }
  223. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  224. {
  225. List<Permanent> destroyTargetPermanents = card.Owner.GetBattleAreaPermanents()
  226. .Filter(permanent => PermanentCondition(permanent) || PermanentCondition1(permanent));
  227. DestroyPermanentsClass destroyPermanentsClass = new DestroyPermanentsClass(
  228. destroyTargetPermanents,
  229. CardEffectCommons.CardEffectHashtable(activateClass));
  230. yield return ContinuousController.instance.StartCoroutine(destroyPermanentsClass.Destroy());
  231. if (destroyPermanentsClass.DestroyedPermanents.Count >= 1)
  232. {
  233. yield return ContinuousController.instance.StartCoroutine(new IRecovery(card.Owner, 1, activateClass).Recovery());
  234. yield return new WaitForSeconds(0.4f);
  235. }
  236. }
  237. }
  238. return cardEffects;
  239. }
  240. }
  241. }