using System.Collections; using System.Collections.Generic; // Deramon namespace DCGO.CardEffects.BT25 { public class BT25_055 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Alternative Digivolve Condition if (timing == EffectTiming.None) { static bool PermanentCondition(Permanent targetPermanent) { return targetPermanent.TopCard.HasTSTraits; } cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(PermanentCondition, 3, false, card, null, level: 4)); } #endregion #region Shared OP / WD string SharedEffectName = "May suspend 1 Digimon, then if 2 or more suspended, 1 of your Digimon may unsuspend"; CardEffectFactory.ActivateClassesForSharedEffects (ref cardEffects, timing, card, SharedEffectName, SharedActivateCoroutine, SharedEffectDescription, optional: false, isSkippable: true, onPlay: true, whenDigivolving: true); string SharedEffectDescription(string tag) => $"[{tag}] You may suspend 1 Digimon. Then, if there are 2 or more suspended Digimon, 1 of your Digimon may unsuspend."; bool CanSuspendPermanentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent) && !permanent.IsSuspended && permanent.CanSuspend; } bool SuspendedDigimon(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent) && permanent.IsSuspended; } bool CanUnsuspendDigimon(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) && permanent.IsSuspended && permanent.CanUnsuspend; } IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass) { if (CardEffectCommons.HasMatchConditionPermanent(CanSuspendPermanentCondition)) { SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSuspendPermanentCondition, 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 && CardEffectCommons.HasMatchConditionPermanent(CanUnsuspendDigimon)) { SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanUnsuspendDigimon, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: true, canEndNotMax: false, selectPermanentCoroutine: null, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.UnTap, cardEffect: activateClass); selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to unsuspend", "Opponent is selecting 1 Digimon to unsuspend"); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); } } #endregion #region All turns - OPT if (timing == EffectTiming.OnTappedAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("May play 1 4K DP or lower traited Digimon", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription()); activateClass.SetIsSkippable(true); activateClass.SetHashString("BT25_055_AT"); cardEffects.Add(activateClass); string EffectDescription() { return "[All Turns] [Once Per Turn] When this Digimon suspends, you may play 1 4000 DP or lower Digimon card with [Vegetation], [Plant], [Avian] or [Bird] in any of its traits or the [TS] trait from your hand without paying the cost."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerWhenSelfPermanentSuspends(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition); } bool CanSelectCardCondition(CardSource cardSource) { return cardSource.IsDigimon && cardSource.HasDP && cardSource.CardDP <= 4000 && (cardSource.ContainsTraits("Vegetation") || cardSource.ContainsTraits("Plant") || cardSource.ContainsTraits("Avian") || cardSource.ContainsTraits("Bird") || cardSource.HasTSTraits); } IEnumerator ActivateCoroutine(Hashtable hashtable) { bool Used = false; if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition)) { IEnumerator AfterSelectCardCoroutine(List cardSources) { if (cardSources.Count > 0) { Used = true; } yield return null; } yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayByEffect( canTargetCondition: CanSelectCardCondition, SelectCardEffect.Root.Hand, activateClass, payCost: false, afterSelectCardCoroutine: AfterSelectCardCoroutine )); } if (!Used) { activateClass.RemoveUse(); } } } #endregion #region Inherited if (timing == EffectTiming.OnAllyAttack) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Change attack target", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription()); activateClass.SetHashString("BT25_055_Inherited"); activateClass.SetIsSkippable(true); activateClass.SetIsInheritedEffect(true); cardEffects.Add(activateClass); string EffectDescription() { return "[Opponent's Turn] [Once Per Turn] When one of your opponent's Digimon attacks, you can change the attack target to 1 of your suspended Digimon."; } bool CanSelectRedirectCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) && permanent.IsSuspended; } bool PermanentCondition(Permanent permanent) { return CardEffectCommons.IsOpponentPermanent(permanent, card); } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.IsOpponentTurn(card) && CardEffectCommons.CanTriggerOnPermanentAttack(hashtable, PermanentCondition); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleArea(card) && CardEffectCommons.HasMatchConditionPermanent(CanSelectRedirectCondition) && GManager.instance.attackProcess.AttackingPermanent != null && GManager.instance.attackProcess.AttackingPermanent.CanSwitchAttackTarget; } IEnumerator ActivateCoroutine(Hashtable _hashtable) { bool Used = false; SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectRedirectCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: true, canEndNotMax: false, selectPermanentCoroutine: SelectPermanentCoroutine, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Custom, cardEffect: activateClass); selectPermanentEffect.SetUpCustomMessage( "Select 1 Digimon to switch the attack to.", "The opponent is selecting 1 Digimon to switch the attack to."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); IEnumerator SelectPermanentCoroutine(Permanent permanent) { Used = true; yield return ContinuousController.instance.StartCoroutine(GManager.instance.attackProcess.SwitchDefender( activateClass, false, permanent)); } if (!Used) { activateClass.RemoveUse(); } } } #endregion return cardEffects; } } }