EX9_019.cs 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. //WereGarurumon: Sagittarius Mode
  4. namespace DCGO.CardEffects.EX9
  5. {
  6. public class EX9_019 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternate Digivolution Requirement
  12. //[WereGarurumon]: Cost 1
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.EqualsCardName("WereGarurumon");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  20. permanentCondition: PermanentCondition,
  21. digivolutionCost: 1,
  22. ignoreDigivolutionRequirement: false,
  23. card: card,
  24. condition: null));
  25. }
  26. //Lv.4 w/[Garurumon] in name or w/[ADVENTURE] trait: Cost 3
  27. if (timing == EffectTiming.None)
  28. {
  29. bool PermanentCondition(Permanent targetPermanent)
  30. {
  31. return targetPermanent.TopCard.IsLevel4 &&
  32. (targetPermanent.TopCard.HasGarurumonName || targetPermanent.TopCard.HasAdventureTraits);
  33. }
  34. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  35. permanentCondition: PermanentCondition,
  36. digivolutionCost: 3,
  37. ignoreDigivolutionRequirement: false,
  38. card: card,
  39. condition: null));
  40. }
  41. #endregion
  42. #region On Play
  43. if (timing == EffectTiming.OnEnterFieldAnyone)
  44. {
  45. ActivateClass activateClass = new ActivateClass();
  46. activateClass.SetUpICardEffect("1 of your opponent's Digimon can't suspend", CanUseCondition,
  47. card);
  48. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  49. cardEffects.Add(activateClass);
  50. string EffectDescription()
  51. {
  52. return
  53. "[On Play] 1 of your opponent's Digimon or Tamers can't suspend until their turn ends.";
  54. }
  55. bool CanUseCondition(Hashtable hashtable)
  56. {
  57. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  58. }
  59. bool CanSelectOpponentPermanentCondition(Permanent permanent)
  60. {
  61. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  62. {
  63. return permanent.IsDigimon || permanent.IsTamer;
  64. }
  65. return false;
  66. }
  67. bool CanActivateCondition(Hashtable hashtable)
  68. {
  69. if (CardEffectCommons.IsExistOnBattleArea(card))
  70. {
  71. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentCondition))
  72. {
  73. return true;
  74. }
  75. }
  76. return false;
  77. }
  78. IEnumerator ActivateCoroutine(Hashtable hashtable)
  79. {
  80. Permanent selectedPermanent = null;
  81. SelectPermanentEffect selectPermanentEffect =
  82. GManager.instance.GetComponent<SelectPermanentEffect>();
  83. selectPermanentEffect.SetUp(
  84. selectPlayer: card.Owner,
  85. canTargetCondition_ByPreSelecetedList: null,
  86. canTargetCondition: CanSelectOpponentPermanentCondition,
  87. canEndSelectCondition: null,
  88. maxCount: 1,
  89. canNoSelect: false,
  90. canEndNotMax: false,
  91. selectPermanentCoroutine: SelectPermanentCoroutine,
  92. afterSelectPermanentCoroutine: null,
  93. mode: SelectPermanentEffect.Mode.Custom,
  94. cardEffect: activateClass);
  95. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon/Tamer that will be unable to suspend.",
  96. "The opponent is selecting 1 Digimon/Tamer that will be unable to suspend.");
  97. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  98. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  99. {
  100. selectedPermanent = permanent;
  101. CanNotSuspendClass canNotSuspendClass = new CanNotSuspendClass();
  102. canNotSuspendClass.SetUpICardEffect("Can't Suspend", CanUseCanNotSuspendCondition, card);
  103. canNotSuspendClass.SetUpCanNotSuspendClass(PermanentCondition: PermanentCanNotSuspendCondition);
  104. selectedPermanent.UntilOwnerTurnEndEffects.Add(_ => canNotSuspendClass);
  105. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  106. {
  107. yield return ContinuousController.instance.StartCoroutine(GManager.instance
  108. .GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  109. }
  110. bool CanUseCanNotSuspendCondition(Hashtable hashtableCanNotSuspend)
  111. {
  112. if (selectedPermanent.TopCard != null)
  113. {
  114. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  115. {
  116. return true;
  117. }
  118. }
  119. return false;
  120. }
  121. bool PermanentCanNotSuspendCondition(Permanent permanentCanNotSuspend)
  122. {
  123. if (permanentCanNotSuspend == selectedPermanent)
  124. {
  125. return true;
  126. }
  127. return false;
  128. }
  129. }
  130. }
  131. }
  132. #endregion
  133. #region When Digivolving
  134. if (timing == EffectTiming.OnEnterFieldAnyone)
  135. {
  136. ActivateClass activateClass = new ActivateClass();
  137. activateClass.SetUpICardEffect("1 of your opponent's Digimon can't suspend", CanUseCondition,
  138. card);
  139. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  140. cardEffects.Add(activateClass);
  141. string EffectDescription()
  142. {
  143. return
  144. "[When Digivolving] 1 of your opponent's Digimon or Tamers can't suspend until their turn ends.";
  145. }
  146. bool CanUseCondition(Hashtable hashtable)
  147. {
  148. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  149. }
  150. bool CanSelectOpponentPermanentCondition(Permanent permanent)
  151. {
  152. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  153. {
  154. return permanent.IsDigimon || permanent.IsTamer;
  155. }
  156. return false;
  157. }
  158. bool CanActivateCondition(Hashtable hashtable)
  159. {
  160. if (CardEffectCommons.IsExistOnBattleArea(card))
  161. {
  162. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentCondition))
  163. {
  164. return true;
  165. }
  166. }
  167. return false;
  168. }
  169. IEnumerator ActivateCoroutine(Hashtable hashtable)
  170. {
  171. Permanent selectedPermanent = null;
  172. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  173. selectPermanentEffect.SetUp(
  174. selectPlayer: card.Owner,
  175. canTargetCondition_ByPreSelecetedList: null,
  176. canTargetCondition: CanSelectOpponentPermanentCondition,
  177. canEndSelectCondition: null,
  178. maxCount: 1,
  179. canNoSelect: false,
  180. canEndNotMax: false,
  181. selectPermanentCoroutine: SelectPermanentCoroutine,
  182. afterSelectPermanentCoroutine: null,
  183. mode: SelectPermanentEffect.Mode.Custom,
  184. cardEffect: activateClass);
  185. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon/Tamer that will be unable to suspend.",
  186. "The opponent is selecting 1 Digimon/Tamer that will be unable to suspend.");
  187. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  188. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  189. {
  190. selectedPermanent = permanent;
  191. CanNotSuspendClass canNotSuspendClass = new CanNotSuspendClass();
  192. canNotSuspendClass.SetUpICardEffect("Can't Suspend", CanUseCanNotSuspendCondition, card);
  193. canNotSuspendClass.SetUpCanNotSuspendClass(PermanentCondition: PermanentCanNotSuspendCondition);
  194. selectedPermanent.UntilOwnerTurnEndEffects.Add(_ => canNotSuspendClass);
  195. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  196. {
  197. yield return ContinuousController.instance.StartCoroutine(GManager.instance
  198. .GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  199. }
  200. bool CanUseCanNotSuspendCondition(Hashtable hashtableCanNotSuspend)
  201. {
  202. if (selectedPermanent.TopCard != null)
  203. {
  204. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  205. {
  206. return true;
  207. }
  208. }
  209. return false;
  210. }
  211. bool PermanentCanNotSuspendCondition(Permanent permanentCanNotSuspend)
  212. {
  213. if (permanentCanNotSuspend == selectedPermanent)
  214. {
  215. return true;
  216. }
  217. return false;
  218. }
  219. }
  220. }
  221. }
  222. #endregion
  223. #region Your Turn
  224. if (timing == EffectTiming.OnEnterFieldAnyone)
  225. {
  226. ActivateClass activateClass = new ActivateClass();
  227. activateClass.SetUpICardEffect("Digivolve into a Digimon with [Garurumon] in name", CanUseCondition, card);
  228. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  229. cardEffects.Add(activateClass);
  230. string EffectDiscription()
  231. {
  232. return "[Your Turn] When any of your Digimon or Tamers with [Greymon] or [Matt Ishida] in their names are played or any of your Digimon digivolve into a Digimon with [Greymon] in its name, this Digimon may digivolve into a Digimon card with [Garurumon] in its name in the hand without paying the cost.";
  233. }
  234. bool PlayedRequirement(Permanent permanent)
  235. {
  236. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card) &&
  237. !permanent.IsOption &&
  238. (permanent.TopCard.HasGreymonName || permanent.TopCard.ContainsCardName("Matt Ishida"));
  239. }
  240. bool DigivolveRequirement(Permanent permanent)
  241. {
  242. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  243. !permanent.IsOption &&
  244. permanent.TopCard.HasGreymonName;
  245. }
  246. bool CanSelectCardCondition(CardSource cardSource)
  247. {
  248. return cardSource.IsDigimon && cardSource.HasGarurumonName;
  249. }
  250. bool CanUseCondition(Hashtable hashtable)
  251. {
  252. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  253. CardEffectCommons.IsOwnerTurn(card) &&
  254. (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PlayedRequirement) ||
  255. CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, DigivolveRequirement));
  256. }
  257. bool CanActivateCondition(Hashtable hashtable)
  258. {
  259. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  260. }
  261. IEnumerator ActivateCoroutine(Hashtable hashtable)
  262. {
  263. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  264. targetPermanent: card.PermanentOfThisCard(),
  265. cardCondition: CanSelectCardCondition,
  266. payCost: false,
  267. reduceCostTuple: null,
  268. fixedCostTuple: null,
  269. ignoreDigivolutionRequirementFixedCost: -1,
  270. isHand: true,
  271. activateClass: activateClass,
  272. successProcess: null));
  273. }
  274. }
  275. #endregion
  276. #region When Attacking - ESS
  277. if (timing == EffectTiming.OnAllyAttack)
  278. {
  279. ActivateClass activateClass = new ActivateClass();
  280. activateClass.SetUpICardEffect("De-Digivolve 1", CanUseCondition, card);
  281. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  282. activateClass.SetHashString("WA_EX9-019");
  283. activateClass.SetIsInheritedEffect(true);
  284. cardEffects.Add(activateClass);
  285. string EffectDiscription()
  286. {
  287. return "[When Attacking] [Once Per Turn] <De-Digivolve 1> 1 of your opponent's Digimon";
  288. }
  289. bool CanSelectPermanentCondition(Permanent permanent)
  290. {
  291. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  292. }
  293. bool CanUseCondition(Hashtable hashtable)
  294. {
  295. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  296. }
  297. bool CanActivateCondition(Hashtable hashtable)
  298. {
  299. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  300. }
  301. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  302. {
  303. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  304. {
  305. Permanent selectedPermanent = null;
  306. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  307. selectPermanentEffect.SetUp(
  308. selectPlayer: card.Owner,
  309. canTargetCondition_ByPreSelecetedList: null,
  310. canTargetCondition: CanSelectPermanentCondition,
  311. canEndSelectCondition: null,
  312. maxCount: 1,
  313. canNoSelect: false,
  314. canEndNotMax: false,
  315. selectPermanentCoroutine: SelectPermanentCoroutine,
  316. afterSelectPermanentCoroutine: null,
  317. mode: SelectPermanentEffect.Mode.Custom,
  318. cardEffect: activateClass);
  319. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digivolve.",
  320. "The opponent is selecting 1 Digimon to De-Digivolve.");
  321. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  322. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  323. {
  324. selectedPermanent = permanent;
  325. yield return null;
  326. }
  327. if (selectedPermanent != null)
  328. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(selectedPermanent, 1, activateClass).Degeneration());
  329. }
  330. }
  331. }
  332. #endregion
  333. return cardEffects;
  334. }
  335. }
  336. }