BT11_052.cs 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT11
  5. {
  6. public class BT11_052 : 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 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 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.IsTamer)
  24. {
  25. if (cardSource.GetCostItself <= 3)
  26. {
  27. if (cardSource.HasPlayCost)
  28. {
  29. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  30. {
  31. return true;
  32. }
  33. }
  34. }
  35. }
  36. return false;
  37. }
  38. bool CanUseCondition(Hashtable hashtable)
  39. {
  40. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  41. }
  42. bool CanActivateCondition(Hashtable hashtable)
  43. {
  44. if (CardEffectCommons.IsExistOnBattleArea(card))
  45. {
  46. if (card.Owner.HandCards.Count >= 1)
  47. {
  48. return true;
  49. }
  50. }
  51. return false;
  52. }
  53. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  54. {
  55. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  56. {
  57. List<CardSource> selectedCards = new List<CardSource>();
  58. int maxCount = 1;
  59. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  60. selectHandEffect.SetUp(
  61. selectPlayer: card.Owner,
  62. canTargetCondition: CanSelectCardCondition,
  63. canTargetCondition_ByPreSelecetedList: null,
  64. canEndSelectCondition: null,
  65. maxCount: maxCount,
  66. canNoSelect: true,
  67. canEndNotMax: false,
  68. isShowOpponent: true,
  69. selectCardCoroutine: SelectCardCoroutine,
  70. afterSelectCardCoroutine: null,
  71. mode: SelectHandEffect.Mode.Custom,
  72. cardEffect: activateClass);
  73. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  74. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  75. yield return StartCoroutine(selectHandEffect.Activate());
  76. IEnumerator SelectCardCoroutine(CardSource cardSource)
  77. {
  78. selectedCards.Add(cardSource);
  79. yield return null;
  80. }
  81. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  82. }
  83. }
  84. }
  85. if (timing == EffectTiming.OnEnterFieldAnyone)
  86. {
  87. ActivateClass activateClass = new ActivateClass();
  88. activateClass.SetUpICardEffect("Play 1 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 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.IsTamer)
  98. {
  99. if (cardSource.GetCostItself <= 3)
  100. {
  101. if (cardSource.HasPlayCost)
  102. {
  103. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  104. {
  105. return true;
  106. }
  107. }
  108. }
  109. }
  110. return false;
  111. }
  112. bool CanUseCondition(Hashtable hashtable)
  113. {
  114. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  115. }
  116. bool CanActivateCondition(Hashtable hashtable)
  117. {
  118. if (CardEffectCommons.IsExistOnBattleArea(card))
  119. {
  120. if (card.Owner.HandCards.Count >= 1)
  121. {
  122. return true;
  123. }
  124. }
  125. return false;
  126. }
  127. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  128. {
  129. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  130. {
  131. List<CardSource> selectedCards = new List<CardSource>();
  132. int maxCount = 1;
  133. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  134. selectHandEffect.SetUp(
  135. selectPlayer: card.Owner,
  136. canTargetCondition: CanSelectCardCondition,
  137. canTargetCondition_ByPreSelecetedList: null,
  138. canEndSelectCondition: null,
  139. maxCount: maxCount,
  140. canNoSelect: true,
  141. canEndNotMax: false,
  142. isShowOpponent: true,
  143. selectCardCoroutine: SelectCardCoroutine,
  144. afterSelectCardCoroutine: null,
  145. mode: SelectHandEffect.Mode.Custom,
  146. cardEffect: activateClass);
  147. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  148. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  149. yield return StartCoroutine(selectHandEffect.Activate());
  150. IEnumerator SelectCardCoroutine(CardSource cardSource)
  151. {
  152. selectedCards.Add(cardSource);
  153. yield return null;
  154. }
  155. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  156. }
  157. }
  158. }
  159. if (timing == EffectTiming.None)
  160. {
  161. bool Condition()
  162. {
  163. if (CardEffectCommons.IsExistOnBattleArea(card))
  164. {
  165. if (CardEffectCommons.IsOwnerTurn(card))
  166. {
  167. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsTamer))
  168. {
  169. return true;
  170. }
  171. }
  172. }
  173. return false;
  174. }
  175. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 2000, isInheritedEffect: true, card: card, condition: Condition));
  176. }
  177. return cardEffects;
  178. }
  179. }
  180. }