EX11_071.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. // Cool Boy
  6. namespace DCGO.CardEffects.EX11
  7. {
  8. public class EX11_071 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region On Play
  14. if (timing == EffectTiming.OnEnterFieldAnyone)
  15. {
  16. ActivateClass activateClass = new ActivateClass();
  17. activateClass.SetUpICardEffect("Reveal 3, add 1 [Omekamon] or [Omnimon (X Antibody)] and 1 [Royal Knight] or [LIBERATOR] trait card, bot deck the rest.", CanUseCondition, card);
  18. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  19. cardEffects.Add(activateClass);
  20. string EffectDiscription()
  21. {
  22. return "[On Play] Reveal the top 3 cards of your deck. Add 1 [Omekamon] or [Omnimon (X Antibody)] and 1 [Royal Knight] or [LIBERATOR] trait card among them to the hand. Return the rest to the bottom of the deck.";
  23. }
  24. bool CanUseCondition(Hashtable hashtable)
  25. {
  26. return CardEffectCommons.CanTriggerOnPlay(hashtable, card)
  27. && CardEffectCommons.IsExistOnBattleArea(card);
  28. }
  29. bool CanActivateCondition(Hashtable hashtable)
  30. {
  31. return CardEffectCommons.IsExistOnBattleArea(card)
  32. && card.Owner.LibraryCards.Count >= 1;
  33. }
  34. bool CanSelectCardCondition(CardSource cardSource)
  35. {
  36. return cardSource.EqualsCardName("Omekamon")
  37. || cardSource.EqualsCardName("Omnimon (X Antibody)");
  38. }
  39. bool CanSelectCardCondition1(CardSource cardSource)
  40. {
  41. return cardSource.EqualsTraits("Royal Knight")
  42. || cardSource.EqualsTraits("LIBERATOR");
  43. }
  44. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  45. {
  46. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  47. revealCount: 3,
  48. simplifiedSelectCardConditions:
  49. new SimplifiedSelectCardConditionClass[]
  50. {
  51. new SimplifiedSelectCardConditionClass(
  52. canTargetCondition:CanSelectCardCondition,
  53. message: "Select 1 [Omekamon] or [Omnimon (X Antibody)].",
  54. mode: SelectCardEffect.Mode.AddHand,
  55. maxCount: 1,
  56. selectCardCoroutine: null),
  57. new SimplifiedSelectCardConditionClass(
  58. canTargetCondition:CanSelectCardCondition1,
  59. message: "Select 1 [Royal Knight] or [LIBERATOR] trait card.",
  60. mode: SelectCardEffect.Mode.AddHand,
  61. maxCount: 1,
  62. selectCardCoroutine: null),
  63. },
  64. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  65. activateClass: activateClass
  66. ));
  67. }
  68. }
  69. #endregion
  70. #region Main
  71. if (timing == EffectTiming.OnDeclaration)
  72. {
  73. ActivateClass activateClass = new ActivateClass();
  74. activateClass.SetUpICardEffect("Return tamer to play 4 cost or higher [Royal Knight] or [LIBERATOR] trait card for 2 less", CanUseCondition, card);
  75. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, true, EffectDiscription());
  76. cardEffects.Add(activateClass);
  77. string EffectDiscription()
  78. {
  79. return "[Main] By returning this Tamer to the bottom of the deck, you may play 1 play cost 4 or higher [Royal Knight] or [LIBERATOR] trait card from your hand with the play cost reduced by 2.";
  80. }
  81. bool CanUseCondition(Hashtable hashtable)
  82. {
  83. return CardEffectCommons.IsExistOnBattleArea(card);
  84. }
  85. bool CanSelectCardCondition(CardSource cardSource)
  86. {
  87. return (cardSource.EqualsTraits("Royal Knight")
  88. || cardSource.EqualsTraits("LIBERATOR"))
  89. && cardSource.GetCostItself >= 4
  90. && CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: true, cardEffect: activateClass, fixedCost: cardSource.GetCostItself - 2);
  91. }
  92. IEnumerator ActivateCoroutine(Hashtable hashtable)
  93. {
  94. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeckBouncePeremanentAndProcessAccordingToResult(
  95. targetPermanents: new List<Permanent>() { card.PermanentOfThisCard() },
  96. activateClass: activateClass,
  97. successProcess: SuccessProcess(),
  98. failureProcess: null));
  99. IEnumerator SuccessProcess()
  100. {
  101. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition))
  102. {
  103. List<CardSource> selectedCards = new List<CardSource>();
  104. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  105. selectHandEffect.SetUp(
  106. selectPlayer: card.Owner,
  107. canTargetCondition: CanSelectCardCondition,
  108. canTargetCondition_ByPreSelecetedList: null,
  109. canEndSelectCondition: null,
  110. maxCount: 1,
  111. canNoSelect: true,
  112. canEndNotMax: false,
  113. isShowOpponent: true,
  114. selectCardCoroutine: SelectCardCoroutine,
  115. afterSelectCardCoroutine: null,
  116. mode: SelectHandEffect.Mode.Custom,
  117. cardEffect: activateClass);
  118. selectHandEffect.SetUpCustomMessage(
  119. "Select 1 card to play.",
  120. "The opponent is selecting 1 card to play.");
  121. yield return StartCoroutine(selectHandEffect.Activate());
  122. IEnumerator SelectCardCoroutine(CardSource cardSource)
  123. {
  124. selectedCards.Add(cardSource);
  125. yield return null;
  126. }
  127. #region reduce play cost
  128. ChangeCostClass changeCostClass = new ChangeCostClass();
  129. changeCostClass.SetUpICardEffect("Play Cost -2", CanUseCondition1, card);
  130. changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
  131. Func<EffectTiming, ICardEffect> getCardEffect = GetCardEffect;
  132. card.Owner.UntilCalculateFixedCostEffect.Add(getCardEffect);
  133. ICardEffect GetCardEffect(EffectTiming _timing)
  134. {
  135. if (_timing == EffectTiming.None)
  136. {
  137. return changeCostClass;
  138. }
  139. return null;
  140. }
  141. bool CanUseCondition1(Hashtable hashtable) => true;
  142. int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
  143. {
  144. if (CardSourceCondition(cardSource)
  145. && RootCondition(root)
  146. && PermanentsCondition(targetPermanents))
  147. {
  148. Cost -= 2;
  149. }
  150. return Cost;
  151. }
  152. bool PermanentsCondition(List<Permanent> targetPermanents)
  153. {
  154. return targetPermanents == null
  155. || targetPermanents.Count((targetPermanent) => targetPermanent != null) == 0;
  156. }
  157. bool CardSourceCondition(CardSource cardSource)
  158. {
  159. return cardSource != null
  160. && cardSource.Owner == card.Owner
  161. && (cardSource.EqualsTraits("Royal Knight")
  162. || cardSource.EqualsTraits("LIBERATOR"));
  163. }
  164. bool RootCondition(SelectCardEffect.Root root) => true;
  165. bool isUpDown() => true;
  166. #endregion
  167. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  168. cardSources: selectedCards,
  169. activateClass: activateClass,
  170. payCost: true,
  171. isTapped: false,
  172. root: SelectCardEffect.Root.Hand,
  173. activateETB: true
  174. ));
  175. #region release reducing play cost
  176. card.Owner.UntilCalculateFixedCostEffect.Remove(getCardEffect);
  177. #endregion
  178. }
  179. }
  180. }
  181. }
  182. #endregion
  183. #region Security Effect
  184. if (timing == EffectTiming.SecuritySkill)
  185. {
  186. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  187. }
  188. #endregion
  189. return cardEffects;
  190. }
  191. }
  192. }