EX5_041.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. public class EX5_041 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. if (timing == EffectTiming.None)
  11. {
  12. static bool PermanentCondition(Permanent targetPermanent)
  13. {
  14. return targetPermanent.TopCard.CardTraits.Contains("Deva") && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 5;
  15. }
  16. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  17. }
  18. if (timing == EffectTiming.OnCounterTiming)
  19. {
  20. cardEffects.Add(CardEffectFactory.BlastDigivolveEffect(card: card, condition: null));
  21. }
  22. if (timing == EffectTiming.OnEnterFieldAnyone)
  23. {
  24. ActivateClass activateClass = new ActivateClass();
  25. activateClass.SetUpICardEffect("Suspend Digimon and opponent's Digimon can't unsuspend", CanUseCondition, card);
  26. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  27. cardEffects.Add(activateClass);
  28. string EffectDiscription()
  29. {
  30. return "[On Play] For each of your Digimon with the [Deva]/[Four Sovereigns] trait, suspend 1 of your opponent's Digimon. Then, during your opponent's next unsuspend phase, all of their Digimon can't unsuspend .";
  31. }
  32. bool CanSelectPermanentCondition(Permanent permanent)
  33. {
  34. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  35. }
  36. bool CanUseCondition(Hashtable hashtable)
  37. {
  38. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  39. }
  40. bool CanActivateCondition(Hashtable hashtable)
  41. {
  42. if (CardEffectCommons.IsExistOnBattleArea(card))
  43. {
  44. return true;
  45. }
  46. return false;
  47. }
  48. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  49. {
  50. int digimonCount = card.Owner.GetBattleAreaDigimons().Count(permanent =>
  51. permanent.TopCard.CardTraits.Contains("Deva")
  52. || permanent.TopCard.CardTraits.Contains("Four Sovereigns")
  53. || permanent.TopCard.CardTraits.Contains("FourSovereigns"));
  54. if (digimonCount >= 1)
  55. {
  56. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  57. {
  58. int maxCount = Math.Min(digimonCount, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  59. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  60. selectPermanentEffect.SetUp(
  61. selectPlayer: card.Owner,
  62. canTargetCondition: CanSelectPermanentCondition,
  63. canTargetCondition_ByPreSelecetedList: null,
  64. canEndSelectCondition: null,
  65. maxCount: maxCount,
  66. canNoSelect: false,
  67. canEndNotMax: false,
  68. selectPermanentCoroutine: null,
  69. afterSelectPermanentCoroutine: null,
  70. mode: SelectPermanentEffect.Mode.Tap,
  71. cardEffect: activateClass);
  72. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  73. }
  74. }
  75. bool PermanentCondition(Permanent permanent)
  76. {
  77. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  78. {
  79. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  80. {
  81. return true;
  82. }
  83. }
  84. return false;
  85. }
  86. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotUnsuspendPlayerEffect(
  87. permanentCondition: PermanentCondition,
  88. effectDuration: EffectDuration.UntilOwnerActivePhase,
  89. activateClass: activateClass,
  90. isOnlyActivePhase: true,
  91. effectName: "Your card can't unsuspend"));
  92. }
  93. }
  94. if (timing == EffectTiming.OnEnterFieldAnyone)
  95. {
  96. ActivateClass activateClass = new ActivateClass();
  97. activateClass.SetUpICardEffect("Suspend Digimon and opponent's Digimon can't unsuspend", CanUseCondition, card);
  98. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  99. cardEffects.Add(activateClass);
  100. string EffectDiscription()
  101. {
  102. return "[When Digivolving] For each of your Digimon with the [Deva]/[Four Sovereigns] trait, suspend 1 of your opponent's Digimon. Then, during your opponent's next unsuspend phase, all of their Digimon can't unsuspend .";
  103. }
  104. bool CanSelectPermanentCondition(Permanent permanent)
  105. {
  106. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  107. }
  108. bool CanUseCondition(Hashtable hashtable)
  109. {
  110. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  111. }
  112. bool CanActivateCondition(Hashtable hashtable)
  113. {
  114. if (CardEffectCommons.IsExistOnBattleArea(card))
  115. {
  116. return true;
  117. }
  118. return false;
  119. }
  120. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  121. {
  122. int digimonCount = card.Owner.GetBattleAreaDigimons().Count(permanent =>
  123. permanent.TopCard.CardTraits.Contains("Deva")
  124. || permanent.TopCard.CardTraits.Contains("Four Sovereigns")
  125. || permanent.TopCard.CardTraits.Contains("FourSovereigns"));
  126. if (digimonCount >= 1)
  127. {
  128. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  129. {
  130. int maxCount = Math.Min(digimonCount, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  131. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  132. selectPermanentEffect.SetUp(
  133. selectPlayer: card.Owner,
  134. canTargetCondition: CanSelectPermanentCondition,
  135. canTargetCondition_ByPreSelecetedList: null,
  136. canEndSelectCondition: null,
  137. maxCount: maxCount,
  138. canNoSelect: false,
  139. canEndNotMax: false,
  140. selectPermanentCoroutine: null,
  141. afterSelectPermanentCoroutine: null,
  142. mode: SelectPermanentEffect.Mode.Tap,
  143. cardEffect: activateClass);
  144. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  145. }
  146. }
  147. bool PermanentCondition(Permanent permanent)
  148. {
  149. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  150. {
  151. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  152. {
  153. return true;
  154. }
  155. }
  156. return false;
  157. }
  158. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotUnsuspendPlayerEffect(
  159. permanentCondition: PermanentCondition,
  160. effectDuration: EffectDuration.UntilOwnerActivePhase,
  161. activateClass: activateClass,
  162. isOnlyActivePhase: true,
  163. effectName: "Your card can't unsuspend"));
  164. }
  165. }
  166. if (timing == EffectTiming.OnDestroyedAnyone)
  167. {
  168. ActivateClass activateClass = new ActivateClass();
  169. activateClass.SetUpICardEffect("Delete 1 suspended Digimon", CanUseCondition, card);
  170. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  171. cardEffects.Add(activateClass);
  172. string EffectDiscription()
  173. {
  174. return "[On Deletion] Delete 1 of your opponent's suspended Digimon.";
  175. }
  176. bool CanSelectPermanentCondition(Permanent permanent)
  177. {
  178. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  179. {
  180. if (permanent.IsSuspended)
  181. {
  182. return true;
  183. }
  184. }
  185. return false;
  186. }
  187. bool CanUseCondition(Hashtable hashtable)
  188. {
  189. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  190. }
  191. bool CanActivateCondition(Hashtable hashtable)
  192. {
  193. if (CardEffectCommons.CanActivateOnDeletion(card, activateClass))
  194. {
  195. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  196. {
  197. return true;
  198. }
  199. }
  200. return false;
  201. }
  202. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  203. {
  204. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  205. {
  206. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  207. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  208. selectPermanentEffect.SetUp(
  209. selectPlayer: card.Owner,
  210. canTargetCondition: CanSelectPermanentCondition,
  211. canTargetCondition_ByPreSelecetedList: null,
  212. canEndSelectCondition: null,
  213. maxCount: maxCount,
  214. canNoSelect: false,
  215. canEndNotMax: false,
  216. selectPermanentCoroutine: null,
  217. afterSelectPermanentCoroutine: null,
  218. mode: SelectPermanentEffect.Mode.Destroy,
  219. cardEffect: activateClass);
  220. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  221. }
  222. }
  223. }
  224. return cardEffects;
  225. }
  226. }