using System.Collections; using System.Collections.Generic; namespace DCGO.CardEffects.BT18 { public class BT18_057 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Your Turn if (timing == EffectTiming.BeforePayCost) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Digivolution Cost -1", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription()); activateClass.SetHashString("ReduceDigivolutionCost-1_BT18_57"); cardEffects.Add(activateClass); string EffectDescription() { return "[Your Turn] (Once Per Turn) When this Digimon or any of your Tamers would digivolve into a multicolored Digimon that is black or yellow, reduce the digivolution cost by 1."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.IsOwnerTurn(card) && CardEffectCommons.CanTriggerWhenPermanentWouldDigivolve(hashtable, DigivolveFromPermanentCondition, DigivolveToCardCondition); } bool DigivolveFromPermanentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card) && (permanent == card.PermanentOfThisCard() || permanent.IsTamer); } bool DigivolveToCardCondition(CardSource cardSource) { return cardSource.IsDigimon && cardSource.CardColors.Count > 1 && (cardSource.CardColors.Contains(CardColor.Black) || cardSource.CardColors.Contains(CardColor.Yellow)); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card); } IEnumerator ActivateCoroutine(Hashtable hashtable) { ContinuousController.instance.PlaySE(GManager.instance.GetComponent().BuffSE); ChangeCostClass changeCostClass = new ChangeCostClass(); changeCostClass.SetUpICardEffect("Digivolution Cost -1", CanUseReduceCondition, card); changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: IsUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true); card.Owner.UntilCalculateFixedCostEffect.Add(_ => changeCostClass); yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ShowReducedCost(hashtable)); bool CanUseReduceCondition(Hashtable reduceHashtable) { return true; } int ChangeCost(CardSource cardSource, int cost, SelectCardEffect.Root root, List targetPermanents) { if (CardSourceCondition(cardSource) && RootCondition(root) && PermanentsCondition(targetPermanents)) { cost -= 1; } return cost; } bool PermanentsCondition(List targetPermanents) { return targetPermanents != null && targetPermanents.Some(PermanentCondition); } bool PermanentCondition(Permanent targetPermanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(targetPermanent, card); } bool CardSourceCondition(CardSource cardSource) { return cardSource.Owner == card.Owner; } bool RootCondition(SelectCardEffect.Root root) { return true; } bool IsUpDown() { return true; } } } #endregion #region Blocker - ESS if (timing == EffectTiming.None) { cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect( isInheritedEffect: true, card: card, condition: null)); } #endregion return cardEffects; } } }