VikemonAce_BT16_026.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT16
  4. {
  5. public class VikemonAce_BT16_026 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Alternate Digivolution, Blast Digivolve
  11. if (timing == EffectTiming.None)
  12. {
  13. bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.CardNames.Contains("Shakkoumon") || targetPermanent.TopCard.CardNames.Contains("Zudomon");
  16. }
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  18. permanentCondition: PermanentCondition,
  19. digivolutionCost: 3,
  20. ignoreDigivolutionRequirement: false,
  21. card: card,
  22. condition: null)
  23. );
  24. }
  25. if (timing == EffectTiming.OnCounterTiming)
  26. {
  27. cardEffects.Add(CardEffectFactory.BlastDigivolveEffect(card: card, condition: null));
  28. }
  29. #endregion
  30. #region On Play
  31. if (timing == EffectTiming.OnEnterFieldAnyone)
  32. {
  33. ActivateClass activateClass = new ActivateClass();
  34. activateClass.SetUpICardEffect("<De-Digivolve 2> 1 of your opponent's Digimon.", CanUseCondition, card);
  35. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  36. cardEffects.Add(activateClass);
  37. string EffectDiscription()
  38. {
  39. return "[On Play] <De-Digivolve 2> 1 of your opponent's Digimon. Then, none of your opponent's Digimon with 1 or fewer digivolution cards can suspend until the end of their turn.";
  40. }
  41. bool CanSelectDeDigivolveTarget(Permanent permanent)
  42. {
  43. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  44. }
  45. bool CantSuspendCondition(Permanent permanent)
  46. {
  47. if(CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  48. {
  49. return permanent.DigivolutionCards.Count <= 1;
  50. }
  51. return false;
  52. }
  53. bool CanUseCondition(Hashtable hashtable)
  54. {
  55. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  56. }
  57. bool CanActivateCondition(Hashtable hashtable)
  58. {
  59. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  60. }
  61. IEnumerator ActivateCoroutine(Hashtable hashtable)
  62. {
  63. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectDeDigivolveTarget))
  64. {
  65. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  66. selectPermanentEffect.SetUp(
  67. selectPlayer: card.Owner,
  68. canTargetCondition: CanSelectDeDigivolveTarget,
  69. canTargetCondition_ByPreSelecetedList: null,
  70. canEndSelectCondition: null,
  71. maxCount: 1,
  72. canNoSelect: false,
  73. canEndNotMax: false,
  74. selectPermanentCoroutine: SelectPermanentCoroutine,
  75. afterSelectPermanentCoroutine: null,
  76. mode: SelectPermanentEffect.Mode.Custom,
  77. cardEffect: activateClass);
  78. selectPermanentEffect.SetUpCustomMessage("Select Digimons to De-Digivolve.", "The opponent is selecting Digimons to De-Digivolve.");
  79. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  80. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  81. {
  82. if (permanent != null)
  83. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(permanent, 2, activateClass).Degeneration());
  84. yield return null;
  85. }
  86. }
  87. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotSuspendPlayerEffect(
  88. permanentCondition: CantSuspendCondition,
  89. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  90. activateClass: activateClass,
  91. isOnlyActivePhase: false,
  92. effectName: "Can't Suspend"));
  93. }
  94. }
  95. #endregion
  96. #region When Digivolving
  97. if (timing == EffectTiming.OnEnterFieldAnyone)
  98. {
  99. ActivateClass activateClass = new ActivateClass();
  100. activateClass.SetUpICardEffect("<De-Digivolve 2> 1 of your opponent's Digimon.", CanUseCondition, card);
  101. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  102. cardEffects.Add(activateClass);
  103. string EffectDiscription()
  104. {
  105. return "[When Digivolving] <De-Digivolve 2> 1 of your opponent's Digimon. Then, none of your opponent's Digimon with 1 or fewer digivolution cards can suspend until the end of their turn.";
  106. }
  107. bool CanSelectDeDigivolveTarget(Permanent permanent)
  108. {
  109. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  110. }
  111. bool CantSuspendCondition(Permanent permanent)
  112. {
  113. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  114. {
  115. return permanent.DigivolutionCards.Count <= 1;
  116. }
  117. return false;
  118. }
  119. bool CanUseCondition(Hashtable hashtable)
  120. {
  121. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  122. }
  123. bool CanActivateCondition(Hashtable hashtable)
  124. {
  125. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  126. }
  127. IEnumerator ActivateCoroutine(Hashtable hashtable)
  128. {
  129. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectDeDigivolveTarget))
  130. {
  131. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  132. selectPermanentEffect.SetUp(
  133. selectPlayer: card.Owner,
  134. canTargetCondition: CanSelectDeDigivolveTarget,
  135. canTargetCondition_ByPreSelecetedList: null,
  136. canEndSelectCondition: null,
  137. maxCount: 1,
  138. canNoSelect: false,
  139. canEndNotMax: false,
  140. selectPermanentCoroutine: SelectPermanentCoroutine,
  141. afterSelectPermanentCoroutine: null,
  142. mode: SelectPermanentEffect.Mode.Custom,
  143. cardEffect: activateClass);
  144. selectPermanentEffect.SetUpCustomMessage("Select Digimons to De-Digivolve.", "The opponent is selecting Digimons to De-Digivolve.");
  145. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  146. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  147. {
  148. if (permanent != null)
  149. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(permanent, 2, activateClass).Degeneration());
  150. yield return null;
  151. }
  152. }
  153. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotSuspendPlayerEffect(
  154. permanentCondition: CantSuspendCondition,
  155. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  156. activateClass: activateClass,
  157. isOnlyActivePhase: false,
  158. effectName: "Can't Suspend"));
  159. }
  160. }
  161. #endregion
  162. #region When Attacking
  163. if (timing == EffectTiming.OnAllyAttack)
  164. {
  165. ActivateClass activateClass = new ActivateClass();
  166. activateClass.SetUpICardEffect("Delete 1 of your opponent's Digimon", CanUseCondition, card);
  167. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  168. cardEffects.Add(activateClass);
  169. string EffectDiscription()
  170. {
  171. return "[When Attacking] Delete 1 of your opponent's Digimon with 1 or fewer digivolution cards.";
  172. }
  173. bool CanSelectPermanentCondition(Permanent targetPermanent)
  174. {
  175. if(CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(targetPermanent, card))
  176. return (targetPermanent.DigivolutionCards.Count <= 1);
  177. return false;
  178. }
  179. bool CanUseCondition(Hashtable hashtable)
  180. {
  181. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  182. }
  183. bool CanActivateCondition(Hashtable hashtable)
  184. {
  185. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  186. {
  187. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  188. return true;
  189. }
  190. return false;
  191. }
  192. IEnumerator ActivateCoroutine(Hashtable hashtable)
  193. {
  194. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  195. selectPermanentEffect.SetUp(
  196. selectPlayer: card.Owner,
  197. canTargetCondition: CanSelectPermanentCondition,
  198. canTargetCondition_ByPreSelecetedList: null,
  199. canEndSelectCondition: null,
  200. maxCount: 1,
  201. canNoSelect: false,
  202. canEndNotMax: false,
  203. selectPermanentCoroutine: null,
  204. afterSelectPermanentCoroutine: null,
  205. mode: SelectPermanentEffect.Mode.Destroy,
  206. cardEffect: activateClass);
  207. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  208. }
  209. }
  210. #endregion
  211. return cardEffects;
  212. }
  213. }
  214. }