EX10_009.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. // Creepymon
  6. namespace DCGO.CardEffects.EX10
  7. {
  8. public class EX10_009 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region WD/OD Shared
  14. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  15. {
  16. List<Permanent> permanents = card.Owner.Enemy.GetBattleAreaDigimons()
  17. .Filter(perm => CardEffectCommons.IsMinDP(perm, card.Owner.Enemy)).ToList();
  18. bool hasNotDeleted = false;
  19. if (permanents.Any())
  20. {
  21. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(
  22. targetPermanents: permanents,
  23. activateClass: activateClass,
  24. successProcess: null,
  25. failureProcess: FailureProcess));
  26. IEnumerator FailureProcess()
  27. {
  28. hasNotDeleted = true;
  29. yield return null;
  30. }
  31. }
  32. if (!permanents.Any() || hasNotDeleted)
  33. {
  34. yield return ContinuousController.instance.StartCoroutine(new IAddTrashCardsFromLibraryTop(
  35. addTrashCount: 5,
  36. card.Owner.Enemy,
  37. cardEffect: activateClass).AddTrashCardsFromLibraryTop());
  38. }
  39. }
  40. #endregion
  41. #region When Digivolving
  42. if (timing == EffectTiming.OnEnterFieldAnyone)
  43. {
  44. ActivateClass activateClass = new ActivateClass();
  45. activateClass.SetUpICardEffect("Delete all lowest DP Digimon. if this didn't happen, trash their top 5 deck cards", CanUseCondition, card);
  46. activateClass.SetUpActivateClass(CanActivateCondition, hashtable => SharedActivateCoroutine(hashtable, activateClass), -1, false, EffectDiscription());
  47. cardEffects.Add(activateClass);
  48. string EffectDiscription()
  49. {
  50. return "[When Digivolving] Delete all of your opponent's lowest DP Digimon. If this effect didn't delete, trash their deck's top 5 cards.";
  51. }
  52. bool CanUseCondition(Hashtable hashtable)
  53. {
  54. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  55. && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  56. }
  57. bool CanActivateCondition(Hashtable hashtable)
  58. {
  59. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  60. }
  61. }
  62. #endregion
  63. #region On Deletion
  64. if (timing == EffectTiming.OnDestroyedAnyone)
  65. {
  66. ActivateClass activateClass = new ActivateClass();
  67. activateClass.SetUpICardEffect("Delete all lowest DP Digimon. if this didn't happen, trash their top 5 deck cards", CanUseCondition, card);
  68. activateClass.SetUpActivateClass(CanActivateCondition, hashtable => SharedActivateCoroutine(hashtable, activateClass), -1, false, EffectDiscription());
  69. cardEffects.Add(activateClass);
  70. string EffectDiscription()
  71. {
  72. return "[On Deletion] Delete all of your opponent's lowest DP Digimon. If this effect didn't delete, trash their deck's top 5 cards.";
  73. }
  74. bool CanUseCondition(Hashtable hashtable)
  75. {
  76. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  77. }
  78. bool CanActivateCondition(Hashtable hashtable)
  79. {
  80. return CardEffectCommons.CanActivateOnDeletion(card, activateClass);
  81. }
  82. }
  83. #endregion
  84. #region When Attacking
  85. if (timing == EffectTiming.OnAllyAttack)
  86. {
  87. ActivateClass activateClass = new ActivateClass();
  88. activateClass.SetUpICardEffect("Play 1 red/purple digimon with 5k DP to breeding area", CanUseCondition, card);
  89. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  90. cardEffects.Add(activateClass);
  91. string EffectDiscription()
  92. {
  93. return "[When Attacking] If your opponent has 10 or more cards in their trash, you may play 1 red or purple 5000 DP or lower Digimon card from your trash to your empty breeding area without paying the cost.";
  94. }
  95. bool CanUseCondition(Hashtable hashtable)
  96. {
  97. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  98. && CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  99. }
  100. bool CanActivateCondition(Hashtable hashtable)
  101. {
  102. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  103. && card.Owner.Enemy.TrashCards.Count >= 10
  104. && CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition)
  105. && !card.Owner.GetBreedingAreaPermanents().Any();
  106. }
  107. bool CanSelectCardCondition(CardSource card)
  108. {
  109. return card.IsDigimon
  110. && (card.HasCardColor(CardColor.Red) || card.HasCardColor(CardColor.Purple))
  111. && card.BaseCardDP <= 5000
  112. && CardEffectCommons.CanPlayAsNewPermanent(card, false, activateClass, isBreedingArea: true);
  113. }
  114. IEnumerator ActivateCoroutine(Hashtable hashtable)
  115. {
  116. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  117. {
  118. CardSource selectedCard = null;
  119. #region Select Trash Card
  120. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInTrash(card, CanSelectCardCondition));
  121. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  122. selectCardEffect.SetUp(
  123. canTargetCondition: CanSelectCardCondition,
  124. canTargetCondition_ByPreSelecetedList: null,
  125. canEndSelectCondition: null,
  126. canNoSelect: () => true,
  127. selectCardCoroutine: SelectCardCoroutine,
  128. afterSelectCardCoroutine: null,
  129. message: "Select 1 digimon to place in breeding area.",
  130. maxCount: maxCount,
  131. canEndNotMax: false,
  132. isShowOpponent: true,
  133. mode: SelectCardEffect.Mode.Custom,
  134. root: SelectCardEffect.Root.Trash,
  135. customRootCardList: null,
  136. canLookReverseCard: true,
  137. selectPlayer: card.Owner,
  138. cardEffect: activateClass);
  139. IEnumerator SelectCardCoroutine(CardSource cardSource)
  140. {
  141. selectedCard = cardSource;
  142. yield return null;
  143. }
  144. selectCardEffect.SetUpCustomMessage("Select 1 digimon to place in breeding area.", "The opponent is selecting 1 digimon to place in breeding area.");
  145. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  146. #endregion
  147. if (selectedCard != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  148. cardSources: new List<CardSource> { selectedCard },
  149. activateClass: activateClass,
  150. payCost: false,
  151. isTapped: false,
  152. root: SelectCardEffect.Root.Trash,
  153. activateETB: false,
  154. isBreedingArea: true));
  155. }
  156. }
  157. }
  158. #endregion
  159. #region End Of Your Turn
  160. if (timing == EffectTiming.OnEndTurn)
  161. {
  162. ActivateClass activateClass = new ActivateClass();
  163. activateClass.SetUpICardEffect("Attack with this digimon", CanUseCondition, card);
  164. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  165. cardEffects.Add(activateClass);
  166. string EffectDiscription()
  167. {
  168. return "[End of Your Turn] This Digimon may attack.";
  169. }
  170. bool CanUseCondition(Hashtable hashtable)
  171. {
  172. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  173. }
  174. bool CanActivateCondition(Hashtable hashtable)
  175. {
  176. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  177. && CardEffectCommons.IsOwnerTurn(card)
  178. && card.PermanentOfThisCard().CanAttack(activateClass);
  179. }
  180. IEnumerator ActivateCoroutine(Hashtable hashtable)
  181. {
  182. if (card.PermanentOfThisCard().CanAttack(activateClass))
  183. {
  184. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  185. selectAttackEffect.SetUp(
  186. attacker: card.PermanentOfThisCard(),
  187. canAttackPlayerCondition: () => true,
  188. defenderCondition: (permanent) => true,
  189. cardEffect: activateClass);
  190. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  191. }
  192. }
  193. }
  194. #endregion
  195. return cardEffects;
  196. }
  197. }
  198. }