BT20_089.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  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.OnStartMainPhase)
  34. {
  35. ActivateClass activateClass = new ActivateClass();
  36. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  37. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  38. cardEffects.Add(activateClass);
  39. string EffectDiscription()
  40. {
  41. return "[Start of Your Main Phase] If your opponent has a Digimon, gain 1 memory.";
  42. }
  43. bool CanUseCondition(Hashtable hashtable)
  44. {
  45. if (CardEffectCommons.IsExistOnBattleArea(card))
  46. {
  47. if (CardEffectCommons.IsOwnerTurn(card))
  48. {
  49. return true;
  50. }
  51. }
  52. return false;
  53. }
  54. bool CanActivateCondition(Hashtable hashtable)
  55. {
  56. if (CardEffectCommons.IsExistOnBattleArea(card))
  57. {
  58. if (card.Owner.Enemy.GetBattleAreaDigimons().Count >= 1)
  59. {
  60. if (card.Owner.CanAddMemory(activateClass))
  61. {
  62. return true;
  63. }
  64. }
  65. }
  66. return false;
  67. }
  68. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  69. {
  70. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  71. }
  72. }
  73. #endregion
  74. #region All Turns
  75. if (timing == EffectTiming.OnEnterFieldAnyone)
  76. {
  77. ActivateClass activateClass = new ActivateClass();
  78. activateClass.SetUpICardEffect("Mind Link", CanUseCondition, card);
  79. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  80. cardEffects.Add(activateClass);
  81. string EffectDiscription()
  82. {
  83. 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.";
  84. }
  85. bool MyPlayedDigimonCondition(Permanent permanent)
  86. {
  87. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  88. }
  89. bool IsMyProperDigimon(Permanent permanent)
  90. {
  91. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  92. (permanent.TopCard.HasText("Pulsemon") ||
  93. (permanent.TopCard.HasSocTraits || permanent.TopCard.HasSeekersTraits));
  94. }
  95. bool CanUseCondition(Hashtable hashtable)
  96. {
  97. if (isExistOnField(card))
  98. {
  99. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, MyPlayedDigimonCondition))
  100. return true;
  101. if (CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, MyPlayedDigimonCondition))
  102. return true;
  103. }
  104. return false;
  105. }
  106. bool CanActivateCondition(Hashtable hashtable)
  107. {
  108. return isExistOnField(card) &&
  109. CardEffectCommons.HasMatchConditionPermanent(IsMyProperDigimon);
  110. }
  111. IEnumerator ActivateCoroutine(Hashtable hashtable)
  112. {
  113. yield return ContinuousController.instance.StartCoroutine(
  114. new MindLinkClass(
  115. tamer: card.PermanentOfThisCard(),
  116. digimonCondition: IsMyProperDigimon,
  117. activateClass: activateClass
  118. ).MindLink()
  119. );
  120. }
  121. }
  122. #endregion
  123. #region All Turns - ESS
  124. bool ESSDigimonCondition()
  125. {
  126. Permanent permanent = card.PermanentOfThisCard();
  127. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  128. (permanent.TopCard.HasText("Pulsemon") ||
  129. (permanent.TopCard.HasSocTraits || permanent.TopCard.HasSeekersTraits));
  130. }
  131. if (timing == EffectTiming.OnAllyAttack)
  132. {
  133. cardEffects.Add(CardEffectFactory.AllianceSelfEffect(isInheritedEffect: true, card: card, condition: ESSDigimonCondition));
  134. }
  135. if (timing == EffectTiming.OnDetermineDoSecurityCheck)
  136. {
  137. cardEffects.Add(CardEffectFactory.PierceSelfEffect(isInheritedEffect: true, card: card, condition: ESSDigimonCondition));
  138. }
  139. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  140. {
  141. cardEffects.Add(CardEffectFactory.BarrierSelfEffect(isInheritedEffect: true, card: card, condition: ESSDigimonCondition));
  142. }
  143. #endregion
  144. #region End of All Turns
  145. if (timing == EffectTiming.OnEndTurn)
  146. {
  147. ActivateClass activateClass = new ActivateClass();
  148. activateClass.SetUpICardEffect("Play 1 [Eiji Nagasumi] from this Digimon's digivolution cards", CanUseCondition, card);
  149. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  150. activateClass.SetIsInheritedEffect(true);
  151. cardEffects.Add(activateClass);
  152. string EffectDescription()
  153. {
  154. return
  155. "[End of All Turns] You may play 1 [Eiji Nagasumi] from this Digimon's digivolution cards without paying the cost.";
  156. }
  157. bool IsEijiCardCondition(CardSource cardSource)
  158. {
  159. return CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass) &&
  160. cardSource.EqualsCardName("Eiji Nagasumi");
  161. }
  162. bool CanUseCondition(Hashtable hashtable)
  163. {
  164. return CardEffectCommons.IsExistOnBattleArea(card);
  165. }
  166. bool CanActivateCondition(Hashtable hashtable)
  167. {
  168. return CardEffectCommons.IsExistOnBattleArea(card) &&
  169. card.PermanentOfThisCard().DigivolutionCards.Some(IsEijiCardCondition);
  170. }
  171. IEnumerator ActivateCoroutine(Hashtable hashtable)
  172. {
  173. if (CardEffectCommons.IsExistOnBattleArea(card))
  174. {
  175. Permanent selectedPermanent = card.PermanentOfThisCard();
  176. if (selectedPermanent != null)
  177. {
  178. if (selectedPermanent.DigivolutionCards.Some(IsEijiCardCondition))
  179. {
  180. int maxCount = 1;
  181. List<CardSource> selectedCards = new List<CardSource>();
  182. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  183. selectCardEffect.SetUp(
  184. canTargetCondition: IsEijiCardCondition,
  185. canTargetCondition_ByPreSelecetedList: null,
  186. canEndSelectCondition: null,
  187. canNoSelect: () => true,
  188. selectCardCoroutine: SelectCardCoroutine,
  189. afterSelectCardCoroutine: null,
  190. message: "Select 1 digivolution card to play.",
  191. maxCount: maxCount,
  192. canEndNotMax: false,
  193. isShowOpponent: true,
  194. mode: SelectCardEffect.Mode.Custom,
  195. root: SelectCardEffect.Root.Custom,
  196. customRootCardList: selectedPermanent.DigivolutionCards,
  197. canLookReverseCard: true,
  198. selectPlayer: card.Owner,
  199. cardEffect: activateClass);
  200. selectCardEffect.SetUpCustomMessage("Select 1 digivolution card to play.",
  201. "The opponent is selecting 1 digivolution card to play.");
  202. selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
  203. yield return StartCoroutine(selectCardEffect.Activate());
  204. IEnumerator SelectCardCoroutine(CardSource cardSource)
  205. {
  206. selectedCards.Add(cardSource);
  207. yield return null;
  208. }
  209. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  210. cardSources: selectedCards,
  211. activateClass: activateClass,
  212. payCost: false,
  213. isTapped: false,
  214. root: SelectCardEffect.Root.DigivolutionCards,
  215. activateETB: true));
  216. }
  217. }
  218. }
  219. }
  220. }
  221. #endregion
  222. #region Security Effect
  223. if (timing == EffectTiming.SecuritySkill)
  224. {
  225. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  226. }
  227. #endregion
  228. return cardEffects;
  229. }
  230. }
  231. }