BT20_059.cs 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT20
  5. {
  6. public class BT20_059 : 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.EqualsCardName("Gankoomon");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  19. }
  20. #endregion
  21. #region When Digivolving
  22. if (timing == EffectTiming.OnEnterFieldAnyone)
  23. {
  24. ActivateClass activateClass = new ActivateClass();
  25. activateClass.SetUpICardEffect("<De-Digivolve 2>, then your Digimon or unaffected by Digimon effects", CanUseCondition, card);
  26. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  27. activateClass.SetIsDigimonEffect(true);
  28. cardEffects.Add(activateClass);
  29. string EffectDiscription()
  30. {
  31. return "[When Digivolving] <De-Digivolve 2> 1 of your opponent's Digimon. Then, if [Gankoomon] or [X Antibody] is in this Digimon's digivolution cards, until the end of your opponent's turn, none of your Digimon are affected by your opponent's Digimon effects.";
  32. }
  33. bool CanSelectDeDigivolveTarget(Permanent permanent)
  34. {
  35. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  36. }
  37. bool HasGankooOrXAnti()
  38. {
  39. return card.PermanentOfThisCard().DigivolutionCards.Count(source => source.EqualsCardName("Gankoomon") || source.EqualsCardName("X Antibody")) > 0;
  40. }
  41. bool CanUseCondition(Hashtable hashtable)
  42. {
  43. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  44. CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  45. }
  46. bool CanActivateCondition(Hashtable hashtable)
  47. {
  48. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  49. }
  50. IEnumerator ActivateCoroutine(Hashtable hashtable)
  51. {
  52. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectDeDigivolveTarget))
  53. {
  54. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  55. selectPermanentEffect.SetUp(
  56. selectPlayer: card.Owner,
  57. canTargetCondition: CanSelectDeDigivolveTarget,
  58. canTargetCondition_ByPreSelecetedList: null,
  59. canEndSelectCondition: null,
  60. maxCount: 1,
  61. canNoSelect: false,
  62. canEndNotMax: false,
  63. selectPermanentCoroutine: SelectPermanentCoroutine,
  64. afterSelectPermanentCoroutine: null,
  65. mode: SelectPermanentEffect.Mode.Custom,
  66. cardEffect: activateClass);
  67. selectPermanentEffect.SetUpCustomMessage("Select Digimon to De-Digivolve.", "The opponent is selecting Digimon to De-Digivolve.");
  68. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  69. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  70. {
  71. if (permanent != null)
  72. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(permanent, 2, activateClass).Degeneration());
  73. yield return null;
  74. }
  75. }
  76. if (HasGankooOrXAnti())
  77. {
  78. CanNotAffectedClass canNotAffectedClass = new CanNotAffectedClass();
  79. canNotAffectedClass.SetUpICardEffect("Isn't affected by opponent's Digimon's effects", CanUseConditionImmunity, card);
  80. canNotAffectedClass.SetUpCanNotAffectedClass(CardCondition: CardCondition, SkillCondition: SkillCondition);
  81. card.Owner.UntilOpponentTurnEndEffects.Add(GetCardEffect);
  82. card.Owner.UntilOpponentTurnEndEffects.Add(GetDetailEffect);
  83. bool CanUseConditionImmunity(Hashtable hashtable)
  84. {
  85. return true;
  86. }
  87. bool CardCondition(CardSource cardSource)
  88. {
  89. if (CardEffectCommons.IsExistOnBattleAreaDigimon(cardSource))
  90. {
  91. if (card.Owner == cardSource.Owner)
  92. {
  93. return true;
  94. }
  95. }
  96. return false;
  97. }
  98. bool SkillCondition(ICardEffect cardEffect)
  99. {
  100. if (CardEffectCommons.IsOpponentEffect(cardEffect, card))
  101. {
  102. if (cardEffect.IsDigimonEffect)
  103. {
  104. return true;
  105. }
  106. }
  107. return false;
  108. }
  109. ICardEffect GetCardEffect(EffectTiming _timing)
  110. {
  111. if (_timing == EffectTiming.None)
  112. {
  113. return canNotAffectedClass;
  114. }
  115. return null;
  116. }
  117. bool PermanentCondition(Permanent permanent)
  118. {
  119. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  120. }
  121. ICardEffect GetDetailEffect(EffectTiming timing)
  122. {
  123. if (timing == EffectTiming.None)
  124. {
  125. return CardEffectFactory.AddDetailClass(CanUseConditionImmunity, PermanentCondition, "Isn't affected by opponent's Digimon's effects", false, card);
  126. }
  127. return null;
  128. }
  129. }
  130. }
  131. }
  132. #endregion
  133. #region Opponents Turn
  134. if (timing == EffectTiming.None)
  135. {
  136. bool PermanentCondition(Permanent permanent)
  137. {
  138. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  139. {
  140. if (permanent.TopCard.ContainsCardName("Sistermon") || permanent.TopCard.ContainsCardName("Huckmon"))
  141. return true;
  142. if (permanent.TopCard.HasRoyalKnightTraits)
  143. return true;
  144. }
  145. return false;
  146. }
  147. bool Condition()
  148. {
  149. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  150. {
  151. if (CardEffectCommons.IsOpponentTurn(card))
  152. {
  153. return true;
  154. }
  155. }
  156. return false;
  157. }
  158. cardEffects.Add(CardEffectFactory.RebootStaticEffect(permanentCondition: PermanentCondition, isInheritedEffect: false, card: card, Condition));
  159. cardEffects.Add(CardEffectFactory.BlockerStaticEffect(permanentCondition: PermanentCondition, isInheritedEffect: false, card: card, Condition));
  160. }
  161. #endregion
  162. #region Opponents Turn - ESS
  163. if (timing == EffectTiming.None)
  164. {
  165. bool PermanentCondition(Permanent permanent)
  166. {
  167. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  168. }
  169. bool Condition()
  170. {
  171. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  172. {
  173. if (CardEffectCommons.IsOpponentTurn(card))
  174. {
  175. return card.PermanentOfThisCard().TopCard.EqualsCardName("Jesmon GX");
  176. }
  177. }
  178. return false;
  179. }
  180. cardEffects.Add(CardEffectFactory.RebootStaticEffect(permanentCondition: PermanentCondition, isInheritedEffect: true, card: card, Condition));
  181. cardEffects.Add(CardEffectFactory.BlockerStaticEffect(permanentCondition: PermanentCondition, isInheritedEffect: true, card: card, Condition));
  182. }
  183. #endregion
  184. return cardEffects;
  185. }
  186. }
  187. }