EX3_024.cs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX3
  6. {
  7. public class EX3_024 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.CardNames.Contains("Wingdramon") || targetPermanent.TopCard.CardNames.Contains("Groundramon");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  19. }
  20. if (timing == EffectTiming.OnTappedAnyone)
  21. {
  22. ActivateClass activateClass = new ActivateClass();
  23. activateClass.SetUpICardEffect("Unsuspend this Digimon", CanUseCondition, card);
  24. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  25. activateClass.SetHashString("Unsuspen_EX3_024");
  26. cardEffects.Add(activateClass);
  27. string EffectDiscription()
  28. {
  29. return "[All Turns][Once Per Turn] When this Digimon becomes suspended, unsuspend it.";
  30. }
  31. bool CanUseCondition(Hashtable hashtable)
  32. {
  33. if (CardEffectCommons.IsExistOnBattleArea(card))
  34. {
  35. if (CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, (permanent) => permanent == card.PermanentOfThisCard()))
  36. {
  37. return true;
  38. }
  39. }
  40. return false;
  41. }
  42. bool CanActivateCondition(Hashtable hashtable)
  43. {
  44. if (CardEffectCommons.IsExistOnBattleArea(card))
  45. {
  46. return true;
  47. }
  48. return false;
  49. }
  50. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  51. {
  52. Permanent selectedPermanent = card.PermanentOfThisCard();
  53. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { selectedPermanent }, activateClass).Unsuspend());
  54. }
  55. }
  56. if (timing == EffectTiming.OnStartMainPhase)
  57. {
  58. ActivateClass activateClass = new ActivateClass();
  59. activateClass.SetUpICardEffect("Suspend your 1 Digimon to force opponent to attack", CanUseCondition, card);
  60. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  61. cardEffects.Add(activateClass);
  62. string EffectDiscription()
  63. {
  64. return "[Start of Opponent's Main Phase] By suspending 1 of your Digimon with [Dramon] or [Examon] in its name, your opponent attacks with 1 of their Digimon.";
  65. }
  66. bool CanSelectPermanentCondition(Permanent permanent)
  67. {
  68. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  69. {
  70. if (!permanent.IsSuspended && permanent.CanSuspend)
  71. {
  72. if (permanent.TopCard.HasDramonName)
  73. {
  74. return true;
  75. }
  76. if (permanent.TopCard.CardNames.Contains("Examon"))
  77. {
  78. return true;
  79. }
  80. }
  81. }
  82. return false;
  83. }
  84. bool CanSelectPermanentCondition1(Permanent permanent)
  85. {
  86. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  87. {
  88. if (permanent.CanSelectBySkill(activateClass))
  89. {
  90. return true;
  91. }
  92. }
  93. return false;
  94. }
  95. bool CanUseCondition(Hashtable hashtable)
  96. {
  97. if (CardEffectCommons.IsExistOnBattleArea(card))
  98. {
  99. if (CardEffectCommons.IsOpponentTurn(card))
  100. {
  101. return true;
  102. }
  103. }
  104. return false;
  105. }
  106. bool CanActivateCondition(Hashtable hashtable)
  107. {
  108. if (CardEffectCommons.IsExistOnBattleArea(card))
  109. {
  110. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  111. {
  112. return true;
  113. }
  114. }
  115. return false;
  116. }
  117. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  118. {
  119. Permanent selectedPermanent = null;
  120. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  121. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  122. selectPermanentEffect.SetUp(
  123. selectPlayer: card.Owner,
  124. canTargetCondition: CanSelectPermanentCondition,
  125. canTargetCondition_ByPreSelecetedList: null,
  126. canEndSelectCondition: null,
  127. maxCount: maxCount,
  128. canNoSelect: true,
  129. canEndNotMax: false,
  130. selectPermanentCoroutine: SelectPermanentCoroutine,
  131. afterSelectPermanentCoroutine: null,
  132. mode: SelectPermanentEffect.Mode.Custom,
  133. cardEffect: activateClass);
  134. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to suspend.", "The opponent is selecting 1 Digimon to suspend.");
  135. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  136. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  137. {
  138. selectedPermanent = permanent;
  139. yield return null;
  140. }
  141. if (selectedPermanent != null)
  142. {
  143. if (selectedPermanent.TopCard != null)
  144. {
  145. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  146. {
  147. if (!selectedPermanent.IsSuspended && selectedPermanent.CanSuspend)
  148. {
  149. Hashtable hashtable = new Hashtable();
  150. hashtable.Add("CardEffect", activateClass);
  151. Permanent tapPermanent = selectedPermanent;
  152. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { tapPermanent }, hashtable).Tap());
  153. if (tapPermanent.TopCard != null)
  154. {
  155. if (tapPermanent.IsSuspended)
  156. {
  157. if (!GManager.instance.attackProcess.IsAttacking && card.Owner.Enemy.GetBattleAreaDigimons().Count(CanSelectPermanentCondition1) >= 1)
  158. {
  159. Permanent attackPermanent = null;
  160. selectPermanentEffect.SetUp(
  161. selectPlayer: card.Owner.Enemy,
  162. canTargetCondition: CanSelectPermanentCondition1,
  163. canTargetCondition_ByPreSelecetedList: null,
  164. canEndSelectCondition: null,
  165. maxCount: maxCount,
  166. canNoSelect: false,
  167. canEndNotMax: false,
  168. selectPermanentCoroutine: SelectPermanentCoroutine1,
  169. afterSelectPermanentCoroutine: null,
  170. mode: SelectPermanentEffect.Mode.Custom,
  171. cardEffect: activateClass);
  172. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will attack.", "The opponent is selecting 1 Digimon that will attack.");
  173. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  174. IEnumerator SelectPermanentCoroutine1(Permanent permanent)
  175. {
  176. attackPermanent = permanent;
  177. yield return null;
  178. }
  179. if (attackPermanent != null)
  180. {
  181. if (!attackPermanent.TopCard.CanNotBeAffected(activateClass))
  182. {
  183. if (attackPermanent.CanAttack(activateClass))
  184. {
  185. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  186. selectAttackEffect.SetUp(
  187. attacker: attackPermanent,
  188. canAttackPlayerCondition: () => true,
  189. defenderCondition: (permanent) => true,
  190. cardEffect: activateClass);
  191. selectAttackEffect.SetCanNotSelectNotAttack();
  192. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  193. }
  194. }
  195. }
  196. }
  197. }
  198. }
  199. }
  200. }
  201. }
  202. }
  203. }
  204. }
  205. if (timing == EffectTiming.OnStartMainPhase)
  206. {
  207. ActivateClass activateClass = new ActivateClass();
  208. activateClass.SetUpICardEffect("Suspend your 1 Digimon to force opponent to attack", CanUseCondition, card);
  209. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  210. activateClass.SetIsInheritedEffect(true);
  211. cardEffects.Add(activateClass);
  212. string EffectDiscription()
  213. {
  214. return "[Start of Opponent's Main Phase] By suspending 1 of your Digimon with [Dramon] or [Examon] in its name, your opponent attacks with 1 of their Digimon.";
  215. }
  216. bool CanSelectPermanentCondition(Permanent permanent)
  217. {
  218. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  219. {
  220. if (!permanent.IsSuspended && permanent.CanSuspend)
  221. {
  222. if (permanent.TopCard.HasDramonName)
  223. {
  224. return true;
  225. }
  226. if (permanent.TopCard.ContainsCardName("Examon"))
  227. {
  228. return true;
  229. }
  230. }
  231. }
  232. return false;
  233. }
  234. bool CanSelectPermanentCondition1(Permanent permanent)
  235. {
  236. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  237. {
  238. if (permanent.CanSelectBySkill(activateClass))
  239. {
  240. return true;
  241. }
  242. }
  243. return false;
  244. }
  245. bool CanUseCondition(Hashtable hashtable)
  246. {
  247. if (CardEffectCommons.IsExistOnBattleArea(card))
  248. {
  249. if (CardEffectCommons.IsOpponentTurn(card))
  250. {
  251. return true;
  252. }
  253. }
  254. return false;
  255. }
  256. bool CanActivateCondition(Hashtable hashtable)
  257. {
  258. if (CardEffectCommons.IsExistOnBattleArea(card))
  259. {
  260. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  261. {
  262. return true;
  263. }
  264. }
  265. return false;
  266. }
  267. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  268. {
  269. Permanent selectedPermanent = null;
  270. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  271. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  272. selectPermanentEffect.SetUp(
  273. selectPlayer: card.Owner,
  274. canTargetCondition: CanSelectPermanentCondition,
  275. canTargetCondition_ByPreSelecetedList: null,
  276. canEndSelectCondition: null,
  277. maxCount: maxCount,
  278. canNoSelect: true,
  279. canEndNotMax: false,
  280. selectPermanentCoroutine: SelectPermanentCoroutine,
  281. afterSelectPermanentCoroutine: null,
  282. mode: SelectPermanentEffect.Mode.Custom,
  283. cardEffect: activateClass);
  284. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to suspend.", "The opponent is selecting 1 Digimon to suspend.");
  285. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  286. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  287. {
  288. selectedPermanent = permanent;
  289. yield return null;
  290. }
  291. if (selectedPermanent != null)
  292. {
  293. if (selectedPermanent.TopCard != null)
  294. {
  295. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  296. {
  297. if (!selectedPermanent.IsSuspended && selectedPermanent.CanSuspend)
  298. {
  299. Hashtable hashtable = new Hashtable();
  300. hashtable.Add("CardEffect", activateClass);
  301. Permanent tapPermanent = selectedPermanent;
  302. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { tapPermanent }, hashtable).Tap());
  303. if (tapPermanent.TopCard != null)
  304. {
  305. if (tapPermanent.IsSuspended)
  306. {
  307. if (!GManager.instance.attackProcess.IsAttacking && card.Owner.Enemy.GetBattleAreaDigimons().Count(CanSelectPermanentCondition1) >= 1)
  308. {
  309. Permanent attackPermanent = null;
  310. selectPermanentEffect.SetUp(
  311. selectPlayer: card.Owner.Enemy,
  312. canTargetCondition: CanSelectPermanentCondition1,
  313. canTargetCondition_ByPreSelecetedList: null,
  314. canEndSelectCondition: null,
  315. maxCount: maxCount,
  316. canNoSelect: false,
  317. canEndNotMax: false,
  318. selectPermanentCoroutine: SelectPermanentCoroutine1,
  319. afterSelectPermanentCoroutine: null,
  320. mode: SelectPermanentEffect.Mode.Custom,
  321. cardEffect: activateClass);
  322. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will attack.", "The opponent is selecting 1 Digimon that will attack.");
  323. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  324. IEnumerator SelectPermanentCoroutine1(Permanent permanent)
  325. {
  326. attackPermanent = permanent;
  327. yield return null;
  328. }
  329. if (attackPermanent != null)
  330. {
  331. if (attackPermanent.CanAttack(activateClass))
  332. {
  333. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  334. selectAttackEffect.SetUp(
  335. attacker: attackPermanent,
  336. canAttackPlayerCondition: () => true,
  337. defenderCondition: (permanent) => true,
  338. cardEffect: activateClass);
  339. selectAttackEffect.SetCanNotSelectNotAttack();
  340. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  341. }
  342. }
  343. }
  344. }
  345. }
  346. }
  347. }
  348. }
  349. }
  350. }
  351. }
  352. return cardEffects;
  353. }
  354. }
  355. }