BT15_054.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT15
  6. {
  7. public class BT15_054 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. //Alternate Digivolution Requirement
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.EqualsCardName("Rosemon");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  20. permanentCondition: PermanentCondition,
  21. digivolutionCost: 1,
  22. ignoreDigivolutionRequirement: false,
  23. card: card,
  24. condition: null));
  25. }
  26. #region When Digivolving
  27. if (timing == EffectTiming.OnEnterFieldAnyone)
  28. {
  29. ActivateClass activateClass = new ActivateClass();
  30. activateClass.SetUpICardEffect("Opponent's 1 Digimon and 1 Tamer is suspended and can't unsuspend", CanUseCondition, card);
  31. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  32. cardEffects.Add(activateClass);
  33. string EffectDiscription()
  34. {
  35. return "[When Digivolving] Suspend 1 of your opponent's Digimon and 1 of their Tamers. They can't unsuspend until the end of their turn.";
  36. }
  37. bool CanSelectPermanent(Permanent permanent)
  38. {
  39. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card);
  40. }
  41. bool CanSelectDigimonCard(Permanent permanent)
  42. {
  43. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  44. }
  45. bool CanSelectTamerCard(Permanent permanent)
  46. {
  47. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  48. {
  49. if (permanent.IsTamer)
  50. return true;
  51. }
  52. return false;
  53. }
  54. bool CanUseCondition(Hashtable hashtable)
  55. {
  56. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  57. }
  58. bool CanActivateCondition(Hashtable hashtable)
  59. {
  60. if (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
  61. {
  62. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanent))
  63. {
  64. if (CardEffectCommons.IsExistOnBattleArea(card))
  65. {
  66. return true;
  67. }
  68. }
  69. }
  70. return false;
  71. }
  72. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  73. {
  74. List<CardSource> selectedCards = new List<CardSource>();
  75. int maxCount = 0;
  76. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectDigimonCard))
  77. {
  78. maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectDigimonCard));
  79. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  80. selectPermanentEffect.SetUp(
  81. selectPlayer: card.Owner,
  82. canTargetCondition: CanSelectDigimonCard,
  83. canTargetCondition_ByPreSelecetedList: null,
  84. canEndSelectCondition: null,
  85. maxCount: maxCount,
  86. canNoSelect: false,
  87. canEndNotMax: false,
  88. selectPermanentCoroutine: SelectPermanentCoroutine,
  89. afterSelectPermanentCoroutine: null,
  90. mode: SelectPermanentEffect.Mode.Tap,
  91. cardEffect: activateClass);
  92. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will suspend and get unable to unsuspend.", "The opponent is selecting 1 Digimon that will suspend and get unable to unsuspend.");
  93. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  94. }
  95. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectTamerCard))
  96. {
  97. maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectTamerCard));
  98. SelectPermanentEffect selectTamerEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  99. selectTamerEffect.SetUp(
  100. selectPlayer: card.Owner,
  101. canTargetCondition: CanSelectTamerCard,
  102. canTargetCondition_ByPreSelecetedList: null,
  103. canEndSelectCondition: null,
  104. maxCount: maxCount,
  105. canNoSelect: false,
  106. canEndNotMax: false,
  107. selectPermanentCoroutine: SelectPermanentCoroutine,
  108. afterSelectPermanentCoroutine: null,
  109. mode: SelectPermanentEffect.Mode.Tap,
  110. cardEffect: activateClass);
  111. selectTamerEffect.SetUpCustomMessage(
  112. "Select 1 Tamer that will suspend and get unable to unsuspend.",
  113. "The opponent is selecting 1 Tamer that will suspend and get unable to unsuspend.");
  114. yield return ContinuousController.instance.StartCoroutine(selectTamerEffect.Activate());
  115. }
  116. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  117. {
  118. selectedCards.Add(permanent.TopCard);
  119. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCantUnsuspendUntilOpponentTurnEnd(
  120. targetPermanent: permanent,
  121. activateClass: activateClass
  122. ));
  123. }
  124. }
  125. }
  126. #endregion
  127. #region Opponent's Turn Digimon Played
  128. if (timing == EffectTiming.OnEnterFieldAnyone)
  129. {
  130. ActivateClass activateClass = new ActivateClass();
  131. activateClass.SetUpICardEffect("Suspend 1 of your Opponent's Digimon", CanUseCondition, card);
  132. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  133. activateClass.SetHashString("Suspend1WhenPlayed_BT15_054");
  134. cardEffects.Add(activateClass);
  135. string EffectDiscription()
  136. {
  137. return "[Opponent's Turn] [Once Per Turn] When an opponent's Digimon is played, you may suspend 1 of their Digimon.";
  138. }
  139. bool PermanentCondition(Permanent permanent)
  140. {
  141. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  142. }
  143. bool CanUseCondition(Hashtable hashtable)
  144. {
  145. return CardEffectCommons.IsOpponentTurn(card) &&
  146. CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  147. CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition);
  148. }
  149. bool CanActivateCondition(Hashtable hashtable)
  150. {
  151. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  152. }
  153. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  154. {
  155. if (CardEffectCommons.HasMatchConditionPermanent(PermanentCondition))
  156. {
  157. List<CardSource> selectedCards = new List<CardSource>();
  158. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(PermanentCondition));
  159. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  160. selectPermanentEffect.SetUp(
  161. selectPlayer: card.Owner,
  162. canTargetCondition: PermanentCondition,
  163. canTargetCondition_ByPreSelecetedList: null,
  164. canEndSelectCondition: null,
  165. maxCount: maxCount,
  166. canNoSelect: false,
  167. canEndNotMax: false,
  168. selectPermanentCoroutine: null,
  169. afterSelectPermanentCoroutine: null,
  170. mode: SelectPermanentEffect.Mode.Tap,
  171. cardEffect: activateClass);
  172. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to suspend.", "The opponent is selecting 1 Digimon to suspend.");
  173. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  174. }
  175. }
  176. }
  177. #endregion
  178. #region Opponent's Turn Digimon Enters From Raising Area
  179. if (timing == EffectTiming.OnMove)
  180. {
  181. ActivateClass activateClass = new ActivateClass();
  182. activateClass.SetUpICardEffect("Suspend 1 of your Opponent's Digimon", CanUseCondition, card);
  183. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  184. activateClass.SetHashString("Suspend1FromBreeding_BT15_054");
  185. cardEffects.Add(activateClass);
  186. string EffectDiscription()
  187. {
  188. return "[Opponent's Turn] [Once Per Turn] When an opponent's Digimon moves from the breeding area to the battle area, if [Rosemon] or [X Antibody] in this Digimon's digivolution cards, you may suspend 1 of their Digimon.";
  189. }
  190. bool PermanentCondition(Permanent permanent)
  191. {
  192. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  193. }
  194. bool CanUseCondition(Hashtable hashtable)
  195. {
  196. if (CardEffectCommons.IsExistOnBattleArea(card))
  197. {
  198. if (CardEffectCommons.IsOpponentTurn(card))
  199. {
  200. if (CardEffectCommons.CanTriggerOnMove(hashtable, PermanentCondition))
  201. {
  202. return CardEffectCommons.HasMatchConditionPermanent(PermanentCondition);
  203. }
  204. }
  205. }
  206. return false;
  207. }
  208. bool CanActivateCondition(Hashtable hashtable)
  209. {
  210. if (CardEffectCommons.IsExistOnBattleArea(card))
  211. {
  212. if (card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.EqualsCardName("Rosemon") || cardSource.EqualsCardName("X Antibody")) >= 1)
  213. {
  214. return true;
  215. }
  216. }
  217. return false;
  218. }
  219. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  220. {
  221. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(PermanentCondition));
  222. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  223. selectPermanentEffect.SetUp(
  224. selectPlayer: card.Owner,
  225. canTargetCondition: PermanentCondition,
  226. canTargetCondition_ByPreSelecetedList: null,
  227. canEndSelectCondition: null,
  228. maxCount: maxCount,
  229. canNoSelect: false,
  230. canEndNotMax: false,
  231. selectPermanentCoroutine: null,
  232. afterSelectPermanentCoroutine: null,
  233. mode: SelectPermanentEffect.Mode.Tap,
  234. cardEffect: activateClass);
  235. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  236. }
  237. }
  238. #endregion
  239. return cardEffects;
  240. }
  241. }
  242. }