BT20_043.cs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. // Varodurumon
  6. namespace DCGO.CardEffects.BT20
  7. {
  8. public class BT20_043 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Alternate Digivolution Requirement
  14. if (timing == EffectTiming.None)
  15. {
  16. static bool PermanentCondition(Permanent targetPermanent)
  17. {
  18. return targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.IsLevel5 && targetPermanent.TopCard.EqualsTraits("ACCEL");
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  21. }
  22. #endregion
  23. #region Reduce Play Cost
  24. if (timing == EffectTiming.None)
  25. {
  26. bool Condition()
  27. {
  28. return CardEffectCommons.HasMatchConditionPermanent(HasAccelTraitInPlay);
  29. }
  30. bool HasAccelTraitInPlay(Permanent permanent)
  31. {
  32. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  33. && permanent.TopCard.EqualsTraits("ACCEL");
  34. }
  35. cardEffects.Add(CardEffectFactory.MandatorySelfPlayCostReduction(5, card, Condition));
  36. }
  37. #endregion
  38. #region On Play
  39. if (timing == EffectTiming.OnEnterFieldAnyone)
  40. {
  41. ActivateClass activateClass = new ActivateClass();
  42. activateClass.SetUpICardEffect("Suspend all of your opponent's Digimon, 1 of your Digimon gets +3000DP, then attack", CanUseCondition, card);
  43. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  44. cardEffects.Add(activateClass);
  45. string EffectDescription()
  46. {
  47. return "[On Play] Suspend all of your opponent's Digimon and 1 of your Digimon gets +3000 DP for the turn. Then, 1 of your Digimon may attack.";
  48. }
  49. bool IsYourBoostedDigimon(Permanent permanent)
  50. {
  51. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  52. }
  53. bool IsYourAttackingDigimon(Permanent permanent)
  54. {
  55. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  56. permanent.CanAttack(activateClass);
  57. }
  58. bool CanUseCondition(Hashtable hashtable)
  59. {
  60. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  61. }
  62. bool CanActivateCondition(Hashtable hashtable)
  63. {
  64. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  65. }
  66. IEnumerator ActivateCoroutine(Hashtable hashtable)
  67. {
  68. List<Permanent> suspendTargetPermanents = card.Owner.Enemy.GetBattleAreaPermanents().Filter(permanent => permanent.IsDigimon);
  69. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(suspendTargetPermanents, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  70. if (CardEffectCommons.HasMatchConditionPermanent(IsYourBoostedDigimon))
  71. {
  72. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  73. selectPermanentEffect.SetUp(
  74. selectPlayer: card.Owner,
  75. canTargetCondition: IsYourBoostedDigimon,
  76. canTargetCondition_ByPreSelecetedList: null,
  77. canEndSelectCondition: null,
  78. maxCount: 1,
  79. canNoSelect: false,
  80. canEndNotMax: false,
  81. selectPermanentCoroutine: SelectBoostedDigimon,
  82. afterSelectPermanentCoroutine: null,
  83. mode: SelectPermanentEffect.Mode.Custom,
  84. cardEffect: activateClass);
  85. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to get +3000DP.", "The opponent is selecting 1 Digimon to get +3000DP.");
  86. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  87. IEnumerator SelectBoostedDigimon(Permanent target)
  88. {
  89. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: target, changeValue: 3000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  90. }
  91. }
  92. if (CardEffectCommons.HasMatchConditionPermanent(IsYourAttackingDigimon))
  93. {
  94. Permanent selectedPermanent = null;
  95. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  96. selectPermanentEffect.SetUp(
  97. selectPlayer: card.Owner,
  98. canTargetCondition: IsYourAttackingDigimon,
  99. canTargetCondition_ByPreSelecetedList: null,
  100. canEndSelectCondition: null,
  101. maxCount: 1,
  102. canNoSelect: false,
  103. canEndNotMax: false,
  104. selectPermanentCoroutine: SelectPermanentCoroutine,
  105. afterSelectPermanentCoroutine: null,
  106. mode: SelectPermanentEffect.Mode.Custom,
  107. cardEffect: activateClass);
  108. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to attack.", "The opponent is selecting 1 Digimon to attack.");
  109. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  110. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  111. {
  112. selectedPermanent = permanent;
  113. yield return null;
  114. }
  115. if (selectedPermanent != null)
  116. {
  117. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  118. selectAttackEffect.SetUp(
  119. attacker: selectedPermanent,
  120. canAttackPlayerCondition: () => true,
  121. defenderCondition: _ => true,
  122. cardEffect: activateClass);
  123. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  124. }
  125. }
  126. }
  127. }
  128. #endregion
  129. #region When Digivolving
  130. if (timing == EffectTiming.OnEnterFieldAnyone)
  131. {
  132. ActivateClass activateClass = new ActivateClass();
  133. activateClass.SetUpICardEffect("Suspend all of your opponent's Digimon, 1 of your Digimon gets +3000DP, then attack", CanUseCondition, card);
  134. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  135. cardEffects.Add(activateClass);
  136. string EffectDescription()
  137. {
  138. return "[When Digivolving] Suspend all of your opponent's Digimon and 1 of your Digimon gets +3000 DP for the turn. Then, 1 of your Digimon may attack.";
  139. }
  140. bool IsYourBoostedDigimon(Permanent permanent)
  141. {
  142. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  143. }
  144. bool IsYourAttackingDigimon(Permanent permanent)
  145. {
  146. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  147. permanent.CanAttack(activateClass);
  148. }
  149. bool CanUseCondition(Hashtable hashtable)
  150. {
  151. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  152. CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  153. }
  154. bool CanActivateCondition(Hashtable hashtable)
  155. {
  156. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  157. }
  158. IEnumerator ActivateCoroutine(Hashtable hashtable)
  159. {
  160. List<Permanent> suspendTargetPermanents = card.Owner.Enemy.GetBattleAreaPermanents().Filter(permanent => permanent.IsDigimon);
  161. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(suspendTargetPermanents, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  162. if (CardEffectCommons.HasMatchConditionPermanent(IsYourBoostedDigimon))
  163. {
  164. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  165. selectPermanentEffect.SetUp(
  166. selectPlayer: card.Owner,
  167. canTargetCondition: IsYourBoostedDigimon,
  168. canTargetCondition_ByPreSelecetedList: null,
  169. canEndSelectCondition: null,
  170. maxCount: 1,
  171. canNoSelect: false,
  172. canEndNotMax: false,
  173. selectPermanentCoroutine: SelectBoostedDigimon,
  174. afterSelectPermanentCoroutine: null,
  175. mode: SelectPermanentEffect.Mode.Custom,
  176. cardEffect: activateClass);
  177. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to get +3000DP.", "The opponent is selecting 1 Digimon to get +3000DP.");
  178. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  179. IEnumerator SelectBoostedDigimon(Permanent target)
  180. {
  181. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: target, changeValue: 3000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  182. }
  183. }
  184. if (CardEffectCommons.HasMatchConditionPermanent(IsYourAttackingDigimon))
  185. {
  186. Permanent selectedPermanent = null;
  187. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  188. selectPermanentEffect.SetUp(
  189. selectPlayer: card.Owner,
  190. canTargetCondition: IsYourAttackingDigimon,
  191. canTargetCondition_ByPreSelecetedList: null,
  192. canEndSelectCondition: null,
  193. maxCount: 1,
  194. canNoSelect: false,
  195. canEndNotMax: false,
  196. selectPermanentCoroutine: SelectPermanentCoroutine,
  197. afterSelectPermanentCoroutine: null,
  198. mode: SelectPermanentEffect.Mode.Custom,
  199. cardEffect: activateClass);
  200. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to attack.", "The opponent is selecting 1 Digimon to attack.");
  201. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  202. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  203. {
  204. selectedPermanent = permanent;
  205. yield return null;
  206. }
  207. if (selectedPermanent != null)
  208. {
  209. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  210. selectAttackEffect.SetUp(
  211. attacker: selectedPermanent,
  212. canAttackPlayerCondition: () => true,
  213. defenderCondition: _ => true,
  214. cardEffect: activateClass);
  215. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  216. }
  217. }
  218. }
  219. }
  220. #endregion
  221. #region End of Turn
  222. if (timing == EffectTiming.OnEndTurn)
  223. {
  224. ActivateClass activateClass = new ActivateClass();
  225. activateClass.SetUpICardEffect("DNA digivolve this Digimon", CanUseCondition, card);
  226. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  227. cardEffects.Add(activateClass);
  228. string EffectDescription()
  229. {
  230. return "[End of Your Turn] This Digimon and any of your other Digimon may DNA digivolve into a Digimon card with [Chaosmon] in its name in the hand. Then, the DNA digivolved Digimon may attack.";
  231. }
  232. bool CanSelectCardCondition(CardSource cardSource)
  233. {
  234. if (cardSource != null)
  235. {
  236. if (cardSource.IsDigimon)
  237. {
  238. if (cardSource.ContainsCardName("Chaosmon"))
  239. {
  240. if (cardSource.CanPlayJogress(true))
  241. {
  242. if (cardSource.CanJogressFromTargetPermanent(card.PermanentOfThisCard(), true))
  243. {
  244. return true;
  245. }
  246. }
  247. }
  248. }
  249. }
  250. return false;
  251. }
  252. bool CanUseCondition(Hashtable hashtable)
  253. {
  254. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  255. }
  256. bool CanActivateCondition(Hashtable hashtable)
  257. {
  258. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  259. {
  260. if (CardEffectCommons.IsOwnerTurn(card))
  261. {
  262. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition))
  263. {
  264. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon && permanent != card.PermanentOfThisCard()))
  265. {
  266. return true;
  267. }
  268. }
  269. }
  270. }
  271. return false;
  272. }
  273. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  274. {
  275. if (isExistOnField(card))
  276. {
  277. yield return ContinuousController.instance.StartCoroutine(
  278. CardEffectCommons.DNADigivolvePermanentsIntoHandOrTrashCard(
  279. CanSelectCardCondition,
  280. payCost: true,
  281. isHand: true,
  282. activateClass,
  283. permanentConditions: new Func<Permanent, bool>[] { (permanent) => permanent == card.PermanentOfThisCard() },
  284. successProcess: OnDNASuccess
  285. ));
  286. IEnumerator OnDNASuccess(CardSource cardSource)
  287. {
  288. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  289. selectAttackEffect.SetUp(
  290. attacker: cardSource.PermanentOfThisCard(),
  291. canAttackPlayerCondition: () => true,
  292. defenderCondition: _ => true,
  293. cardEffect: activateClass);
  294. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  295. }
  296. }
  297. }
  298. }
  299. #endregion
  300. #region When Attacking - ESS
  301. if (timing == EffectTiming.OnAllyAttack)
  302. {
  303. ActivateClass activateClass = new ActivateClass();
  304. activateClass.SetUpICardEffect("1 Opponent's Digimon gets -4000 DP", CanUseCondition, card);
  305. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  306. activateClass.SetIsInheritedEffect(true);
  307. activateClass.SetHashString("WhenAttacking_BT20-043");
  308. cardEffects.Add(activateClass);
  309. string EffectDescription()
  310. {
  311. return "[When Attacking] [Once Per Turn] 1 of your opponent's Digimon gets -4000 DP for the turn.";
  312. }
  313. bool IsOpponentsDigimon(Permanent permanent)
  314. {
  315. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  316. }
  317. bool CanUseCondition(Hashtable hashtable)
  318. {
  319. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  320. }
  321. bool CanActivateCondition(Hashtable hashtable)
  322. {
  323. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  324. }
  325. IEnumerator ActivateCoroutine(Hashtable hashtable)
  326. {
  327. if (CardEffectCommons.HasMatchConditionPermanent(IsOpponentsDigimon))
  328. {
  329. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  330. selectPermanentEffect.SetUp(
  331. selectPlayer: card.Owner,
  332. canTargetCondition: IsOpponentsDigimon,
  333. canTargetCondition_ByPreSelecetedList: null,
  334. canEndSelectCondition: null,
  335. maxCount: 1,
  336. canNoSelect: false,
  337. canEndNotMax: false,
  338. selectPermanentCoroutine: SelectedPermanent,
  339. afterSelectPermanentCoroutine: null,
  340. mode: SelectPermanentEffect.Mode.Custom,
  341. cardEffect: activateClass);
  342. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -4000.", "The opponent is selecting 1 Digimon that will get DP -4000.");
  343. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  344. IEnumerator SelectedPermanent(Permanent target)
  345. {
  346. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: target, changeValue: -4000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  347. }
  348. }
  349. }
  350. }
  351. #endregion
  352. return cardEffects;
  353. }
  354. }
  355. }