Rosemon_X_Antibody_BT15_054.cs 12 KB

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