BT15_014.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT15
  6. {
  7. public class BT15_014 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. if (timing == EffectTiming.OnCounterTiming)
  13. {
  14. cardEffects.Add(CardEffectFactory.BlastDigivolveEffect(card: card, condition: null));
  15. }
  16. if (timing == EffectTiming.OnEnterFieldAnyone)
  17. {
  18. ActivateClass activateClass = new ActivateClass();
  19. activateClass.SetUpICardEffect("Play 1 Tamer from hand", CanUseCondition, card);
  20. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  21. cardEffects.Add(activateClass);
  22. string EffectDiscription()
  23. {
  24. return "[On Play] You may play 1 red Tamer card with a play cost of 4 or less from your hand without paying the cost.";
  25. }
  26. bool CanSelectCardCondition(CardSource cardSource)
  27. {
  28. if (cardSource.IsTamer)
  29. {
  30. if (cardSource.GetCostItself <= 4)
  31. {
  32. if (cardSource.HasPlayCost)
  33. {
  34. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  35. {
  36. if (cardSource.HasCardColor(CardColor.Red))
  37. {
  38. return true;
  39. }
  40. }
  41. }
  42. }
  43. }
  44. return false;
  45. }
  46. bool CanUseCondition(Hashtable hashtable)
  47. {
  48. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  49. }
  50. bool CanActivateCondition(Hashtable hashtable)
  51. {
  52. if (CardEffectCommons.IsExistOnBattleArea(card))
  53. {
  54. if (card.Owner.HandCards.Count >= 1)
  55. {
  56. return true;
  57. }
  58. }
  59. return false;
  60. }
  61. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  62. {
  63. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  64. {
  65. List<CardSource> selectedCards = new List<CardSource>();
  66. int maxCount = 1;
  67. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  68. selectHandEffect.SetUp(
  69. selectPlayer: card.Owner,
  70. canTargetCondition: CanSelectCardCondition,
  71. canTargetCondition_ByPreSelecetedList: null,
  72. canEndSelectCondition: null,
  73. maxCount: maxCount,
  74. canNoSelect: true,
  75. canEndNotMax: false,
  76. isShowOpponent: true,
  77. selectCardCoroutine: SelectCardCoroutine,
  78. afterSelectCardCoroutine: null,
  79. mode: SelectHandEffect.Mode.Custom,
  80. cardEffect: activateClass);
  81. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  82. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  83. yield return StartCoroutine(selectHandEffect.Activate());
  84. IEnumerator SelectCardCoroutine(CardSource cardSource)
  85. {
  86. selectedCards.Add(cardSource);
  87. yield return null;
  88. }
  89. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  90. }
  91. }
  92. }
  93. if (timing == EffectTiming.OnEnterFieldAnyone)
  94. {
  95. ActivateClass activateClass = new ActivateClass();
  96. activateClass.SetUpICardEffect("Play 1 Tamer from hand", CanUseCondition, card);
  97. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  98. cardEffects.Add(activateClass);
  99. string EffectDiscription()
  100. {
  101. return "[When Digivolving] You may play 1 red Tamer card with a play cost of 4 or less from your hand without paying the cost.";
  102. }
  103. bool CanSelectCardCondition(CardSource cardSource)
  104. {
  105. if (cardSource.IsTamer)
  106. {
  107. if (cardSource.GetCostItself <= 4)
  108. {
  109. if (cardSource.HasPlayCost)
  110. {
  111. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  112. {
  113. if (cardSource.HasCardColor(CardColor.Red))
  114. {
  115. return true;
  116. }
  117. }
  118. }
  119. }
  120. }
  121. return false;
  122. }
  123. bool CanUseCondition(Hashtable hashtable)
  124. {
  125. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  126. }
  127. bool CanActivateCondition(Hashtable hashtable)
  128. {
  129. if (CardEffectCommons.IsExistOnBattleArea(card))
  130. {
  131. if (card.Owner.HandCards.Count >= 1)
  132. {
  133. return true;
  134. }
  135. }
  136. return false;
  137. }
  138. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  139. {
  140. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  141. {
  142. List<CardSource> selectedCards = new List<CardSource>();
  143. int maxCount = 1;
  144. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  145. selectHandEffect.SetUp(
  146. selectPlayer: card.Owner,
  147. canTargetCondition: CanSelectCardCondition,
  148. canTargetCondition_ByPreSelecetedList: null,
  149. canEndSelectCondition: null,
  150. maxCount: maxCount,
  151. canNoSelect: true,
  152. canEndNotMax: false,
  153. isShowOpponent: true,
  154. selectCardCoroutine: SelectCardCoroutine,
  155. afterSelectCardCoroutine: null,
  156. mode: SelectHandEffect.Mode.Custom,
  157. cardEffect: activateClass);
  158. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  159. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  160. yield return StartCoroutine(selectHandEffect.Activate());
  161. IEnumerator SelectCardCoroutine(CardSource cardSource)
  162. {
  163. selectedCards.Add(cardSource);
  164. yield return null;
  165. }
  166. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  167. }
  168. }
  169. }
  170. if (timing == EffectTiming.OnEnterFieldAnyone)
  171. {
  172. ActivateClass activateClass = new ActivateClass();
  173. activateClass.SetUpICardEffect("Delete 1 Digimon with Blocker", CanUseCondition, card);
  174. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  175. activateClass.SetHashString("DeleteBlocker_BT15_014");
  176. cardEffects.Add(activateClass);
  177. string EffectDiscription()
  178. {
  179. return "[All Turns][Once Per Turn] When your Tamer card is played, delete 1 of your opponent's Digimon with [Blocker].";
  180. }
  181. bool PermanentCondition(Permanent permanent)
  182. {
  183. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  184. {
  185. if (permanent.IsTamer)
  186. {
  187. return true;
  188. }
  189. }
  190. return false;
  191. }
  192. bool CanSelectPermanentCondition(Permanent permanent)
  193. {
  194. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  195. {
  196. if (permanent.HasBlocker)
  197. {
  198. return true;
  199. }
  200. }
  201. return false;
  202. }
  203. bool CanUseCondition(Hashtable hashtable)
  204. {
  205. if (CardEffectCommons.IsExistOnBattleArea(card))
  206. {
  207. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition))
  208. {
  209. return true;
  210. }
  211. }
  212. return false;
  213. }
  214. bool CanActivateCondition(Hashtable hashtable)
  215. {
  216. if (CardEffectCommons.IsExistOnBattleArea(card))
  217. {
  218. return true;
  219. }
  220. return false;
  221. }
  222. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  223. {
  224. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  225. {
  226. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  227. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  228. selectPermanentEffect.SetUp(
  229. selectPlayer: card.Owner,
  230. canTargetCondition: CanSelectPermanentCondition,
  231. canTargetCondition_ByPreSelecetedList: null,
  232. canEndSelectCondition: null,
  233. maxCount: maxCount,
  234. canNoSelect: false,
  235. canEndNotMax: false,
  236. selectPermanentCoroutine: null,
  237. afterSelectPermanentCoroutine: null,
  238. mode: SelectPermanentEffect.Mode.Destroy,
  239. cardEffect: activateClass);
  240. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  241. }
  242. }
  243. }
  244. return cardEffects;
  245. }
  246. }
  247. }