P_207.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Minervamon
  5. namespace DCGO.CardEffects.P
  6. {
  7. public class P_207 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternate Digivolution Requirement
  13. if (timing == EffectTiming.None)
  14. {
  15. static bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.IsLevel5 &&
  18. (targetPermanent.TopCard.EqualsTraits("Beastkin") || targetPermanent.TopCard.HasTSTraits);
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  21. }
  22. #endregion
  23. #region Alliance
  24. if (timing == EffectTiming.OnAllyAttack)
  25. {
  26. cardEffects.Add(CardEffectFactory.AllianceSelfEffect(isInheritedEffect: false, card: card, condition: null));
  27. }
  28. #endregion
  29. #region OP/WD Shared
  30. bool SharedCanSelectCardCondition(CardSource cardSource, ActivateClass activateClass)
  31. {
  32. return cardSource.IsDigimon
  33. && cardSource.HasLevel && cardSource.Level <= 4
  34. && (cardSource.HasAvianBeastAnimalTraits || cardSource.HasTSTraits)
  35. && CardEffectCommons.CanPlayAsNewPermanent(cardSource, false, activateClass);
  36. }
  37. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  38. {
  39. if (CardEffectCommons.HasMatchConditionOwnersHand(card, cs => SharedCanSelectCardCondition(cs, activateClass)))
  40. {
  41. CardSource selectedCard = null;
  42. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  43. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInHand(card, cs => SharedCanSelectCardCondition(cs, activateClass)));
  44. selectHandEffect.SetUp(
  45. selectPlayer: card.Owner,
  46. canTargetCondition: cs => SharedCanSelectCardCondition(cs, activateClass),
  47. canTargetCondition_ByPreSelecetedList: null,
  48. canEndSelectCondition: null,
  49. maxCount: maxCount,
  50. canNoSelect: true,
  51. canEndNotMax: false,
  52. isShowOpponent: true,
  53. selectCardCoroutine: SelectCardCoroutine,
  54. afterSelectCardCoroutine: null,
  55. mode: SelectHandEffect.Mode.Custom,
  56. cardEffect: activateClass);
  57. IEnumerator SelectCardCoroutine(CardSource cardSource)
  58. {
  59. selectedCard = cardSource;
  60. yield return null;
  61. }
  62. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  63. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  64. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  65. if (selectedCard != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  66. cardSources: new List<CardSource>() { selectedCard },
  67. activateClass: activateClass,
  68. payCost: false,
  69. isTapped: false,
  70. root: SelectCardEffect.Root.Hand,
  71. activateETB: true));
  72. }
  73. }
  74. #endregion
  75. #region On Play
  76. if (timing == EffectTiming.OnEnterFieldAnyone)
  77. {
  78. ActivateClass activateClass = new ActivateClass();
  79. activateClass.SetUpICardEffect("Play 1 level 4 or lower [Avian]/[Bird]/[Beast]/[Animal]/Sovereign]/[TS] digimon from hand", CanUseCondition, card);
  80. activateClass.SetUpActivateClass(CanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), -1, false, EffectDiscription());
  81. cardEffects.Add(activateClass);
  82. string EffectDiscription()
  83. {
  84. return "[On Play] You may play 1 level 4 or lower Digimon card with [Avian], [Bird], [Beast], [Animal] or [Sovereign] in any of its traits (other than [Sea Animal]) or the [TS] trait from your hand without paying the cost.";
  85. }
  86. bool CanUseCondition(Hashtable hashtable)
  87. {
  88. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  89. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  90. }
  91. bool CanActivateCondition(Hashtable hashtable)
  92. {
  93. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  94. }
  95. }
  96. #endregion
  97. #region When Digivolving
  98. if (timing == EffectTiming.OnEnterFieldAnyone)
  99. {
  100. ActivateClass activateClass = new ActivateClass();
  101. activateClass.SetUpICardEffect("Play 1 level 4 or lower [Avian]/[Bird]/[Beast]/[Animal]/Sovereign]/[TS] digimon from hand", CanUseCondition, card);
  102. activateClass.SetUpActivateClass(CanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), -1, false, EffectDiscription());
  103. cardEffects.Add(activateClass);
  104. string EffectDiscription()
  105. {
  106. return "[When Digivolving] You may play 1 level 4 or lower Digimon card with [Avian], [Bird], [Beast], [Animal] or [Sovereign] in any of its traits (other than [Sea Animal]) or the [TS] trait from your hand without paying the cost.";
  107. }
  108. bool CanUseCondition(Hashtable hashtable)
  109. {
  110. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  111. && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  112. }
  113. bool CanActivateCondition(Hashtable hashtable)
  114. {
  115. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  116. }
  117. }
  118. #endregion
  119. #region When Attacking - OPT
  120. if (timing == EffectTiming.OnAllyAttack)
  121. {
  122. ActivateClass activateClass = new ActivateClass();
  123. activateClass.SetUpICardEffect("Play 1 level 4 or lower [Avian]/[Bird]/[Beast]/[Animal]/Sovereign]/[TS] digimon from trash", CanUseCondition, card);
  124. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  125. activateClass.SetHashString("P_207_WA");
  126. cardEffects.Add(activateClass);
  127. string EffectDiscription()
  128. {
  129. return "[When Attacking] [Once Per Turn] You may play 1 level 4 or lower Digimon card with [Avian], [Bird], [Beast], [Animal] or [Sovereign], other than [Sea Animal], in any of its traits or the [TS] trait from your trash without paying the cost.";
  130. }
  131. bool CanUseCondition(Hashtable hashtable)
  132. {
  133. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  134. && CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  135. }
  136. bool CanActivateCondition(Hashtable hashtable)
  137. {
  138. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  139. }
  140. IEnumerator ActivateCoroutine(Hashtable hashtable)
  141. {
  142. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, cs => SharedCanSelectCardCondition(cs, activateClass)))
  143. {
  144. CardSource selectedCard = null;
  145. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  146. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInTrash(card, cs => SharedCanSelectCardCondition(cs, activateClass)));
  147. selectCardEffect.SetUp(
  148. canTargetCondition: cs => SharedCanSelectCardCondition(cs, activateClass),
  149. canTargetCondition_ByPreSelecetedList: null,
  150. canEndSelectCondition: null,
  151. canNoSelect: () => true,
  152. selectCardCoroutine: SelectCardCoroutine,
  153. afterSelectCardCoroutine: null,
  154. message: "Select 1 card to play.",
  155. maxCount: maxCount,
  156. canEndNotMax: false,
  157. isShowOpponent: true,
  158. mode: SelectCardEffect.Mode.Custom,
  159. root: SelectCardEffect.Root.Trash,
  160. customRootCardList: null,
  161. canLookReverseCard: true,
  162. selectPlayer: card.Owner,
  163. cardEffect: activateClass);
  164. selectCardEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  165. selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
  166. IEnumerator SelectCardCoroutine(CardSource cardSource)
  167. {
  168. selectedCard = cardSource;
  169. yield return null;
  170. }
  171. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  172. if (selectedCard != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  173. cardSources: new List<CardSource>() { selectedCard },
  174. activateClass: activateClass,
  175. payCost: false,
  176. isTapped: false,
  177. root: SelectCardEffect.Root.Trash,
  178. activateETB: true));
  179. }
  180. }
  181. }
  182. #endregion
  183. return cardEffects;
  184. }
  185. }
  186. }