using System.Collections; using System.Collections.Generic; using UnityEngine; using System.Linq; using Photon; using System; using Photon.Pun; public class BT5_092 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Play 1 [Agumon] or [Gabumon] from hand", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[On Play] You may play 1 [Agumon] or [Gabumon] from your hand without paying its memory cost."; } bool CanSelectCardCondition(CardSource cardSource) { if (cardSource != null) { if (cardSource.CardNames.Contains("Agumon") || cardSource.CardNames.Contains("Gabumon")) { if (cardSource.Owner == card.Owner) { if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass)) { return true; } } } } return false; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOnPlay(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { if (isExistOnField(card)) { if (card.Owner.HandCards.Count >= 1) { return true; } } return false; } IEnumerator ActivateCoroutine(Hashtable _hashtable) { if (isExistOnField(card)) { if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1) { List selectedCards = new List(); int maxCount = 1; SelectHandEffect selectHandEffect = GManager.instance.GetComponent(); selectHandEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectCardCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: maxCount, canNoSelect: true, canEndNotMax: false, isShowOpponent: true, selectCardCoroutine: SelectCardCoroutine, afterSelectCardCoroutine: null, mode: SelectHandEffect.Mode.Custom, cardEffect: activateClass); selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play."); selectHandEffect.SetUpCustomMessage_ShowCard("Played Card"); yield return StartCoroutine(selectHandEffect.Activate()); IEnumerator SelectCardCoroutine(CardSource cardSource) { selectedCards.Add(cardSource); yield return null; } yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true)); } } } } if (timing == EffectTiming.BeforePayCost) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Digivolution Cost -1", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription()); activateClass.SetHashString("Digisorption-1_BT5_092"); cardEffects.Add(activateClass); string EffectDiscription() { return "[Main] When digivolving one of your Digimon into a Digimon card in your hand with [Garurumon], [Omnimon], or [Greymon] (other than [DoruGreymon], [BurningGreymon], or [DexDoruGreymon]), in its name, you may suspend this Tamer to reduce the memory cost of the digivolution by 1."; } bool PermanentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card); } bool CardCondition(CardSource cardSource) { if (cardSource.IsDigimon) { if (cardSource.HasGarurumonName || cardSource.ContainsCardName("Omnimon") || cardSource.HasGreymonName) { if (CardEffectCommons.IsExistOnHand(cardSource)) { return true; } } } return false; } bool CanUseCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleArea(card)) { if (GManager.instance.turnStateMachine.gameContext.TurnPhase == GameContext.phase.Main) { if (CardEffectCommons.CanTriggerWhenPermanentWouldDigivolve(hashtable, PermanentCondition, CardCondition)) { return true; } } } return false; } bool CanActivateCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleArea(card)) { if (CardEffectCommons.CanActivateSuspendCostEffect(card)) { return true; } } return false; } IEnumerator ActivateCoroutine(Hashtable _hashtable) { if (isExistOnField(card)) { if (!card.PermanentOfThisCard().IsSuspended && card.PermanentOfThisCard().CanSuspend) { Hashtable hashtable = new Hashtable(); hashtable.Add("CardEffect", activateClass); yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List() { card.PermanentOfThisCard() }, hashtable).Tap()); ContinuousController.instance.PlaySE(GManager.instance.GetComponent().BuffSE); ChangeCostClass changeCostClass = new ChangeCostClass(); changeCostClass.SetUpICardEffect("Digivolution Cost -1", CanUseCondition1, 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 CanUseCondition1(Hashtable hashtable) { return true; } int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List targetPermanents) { if (CardSourceCondition(cardSource)) { if (RootCondition(root)) { if (PermanentsCondition(targetPermanents)) { Cost -= 1; } } } return Cost; } bool PermanentsCondition(List targetPermanents) { if (targetPermanents != null) { if (targetPermanents.Count(PermanentCondition) >= 1) { return true; } } return false; } bool PermanentCondition(Permanent targetPermanent) { if(targetPermanent != null) { if (targetPermanent.TopCard != null) { if (targetPermanent.TopCard.Owner == card.Owner) { if (targetPermanent.TopCard.Owner.GetBattleAreaPermanents().Contains(targetPermanent)) { return true; } } } } return false; } bool CardSourceCondition(CardSource cardSource) { if (cardSource != null) { if (cardSource.Owner == card.Owner) { return true; } } return false; } bool RootCondition(SelectCardEffect.Root root) { return true; } bool isUpDown() { return true; } } } } } if (timing == EffectTiming.SecuritySkill) { cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card)); } return cardEffects; } }