BT11_069.cs 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT11
  6. {
  7. public class BT11_069 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.CardNames.Contains("MetalGreymon");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  19. permanentCondition: PermanentCondition,
  20. digivolutionCost: 1,
  21. ignoreDigivolutionRequirement: false,
  22. card: card,
  23. condition: null));
  24. }
  25. if (timing == EffectTiming.OnEnterFieldAnyone)
  26. {
  27. ActivateClass activateClass = new ActivateClass();
  28. activateClass.SetUpICardEffect("This Digimon gets effects and delete 1 Digimon with 6000 DP or less", CanUseCondition, card);
  29. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  30. cardEffects.Add(activateClass);
  31. string EffectDiscription()
  32. {
  33. return "[When Digivolving] Until the end of your opponent's turn, this Digimon can't have its DP reduced by your opponent's effects, and isn't affected by <De-Digivolve> effects. Then, if [MetalGreymon] or [X Antibody] is in this Digimon's digivolution cards, delete 1 of your opponent's Digimon with 6000 DP or less.";
  34. }
  35. bool CanSelectPermanentCondition(Permanent permanent)
  36. {
  37. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  38. {
  39. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(6000, activateClass))
  40. {
  41. return true;
  42. }
  43. }
  44. return false;
  45. }
  46. bool CanUseCondition(Hashtable hashtable)
  47. {
  48. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  49. }
  50. bool CanActivateCondition(Hashtable hashtable)
  51. {
  52. if (CardEffectCommons.IsExistOnBattleArea(card))
  53. {
  54. return true;
  55. }
  56. return false;
  57. }
  58. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  59. {
  60. bool CardEffectCondition(ICardEffect cardEffect)
  61. {
  62. return CardEffectCommons.IsOpponentEffect(cardEffect, card);
  63. }
  64. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainImmuneFromDPMinus(
  65. targetPermanent: card.PermanentOfThisCard(),
  66. cardEffectCondition: CardEffectCondition,
  67. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  68. activateClass: activateClass,
  69. effectName: "Can't have DP reduced by opponent's effect"));
  70. Permanent selectedPermanent = card.PermanentOfThisCard();
  71. if (selectedPermanent != null)
  72. {
  73. ImmuneFromDeDigivolveClass immuneFromDeDigivolveClass = new ImmuneFromDeDigivolveClass();
  74. immuneFromDeDigivolveClass.SetUpICardEffect("Isn't affected by <De-Digivolve>", CanUseCondition1, selectedPermanent.TopCard);
  75. immuneFromDeDigivolveClass.SetUpImmuneFromDeDigivolveClass(PermanentCondition: PermanentCondition);
  76. selectedPermanent.UntilOpponentTurnEndEffects.Add((_timing) => immuneFromDeDigivolveClass);
  77. bool CanUseCondition1(Hashtable hashtable1)
  78. {
  79. if (selectedPermanent.TopCard != null)
  80. {
  81. return true;
  82. }
  83. return false;
  84. }
  85. bool PermanentCondition(Permanent permanent)
  86. {
  87. if (permanent == selectedPermanent)
  88. {
  89. return true;
  90. }
  91. return false;
  92. }
  93. }
  94. if (CardEffectCommons.IsExistOnBattleArea(card))
  95. {
  96. if (card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.CardNames.Contains("MetalGreymon") || cardSource.CardNames.Contains("X Antibody") || cardSource.CardNames.Contains("XAntibody")) >= 1)
  97. {
  98. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  99. {
  100. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  101. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  102. selectPermanentEffect.SetUp(
  103. selectPlayer: card.Owner,
  104. canTargetCondition: CanSelectPermanentCondition,
  105. canTargetCondition_ByPreSelecetedList: null,
  106. canEndSelectCondition: null,
  107. maxCount: maxCount,
  108. canNoSelect: false,
  109. canEndNotMax: false,
  110. selectPermanentCoroutine: null,
  111. afterSelectPermanentCoroutine: null,
  112. mode: SelectPermanentEffect.Mode.Destroy,
  113. cardEffect: activateClass);
  114. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  115. }
  116. }
  117. }
  118. }
  119. }
  120. if (timing == EffectTiming.OnUnTappedAnyone)
  121. {
  122. ActivateClass activateClass = new ActivateClass();
  123. activateClass.SetUpICardEffect("Trash the top card of opponent's security", CanUseCondition, card);
  124. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  125. activateClass.SetIsInheritedEffect(true);
  126. activateClass.SetHashString("TrashSecurity_BT11_069");
  127. cardEffects.Add(activateClass);
  128. string EffectDiscription()
  129. {
  130. return "[Opponent's Turn][Once Per Turn] When a Digimon becomes unsuspended, if this Digimon has [Greymon] or [Omnimon] in its name, trash the top card of your opponent's security stack.";
  131. }
  132. bool PermanentCondition(Permanent permanent)
  133. {
  134. if (CardEffectCommons.IsPermanentExistsOnBattleArea(permanent))
  135. {
  136. if (permanent.IsDigimon)
  137. {
  138. return true;
  139. }
  140. }
  141. return false;
  142. }
  143. bool CanUseCondition(Hashtable hashtable)
  144. {
  145. if (CardEffectCommons.IsExistOnBattleArea(card))
  146. {
  147. if (CardEffectCommons.IsOpponentTurn(card))
  148. {
  149. if (CardEffectCommons.CanTriggerWhenPermanentUnsuspends(hashtable, PermanentCondition))
  150. {
  151. return true;
  152. }
  153. }
  154. }
  155. return false;
  156. }
  157. bool CanActivateCondition(Hashtable hashtable)
  158. {
  159. if (CardEffectCommons.IsExistOnBattleArea(card))
  160. {
  161. if (card.PermanentOfThisCard().TopCard.HasGreymonName)
  162. {
  163. return true;
  164. }
  165. if (card.PermanentOfThisCard().TopCard.ContainsCardName("Omnimon"))
  166. {
  167. return true;
  168. }
  169. }
  170. return false;
  171. }
  172. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  173. {
  174. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  175. player: card.Owner.Enemy,
  176. destroySecurityCount: 1,
  177. cardEffect: activateClass,
  178. fromTop: true).DestroySecurity());
  179. }
  180. }
  181. return cardEffects;
  182. }
  183. }
  184. }