BT23_017.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. // Betamon
  6. namespace DCGO.CardEffects.BT23
  7. {
  8. public class BT23_017 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Alternative Digivolution Condition
  14. if (timing == EffectTiming.None)
  15. {
  16. bool PermanentCondition(Permanent targetPermanent)
  17. {
  18. return targetPermanent.TopCard.HasCSTraits
  19. && targetPermanent.TopCard.HasLevel
  20. && targetPermanent.TopCard.IsLevel2;
  21. }
  22. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  23. permanentCondition: PermanentCondition,
  24. digivolutionCost: 0,
  25. ignoreDigivolutionRequirement: false,
  26. card: card,
  27. condition: null)
  28. );
  29. }
  30. #endregion
  31. #region On Play
  32. if (timing == EffectTiming.OnEnterFieldAnyone)
  33. {
  34. ActivateClass activateClass = new ActivateClass();
  35. activateClass.SetUpICardEffect("Trash 1 card, return 1 non digi-egg [CS] card from trash to hand", CanUseCondition, card);
  36. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  37. cardEffects.Add(activateClass);
  38. string EffectDiscription()
  39. {
  40. return "[On Play] By trash 1 card in your hand, you may return 1 non-Digi-Egg card with the [CS] trait from your trash to the hand.";
  41. }
  42. bool CanUseCondition(Hashtable hashtable)
  43. {
  44. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  45. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  46. }
  47. bool CanActivateCondition(Hashtable hashtable)
  48. {
  49. return CardEffectCommons.IsExistOnBattleArea(card);
  50. }
  51. bool CanSelectCardCondition(CardSource cardSource)
  52. {
  53. return !cardSource.IsDigiEgg
  54. && cardSource.HasCSTraits;
  55. }
  56. IEnumerator ActivateCoroutine(Hashtable hashtable)
  57. {
  58. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, _ => true))
  59. {
  60. bool trashed = false;
  61. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  62. selectHandEffect.SetUp(
  63. selectPlayer: card.Owner,
  64. canTargetCondition: (cardSource) => true,
  65. canTargetCondition_ByPreSelecetedList: null,
  66. canEndSelectCondition: null,
  67. maxCount: 1,
  68. canNoSelect: true,
  69. canEndNotMax: false,
  70. isShowOpponent: true,
  71. selectCardCoroutine: null,
  72. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  73. mode: SelectHandEffect.Mode.Discard,
  74. cardEffect: activateClass);
  75. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  76. {
  77. if (cardSources.Any()) trashed = true;
  78. yield return null;
  79. }
  80. selectHandEffect.SetUpCustomMessage("Select 1 card to trash", "Your opponent is selecting 1 card to trash");
  81. selectHandEffect.SetUpCustomMessage_ShowCard("Selected Card");
  82. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  83. if (trashed && CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  84. {
  85. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInTrash(card, CanSelectCardCondition));
  86. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  87. selectCardEffect.SetUp(
  88. canTargetCondition: CanSelectCardCondition,
  89. canTargetCondition_ByPreSelecetedList: null,
  90. canEndSelectCondition: null,
  91. canNoSelect: () => true,
  92. selectCardCoroutine: null,
  93. afterSelectCardCoroutine: null,
  94. message: "Select 1 [CS] card to add to hand.",
  95. maxCount: maxCount,
  96. canEndNotMax: false,
  97. isShowOpponent: true,
  98. mode: SelectCardEffect.Mode.AddHand,
  99. root: SelectCardEffect.Root.Trash,
  100. customRootCardList: null,
  101. canLookReverseCard: true,
  102. selectPlayer: card.Owner,
  103. cardEffect: activateClass);
  104. selectCardEffect.SetUpCustomMessage("Select 1 [CS] card to add to hand.", "The opponent is selecting 1 card to add to hand.");
  105. selectCardEffect.SetUpCustomMessage_ShowCard("Selected Card");
  106. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  107. }
  108. }
  109. }
  110. }
  111. #endregion
  112. #region ESS - When Attacking
  113. if (timing == EffectTiming.OnAllyAttack)
  114. {
  115. ActivateClass activateClass = new ActivateClass();
  116. activateClass.SetUpICardEffect("Play 1 5 cost or less [Hudie] digimon from hand", CanUseCondition, card);
  117. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  118. activateClass.SetIsInheritedEffect(true);
  119. activateClass.SetHashString("BT23_017_WA");
  120. cardEffects.Add(activateClass);
  121. string EffectDiscription()
  122. {
  123. 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.";
  124. }
  125. bool CanUseCondition(Hashtable hashtable)
  126. {
  127. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  128. && CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  129. }
  130. bool CanActivateCondition(Hashtable hashtable)
  131. {
  132. return CardEffectCommons.IsExistOnBattleArea(card);
  133. }
  134. bool CanSelectCardCondition(CardSource cardSource)
  135. {
  136. return cardSource.IsDigiEgg
  137. && cardSource.HasPlayCost && cardSource.BasePlayCostFromEntity <= 5
  138. && cardSource.EqualsTraits("Hudie")
  139. && CardEffectCommons.CanPlayAsNewPermanent(cardSource, false, activateClass);
  140. }
  141. IEnumerator ActivateCoroutine(Hashtable hashtable)
  142. {
  143. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition))
  144. {
  145. CardSource selectedCard = null;
  146. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  147. selectHandEffect.SetUp(
  148. selectPlayer: card.Owner,
  149. canTargetCondition: CanSelectCardCondition,
  150. canTargetCondition_ByPreSelecetedList: null,
  151. canEndSelectCondition: null,
  152. maxCount: 1,
  153. canNoSelect: true,
  154. canEndNotMax: false,
  155. isShowOpponent: true,
  156. selectCardCoroutine: SelectCardCoroutine,
  157. afterSelectCardCoroutine: null,
  158. mode: SelectHandEffect.Mode.Custom,
  159. cardEffect: activateClass);
  160. IEnumerator SelectCardCoroutine(CardSource cardSource)
  161. {
  162. selectedCard = cardSource;
  163. yield return null;
  164. }
  165. selectHandEffect.SetUpCustomMessage("Select 1 [Hudie] digimon to play", "Your opponent is selecting 1 card to play");
  166. selectHandEffect.SetUpCustomMessage_ShowCard("Selected Card");
  167. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  168. if (selectedCard != null)
  169. {
  170. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  171. new List<CardSource>() { selectedCard },
  172. activateClass: activateClass,
  173. payCost: false,
  174. isTapped: false,
  175. root: SelectCardEffect.Root.Hand,
  176. activateETB: true));
  177. Permanent playedDigimon = selectedCard.PermanentOfThisCard();
  178. #region Can't Digivolve/Delete EoOT
  179. if (playedDigimon != null)
  180. {
  181. #region Can't Digivolve
  182. CanNotDigivolveClass canNotEvolveClass = new CanNotDigivolveClass();
  183. canNotEvolveClass.SetUpICardEffect("Can't digivolve", CanUseCantEvoCondition, card);
  184. canNotEvolveClass.SetUpCanNotEvolveClass(permanentCondition: PermanentCondition, cardCondition: CardCondition);
  185. playedDigimon.PermanentEffects.Add((_timing) => canNotEvolveClass);
  186. bool CanUseCantEvoCondition(Hashtable hashtable)
  187. {
  188. return CardEffectCommons.IsPermanentExistsOnBattleArea(playedDigimon);
  189. }
  190. bool PermanentCondition(Permanent permanent)
  191. {
  192. return permanent == playedDigimon;
  193. }
  194. bool CardCondition(CardSource cardSource)
  195. {
  196. return true;
  197. }
  198. #endregion
  199. #region Delete EoOT
  200. ActivateClass activateClass1 = new ActivateClass();
  201. activateClass1.SetUpICardEffect("Delete the Digimon", CanUseEndofOpponentTurnCondition, card);
  202. activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, "");
  203. card.Owner.UntilOpponentTurnEndEffects.Add(GetCardEffect);
  204. bool CanUseEndofOpponentTurnCondition(Hashtable hashtable)
  205. {
  206. if (CardEffectCommons.IsPermanentExistsOnBattleArea(playedDigimon))
  207. {
  208. if (CardEffectCommons.IsOpponentTurn(card))
  209. {
  210. return true;
  211. }
  212. }
  213. return false;
  214. }
  215. bool CanActivateCondition1(Hashtable hashtable)
  216. {
  217. if (CardEffectCommons.IsPermanentExistsOnBattleArea(playedDigimon))
  218. {
  219. if (playedDigimon.CanBeDestroyedBySkill(activateClass1))
  220. {
  221. if (!playedDigimon.TopCard.CanNotBeAffected(activateClass1))
  222. {
  223. return true;
  224. }
  225. }
  226. }
  227. return false;
  228. }
  229. IEnumerator ActivateCoroutine1(Hashtable _hashtable1)
  230. {
  231. yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass(new List<Permanent>() { playedDigimon }, CardEffectCommons.CardEffectHashtable(activateClass1)).Destroy());
  232. }
  233. ICardEffect GetCardEffect(EffectTiming _timing)
  234. {
  235. if (_timing == EffectTiming.OnEndTurn)
  236. {
  237. return activateClass1;
  238. }
  239. return null;
  240. }
  241. #endregion
  242. }
  243. #endregion
  244. }
  245. }
  246. }
  247. }
  248. #endregion
  249. return cardEffects;
  250. }
  251. }
  252. }