ST18_10.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.ST18
  4. {
  5. public class 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. Permanent selectedPermanent = null;
  50. bool ownDigimon = false;
  51. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  52. selectPermanentEffect.SetUp(
  53. selectPlayer: card.Owner,
  54. canTargetCondition: CanSelectPermanentSharedCondition,
  55. canTargetCondition_ByPreSelecetedList: null,
  56. canEndSelectCondition: null,
  57. maxCount: 1,
  58. canNoSelect: false,
  59. canEndNotMax: false,
  60. selectPermanentCoroutine: SelectPermanentCoroutine,
  61. afterSelectPermanentCoroutine: null,
  62. mode: SelectPermanentEffect.Mode.Custom,
  63. cardEffect: activateClass);
  64. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  65. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  66. {
  67. selectedPermanent = permanent;
  68. yield return null;
  69. }
  70. if (selectedPermanent != null &&
  71. selectedPermanent.TopCard &&
  72. !selectedPermanent.TopCard.CanNotBeAffected(activateClass) &&
  73. !selectedPermanent.IsSuspended && selectedPermanent.CanSuspend)
  74. {
  75. yield return ContinuousController.instance.StartCoroutine(
  76. new SuspendPermanentsClass(new List<Permanent>() { selectedPermanent },
  77. CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  78. ownDigimon = selectedPermanent.IsSuspended &&
  79. CardEffectCommons.IsOwnerPermanent(selectedPermanent, card);
  80. }
  81. if (ownDigimon && CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition))
  82. {
  83. List<CardSource> selectedCards = new List<CardSource>();
  84. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  85. selectHandEffect.SetUp(
  86. selectPlayer: card.Owner,
  87. canTargetCondition: CanSelectCardCondition,
  88. canTargetCondition_ByPreSelecetedList: null,
  89. canEndSelectCondition: null,
  90. maxCount: 1,
  91. canNoSelect: true,
  92. canEndNotMax: false,
  93. isShowOpponent: true,
  94. selectCardCoroutine: SelectCardCoroutine,
  95. afterSelectCardCoroutine: null,
  96. mode: SelectHandEffect.Mode.Custom,
  97. cardEffect: activateClass);
  98. selectHandEffect.SetUpCustomMessage("Select card to play.",
  99. "The opponent is selecting 1 card to play.");
  100. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  101. yield return StartCoroutine(selectHandEffect.Activate());
  102. IEnumerator SelectCardCoroutine(CardSource cardSource)
  103. {
  104. selectedCards.Add(cardSource);
  105. yield return null;
  106. }
  107. yield return ContinuousController.instance.StartCoroutine(
  108. CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass,
  109. payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  110. }
  111. }
  112. }
  113. }
  114. #endregion
  115. #region When Digivolving
  116. if (timing == EffectTiming.OnEnterFieldAnyone)
  117. {
  118. ActivateClass activateClass = new ActivateClass();
  119. activateClass.SetUpICardEffect("Suspend 1 Digimon", CanUseCondition, card);
  120. activateClass.SetUpActivateClass(CanActivateSharedCondition, ActivateCoroutine, -1, false, EffectDescription());
  121. cardEffects.Add(activateClass);
  122. string EffectDescription()
  123. {
  124. return
  125. "[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.";
  126. }
  127. bool CanUseCondition(Hashtable hashtable)
  128. {
  129. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  130. }
  131. bool CanSelectCardCondition(CardSource cardSource)
  132. {
  133. return cardSource.IsDigimon &&
  134. cardSource.HasBirdTraits &&
  135. cardSource.HasDP &&
  136. cardSource.CardDP <= 3000 &&
  137. CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass);
  138. }
  139. IEnumerator ActivateCoroutine(Hashtable hashtable)
  140. {
  141. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentSharedCondition))
  142. {
  143. Permanent selectedPermanent = null;
  144. bool ownDigimon = false;
  145. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  146. selectPermanentEffect.SetUp(
  147. selectPlayer: card.Owner,
  148. canTargetCondition: CanSelectPermanentSharedCondition,
  149. canTargetCondition_ByPreSelecetedList: null,
  150. canEndSelectCondition: null,
  151. maxCount: 1,
  152. canNoSelect: false,
  153. canEndNotMax: false,
  154. selectPermanentCoroutine: SelectPermanentCoroutine,
  155. afterSelectPermanentCoroutine: null,
  156. mode: SelectPermanentEffect.Mode.Custom,
  157. cardEffect: activateClass);
  158. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  159. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  160. {
  161. selectedPermanent = permanent;
  162. yield return null;
  163. }
  164. if (selectedPermanent != null &&
  165. selectedPermanent.TopCard &&
  166. !selectedPermanent.TopCard.CanNotBeAffected(activateClass) &&
  167. !selectedPermanent.IsSuspended && selectedPermanent.CanSuspend)
  168. {
  169. yield return ContinuousController.instance.StartCoroutine(
  170. new SuspendPermanentsClass(new List<Permanent>() { selectedPermanent },
  171. CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  172. ownDigimon = selectedPermanent.IsSuspended &&
  173. CardEffectCommons.IsOwnerPermanent(selectedPermanent, card);
  174. }
  175. if (ownDigimon && CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition))
  176. {
  177. List<CardSource> selectedCards = new List<CardSource>();
  178. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  179. selectHandEffect.SetUp(
  180. selectPlayer: card.Owner,
  181. canTargetCondition: CanSelectCardCondition,
  182. canTargetCondition_ByPreSelecetedList: null,
  183. canEndSelectCondition: null,
  184. maxCount: 1,
  185. canNoSelect: true,
  186. canEndNotMax: false,
  187. isShowOpponent: true,
  188. selectCardCoroutine: SelectCardCoroutine,
  189. afterSelectCardCoroutine: null,
  190. mode: SelectHandEffect.Mode.Custom,
  191. cardEffect: activateClass);
  192. selectHandEffect.SetUpCustomMessage("Select card to play.",
  193. "The opponent is selecting 1 card to play.");
  194. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  195. yield return StartCoroutine(selectHandEffect.Activate());
  196. IEnumerator SelectCardCoroutine(CardSource cardSource)
  197. {
  198. selectedCards.Add(cardSource);
  199. yield return null;
  200. }
  201. yield return ContinuousController.instance.StartCoroutine(
  202. CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass,
  203. payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  204. }
  205. }
  206. }
  207. }
  208. #endregion
  209. #region Your Turn - ESS
  210. if (timing == EffectTiming.OnAllyAttack)
  211. {
  212. ActivateClass activateClass = new ActivateClass();
  213. activateClass.SetUpICardEffect("Unsuspend this Digimon", CanUseCondition, card);
  214. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription());
  215. activateClass.SetIsInheritedEffect(true);
  216. activateClass.SetHashString("Unsuspend_EX7_034");
  217. cardEffects.Add(activateClass);
  218. string EffectDescription()
  219. {
  220. return "[Your Turn] (Once Per Turn) When this Digimon attacks your opponent's Digimon, you may unsuspend this Digimon.";
  221. }
  222. bool CanUseCondition(Hashtable hashtable)
  223. {
  224. return CardEffectCommons.CanTriggerOnAttack(hashtable, card) &&
  225. CardEffectCommons.IsOwnerTurn(card) &&
  226. CardEffectCommons.IsPermanentExistsOnBattleArea(GManager.instance.attackProcess.DefendingPermanent);
  227. }
  228. bool CanActivateCondition(Hashtable hashtable)
  229. {
  230. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  231. }
  232. IEnumerator ActivateCoroutine(Hashtable hashtable)
  233. {
  234. yield return ContinuousController.instance.StartCoroutine(
  235. new IUnsuspendPermanents(new List<Permanent>() { card.PermanentOfThisCard() }, activateClass).Unsuspend());
  236. }
  237. }
  238. #endregion
  239. return cardEffects;
  240. }
  241. }
  242. }