LM_043.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Diagnostics;
  5. //Darkdramon
  6. namespace DCGO.CardEffects.LM
  7. {
  8. public class LM_043 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Alternative Digivolve Cost
  14. if (timing == EffectTiming.None)
  15. {
  16. bool PermanentCondition(Permanent targetPermanent)
  17. {
  18. if (targetPermanent.TopCard.IsLevel5)
  19. {
  20. if (targetPermanent.TopCard.EqualsTraits("D-Brigade") || targetPermanent.TopCard.EqualsTraits("ACCEL"))
  21. {
  22. return true;
  23. }
  24. }
  25. return false;
  26. }
  27. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  28. }
  29. #endregion
  30. #region Blast Digivolve
  31. if (timing == EffectTiming.OnCounterTiming)
  32. {
  33. cardEffects.Add(CardEffectFactory.BlastDigivolveEffect(card: card, condition: null));
  34. }
  35. #endregion
  36. #region Scapegoat
  37. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  38. {
  39. cardEffects.Add(CardEffectFactory.ScapegoatSelfEffect(isInheritedEffect: false, card: card, condition: null, effectName: "<Scapegoat>", effectDiscription: null));
  40. }
  41. #endregion
  42. #region On Play
  43. if (timing == EffectTiming.OnEnterFieldAnyone)
  44. {
  45. ActivateClass activateClass = new ActivateClass();
  46. activateClass.SetUpICardEffect("<De-Digivolve 1>, then delete all lowest play cost digimon", CanUseCondition, card);
  47. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  48. cardEffects.Add(activateClass);
  49. string EffectDiscription()
  50. {
  51. return "[On Play] <De-Digivolve 1> 1 of your opponent's Digimon (Trash the top card. You can't trash past level 3 cards). Then, delete all of their Digimon with the lowest play cost.";
  52. }
  53. bool CanUseCondition(Hashtable hashtable)
  54. {
  55. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  56. {
  57. if (CardEffectCommons.CanTriggerOnPlay(hashtable, card))
  58. {
  59. return true;
  60. }
  61. }
  62. return false;
  63. }
  64. bool CanActivateCondition(Hashtable hashtable)
  65. {
  66. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  67. }
  68. bool CanSelectPermanentDeDigi(Permanent permanent)
  69. {
  70. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  71. }
  72. bool CanSelectPermanentMinDP(Permanent permanent)
  73. {
  74. return CardEffectCommons.IsMinCost(permanent, card.Owner.Enemy, true);
  75. }
  76. IEnumerator ActivateCoroutine(Hashtable hashtable)
  77. {
  78. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectPermanentDeDigi))
  79. {
  80. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentDeDigi));
  81. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  82. selectPermanentEffect.SetUp(
  83. selectPlayer: card.Owner,
  84. canTargetCondition: CanSelectPermanentDeDigi,
  85. canTargetCondition_ByPreSelecetedList: null,
  86. canEndSelectCondition: null,
  87. maxCount: maxCount,
  88. canNoSelect: false,
  89. canEndNotMax: false,
  90. selectPermanentCoroutine: SelectPermanentCoroutine,
  91. afterSelectPermanentCoroutine: null,
  92. mode: SelectPermanentEffect.Mode.Custom,
  93. cardEffect: activateClass);
  94. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digivolve.", "The opponent is selecting 1 Digimon to De-Digivolve.");
  95. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  96. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  97. {
  98. Permanent selectedPermanent = permanent;
  99. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(selectedPermanent, 1, activateClass).Degeneration());
  100. }
  101. }
  102. List<Permanent> destroyTargetPermanents = card.Owner.Enemy.GetBattleAreaDigimons().Filter(CanSelectPermanentMinDP);
  103. yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass(destroyTargetPermanents, CardEffectCommons.CardEffectHashtable(activateClass)).Destroy());
  104. }
  105. }
  106. #endregion
  107. #region When Digivolving
  108. if (timing == EffectTiming.OnEnterFieldAnyone)
  109. {
  110. ActivateClass activateClass = new ActivateClass();
  111. activateClass.SetUpICardEffect("<De-Digivolve 1>, then delete all lowest play cost digimon", CanUseCondition, card);
  112. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  113. cardEffects.Add(activateClass);
  114. string EffectDiscription()
  115. {
  116. return "[When Digivolving] <De-Digivolve 1> 1 of your opponent's Digimon (Trash the top card. You can't trash past level 3 cards). Then, delete all of their Digimon with the lowest play cost.";
  117. }
  118. bool CanUseCondition(Hashtable hashtable)
  119. {
  120. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  121. {
  122. if (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
  123. {
  124. return true;
  125. }
  126. }
  127. return false;
  128. }
  129. bool CanActivateCondition(Hashtable hashtable)
  130. {
  131. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  132. }
  133. bool CanSelectPermanentDeDigi(Permanent permanent)
  134. {
  135. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  136. }
  137. bool CanSelectPermanentMinDP(Permanent permanent)
  138. {
  139. return CardEffectCommons.IsMinCost(permanent, card.Owner.Enemy, true);
  140. }
  141. IEnumerator ActivateCoroutine(Hashtable hashtable)
  142. {
  143. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectPermanentDeDigi))
  144. {
  145. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentDeDigi));
  146. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  147. selectPermanentEffect.SetUp(
  148. selectPlayer: card.Owner,
  149. canTargetCondition: CanSelectPermanentDeDigi,
  150. canTargetCondition_ByPreSelecetedList: null,
  151. canEndSelectCondition: null,
  152. maxCount: maxCount,
  153. canNoSelect: false,
  154. canEndNotMax: false,
  155. selectPermanentCoroutine: SelectPermanentCoroutine,
  156. afterSelectPermanentCoroutine: null,
  157. mode: SelectPermanentEffect.Mode.Custom,
  158. cardEffect: activateClass);
  159. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digivolve.", "The opponent is selecting 1 Digimon to De-Digivolve.");
  160. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  161. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  162. {
  163. Permanent selectedPermanent = permanent;
  164. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(selectedPermanent, 1, activateClass).Degeneration());
  165. }
  166. }
  167. List<Permanent> destroyTargetPermanents = card.Owner.Enemy.GetBattleAreaDigimons().Filter(CanSelectPermanentMinDP);
  168. yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass(destroyTargetPermanents, CardEffectCommons.CardEffectHashtable(activateClass)).Destroy());
  169. }
  170. }
  171. #endregion
  172. #region Your Turn - ESS
  173. if (timing == EffectTiming.OnCounterTiming)
  174. {
  175. bool Condition()
  176. {
  177. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  178. {
  179. if (CardEffectCommons.IsOwnerTurn(card))
  180. {
  181. return true;
  182. }
  183. }
  184. return false;
  185. }
  186. cardEffects.Add(CardEffectFactory.CollisionSelfStaticEffect(isInheritedEffect: true, card: card, condition: Condition));
  187. }
  188. #endregion
  189. return cardEffects;
  190. }
  191. }
  192. }