EX7_026.cs 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.EX7
  4. {
  5. public class EX7_026 : 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
  11. if (timing == EffectTiming.None)
  12. {
  13. bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.IsLevel3 && targetPermanent.TopCard.ContainsTraits("NSp");
  16. }
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  18. permanentCondition: PermanentCondition,
  19. digivolutionCost: 2,
  20. ignoreDigivolutionRequirement: false,
  21. card: card,
  22. condition: null)
  23. );
  24. }
  25. #endregion
  26. #region On Play/ When Digivolving Shared
  27. bool CanSelectPermanentSharedCondition(Permanent permanent)
  28. {
  29. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  30. }
  31. bool CanActivateSharedCondition(Hashtable hashtable)
  32. {
  33. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  34. CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentSharedCondition);
  35. }
  36. #endregion
  37. #region On Play
  38. if (timing == EffectTiming.OnEnterFieldAnyone)
  39. {
  40. ActivateClass activateClass = new ActivateClass();
  41. activateClass.SetUpICardEffect("DP -3000", CanUseCondition, card);
  42. activateClass.SetUpActivateClass(CanActivateSharedCondition, ActivateCoroutine, -1, false, EffectDescription());
  43. cardEffects.Add(activateClass);
  44. string EffectDescription()
  45. {
  46. return "[On Play] 1 of your opponent's Digimon gets -3000 DP for the turn.";
  47. }
  48. bool CanUseCondition(Hashtable hashtable)
  49. {
  50. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  51. }
  52. IEnumerator ActivateCoroutine(Hashtable hashtable)
  53. {
  54. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentSharedCondition))
  55. {
  56. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  57. selectPermanentEffect.SetUp(
  58. selectPlayer: card.Owner,
  59. canTargetCondition: CanSelectPermanentSharedCondition,
  60. canTargetCondition_ByPreSelecetedList: null,
  61. canEndSelectCondition: null,
  62. maxCount: 1,
  63. canNoSelect: false,
  64. canEndNotMax: false,
  65. selectPermanentCoroutine: SelectPermanentCoroutine,
  66. afterSelectPermanentCoroutine: null,
  67. mode: SelectPermanentEffect.Mode.Custom,
  68. cardEffect: activateClass);
  69. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  70. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  71. {
  72. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  73. targetPermanent: permanent,
  74. changeValue: -3000,
  75. effectDuration: EffectDuration.UntilEachTurnEnd,
  76. activateClass: activateClass));
  77. }
  78. }
  79. }
  80. }
  81. #endregion
  82. #region When Digivolving
  83. if (timing == EffectTiming.OnEnterFieldAnyone)
  84. {
  85. ActivateClass activateClass = new ActivateClass();
  86. activateClass.SetUpICardEffect("DP -3000", CanUseCondition, card);
  87. activateClass.SetUpActivateClass(CanActivateSharedCondition, ActivateCoroutine, -1, false, EffectDescription());
  88. cardEffects.Add(activateClass);
  89. string EffectDescription()
  90. {
  91. return "[When Digivolving] 1 of your opponent's Digimon gets -3000 DP for the turn.";
  92. }
  93. bool CanUseCondition(Hashtable hashtable)
  94. {
  95. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  96. }
  97. IEnumerator ActivateCoroutine(Hashtable hashtable)
  98. {
  99. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentSharedCondition))
  100. {
  101. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  102. selectPermanentEffect.SetUp(
  103. selectPlayer: card.Owner,
  104. canTargetCondition: CanSelectPermanentSharedCondition,
  105. canTargetCondition_ByPreSelecetedList: null,
  106. canEndSelectCondition: null,
  107. maxCount: 1,
  108. canNoSelect: false,
  109. canEndNotMax: false,
  110. selectPermanentCoroutine: SelectPermanentCoroutine,
  111. afterSelectPermanentCoroutine: null,
  112. mode: SelectPermanentEffect.Mode.Custom,
  113. cardEffect: activateClass);
  114. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  115. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  116. {
  117. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  118. targetPermanent: permanent,
  119. changeValue: -3000,
  120. effectDuration: EffectDuration.UntilEachTurnEnd,
  121. activateClass: activateClass));
  122. }
  123. }
  124. }
  125. }
  126. #endregion
  127. #region Barrier - ESS
  128. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  129. {
  130. cardEffects.Add(CardEffectFactory.BarrierSelfEffect(isInheritedEffect: true, card: card, condition: null));
  131. }
  132. #endregion
  133. return cardEffects;
  134. }
  135. }
  136. }