EX1_064.cs 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.EX1
  5. {
  6. public class EX1_064 : 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 level 4 or lower unsuspended Digimon", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[On Play] Delete 4 of your opponent's unsuspended level 4 or lower Digimon.";
  20. }
  21. bool CanSelectPermanentCondition(Permanent permanent)
  22. {
  23. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  24. {
  25. if (permanent.Level <= 4)
  26. {
  27. if (!permanent.IsSuspended)
  28. {
  29. if (permanent.CanSelectBySkill(activateClass))
  30. {
  31. if (permanent.TopCard.HasLevel)
  32. {
  33. return true;
  34. }
  35. }
  36. }
  37. }
  38. }
  39. return false;
  40. }
  41. bool CanUseCondition(Hashtable hashtable)
  42. {
  43. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  44. }
  45. bool CanActivateCondition(Hashtable hashtable)
  46. {
  47. if (CardEffectCommons.IsExistOnBattleArea(card))
  48. {
  49. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  50. {
  51. return true;
  52. }
  53. }
  54. return false;
  55. }
  56. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  57. {
  58. int maxCount = Math.Min(4, 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. if (timing == EffectTiming.OnDestroyedAnyone)
  76. {
  77. ActivateClass activateClass = new ActivateClass();
  78. activateClass.SetUpICardEffect("Draw 1", CanUseCondition, card);
  79. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  80. activateClass.SetHashString("Draw1_EX1_064");
  81. cardEffects.Add(activateClass);
  82. string EffectDiscription()
  83. {
  84. return "[Your Turn][Once Per Turn] When one of your opponent's Digimon is deleted, <Draw 1>. (Draw 1 card from your deck.)";
  85. }
  86. bool PermanentCondition(Permanent permanent)
  87. {
  88. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  89. }
  90. bool CanUseCondition(Hashtable hashtable)
  91. {
  92. if (CardEffectCommons.IsExistOnBattleArea(card))
  93. {
  94. if (CardEffectCommons.IsOwnerTurn(card))
  95. {
  96. if (CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable, PermanentCondition, activateClass))
  97. {
  98. return true;
  99. }
  100. }
  101. }
  102. return false;
  103. }
  104. bool CanActivateCondition(Hashtable hashtable)
  105. {
  106. if (CardEffectCommons.IsExistOnBattleArea(card))
  107. {
  108. return true;
  109. }
  110. return false;
  111. }
  112. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  113. {
  114. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  115. }
  116. }
  117. return cardEffects;
  118. }
  119. }
  120. }