EX10_050.cs 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Baalmon
  5. namespace DCGO.CardEffects.EX10
  6. {
  7. public class EX10_050 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternate Digivolution Requirement
  13. if (timing == EffectTiming.None)
  14. {
  15. static bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.IsLevel4 && targetPermanent.TopCard.HasWizardTraits;
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. #endregion
  22. #region OP/WD Shared
  23. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  24. {
  25. yield return ContinuousController.instance.StartCoroutine(new IAddTrashCardsFromLibraryTop(
  26. addTrashCount: 3,
  27. player: card.Owner,
  28. cardEffect: activateClass).AddTrashCardsFromLibraryTop());
  29. if (card.Owner.TrashCards.Count >= 5)
  30. {
  31. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainReboot(
  32. targetPermanent: card.PermanentOfThisCard(),
  33. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  34. activateClass: activateClass));
  35. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBlocker(
  36. targetPermanent: card.PermanentOfThisCard(),
  37. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  38. activateClass: activateClass));
  39. }
  40. }
  41. #endregion
  42. #region On Play
  43. if (timing == EffectTiming.OnEnterFieldAnyone)
  44. {
  45. ActivateClass activateClass = new ActivateClass();
  46. activateClass.SetUpICardEffect("Trash top 3 cards of deck, then if you have 5 or more in trash, gain Reboot and Blocker until opponent turn ends", CanUseCondition, card);
  47. activateClass.SetUpActivateClass(CanActivateCondition, hashtable => SharedActivateCoroutine(hashtable, activateClass), -1, false, EffectDiscription());
  48. cardEffects.Add(activateClass);
  49. string EffectDiscription()
  50. {
  51. return "[On Play] Trash the top 3 cards of your deck. Then, if you have 5 or more cards in your trash, this Digimon gains <Reboot> (Unsuspend this Digimon during your opponent's unsuspend phase.) and <Blocker> (At blocker timing, by suspending this Digimon, it becomes the attack target.) until your opponent's turn ends.";
  52. }
  53. bool CanUseCondition(Hashtable hashtable)
  54. {
  55. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  56. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  57. }
  58. bool CanActivateCondition(Hashtable hashtable)
  59. {
  60. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  61. }
  62. }
  63. #endregion
  64. #region When Digivolving
  65. if (timing == EffectTiming.OnEnterFieldAnyone)
  66. {
  67. ActivateClass activateClass = new ActivateClass();
  68. activateClass.SetUpICardEffect("Trash top 3 cards of deck, then if you have 5 or more in trash, gain Reboot and Blocker until opponent turn ends", CanUseCondition, card);
  69. activateClass.SetUpActivateClass(CanActivateCondition, hashtable => SharedActivateCoroutine(hashtable, activateClass), -1, false, EffectDiscription());
  70. cardEffects.Add(activateClass);
  71. string EffectDiscription()
  72. {
  73. return "[When Digivolving] Trash the top 3 cards of your deck. Then, if you have 5 or more cards in your trash, this Digimon gains <Reboot> (Unsuspend this Digimon during your opponent's unsuspend phase.) and <Blocker> (At blocker timing, by suspending this Digimon, it becomes the attack target.) until your opponent's turn ends.";
  74. }
  75. bool CanUseCondition(Hashtable hashtable)
  76. {
  77. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  78. && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  79. }
  80. bool CanActivateCondition(Hashtable hashtable)
  81. {
  82. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  83. }
  84. }
  85. #endregion
  86. #region On Deletion
  87. if (timing == EffectTiming.OnDestroyedAnyone)
  88. {
  89. ActivateClass activateClass = new ActivateClass();
  90. activateClass.SetUpICardEffect("Play 1 [Beelzemon] from trash", CanUseCondition, card);
  91. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  92. cardEffects.Add(activateClass);
  93. string EffectDiscription()
  94. {
  95. return "[On Deletion] If you have 10 or more cards in your trash, you may play 1 [Beelzemon] from your trash without paying the cost.";
  96. }
  97. bool CanUseCondition(Hashtable hashtable)
  98. {
  99. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  100. }
  101. bool CanActivateCondition(Hashtable hashtable)
  102. {
  103. return CardEffectCommons.CanActivateOnDeletion(card, activateClass)
  104. && card.Owner.TrashCards.Count >= 10
  105. && CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, IsBeelzemon);
  106. }
  107. bool IsBeelzemon(CardSource cardSource)
  108. {
  109. return cardSource.IsDigimon
  110. && cardSource.EqualsCardName("Beelzemon")
  111. && CardEffectCommons.CanPlayAsNewPermanent(cardSource, false, activateClass, SelectCardEffect.Root.Trash);
  112. }
  113. IEnumerator ActivateCoroutine(Hashtable hashtable)
  114. {
  115. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, IsBeelzemon))
  116. {
  117. CardSource selectedCard = null;
  118. #region Select 1 Beelzemon from Trash
  119. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInTrash(card, IsBeelzemon));
  120. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  121. selectCardEffect.SetUp(
  122. canTargetCondition: IsBeelzemon,
  123. canTargetCondition_ByPreSelecetedList: null,
  124. canEndSelectCondition: null,
  125. canNoSelect: () => true,
  126. selectCardCoroutine: SelectCardCoroutine,
  127. afterSelectCardCoroutine: null,
  128. message: "Select 1 card to play.",
  129. maxCount: maxCount,
  130. canEndNotMax: false,
  131. isShowOpponent: true,
  132. mode: SelectCardEffect.Mode.Custom,
  133. root: SelectCardEffect.Root.Trash,
  134. customRootCardList: null,
  135. canLookReverseCard: true,
  136. selectPlayer: card.Owner,
  137. cardEffect: activateClass);
  138. IEnumerator SelectCardCoroutine(CardSource cardSource)
  139. {
  140. selectedCard = cardSource;
  141. yield return null;
  142. }
  143. selectCardEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  144. selectCardEffect.SetUpCustomMessage_ShowCard("Selected Card");
  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: true));
  154. }
  155. }
  156. }
  157. #endregion
  158. #region ESS
  159. if (timing == EffectTiming.None)
  160. {
  161. bool Condition()
  162. {
  163. return CardEffectCommons.IsExistOnBattleArea(card);
  164. }
  165. int GetDPChangeValue()
  166. {
  167. int stacksOf10 = card.Owner.TrashCards.Count / 10;
  168. return stacksOf10 * 1000;
  169. }
  170. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: GetDPChangeValue(), isInheritedEffect: true, card: card, condition: Condition));
  171. }
  172. #endregion
  173. return cardEffects;
  174. }
  175. }
  176. }