using System; using System.Collections; using System.Collections.Generic; namespace DCGO.CardEffects.BT12 { public class BT12_057 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); if (timing == EffectTiming.None) { bool PermanentCondition(Permanent targetPermanent) { return targetPermanent.TopCard.HasSaveText && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 5; } cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect( permanentCondition: PermanentCondition, digivolutionCost: 9, ignoreDigivolutionRequirement: false, card: card, condition: null)); } if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Suspend Digimon and Tamer, and gain Memory", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[When Digivolving] Suspend all Digimon except this one, and suspend all of you and your opponent's Tamers. Then, for every 2 suspended Digimon and Tamers, gain 1 memory."; } bool CanSelectPermanentCondition(Permanent permanent) { if (CardEffectCommons.IsPermanentExistsOnBattleArea(permanent)) { if (permanent != card.PermanentOfThisCard()) { if (!permanent.TopCard.CanNotBeAffected(activateClass)) { if (permanent.IsDigimon) { return true; } if (permanent.IsTamer) { return true; } } } } return false; } bool PermanentCondition(Permanent permanent) { if (CardEffectCommons.IsPermanentExistsOnBattleArea(permanent)) { if (permanent.IsSuspended) { if (permanent.IsDigimon || permanent.IsTamer) { return true; } } } return false; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleArea(card)) { return true; } return false; } IEnumerator ActivateCoroutine(Hashtable _hashtable) { List suspendTargetPermanents = GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer .Map(player => player.GetBattleAreaPermanents().Filter(CanSelectPermanentCondition)) .Flat(); yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(suspendTargetPermanents, CardEffectCommons.CardEffectHashtable(activateClass)).Tap()); int permanentCount = CardEffectCommons.MatchConditionPermanentCount(PermanentCondition); int gainMemory = permanentCount / 2; yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(gainMemory, activateClass)); } } if (timing == EffectTiming.None) { bool PermanentCondition(Permanent permanent) { if (CardEffectCommons.IsPermanentExistsOnBattleArea(permanent)) { if (permanent != card.PermanentOfThisCard()) { if (permanent.IsDigimon || permanent.IsTamer) { return true; } } } return false; } bool CanUseCondition() { return CardEffectCommons.IsExistOnBattleArea(card); } string effectName = "All Digimon and Tamer other than this Digimon can't unsuspend"; cardEffects.Add(CardEffectFactory.CantUnsuspendStaticEffect( permanentCondition: PermanentCondition, isInheritedEffect: false, card: card, condition: CanUseCondition, effectName: effectName)); } if (timing == EffectTiming.OnAllyAttack) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Suspend 1 Digimon or Tamer and trash opponent's security", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[When Attacking] Suspend 1 of your opponent's Digimon or Tamers. Then, trash 1 card from the top of your opponent's security stack for every 5 suspended Digimon and Tamers."; } bool CanSelectPermanentCondition(Permanent permanent) { if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card)) { if (permanent.IsDigimon || permanent.IsTamer) { return true; } } return false; } bool PermanentCondition(Permanent permanent) { if (CardEffectCommons.IsPermanentExistsOnBattleArea(permanent)) { if (permanent.IsSuspended) { if (permanent.IsDigimon || permanent.IsTamer) { return true; } } } return false; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOnAttack(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleArea(card)) { return true; } return false; } IEnumerator ActivateCoroutine(Hashtable _hashtable) { if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition)) { int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition)); SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectPermanentCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: maxCount, canNoSelect: false, canEndNotMax: false, selectPermanentCoroutine: null, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Tap, cardEffect: activateClass); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); } int permanentCount = CardEffectCommons.MatchConditionPermanentCount(PermanentCondition); int trashCount = permanentCount / 5; yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity( player: card.Owner.Enemy, destroySecurityCount: trashCount, cardEffect: activateClass, fromTop: true).DestroySecurity()); } } return cardEffects; } } }