BT17_086.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT17
  5. {
  6. public class BT17_086 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Security Effect
  12. if (timing == EffectTiming.SecuritySkill)
  13. {
  14. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  15. }
  16. #endregion
  17. #region Start of Your Main Phase
  18. if (timing == EffectTiming.OnStartMainPhase)
  19. {
  20. ActivateClass activateClass = new ActivateClass();
  21. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  22. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  23. cardEffects.Add(activateClass);
  24. string EffectDiscription()
  25. {
  26. return "[Start of Your Main Phase] If you have a Digimon with [Pulsemon] in its text, gain 1 memory..";
  27. }
  28. bool CanUseCondition(Hashtable hashtable)
  29. {
  30. if (CardEffectCommons.IsExistOnBattleArea(card))
  31. {
  32. if (CardEffectCommons.IsOwnerTurn(card))
  33. {
  34. return true;
  35. }
  36. }
  37. return false;
  38. }
  39. bool CanActivateCondition(Hashtable hashtable)
  40. {
  41. if (isExistOnField(card))
  42. {
  43. if (card.Owner.GetBattleAreaPermanents().Contains(card.PermanentOfThisCard()))
  44. {
  45. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon && permanent.TopCard.HasPulsemonText))
  46. {
  47. if (card.Owner.CanAddMemory(activateClass))
  48. {
  49. return true;
  50. }
  51. }
  52. }
  53. }
  54. return false;
  55. }
  56. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  57. {
  58. if (isExistOnField(card))
  59. {
  60. if (card.Owner.CanAddMemory(activateClass))
  61. {
  62. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  63. }
  64. }
  65. }
  66. }
  67. #endregion
  68. #region Mind Link
  69. if (timing == EffectTiming.OnDeclaration)
  70. {
  71. ActivateClass activateClass = new ActivateClass();
  72. activateClass.SetUpICardEffect("Mind Link", CanUseCondition, card);
  73. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  74. cardEffects.Add(activateClass);
  75. string EffectDiscription()
  76. {
  77. return "[Main] <Mind Link> with 1 of your Digimon with [Pulsemon] in text. (Place this Tamer as that Digimon's bottom digivolution card if there are no Tamer cards in its digivolution cards.)";
  78. }
  79. bool CanSelectPermanentCondition(Permanent permanent)
  80. {
  81. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  82. {
  83. if (permanent.TopCard.HasText("Pulsemon"))
  84. {
  85. return true;
  86. }
  87. }
  88. return false;
  89. }
  90. bool CanUseCondition(Hashtable hashtable)
  91. {
  92. if (CardEffectCommons.IsExistOnBattleArea(card))
  93. {
  94. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  95. {
  96. return true;
  97. }
  98. }
  99. return false;
  100. }
  101. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  102. {
  103. yield return ContinuousController.instance.StartCoroutine(
  104. new MindLinkClass(
  105. tamer: card.PermanentOfThisCard(),
  106. digimonCondition: CanSelectPermanentCondition,
  107. activateClass: activateClass
  108. ).MindLink()
  109. );
  110. }
  111. }
  112. #endregion
  113. #region Inherit
  114. if (timing == EffectTiming.None)
  115. {
  116. bool Condition()
  117. {
  118. if (CardEffectCommons.IsExistOnBattleArea(card))
  119. {
  120. if (card.PermanentOfThisCard().TopCard.HasText("Pulsemon"))
  121. {
  122. return true;
  123. }
  124. }
  125. return false;
  126. }
  127. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: true, card: card, condition: Condition));
  128. }
  129. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  130. {
  131. bool Condition()
  132. {
  133. if (CardEffectCommons.IsExistOnBattleArea(card))
  134. {
  135. if (card.PermanentOfThisCard().TopCard.HasText("Pulsemon"))
  136. {
  137. return true;
  138. }
  139. }
  140. return false;
  141. }
  142. cardEffects.Add(CardEffectFactory.BarrierSelfEffect(isInheritedEffect: true, card: card, condition: Condition));
  143. }
  144. #endregion
  145. #region End Mind Link
  146. if (timing == EffectTiming.OnEndTurn)
  147. {
  148. ActivateClass activateClass = new ActivateClass();
  149. activateClass.SetUpICardEffect("Play 1 [Leon Alexander] from this Digimon's digivolution cards", CanUseCondition, card);
  150. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  151. activateClass.SetIsInheritedEffect(true);
  152. cardEffects.Add(activateClass);
  153. string EffectDiscription()
  154. {
  155. return "[End of All Turns] You may play 1 [Leon Alexander] from this Digimon's digivolution cards without paying the cost.";
  156. }
  157. bool CanSelectCardCondition(CardSource cardSource)
  158. {
  159. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  160. {
  161. if (cardSource.CardNames.Contains("Leon Alexander"))
  162. {
  163. return true;
  164. }
  165. if (cardSource.CardNames.Contains("LeonAlexander"))
  166. {
  167. return true;
  168. }
  169. }
  170. return false;
  171. }
  172. bool CanUseCondition(Hashtable hashtable)
  173. {
  174. if (CardEffectCommons.IsExistOnBattleArea(card))
  175. {
  176. return true;
  177. }
  178. return false;
  179. }
  180. bool CanActivateCondition(Hashtable hashtable)
  181. {
  182. if (CardEffectCommons.IsExistOnBattleArea(card))
  183. {
  184. if (card.PermanentOfThisCard().DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  185. {
  186. return true;
  187. }
  188. }
  189. return false;
  190. }
  191. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  192. {
  193. if (CardEffectCommons.IsExistOnBattleArea(card))
  194. {
  195. Permanent selectedPermanent = card.PermanentOfThisCard();
  196. if (selectedPermanent != null)
  197. {
  198. if (selectedPermanent.DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  199. {
  200. int maxCount = 1;
  201. List<CardSource> selectedCards = new List<CardSource>();
  202. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  203. selectCardEffect.SetUp(
  204. canTargetCondition: CanSelectCardCondition,
  205. canTargetCondition_ByPreSelecetedList: null,
  206. canEndSelectCondition: null,
  207. canNoSelect: () => true,
  208. selectCardCoroutine: SelectCardCoroutine,
  209. afterSelectCardCoroutine: null,
  210. message: "Select 1 digivolution card to play.",
  211. maxCount: maxCount,
  212. canEndNotMax: false,
  213. isShowOpponent: true,
  214. mode: SelectCardEffect.Mode.Custom,
  215. root: SelectCardEffect.Root.Custom,
  216. customRootCardList: selectedPermanent.DigivolutionCards,
  217. canLookReverseCard: true,
  218. selectPlayer: card.Owner,
  219. cardEffect: activateClass);
  220. selectCardEffect.SetUpCustomMessage("Select 1 digivolution card to play.",
  221. "The opponent is selecting 1 digivolution card to play.");
  222. selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
  223. yield return StartCoroutine(selectCardEffect.Activate());
  224. IEnumerator SelectCardCoroutine(CardSource cardSource)
  225. {
  226. selectedCards.Add(cardSource);
  227. yield return null;
  228. }
  229. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  230. cardSources: selectedCards,
  231. activateClass: activateClass,
  232. payCost: false,
  233. isTapped: false,
  234. root: SelectCardEffect.Root.DigivolutionCards,
  235. activateETB: true));
  236. }
  237. }
  238. }
  239. }
  240. }
  241. #endregion
  242. return cardEffects;
  243. }
  244. }
  245. }