EX9_035.cs 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // Palmon
  4. namespace DCGO.CardEffects.EX9
  5. {
  6. public class EX9_035 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternate Digivolution Requirement
  12. if (timing == EffectTiming.None)
  13. {
  14. static bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.IsLevel2 &&
  17. targetPermanent.TopCard.EqualsTraits("DM");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  20. permanentCondition: PermanentCondition,
  21. digivolutionCost: 0,
  22. ignoreDigivolutionRequirement: false,
  23. card: card,
  24. condition: null));
  25. }
  26. #endregion
  27. #region On Play
  28. if (timing == EffectTiming.OnEnterFieldAnyone)
  29. {
  30. ActivateClass activateClass = new ActivateClass();
  31. activateClass.SetUpICardEffect("Reveal 3, Add 1 [DM] trait, and place 1 [Ver.4] trait under a [DM] digimon",
  32. CanUseCondition, card);
  33. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  34. cardEffects.Add(activateClass);
  35. string EffectDescription() =>
  36. "[On Play] Reveal the top 3 cards of your deck. Among them, add 1 card with the [DM] trait to the hand and place 1 card with the [Ver.4] trait face down as the bottom digivolution card of any of your Digimon with the [DM] trait . Return the rest to the bottom of the deck.";
  37. bool CanUseCondition(Hashtable hashtable)
  38. {
  39. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  40. }
  41. bool CanActivateCondition(Hashtable hashtable)
  42. {
  43. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  44. card.Owner.LibraryCards.Count > 0;
  45. }
  46. bool HasDmTrait(CardSource source)
  47. {
  48. return source.EqualsTraits("DM");
  49. }
  50. bool HasVer1Trait(CardSource source)
  51. {
  52. return source.EqualsTraits("Ver.4");
  53. }
  54. bool CanSelectPermanentCondition(Permanent permanent)
  55. {
  56. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  57. permanent.TopCard.EqualsTraits("DM");
  58. }
  59. IEnumerator ActivateCoroutine(Hashtable hashtable)
  60. {
  61. CardSource selectedCard = null;
  62. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  63. revealCount: 3,
  64. simplifiedSelectCardConditions:
  65. new SimplifiedSelectCardConditionClass[]
  66. {
  67. new(
  68. canTargetCondition: HasDmTrait,
  69. message: "Select 1 [DM] card.",
  70. mode: SelectCardEffect.Mode.AddHand,
  71. maxCount: 1,
  72. selectCardCoroutine: null),
  73. new(
  74. canTargetCondition: HasVer1Trait,
  75. message: "Select 1 [Ver.4] card.",
  76. mode: SelectCardEffect.Mode.Custom,
  77. maxCount: 1,
  78. selectCardCoroutine: SelectCardCoroutine),
  79. },
  80. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  81. activateClass: activateClass
  82. ));
  83. IEnumerator SelectCardCoroutine(CardSource cardSource)
  84. {
  85. selectedCard = cardSource;
  86. yield return null;
  87. }
  88. if (selectedCard && CardEffectCommons.HasMatchConditionOwnersPermanent(card, CanSelectPermanentCondition))
  89. {
  90. Permanent selectedPermanent = null;
  91. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  92. selectPermanentEffect.SetUp(
  93. selectPlayer: card.Owner,
  94. canTargetCondition: CanSelectPermanentCondition,
  95. canTargetCondition_ByPreSelecetedList: null,
  96. canEndSelectCondition: null,
  97. maxCount: 1,
  98. canNoSelect: false,
  99. canEndNotMax: false,
  100. selectPermanentCoroutine: SelectPermanentCoroutine,
  101. afterSelectPermanentCoroutine: null,
  102. mode: SelectPermanentEffect.Mode.Custom,
  103. cardEffect: activateClass);
  104. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  105. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  106. {
  107. selectedPermanent = permanent;
  108. yield return null;
  109. }
  110. if (selectedPermanent != null)
  111. {
  112. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddExecutingCard(selectedCard));
  113. yield return ContinuousController.instance.StartCoroutine(
  114. selectedPermanent.AddDigivolutionCardsBottom(new List<CardSource>() { selectedCard }, activateClass, isFacedown: true));
  115. }
  116. }
  117. }
  118. }
  119. #endregion
  120. #region When Attacking - ESS
  121. if (timing == EffectTiming.OnAllyAttack)
  122. {
  123. ActivateClass activateClass = new ActivateClass();
  124. activateClass.SetUpICardEffect("Suspend 1 of your opponent's Digimon", CanUseCondition, card);
  125. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  126. activateClass.SetHashString("Suspend_EX9_035");
  127. activateClass.SetIsInheritedEffect(true);
  128. cardEffects.Add(activateClass);
  129. string EffectDescription() =>
  130. "[When Attacking] [Once Per Turn] Suspend 1 of your opponent's Digimon.";
  131. bool CanUseCondition(Hashtable hashtable)
  132. {
  133. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  134. }
  135. bool IsOpponentsDigimon(Permanent permanent)
  136. {
  137. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  138. }
  139. bool CanActivateCondition(Hashtable hashtable)
  140. {
  141. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  142. }
  143. IEnumerator ActivateCoroutine(Hashtable hashtable)
  144. {
  145. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, IsOpponentsDigimon))
  146. {
  147. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  148. selectPermanentEffect.SetUp(
  149. selectPlayer: card.Owner,
  150. canTargetCondition: IsOpponentsDigimon,
  151. canTargetCondition_ByPreSelecetedList: null,
  152. canEndSelectCondition: null,
  153. maxCount: 1,
  154. canNoSelect: false,
  155. canEndNotMax: false,
  156. selectPermanentCoroutine: null,
  157. afterSelectPermanentCoroutine: null,
  158. mode: SelectPermanentEffect.Mode.Tap,
  159. cardEffect: activateClass);
  160. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to suspend.",
  161. "The opponent is selecting 1 Digimon to suspend.");
  162. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  163. }
  164. }
  165. }
  166. #endregion
  167. return cardEffects;
  168. }
  169. }
  170. }