BT24_069.cs 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // Vilemon
  4. namespace DCGO.CardEffects.BT24
  5. {
  6. public class BT24_069 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Shared WM / WD
  12. string SharedEffectName = "Trash 1. Opponent trashes 1 or mills 2";
  13. string SharedEffectDescription(string tag) => $"[{tag}] Trash 1 card in your hand. Then, your opponent may trash 1 card in their hand. If your opponent didn't trash with this effect, trash the top 2 cards of your opponent's deck.";
  14. bool SharedCanActivateCondition(Hashtable hashtable) => CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  15. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  16. {
  17. #region Trash 1 card
  18. if (card.Owner.HandCards.Count >= 1)
  19. {
  20. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  21. selectHandEffect.SetUp(
  22. selectPlayer: card.Owner,
  23. canTargetCondition: (cardSource) => true,
  24. canTargetCondition_ByPreSelecetedList: null,
  25. canEndSelectCondition: null,
  26. maxCount: 1,
  27. canNoSelect: false,
  28. canEndNotMax: false,
  29. isShowOpponent: true,
  30. selectCardCoroutine: null,
  31. afterSelectCardCoroutine: null,
  32. mode: SelectHandEffect.Mode.Discard,
  33. cardEffect: activateClass);
  34. selectHandEffect.SetUpCustomMessage("Select 1 Card to trash.", "The opponent is selecting 1 card to trash from their hand.");
  35. yield return StartCoroutine(selectHandEffect.Activate());
  36. }
  37. #endregion
  38. bool discarded = false;
  39. #region Opponent Trash 1 Card
  40. if (card.Owner.Enemy.HandCards.Count >= 1)
  41. {
  42. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  43. selectHandEffect.SetUp(
  44. selectPlayer: card.Owner.Enemy,
  45. canTargetCondition: (cardSource) => true,
  46. canTargetCondition_ByPreSelecetedList: null,
  47. canEndSelectCondition: null,
  48. maxCount: 1,
  49. canNoSelect: true,
  50. canEndNotMax: false,
  51. isShowOpponent: true,
  52. selectCardCoroutine: null,
  53. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  54. mode: SelectHandEffect.Mode.Discard,
  55. cardEffect: activateClass);
  56. selectHandEffect.SetUpCustomMessage("Select 1 Card to trash. If you don't you will trash 2 cards from deck.", "The opponent is selecting 1 card to trash from their hand.");
  57. yield return StartCoroutine(selectHandEffect.Activate());
  58. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  59. {
  60. if (cardSources.Count >= 1)
  61. {
  62. discarded = true;
  63. yield return null;
  64. }
  65. }
  66. }
  67. #endregion
  68. #region Mill 2
  69. if (!discarded)
  70. {
  71. yield return ContinuousController.instance.StartCoroutine(new IAddTrashCardsFromLibraryTop(
  72. addTrashCount: 2,
  73. player: card.Owner.Enemy,
  74. cardEffect: activateClass).AddTrashCardsFromLibraryTop());
  75. }
  76. #endregion
  77. }
  78. #endregion
  79. #region When Moving
  80. if (timing == EffectTiming.OnMove)
  81. {
  82. ActivateClass activateClass = new ActivateClass();
  83. activateClass.SetUpICardEffect(SharedEffectName, CanUseCondition, card);
  84. activateClass.SetUpActivateClass(SharedCanActivateCondition, hashtable => SharedActivateCoroutine(hashtable, activateClass), -1, false, SharedEffectDescription("When Moving"));
  85. cardEffects.Add(activateClass);
  86. bool PermanentCondition(Permanent permanent)
  87. {
  88. return permanent == card.PermanentOfThisCard();
  89. }
  90. bool CanUseCondition(Hashtable hashtable)
  91. {
  92. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  93. CardEffectCommons.CanTriggerOnMove(hashtable, PermanentCondition);
  94. }
  95. }
  96. #endregion
  97. #region When Digivolving
  98. if (timing == EffectTiming.OnEnterFieldAnyone)
  99. {
  100. ActivateClass activateClass = new ActivateClass();
  101. activateClass.SetUpICardEffect(SharedEffectName, CanUseCondition, card);
  102. activateClass.SetUpActivateClass(SharedCanActivateCondition, hashtable => SharedActivateCoroutine(hashtable, activateClass), -1, false, SharedEffectDescription("When Digivolving"));
  103. cardEffects.Add(activateClass);
  104. bool CanUseCondition(Hashtable hashtable)
  105. {
  106. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  107. CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  108. }
  109. }
  110. #endregion
  111. #region All Turns
  112. if (timing == EffectTiming.None)
  113. {
  114. bool Condition() => card.Owner.Enemy.TrashCards.Count >= 10;
  115. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(false, card, Condition));
  116. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(
  117. changeValue: 2000,
  118. isInheritedEffect: false,
  119. card: card,
  120. condition: Condition));
  121. }
  122. #endregion
  123. #region ESS
  124. if (timing == EffectTiming.OnAllyAttack)
  125. {
  126. ActivateClass activateClass = new ActivateClass();
  127. activateClass.SetUpICardEffect("Trash top card from both players deck", CanUseCondition, card);
  128. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  129. activateClass.SetHashString("BT24_069_TrashTopDeck");
  130. activateClass.SetIsInheritedEffect(true);
  131. cardEffects.Add(activateClass);
  132. string EffectDescription()
  133. {
  134. return "[When Attacking] [Once Per Turn] Trash the top card of both players' decks.";
  135. }
  136. bool CanUseCondition(Hashtable hashtable)
  137. {
  138. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  139. && CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  140. }
  141. bool CanActivateCondition(Hashtable hashtable)
  142. {
  143. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  144. }
  145. IEnumerator ActivateCoroutine(Hashtable hashtable)
  146. {
  147. yield return ContinuousController.instance.StartCoroutine(new IAddTrashCardsFromLibraryTop(
  148. addTrashCount: 1,
  149. player: card.Owner,
  150. cardEffect: activateClass).AddTrashCardsFromLibraryTop());
  151. yield return ContinuousController.instance.StartCoroutine(new IAddTrashCardsFromLibraryTop(
  152. addTrashCount: 1,
  153. player: card.Owner.Enemy,
  154. cardEffect: activateClass).AddTrashCardsFromLibraryTop());
  155. }
  156. }
  157. #endregion
  158. return cardEffects;
  159. }
  160. }
  161. }