BT23_037.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // Tentomon
  4. namespace DCGO.CardEffects.BT23
  5. {
  6. public class BT23_037 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternative Digivolution Condition
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.IsLevel2 && targetPermanent.TopCard.HasCSTraits;
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  19. permanentCondition: PermanentCondition,
  20. digivolutionCost: 0,
  21. ignoreDigivolutionRequirement: false,
  22. card: card,
  23. condition: null)
  24. );
  25. }
  26. #endregion
  27. #region Your Turn
  28. if (timing == EffectTiming.None)
  29. {
  30. bool Condition()
  31. {
  32. return CardEffectCommons.IsOwnerTurn(card) && CardEffectCommons.IsExistOnBattleArea(card);
  33. }
  34. bool PermanentCondition(Permanent targetPermanent)
  35. {
  36. return targetPermanent == card.PermanentOfThisCard();
  37. }
  38. bool CardSourceCondition(CardSource cardSource)
  39. {
  40. return cardSource.HasCSTraits;
  41. }
  42. bool RootCondition(SelectCardEffect.Root root)
  43. {
  44. return true;
  45. }
  46. cardEffects.Add(CardEffectFactory.ChangeDigivolutionCostStaticEffect(
  47. changeValue: -1,
  48. permanentCondition: PermanentCondition,
  49. cardCondition: CardSourceCondition,
  50. rootCondition: RootCondition,
  51. isInheritedEffect: false,
  52. card: card,
  53. condition: Condition,
  54. setFixedCost: false));
  55. }
  56. #endregion
  57. #region ESS - When Attacking
  58. if (timing == EffectTiming.OnAllyAttack)
  59. {
  60. ActivateClass activateClass = new ActivateClass();
  61. activateClass.SetUpICardEffect("Play 1 5 cost or less [Hudie] digimon from hand", CanUseCondition, card);
  62. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  63. activateClass.SetIsInheritedEffect(true);
  64. activateClass.SetHashString("BT23_017_WA");
  65. cardEffects.Add(activateClass);
  66. string EffectDiscription()
  67. {
  68. return "[When Attacking] [Once Per Turn] You may play 1 play cost 5 or lower Digimon card with the [Hudie] trait from your hand without paying the cost. The Digimon this effect played can't digivolve and is deleted at the end of your opponent's turn.";
  69. }
  70. bool CanUseCondition(Hashtable hashtable)
  71. {
  72. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  73. && CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  74. }
  75. bool CanActivateCondition(Hashtable hashtable)
  76. {
  77. return CardEffectCommons.IsExistOnBattleArea(card);
  78. }
  79. bool CanSelectCardCondition(CardSource cardSource)
  80. {
  81. return cardSource.IsDigiEgg
  82. && cardSource.HasPlayCost && cardSource.BasePlayCostFromEntity <= 5
  83. && cardSource.EqualsTraits("Hudie")
  84. && CardEffectCommons.CanPlayAsNewPermanent(cardSource, false, activateClass);
  85. }
  86. IEnumerator ActivateCoroutine(Hashtable hashtable)
  87. {
  88. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition))
  89. {
  90. CardSource selectedCard = null;
  91. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  92. selectHandEffect.SetUp(
  93. selectPlayer: card.Owner,
  94. canTargetCondition: CanSelectCardCondition,
  95. canTargetCondition_ByPreSelecetedList: null,
  96. canEndSelectCondition: null,
  97. maxCount: 1,
  98. canNoSelect: true,
  99. canEndNotMax: false,
  100. isShowOpponent: true,
  101. selectCardCoroutine: SelectCardCoroutine,
  102. afterSelectCardCoroutine: null,
  103. mode: SelectHandEffect.Mode.Custom,
  104. cardEffect: activateClass);
  105. IEnumerator SelectCardCoroutine(CardSource cardSource)
  106. {
  107. selectedCard = cardSource;
  108. yield return null;
  109. }
  110. selectHandEffect.SetUpCustomMessage("Select 1 [Hudie] digimon to play", "Your opponent is selecting 1 card to play");
  111. selectHandEffect.SetUpCustomMessage_ShowCard("Selected Card");
  112. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  113. if (selectedCard != null)
  114. {
  115. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  116. new List<CardSource>() { selectedCard },
  117. activateClass: activateClass,
  118. payCost: false,
  119. isTapped: false,
  120. root: SelectCardEffect.Root.Hand,
  121. activateETB: true));
  122. Permanent playedDigimon = selectedCard.PermanentOfThisCard();
  123. #region Can't Digivolve/Delete EoOT
  124. if (playedDigimon != null)
  125. {
  126. #region Can't Digivolve
  127. CanNotDigivolveClass canNotEvolveClass = new CanNotDigivolveClass();
  128. canNotEvolveClass.SetUpICardEffect("Can't digivolve", CanUseCantEvoCondition, card);
  129. canNotEvolveClass.SetUpCanNotEvolveClass(permanentCondition: PermanentCondition, cardCondition: CardCondition);
  130. playedDigimon.PermanentEffects.Add((_timing) => canNotEvolveClass);
  131. bool CanUseCantEvoCondition(Hashtable hashtable)
  132. {
  133. return CardEffectCommons.IsPermanentExistsOnBattleArea(playedDigimon);
  134. }
  135. bool PermanentCondition(Permanent permanent)
  136. {
  137. return permanent == playedDigimon;
  138. }
  139. bool CardCondition(CardSource cardSource)
  140. {
  141. return true;
  142. }
  143. #endregion
  144. #region Delete EoOT
  145. ActivateClass activateClass1 = new ActivateClass();
  146. activateClass1.SetUpICardEffect("Delete the Digimon", CanUseEndofOpponentTurnCondition, card);
  147. activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, "");
  148. card.Owner.UntilOpponentTurnEndEffects.Add(GetCardEffect);
  149. bool CanUseEndofOpponentTurnCondition(Hashtable hashtable)
  150. {
  151. if (CardEffectCommons.IsPermanentExistsOnBattleArea(playedDigimon))
  152. {
  153. if (CardEffectCommons.IsOpponentTurn(card))
  154. {
  155. return true;
  156. }
  157. }
  158. return false;
  159. }
  160. bool CanActivateCondition1(Hashtable hashtable)
  161. {
  162. if (CardEffectCommons.IsPermanentExistsOnBattleArea(playedDigimon))
  163. {
  164. if (playedDigimon.CanBeDestroyedBySkill(activateClass1))
  165. {
  166. if (!playedDigimon.TopCard.CanNotBeAffected(activateClass1))
  167. {
  168. return true;
  169. }
  170. }
  171. }
  172. return false;
  173. }
  174. IEnumerator ActivateCoroutine1(Hashtable _hashtable1)
  175. {
  176. yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass(new List<Permanent>() { playedDigimon }, CardEffectCommons.CardEffectHashtable(activateClass1)).Destroy());
  177. }
  178. ICardEffect GetCardEffect(EffectTiming _timing)
  179. {
  180. if (_timing == EffectTiming.OnEndTurn)
  181. {
  182. return activateClass1;
  183. }
  184. return null;
  185. }
  186. #endregion
  187. }
  188. #endregion
  189. }
  190. }
  191. }
  192. }
  193. #endregion
  194. return cardEffects;
  195. }
  196. }
  197. }