EX9_042.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. //Toropiamon
  4. namespace DCGO.CardEffects.EX9
  5. {
  6. public class EX9_042 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternate Digivolution Requirement
  12. if (timing == EffectTiming.None)
  13. {
  14. static bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.HasWGTraits && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 4;
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  19. }
  20. #endregion
  21. #region On Play/When Digivolving Shared
  22. bool OpponentsDigimon(Permanent permanent)
  23. {
  24. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  25. }
  26. #endregion
  27. #region On Play
  28. if (timing == EffectTiming.OnEnterFieldAnyone)
  29. {
  30. ActivateClass activateClass = new ActivateClass();
  31. activateClass.SetUpICardEffect("Suspend 1 Digimon, 1 Digimon Can't Unsuspend", CanUseCondition, card);
  32. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  33. cardEffects.Add(activateClass);
  34. string EffectDiscription()
  35. {
  36. return "[On Play] Suspend 1 of your opponent's Digimon. Then, 1 of their Digimon can't unsuspend until their turn ends.";
  37. }
  38. bool CanUseCondition(Hashtable hashtable)
  39. {
  40. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  41. }
  42. bool CanActivateCondition(Hashtable hashtable)
  43. {
  44. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  45. }
  46. IEnumerator ActivateCoroutine(Hashtable hashtable)
  47. {
  48. if (CardEffectCommons.HasMatchConditionPermanent(OpponentsDigimon))
  49. {
  50. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  51. selectPermanentEffect.SetUp(
  52. selectPlayer: card.Owner,
  53. canTargetCondition: OpponentsDigimon,
  54. canTargetCondition_ByPreSelecetedList: null,
  55. canEndSelectCondition: null,
  56. maxCount: 1,
  57. canNoSelect: false,
  58. canEndNotMax: false,
  59. selectPermanentCoroutine: null,
  60. afterSelectPermanentCoroutine: null,
  61. mode: SelectPermanentEffect.Mode.Tap,
  62. cardEffect: activateClass);
  63. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  64. selectPermanentEffect.SetUp(
  65. selectPlayer: card.Owner,
  66. canTargetCondition: OpponentsDigimon,
  67. canTargetCondition_ByPreSelecetedList: null,
  68. canEndSelectCondition: null,
  69. maxCount: 1,
  70. canNoSelect: false,
  71. canEndNotMax: false,
  72. selectPermanentCoroutine: SelectPermanentCoroutine,
  73. afterSelectPermanentCoroutine: null,
  74. mode: SelectPermanentEffect.Mode.Custom,
  75. cardEffect: activateClass);
  76. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will not unsuspend.", "The opponent is selecting 1 Digimon that will not unsuspend.");
  77. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  78. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  79. {
  80. Permanent selectedPermanent = permanent;
  81. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotUnsuspend(
  82. targetPermanent: selectedPermanent,
  83. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  84. activateClass: activateClass,
  85. condition: null,
  86. effectName: "Can't unsuspend"
  87. ));
  88. }
  89. }
  90. yield return null;
  91. }
  92. }
  93. #endregion
  94. #region When Digivolving
  95. if (timing == EffectTiming.OnEnterFieldAnyone)
  96. {
  97. ActivateClass activateClass = new ActivateClass();
  98. activateClass.SetUpICardEffect("Suspend 1 Digimon, 1 Digimon Can't Unsuspend", CanUseCondition, card);
  99. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  100. cardEffects.Add(activateClass);
  101. string EffectDiscription()
  102. {
  103. return "[When Digivolving] Suspend 1 of your opponent's Digimon. Then, 1 of their Digimon can't unsuspend until their turn ends.";
  104. }
  105. bool CanUseCondition(Hashtable hashtable)
  106. {
  107. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  108. CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  109. }
  110. bool CanActivateCondition(Hashtable hashtable)
  111. {
  112. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  113. }
  114. IEnumerator ActivateCoroutine(Hashtable hashtable)
  115. {
  116. if (CardEffectCommons.HasMatchConditionPermanent(OpponentsDigimon))
  117. {
  118. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  119. selectPermanentEffect.SetUp(
  120. selectPlayer: card.Owner,
  121. canTargetCondition: OpponentsDigimon,
  122. canTargetCondition_ByPreSelecetedList: null,
  123. canEndSelectCondition: null,
  124. maxCount: 1,
  125. canNoSelect: false,
  126. canEndNotMax: false,
  127. selectPermanentCoroutine: null,
  128. afterSelectPermanentCoroutine: null,
  129. mode: SelectPermanentEffect.Mode.Tap,
  130. cardEffect: activateClass);
  131. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  132. selectPermanentEffect.SetUp(
  133. selectPlayer: card.Owner,
  134. canTargetCondition: OpponentsDigimon,
  135. canTargetCondition_ByPreSelecetedList: null,
  136. canEndSelectCondition: null,
  137. maxCount: 1,
  138. canNoSelect: false,
  139. canEndNotMax: false,
  140. selectPermanentCoroutine: SelectPermanentCoroutine,
  141. afterSelectPermanentCoroutine: null,
  142. mode: SelectPermanentEffect.Mode.Custom,
  143. cardEffect: activateClass);
  144. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will not unsuspend.", "The opponent is selecting 1 Digimon that will not unsuspend.");
  145. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  146. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  147. {
  148. Permanent selectedPermanent = permanent;
  149. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotUnsuspend(
  150. targetPermanent: selectedPermanent,
  151. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  152. activateClass: activateClass,
  153. condition: null,
  154. effectName: "Can't unsuspend"
  155. ));
  156. }
  157. }
  158. yield return null;
  159. }
  160. }
  161. #endregion
  162. #region All Turns
  163. if (timing == EffectTiming.OnTappedAnyone)
  164. {
  165. ActivateClass activateClass = new ActivateClass();
  166. activateClass.SetUpICardEffect("Digivolve into a [WG] trait", CanUseCondition, card);
  167. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  168. activateClass.SetHashString("Digivolve_EX9-042");
  169. cardEffects.Add(activateClass);
  170. bool MyWGTraitDigimon(Permanent permanent)
  171. {
  172. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  173. permanent.TopCard.HasWGTraits;
  174. }
  175. bool DigivolutionTarget(CardSource source)
  176. {
  177. return source.HasWGTraits &&
  178. source.CanPlayCardTargetFrame(card.PermanentOfThisCard().PermanentFrame, false, activateClass);
  179. }
  180. string EffectDiscription()
  181. {
  182. return "[All Turns] [Once Per Turn] When effects suspend any of your [WG] trait Digimon, this Digimon may digivolve into a [WG] trait Digimon card in the hand without paying the cost.";
  183. }
  184. bool CanUseCondition(Hashtable hashtable)
  185. {
  186. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  187. CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, MyWGTraitDigimon) &&
  188. CardEffectCommons.IsByEffect(hashtable, null);
  189. }
  190. bool CanActivateCondition(Hashtable hashtable)
  191. {
  192. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  193. CardEffectCommons.HasMatchConditionOwnersHand(card, DigivolutionTarget);
  194. }
  195. IEnumerator ActivateCoroutine(Hashtable hashtable)
  196. {
  197. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  198. targetPermanent: card.PermanentOfThisCard(),
  199. cardCondition: DigivolutionTarget,
  200. payCost: false,
  201. reduceCostTuple: null,
  202. fixedCostTuple: null,
  203. ignoreDigivolutionRequirementFixedCost: -1,
  204. isHand: true,
  205. activateClass: activateClass,
  206. successProcess: null));
  207. }
  208. }
  209. #endregion
  210. #region End of your Turn - ESS
  211. if (timing == EffectTiming.OnEndTurn)
  212. {
  213. ActivateClass activateClass = new ActivateClass();
  214. activateClass.SetUpICardEffect("[WG] trait may unsuspend", CanUseCondition, card);
  215. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  216. activateClass.SetHashString("EOT_EX9-042");
  217. activateClass.SetIsInheritedEffect(true);
  218. cardEffects.Add(activateClass);
  219. string EffectDiscription()
  220. {
  221. return "[End of Your Turn] [Once Per Turn] 1 of your Digimon with the [WG] trait may unsuspend.";
  222. }
  223. bool CanSelectDigimonPermanentCondition(Permanent permanent)
  224. {
  225. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  226. permanent.TopCard.HasWGTraits;
  227. }
  228. bool CanUseCondition(Hashtable hashtable)
  229. {
  230. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  231. CardEffectCommons.IsOwnerTurn(card);
  232. }
  233. bool CanActivateCondition(Hashtable hashtable)
  234. {
  235. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  236. }
  237. IEnumerator ActivateCoroutine(Hashtable hashtable)
  238. {
  239. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  240. selectPermanentEffect.SetUp(
  241. selectPlayer: card.Owner,
  242. canTargetCondition: CanSelectDigimonPermanentCondition,
  243. canTargetCondition_ByPreSelecetedList: null,
  244. canEndSelectCondition: null,
  245. maxCount: 1,
  246. canNoSelect: true,
  247. canEndNotMax: false,
  248. selectPermanentCoroutine: null,
  249. afterSelectPermanentCoroutine: null,
  250. mode: SelectPermanentEffect.Mode.UnTap,
  251. cardEffect: activateClass);
  252. selectPermanentEffect.SetUpCustomMessage(
  253. "Select 1 Digimon that will unsuspend.",
  254. "The opponent is selecting 1 Digimon that will unsuspend.");
  255. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  256. }
  257. }
  258. #endregion
  259. return cardEffects;
  260. }
  261. }
  262. }