BT14_036.cs 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT14
  5. {
  6. public class BT14_036 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.OnEnterFieldAnyone)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("DP -3000", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[When Digivolving] 1 of your opponent's Digimon gets -3000 DP for the turn.";
  20. }
  21. bool CanSelectPermanentCondition(Permanent permanent)
  22. {
  23. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  24. }
  25. bool CanUseCondition(Hashtable hashtable)
  26. {
  27. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  28. }
  29. bool CanActivateCondition(Hashtable hashtable)
  30. {
  31. if (CardEffectCommons.IsExistOnBattleArea(card))
  32. {
  33. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  34. {
  35. return true;
  36. }
  37. }
  38. return false;
  39. }
  40. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  41. {
  42. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  43. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  44. selectPermanentEffect.SetUp(
  45. selectPlayer: card.Owner,
  46. canTargetCondition: CanSelectPermanentCondition,
  47. canTargetCondition_ByPreSelecetedList: null,
  48. canEndSelectCondition: null,
  49. maxCount: maxCount,
  50. canNoSelect: false,
  51. canEndNotMax: false,
  52. selectPermanentCoroutine: SelectPermanentCoroutine,
  53. afterSelectPermanentCoroutine: null,
  54. mode: SelectPermanentEffect.Mode.Custom,
  55. cardEffect: activateClass);
  56. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -3000.", "The opponent is selecting 1 Digimon that will get DP -3000.");
  57. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  58. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  59. {
  60. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -3000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  61. }
  62. }
  63. }
  64. if (timing == EffectTiming.OnAllyAttack)
  65. {
  66. ActivateClass activateClass = new ActivateClass();
  67. activateClass.SetUpICardEffect("DP -2000", CanUseCondition, card);
  68. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  69. activateClass.SetIsInheritedEffect(true);
  70. activateClass.SetHashString("DP-2000_BT14_036");
  71. cardEffects.Add(activateClass);
  72. string EffectDiscription()
  73. {
  74. return "[When Attacking][Once Per Turn] 1 of your opponent's Digimon gets -2000 DP for the turn.";
  75. }
  76. bool CanSelectPermanentCondition(Permanent permanent)
  77. {
  78. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  79. }
  80. bool CanUseCondition(Hashtable hashtable)
  81. {
  82. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  83. }
  84. bool CanActivateCondition(Hashtable hashtable)
  85. {
  86. if (CardEffectCommons.IsExistOnBattleArea(card))
  87. {
  88. return true;
  89. }
  90. return false;
  91. }
  92. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  93. {
  94. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  95. {
  96. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  97. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  98. selectPermanentEffect.SetUp(
  99. selectPlayer: card.Owner,
  100. canTargetCondition: CanSelectPermanentCondition,
  101. canTargetCondition_ByPreSelecetedList: null,
  102. canEndSelectCondition: null,
  103. maxCount: maxCount,
  104. canNoSelect: false,
  105. canEndNotMax: false,
  106. selectPermanentCoroutine: SelectPermanentCoroutine,
  107. afterSelectPermanentCoroutine: null,
  108. mode: SelectPermanentEffect.Mode.Custom,
  109. cardEffect: activateClass);
  110. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -2000.", "The opponent is selecting 1 Digimon that will get DP -2000.");
  111. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  112. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  113. {
  114. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  115. targetPermanent: permanent,
  116. changeValue: -2000,
  117. effectDuration: EffectDuration.UntilEachTurnEnd,
  118. activateClass: activateClass));
  119. }
  120. }
  121. }
  122. }
  123. return cardEffects;
  124. }
  125. }
  126. }