EX2_073.cs 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.EX2
  4. {
  5. public class EX2_073 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. if (timing == EffectTiming.OnEnterFieldAnyone)
  11. {
  12. ActivateClass activateClass = new ActivateClass();
  13. activateClass.SetUpICardEffect("Delete opponent's all Digimon with the highest DP", CanUseCondition, card);
  14. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  15. cardEffects.Add(activateClass);
  16. string EffectDiscription()
  17. {
  18. return "[When Digivolving] Delete all of your opponent's Digimon with the highest DP.";
  19. }
  20. bool CanSelectPermanentCondition(Permanent permanent)
  21. {
  22. if (permanent != null)
  23. {
  24. if (permanent.TopCard != null)
  25. {
  26. if (permanent.IsDigimon)
  27. {
  28. if (permanent.TopCard.Owner == card.Owner.Enemy)
  29. {
  30. if (permanent.TopCard.Owner.GetBattleAreaPermanents().Contains(permanent))
  31. {
  32. int maxDP = 0;
  33. foreach (Permanent permanent1 in permanent.TopCard.Owner.GetBattleAreaDigimons())
  34. {
  35. if (permanent1.DP > maxDP)
  36. {
  37. maxDP = permanent1.DP;
  38. }
  39. }
  40. if (permanent.DP == maxDP)
  41. {
  42. return true;
  43. }
  44. }
  45. }
  46. }
  47. }
  48. }
  49. return false;
  50. }
  51. bool CanUseCondition(Hashtable hashtable)
  52. {
  53. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  54. }
  55. bool CanActivateCondition(Hashtable hashtable)
  56. {
  57. if (CardEffectCommons.IsExistOnBattleArea(card))
  58. {
  59. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  60. {
  61. return true;
  62. }
  63. }
  64. return false;
  65. }
  66. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  67. {
  68. if (isExistOnField(card))
  69. {
  70. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  71. {
  72. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  73. {
  74. List<Permanent> destroyedPermanetns = new List<Permanent>();
  75. foreach (Permanent permanent in card.Owner.Enemy.GetBattleAreaDigimons())
  76. {
  77. if (CanSelectPermanentCondition(permanent))
  78. {
  79. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  80. {
  81. destroyedPermanetns.Add(permanent);
  82. }
  83. }
  84. }
  85. if (destroyedPermanetns.Count >= 1)
  86. {
  87. Hashtable hashtable = new Hashtable();
  88. hashtable.Add("CardEffect", activateClass);
  89. yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass(destroyedPermanetns, hashtable).Destroy());
  90. }
  91. }
  92. }
  93. }
  94. }
  95. }
  96. if (timing == EffectTiming.OnAllyAttack)
  97. {
  98. int count()
  99. {
  100. return 1 + card.Owner.Enemy.TrashCards.Count / 10;
  101. }
  102. ActivateClass activateClass = new ActivateClass();
  103. activateClass.SetUpICardEffect($"Trash {count()} cards of opponent's security", CanUseCondition, card);
  104. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  105. cardEffects.Add(activateClass);
  106. string EffectDiscription()
  107. {
  108. return "[When Attacking] Trash the top card of your opponent's security stack. Add 1 to the number of cards trashed by this effect for every 10 cards in your opponent's trash.";
  109. }
  110. bool CanUseCondition(Hashtable hashtable)
  111. {
  112. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  113. }
  114. bool CanActivateCondition(Hashtable hashtable)
  115. {
  116. if (CardEffectCommons.IsExistOnBattleArea(card))
  117. {
  118. if (card.Owner.Enemy.SecurityCards.Count >= 1)
  119. {
  120. if (count() >= 1)
  121. {
  122. return true;
  123. }
  124. }
  125. }
  126. return false;
  127. }
  128. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  129. {
  130. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  131. player: card.Owner.Enemy,
  132. destroySecurityCount: count(),
  133. cardEffect: activateClass,
  134. fromTop: true).DestroySecurity());
  135. }
  136. }
  137. return cardEffects;
  138. }
  139. }
  140. }