using System.Collections; using System.Collections.Generic; using System.Linq; // Neptunemon namespace DCGO.CardEffects.BT24 { public class BT24_030 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Static Effects #region Alt Digivolution Condition if (timing == EffectTiming.None) { static bool PermanentCondition(Permanent targetPermanent) { return targetPermanent.TopCard.IsLevel5 && (targetPermanent.TopCard.HasAquaTraits || targetPermanent.TopCard.HasTSTraits); } cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null)); } #endregion #region Reduce Play Cost if (timing == EffectTiming.None) { bool Condition() { return card.Owner.Enemy.GetBattleAreaDigimons().Count >= 2; } cardEffects.Add(CardEffectFactory.MandatorySelfPlayCostReduction(5, card, Condition)); } #endregion #endregion #region On Play / When Digivolving Shared IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass) { var opponentDigimons = card.Owner.Enemy.GetBattleAreaDigimons(); if (opponentDigimons.Any()) { var lowestSourcesPermanents = card.Owner.Enemy.GetBattleAreaDigimons() .GroupBy(x => x.DigivolutionCards.Count) .OrderBy(g => g.Key) .First() .ToList(); yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeckBouncePeremanentAndProcessAccordingToResult( targetPermanents: lowestSourcesPermanents, activateClass: activateClass, successProcess: null, failureProcess: null)); } } #endregion #region On Play if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Bottom deck all opponent digimon with lowest digivolution cards", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[On Play] Return all of your opponent's Digimon with the fewest digivolution cards to the bottom of the deck."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerOnPlay(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card); } } #endregion #region When Digivolving if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Bottom deck all opponent digimon with lowest digivolution cards", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[When Digivolving] Return all of your opponent's Digimon with the fewest digivolution cards to the bottom of the deck."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card); } } #endregion #region All Turns - OPT if (timing == EffectTiming.OnTappedAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Unsuspend this digimon", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription()); activateClass.SetHashString("BT24_030_AT"); cardEffects.Add(activateClass); string EffectDiscription() { return "[All Turns] [Once Per Turn] When this Digimon suspends, it may unsuspend."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerWhenSelfPermanentSuspends(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card); } IEnumerator ActivateCoroutine(Hashtable hashtable) { yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents( permanents: new List() { card.PermanentOfThisCard() }, cardEffect: activateClass).Unsuspend()); } } #endregion #region All Turns if (timing == EffectTiming.WhenRemoveField) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("By suspending this digimon, your [TS]/[Aqua]/[Sea Animal] digimon wont leave the field", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[All Turns] When any of your Digimon with the [TS] trait or [Aqua] or [Sea Animal] in any of their traits would leave the battle area by your opponent's effects, by suspending this Digimon, they don't leave."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerWhenPermanentRemoveField(hashtable, PermanentCondition) && CardEffectCommons.IsByEffect(hashtable, cardEffect => CardEffectCommons.IsOpponentEffect(cardEffect, card)); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanActivateSuspendCostEffect(card); } bool PermanentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) && (permanent.TopCard.HasTSTraits || permanent.TopCard.HasAquaTraits); } IEnumerator ActivateCoroutine(Hashtable hashtable) { Permanent thisPermament = card.PermanentOfThisCard(); yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List() { thisPermament }, hashtable).Tap()); if (thisPermament.IsSuspended) { List protectedPermanents = CardEffectCommons.GetPermanentsFromHashtable(hashtable) .Filter(PermanentCondition); foreach (Permanent permanent in protectedPermanents) { permanent.willBeRemoveField = false; permanent.HideHandBounceEffect(); permanent.HideDeckBounceEffect(); permanent.HideDeleteEffect(); permanent.HideWillRemoveFieldEffect(); } } } } #endregion return cardEffects; } } }