BT15_018.cs 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT15
  5. {
  6. public class BT15_018 : 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.OnEndTurn)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Delete 1 Digimon with the lowest DP", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  16. activateClass.SetHashString("DeleteLowestDP_BT15_018");
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[End of Your Turn] [Once Per Turn] If your opponent has 4 or more memory, delete 1 of their Digimon with the lowest DP.";
  21. }
  22. bool CanSelectPermanentCondition(Permanent permanent)
  23. {
  24. if (CardEffectCommons.IsMinDP(permanent, card.Owner.Enemy))
  25. {
  26. if (permanent.IsDigimon)
  27. {
  28. return true;
  29. }
  30. }
  31. return false;
  32. }
  33. bool CanUseCondition(Hashtable hashtable)
  34. {
  35. if (CardEffectCommons.IsExistOnBattleArea(card))
  36. {
  37. if (CardEffectCommons.IsOwnerTurn(card))
  38. {
  39. return true;
  40. }
  41. }
  42. return false;
  43. }
  44. bool CanActivateCondition(Hashtable hashtable)
  45. {
  46. if (CardEffectCommons.IsExistOnBattleArea(card))
  47. {
  48. if (card.Owner.Enemy.MemoryForPlayer >= 4)
  49. {
  50. return true;
  51. }
  52. }
  53. return false;
  54. }
  55. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  56. {
  57. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  58. {
  59. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  60. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  61. selectPermanentEffect.SetUp(
  62. selectPlayer: card.Owner,
  63. canTargetCondition: CanSelectPermanentCondition,
  64. canTargetCondition_ByPreSelecetedList: null,
  65. canEndSelectCondition: null,
  66. maxCount: maxCount,
  67. canNoSelect: false,
  68. canEndNotMax: false,
  69. selectPermanentCoroutine: null,
  70. afterSelectPermanentCoroutine: null,
  71. mode: SelectPermanentEffect.Mode.Destroy,
  72. cardEffect: activateClass);
  73. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  74. }
  75. }
  76. }
  77. if (timing == EffectTiming.OnEndTurn)
  78. {
  79. ActivateClass activateClass = new ActivateClass();
  80. activateClass.SetUpICardEffect("Delete 1 Digimon with the highest Cost", CanUseCondition, card);
  81. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  82. activateClass.SetHashString("DeleteHighestCost_BT15_018");
  83. cardEffects.Add(activateClass);
  84. string EffectDiscription()
  85. {
  86. return "[End of Opponent's Turn] [Once Per Turn] If you have 4 or less memory, delete 1 of your opponent's Digimon with the highest play cost.";
  87. }
  88. bool CanSelectPermanentCondition(Permanent permanent)
  89. {
  90. if (CardEffectCommons.IsMaxCost(permanent, card.Owner.Enemy, true))
  91. {
  92. if (permanent.IsDigimon)
  93. {
  94. return true;
  95. }
  96. }
  97. return false;
  98. }
  99. bool CanUseCondition(Hashtable hashtable)
  100. {
  101. if (CardEffectCommons.IsExistOnBattleArea(card))
  102. {
  103. if (CardEffectCommons.IsOpponentTurn(card))
  104. {
  105. return true;
  106. }
  107. }
  108. return false;
  109. }
  110. bool CanActivateCondition(Hashtable hashtable)
  111. {
  112. if (CardEffectCommons.IsExistOnBattleArea(card))
  113. {
  114. if (card.Owner.MemoryForPlayer <= 4)
  115. {
  116. return true;
  117. }
  118. }
  119. return false;
  120. }
  121. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  122. {
  123. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  124. {
  125. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  126. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  127. selectPermanentEffect.SetUp(
  128. selectPlayer: card.Owner,
  129. canTargetCondition: CanSelectPermanentCondition,
  130. canTargetCondition_ByPreSelecetedList: null,
  131. canEndSelectCondition: null,
  132. maxCount: maxCount,
  133. canNoSelect: false,
  134. canEndNotMax: false,
  135. selectPermanentCoroutine: null,
  136. afterSelectPermanentCoroutine: null,
  137. mode: SelectPermanentEffect.Mode.Destroy,
  138. cardEffect: activateClass);
  139. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  140. }
  141. }
  142. }
  143. return cardEffects;
  144. }
  145. }
  146. }