BT11_032.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT11
  6. {
  7. public class BT11_032 : 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.OnEnterFieldAnyone)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Play 1 blue Tamer from hand", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[When Digivolving] You may play 1 blue Tamer card from your hand without paying the cost.";
  21. }
  22. bool CanSelectCardCondition(CardSource cardSource)
  23. {
  24. if (cardSource.CardColors.Contains(CardColor.Blue))
  25. {
  26. if (cardSource.IsTamer)
  27. {
  28. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  29. {
  30. return true;
  31. }
  32. }
  33. }
  34. return false;
  35. }
  36. bool CanUseCondition(Hashtable hashtable)
  37. {
  38. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  39. }
  40. bool CanActivateCondition(Hashtable hashtable)
  41. {
  42. if (CardEffectCommons.IsExistOnBattleArea(card))
  43. {
  44. if (card.Owner.HandCards.Count >= 1)
  45. {
  46. return true;
  47. }
  48. }
  49. return false;
  50. }
  51. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  52. {
  53. List<CardSource> selectedCards = new List<CardSource>();
  54. int maxCount = 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: maxCount,
  62. canNoSelect: true,
  63. canEndNotMax: false,
  64. isShowOpponent: true,
  65. selectCardCoroutine: SelectCardCoroutine,
  66. afterSelectCardCoroutine: null,
  67. mode: SelectHandEffect.Mode.Custom,
  68. cardEffect: activateClass);
  69. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  70. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  71. yield return StartCoroutine(selectHandEffect.Activate());
  72. IEnumerator SelectCardCoroutine(CardSource cardSource)
  73. {
  74. selectedCards.Add(cardSource);
  75. yield return null;
  76. }
  77. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  78. }
  79. }
  80. if (timing == EffectTiming.OnEnterFieldAnyone)
  81. {
  82. ActivateClass activateClass = new ActivateClass();
  83. activateClass.SetUpICardEffect("Unsuspend this Digimon", CanUseCondition, card);
  84. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  85. cardEffects.Add(activateClass);
  86. string EffectDiscription()
  87. {
  88. return "[Your Turn] When you play a blue Tamer, unsuspend this Digimon.";
  89. }
  90. bool PermanentCondition(Permanent permanent)
  91. {
  92. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  93. {
  94. if (permanent.IsTamer)
  95. {
  96. if (permanent.TopCard.CardColors.Contains(CardColor.Blue))
  97. {
  98. return true;
  99. }
  100. }
  101. }
  102. return false;
  103. }
  104. bool CanUseCondition(Hashtable hashtable)
  105. {
  106. if (CardEffectCommons.IsExistOnBattleArea(card))
  107. {
  108. if (CardEffectCommons.IsOwnerTurn(card))
  109. {
  110. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition))
  111. {
  112. return true;
  113. }
  114. }
  115. }
  116. return false;
  117. }
  118. bool CanActivateCondition(Hashtable hashtable)
  119. {
  120. if (CardEffectCommons.IsExistOnBattleArea(card))
  121. {
  122. if (CardEffectCommons.CanUnsuspend(card.PermanentOfThisCard()))
  123. {
  124. return true;
  125. }
  126. }
  127. return false;
  128. }
  129. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  130. {
  131. Permanent selectedPermanent = card.PermanentOfThisCard();
  132. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { selectedPermanent }, activateClass).Unsuspend());
  133. }
  134. }
  135. if (timing == EffectTiming.OnUnTappedAnyone)
  136. {
  137. ActivateClass activateClass = new ActivateClass();
  138. activateClass.SetUpICardEffect("Return opponent's 1 Digimon to hand", CanUseCondition, card);
  139. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  140. activateClass.SetHashString("Bounce_BT11_032");
  141. cardEffects.Add(activateClass);
  142. string EffectDiscription()
  143. {
  144. return "[Your Turn][Once Per Turn] When this Digimon becomes unsuspended, return 1 of your opponent's level 3 or lower Digimon to its owner's hand. For every blue Tamer you have in play, add 1 to the max level of the Digimon you can choose with this effect.";
  145. }
  146. int maxLevel()
  147. {
  148. return 3 + card.Owner.GetBattleAreaPermanents().Count((permanent) => permanent.TopCard.CardColors.Contains(CardColor.Blue) && permanent.IsTamer);
  149. }
  150. bool CanSelectPermanentCondition(Permanent permanent)
  151. {
  152. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  153. {
  154. if (permanent.TopCard.HasLevel)
  155. {
  156. if (permanent.TopCard.Level <= maxLevel())
  157. {
  158. if (permanent.CanSelectBySkill(activateClass))
  159. {
  160. return true;
  161. }
  162. }
  163. }
  164. }
  165. return false;
  166. }
  167. bool CanUseCondition(Hashtable hashtable)
  168. {
  169. if (CardEffectCommons.IsExistOnBattleArea(card))
  170. {
  171. if (CardEffectCommons.IsOwnerTurn(card))
  172. {
  173. if (CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, (permanent) => permanent == card.PermanentOfThisCard()))
  174. {
  175. return true;
  176. }
  177. }
  178. }
  179. return false;
  180. }
  181. bool CanActivateCondition(Hashtable hashtable)
  182. {
  183. if (CardEffectCommons.IsExistOnBattleArea(card))
  184. {
  185. return true;
  186. }
  187. return false;
  188. }
  189. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  190. {
  191. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  192. {
  193. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  194. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  195. selectPermanentEffect.SetUp(
  196. selectPlayer: card.Owner,
  197. canTargetCondition: CanSelectPermanentCondition,
  198. canTargetCondition_ByPreSelecetedList: null,
  199. canEndSelectCondition: null,
  200. maxCount: maxCount,
  201. canNoSelect: false,
  202. canEndNotMax: false,
  203. selectPermanentCoroutine: null,
  204. afterSelectPermanentCoroutine: null,
  205. mode: SelectPermanentEffect.Mode.Bounce,
  206. cardEffect: activateClass);
  207. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  208. }
  209. }
  210. }
  211. return cardEffects;
  212. }
  213. }
  214. }