EX2_010.cs 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.EX2
  5. {
  6. public class EX2_010 : 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.OnAllyAttack)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Delete 1 Digimon with 4000 or 6000 DP or less", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[When Attacking] Delete 1 of your opponent's Digimon with 4000 DP or less. If you have a red Tamer in play, delete 1 of your opponent's Digimon with 6000 DP or less instead.";
  20. }
  21. bool CanSelectPermanentCondition(Permanent permanent)
  22. {
  23. if (permanent != null)
  24. {
  25. if (permanent.TopCard != null)
  26. {
  27. if (permanent.IsDigimon)
  28. {
  29. if (permanent.TopCard.Owner == card.Owner.Enemy)
  30. {
  31. if (permanent.TopCard.Owner.GetBattleAreaPermanents().Contains(permanent))
  32. {
  33. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(4000, activateClass))
  34. {
  35. return true;
  36. }
  37. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.TopCard.CardColors.Contains(CardColor.Red) && permanent.IsTamer))
  38. {
  39. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(6000, activateClass))
  40. {
  41. return true;
  42. }
  43. }
  44. }
  45. }
  46. }
  47. }
  48. }
  49. return false;
  50. }
  51. bool CanUseCondition(Hashtable hashtable)
  52. {
  53. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  54. }
  55. bool CanActivateCondition(Hashtable hashtable)
  56. {
  57. if (CardEffectCommons.IsExistOnBattleArea(card))
  58. {
  59. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  60. {
  61. return true;
  62. }
  63. }
  64. return false;
  65. }
  66. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  67. {
  68. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  69. {
  70. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  71. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  72. selectPermanentEffect.SetUp(
  73. selectPlayer: card.Owner,
  74. canTargetCondition: CanSelectPermanentCondition,
  75. canTargetCondition_ByPreSelecetedList: null,
  76. canEndSelectCondition: null,
  77. maxCount: maxCount,
  78. canNoSelect: false,
  79. canEndNotMax: false,
  80. selectPermanentCoroutine: null,
  81. afterSelectPermanentCoroutine: null,
  82. mode: SelectPermanentEffect.Mode.Destroy,
  83. cardEffect: activateClass);
  84. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  85. }
  86. }
  87. }
  88. if (timing == EffectTiming.None)
  89. {
  90. ChangeDPDeleteEffectMaxDPClass changeDPDeleteEffectMaxDPClass = new ChangeDPDeleteEffectMaxDPClass();
  91. changeDPDeleteEffectMaxDPClass.SetUpICardEffect("Maximum DP of DP-based deletion effects gets +1000 DP", CanUseCondition, card);
  92. changeDPDeleteEffectMaxDPClass.SetUpChangeDPDeleteEffectMaxDPClass(changeMaxDP: ChangeMaxDP);
  93. changeDPDeleteEffectMaxDPClass.SetIsInheritedEffect(true);
  94. cardEffects.Add(changeDPDeleteEffectMaxDPClass);
  95. bool CanUseCondition(Hashtable hashtable)
  96. {
  97. if (isExistOnField(card))
  98. {
  99. if (CardEffectCommons.IsOwnerTurn(card))
  100. {
  101. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  102. {
  103. return true;
  104. }
  105. }
  106. }
  107. return false;
  108. }
  109. int ChangeMaxDP(int maxDP, ICardEffect cardEffect)
  110. {
  111. if (cardEffect != null)
  112. {
  113. if (cardEffect.EffectSourceCard != null)
  114. {
  115. if (cardEffect.EffectSourceCard.Owner == card.Owner)
  116. {
  117. maxDP += 1000;
  118. }
  119. }
  120. }
  121. return maxDP;
  122. }
  123. }
  124. return cardEffects;
  125. }
  126. }
  127. }