EX2_051.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.EX2
  5. {
  6. public class EX2_051 : 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.OnDeclaration)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Delete 1 Digimon with DP less than or equal to this Digimon's DP", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[Main] If you have a [Mother D-Reaper] in play, you may suspend this Digimon to delete 1 of your opponent's Digimon with DP less than or equal to this Digimon's DP.";
  20. }
  21. bool CanSelectPermanentCondition(Permanent permanent)
  22. {
  23. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  24. {
  25. if (CardEffectCommons.IsExistOnBattleArea(card))
  26. {
  27. if (permanent.DP <= card.PermanentOfThisCard().DP)
  28. {
  29. return true;
  30. }
  31. }
  32. }
  33. return false;
  34. }
  35. bool CanUseCondition(Hashtable hashtable)
  36. {
  37. if (CardEffectCommons.IsExistOnBattleArea(card))
  38. {
  39. if (CardEffectCommons.CanActivateSuspendCostEffect(card))
  40. {
  41. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.TopCard.CardNames.Contains("Mother D-Reaper")))
  42. {
  43. return true;
  44. }
  45. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.TopCard.CardNames.Contains("MotherD-Reaper")))
  46. {
  47. return true;
  48. }
  49. }
  50. }
  51. return false;
  52. }
  53. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  54. {
  55. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  56. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  57. {
  58. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  59. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  60. selectPermanentEffect.SetUp(
  61. selectPlayer: card.Owner,
  62. canTargetCondition: CanSelectPermanentCondition,
  63. canTargetCondition_ByPreSelecetedList: null,
  64. canEndSelectCondition: null,
  65. maxCount: maxCount,
  66. canNoSelect: false,
  67. canEndNotMax: false,
  68. selectPermanentCoroutine: null,
  69. afterSelectPermanentCoroutine: null,
  70. mode: SelectPermanentEffect.Mode.Destroy,
  71. cardEffect: activateClass);
  72. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  73. }
  74. }
  75. }
  76. return cardEffects;
  77. }
  78. }
  79. }