EX11_035.cs 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System;
  5. namespace DCGO.CardEffects.EX11
  6. {
  7. // Zephagamon
  8. public class EX11_035 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Piercing
  14. if (timing == EffectTiming.OnDetermineDoSecurityCheck)
  15. {
  16. cardEffects.Add(CardEffectFactory.PierceSelfEffect(isInheritedEffect: false, card: card, condition: null));
  17. }
  18. #endregion
  19. #region Vortex
  20. if (timing == EffectTiming.OnEndTurn)
  21. {
  22. cardEffects.Add(CardEffectFactory.VortexSelfEffect(isInheritedEffect: false, card: card,
  23. condition: null));
  24. }
  25. #endregion
  26. #region Blocker
  27. if (timing == EffectTiming.None)
  28. {
  29. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  30. }
  31. #endregion
  32. #region When Digivolving
  33. if (timing == EffectTiming.OnEnterFieldAnyone)
  34. {
  35. ActivateClass activateClass = new ActivateClass();
  36. activateClass.SetUpICardEffect("May unsuspend 1. May suspend 1.", CanUseCondition, card);
  37. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  38. cardEffects.Add(activateClass);
  39. string EffectDescription() => "[When Digivolving] You may unsuspend 1 Digimon. Then, you may suspend 1 Digimon.";
  40. bool CanUseCondition(Hashtable hashtable)
  41. {
  42. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  43. && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  44. }
  45. bool CanActivateCondition(Hashtable hashtable)
  46. {
  47. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  48. }
  49. bool CanSelectPermanentCondition(Permanent permanent)
  50. {
  51. return CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent);
  52. }
  53. IEnumerator ActivateCoroutine(Hashtable hashtable)
  54. {
  55. #region Unsuspend 1 Digimon
  56. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  57. {
  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: 1,
  65. canNoSelect: true,
  66. canEndNotMax: false,
  67. selectPermanentCoroutine: null,
  68. afterSelectPermanentCoroutine: null,
  69. mode: SelectPermanentEffect.Mode.UnTap,
  70. cardEffect: activateClass);
  71. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to unsuspend", "Opponent is selecting 1 Digimon to unsuspend");
  72. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  73. }
  74. #endregion
  75. #region Suspend 1 Digimon
  76. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  77. {
  78. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  79. selectPermanentEffect.SetUp(
  80. selectPlayer: card.Owner,
  81. canTargetCondition: CanSelectPermanentCondition,
  82. canTargetCondition_ByPreSelecetedList: null,
  83. canEndSelectCondition: null,
  84. maxCount: 1,
  85. canNoSelect: true,
  86. canEndNotMax: false,
  87. selectPermanentCoroutine: null,
  88. afterSelectPermanentCoroutine: null,
  89. mode: SelectPermanentEffect.Mode.Tap,
  90. cardEffect: activateClass);
  91. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to suspend", "Opponent is selecting 1 Digimon to suspend");
  92. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  93. }
  94. #endregion
  95. }
  96. }
  97. #endregion
  98. #region All Turns
  99. if (timing == EffectTiming.OnTappedAnyone)
  100. {
  101. ActivateClass activateClass = new ActivateClass();
  102. activateClass.SetUpICardEffect("You may play 1 Digimon with 3k DP, +2k per suspended Digimon", CanUseCondition, card);
  103. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription());
  104. activateClass.SetHashString("EX11_035_AT");
  105. cardEffects.Add(activateClass);
  106. string EffectDescription()
  107. => "[All Turns] [Once Per Turn] When any of your Digimon suspend, you may play 1 3000 DP or lower green Digimon card with [Avian] or [Bird] in any of its traits from your hand without paying the cost. For each suspended Digimon, add 2000 to this effect's DP maximum.";
  108. bool PermanentCondition(Permanent permanent)
  109. {
  110. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  111. }
  112. bool CanUseCondition(Hashtable hashtable)
  113. {
  114. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  115. && CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, PermanentCondition);
  116. }
  117. bool CanActivateCondition(Hashtable hashtable)
  118. {
  119. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  120. }
  121. bool CanSelectCardCondition(CardSource cardSource, int DP)
  122. {
  123. return cardSource.IsDigimon
  124. && cardSource.HasCardColor(CardColor.Green)
  125. && cardSource.HasDP
  126. && cardSource.CardDP <= DP
  127. && (cardSource.ContainsTraits("Avian")
  128. || cardSource.ContainsTraits("Bird"))
  129. && CardEffectCommons.CanPlayAsNewPermanent(cardSource, false, activateClass);
  130. }
  131. bool IsSuspendedDigimon(Permanent permanent)
  132. {
  133. return permanent.IsDigimon
  134. && permanent.IsSuspended;
  135. }
  136. IEnumerator ActivateCoroutine(Hashtable hashtable)
  137. {
  138. int DP = 3000 + (CardEffectCommons.MatchConditionPermanentCount(IsSuspendedDigimon) * 2000);
  139. List<CardSource> selectedCards = new List<CardSource>();
  140. int maxCount = Math.Min(1, card.Owner.HandCards.Count(cardSource => CanSelectCardCondition(cardSource, DP)));
  141. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  142. selectHandEffect.SetUp(
  143. selectPlayer: card.Owner,
  144. canTargetCondition: cardSource => CanSelectCardCondition(cardSource, DP),
  145. canTargetCondition_ByPreSelecetedList: null,
  146. canEndSelectCondition: null,
  147. maxCount: maxCount,
  148. canNoSelect: false,
  149. canEndNotMax: false,
  150. isShowOpponent: true,
  151. selectCardCoroutine: SelectCardCoroutine,
  152. afterSelectCardCoroutine: null,
  153. mode: SelectHandEffect.Mode.Custom,
  154. cardEffect: activateClass);
  155. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  156. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  157. yield return StartCoroutine(selectHandEffect.Activate());
  158. IEnumerator SelectCardCoroutine(CardSource cardSource)
  159. {
  160. selectedCards.Add(cardSource);
  161. yield return null;
  162. }
  163. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  164. }
  165. }
  166. #endregion
  167. return cardEffects;
  168. }
  169. }
  170. }