EX10_049.cs 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // SkullSatamon
  5. namespace DCGO.CardEffects.EX10
  6. {
  7. public class EX10_049 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Blocker
  13. if (timing == EffectTiming.None)
  14. {
  15. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  16. }
  17. #endregion
  18. #region WD/OD Shared
  19. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  20. {
  21. #region Check Opponent Trash & Trash 3 if true
  22. bool trashDeck = card.Owner.Enemy.TrashCards.Count <= 10;
  23. if (trashDeck)
  24. {
  25. yield return ContinuousController.instance.StartCoroutine(new IAddTrashCardsFromLibraryTop(
  26. addTrashCount: 3,
  27. player: card.Owner,
  28. cardEffect: activateClass).AddTrashCardsFromLibraryTop());
  29. yield return ContinuousController.instance.StartCoroutine(new IAddTrashCardsFromLibraryTop(
  30. addTrashCount: 3,
  31. player: card.Owner.Enemy,
  32. cardEffect: activateClass).AddTrashCardsFromLibraryTop());
  33. }
  34. #endregion
  35. int deleteLevel = card.Owner.Enemy.TrashCards.Count >= 10 ? 5 : 3;
  36. bool PermamentCondition(Permanent permanent)
  37. {
  38. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  39. && permanent.TopCard.HasLevel && permanent.TopCard.Level <= deleteLevel;
  40. }
  41. #region Select 1 Digimon to Delete
  42. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(PermamentCondition));
  43. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  44. selectPermanentEffect.SetUp(
  45. selectPlayer: card.Owner,
  46. canTargetCondition: PermamentCondition,
  47. canTargetCondition_ByPreSelecetedList: null,
  48. canEndSelectCondition: null,
  49. maxCount: maxCount,
  50. canNoSelect: false,
  51. canEndNotMax: false,
  52. selectPermanentCoroutine: null,
  53. afterSelectPermanentCoroutine: null,
  54. mode: SelectPermanentEffect.Mode.Destroy,
  55. cardEffect: activateClass);
  56. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  57. #endregion
  58. }
  59. #endregion
  60. #region When Digivolving
  61. if (timing == EffectTiming.OnEnterFieldAnyone)
  62. {
  63. ActivateClass activateClass = new ActivateClass();
  64. activateClass.SetUpICardEffect("If opponent has 10 or more trash cards, trash top 3 of both player decks. then delete 1 level 3 or lower digimon, add 2 levels if enemy trash is 10 or more", CanUseCondition, card);
  65. activateClass.SetUpActivateClass(CanActivateCondition, hashtable => SharedActivateCoroutine(hashtable, activateClass), -1, false, EffectDiscription());
  66. cardEffects.Add(activateClass);
  67. string EffectDiscription()
  68. {
  69. return "[When Digivolving] If your opponent has 10 or fewer cards in their trash, trash the top 3 cards of both players' decks. Then, delete 1 of your opponent's level 3 or lower Digimon. If your opponent has 10 or more cards in their trash, add 2 to this effect's level maximum.";
  70. }
  71. bool CanUseCondition(Hashtable hashtable)
  72. {
  73. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  74. && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  75. }
  76. bool CanActivateCondition(Hashtable hashtable)
  77. {
  78. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  79. }
  80. }
  81. #endregion
  82. #region On Deletion
  83. if (timing == EffectTiming.OnDestroyedAnyone)
  84. {
  85. ActivateClass activateClass = new ActivateClass();
  86. activateClass.SetUpICardEffect("If opponent has 10 or more trash cards, trash top 3 of both player decks. then delete 1 level 3 or lower digimon, add 2 levels if enemy trash is 10 or more", CanUseCondition, card);
  87. activateClass.SetUpActivateClass(CanActivateCondition, hashtable => SharedActivateCoroutine(hashtable, activateClass), -1, false, EffectDiscription());
  88. cardEffects.Add(activateClass);
  89. string EffectDiscription()
  90. {
  91. return "[On Deletion] If your opponent has 10 or fewer cards in their trash, trash the top 3 cards of both players' decks. Then, delete 1 of your opponent's level 3 or lower Digimon. If your opponent has 10 or more cards in their trash, add 2 to this effect's level maximum.";
  92. }
  93. bool CanUseCondition(Hashtable hashtable)
  94. {
  95. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card);
  96. }
  97. bool CanActivateCondition(Hashtable hashtable)
  98. {
  99. return CardEffectCommons.CanActivateOnDeletion(card);
  100. }
  101. }
  102. #endregion
  103. #region ESS Once Per Turn
  104. if (timing == EffectTiming.OnAllyAttack)
  105. {
  106. ActivateClass activateClass = new ActivateClass();
  107. activateClass.SetUpICardEffect("If opponent has 10 or less trash cards, both player trash 2 cards from top deck, otherwise Sec +1", CanUseCondition, card);
  108. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  109. activateClass.SetHashString("EX10_049_WA");
  110. activateClass.SetIsInheritedEffect(true);
  111. cardEffects.Add(activateClass);
  112. string EffectDiscription()
  113. {
  114. return "[When Attacking] [Once Per Turn] This Digimon gains <Security A. +1> for the turn. (This Digimon checks 1 additional security card.) If your opponent has 10 or fewer cards in their trash, instead trash the top 2 cards of both players' decks.";
  115. }
  116. bool CanUseCondition(Hashtable hashtable)
  117. {
  118. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  119. && CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  120. }
  121. bool CanActivateCondition(Hashtable hashtable)
  122. {
  123. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  124. }
  125. IEnumerator ActivateCoroutine(Hashtable hashtable)
  126. {
  127. bool hasSecAttack = card.Owner.Enemy.TrashCards.Count >= 11;
  128. if (hasSecAttack) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(
  129. targetPermanent: card.PermanentOfThisCard(),
  130. changeValue: 1,
  131. effectDuration: EffectDuration.UntilEachTurnEnd,
  132. activateClass: activateClass));
  133. if (!hasSecAttack)
  134. {
  135. yield return ContinuousController.instance.StartCoroutine(new IAddTrashCardsFromLibraryTop(
  136. addTrashCount: 2,
  137. player: card.Owner,
  138. cardEffect: activateClass).AddTrashCardsFromLibraryTop());
  139. yield return ContinuousController.instance.StartCoroutine(new IAddTrashCardsFromLibraryTop(
  140. addTrashCount: 2,
  141. player: card.Owner.Enemy,
  142. cardEffect: activateClass).AddTrashCardsFromLibraryTop());
  143. }
  144. }
  145. }
  146. #endregion
  147. return cardEffects;
  148. }
  149. }
  150. }