BT20_084.cs 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  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_084 : 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. if (targetPermanent.TopCard.EqualsCardName("Sistermon Ciel"))
  18. {
  19. return true;
  20. }
  21. return false;
  22. }
  23. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  24. permanentCondition: PermanentCondition,
  25. digivolutionCost: 1,
  26. ignoreDigivolutionRequirement: false,
  27. card: card,
  28. condition: null));
  29. }
  30. #endregion
  31. #region All Turns - When opponent plays digimon/tamer
  32. if (timing == EffectTiming.OnEnterFieldAnyone)
  33. {
  34. ActivateClass activateClass = new ActivateClass();
  35. activateClass.SetUpICardEffect("Digivolve 1 [Sistermon Ciel (Awakened)] from trash", CanUseCondition, card);
  36. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  37. cardEffects.Add(activateClass);
  38. string EffectDiscription()
  39. {
  40. return "[Trash] [All Turns] When any of your Digimon are played, 1 of your [Sistermon Ciel] may digivolve into this card without paying the cost.";
  41. }
  42. #region Digimon/Tamer Played/card is in trash condition
  43. bool PermanentCondition(Permanent permanent)
  44. {
  45. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  46. }
  47. bool CanUseCondition(Hashtable hashtable)
  48. {
  49. if (CardEffectCommons.IsExistOnTrash(card))
  50. {
  51. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition))
  52. {
  53. return true;
  54. }
  55. }
  56. return false;
  57. }
  58. #endregion
  59. #region Selectable Digimon Conditions
  60. bool CanSelectPermanentCondition(Permanent permanent)
  61. {
  62. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  63. {
  64. if (CanSelectCardCondition(permanent.TopCard))
  65. {
  66. if (card.CanPlayCardTargetFrame(permanent.PermanentFrame, false, activateClass, root: SelectCardEffect.Root.Trash))
  67. {
  68. return true;
  69. }
  70. }
  71. }
  72. return false;
  73. }
  74. bool CanSelectCardCondition(CardSource cardSource)
  75. {
  76. if (CardEffectCommons.IsExistOnBattleAreaDigimon(cardSource))
  77. {
  78. if (cardSource.EqualsCardName("Sistermon Ciel"))
  79. {
  80. return true;
  81. }
  82. }
  83. return false;
  84. }
  85. #endregion
  86. bool CanActivateCondition(Hashtable hashtable)
  87. {
  88. if (CardEffectCommons.IsExistOnTrash(card))
  89. {
  90. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  91. {
  92. return true;
  93. }
  94. }
  95. return false;
  96. }
  97. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  98. {
  99. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  100. {
  101. Permanent selectedPermanent = null;
  102. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  103. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  104. selectPermanentEffect.SetUp(
  105. selectPlayer: card.Owner,
  106. canTargetCondition: CanSelectPermanentCondition,
  107. canTargetCondition_ByPreSelecetedList: null,
  108. canEndSelectCondition: null,
  109. maxCount: maxCount,
  110. canNoSelect: true,
  111. canEndNotMax: false,
  112. selectPermanentCoroutine: SelectPermanentCoroutine,
  113. afterSelectPermanentCoroutine: null,
  114. mode: SelectPermanentEffect.Mode.Custom,
  115. cardEffect: activateClass);
  116. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will digivolve.", "The opponent is selecting 1 Digimon that will digivolve.");
  117. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  118. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  119. {
  120. selectedPermanent = permanent;
  121. yield return null;
  122. }
  123. if (selectedPermanent != null)
  124. {
  125. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  126. targetPermanent: selectedPermanent,
  127. cardCondition: null,
  128. payCost: false,
  129. reduceCostTuple: null,
  130. fixedCostTuple: null,
  131. ignoreDigivolutionRequirementFixedCost: -1,
  132. isHand: false,
  133. activateClass: activateClass,
  134. successProcess: null,
  135. ignoreSelection: true));
  136. }
  137. }
  138. }
  139. }
  140. #endregion
  141. #region On Play
  142. if (timing == EffectTiming.OnEnterFieldAnyone)
  143. {
  144. ActivateClass activateClass = new ActivateClass();
  145. activateClass.SetUpICardEffect("1 Digimon/Tamer can't suspend", CanUseCondition, card);
  146. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  147. cardEffects.Add(activateClass);
  148. string EffectDiscription()
  149. {
  150. return "[On Play] 1 of your opponent's Digimon or Tamers can't suspend until the end of their turn.";
  151. }
  152. bool OpponentsDigimonOrTamer(Permanent permanent)
  153. {
  154. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card) &&
  155. (permanent.IsDigimon || permanent.IsTamer);
  156. }
  157. bool CanUseCondition(Hashtable hashtable)
  158. {
  159. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  160. }
  161. bool CanActivateCondition(Hashtable hashtable)
  162. {
  163. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  164. CardEffectCommons.HasMatchConditionPermanent(OpponentsDigimonOrTamer);
  165. }
  166. IEnumerator ActivateCoroutine(Hashtable hashtable)
  167. {
  168. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  169. selectPermanentEffect.SetUp(
  170. selectPlayer: card.Owner,
  171. canTargetCondition: OpponentsDigimonOrTamer,
  172. canTargetCondition_ByPreSelecetedList: null,
  173. canEndSelectCondition: null,
  174. maxCount: 1,
  175. canNoSelect: false,
  176. canEndNotMax: false,
  177. selectPermanentCoroutine: SelectPermanentCoroutine,
  178. afterSelectPermanentCoroutine: null,
  179. mode: SelectPermanentEffect.Mode.Custom,
  180. cardEffect: activateClass);
  181. selectPermanentEffect.SetUpCustomMessage("Select Digimon or Tamer that will get unable to suspend.",
  182. "The opponent is selecting Digimon or Tamer that will get unable to suspend.");
  183. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  184. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  185. {
  186. Permanent selectedPermanent = permanent;
  187. if (selectedPermanent != null)
  188. {
  189. CanNotSuspendClass canNotSuspendClass = new CanNotSuspendClass();
  190. canNotSuspendClass.SetUpICardEffect("Can't Suspend", CanUseCondition1, card);
  191. canNotSuspendClass.SetUpCanNotSuspendClass(PermanentCondition: PermanentCondition);
  192. selectedPermanent.UntilOwnerTurnEndEffects.Add((_timing) => canNotSuspendClass);
  193. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  194. {
  195. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  196. }
  197. bool CanUseCondition1(Hashtable hashtable)
  198. {
  199. if (selectedPermanent.TopCard != null)
  200. {
  201. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  202. {
  203. return true;
  204. }
  205. }
  206. return false;
  207. }
  208. bool PermanentCondition(Permanent permanent)
  209. {
  210. if (permanent == selectedPermanent)
  211. {
  212. return true;
  213. }
  214. return false;
  215. }
  216. }
  217. }
  218. }
  219. }
  220. #endregion
  221. #region When Digivolving
  222. if (timing == EffectTiming.OnEnterFieldAnyone)
  223. {
  224. ActivateClass activateClass = new ActivateClass();
  225. activateClass.SetUpICardEffect("1 Digimon/Tamer can't suspend", CanUseCondition, card);
  226. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  227. cardEffects.Add(activateClass);
  228. string EffectDiscription()
  229. {
  230. return "[When Digivolving] 1 of your opponent's Digimon or Tamers can't suspend until the end of their turn.";
  231. }
  232. bool OpponentsDigimonOrTamer(Permanent permanent)
  233. {
  234. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card) &&
  235. (permanent.IsDigimon || permanent.IsTamer);
  236. }
  237. bool CanUseCondition(Hashtable hashtable)
  238. {
  239. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  240. CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  241. }
  242. bool CanActivateCondition(Hashtable hashtable)
  243. {
  244. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  245. CardEffectCommons.HasMatchConditionPermanent(OpponentsDigimonOrTamer);
  246. }
  247. IEnumerator ActivateCoroutine(Hashtable hashtable)
  248. {
  249. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  250. selectPermanentEffect.SetUp(
  251. selectPlayer: card.Owner,
  252. canTargetCondition: OpponentsDigimonOrTamer,
  253. canTargetCondition_ByPreSelecetedList: null,
  254. canEndSelectCondition: null,
  255. maxCount: 1,
  256. canNoSelect: false,
  257. canEndNotMax: false,
  258. selectPermanentCoroutine: SelectPermanentCoroutine,
  259. afterSelectPermanentCoroutine: null,
  260. mode: SelectPermanentEffect.Mode.Custom,
  261. cardEffect: activateClass);
  262. selectPermanentEffect.SetUpCustomMessage("Select Digimon or Tamer that will get unable to suspend.",
  263. "The opponent is selecting Digimon or Tamer that will get unable to suspend.");
  264. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  265. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  266. {
  267. Permanent selectedPermanent = permanent;
  268. if (selectedPermanent != null)
  269. {
  270. CanNotSuspendClass canNotSuspendClass = new CanNotSuspendClass();
  271. canNotSuspendClass.SetUpICardEffect("Can't Suspend", CanUseCondition1, card);
  272. canNotSuspendClass.SetUpCanNotSuspendClass(PermanentCondition: PermanentCondition);
  273. selectedPermanent.UntilOwnerTurnEndEffects.Add((_timing) => canNotSuspendClass);
  274. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  275. {
  276. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  277. }
  278. bool CanUseCondition1(Hashtable hashtable)
  279. {
  280. if (selectedPermanent.TopCard != null)
  281. {
  282. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  283. {
  284. return true;
  285. }
  286. }
  287. return false;
  288. }
  289. bool PermanentCondition(Permanent permanent)
  290. {
  291. if (permanent == selectedPermanent)
  292. {
  293. return true;
  294. }
  295. return false;
  296. }
  297. }
  298. }
  299. }
  300. }
  301. #endregion
  302. #region End of all Turns
  303. if (timing == EffectTiming.OnEndTurn)
  304. {
  305. ActivateClass activateClass = new ActivateClass();
  306. activateClass.SetUpICardEffect("Place top card as top security", CanUseCondition, card);
  307. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  308. cardEffects.Add(activateClass);
  309. string EffectDiscription()
  310. {
  311. return "[End of All Turns] Place this Digimon's top stacked card as the top security card.";
  312. }
  313. bool CanUseCondition(Hashtable hashtable)
  314. {
  315. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  316. }
  317. bool CanActivateCondition(Hashtable hashtable)
  318. {
  319. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  320. card.PermanentOfThisCard().DigivolutionCards.Count > 0;
  321. }
  322. IEnumerator ActivateCoroutine(Hashtable hashtable)
  323. {
  324. // Place this card face up as the bottom security card
  325. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddSecurityCard(
  326. card, toTop: true, faceUp: false));
  327. }
  328. }
  329. #endregion
  330. return cardEffects;
  331. }
  332. }
  333. }