EX8_032.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.EX8
  4. {
  5. public class EX8_032 : 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 Conditions
  11. if (timing == EffectTiming.None)
  12. {
  13. bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. if (targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 3)
  16. return targetPermanent.TopCard.EqualsTraits("NSo");
  17. return false;
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  20. permanentCondition: PermanentCondition,
  21. digivolutionCost: 2,
  22. ignoreDigivolutionRequirement: false,
  23. card: card,
  24. condition: null)
  25. );
  26. }
  27. #endregion
  28. #region Inherited Effect
  29. if (timing == EffectTiming.OnAllyAttack)
  30. {
  31. ActivateClass activateClass = new ActivateClass();
  32. activateClass.SetUpICardEffect("Opponent's Digimon gets -2000 DP for the turn", CanUseCondition, card);
  33. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  34. activateClass.SetIsInheritedEffect(true);
  35. activateClass.SetHashString("ChangeDP_EX8_032");
  36. cardEffects.Add(activateClass);
  37. string EffectDescription()
  38. {
  39. return "[When Attacking] [Once Per Turn] 1 of your opponent's Digimon gets -2000 DP for the turn.";
  40. }
  41. bool SelectOpponentsDigimon(Permanent permanent)
  42. {
  43. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  44. }
  45. bool CanUseCondition(Hashtable hashtable)
  46. {
  47. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  48. }
  49. bool CanActivateCondition(Hashtable hashtable)
  50. {
  51. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  52. }
  53. IEnumerator ActivateCoroutine(Hashtable hashtable)
  54. {
  55. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  56. selectPermanentEffect.SetUp(
  57. selectPlayer: card.Owner,
  58. canTargetCondition: SelectOpponentsDigimon,
  59. canTargetCondition_ByPreSelecetedList: null,
  60. canEndSelectCondition: null,
  61. maxCount: 1,
  62. canNoSelect: false,
  63. canEndNotMax: false,
  64. selectPermanentCoroutine: SelectPermanentCoroutine,
  65. afterSelectPermanentCoroutine: null,
  66. mode: SelectPermanentEffect.Mode.Custom,
  67. cardEffect: activateClass);
  68. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  69. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  70. {
  71. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  72. targetPermanent: permanent,
  73. changeValue: -2000,
  74. effectDuration: EffectDuration.UntilEachTurnEnd,
  75. activateClass: activateClass));
  76. }
  77. }
  78. }
  79. #endregion
  80. return cardEffects;
  81. }
  82. }
  83. }