EX7_044.cs 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.EX7
  4. {
  5. public class EX7_044 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Alternate Digivolution
  11. if (timing == EffectTiming.None)
  12. {
  13. bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.IsLevel4 && targetPermanent.TopCard.HasText("Three Musketeers");
  16. }
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  18. permanentCondition: PermanentCondition,
  19. digivolutionCost: 3,
  20. ignoreDigivolutionRequirement: false,
  21. card: card,
  22. condition: null)
  23. );
  24. }
  25. #endregion
  26. #region On Play/ When Digivolving Shared
  27. bool CanSelectCardSharedCondition(CardSource cardSource)
  28. {
  29. return cardSource.IsOption &&
  30. cardSource.ContainsTraits("Three Musketeers");
  31. }
  32. bool CanSelectOpponentPermanentSharedCondition(Permanent permanent)
  33. {
  34. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card) &&
  35. (permanent.IsDigimon || permanent.IsTamer) &&
  36. permanent.TopCard.HasPlayCost &&
  37. permanent.TopCard.GetCostItself <= 3;
  38. }
  39. bool CanActivateSharedCondition(Hashtable hashtable)
  40. {
  41. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  42. }
  43. #endregion
  44. #region On Play
  45. if (timing == EffectTiming.OnEnterFieldAnyone)
  46. {
  47. ActivateClass activateClass = new ActivateClass();
  48. activateClass.SetUpICardEffect("Reveal the top 4 cards of deck, then delete opponent's Digimon", CanUseCondition, card);
  49. activateClass.SetUpActivateClass(CanActivateSharedCondition, ActivateCoroutine, -1, false, EffectDescription());
  50. cardEffects.Add(activateClass);
  51. string EffectDescription()
  52. {
  53. return
  54. "[On Play] Reveal the top 4 cards of your deck. Place 1 Option card with the [Three Musketeers] trait among them as this Digimon's bottom digivolution card. Return the rest to the top or bottom of the deck. If this effect placed, delete 1 of your opponent's Digimon or Tamers with a play cost of 3 or less.";
  55. }
  56. bool CanUseCondition(Hashtable hashtable)
  57. {
  58. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  59. }
  60. IEnumerator ActivateCoroutine(Hashtable hashtable)
  61. {
  62. bool cardWasPlaced = false;
  63. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  64. revealCount: 4,
  65. simplifiedSelectCardConditions:
  66. new SimplifiedSelectCardConditionClass[]
  67. {
  68. new(
  69. canTargetCondition: CanSelectCardSharedCondition,
  70. message: "Select 1 Option card with [Three Musketeers] in its traits.",
  71. mode: SelectCardEffect.Mode.Custom,
  72. maxCount: 1,
  73. selectCardCoroutine: SelectCardCoroutine)
  74. },
  75. remainingCardsPlace: RemainingCardsPlace.DeckTopOrBottom,
  76. activateClass: activateClass
  77. ));
  78. IEnumerator SelectCardCoroutine(CardSource cardSource)
  79. {
  80. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  81. {
  82. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard()
  83. .AddDigivolutionCardsBottom(new List<CardSource>() { cardSource }, activateClass));
  84. cardWasPlaced = true;
  85. }
  86. }
  87. if (cardWasPlaced && CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentSharedCondition))
  88. {
  89. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  90. selectPermanentEffect.SetUp(
  91. selectPlayer: card.Owner,
  92. canTargetCondition: CanSelectOpponentPermanentSharedCondition,
  93. canTargetCondition_ByPreSelecetedList: null,
  94. canEndSelectCondition: null,
  95. maxCount: 1,
  96. canNoSelect: false,
  97. canEndNotMax: false,
  98. selectPermanentCoroutine: null,
  99. afterSelectPermanentCoroutine: null,
  100. mode: SelectPermanentEffect.Mode.Destroy,
  101. cardEffect: activateClass);
  102. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  103. }
  104. }
  105. }
  106. #endregion
  107. #region When Digivolving
  108. if (timing == EffectTiming.OnEnterFieldAnyone)
  109. {
  110. ActivateClass activateClass = new ActivateClass();
  111. activateClass.SetUpICardEffect("Reveal the top 4 cards of deck, then delete opponent's Digimon", CanUseCondition, card);
  112. activateClass.SetUpActivateClass(CanActivateSharedCondition, ActivateCoroutine, -1, false, EffectDescription());
  113. cardEffects.Add(activateClass);
  114. string EffectDescription()
  115. {
  116. return
  117. "[When Digivolving] Reveal the top 4 cards of your deck. Place 1 Option card with the [Three Musketeers] trait among them as this Digimon's bottom digivolution card. Return the rest to the top or bottom of the deck. If this effect placed, delete 1 of your opponent's Digimon or Tamers with a play cost of 3 or less.";
  118. }
  119. bool CanUseCondition(Hashtable hashtable)
  120. {
  121. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  122. }
  123. IEnumerator ActivateCoroutine(Hashtable hashtable)
  124. {
  125. bool cardWasPlaced = false;
  126. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  127. revealCount: 4,
  128. simplifiedSelectCardConditions:
  129. new SimplifiedSelectCardConditionClass[]
  130. {
  131. new(
  132. canTargetCondition: CanSelectCardSharedCondition,
  133. message: "Select 1 Option card with [Three Musketeers] in its traits.",
  134. mode: SelectCardEffect.Mode.Custom,
  135. maxCount: 1,
  136. selectCardCoroutine: SelectCardCoroutine)
  137. },
  138. remainingCardsPlace: RemainingCardsPlace.DeckTopOrBottom,
  139. activateClass: activateClass
  140. ));
  141. IEnumerator SelectCardCoroutine(CardSource cardSource)
  142. {
  143. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  144. {
  145. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard()
  146. .AddDigivolutionCardsBottom(new List<CardSource>() { cardSource }, activateClass));
  147. cardWasPlaced = true;
  148. }
  149. }
  150. if (cardWasPlaced && CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentSharedCondition))
  151. {
  152. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  153. selectPermanentEffect.SetUp(
  154. selectPlayer: card.Owner,
  155. canTargetCondition: CanSelectOpponentPermanentSharedCondition,
  156. canTargetCondition_ByPreSelecetedList: null,
  157. canEndSelectCondition: null,
  158. maxCount: 1,
  159. canNoSelect: false,
  160. canEndNotMax: false,
  161. selectPermanentCoroutine: null,
  162. afterSelectPermanentCoroutine: null,
  163. mode: SelectPermanentEffect.Mode.Destroy,
  164. cardEffect: activateClass);
  165. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  166. }
  167. }
  168. }
  169. #endregion
  170. #region Collision - ESS
  171. if (timing == EffectTiming.OnCounterTiming)
  172. {
  173. cardEffects.Add(CardEffectFactory.CollisionSelfStaticEffect(
  174. isInheritedEffect: true,
  175. card: card,
  176. condition: null));
  177. }
  178. #endregion
  179. return cardEffects;
  180. }
  181. }
  182. }