GrandGalemon_ST18_10.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.ST18
  4. {
  5. public class GrandGalemon_ST18_10 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region On Play/ When Digivolving Shared
  11. bool CanSelectPermanentSharedCondition(Permanent permanent)
  12. {
  13. return CardEffectCommons.IsPermanentExistsOnBattleArea(permanent) &&
  14. permanent.IsDigimon;
  15. }
  16. bool CanActivateSharedCondition(Hashtable hashtable)
  17. {
  18. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  19. }
  20. #endregion
  21. #region On Play
  22. if (timing == EffectTiming.OnEnterFieldAnyone)
  23. {
  24. ActivateClass activateClass = new ActivateClass();
  25. activateClass.SetUpICardEffect("Suspend 1 Digimon", CanUseCondition, card);
  26. activateClass.SetUpActivateClass(CanActivateSharedCondition, ActivateCoroutine, -1, false, EffectDescription());
  27. cardEffects.Add(activateClass);
  28. string EffectDescription()
  29. {
  30. return
  31. "[On Play] Suspend 1 Digimon. If this effect suspends your Digimon, you may play 1 Digimon card with the [Bird]/[Avian] in one of its traits with 3000 DP or less below from your hand without paying the cost.";
  32. }
  33. bool CanUseCondition(Hashtable hashtable)
  34. {
  35. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  36. }
  37. bool CanSelectCardCondition(CardSource cardSource)
  38. {
  39. return cardSource.IsDigimon &&
  40. cardSource.HasBirdTraits &&
  41. cardSource.HasDP &&
  42. cardSource.CardDP <= 3000 &&
  43. CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass);
  44. }
  45. IEnumerator ActivateCoroutine(Hashtable hashtable)
  46. {
  47. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentSharedCondition))
  48. {
  49. bool ownDigimon = false;
  50. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  51. selectPermanentEffect.SetUp(
  52. selectPlayer: card.Owner,
  53. canTargetCondition: CanSelectPermanentSharedCondition,
  54. canTargetCondition_ByPreSelecetedList: null,
  55. canEndSelectCondition: null,
  56. maxCount: 1,
  57. canNoSelect: false,
  58. canEndNotMax: false,
  59. selectPermanentCoroutine: null,
  60. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  61. mode: SelectPermanentEffect.Mode.Tap,
  62. cardEffect: activateClass);
  63. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  64. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  65. {
  66. ownDigimon = permanents.Some(permanent => CardEffectCommons.IsOwnerPermanent(permanent, card));
  67. yield return null;
  68. }
  69. if (ownDigimon && CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition))
  70. {
  71. List<CardSource> selectedCards = new List<CardSource>();
  72. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  73. selectHandEffect.SetUp(
  74. selectPlayer: card.Owner,
  75. canTargetCondition: CanSelectCardCondition,
  76. canTargetCondition_ByPreSelecetedList: null,
  77. canEndSelectCondition: null,
  78. maxCount: 1,
  79. canNoSelect: true,
  80. canEndNotMax: false,
  81. isShowOpponent: true,
  82. selectCardCoroutine: SelectCardCoroutine,
  83. afterSelectCardCoroutine: null,
  84. mode: SelectHandEffect.Mode.Custom,
  85. cardEffect: activateClass);
  86. selectHandEffect.SetUpCustomMessage("Select card to play.",
  87. "The opponent is selecting 1 card to play.");
  88. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  89. yield return StartCoroutine(selectHandEffect.Activate());
  90. IEnumerator SelectCardCoroutine(CardSource cardSource)
  91. {
  92. selectedCards.Add(cardSource);
  93. yield return null;
  94. }
  95. yield return ContinuousController.instance.StartCoroutine(
  96. CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass,
  97. payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  98. }
  99. }
  100. }
  101. }
  102. #endregion
  103. #region When Digivolving
  104. if (timing == EffectTiming.OnEnterFieldAnyone)
  105. {
  106. ActivateClass activateClass = new ActivateClass();
  107. activateClass.SetUpICardEffect("Suspend 1 Digimon", CanUseCondition, card);
  108. activateClass.SetUpActivateClass(CanActivateSharedCondition, ActivateCoroutine, -1, false, EffectDescription());
  109. cardEffects.Add(activateClass);
  110. string EffectDescription()
  111. {
  112. return
  113. "[When Digivolving] Suspend 1 Digimon. If this effect suspends your Digimon, you may play 1 Digimon card with the [Bird]/[Avian] in one of its traits with 3000 DP or less below from your hand without paying the cost.";
  114. }
  115. bool CanUseCondition(Hashtable hashtable)
  116. {
  117. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  118. }
  119. bool CanSelectCardCondition(CardSource cardSource)
  120. {
  121. return cardSource.IsDigimon &&
  122. cardSource.HasBirdTraits &&
  123. cardSource.HasDP &&
  124. cardSource.CardDP <= 3000 &&
  125. CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass);
  126. }
  127. IEnumerator ActivateCoroutine(Hashtable hashtable)
  128. {
  129. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentSharedCondition))
  130. {
  131. bool ownDigimon = false;
  132. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  133. selectPermanentEffect.SetUp(
  134. selectPlayer: card.Owner,
  135. canTargetCondition: CanSelectPermanentSharedCondition,
  136. canTargetCondition_ByPreSelecetedList: null,
  137. canEndSelectCondition: null,
  138. maxCount: 1,
  139. canNoSelect: false,
  140. canEndNotMax: false,
  141. selectPermanentCoroutine: null,
  142. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  143. mode: SelectPermanentEffect.Mode.Tap,
  144. cardEffect: activateClass);
  145. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  146. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  147. {
  148. ownDigimon = permanents.Some(permanent => CardEffectCommons.IsOwnerPermanent(permanent, card));
  149. yield return null;
  150. }
  151. if (ownDigimon && CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition))
  152. {
  153. List<CardSource> selectedCards = new List<CardSource>();
  154. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  155. selectHandEffect.SetUp(
  156. selectPlayer: card.Owner,
  157. canTargetCondition: CanSelectCardCondition,
  158. canTargetCondition_ByPreSelecetedList: null,
  159. canEndSelectCondition: null,
  160. maxCount: 1,
  161. canNoSelect: true,
  162. canEndNotMax: false,
  163. isShowOpponent: true,
  164. selectCardCoroutine: SelectCardCoroutine,
  165. afterSelectCardCoroutine: null,
  166. mode: SelectHandEffect.Mode.Custom,
  167. cardEffect: activateClass);
  168. selectHandEffect.SetUpCustomMessage("Select card to play.",
  169. "The opponent is selecting 1 card to play.");
  170. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  171. yield return StartCoroutine(selectHandEffect.Activate());
  172. IEnumerator SelectCardCoroutine(CardSource cardSource)
  173. {
  174. selectedCards.Add(cardSource);
  175. yield return null;
  176. }
  177. yield return ContinuousController.instance.StartCoroutine(
  178. CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass,
  179. payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  180. }
  181. }
  182. }
  183. }
  184. #endregion
  185. #region Your Turn - ESS
  186. if (timing == EffectTiming.OnAllyAttack)
  187. {
  188. ActivateClass activateClass = new ActivateClass();
  189. activateClass.SetUpICardEffect("Unsuspend this Digimon", CanUseCondition, card);
  190. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription());
  191. activateClass.SetIsInheritedEffect(true);
  192. activateClass.SetHashString("Unsuspend_EX7_034");
  193. cardEffects.Add(activateClass);
  194. string EffectDescription()
  195. {
  196. return "[Your Turn] (Once Per Turn) When this Digimon attacks your opponent's Digimon, you may unsuspend this Digimon.";
  197. }
  198. bool CanUseCondition(Hashtable hashtable)
  199. {
  200. return CardEffectCommons.CanTriggerOnAttack(hashtable, card) &&
  201. CardEffectCommons.IsOwnerTurn(card) &&
  202. CardEffectCommons.IsPermanentExistsOnBattleArea(GManager.instance.attackProcess.DefendingPermanent);
  203. }
  204. bool CanActivateCondition(Hashtable hashtable)
  205. {
  206. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  207. }
  208. IEnumerator ActivateCoroutine(Hashtable hashtable)
  209. {
  210. yield return ContinuousController.instance.StartCoroutine(
  211. new IUnsuspendPermanents(new List<Permanent>() { card.PermanentOfThisCard() }, activateClass).Unsuspend());
  212. }
  213. }
  214. #endregion
  215. return cardEffects;
  216. }
  217. }
  218. }