BT15_021.cs 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT15
  5. {
  6. public class BT15_021 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Evo on Gomamon for 0
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.CardNames.Contains("Gomamon");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null));
  19. }
  20. #endregion
  21. #region On Play/When Digivolving Shared
  22. bool CanSelectCardCondition(CardSource cardSource)
  23. {
  24. if (cardSource.ContainsTraits("Sea Beast"))
  25. {
  26. return true;
  27. }
  28. if (cardSource.ContainsTraits("Plesiosaur"))
  29. {
  30. return true;
  31. }
  32. if (cardSource.ContainsTraits("Beastkin"))
  33. {
  34. return true;
  35. }
  36. if (cardSource.HasXAntibodyTraits)
  37. {
  38. return true;
  39. }
  40. return false;
  41. }
  42. bool CanActivateSharedCondition(Hashtable hashtable)
  43. {
  44. if (CardEffectCommons.IsExistOnBattleArea(card))
  45. {
  46. if (card.Owner.LibraryCards.Count >= 1)
  47. {
  48. return true;
  49. }
  50. }
  51. return false;
  52. }
  53. #endregion
  54. #region On Play
  55. if (timing == EffectTiming.OnEnterFieldAnyone)
  56. {
  57. ActivateClass activateClass = new ActivateClass();
  58. activateClass.SetUpICardEffect("Reveal the top 3 cards of deck", CanUseCondition, card);
  59. activateClass.SetUpActivateClass(CanActivateSharedCondition, ActivateCoroutine, -1, false, EffectSharedDiscription());
  60. cardEffects.Add(activateClass);
  61. string EffectSharedDiscription()
  62. {
  63. return "[On Play] Reveal the top 3 cards of your deck. Add 1 card with the [Sea Beast], [Plesiosaur], [Beastkin] or [X Antibody] trait among them to the hand.";
  64. }
  65. bool CanUseCondition(Hashtable hashtable)
  66. {
  67. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  68. }
  69. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  70. {
  71. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  72. revealCount: 3,
  73. simplifiedSelectCardConditions:
  74. new SimplifiedSelectCardConditionClass[]
  75. {
  76. new SimplifiedSelectCardConditionClass(
  77. canTargetCondition:CanSelectCardCondition,
  78. message: "Select 1 card.",
  79. mode: SelectCardEffect.Mode.AddHand,
  80. maxCount: 1,
  81. selectCardCoroutine: null),
  82. },
  83. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  84. activateClass: activateClass
  85. ));
  86. }
  87. }
  88. #endregion
  89. #region When Digivolving
  90. if (timing == EffectTiming.OnEnterFieldAnyone)
  91. {
  92. ActivateClass activateClass = new ActivateClass();
  93. activateClass.SetUpICardEffect("Reveal the top 3 cards of deck", CanUseCondition, card);
  94. activateClass.SetUpActivateClass(CanActivateSharedCondition, ActivateCoroutine, -1, false, EffectSharedDiscription());
  95. cardEffects.Add(activateClass);
  96. string EffectSharedDiscription()
  97. {
  98. return "[When Digivolving] Reveal the top 3 cards of your deck. Add 1 card with the [Sea Beast], [Plesiosaur], [Beastkin] or [X Antibody] trait among them to the hand.";
  99. }
  100. bool CanUseCondition(Hashtable hashtable)
  101. {
  102. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  103. }
  104. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  105. {
  106. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  107. revealCount: 3,
  108. simplifiedSelectCardConditions:
  109. new SimplifiedSelectCardConditionClass[]
  110. {
  111. new SimplifiedSelectCardConditionClass(
  112. canTargetCondition:CanSelectCardCondition,
  113. message: "Select 1 card.",
  114. mode: SelectCardEffect.Mode.AddHand,
  115. maxCount: 1,
  116. selectCardCoroutine: null),
  117. },
  118. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  119. activateClass: activateClass
  120. ));
  121. }
  122. }
  123. #endregion
  124. #region When Attacking
  125. if (timing == EffectTiming.OnAllyAttack)
  126. {
  127. ActivateClass activateClass = new ActivateClass();
  128. activateClass.SetUpICardEffect("Opponent's 1 Digimon can't attack", CanUseCondition, card);
  129. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  130. activateClass.SetHashString("CantAtatck_BT15_021_inherited");
  131. activateClass.SetIsInheritedEffect(true);
  132. cardEffects.Add(activateClass);
  133. string EffectDiscription()
  134. {
  135. return "[When Attacking][Once Per Turn] Until the end of your opponent's turn, 1 of your opponent's Digimon with as many or fewer digivolution cards as this Digimon can't attack.";
  136. }
  137. bool CanSelectPermanentCondition(Permanent permanent)
  138. {
  139. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  140. {
  141. if (CardEffectCommons.IsExistOnBattleArea(card))
  142. {
  143. if (permanent.DigivolutionCards.Count <= card.PermanentOfThisCard().DigivolutionCards.Count)
  144. {
  145. return true;
  146. }
  147. }
  148. }
  149. return false;
  150. }
  151. bool CanUseCondition(Hashtable hashtable)
  152. {
  153. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  154. }
  155. bool CanActivateCondition(Hashtable hashtable)
  156. {
  157. if (CardEffectCommons.IsExistOnBattleArea(card))
  158. {
  159. return true;
  160. }
  161. return false;
  162. }
  163. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  164. {
  165. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  166. {
  167. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  168. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  169. selectPermanentEffect.SetUp(
  170. selectPlayer: card.Owner,
  171. canTargetCondition: CanSelectPermanentCondition,
  172. canTargetCondition_ByPreSelecetedList: null,
  173. canEndSelectCondition: null,
  174. maxCount: maxCount,
  175. canNoSelect: false,
  176. canEndNotMax: false,
  177. selectPermanentCoroutine: SelectPermanentCoroutine,
  178. afterSelectPermanentCoroutine: null,
  179. mode: SelectPermanentEffect.Mode.Custom,
  180. cardEffect: activateClass);
  181. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get effects.", "The opponent is selecting 1 Digimon that will get effects.");
  182. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  183. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  184. {
  185. Permanent selectedPermanent = permanent;
  186. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotAttack(
  187. targetPermanent: selectedPermanent,
  188. defenderCondition: null,
  189. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  190. activateClass: activateClass,
  191. effectName: "Can't Attack"));
  192. }
  193. }
  194. }
  195. }
  196. #endregion
  197. return cardEffects;
  198. }
  199. }
  200. }