EX3_044.cs 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.EX3
  5. {
  6. public class EX3_044 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.None)
  12. {
  13. bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.CardNames.Contains("Wingdramon") || targetPermanent.TopCard.CardNames.Contains("Groundramon");
  16. }
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  18. }
  19. if (timing == EffectTiming.OnTappedAnyone)
  20. {
  21. ActivateClass activateClass = new ActivateClass();
  22. activateClass.SetUpICardEffect("Suspend 1 Digimon", CanUseCondition, card);
  23. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  24. activateClass.SetHashString("Suspend_EX3_044");
  25. cardEffects.Add(activateClass);
  26. string EffectDiscription()
  27. {
  28. return "[All Turns][Once Per Turn] When this Digimon becomes suspended, suspend 1 of your opponent's Digimon.";
  29. }
  30. bool CanSelectPermanentCondition(Permanent permanent)
  31. {
  32. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  33. }
  34. bool CanUseCondition(Hashtable hashtable)
  35. {
  36. if (CardEffectCommons.IsExistOnBattleArea(card))
  37. {
  38. if (CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, (permanent) => permanent == card.PermanentOfThisCard()))
  39. {
  40. return true;
  41. }
  42. }
  43. return false;
  44. }
  45. bool CanActivateCondition(Hashtable hashtable)
  46. {
  47. if (CardEffectCommons.IsExistOnBattleArea(card))
  48. {
  49. return true;
  50. }
  51. return false;
  52. }
  53. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  54. {
  55. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  56. {
  57. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  58. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  59. selectPermanentEffect.SetUp(
  60. selectPlayer: card.Owner,
  61. canTargetCondition: CanSelectPermanentCondition,
  62. canTargetCondition_ByPreSelecetedList: null,
  63. canEndSelectCondition: null,
  64. maxCount: maxCount,
  65. canNoSelect: false,
  66. canEndNotMax: false,
  67. selectPermanentCoroutine: null,
  68. afterSelectPermanentCoroutine: null,
  69. mode: SelectPermanentEffect.Mode.Tap,
  70. cardEffect: activateClass);
  71. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  72. }
  73. }
  74. }
  75. if (timing == EffectTiming.OnEndBattle)
  76. {
  77. ActivateClass activateClass = new ActivateClass();
  78. activateClass.SetUpICardEffect("Trash the top card of opponent's security", CanUseCondition, card);
  79. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  80. activateClass.SetHashString("TrashSecurity_EX3_044");
  81. cardEffects.Add(activateClass);
  82. string EffectDiscription()
  83. {
  84. return "[All Turns][Once Per Turn] When one of your Digimon with [Dramon] or [Examon] in its name deletes an opponent's Digimon in battle and survives, trash the top card of your opponent's security stack.";
  85. }
  86. bool PermanentCondition(Permanent permanent)
  87. {
  88. if (permanent.TopCard.Owner == card.Owner)
  89. {
  90. if (permanent.TopCard.HasDramonName)
  91. {
  92. return true;
  93. }
  94. if (permanent.TopCard.ContainsCardName("Examon"))
  95. {
  96. return true;
  97. }
  98. }
  99. return false;
  100. }
  101. bool CanUseCondition(Hashtable hashtable)
  102. {
  103. if (CardEffectCommons.IsExistOnBattleArea(card))
  104. {
  105. bool WinnerCondition(Permanent permanent) => PermanentCondition(permanent);
  106. bool LoserCondition(Permanent permanent) => CardEffectCommons.IsOpponentPermanent(permanent, card);
  107. if (CardEffectCommons.CanTriggerWhenDeleteOpponentDigimonByBattle(hashtable: hashtable, winnerCondition: WinnerCondition, loserCondition: LoserCondition, isOnlyWinnerSurvive: true))
  108. {
  109. return true;
  110. }
  111. }
  112. return false;
  113. }
  114. bool CanActivateCondition(Hashtable hashtable)
  115. {
  116. if (CardEffectCommons.IsExistOnBattleArea(card))
  117. {
  118. return true;
  119. }
  120. return false;
  121. }
  122. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  123. {
  124. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  125. player: card.Owner.Enemy,
  126. destroySecurityCount: 1,
  127. cardEffect: activateClass,
  128. fromTop: true).DestroySecurity());
  129. }
  130. }
  131. if (timing == EffectTiming.OnEndBattle)
  132. {
  133. ActivateClass activateClass = new ActivateClass();
  134. activateClass.SetUpICardEffect("Trash the top card of opponent's security", CanUseCondition, card);
  135. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  136. activateClass.SetIsInheritedEffect(true);
  137. activateClass.SetHashString("TrashSecurity_EX3_044_Inherited");
  138. cardEffects.Add(activateClass);
  139. string EffectDiscription()
  140. {
  141. return "[All Turns][Once Per Turn] When one of your Digimon with [Dramon] or [Examon] in its name deletes an opponent's Digimon in battle and survives, trash the top card of your opponent's security stack.";
  142. }
  143. bool PermanentCondition(Permanent permanent)
  144. {
  145. if (permanent.TopCard.Owner == card.Owner)
  146. {
  147. if (permanent.TopCard.HasDramonName)
  148. {
  149. return true;
  150. }
  151. if (permanent.TopCard.ContainsCardName("Examon"))
  152. {
  153. return true;
  154. }
  155. }
  156. return false;
  157. }
  158. bool CanUseCondition(Hashtable hashtable)
  159. {
  160. if (CardEffectCommons.IsExistOnBattleArea(card))
  161. {
  162. bool WinnerCondition(Permanent permanent) => PermanentCondition(permanent);
  163. bool LoserCondition(Permanent permanent) => CardEffectCommons.IsOpponentPermanent(permanent, card);
  164. if (CardEffectCommons.CanTriggerWhenDeleteOpponentDigimonByBattle(hashtable: hashtable, winnerCondition: WinnerCondition, loserCondition: LoserCondition, isOnlyWinnerSurvive: true))
  165. {
  166. return true;
  167. }
  168. }
  169. return false;
  170. }
  171. bool CanActivateCondition(Hashtable hashtable)
  172. {
  173. if (CardEffectCommons.IsExistOnBattleArea(card))
  174. {
  175. return true;
  176. }
  177. return false;
  178. }
  179. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  180. {
  181. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  182. player: card.Owner.Enemy,
  183. destroySecurityCount: 1,
  184. cardEffect: activateClass,
  185. fromTop: true).DestroySecurity());
  186. }
  187. }
  188. return cardEffects;
  189. }
  190. }
  191. }