EX8_003.cs 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // Kokomon
  4. namespace DCGO.CardEffects.EX8
  5. {
  6. public class EX8_003 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region When Attacking - ESS
  12. if (timing == EffectTiming.OnAllyAttack)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Opponent's Digimon gets -2000 DP for the turn", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  17. activateClass.SetIsInheritedEffect(true);
  18. activateClass.SetHashString("ChangeDP_EX8_003");
  19. cardEffects.Add(activateClass);
  20. string EffectDescription()
  21. {
  22. return "[When Attacking] [Once Per Turn] If you have another Digimon, 1 of your opponent's Digimon gets -2000 DP for the turn.";
  23. }
  24. bool CanUseCondition(Hashtable hashtable)
  25. {
  26. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  27. }
  28. bool AnotherDigimonOnField() {
  29. return CardEffectCommons.HasMatchConditionOwnersPermanent(
  30. card,
  31. permanent => permanent.IsDigimon && permanent != card.PermanentOfThisCard()
  32. );
  33. }
  34. bool CanActivateCondition(Hashtable hashtable)
  35. {
  36. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && AnotherDigimonOnField();
  37. }
  38. bool SelectOpponentsDigimon(Permanent permanent)
  39. {
  40. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  41. }
  42. IEnumerator ActivateCoroutine(Hashtable hashtable)
  43. {
  44. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, SelectOpponentsDigimon))
  45. {
  46. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  47. selectPermanentEffect.SetUp(
  48. selectPlayer: card.Owner,
  49. canTargetCondition: SelectOpponentsDigimon,
  50. canTargetCondition_ByPreSelecetedList: null,
  51. canEndSelectCondition: null,
  52. maxCount: 1,
  53. canNoSelect: false,
  54. canEndNotMax: false,
  55. selectPermanentCoroutine: SelectPermanentCoroutine,
  56. afterSelectPermanentCoroutine: null,
  57. mode: SelectPermanentEffect.Mode.Custom,
  58. cardEffect: activateClass);
  59. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  60. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  61. {
  62. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  63. targetPermanent: permanent,
  64. changeValue: -2000,
  65. effectDuration: EffectDuration.UntilEachTurnEnd,
  66. activateClass: activateClass));
  67. }
  68. }
  69. }
  70. }
  71. #endregion
  72. return cardEffects;
  73. }
  74. }
  75. }