ST19_11.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.ST19
  4. {
  5. public class ST19_11 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region On Play/ When Digivolving Shared
  11. bool CanSelectPermanentSharedCondition(Permanent permanent)
  12. {
  13. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  14. }
  15. int GetDPReduceValue()
  16. {
  17. int reduceValue = -3000;
  18. if (card.Owner.GetBattleAreaDigimons().Count + card.Owner.Enemy.GetBattleAreaDigimons().Count >= 3)
  19. reduceValue += -3000;
  20. return reduceValue;
  21. }
  22. bool CanActivateSharedCondition(Hashtable hashtable)
  23. {
  24. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  25. CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentSharedCondition);
  26. }
  27. #endregion
  28. #region On Play
  29. if (timing == EffectTiming.OnEnterFieldAnyone)
  30. {
  31. ActivateClass activateClass = new ActivateClass();
  32. activateClass.SetUpICardEffect($"DP -3000/-6000", CanUseCondition, card);
  33. activateClass.SetUpActivateClass(CanActivateSharedCondition, ActivateCoroutine, -1, false, EffectDescription());
  34. cardEffects.Add(activateClass);
  35. string EffectDescription()
  36. {
  37. return "[On Play] 1 of your opponent's Digimon gets -3000 DP for the turn. If there are 3 or more Digimon, increase the DP reduction of this effect by -3000.";
  38. }
  39. bool CanUseCondition(Hashtable hashtable)
  40. {
  41. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  42. }
  43. IEnumerator ActivateCoroutine(Hashtable hashtable)
  44. {
  45. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  46. selectPermanentEffect.SetUp(
  47. selectPlayer: card.Owner,
  48. canTargetCondition: CanSelectPermanentSharedCondition,
  49. canTargetCondition_ByPreSelecetedList: null,
  50. canEndSelectCondition: null,
  51. maxCount: 1,
  52. canNoSelect: false,
  53. canEndNotMax: false,
  54. selectPermanentCoroutine: SelectPermanentCoroutine,
  55. afterSelectPermanentCoroutine: null,
  56. mode: SelectPermanentEffect.Mode.Custom,
  57. cardEffect: activateClass);
  58. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  59. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  60. {
  61. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  62. targetPermanent: permanent,
  63. changeValue: GetDPReduceValue(),
  64. effectDuration: EffectDuration.UntilEachTurnEnd,
  65. activateClass: activateClass));
  66. }
  67. }
  68. }
  69. #endregion
  70. #region When Digivolving
  71. if (timing == EffectTiming.OnEnterFieldAnyone)
  72. {
  73. ActivateClass activateClass = new ActivateClass();
  74. activateClass.SetUpICardEffect($"DP -3000/-6000", CanUseCondition, card);
  75. activateClass.SetUpActivateClass(CanActivateSharedCondition, ActivateCoroutine, -1, false, EffectDescription());
  76. cardEffects.Add(activateClass);
  77. string EffectDescription()
  78. {
  79. return "[When Digivolving] 1 of your opponent's Digimon gets -3000 DP for the turn. If there are 3 or more Digimon, increase the DP reduction of this effect by -3000.";
  80. }
  81. bool CanUseCondition(Hashtable hashtable)
  82. {
  83. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  84. }
  85. IEnumerator ActivateCoroutine(Hashtable hashtable)
  86. {
  87. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentSharedCondition))
  88. {
  89. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  90. selectPermanentEffect.SetUp(
  91. selectPlayer: card.Owner,
  92. canTargetCondition: CanSelectPermanentSharedCondition,
  93. canTargetCondition_ByPreSelecetedList: null,
  94. canEndSelectCondition: null,
  95. maxCount: 1,
  96. canNoSelect: false,
  97. canEndNotMax: false,
  98. selectPermanentCoroutine: SelectPermanentCoroutine,
  99. afterSelectPermanentCoroutine: null,
  100. mode: SelectPermanentEffect.Mode.Custom,
  101. cardEffect: activateClass);
  102. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  103. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  104. {
  105. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  106. targetPermanent: permanent,
  107. changeValue: GetDPReduceValue(),
  108. effectDuration: EffectDuration.UntilEachTurnEnd,
  109. activateClass: activateClass));
  110. }
  111. }
  112. }
  113. }
  114. #endregion
  115. #region All Turns - ESS
  116. if (timing == EffectTiming.WhenRemoveField)
  117. {
  118. ActivateClass activateClass = new ActivateClass();
  119. activateClass.SetUpICardEffect("Delete 1 of your other Digimon to prevent this Digimon from leaving",
  120. CanUseCondition, card);
  121. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription());
  122. activateClass.SetIsInheritedEffect(true);
  123. activateClass.SetHashString("Substitute_EX7_027");
  124. cardEffects.Add(activateClass);
  125. string EffectDescription()
  126. {
  127. return
  128. "[All Turns][Once Per Turn] When this Digimon would leave the battle area other than by one of your effects, by deleting 1 of your Tokens or 1 of your other Digimon with the [Puppet] trait, prevent it from leaving.";
  129. }
  130. bool CanSelectPermanentCondition(Permanent permanent)
  131. {
  132. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  133. permanent != card.PermanentOfThisCard() &&
  134. (permanent.IsToken || permanent.TopCard.ContainsTraits("Puppet"));
  135. }
  136. bool CanUseCondition(Hashtable hashtable)
  137. {
  138. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  139. CardEffectCommons.CanTriggerWhenRemoveField(hashtable, card) &&
  140. !CardEffectCommons.IsByEffect(hashtable, cardEffect => CardEffectCommons.IsOwnerEffect(cardEffect, card));
  141. }
  142. bool CanActivateCondition(Hashtable hashtable)
  143. {
  144. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  145. CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
  146. }
  147. IEnumerator ActivateCoroutine(Hashtable hashtable)
  148. {
  149. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  150. {
  151. Permanent thisCardPermanent = card.PermanentOfThisCard();
  152. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  153. selectPermanentEffect.SetUp(
  154. selectPlayer: card.Owner,
  155. canTargetCondition: CanSelectPermanentCondition,
  156. canTargetCondition_ByPreSelecetedList: null,
  157. canEndSelectCondition: null,
  158. maxCount: 1,
  159. canNoSelect: true,
  160. canEndNotMax: false,
  161. selectPermanentCoroutine: SelectPermanentCoroutine,
  162. afterSelectPermanentCoroutine: null,
  163. mode: SelectPermanentEffect.Mode.Custom,
  164. cardEffect: activateClass);
  165. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.",
  166. "The opponent is selecting 1 Digimon to delete.");
  167. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  168. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  169. {
  170. yield return ContinuousController.instance.StartCoroutine(
  171. CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(
  172. targetPermanents: new List<Permanent>() { permanent },
  173. activateClass: activateClass,
  174. successProcess: _ => SuccessProcess(),
  175. failureProcess: null));
  176. IEnumerator SuccessProcess()
  177. {
  178. thisCardPermanent.willBeRemoveField = false;
  179. thisCardPermanent.HideDeleteEffect();
  180. thisCardPermanent.HideHandBounceEffect();
  181. thisCardPermanent.HideDeckBounceEffect();
  182. thisCardPermanent.HideWillRemoveFieldEffect();
  183. yield return null;
  184. }
  185. }
  186. }
  187. }
  188. }
  189. #endregion
  190. return cardEffects;
  191. }
  192. }
  193. }