using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine; // Yuugo Kamishiro namespace DCGO.CardEffects.BT22 { public class BT22_094 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region On Play if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Reveal top 3, add 1 [CS] card to hand, bottom deck the rest", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[On Play] Reveal the top 3 cards of your deck. Add 1 card with the [CS] trait among them to the hand. Return the rest to the bottom of the deck."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOnPlay(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnField(card); } bool CanSelectCardCondition(CardSource cardSource) { return cardSource.HasCSTraits; } IEnumerator ActivateCoroutine(Hashtable hashtable) { yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect( revealCount: 3, new SimplifiedSelectCardConditionClass[] { new SimplifiedSelectCardConditionClass( canTargetCondition: CanSelectCardCondition, message: "Select 1 [CS] Card", mode: SelectCardEffect.Mode.AddHand, maxCount: 1, selectCardCoroutine: null), }, remainingCardsPlace: RemainingCardsPlace.DeckBottom, activateClass: activateClass )); } } #endregion #region Your Turn #region Before Pay Cost if (timing == EffectTiming.BeforePayCost) { ActivateClass activateClass2 = new ActivateClass(); activateClass2.SetUpICardEffect("Reduce play cost", CanUseCondition2, card); activateClass2.SetUpActivateClass(CanActivateCondition2, ActivateCoroutine2, -1, true, EffectDiscription2()); cardEffects.Add(activateClass2); string EffectDiscription2() { return "[Your Turn] When any of your Digimon or Tamers with the [CS] trait would be played, by returning this Tamer to the bottom of the deck, reduce the play cost by 2."; } bool PlayCardCondition(CardSource cardSource) { return (cardSource.IsDigimon || cardSource.IsTamer) && cardSource.HasCSTraits && cardSource.Owner == card.Owner; } bool CanUseCondition2(Hashtable hashtable) { return CardEffectCommons.CanTriggerWhenPermanentWouldPlay(hashtable, PlayCardCondition) && CardEffectCommons.IsExistOnBattleArea(card); } bool CanActivateCondition2(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleArea(card) && CardEffectCommons.IsOwnerTurn(card); } IEnumerator ActivateCoroutine2(Hashtable _hashtable) { Permanent bounceTargetPermanent = card.PermanentOfThisCard(); if (bounceTargetPermanent != null) { yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeckBouncePeremanentAndProcessAccordingToResult( targetPermanents: new List() { bounceTargetPermanent }, activateClass: activateClass2, successProcess: SuccessProcess(), failureProcess: null)); IEnumerator SuccessProcess() { ContinuousController.instance.PlaySE(GManager.instance.GetComponent().BuffSE); ChangeCostClass changeCostClass = new ChangeCostClass(); changeCostClass.SetUpICardEffect("Cost -2", CanUseChangeCostCondition, card); changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true); card.Owner.UntilCalculateFixedCostEffect.Add((_timing) => changeCostClass); yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ShowReducedCost(_hashtable)); bool CanUseChangeCostCondition(Hashtable hashtable) { return true; } int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List targetPermanents) { if (CardSourceCondition(cardSource) && RootCondition(root) && PermanentsCondition(targetPermanents)) { Cost -= 2; } return Cost; } bool PermanentsCondition(List targetPermanents) { return targetPermanents != null; } bool CardSourceCondition(CardSource cardSource) { if (cardSource != null) { return cardSource.Owner == card.Owner; } return false; } bool RootCondition(SelectCardEffect.Root root) => true; bool isUpDown() => true; } } } } #endregion #region Before Pay Cost (Not Shown) if (timing == EffectTiming.None) { ChangeCostClass changeCostClass = new ChangeCostClass(); changeCostClass.SetUpICardEffect("Play Cost -2", CanUseChangeCostCondition, card); changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => true, isChangePayingCost: () => true); changeCostClass.SetNotShowUI(true); cardEffects.Add(changeCostClass); bool CanUseChangeCostCondition(Hashtable hashtable) { return true; } int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List targetPermanents) { if (CardSourceCondition(cardSource) && RootCondition(root) && PermanentsCondition(targetPermanents)) { Cost -= 2; } return Cost; } bool PermanentsCondition(List targetPermanents) { return targetPermanents != null; } bool CardSourceCondition(CardSource cardSource) { if (cardSource != null) { return cardSource.Owner == card.Owner; } return false; } bool RootCondition(SelectCardEffect.Root root) => true; bool isUpDown() => true; } #endregion #endregion #region Security if (timing == EffectTiming.SecuritySkill) { cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card)); } #endregion return cardEffects; } } }