EX7_035.cs 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.EX7
  4. {
  5. public class EX7_035 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Alternate Digivolution
  11. if (timing == EffectTiming.None)
  12. {
  13. bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.IsLevel4 && targetPermanent.TopCard.ContainsTraits("NSp");
  16. }
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  18. permanentCondition: PermanentCondition,
  19. digivolutionCost: 3,
  20. ignoreDigivolutionRequirement: false,
  21. card: card,
  22. condition: null)
  23. );
  24. }
  25. #endregion
  26. #region On Play
  27. if (timing == EffectTiming.OnEnterFieldAnyone)
  28. {
  29. ActivateClass activateClass = new ActivateClass();
  30. activateClass.SetUpICardEffect("Suspend 1 of your opponent's Digimon.", CanUseCondition, card);
  31. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  32. cardEffects.Add(activateClass);
  33. string EffectDescription()
  34. {
  35. return
  36. "[On Play] Suspend 1 of your opponent's Digimon. That Digimon can't unsuspend until the end of their turn.";
  37. }
  38. bool CanUseCondition(Hashtable hashtable)
  39. {
  40. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  41. }
  42. bool CanSelectPermanentCondition(Permanent permanent)
  43. {
  44. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  45. }
  46. bool CanActivateCondition(Hashtable hashtable)
  47. {
  48. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  49. CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
  50. }
  51. IEnumerator ActivateCoroutine(Hashtable hashtable)
  52. {
  53. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  54. {
  55. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  56. selectPermanentEffect.SetUp(
  57. selectPlayer: card.Owner,
  58. canTargetCondition: CanSelectPermanentCondition,
  59. canTargetCondition_ByPreSelecetedList: null,
  60. canEndSelectCondition: null,
  61. maxCount: 1,
  62. canNoSelect: false,
  63. canEndNotMax: false,
  64. selectPermanentCoroutine: null,
  65. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  66. mode: SelectPermanentEffect.Mode.Tap,
  67. cardEffect: activateClass);
  68. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  69. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  70. {
  71. foreach (Permanent selectedPermanent in permanents)
  72. {
  73. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotUnsuspend(
  74. targetPermanent: selectedPermanent,
  75. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  76. activateClass: activateClass,
  77. condition: null,
  78. effectName: "Can't unsuspend"
  79. ));
  80. }
  81. }
  82. }
  83. }
  84. }
  85. #endregion
  86. #region When Digivolving
  87. if (timing == EffectTiming.OnEnterFieldAnyone)
  88. {
  89. ActivateClass activateClass = new ActivateClass();
  90. activateClass.SetUpICardEffect("Suspend 1 of your opponent's Digimon.", CanUseCondition, card);
  91. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  92. cardEffects.Add(activateClass);
  93. string EffectDescription()
  94. {
  95. return
  96. "[When Digivolving] Suspend 1 of your opponent's Digimon. That Digimon can't unsuspend until the end of their turn.";
  97. }
  98. bool CanUseCondition(Hashtable hashtable)
  99. {
  100. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  101. }
  102. bool CanSelectPermanentCondition(Permanent permanent)
  103. {
  104. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  105. }
  106. bool CanActivateCondition(Hashtable hashtable)
  107. {
  108. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  109. CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
  110. }
  111. IEnumerator ActivateCoroutine(Hashtable hashtable)
  112. {
  113. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  114. {
  115. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  116. selectPermanentEffect.SetUp(
  117. selectPlayer: card.Owner,
  118. canTargetCondition: CanSelectPermanentCondition,
  119. canTargetCondition_ByPreSelecetedList: null,
  120. canEndSelectCondition: null,
  121. maxCount: 1,
  122. canNoSelect: false,
  123. canEndNotMax: false,
  124. selectPermanentCoroutine: null,
  125. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  126. mode: SelectPermanentEffect.Mode.Tap,
  127. cardEffect: activateClass);
  128. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  129. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  130. {
  131. foreach (Permanent selectedPermanent in permanents)
  132. {
  133. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotUnsuspend(
  134. targetPermanent: selectedPermanent,
  135. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  136. activateClass: activateClass,
  137. condition: null,
  138. effectName: "Can't unsuspend"
  139. ));
  140. }
  141. }
  142. }
  143. }
  144. }
  145. #endregion
  146. #region All Turns - ESS
  147. if (timing == EffectTiming.OnEndBattle)
  148. {
  149. ActivateClass activateClass = new ActivateClass();
  150. activateClass.SetUpICardEffect("Trash opponent's 1 Security", CanUseCondition, card);
  151. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  152. activateClass.SetIsInheritedEffect(true);
  153. activateClass.SetHashString("TrashSecurity_EX7_035");
  154. cardEffects.Add(activateClass);
  155. string EffectDescription()
  156. {
  157. return
  158. "[All Turns] [Once Per Turn] When this Digimon deletes an opponent's Digimon in battle, trash the top card of your opponent's security stack.";
  159. }
  160. bool WinnerCondition(Permanent permanent) => permanent.cardSources.Contains(card);
  161. bool LoserCondition(Permanent permanent) => CardEffectCommons.IsOpponentPermanent(permanent, card);
  162. bool CanUseCondition(Hashtable hashtable)
  163. {
  164. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  165. CardEffectCommons.CanTriggerWhenDeleteOpponentDigimonByBattle(hashtable: hashtable,
  166. winnerCondition: WinnerCondition, loserCondition: LoserCondition, isOnlyWinnerSurvive: false);
  167. }
  168. bool CanActivateCondition(Hashtable hashtable)
  169. {
  170. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  171. card.Owner.Enemy.SecurityCards.Count >= 1;
  172. }
  173. IEnumerator ActivateCoroutine(Hashtable hashtable)
  174. {
  175. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  176. player: card.Owner.Enemy,
  177. destroySecurityCount: 1,
  178. cardEffect: activateClass,
  179. fromTop: true).DestroySecurity());
  180. }
  181. }
  182. #endregion
  183. return cardEffects;
  184. }
  185. }
  186. }