BT11_054.cs 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  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_054 : 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.None)
  13. {
  14. ChangeCardNamesClass changeCardNamesClass = new ChangeCardNamesClass();
  15. changeCardNamesClass.SetUpICardEffect("Also treated as having [Leomon] in its name", CanUseCondition, card);
  16. changeCardNamesClass.SetUpChangeCardNamesClass(changeCardNames: changeCardNames);
  17. cardEffects.Add(changeCardNamesClass);
  18. bool CanUseCondition(Hashtable hashtable)
  19. {
  20. return true;
  21. }
  22. List<string> changeCardNames(CardSource cardSource, List<string> CardNames)
  23. {
  24. if (cardSource == card)
  25. {
  26. CardNames.Add("Leomon_BT11_054");
  27. }
  28. return CardNames;
  29. }
  30. }
  31. if (timing == EffectTiming.OnEnterFieldAnyone)
  32. {
  33. ActivateClass activateClass = new ActivateClass();
  34. activateClass.SetUpICardEffect("Play 1 Tamer from hand", CanUseCondition, card);
  35. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  36. cardEffects.Add(activateClass);
  37. string EffectDiscription()
  38. {
  39. return "[When Digivolving] You may play 1 green or blue Tamer card with a play cost of 4 or less from your hand without paying the cost.";
  40. }
  41. bool CanSelectCardCondition(CardSource cardSource)
  42. {
  43. if (cardSource.IsTamer)
  44. {
  45. if (cardSource.GetCostItself <= 4)
  46. {
  47. if (cardSource.HasCardColor(CardColor.Blue) || cardSource.HasCardColor(CardColor.Green))
  48. {
  49. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  50. {
  51. return true;
  52. }
  53. }
  54. }
  55. }
  56. return false;
  57. }
  58. bool CanUseCondition(Hashtable hashtable)
  59. {
  60. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  61. }
  62. bool CanActivateCondition(Hashtable hashtable)
  63. {
  64. if (CardEffectCommons.IsExistOnBattleArea(card))
  65. {
  66. if (card.Owner.HandCards.Count >= 1)
  67. {
  68. return true;
  69. }
  70. }
  71. return false;
  72. }
  73. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  74. {
  75. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  76. {
  77. List<CardSource> selectedCards = new List<CardSource>();
  78. int maxCount = 1;
  79. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  80. selectHandEffect.SetUp(
  81. selectPlayer: card.Owner,
  82. canTargetCondition: CanSelectCardCondition,
  83. canTargetCondition_ByPreSelecetedList: null,
  84. canEndSelectCondition: null,
  85. maxCount: maxCount,
  86. canNoSelect: true,
  87. canEndNotMax: false,
  88. isShowOpponent: true,
  89. selectCardCoroutine: SelectCardCoroutine,
  90. afterSelectCardCoroutine: null,
  91. mode: SelectHandEffect.Mode.Custom,
  92. cardEffect: activateClass);
  93. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  94. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  95. yield return StartCoroutine(selectHandEffect.Activate());
  96. IEnumerator SelectCardCoroutine(CardSource cardSource)
  97. {
  98. selectedCards.Add(cardSource);
  99. yield return null;
  100. }
  101. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  102. }
  103. }
  104. }
  105. if (timing == EffectTiming.OnEnterFieldAnyone)
  106. {
  107. ActivateClass activateClass = new ActivateClass();
  108. activateClass.SetUpICardEffect("Your 1 Digimon gains Rush", CanUseCondition, card);
  109. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  110. activateClass.SetIsInheritedEffect(true);
  111. activateClass.SetHashString("Rush_BT11_054");
  112. cardEffects.Add(activateClass);
  113. string EffectDiscription()
  114. {
  115. return "[Your Turn][Once Per Turn] When you play another Digimon by an effect, 1 of your Digimon gains <Rush> for the turn. (This Digimon may attack the turn it was played.)";
  116. }
  117. bool CanSelectPermanentCondition(Permanent permanent)
  118. {
  119. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  120. }
  121. bool PermanentCondition(Permanent permanent)
  122. {
  123. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  124. {
  125. if (permanent != card.PermanentOfThisCard())
  126. {
  127. return true;
  128. }
  129. }
  130. return false;
  131. }
  132. bool CanUseCondition(Hashtable hashtable)
  133. {
  134. if (CardEffectCommons.IsExistOnBattleArea(card))
  135. {
  136. if (CardEffectCommons.IsOwnerTurn(card))
  137. {
  138. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition))
  139. {
  140. if (CardEffectCommons.IsByEffect(hashtable, null))
  141. {
  142. return true;
  143. }
  144. }
  145. }
  146. }
  147. return false;
  148. }
  149. bool CanActivateCondition(Hashtable hashtable)
  150. {
  151. if (CardEffectCommons.IsExistOnBattleArea(card))
  152. {
  153. return true;
  154. }
  155. return false;
  156. }
  157. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  158. {
  159. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  160. {
  161. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  162. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  163. selectPermanentEffect.SetUp(
  164. selectPlayer: card.Owner,
  165. canTargetCondition: CanSelectPermanentCondition,
  166. canTargetCondition_ByPreSelecetedList: null,
  167. canEndSelectCondition: null,
  168. maxCount: maxCount,
  169. canNoSelect: false,
  170. canEndNotMax: false,
  171. selectPermanentCoroutine: SelectPermanentCoroutine,
  172. afterSelectPermanentCoroutine: null,
  173. mode: SelectPermanentEffect.Mode.Custom,
  174. cardEffect: activateClass);
  175. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get Rush.", "The opponent is selecting 1 Digimon that will get Rush.");
  176. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  177. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  178. {
  179. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainRush(
  180. targetPermanent: permanent,
  181. effectDuration: EffectDuration.UntilEachTurnEnd,
  182. activateClass: activateClass));
  183. }
  184. }
  185. }
  186. }
  187. return cardEffects;
  188. }
  189. }
  190. }