| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- using System.Collections;
- using System.Collections.Generic;
- //ST20 Tai & Izzy
- namespace DCGO.CardEffects.ST20
- {
- public class ST20_13 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- #region Cost reduction
- if (timing == EffectTiming.BeforePayCost)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Reduce Play Cost", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
- cardEffects.Add(activateClass);
- string EffectDiscription()
- {
- return "[Your Turn] When any Digimon cards with the [ADVENTURE] trait would be played from your hand, by suspending this Tamer, reduce the play cost by 1.";
- }
- bool PlayCardCondition(CardSource cardSource)
- {
- if (CardEffectCommons.IsExistOnHand(cardSource))
- {
- return cardSource.EqualsTraits("ADVENTURE");
- }
- return false;
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- if (CardEffectCommons.IsExistOnBattleArea(card))
- {
- return CardEffectCommons.CanTriggerWhenPermanentWouldPlay(hashtable, PlayCardCondition);
- }
- return false;
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- if (CardEffectCommons.IsOwnerTurn(card))
- {
- if (CardEffectCommons.IsExistOnBattleArea(card))
- {
- if (CardEffectCommons.CanActivateSuspendCostEffect(card))
- {
- return true;
- }
- }
- }
- return false;
- }
- IEnumerator ActivateCoroutine(Hashtable _hashtable)
- {
- if (CardEffectCommons.IsExistOnBattleArea(card))
- {
- if (!card.PermanentOfThisCard().IsSuspended && card.PermanentOfThisCard().CanSuspend)
- {
- yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(
- new List<Permanent>() { card.PermanentOfThisCard() },
- CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
- if (card.PermanentOfThisCard().IsSuspended)
- {
- ContinuousController.instance.PlaySE(GManager.instance.GetComponent<Effects>().BuffSE);
- ChangeCostClass changeCostClass = new ChangeCostClass();
- changeCostClass.SetUpICardEffect("Cost -1", 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<Permanent> targetPermanents)
- {
- if (CardSourceCondition(cardSource))
- {
- if (RootCondition(root))
- {
- if (PermanentsCondition(targetPermanents))
- {
- Cost -= 1;
- }
- }
- }
- return Cost;
- }
- bool PermanentsCondition(List<Permanent> targetPermanents)
- {
- return targetPermanents != null;
- }
- bool CardSourceCondition(CardSource cardSource)
- {
- if (cardSource != null)
- {
- return cardSource.Owner == card.Owner;
- }
- return false;
- }
- bool RootCondition(SelectCardEffect.Root root)
- {
- return true;
- }
- bool isUpDown()
- {
- return true;
- }
- }
- }
- }
- }
- }
- #endregion
- #region Blocker gain
- if (timing == EffectTiming.None)
- {
- bool CanUseCondition()
- {
- return CardEffectCommons.IsExistOnBattleArea(card) && CardEffectCommons.IsOpponentTurn(card);
- }
- bool PermanentCondition(Permanent permanent)
- {
- if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
- {
- if (permanent.TopCard.EqualsTraits("ADVENTURE"))
- {
- return true;
- }
- }
- return false;
- }
- cardEffects.Add(CardEffectFactory.BlockerStaticEffect(
- permanentCondition: PermanentCondition,
- isInheritedEffect: false,
- card: card,
- condition: CanUseCondition));
- }
- #endregion
- if (timing == EffectTiming.SecuritySkill)
- {
- cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
- }
- return cardEffects;
- }
- }
- }
|