BT14_066.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT14
  5. {
  6. public class BT14_066 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.None)
  12. {
  13. bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return (targetPermanent.TopCard.ContainsCardName("Numemon") || targetPermanent.TopCard.ContainsCardName("Monzaemon"))
  16. && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 5;
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  19. }
  20. if (timing == EffectTiming.OnEnterFieldAnyone)
  21. {
  22. ActivateClass activateClass = new ActivateClass();
  23. activateClass.SetUpICardEffect("Trash 1 card from hand to gain Memory +2", CanUseCondition, card);
  24. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  25. cardEffects.Add(activateClass);
  26. string EffectDiscription()
  27. {
  28. return "[On Play] By trashing 1 card with [Numemon] in its name in your hand, gain 2 memory.";
  29. }
  30. bool CanSelectCardCondition(CardSource cardSource)
  31. {
  32. return cardSource.ContainsCardName("Numemon");
  33. }
  34. bool CanUseCondition(Hashtable hashtable)
  35. {
  36. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  37. }
  38. bool CanActivateCondition(Hashtable hashtable)
  39. {
  40. if (CardEffectCommons.IsExistOnBattleArea(card))
  41. {
  42. if (card.Owner.HandCards.Count >= 1)
  43. {
  44. return true;
  45. }
  46. }
  47. return false;
  48. }
  49. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  50. {
  51. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  52. {
  53. bool discarded = false;
  54. int discardCount = 1;
  55. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  56. selectHandEffect.SetUp(
  57. selectPlayer: card.Owner,
  58. canTargetCondition: CanSelectCardCondition,
  59. canTargetCondition_ByPreSelecetedList: null,
  60. canEndSelectCondition: null,
  61. maxCount: discardCount,
  62. canNoSelect: true,
  63. canEndNotMax: false,
  64. isShowOpponent: true,
  65. selectCardCoroutine: null,
  66. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  67. mode: SelectHandEffect.Mode.Discard,
  68. cardEffect: activateClass);
  69. yield return StartCoroutine(selectHandEffect.Activate());
  70. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  71. {
  72. if (cardSources.Count >= 1)
  73. {
  74. discarded = true;
  75. yield return null;
  76. }
  77. }
  78. if (discarded)
  79. {
  80. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(2, activateClass));
  81. }
  82. }
  83. }
  84. }
  85. if (timing == EffectTiming.OnEnterFieldAnyone)
  86. {
  87. ActivateClass activateClass = new ActivateClass();
  88. activateClass.SetUpICardEffect("Trash 1 card from hand to gain Memory +2", CanUseCondition, card);
  89. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  90. cardEffects.Add(activateClass);
  91. string EffectDiscription()
  92. {
  93. return "[When Digivolving] By trashing 1 card with [Numemon] in its name in your hand, gain 2 memory.";
  94. }
  95. bool CanSelectCardCondition(CardSource cardSource)
  96. {
  97. return cardSource.ContainsCardName("Numemon");
  98. }
  99. bool CanUseCondition(Hashtable hashtable)
  100. {
  101. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  102. }
  103. bool CanActivateCondition(Hashtable hashtable)
  104. {
  105. if (CardEffectCommons.IsExistOnBattleArea(card))
  106. {
  107. if (card.Owner.HandCards.Count >= 1)
  108. {
  109. return true;
  110. }
  111. }
  112. return false;
  113. }
  114. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  115. {
  116. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  117. {
  118. bool discarded = false;
  119. int discardCount = 1;
  120. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  121. selectHandEffect.SetUp(
  122. selectPlayer: card.Owner,
  123. canTargetCondition: CanSelectCardCondition,
  124. canTargetCondition_ByPreSelecetedList: null,
  125. canEndSelectCondition: null,
  126. maxCount: discardCount,
  127. canNoSelect: true,
  128. canEndNotMax: false,
  129. isShowOpponent: true,
  130. selectCardCoroutine: null,
  131. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  132. mode: SelectHandEffect.Mode.Discard,
  133. cardEffect: activateClass);
  134. yield return StartCoroutine(selectHandEffect.Activate());
  135. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  136. {
  137. if (cardSources.Count >= 1)
  138. {
  139. discarded = true;
  140. yield return null;
  141. }
  142. }
  143. if (discarded)
  144. {
  145. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(2, activateClass));
  146. }
  147. }
  148. }
  149. }
  150. if (timing == EffectTiming.OnDestroyedAnyone)
  151. {
  152. ActivateClass activateClass = new ActivateClass();
  153. activateClass.SetUpICardEffect("Play 1 Digimon from hand", CanUseCondition, card);
  154. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  155. cardEffects.Add(activateClass);
  156. string EffectDiscription()
  157. {
  158. return "[On Deletion] You may play 1 level 5 or lower Digimon card with [Numemon] or [Monzaemon] in its name from your hand without paying the cost.";
  159. }
  160. bool CanSelectCardCondition(CardSource cardSource)
  161. {
  162. if (cardSource.IsDigimon)
  163. {
  164. if (cardSource.Level <= 5)
  165. {
  166. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  167. {
  168. if (cardSource.HasLevel)
  169. {
  170. if (cardSource.ContainsCardName("Numemon"))
  171. {
  172. return true;
  173. }
  174. if (cardSource.ContainsCardName("Monzaemon"))
  175. {
  176. return true;
  177. }
  178. }
  179. }
  180. }
  181. }
  182. return false;
  183. }
  184. bool CanUseCondition(Hashtable hashtable)
  185. {
  186. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  187. }
  188. bool CanActivateCondition(Hashtable hashtable)
  189. {
  190. if (CardEffectCommons.CanActivateOnDeletion(card, activateClass))
  191. {
  192. if (card.Owner.HandCards.Count >= 1)
  193. {
  194. return true;
  195. }
  196. }
  197. return false;
  198. }
  199. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  200. {
  201. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  202. {
  203. List<CardSource> selectedCards = new List<CardSource>();
  204. int maxCount = 1;
  205. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  206. selectHandEffect.SetUp(
  207. selectPlayer: card.Owner,
  208. canTargetCondition: CanSelectCardCondition,
  209. canTargetCondition_ByPreSelecetedList: null,
  210. canEndSelectCondition: null,
  211. maxCount: maxCount,
  212. canNoSelect: true,
  213. canEndNotMax: false,
  214. isShowOpponent: true,
  215. selectCardCoroutine: SelectCardCoroutine,
  216. afterSelectCardCoroutine: null,
  217. mode: SelectHandEffect.Mode.Custom,
  218. cardEffect: activateClass);
  219. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  220. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  221. yield return StartCoroutine(selectHandEffect.Activate());
  222. IEnumerator SelectCardCoroutine(CardSource cardSource)
  223. {
  224. selectedCards.Add(cardSource);
  225. yield return null;
  226. }
  227. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  228. }
  229. }
  230. }
  231. return cardEffects;
  232. }
  233. }
  234. }