BT23_029.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Antylamon
  5. namespace DCGO.CardEffects.BT23
  6. {
  7. public class BT23_029 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternative Digivolution Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.EqualsCardName("Turuiemon") || targetPermanent.TopCard.EqualsCardName("Wendigomon")
  18. || (targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.IsLevel4 && targetPermanent.TopCard.HasCSTraits);
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  21. permanentCondition: PermanentCondition,
  22. digivolutionCost: 3,
  23. ignoreDigivolutionRequirement: false,
  24. card: card,
  25. condition: null)
  26. );
  27. }
  28. #endregion
  29. #region Alliance
  30. if (timing == EffectTiming.OnAllyAttack)
  31. {
  32. cardEffects.Add(CardEffectFactory.AllianceSelfEffect(isInheritedEffect: false, card: card, condition: null));
  33. }
  34. #endregion
  35. #region All Turns - OPT
  36. if (timing == EffectTiming.OnEnterFieldAnyone)
  37. {
  38. ActivateClass activateClass = new ActivateClass();
  39. activateClass.SetUpICardEffect("1 digimon gains can't activate [When Digivolving] effects.", CanUseCondition, card);
  40. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  41. activateClass.SetHashString("BT23_029_AT");
  42. cardEffects.Add(activateClass);
  43. string EffectDiscription()
  44. {
  45. return "[All Turns] [Once Per Turn] When any of your cards with the [Beast], [Beastkin] or [CS] trait are played, until your opponent's turn ends, 1 of their Digimon can't activate [When Digivolving] effects.";
  46. }
  47. bool CanUseCondition(Hashtable hashtable)
  48. {
  49. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  50. && CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition);
  51. }
  52. bool CanActivateCondition(Hashtable hashtable)
  53. {
  54. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  55. }
  56. bool PermanentCondition(Permanent permanent)
  57. {
  58. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card)
  59. && (permanent.IsTamer || permanent.IsDigimon)
  60. && (permanent.TopCard.EqualsTraits("Beast") || permanent.TopCard.EqualsTraits("Beastkin") || permanent.TopCard.HasCSTraits);
  61. }
  62. bool IsOpponentsDigimon(Permanent permanent)
  63. {
  64. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  65. }
  66. IEnumerator ActivateCoroutine(Hashtable hashtable)
  67. {
  68. if (CardEffectCommons.HasMatchConditionPermanent(IsOpponentsDigimon))
  69. {
  70. Permanent selectedPermanent = null;
  71. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  72. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(IsOpponentsDigimon));
  73. selectPermanentEffect.SetUp(
  74. selectPlayer: card.Owner,
  75. canTargetCondition: IsOpponentsDigimon,
  76. canTargetCondition_ByPreSelecetedList: null,
  77. canEndSelectCondition: null,
  78. maxCount: maxCount,
  79. canNoSelect: false,
  80. canEndNotMax: false,
  81. selectPermanentCoroutine: SelectedPermanent,
  82. afterSelectPermanentCoroutine: null,
  83. mode: SelectPermanentEffect.Mode.Custom,
  84. cardEffect: activateClass);
  85. IEnumerator SelectedPermanent(Permanent target)
  86. {
  87. selectedPermanent = target;
  88. yield return null;
  89. }
  90. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will gain cant activate [When Digivolving] effects.", "The opponent is selecting 1 Digimon that will gain cant activate [When Digivolving] effects.");
  91. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  92. if (selectedPermanent != null)
  93. {
  94. DisableEffectClass invalidationClass = new DisableEffectClass();
  95. invalidationClass.SetUpICardEffect("Ignore [When Digivolving] Effect", CanUseConditionDebuff, card);
  96. invalidationClass.SetUpDisableEffectClass(DisableCondition: InvalidateCondition);
  97. selectedPermanent.UntilOwnerTurnEndEffects.Add(_ => invalidationClass);
  98. bool CanUseConditionDebuff(Hashtable hashtableDebuff)
  99. {
  100. return true;
  101. }
  102. bool InvalidateCondition(ICardEffect cardEffect)
  103. {
  104. if (selectedPermanent.TopCard != null)
  105. {
  106. if (cardEffect != null)
  107. {
  108. if (cardEffect.EffectSourceCard != null)
  109. {
  110. if (isExistOnField(cardEffect.EffectSourceCard))
  111. {
  112. if (cardEffect.EffectSourceCard.PermanentOfThisCard() == selectedPermanent)
  113. {
  114. if (cardEffect.IsWhenDigivolving)
  115. {
  116. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  117. {
  118. return true;
  119. }
  120. }
  121. }
  122. }
  123. }
  124. }
  125. }
  126. return false;
  127. }
  128. }
  129. }
  130. }
  131. }
  132. #endregion
  133. #region All Turns - ESS - OPT
  134. if (timing == EffectTiming.OnTappedAnyone)
  135. {
  136. ActivateClass activateClass = new ActivateClass();
  137. activateClass.SetUpICardEffect("-4k DP", CanUseCondition, card);
  138. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  139. activateClass.SetIsInheritedEffect(true);
  140. activateClass.SetHashString("BT23_029_ESS");
  141. cardEffects.Add(activateClass);
  142. string EffectDiscription()
  143. {
  144. return "[All Turns] [Once Per Turn] When any of your other Digimon suspend, 1 of your opponent's Digimon gets -4000 DP for the turn.";
  145. }
  146. bool CanUseCondition(Hashtable hashtable)
  147. {
  148. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  149. && CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, IsYourDigimon);
  150. }
  151. bool CanActivateCondition(Hashtable hashtable)
  152. {
  153. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  154. }
  155. bool IsYourDigimon(Permanent permanent)
  156. {
  157. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  158. && permanent != card.PermanentOfThisCard();
  159. }
  160. bool CanSelectPermanentCondition(Permanent permanent)
  161. {
  162. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  163. }
  164. IEnumerator ActivateCoroutine(Hashtable hashtable)
  165. {
  166. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  167. {
  168. Permanent selectedPermament = null;
  169. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  170. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  171. selectPermanentEffect.SetUp(
  172. selectPlayer: card.Owner,
  173. canTargetCondition: CanSelectPermanentCondition,
  174. canTargetCondition_ByPreSelecetedList: null,
  175. canEndSelectCondition: null,
  176. maxCount: maxCount,
  177. canNoSelect: false,
  178. canEndNotMax: false,
  179. selectPermanentCoroutine: SelectPermanentCoroutine,
  180. afterSelectPermanentCoroutine: null,
  181. mode: SelectPermanentEffect.Mode.Custom,
  182. cardEffect: activateClass);
  183. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  184. {
  185. selectedPermament = permanent;
  186. yield return null;
  187. }
  188. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to -4k DP.", "The opponent is selecting 1 Digimon to -4k DP.");
  189. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  190. if (selectedPermament != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  191. targetPermanent: selectedPermament,
  192. changeValue: -4000,
  193. effectDuration: EffectDuration.UntilEachTurnEnd,
  194. activateClass: activateClass));
  195. }
  196. }
  197. }
  198. #endregion
  199. return cardEffects;
  200. }
  201. }
  202. }