BT13_014.cs 11 KB

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