| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222 |
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- // Neptunemon
- namespace DCGO.CardEffects.BT24
- {
- public class BT24_030 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- #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<Permanent>() { 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<Permanent>() { thisPermament }, hashtable).Tap());
- if (thisPermament.IsSuspended)
- {
- List<Permanent> 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;
- }
- }
- }
|