EX10_023.cs 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.EX10
  4. {
  5. public class EX10_023 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Digivolution Requirements
  11. if (timing == EffectTiming.None)
  12. {
  13. bool Condition()
  14. {
  15. return CardEffectCommons.HasMatchConditionPermanent(HasRyomaMogami);
  16. }
  17. bool HasRyomaMogami(Permanent permanent)
  18. {
  19. return CardEffectCommons.IsOwnerPermanent(permanent, card) &&
  20. permanent.TopCard.EqualsCardName("Ryoma Mogami");
  21. }
  22. bool PermanentCondition(Permanent targetPermanent)
  23. {
  24. return targetPermanent.TopCard.EqualsCardName("Astamon");
  25. }
  26. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 7, ignoreDigivolutionRequirement: false, card: card, condition: Condition));
  27. }
  28. #endregion
  29. #region Blast Digivolve
  30. if (timing == EffectTiming.OnCounterTiming)
  31. {
  32. cardEffects.Add(CardEffectFactory.BlastDigivolveEffect(card: card, condition: null));
  33. }
  34. #endregion
  35. #region Shared OP/WD
  36. string EffectDiscriptionShared(string tag)
  37. {
  38. return $"[{tag}] Suspend all other Digimon and Tamers.";
  39. }
  40. bool CanActivateConditionShared(Hashtable hashtable)
  41. {
  42. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  43. }
  44. IEnumerator ActivateCoroutineShared(Hashtable hashtable, ActivateClass activateClass)
  45. {
  46. bool CanSelectPermanentCondition(Permanent permanent)
  47. {
  48. return (CardEffectCommons.IsPermanentExistsOnBattleArea(permanent) &&
  49. permanent != card.PermanentOfThisCard() &&
  50. !permanent.TopCard.CanNotBeAffected(activateClass) &&
  51. (permanent.IsDigimon || permanent.IsTamer));
  52. }
  53. List<Permanent> suspendTargetPermanents =
  54. GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer
  55. .Map(player => player.GetBattleAreaPermanents().Filter(CanSelectPermanentCondition))
  56. .Flat();
  57. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(suspendTargetPermanents, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  58. }
  59. #endregion
  60. #region On Play
  61. if (timing == EffectTiming.OnEnterFieldAnyone)
  62. {
  63. ActivateClass activateClass = new ActivateClass();
  64. activateClass.SetUpICardEffect("Suspend all other Digimon", CanUseCondition, card);
  65. activateClass.SetUpActivateClass(CanActivateConditionShared, hash => ActivateCoroutineShared(hash, activateClass), -1, false, EffectDiscriptionShared("On Play"));
  66. cardEffects.Add(activateClass);
  67. bool CanUseCondition(Hashtable hashtable)
  68. {
  69. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  70. CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  71. }
  72. }
  73. #endregion
  74. #region When Digivolving
  75. if (timing == EffectTiming.OnEnterFieldAnyone)
  76. {
  77. ActivateClass activateClass = new ActivateClass();
  78. activateClass.SetUpICardEffect("Suspend all other Digimon", CanUseCondition, card);
  79. activateClass.SetUpActivateClass(CanActivateConditionShared, hash => ActivateCoroutineShared(hash, activateClass), -1, false, EffectDiscriptionShared("When Digivolving"));
  80. cardEffects.Add(activateClass);
  81. bool CanUseCondition(Hashtable hashtable)
  82. {
  83. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  84. CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  85. }
  86. }
  87. #endregion
  88. #region When Digivolving/When Attacking Shared
  89. string SharedEffectDiscription(string tag)
  90. {
  91. return $"[{tag}] Delete 1 of your opponent's suspended Digimon.";
  92. }
  93. bool SharedCanActivateCondition(Hashtable hashtable)
  94. {
  95. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  96. }
  97. bool SharedCanSelectPermanentCondition(Permanent permanent)
  98. {
  99. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) &&
  100. permanent.IsSuspended;
  101. }
  102. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  103. {
  104. if (CardEffectCommons.HasMatchConditionPermanent(SharedCanSelectPermanentCondition))
  105. {
  106. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  107. selectPermanentEffect.SetUp(
  108. selectPlayer: card.Owner,
  109. canTargetCondition: SharedCanSelectPermanentCondition,
  110. canTargetCondition_ByPreSelecetedList: null,
  111. canEndSelectCondition: null,
  112. maxCount: 1,
  113. canNoSelect: false,
  114. canEndNotMax: false,
  115. selectPermanentCoroutine: null,
  116. afterSelectPermanentCoroutine: null,
  117. mode: SelectPermanentEffect.Mode.Destroy,
  118. cardEffect: activateClass);
  119. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  120. }
  121. }
  122. #endregion
  123. #region When Digivolving
  124. if (timing == EffectTiming.OnEnterFieldAnyone)
  125. {
  126. ActivateClass activateClass = new ActivateClass();
  127. activateClass.SetUpICardEffect("Delete 1 Suspended Digimon", CanUseCondition, card);
  128. activateClass.SetUpActivateClass(SharedCanActivateCondition, hashtable => SharedActivateCoroutine(hashtable, activateClass), 1, false, SharedEffectDiscription("When Digivolving"));
  129. activateClass.SetHashString("WD_EX10-023");
  130. cardEffects.Add(activateClass);
  131. bool CanUseCondition(Hashtable hashtable)
  132. {
  133. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  134. CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  135. }
  136. }
  137. #endregion
  138. #region When Attacking
  139. if (timing == EffectTiming.OnAllyAttack)
  140. {
  141. ActivateClass activateClass = new ActivateClass();
  142. activateClass.SetUpICardEffect("Delete 1 Suspended Digimon/Tamer", CanUseCondition, card);
  143. activateClass.SetUpActivateClass(SharedCanActivateCondition, hashtable => SharedActivateCoroutine(hashtable, activateClass), 1, false, SharedEffectDiscription("When Attacking"));
  144. activateClass.SetHashString("WD_EX10-023");
  145. cardEffects.Add(activateClass);
  146. bool CanUseCondition(Hashtable hashtable)
  147. {
  148. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  149. CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  150. }
  151. }
  152. #endregion
  153. #region All Turns
  154. if (timing == EffectTiming.None)
  155. {
  156. bool PermanentCondition(Permanent permanent)
  157. {
  158. if (CardEffectCommons.IsPermanentExistsOnBattleArea(permanent))
  159. {
  160. if (permanent != card.PermanentOfThisCard())
  161. {
  162. if (permanent.IsDigimon || permanent.IsTamer)
  163. {
  164. return true;
  165. }
  166. }
  167. }
  168. return false;
  169. }
  170. bool CanUseCondition()
  171. {
  172. return CardEffectCommons.IsExistOnBattleArea(card) &&
  173. GManager.instance.turnStateMachine.gameContext.TurnPhase == GameContext.phase.Active;
  174. }
  175. string effectName = "[All Turns] Other than this Digimon, no Digimon or Tamers can unsuspend in the unsuspend phase.";
  176. cardEffects.Add(CardEffectFactory.CantUnsuspendStaticEffect(
  177. permanentCondition: PermanentCondition,
  178. isInheritedEffect: false,
  179. card: card,
  180. condition: CanUseCondition,
  181. effectName: effectName));
  182. }
  183. #endregion
  184. return cardEffects;
  185. }
  186. }
  187. }