BT21_015.cs 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Cyclonemon
  5. namespace DCGO.CardEffects.BT21
  6. {
  7. public class BT21_015 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Security
  13. if (timing == EffectTiming.SecuritySkill)
  14. {
  15. cardEffects.Add(CardEffectFactory.PlaySelfDigimonAfterBattleSecurityEffect(card: card));
  16. }
  17. #endregion
  18. #region On Play / When Digivolving Shared
  19. bool CanSelectPermanentCondition(Permanent permanent)
  20. {
  21. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  22. {
  23. if (permanent.DP <= 4000)
  24. {
  25. return true;
  26. }
  27. }
  28. return false;
  29. }
  30. IEnumerator ActivateCoroutine(Hashtable _hashtable, ActivateClass activateClass)
  31. {
  32. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  33. {
  34. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  35. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  36. selectPermanentEffect.SetUp(
  37. selectPlayer: card.Owner,
  38. canTargetCondition: CanSelectPermanentCondition,
  39. canTargetCondition_ByPreSelecetedList: null,
  40. canEndSelectCondition: null,
  41. maxCount: maxCount,
  42. canNoSelect: false,
  43. canEndNotMax: false,
  44. selectPermanentCoroutine: null,
  45. afterSelectPermanentCoroutine: null,
  46. mode: SelectPermanentEffect.Mode.Destroy,
  47. cardEffect: activateClass);
  48. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  49. }
  50. }
  51. #endregion
  52. #region On Play
  53. if (timing == EffectTiming.OnEnterFieldAnyone)
  54. {
  55. ActivateClass activateClass = new ActivateClass();
  56. activateClass.SetUpICardEffect("Delete 1 digimon with up to 4000 DP", CanUseCondition, card);
  57. activateClass.SetUpActivateClass(CanActivateCondition, hashtable => ActivateCoroutine(hashtable, activateClass), -1, false, EffectDiscription());
  58. cardEffects.Add(activateClass);
  59. string EffectDiscription()
  60. => "[On Play] Delete 1 of your opponent's Digimon with 4000 DP or less.";
  61. bool CanUseCondition(Hashtable hashtable)
  62. {
  63. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  64. {
  65. if (CardEffectCommons.CanTriggerOnPlay(hashtable, card))
  66. {
  67. return true;
  68. }
  69. }
  70. return false;
  71. }
  72. bool CanActivateCondition(Hashtable hashtable)
  73. {
  74. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  75. {
  76. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  77. {
  78. return true;
  79. }
  80. }
  81. return false;
  82. }
  83. }
  84. #endregion
  85. #region When Digivolving
  86. if (timing == EffectTiming.OnEnterFieldAnyone)
  87. {
  88. ActivateClass activateClass = new ActivateClass();
  89. activateClass.SetUpICardEffect("Delete 1 digimon with up to 4000 DP", CanUseCondition, card);
  90. activateClass.SetUpActivateClass(CanActivateCondition, hashtable => ActivateCoroutine(hashtable, activateClass), -1, false, EffectDiscription());
  91. cardEffects.Add(activateClass);
  92. string EffectDiscription()
  93. => "[When Digivolving] Delete 1 of your opponent's Digimon with 4000 DP or less.";
  94. bool CanUseCondition(Hashtable hashtable)
  95. {
  96. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  97. {
  98. if (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
  99. {
  100. return true;
  101. }
  102. }
  103. return false;
  104. }
  105. bool CanActivateCondition(Hashtable hashtable)
  106. {
  107. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  108. {
  109. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  110. {
  111. return true;
  112. }
  113. }
  114. return false;
  115. }
  116. }
  117. #endregion
  118. #region ESS
  119. if (timing == EffectTiming.None)
  120. {
  121. bool Condition()
  122. {
  123. if (CardEffectCommons.IsOwnerTurn(card))
  124. {
  125. return true;
  126. }
  127. return false;
  128. }
  129. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 2000, isInheritedEffect: true, card: card, condition: Condition));
  130. }
  131. #endregion
  132. return cardEffects;
  133. }
  134. }
  135. }