BT20_089.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT20
  4. {
  5. public class BT20_089 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Rule: Name Change
  11. if (timing == EffectTiming.None)
  12. {
  13. ChangeCardNamesClass changeCardNamesClass = new ChangeCardNamesClass();
  14. changeCardNamesClass.SetUpICardEffect("Also treated as [Eiji Nagasumi]/[Leon Alexander]", CanUseCondition, card);
  15. changeCardNamesClass.SetUpChangeCardNamesClass(changeCardNames: changeCardNames);
  16. cardEffects.Add(changeCardNamesClass);
  17. bool CanUseCondition(Hashtable hashtable)
  18. {
  19. return true;
  20. }
  21. List<string> changeCardNames(CardSource cardSource, List<string> CardNames)
  22. {
  23. if (cardSource == card)
  24. {
  25. CardNames.Add("Eiji Nagasumi");
  26. CardNames.Add("Leon Alexander");
  27. }
  28. return CardNames;
  29. }
  30. }
  31. #endregion
  32. #region Start of Your Turn
  33. if (timing == EffectTiming.OnStartTurn)
  34. {
  35. cardEffects.Add(CardEffectFactory.SetMemoryTo3TamerEffect(card));
  36. }
  37. #endregion
  38. #region All Turns
  39. if (timing == EffectTiming.OnEnterFieldAnyone)
  40. {
  41. ActivateClass activateClass = new ActivateClass();
  42. activateClass.SetUpICardEffect("Mind Link", CanUseCondition, card);
  43. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  44. cardEffects.Add(activateClass);
  45. string EffectDiscription()
  46. {
  47. return "[All Turns] When any of your Digimon are played or digivolve, you may <Mind Link> with 1 of your Digimon with [Pulsemon] in text or the [SoC] or [SEEKERS] trait.";
  48. }
  49. bool MyPlayedDigimonCondition(Permanent permanent)
  50. {
  51. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  52. }
  53. bool IsMyProperDigimon(Permanent permanent)
  54. {
  55. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  56. (permanent.TopCard.HasText("Pulsemon") ||
  57. (permanent.TopCard.HasSocTraits || permanent.TopCard.HasSeekersTraits));
  58. }
  59. bool CanUseCondition(Hashtable hashtable)
  60. {
  61. if (isExistOnField(card))
  62. {
  63. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, MyPlayedDigimonCondition))
  64. return true;
  65. if (CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, MyPlayedDigimonCondition))
  66. return true;
  67. }
  68. return false;
  69. }
  70. bool CanActivateCondition(Hashtable hashtable)
  71. {
  72. return isExistOnField(card) &&
  73. CardEffectCommons.HasMatchConditionPermanent(IsMyProperDigimon);
  74. }
  75. IEnumerator ActivateCoroutine(Hashtable hashtable)
  76. {
  77. yield return ContinuousController.instance.StartCoroutine(
  78. new MindLinkClass(
  79. tamer: card.PermanentOfThisCard(),
  80. digimonCondition: IsMyProperDigimon,
  81. activateClass: activateClass
  82. ).MindLink()
  83. );
  84. }
  85. }
  86. #endregion
  87. #region All Turns - ESS
  88. bool ESSDigimonCondition()
  89. {
  90. Permanent permanent = card.PermanentOfThisCard();
  91. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  92. (permanent.TopCard.HasText("Pulsemon") ||
  93. (permanent.TopCard.HasSocTraits || permanent.TopCard.HasSeekersTraits));
  94. }
  95. if (timing == EffectTiming.OnAllyAttack)
  96. {
  97. cardEffects.Add(CardEffectFactory.AllianceSelfEffect(isInheritedEffect: true, card: card, condition: ESSDigimonCondition));
  98. }
  99. if (timing == EffectTiming.OnDetermineDoSecurityCheck)
  100. {
  101. cardEffects.Add(CardEffectFactory.PierceSelfEffect(isInheritedEffect: true, card: card, condition: ESSDigimonCondition));
  102. }
  103. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  104. {
  105. cardEffects.Add(CardEffectFactory.BarrierSelfEffect(isInheritedEffect: true, card: card, condition: ESSDigimonCondition));
  106. }
  107. #endregion
  108. #region End of All Turns
  109. if (timing == EffectTiming.OnEndTurn)
  110. {
  111. ActivateClass activateClass = new ActivateClass();
  112. activateClass.SetUpICardEffect("Play 1 [Eiji Nagasumi] from this Digimon's digivolution cards", CanUseCondition, card);
  113. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  114. activateClass.SetIsInheritedEffect(true);
  115. cardEffects.Add(activateClass);
  116. string EffectDescription()
  117. {
  118. return
  119. "[End of All Turns] You may play 1 [Eiji Nagasumi] from this Digimon's digivolution cards without paying the cost.";
  120. }
  121. bool IsEijiCardCondition(CardSource cardSource)
  122. {
  123. return CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass) &&
  124. cardSource.EqualsCardName("Eiji Nagasumi");
  125. }
  126. bool CanUseCondition(Hashtable hashtable)
  127. {
  128. return CardEffectCommons.IsExistOnBattleArea(card);
  129. }
  130. bool CanActivateCondition(Hashtable hashtable)
  131. {
  132. return CardEffectCommons.IsExistOnBattleArea(card) &&
  133. card.PermanentOfThisCard().DigivolutionCards.Some(IsEijiCardCondition);
  134. }
  135. IEnumerator ActivateCoroutine(Hashtable hashtable)
  136. {
  137. if (CardEffectCommons.IsExistOnBattleArea(card))
  138. {
  139. Permanent selectedPermanent = card.PermanentOfThisCard();
  140. if (selectedPermanent != null)
  141. {
  142. if (selectedPermanent.DigivolutionCards.Some(IsEijiCardCondition))
  143. {
  144. int maxCount = 1;
  145. List<CardSource> selectedCards = new List<CardSource>();
  146. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  147. selectCardEffect.SetUp(
  148. canTargetCondition: IsEijiCardCondition,
  149. canTargetCondition_ByPreSelecetedList: null,
  150. canEndSelectCondition: null,
  151. canNoSelect: () => true,
  152. selectCardCoroutine: SelectCardCoroutine,
  153. afterSelectCardCoroutine: null,
  154. message: "Select 1 digivolution card to play.",
  155. maxCount: maxCount,
  156. canEndNotMax: false,
  157. isShowOpponent: true,
  158. mode: SelectCardEffect.Mode.Custom,
  159. root: SelectCardEffect.Root.Custom,
  160. customRootCardList: selectedPermanent.DigivolutionCards,
  161. canLookReverseCard: true,
  162. selectPlayer: card.Owner,
  163. cardEffect: activateClass);
  164. selectCardEffect.SetUpCustomMessage("Select 1 digivolution card to play.",
  165. "The opponent is selecting 1 digivolution card to play.");
  166. selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
  167. yield return StartCoroutine(selectCardEffect.Activate());
  168. IEnumerator SelectCardCoroutine(CardSource cardSource)
  169. {
  170. selectedCards.Add(cardSource);
  171. yield return null;
  172. }
  173. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  174. cardSources: selectedCards,
  175. activateClass: activateClass,
  176. payCost: false,
  177. isTapped: false,
  178. root: SelectCardEffect.Root.DigivolutionCards,
  179. activateETB: true));
  180. }
  181. }
  182. }
  183. }
  184. }
  185. #endregion
  186. #region Security Effect
  187. if (timing == EffectTiming.SecuritySkill)
  188. {
  189. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  190. }
  191. #endregion
  192. return cardEffects;
  193. }
  194. }
  195. }