EX1_007.cs 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.EX1
  5. {
  6. public class EX1_007 : 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.OnEnterFieldAnyone)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Delete Digimon with 3000 DP or less", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[On Play] Delete up to 2 of your opponent's Digimon with 3000 DP or less.";
  20. }
  21. bool CanSelectPermanentCondition(Permanent permanent)
  22. {
  23. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  24. {
  25. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(3000, activateClass))
  26. {
  27. return true;
  28. }
  29. }
  30. return false;
  31. }
  32. bool CanUseCondition(Hashtable hashtable)
  33. {
  34. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  35. }
  36. bool CanActivateCondition(Hashtable hashtable)
  37. {
  38. if (CardEffectCommons.IsExistOnBattleArea(card))
  39. {
  40. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  41. {
  42. return true;
  43. }
  44. }
  45. return false;
  46. }
  47. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  48. {
  49. if (isExistOnField(card))
  50. {
  51. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  52. {
  53. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  54. {
  55. int maxCount = Math.Min(2, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  56. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  57. selectPermanentEffect.SetUp(
  58. selectPlayer: card.Owner,
  59. canTargetCondition: CanSelectPermanentCondition,
  60. canTargetCondition_ByPreSelecetedList: null,
  61. canEndSelectCondition: CanEndSelectCondition,
  62. maxCount: maxCount,
  63. canNoSelect: false,
  64. canEndNotMax: true,
  65. selectPermanentCoroutine: null,
  66. afterSelectPermanentCoroutine: null,
  67. mode: SelectPermanentEffect.Mode.Destroy,
  68. cardEffect: activateClass);
  69. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  70. bool CanEndSelectCondition(List<Permanent> permanents)
  71. {
  72. if (CardEffectCommons.HasNoElement(permanents))
  73. {
  74. return false;
  75. }
  76. return true;
  77. }
  78. }
  79. }
  80. }
  81. }
  82. }
  83. if (timing == EffectTiming.None)
  84. {
  85. bool Condition()
  86. {
  87. if (CardEffectCommons.IsExistOnBattleArea(card))
  88. {
  89. if (CardEffectCommons.IsOwnerTurn(card))
  90. {
  91. if (card.PermanentOfThisCard().TopCard.CardTraits.Contains("Machine"))
  92. {
  93. return true;
  94. }
  95. }
  96. }
  97. return false;
  98. }
  99. cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(changeValue: 1, isInheritedEffect: true, card: card, condition: Condition));
  100. }
  101. return cardEffects;
  102. }
  103. }
  104. }