using System.Collections; using System.Collections.Generic; using System; using UnityEngine; namespace DCGO.CardEffects.BT20 { public class BT20_101 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Alternate Digivolution Requirement if (timing == EffectTiming.None) { bool PermanentCondition(Permanent targetPermanent) { return targetPermanent.TopCard.HasPlayCost && targetPermanent.TopCard.GetCostItself >= 10 && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.IsLevel6 && targetPermanent.TopCard.EqualsTraits("Vortex Warriors"); } cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect( permanentCondition: PermanentCondition, digivolutionCost: 1, ignoreDigivolutionRequirement: false, card: card, condition: null)); } #endregion #region Blast Digivolve if (timing == EffectTiming.OnCounterTiming) { cardEffects.Add(CardEffectFactory.BlastDigivolveEffect(card: card, condition: null)); } #endregion #region Piercing/Vortex/Blocker if (timing == EffectTiming.OnDetermineDoSecurityCheck) { cardEffects.Add(CardEffectFactory.PierceSelfEffect(isInheritedEffect: false, card: card, condition: null)); } if (timing == EffectTiming.OnEndTurn) { cardEffects.Add(CardEffectFactory.VortexSelfEffect(isInheritedEffect: false, card: card, condition: null)); } if (timing == EffectTiming.None) { cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null)); } #endregion #region All Turns if (timing == EffectTiming.OnTappedAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Unsuspend this Digimon", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription()); activateClass.SetHashString("Unsuspend_BT20-101"); cardEffects.Add(activateClass); string EffectDiscription() { return "[All Turns] [Once Per Turn] When any Digimon suspend, this Digimon may unsuspend."; } bool PermanentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent); } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, PermanentCondition) ; } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card); } IEnumerator ActivateCoroutine(Hashtable hashtable) { yield return ContinuousController.instance.StartCoroutine( new IUnsuspendPermanents(new List() { card.PermanentOfThisCard() }, activateClass).Unsuspend()); } } #endregion #region On Play if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Suspend 1 Digimon, Then return 1 to bottom of deck for every 2 suspended", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[On Play] You may suspend 1 Digimon. Then, for every 2 suspended Digimon, you may return 1 of your opponent's suspended Digimon to the bottom of the deck."; } bool DigimonCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent); } bool SuspendedDigimon(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent) && permanent.IsSuspended; } bool OpponentsSuspendedDigimon(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) && permanent.IsSuspended; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOnPlay(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card); } IEnumerator ActivateCoroutine(Hashtable hashtable) { if (CardEffectCommons.HasMatchConditionPermanent(DigimonCondition)) { SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: DigimonCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: true, canEndNotMax: false, selectPermanentCoroutine: null, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Tap, cardEffect: activateClass); selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to suspend.", "The opponent is selecting 1 Digimon to suspend."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); } if (CardEffectCommons.MatchConditionPermanentCount(SuspendedDigimon) >= 2) { int maxCount = Math.Min(CardEffectCommons.MatchConditionPermanentCount(OpponentsSuspendedDigimon), Mathf.FloorToInt(CardEffectCommons.MatchConditionPermanentCount(SuspendedDigimon) / 2)); SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: OpponentsSuspendedDigimon, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: maxCount, canNoSelect: true, canEndNotMax: false, selectPermanentCoroutine: null, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.PutLibraryBottom, cardEffect: activateClass); selectPermanentEffect.SetUpCustomMessage($"Select {maxCount} Digimon to bottom deck.", $"The opponent is selecting {maxCount} Digimon to bottom deck."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); } } } #endregion #region When Digivolving if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Suspend 1 Digimon, Then return 1 to bottom of deck for every 2 suspended", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[When Digivolving] You may suspend 1 Digimon. Then, for every 2 suspended Digimon, you may return 1 of your opponent's suspended Digimon to the bottom of the deck."; } bool DigimonCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent); } bool SuspendedDigimon(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent) && permanent.IsSuspended; } bool OpponentsSuspendedDigimon(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) && permanent.IsSuspended; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card); } IEnumerator ActivateCoroutine(Hashtable hashtable) { if (CardEffectCommons.HasMatchConditionPermanent(DigimonCondition)) { SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: DigimonCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: true, canEndNotMax: false, selectPermanentCoroutine: null, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Tap, cardEffect: activateClass); selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to suspend.", "The opponent is selecting 1 Digimon to suspend."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); } if (CardEffectCommons.MatchConditionPermanentCount(SuspendedDigimon) >= 2) { int maxCount = Math.Min(CardEffectCommons.MatchConditionPermanentCount(OpponentsSuspendedDigimon), Mathf.FloorToInt(CardEffectCommons.MatchConditionPermanentCount(SuspendedDigimon)/2)); SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: OpponentsSuspendedDigimon, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: maxCount, canNoSelect: true, canEndNotMax: false, selectPermanentCoroutine: null, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.PutLibraryBottom, cardEffect: activateClass); selectPermanentEffect.SetUpCustomMessage($"Select {maxCount} Digimon to bottom deck.", $"The opponent is selecting {maxCount} Digimon to bottom deck."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); } } } #endregion return cardEffects; } } }