BT21_015.cs 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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. IEnumerator ActivateCoroutine(Hashtable _hashtable, ActivateClass activateClass)
  20. {
  21. bool CanSelectPermanentCondition(Permanent permanent)
  22. {
  23. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  24. && permanent.DP <= card.Owner.MaxDP_DeleteEffect(4000, activateClass);
  25. }
  26. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  27. {
  28. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  29. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  30. selectPermanentEffect.SetUp(
  31. selectPlayer: card.Owner,
  32. canTargetCondition: CanSelectPermanentCondition,
  33. canTargetCondition_ByPreSelecetedList: null,
  34. canEndSelectCondition: null,
  35. maxCount: maxCount,
  36. canNoSelect: false,
  37. canEndNotMax: false,
  38. selectPermanentCoroutine: null,
  39. afterSelectPermanentCoroutine: null,
  40. mode: SelectPermanentEffect.Mode.Destroy,
  41. cardEffect: activateClass);
  42. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  43. }
  44. }
  45. #endregion
  46. #region On Play
  47. if (timing == EffectTiming.OnEnterFieldAnyone)
  48. {
  49. ActivateClass activateClass = new ActivateClass();
  50. activateClass.SetUpICardEffect("Delete 1 digimon with up to 4000 DP", CanUseCondition, card);
  51. activateClass.SetUpActivateClass(CanActivateCondition, hashtable => ActivateCoroutine(hashtable, activateClass), -1, false, EffectDiscription());
  52. cardEffects.Add(activateClass);
  53. string EffectDiscription()
  54. => "[On Play] Delete 1 of your opponent's Digimon with 4000 DP or less.";
  55. bool CanUseCondition(Hashtable hashtable)
  56. {
  57. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  58. {
  59. if (CardEffectCommons.CanTriggerOnPlay(hashtable, card))
  60. {
  61. return true;
  62. }
  63. }
  64. return false;
  65. }
  66. bool CanActivateCondition(Hashtable hashtable)
  67. {
  68. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  69. }
  70. }
  71. #endregion
  72. #region When Digivolving
  73. if (timing == EffectTiming.OnEnterFieldAnyone)
  74. {
  75. ActivateClass activateClass = new ActivateClass();
  76. activateClass.SetUpICardEffect("Delete 1 digimon with up to 4000 DP", CanUseCondition, card);
  77. activateClass.SetUpActivateClass(CanActivateCondition, hashtable => ActivateCoroutine(hashtable, activateClass), -1, false, EffectDiscription());
  78. cardEffects.Add(activateClass);
  79. string EffectDiscription()
  80. => "[When Digivolving] Delete 1 of your opponent's Digimon with 4000 DP or less.";
  81. bool CanUseCondition(Hashtable hashtable)
  82. {
  83. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  84. {
  85. if (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
  86. {
  87. return true;
  88. }
  89. }
  90. return false;
  91. }
  92. bool CanActivateCondition(Hashtable hashtable)
  93. {
  94. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  95. }
  96. }
  97. #endregion
  98. #region ESS
  99. if (timing == EffectTiming.None)
  100. {
  101. bool Condition()
  102. {
  103. if (CardEffectCommons.IsOwnerTurn(card))
  104. {
  105. return true;
  106. }
  107. return false;
  108. }
  109. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 2000, isInheritedEffect: true, card: card, condition: Condition));
  110. }
  111. #endregion
  112. return cardEffects;
  113. }
  114. }
  115. }