BT20_026.cs 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System;
  5. namespace DCGO.CardEffects.BT20
  6. {
  7. public class BT20_026 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternate Digivolution Requirement
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.EqualsCardName("MegaSeadramon");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  20. permanentCondition: PermanentCondition,
  21. digivolutionCost: 0,
  22. ignoreDigivolutionRequirement: false,
  23. card: card,
  24. condition: null)
  25. );
  26. }
  27. #endregion
  28. #region On Play
  29. if (timing == EffectTiming.OnEnterFieldAnyone)
  30. {
  31. ActivateClass activateClass = new ActivateClass();
  32. activateClass.SetUpICardEffect("Return 1 opponent's Digimon to bottom deck and apply an effect to an opponent's Digimon", CanUseCondition, card);
  33. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  34. cardEffects.Add(activateClass);
  35. string EffectDiscription()
  36. {
  37. return "[On Play] Return 1 of your opponent's level 4 or lower Digimon to the bottom of the deck. Then, if [MegaSeadramon]/[X Antibody] is in this Digimon's digivolution cards, 1 of your opponent's Digimon can't suspend until the end of their turn.";
  38. }
  39. bool CanUseCondition(Hashtable hashtable)
  40. {
  41. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  42. }
  43. bool CanSelectPermanentCondition(Permanent permanent)
  44. {
  45. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  46. {
  47. if (permanent.Level <= 4)
  48. {
  49. return true;
  50. }
  51. }
  52. return false;
  53. }
  54. bool CanSelectOpponentDigimonCondition(Permanent permanent)
  55. {
  56. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  57. {
  58. if (permanent.IsDigimon)
  59. {
  60. return true;
  61. }
  62. }
  63. return false;
  64. }
  65. bool CanActivateCondition(Hashtable hashtable)
  66. {
  67. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  68. {
  69. return true;
  70. }
  71. return false;
  72. }
  73. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  74. {
  75. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  76. {
  77. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  78. selectPermanentEffect.SetUp(
  79. selectPlayer: card.Owner,
  80. canTargetCondition: CanSelectPermanentCondition,
  81. canTargetCondition_ByPreSelecetedList: null,
  82. canEndSelectCondition: null,
  83. maxCount: 1,
  84. canNoSelect: false,
  85. canEndNotMax: false,
  86. selectPermanentCoroutine: null,
  87. afterSelectPermanentCoroutine: null,
  88. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  89. cardEffect: activateClass);
  90. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  91. }
  92. if (card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.EqualsCardName("MegaSeadramon") || cardSource.EqualsCardName("X Antibody")) >= 1)
  93. {
  94. if (card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectOpponentDigimonCondition) >= 1)
  95. {
  96. int maxCount = Math.Min(1, card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectOpponentDigimonCondition));
  97. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  98. selectPermanentEffect.SetUp(
  99. selectPlayer: card.Owner,
  100. canTargetCondition: CanSelectOpponentDigimonCondition,
  101. canTargetCondition_ByPreSelecetedList: null,
  102. canEndSelectCondition: null,
  103. maxCount: maxCount,
  104. canNoSelect: false,
  105. canEndNotMax: false,
  106. selectPermanentCoroutine: SelectPermanentCoroutine,
  107. afterSelectPermanentCoroutine: null,
  108. mode: SelectPermanentEffect.Mode.Custom,
  109. cardEffect: activateClass);
  110. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get unable to suspend.", "The opponent is selecting 1 Digimon that will get unable to suspend.");
  111. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  112. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  113. {
  114. Permanent selectedPermanent = permanent;
  115. if (selectedPermanent != null)
  116. {
  117. CanNotSuspendClass canNotSuspendClass = new CanNotSuspendClass();
  118. canNotSuspendClass.SetUpICardEffect("Can't Suspend", CanUseCondition1, card);
  119. canNotSuspendClass.SetUpCanNotSuspendClass(PermanentCondition: PermanentCondition);
  120. selectedPermanent.UntilOwnerTurnEndEffects.Add((_timing) => canNotSuspendClass);
  121. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  122. {
  123. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  124. }
  125. bool CanUseCondition1(Hashtable hashtable)
  126. {
  127. if (selectedPermanent.TopCard != null)
  128. {
  129. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  130. {
  131. return true;
  132. }
  133. }
  134. return false;
  135. }
  136. bool PermanentCondition(Permanent permanent)
  137. {
  138. if (permanent == selectedPermanent)
  139. {
  140. return true;
  141. }
  142. return false;
  143. }
  144. }
  145. }
  146. }
  147. }
  148. }
  149. }
  150. #endregion
  151. #region When Digivolving
  152. if (timing == EffectTiming.OnEnterFieldAnyone)
  153. {
  154. ActivateClass activateClass = new ActivateClass();
  155. activateClass.SetUpICardEffect("Return 1 opponent's Digimon to bottom deck and apply an effect to an opponent's Digimon", CanUseCondition, card);
  156. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  157. cardEffects.Add(activateClass);
  158. string EffectDiscription()
  159. {
  160. return "[When Digivolving] Return 1 of your opponent's level 4 or lower Digimon to the bottom of the deck. Then, if [MegaSeadramon]/[X Antibody] is in this Digimon's digivolution cards, 1 of your opponent's Digimon can't suspend until the end of their turn.";
  161. }
  162. bool CanUseCondition(Hashtable hashtable)
  163. {
  164. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  165. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  166. return false;
  167. }
  168. bool CanSelectPermanentCondition(Permanent permanent)
  169. {
  170. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  171. {
  172. if (permanent.Level <= 4)
  173. {
  174. return true;
  175. }
  176. }
  177. return false;
  178. }
  179. bool CanSelectOpponentDigimonCondition(Permanent permanent)
  180. {
  181. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  182. {
  183. if (permanent.IsDigimon)
  184. {
  185. return true;
  186. }
  187. }
  188. return false;
  189. }
  190. bool CanActivateCondition(Hashtable hashtable)
  191. {
  192. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  193. {
  194. return true;
  195. }
  196. return false;
  197. }
  198. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  199. {
  200. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  201. {
  202. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  203. selectPermanentEffect.SetUp(
  204. selectPlayer: card.Owner,
  205. canTargetCondition: CanSelectPermanentCondition,
  206. canTargetCondition_ByPreSelecetedList: null,
  207. canEndSelectCondition: null,
  208. maxCount: 1,
  209. canNoSelect: false,
  210. canEndNotMax: false,
  211. selectPermanentCoroutine: null,
  212. afterSelectPermanentCoroutine: null,
  213. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  214. cardEffect: activateClass);
  215. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  216. }
  217. if (card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.EqualsCardName("MegaSeadramon") || cardSource.EqualsCardName("X Antibody")) >= 1)
  218. {
  219. if (card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectOpponentDigimonCondition) >= 1)
  220. {
  221. int maxCount = Math.Min(1, card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectOpponentDigimonCondition));
  222. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  223. selectPermanentEffect.SetUp(
  224. selectPlayer: card.Owner,
  225. canTargetCondition: CanSelectOpponentDigimonCondition,
  226. canTargetCondition_ByPreSelecetedList: null,
  227. canEndSelectCondition: null,
  228. maxCount: maxCount,
  229. canNoSelect: false,
  230. canEndNotMax: false,
  231. selectPermanentCoroutine: SelectPermanentCoroutine,
  232. afterSelectPermanentCoroutine: null,
  233. mode: SelectPermanentEffect.Mode.Custom,
  234. cardEffect: activateClass);
  235. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get unable to suspend.", "The opponent is selecting 1 Digimon that will get unable to suspend.");
  236. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  237. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  238. {
  239. Permanent selectedPermanent = permanent;
  240. if (selectedPermanent != null)
  241. {
  242. CanNotSuspendClass canNotSuspendClass = new CanNotSuspendClass();
  243. canNotSuspendClass.SetUpICardEffect("Can't Suspend", CanUseCondition1, card);
  244. canNotSuspendClass.SetUpCanNotSuspendClass(PermanentCondition: PermanentCondition);
  245. selectedPermanent.UntilOwnerTurnEndEffects.Add((_timing) => canNotSuspendClass);
  246. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  247. {
  248. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  249. }
  250. bool CanUseCondition1(Hashtable hashtable)
  251. {
  252. if (selectedPermanent.TopCard != null)
  253. {
  254. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  255. {
  256. return true;
  257. }
  258. }
  259. return false;
  260. }
  261. bool PermanentCondition(Permanent permanent)
  262. {
  263. if (permanent == selectedPermanent)
  264. {
  265. return true;
  266. }
  267. return false;
  268. }
  269. }
  270. }
  271. }
  272. }
  273. }
  274. }
  275. #endregion
  276. #region Inherit
  277. if (timing == EffectTiming.None)
  278. {
  279. CanNotSwitchAttackTargetClass canNotSwitchAttackTargetClass = new CanNotSwitchAttackTargetClass();
  280. canNotSwitchAttackTargetClass.SetUpICardEffect("This Digimon's attack target can't change.", CanUseCondition, card);
  281. canNotSwitchAttackTargetClass.SetUpCanNotSwitchAttackTargetClass(PermanentCondition: PermanentCondition);
  282. canNotSwitchAttackTargetClass.SetIsInheritedEffect(true);
  283. cardEffects.Add(canNotSwitchAttackTargetClass);
  284. bool CanUseCondition(Hashtable hashtable)
  285. {
  286. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.IsOwnerTurn(card);
  287. }
  288. bool PermanentCondition(Permanent permanent)
  289. {
  290. return permanent != null && permanent.TopCard && permanent == card.PermanentOfThisCard();
  291. }
  292. }
  293. #endregion
  294. return cardEffects;
  295. }
  296. }
  297. }