BT16_086.cs 10 KB

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