EX10_032.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. //Proganomon
  5. namespace DCGO.CardEffects.EX10
  6. {
  7. public class EX10_032 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Hand Main
  13. if (timing == EffectTiming.OnDeclaration)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Place 1 [Landramon] from trash under 1 [Sunarizamon], to digivolve for 3", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[Hand] [Main] If you have [Close], by placing 1 [Landramon] from your trash as any of your [Sunarizamon]'s bottom digivolution card, it digivolves into this card for a digivolution cost of 3, ignoring digivolution requirements.";
  22. }
  23. bool CanUseCondition(Hashtable hashtable)
  24. {
  25. return CardEffectCommons.IsExistOnHand(card)
  26. && CardEffectCommons.IsOwnerTurn(card)
  27. && CardEffectCommons.HasMatchConditionOwnersPermanent(card, IsClose)
  28. && CardEffectCommons.HasMatchConditionOwnersPermanent(card, IsSunarizamon)
  29. && CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, IsLandramon);
  30. }
  31. bool IsClose(Permanent permanent)
  32. {
  33. return permanent.IsTamer && permanent.TopCard.EqualsCardName("Close");
  34. }
  35. bool IsSunarizamon(Permanent permanent)
  36. {
  37. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  38. permanent.TopCard.EqualsCardName("Sunarizamon");
  39. }
  40. bool IsLandramon(CardSource source)
  41. {
  42. return source.IsDigimon && source.EqualsCardName("Landramon");
  43. }
  44. bool IsProganomon(CardSource cardSource)
  45. {
  46. return CardEffectCommons.IsExistOnHand(cardSource) && cardSource == card;
  47. }
  48. IEnumerator ActivateCoroutine(Hashtable hashtable)
  49. {
  50. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, IsClose))
  51. {
  52. Permanent sunarizamon = null;
  53. CardSource landramon = null;
  54. #region Select Landramon From Trash
  55. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInTrash(card, IsLandramon));
  56. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  57. selectCardEffect.SetUp(
  58. canTargetCondition: IsLandramon,
  59. canTargetCondition_ByPreSelecetedList: null,
  60. canEndSelectCondition: null,
  61. canNoSelect: () => false,
  62. selectCardCoroutine: SelectCardCoroutine,
  63. afterSelectCardCoroutine: null,
  64. message: "Select 1 [Landramon] to add as digivolution source",
  65. maxCount: maxCount,
  66. canEndNotMax: false,
  67. isShowOpponent: true,
  68. mode: SelectCardEffect.Mode.Custom,
  69. root: SelectCardEffect.Root.Trash,
  70. customRootCardList: null,
  71. canLookReverseCard: true,
  72. selectPlayer: card.Owner,
  73. cardEffect: activateClass);
  74. IEnumerator SelectCardCoroutine(CardSource cardSource)
  75. {
  76. landramon = cardSource;
  77. yield return null;
  78. }
  79. selectCardEffect.SetUpCustomMessage("Select 1 [Landramon] to add as digivolution source.", "The opponent is selecting 1 [Landramon] to add as digivolution source.");
  80. yield return StartCoroutine(selectCardEffect.Activate());
  81. #endregion
  82. if (landramon != null)
  83. {
  84. #region Select Sunarizamon Permanent
  85. int maxCount1 = Math.Min(1, CardEffectCommons.MatchConditionOwnersPermanentCount(card, IsSunarizamon));
  86. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  87. selectPermanentEffect.SetUp(
  88. selectPlayer: card.Owner,
  89. canTargetCondition: IsSunarizamon,
  90. canTargetCondition_ByPreSelecetedList: null,
  91. canEndSelectCondition: null,
  92. maxCount: maxCount1,
  93. canNoSelect: false,
  94. canEndNotMax: false,
  95. selectPermanentCoroutine: SelectPermanentCoroutine,
  96. afterSelectPermanentCoroutine: null,
  97. mode: SelectPermanentEffect.Mode.Custom,
  98. cardEffect: activateClass);
  99. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  100. {
  101. sunarizamon = permanent;
  102. yield return null;
  103. }
  104. selectPermanentEffect.SetUpCustomMessage("Select 1 [Sunarizamon] to add digivolution sources.", "The opponent is selecting 1 [Sunarizamon] to add digivolution sources.");
  105. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  106. #endregion
  107. if (sunarizamon != null)
  108. {
  109. yield return ContinuousController.instance.StartCoroutine(sunarizamon.AddDigivolutionCardsBottom(new List<CardSource>() { landramon }, activateClass));
  110. if (sunarizamon.DigivolutionCards.Contains(landramon))
  111. {
  112. #region Digivolve into Proganomon
  113. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  114. sunarizamon,
  115. IsProganomon,
  116. payCost: true,
  117. reduceCostTuple: null,
  118. fixedCostTuple: null,
  119. ignoreDigivolutionRequirementFixedCost: 3,
  120. isHand: true,
  121. activateClass: activateClass,
  122. successProcess: null,
  123. ignoreSelection: true,
  124. failedProcess: FailureProcess(),
  125. isOptional: false));
  126. #endregion
  127. }
  128. IEnumerator FailureProcess()
  129. {
  130. List<IDiscardHand> discardHands = new List<IDiscardHand>() { new IDiscardHand(card, null) };
  131. yield return ContinuousController.instance.StartCoroutine(new IDiscardHands(discardHands, null).DiscardHands());
  132. }
  133. }
  134. }
  135. }
  136. }
  137. }
  138. #endregion
  139. #region OP/WD/WA Shared
  140. string SharedEffectDiscription(string tag)
  141. {
  142. return $"[{tag}] By trashing any 1 [Mineral] or [Rock] trait card from your Digimon's digivolution cards, 1 of your such Digimon gains <Collision>, <Piercing> and +3000 DP until your opponent's turn ends.";
  143. }
  144. bool CanSelectSource(CardSource source)
  145. {
  146. return source.HasRockMineralTraits;
  147. }
  148. bool CanSelectPermanent(Permanent permanent)
  149. {
  150. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  151. (permanent.TopCard.EqualsTraits("Mineral") || permanent.TopCard.EqualsTraits("Rock"));
  152. }
  153. bool CanSelectPermamentTrashDigivolution(Permanent permanent)
  154. {
  155. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  156. && permanent.DigivolutionCards.Exists(CanSelectSource);
  157. }
  158. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  159. {
  160. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermamentTrashDigivolution))
  161. {
  162. #region Select Permanent to trash Digivolution Cards
  163. Permanent selectedPermanment = null;
  164. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermamentTrashDigivolution));
  165. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  166. selectPermanentEffect.SetUp(
  167. selectPlayer: card.Owner,
  168. canTargetCondition: CanSelectPermamentTrashDigivolution,
  169. canTargetCondition_ByPreSelecetedList: null,
  170. canEndSelectCondition: null,
  171. maxCount: maxCount,
  172. canNoSelect: true,
  173. canEndNotMax: false,
  174. selectPermanentCoroutine: SelectPermanentCoroutine,
  175. afterSelectPermanentCoroutine: null,
  176. mode: SelectPermanentEffect.Mode.Custom,
  177. cardEffect: activateClass);
  178. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  179. {
  180. selectedPermanment = permanent;
  181. yield return null;
  182. }
  183. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon trash digivolution card", "The opponent is selecting 1 Digimon trash digivolution card");
  184. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  185. #endregion
  186. if (selectedPermanment != null)
  187. {
  188. #region Select Digivolution Card to trash
  189. CardSource selectedCard = null;
  190. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  191. selectCardEffect.SetUp(
  192. canTargetCondition: CanSelectSource,
  193. canTargetCondition_ByPreSelecetedList: null,
  194. canEndSelectCondition: null,
  195. canNoSelect: () => true,
  196. selectCardCoroutine: SelectCardCoroutine,
  197. afterSelectCardCoroutine: null,
  198. message: "Select 1 digivolution card to discard.",
  199. maxCount: 1,
  200. canEndNotMax: false,
  201. isShowOpponent: true,
  202. mode: SelectCardEffect.Mode.Custom,
  203. root: SelectCardEffect.Root.Custom,
  204. customRootCardList: selectedPermanment.DigivolutionCards,
  205. canLookReverseCard: true,
  206. selectPlayer: card.Owner,
  207. cardEffect: null);
  208. IEnumerator SelectCardCoroutine(CardSource cardSource)
  209. {
  210. selectedCard = cardSource;
  211. yield return null;
  212. }
  213. selectCardEffect.SetUpCustomMessage("Select 1 digivolution card to discard.", "The opponent is selecting 1 digivolution card to discard.");
  214. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  215. #endregion
  216. if (selectedCard != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.TrashDigivolutionCardsAndProcessAccordingToResult(
  217. targetPermanent: selectedPermanment,
  218. targetDigivolutionCards: new List<CardSource>() { selectedCard },
  219. activateClass: activateClass,
  220. successProcess: SuccessProcess,
  221. failureProcess: null));
  222. IEnumerator SuccessProcess(List<CardSource> cardSources)
  223. {
  224. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanent))
  225. {
  226. #region Select Permanent to gain effects
  227. Permanent selectedPermanment1 = null;
  228. int maxCount1 = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanent));
  229. SelectPermanentEffect selectPermanentEffect1 = GManager.instance.GetComponent<SelectPermanentEffect>();
  230. selectPermanentEffect1.SetUp(
  231. selectPlayer: card.Owner,
  232. canTargetCondition: CanSelectPermanent,
  233. canTargetCondition_ByPreSelecetedList: null,
  234. canEndSelectCondition: null,
  235. maxCount: maxCount1,
  236. canNoSelect: false,
  237. canEndNotMax: false,
  238. selectPermanentCoroutine: SelectPermanentCoroutine,
  239. afterSelectPermanentCoroutine: null,
  240. mode: SelectPermanentEffect.Mode.Custom,
  241. cardEffect: activateClass);
  242. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  243. {
  244. selectedPermanment1 = permanent;
  245. yield return null;
  246. }
  247. selectPermanentEffect1.SetUpCustomMessage("Select 1 Digimon to gain <Collision>, <Piercing>, +3K DP", "The opponent is selecting 1 Digimon to gain <Collision>, <Piercing>, +3K DP");
  248. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect1.Activate());
  249. #endregion
  250. if (selectedPermanment1 != null)
  251. {
  252. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCollision(
  253. targetPermanent: selectedPermanment1,
  254. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  255. activateClass: activateClass));
  256. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainPierce(
  257. targetPermanent: selectedPermanment1,
  258. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  259. activateClass: activateClass));
  260. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  261. targetPermanent: selectedPermanment1,
  262. changeValue: 3000,
  263. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  264. activateClass: activateClass));
  265. }
  266. }
  267. }
  268. }
  269. }
  270. }
  271. #endregion
  272. #region On Play
  273. if (timing == EffectTiming.OnEnterFieldAnyone)
  274. {
  275. ActivateClass activateClass = new ActivateClass();
  276. activateClass.SetUpICardEffect("By trashing 1 source, 1 digimon gains Collision, Piercing, +3K DP", CanUseCondition, card);
  277. activateClass.SetUpActivateClass(CanActivateCondition, hashtable => SharedActivateCoroutine(hashtable, activateClass), -1, false, SharedEffectDiscription("On Play"));
  278. cardEffects.Add(activateClass);
  279. bool CanUseCondition(Hashtable hashtable)
  280. {
  281. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  282. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  283. }
  284. bool CanActivateCondition(Hashtable hashtable)
  285. {
  286. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  287. }
  288. }
  289. #endregion
  290. #region When Digivolving
  291. if (timing == EffectTiming.OnEnterFieldAnyone)
  292. {
  293. ActivateClass activateClass = new ActivateClass();
  294. activateClass.SetUpICardEffect("By trashing 1 source, 1 digimon gains Collision, Piercing, +3K DP", CanUseCondition, card);
  295. activateClass.SetUpActivateClass(CanActivateCondition, hashtable => SharedActivateCoroutine(hashtable, activateClass), -1, false, SharedEffectDiscription("When Digivolving"));
  296. cardEffects.Add(activateClass);
  297. bool CanUseCondition(Hashtable hashtable)
  298. {
  299. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  300. && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  301. }
  302. bool CanActivateCondition(Hashtable hashtable)
  303. {
  304. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  305. }
  306. }
  307. #endregion
  308. #region When Attacking
  309. if (timing == EffectTiming.OnAllyAttack)
  310. {
  311. ActivateClass activateClass = new ActivateClass();
  312. activateClass.SetUpICardEffect("By trashing 1 source, 1 digimon gains Collision, Piercing, +3K DP", CanUseCondition, card);
  313. activateClass.SetUpActivateClass(CanActivateCondition, hashtable => SharedActivateCoroutine(hashtable, activateClass), -1, false, SharedEffectDiscription("When Attacking"));
  314. cardEffects.Add(activateClass);
  315. bool CanUseCondition(Hashtable hashtable)
  316. {
  317. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  318. && CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  319. }
  320. bool CanActivateCondition(Hashtable hashtable)
  321. {
  322. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  323. }
  324. }
  325. #endregion
  326. #region Trash Source - ESS
  327. if (timing == EffectTiming.OnDigivolutionCardDiscarded)
  328. {
  329. ActivateClass activateClass = new ActivateClass();
  330. activateClass.SetUpICardEffect("De-Digivolve 1", CanUseCondition, card);
  331. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  332. activateClass.SetIsInheritedEffect(true);
  333. cardEffects.Add(activateClass);
  334. string EffectDescription()
  335. {
  336. return "When effects trash this card from a [Mineral] or [Rock] trait Digimon's digivolution cards, <De-Digivolve 1> 1 of your opponent's Digimon.";
  337. }
  338. bool CanSelectOpponentsDigimon(Permanent permanent)
  339. {
  340. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  341. }
  342. bool CanUseCondition(Hashtable hashtable)
  343. {
  344. Permanent trashedPermanent = CardEffectCommons.GetPermanentFromHashtable(hashtable);
  345. return (trashedPermanent.TopCard.EqualsTraits("Mineral") || trashedPermanent.TopCard.EqualsTraits("Rock")) &&
  346. CardEffectCommons.CanTriggerOnTrashSelfDigivolutionCard(hashtable, cardEffect => cardEffect != null, card);
  347. }
  348. bool CanActivateCondition(Hashtable hashtable)
  349. {
  350. if (CardEffectCommons.IsExistOnTrash(card))
  351. {
  352. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectOpponentsDigimon))
  353. {
  354. return true;
  355. }
  356. }
  357. return false;
  358. }
  359. IEnumerator ActivateCoroutine(Hashtable hashtable)
  360. {
  361. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  362. selectPermanentEffect.SetUp(
  363. selectPlayer: card.Owner,
  364. canTargetCondition: CanSelectOpponentsDigimon,
  365. canTargetCondition_ByPreSelecetedList: null,
  366. canEndSelectCondition: null,
  367. maxCount: 1,
  368. canNoSelect: false,
  369. canEndNotMax: false,
  370. selectPermanentCoroutine: SelectPermanentCoroutine,
  371. afterSelectPermanentCoroutine: null,
  372. mode: SelectPermanentEffect.Mode.Custom,
  373. cardEffect: activateClass);
  374. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digivolve.", "The opponent is selecting 1 Digimon to De-Digivolve.");
  375. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  376. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  377. {
  378. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(permanent, 1, activateClass).Degeneration());
  379. }
  380. }
  381. }
  382. #endregion
  383. return cardEffects;
  384. }
  385. }
  386. }