BT25_057.cs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. // Monarchlizamon/Final Judgment
  5. namespace DCGO.CardEffects.BT25
  6. {
  7. public class BT25_057 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Digimon Effects
  13. #region Alt Digivolution
  14. if (timing == EffectTiming.None)
  15. {
  16. bool PermanentCondition(Permanent permanent)
  17. {
  18. return permanent.TopCard.HasGlowingDawnTraits;
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(PermanentCondition, 3, false, card, null, level: 4));
  21. }
  22. #endregion
  23. #region When Digivolving
  24. if (timing == EffectTiming.OnEnterFieldAnyone)
  25. {
  26. ActivateClass activateClass = new ActivateClass();
  27. activateClass.SetUpICardEffect("Battle 1 of your opponent's Digimon.", CanUseCondition, card);
  28. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  29. activateClass.SetIsSkippable(true);
  30. cardEffects.Add(activateClass);
  31. string EffectDiscription()
  32. {
  33. return "[When Digivolving] This Digimon may battle 1 of your opponent's Digimon.";
  34. }
  35. bool CanUseCondition(Hashtable hashtable)
  36. {
  37. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  38. && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  39. }
  40. bool CanActivateCondition(Hashtable hashtable)
  41. {
  42. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  43. }
  44. bool CanSelectPermanentCondition(Permanent permanent) => CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  45. IEnumerator ActivateCoroutine(Hashtable hashtable)
  46. {
  47. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectPermanentCondition))
  48. {
  49. Permanent selectedPermanent = null;
  50. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  51. selectPermanentEffect.SetUp(
  52. selectPlayer: card.Owner,
  53. canTargetCondition: CanSelectPermanentCondition,
  54. canTargetCondition_ByPreSelecetedList: null,
  55. canEndSelectCondition: null,
  56. maxCount: 1,
  57. canNoSelect: true,
  58. canEndNotMax: false,
  59. selectPermanentCoroutine: SelectPermanentCoroutine,
  60. afterSelectPermanentCoroutine: null,
  61. mode: SelectPermanentEffect.Mode.Custom,
  62. cardEffect: activateClass);
  63. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  64. {
  65. selectedPermanent = permanent;
  66. yield return null;
  67. }
  68. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to battle.", "The opponent is selecting 1 Digimon to battle.");
  69. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  70. if (selectedPermanent != null) yield return ContinuousController.instance.StartCoroutine(new IBattle(card.PermanentOfThisCard(), selectedPermanent, null, true).Battle());
  71. }
  72. }
  73. }
  74. #endregion
  75. #region WD/WA Shared
  76. string SharedHashString = "BT25_WD_WA";
  77. string SharedEffectName = "By trashing bottom face down card under your tamer, De-Digivolve(1) 1 opponent digimon";
  78. string SharedEffectDescription(string tag) => $"[{tag}] [Once Per Turn] By trashing the bottom face-down card under any of your Tamers, <De-Digivolve 1> 1 of your opponent's Digimon.";
  79. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  80. {
  81. #region Conditions
  82. bool CanSelectPermanentCondition(Permanent permanent)
  83. {
  84. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaTamer(permanent, card)
  85. && permanent.HasFaceDownDigivolutionCards;
  86. }
  87. bool CanSelectTrashSourceCardCondition(CardSource cardSource)
  88. {
  89. return cardSource.IsFlipped
  90. && !cardSource.CanNotTrashFromDigivolutionCards(activateClass);
  91. }
  92. bool CanSelectOpponentPermanentCondition(Permanent permanent) => CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  93. #endregion
  94. bool isUsed = false;
  95. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, CanSelectPermanentCondition))
  96. {
  97. Permanent selectedPermanent = null;
  98. #region Select Tamer
  99. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  100. selectPermanentEffect.SetUp(
  101. selectPlayer: card.Owner,
  102. canTargetCondition: CanSelectPermanentCondition,
  103. canTargetCondition_ByPreSelecetedList: null,
  104. canEndSelectCondition: null,
  105. maxCount: 1,
  106. canNoSelect: true,
  107. canEndNotMax: false,
  108. selectPermanentCoroutine: SelectPermanentCoroutine,
  109. afterSelectPermanentCoroutine: null,
  110. mode: SelectPermanentEffect.Mode.Custom,
  111. cardEffect: activateClass);
  112. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  113. {
  114. selectedPermanent = permanent;
  115. yield return null;
  116. }
  117. selectPermanentEffect.SetUpCustomMessage("Select 1 tamer to trash a face down card from.", "The opponent is selecting 1 tamer to trash a face down card from.");
  118. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  119. #endregion
  120. if (selectedPermanent != null)
  121. {
  122. #region Trash Bottom Card
  123. List<CardSource> selectedCards = new List<CardSource>();
  124. CardSource trashTargetCard = selectedPermanent.DigivolutionCards.Filter(CanSelectTrashSourceCardCondition)[^1];
  125. selectedCards.Add(trashTargetCard);
  126. yield return ContinuousController.instance.StartCoroutine(new ITrashDigivolutionCards(selectedPermanent, selectedCards, activateClass).TrashDigivolutionCards());
  127. isUsed = true; // Declare true since cost was paid, so OPT will be used up here.
  128. #endregion
  129. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectOpponentPermanentCondition))
  130. {
  131. #region De-Digivolve 1 Opponent Digimon
  132. SelectPermanentEffect selectPermanentEffect1 = GManager.instance.GetComponent<SelectPermanentEffect>();
  133. selectPermanentEffect1.SetUp(
  134. selectPlayer: card.Owner,
  135. canTargetCondition: CanSelectOpponentPermanentCondition,
  136. canTargetCondition_ByPreSelecetedList: null,
  137. canEndSelectCondition: null,
  138. maxCount: 1,
  139. canNoSelect: false,
  140. canEndNotMax: false,
  141. selectPermanentCoroutine: null,
  142. afterSelectPermanentCoroutine: null,
  143. mode: SelectPermanentEffect.Mode.Degenerate,
  144. cardEffect: activateClass);
  145. selectPermanentEffect1.SetUpCustomMessage("Select 1 Digimon to De-Digivolve(1)", "The opponent is selecting 1 Digimon to De-Digivolve(1).");
  146. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect1.Activate());
  147. #endregion
  148. }
  149. }
  150. }
  151. if (!isUsed) activateClass.RemoveUse();
  152. }
  153. CardEffectFactory.ActivateClassesForSharedEffects
  154. (ref cardEffects, timing, card,
  155. SharedEffectName,
  156. SharedActivateCoroutine,
  157. SharedEffectDescription,
  158. optional: false,
  159. isSkippable: true,
  160. maxCountPerTurn: 1,
  161. hashValue: SharedHashString,
  162. whenDigivolving: true,
  163. whenAttacking: true);
  164. #endregion
  165. #endregion
  166. #region Option Effects
  167. #region Ignore Colour Requirement
  168. if (timing == EffectTiming.None)
  169. {
  170. cardEffects.Add(CardEffectFactory.UseRequirements(card, CardCondition));
  171. bool CardCondition(CardSource cardSource)
  172. {
  173. return cardSource.HasGlowingDawnTraits;
  174. }
  175. }
  176. #endregion
  177. #region Main
  178. if (timing == EffectTiming.OptionSkill)
  179. {
  180. ActivateClass activateClass = new ActivateClass();
  181. activateClass.SetUpICardEffect("1 of your digimon gains Rush, Sec Atk (+1), and 5K DP, then it may attack", CanUseCondition, card);
  182. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  183. cardEffects.Add(activateClass);
  184. string EffectDiscription()
  185. => "[Main] 1 of your Digimon gains <Rush>, <Security A. +1> and +5000 DP for the turn. Then, it may attack.";
  186. bool CanUseCondition(Hashtable hashtable)
  187. => CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  188. bool CanSelectPermamentCondition(Permanent permanent)
  189. => CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  190. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  191. {
  192. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, CanSelectPermamentCondition))
  193. {
  194. Permanent selectedPermanent = null;
  195. #region Select 1 of your Digimon
  196. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  197. selectPermanentEffect.SetUp(
  198. selectPlayer: card.Owner,
  199. canTargetCondition: CanSelectPermamentCondition,
  200. canTargetCondition_ByPreSelecetedList: null,
  201. canEndSelectCondition: null,
  202. maxCount: 1,
  203. canNoSelect: false,
  204. canEndNotMax: false,
  205. selectPermanentCoroutine: SelectPermanentCoroutine,
  206. afterSelectPermanentCoroutine: null,
  207. mode: SelectPermanentEffect.Mode.Custom,
  208. cardEffect: activateClass);
  209. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  210. {
  211. selectedPermanent = permanent;
  212. yield return null;
  213. }
  214. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to gain rush, sec atk(+1) and 5k DP", "The opponent is selecting 1 Digimon to gain rush, sec atk(+1) and 5k DP");
  215. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  216. #endregion
  217. if (selectedPermanent != null)
  218. {
  219. #region Gain Rush, Sec Atk +1, and 5K DP
  220. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainRush(
  221. targetPermanent: selectedPermanent,
  222. effectDuration: EffectDuration.UntilEachTurnEnd,
  223. activateClass: activateClass
  224. ));
  225. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(
  226. targetPermanent: selectedPermanent,
  227. changeValue: 1,
  228. effectDuration: EffectDuration.UntilEachTurnEnd,
  229. activateClass: activateClass
  230. ));
  231. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  232. targetPermanent: selectedPermanent,
  233. changeValue: 5000,
  234. effectDuration: EffectDuration.UntilEachTurnEnd,
  235. activateClass: activateClass
  236. ));
  237. #endregion
  238. #region Digimon Attack
  239. if (selectedPermanent.CanAttack(activateClass))
  240. {
  241. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  242. selectAttackEffect.SetUp(
  243. attacker: selectedPermanent,
  244. canAttackPlayerCondition: () => true,
  245. defenderCondition: _ => true,
  246. cardEffect: activateClass);
  247. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  248. }
  249. #endregion
  250. }
  251. }
  252. }
  253. }
  254. #endregion
  255. #region Arts Digivolution
  256. if (timing == EffectTiming.None)
  257. {
  258. cardEffects.Add(CardEffectFactory.ArtsDigivolveEffect(card));
  259. }
  260. #endregion
  261. #endregion
  262. return cardEffects;
  263. }
  264. }
  265. }