EX7_070.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.EX7
  4. {
  5. public class EX7_070 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region When Trashed from Digivolution Cards
  11. if (timing == EffectTiming.OnDigivolutionCardDiscarded)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("De-Digivolve 1", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  16. activateClass.SetIsInheritedEffect(true);
  17. activateClass.SetIsOptionEffect(true);
  18. cardEffects.Add(activateClass);
  19. string EffectDescription()
  20. {
  21. return
  22. "When an effect trashes this digivolution card, <De-Digivolve 1> 1 of your opponent's Digimon (Trash the top card. You can't trash past level 3 cards).";
  23. }
  24. bool CanUseCondition(Hashtable hashtable)
  25. {
  26. return CardEffectCommons.CanTriggerOnTrashSelfDigivolutionCard(hashtable, cardEffect => cardEffect != null, card);
  27. }
  28. bool CanSelectPermanentCondition(Permanent permanent)
  29. {
  30. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  31. }
  32. bool CanActivateCondition(Hashtable hashtable)
  33. {
  34. return CardEffectCommons.IsExistOnTrash(card) &&
  35. CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
  36. }
  37. IEnumerator ActivateCoroutine(Hashtable hashtable)
  38. {
  39. SelectPermanentEffect selectPermanentEffect =
  40. GManager.instance.GetComponent<SelectPermanentEffect>();
  41. selectPermanentEffect.SetUp(
  42. selectPlayer: card.Owner,
  43. canTargetCondition: CanSelectPermanentCondition,
  44. canTargetCondition_ByPreSelecetedList: null,
  45. canEndSelectCondition: null,
  46. maxCount: 1,
  47. canNoSelect: false,
  48. canEndNotMax: false,
  49. selectPermanentCoroutine: SelectPermanentCoroutine,
  50. afterSelectPermanentCoroutine: null,
  51. mode: SelectPermanentEffect.Mode.Custom,
  52. cardEffect: activateClass);
  53. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digivolve.",
  54. "The opponent is selecting 1 Digimon to De-Digivolve.");
  55. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  56. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  57. {
  58. yield return ContinuousController.instance.StartCoroutine(
  59. new IDegeneration(permanent, 1, activateClass).Degeneration());
  60. }
  61. }
  62. }
  63. #endregion
  64. #region Ignore Color Requirement
  65. if (timing == EffectTiming.None)
  66. {
  67. IgnoreColorConditionClass ignoreColorConditionClass = new IgnoreColorConditionClass();
  68. ignoreColorConditionClass.SetUpICardEffect("Ignore color requirements", CanUseCondition, card);
  69. ignoreColorConditionClass.SetUpIgnoreColorConditionClass(cardCondition: CardCondition);
  70. cardEffects.Add(ignoreColorConditionClass);
  71. bool HasThreeMusketeersTrait(Permanent permanent)
  72. {
  73. return permanent.IsDigimon &&
  74. permanent.TopCard.ContainsTraits("Three Musketeers");
  75. }
  76. bool CanUseCondition(Hashtable hashtable)
  77. {
  78. return CardEffectCommons.HasMatchConditionOwnersPermanent(card, HasThreeMusketeersTrait);
  79. }
  80. bool CardCondition(CardSource cardSource)
  81. {
  82. return cardSource == card;
  83. }
  84. }
  85. #endregion
  86. #region Main
  87. if (timing == EffectTiming.OptionSkill)
  88. {
  89. ActivateClass activateClass = new ActivateClass();
  90. activateClass.SetUpICardEffect("Delete 1 Digimon", CanUseCondition, card);
  91. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  92. cardEffects.Add(activateClass);
  93. string EffectDescription()
  94. {
  95. return
  96. "[Main] Delete 1 of your opponent's Digimon with the lowest play cost. Then, place this card as the bottom digivolution card of 1 of your Digimon with the [Three Musketeers] trait.";
  97. }
  98. bool CanSelectOpponentPermanentCondition(Permanent permanent)
  99. {
  100. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) &&
  101. CardEffectCommons.IsMinCost(permanent, card.Owner.Enemy, true);
  102. }
  103. bool IsThreeMusketeersPermanentCondition(Permanent permanent)
  104. {
  105. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  106. permanent.TopCard.ContainsTraits("Three Musketeers");
  107. }
  108. bool CanUseCondition(Hashtable hashtable)
  109. {
  110. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  111. }
  112. IEnumerator ActivateCoroutine(Hashtable hashtable)
  113. {
  114. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentCondition))
  115. {
  116. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  117. selectPermanentEffect.SetUp(
  118. selectPlayer: card.Owner,
  119. canTargetCondition: CanSelectOpponentPermanentCondition,
  120. canTargetCondition_ByPreSelecetedList: null,
  121. canEndSelectCondition: null,
  122. maxCount: 1,
  123. canNoSelect: false,
  124. canEndNotMax: false,
  125. selectPermanentCoroutine: null,
  126. afterSelectPermanentCoroutine: null,
  127. mode: SelectPermanentEffect.Mode.Destroy,
  128. cardEffect: activateClass);
  129. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  130. }
  131. if (CardEffectCommons.HasMatchConditionPermanent(IsThreeMusketeersPermanentCondition))
  132. {
  133. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  134. selectPermanentEffect.SetUp(
  135. selectPlayer: card.Owner,
  136. canTargetCondition: IsThreeMusketeersPermanentCondition,
  137. canTargetCondition_ByPreSelecetedList: null,
  138. canEndSelectCondition: null,
  139. maxCount: 1,
  140. canNoSelect: false,
  141. canEndNotMax: false,
  142. selectPermanentCoroutine: SelectPermanentCoroutine,
  143. afterSelectPermanentCoroutine: null,
  144. mode: SelectPermanentEffect.Mode.Custom,
  145. cardEffect: activateClass);
  146. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get a digivolution card.",
  147. "The opponent is selecting 1 Digimon that will get a digivolution card.");
  148. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  149. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  150. {
  151. if (permanent != null)
  152. {
  153. yield return ContinuousController.instance.StartCoroutine(
  154. card.Owner.brainStormObject.CloseBrainstrorm(card));
  155. yield return ContinuousController.instance.StartCoroutine(
  156. permanent.AddDigivolutionCardsBottom(new List<CardSource>() { card }, activateClass));
  157. }
  158. }
  159. }
  160. }
  161. }
  162. #endregion
  163. #region Security Effect
  164. if (timing == EffectTiming.SecuritySkill)
  165. {
  166. ActivateClass activateClass = new ActivateClass();
  167. activateClass.SetUpICardEffect($"Delete 1 of your opponent's Digimon with the lowest play cost.", CanUseCondition, card);
  168. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  169. activateClass.SetIsSecurityEffect(true);
  170. cardEffects.Add(activateClass);
  171. string EffectDescription()
  172. {
  173. return "[Security] Delete 1 of your opponent's Digimon with the lowest play cost.";
  174. }
  175. bool CanSelectPermanentCondition(Permanent permanent)
  176. {
  177. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) &&
  178. CardEffectCommons.IsMinCost(permanent, card.Owner.Enemy, true);
  179. }
  180. bool CanUseCondition(Hashtable hashtable)
  181. {
  182. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  183. }
  184. IEnumerator ActivateCoroutine(Hashtable hashtable)
  185. {
  186. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  187. {
  188. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  189. selectPermanentEffect.SetUp(
  190. selectPlayer: card.Owner,
  191. canTargetCondition: CanSelectPermanentCondition,
  192. canTargetCondition_ByPreSelecetedList: null,
  193. canEndSelectCondition: null,
  194. maxCount: 1,
  195. canNoSelect: false,
  196. canEndNotMax: false,
  197. selectPermanentCoroutine: null,
  198. afterSelectPermanentCoroutine: null,
  199. mode: SelectPermanentEffect.Mode.Destroy,
  200. cardEffect: activateClass);
  201. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  202. }
  203. }
  204. }
  205. #endregion
  206. return cardEffects;
  207. }
  208. }
  209. }