| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using UnityEngine;
- // Zephagamon // Divine Tempest Ligero
- namespace DCGO.CardEffects.LM
- {
- public class LM_066 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- #region Digimon Effects
- #region Alternate Digivolution Requirement
- if (timing == EffectTiming.None)
- {
- bool PermanentCondition(Permanent targetPermanent)
- {
- return targetPermanent.TopCard.HasPlayCost
- && targetPermanent.TopCard.GetCostItself >= 11
- && targetPermanent.TopCard.EqualsTraits("Vortex Warriors");
- }
- cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
- permanentCondition: PermanentCondition,
- digivolutionCost: 2,
- ignoreDigivolutionRequirement: false,
- card: card,
- condition: null));
- }
- #endregion
- #region Piercing
- if (timing == EffectTiming.OnDetermineDoSecurityCheck)
- {
- cardEffects.Add(CardEffectFactory.PierceSelfEffect(isInheritedEffect: false, card: card, condition: null));
- }
- #endregion
- #region Vortex
- if (timing == EffectTiming.OnEndTurn)
- {
- cardEffects.Add(CardEffectFactory.VortexSelfEffect(isInheritedEffect: false, card: card,
- condition: null));
- }
- #endregion
- #region Blocker
- if (timing == EffectTiming.None)
- {
- cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
- }
- #endregion
- #region Shared WD / WA
- string SharedHashString = "LM_066_WD/WA";
- string SharedEffectName = "May unsuspend 1 Digimon, then may battle 1 enemy Digimon";
- string SharedEffectDescription(string tag) => $"[{tag}] [Once Per Turn] You may unsuspend 1 Digimon. Then, this Digimon may battle 1 of your opponent's Digimon.";
- CardEffectFactory.ActivateClassesForSharedEffects
- (ref cardEffects, timing, card,
- SharedEffectName,
- SharedActivateCoroutine,
- SharedEffectDescription,
- optional: false,
- isSkippable: true,
- maxCountPerTurn: 1,
- hashValue: SharedHashString,
- whenDigivolving: true,
- whenAttacking: true);
- bool CanSelectUnsuspendCondition(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent)
- && permanent.IsSuspended
- && permanent.CanUnsuspend;
- }
- bool CanSelectBattleCondtion(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
- }
- IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
- {
- bool Used = false;
- if (CardEffectCommons.HasMatchConditionPermanent(CanSelectUnsuspendCondition))
- {
- SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectUnsuspendCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: 1,
- canNoSelect: true,
- canEndNotMax: false,
- selectPermanentCoroutine: SelectPermanentCoroutine,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.UnTap,
- cardEffect: activateClass);
- selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to unsuspend.", "The opponent is selecting 1 Digimon to unsuspend.");
- IEnumerator SelectPermanentCoroutine(Permanent permanent)
- {
- if (permanent != null)
- {
- Used = true;
- yield return null;
- }
- }
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- }
- if (CardEffectCommons.HasMatchConditionPermanent(CanSelectBattleCondtion))
- {
- SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectBattleCondtion,
- 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 battle.", "The opponent is selecting 1 Digimon to battle.");
- IEnumerator SelectPermanentCoroutine(Permanent permanent)
- {
- if (permanent != null)
- {
- Used = true;
- yield return ContinuousController.instance.StartCoroutine(new IBattle(card.PermanentOfThisCard(), permanent, null, true).Battle());
- }
- }
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- }
- if (!Used) activateClass.RemoveUse();
- }
- #endregion
- #region All Turns
- if (timing == EffectTiming.WhenRemoveField)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Suspend 1 Digimon to not leave", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
- activateClass.SetHashString("LM_066_AT");
- activateClass.SetIsSkippable(true);
- cardEffects.Add(activateClass);
- string EffectDescription()
- {
- return "[All Turns] [Once Per Turn] When this Digimon would leave the battle area other than by your effects, by suspending 1 Digimon, it doesn't leave.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaTrigger(card, activateClass)
- && CardEffectCommons.CanTriggerWhenRemoveField(hashtable, card)
- && !CardEffectCommons.IsByEffect(hashtable, cardEffect => CardEffectCommons.IsOwnerEffect(cardEffect, card));
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaActivate(card, activateClass)
- && CardEffectCommons.HasMatchConditionPermanent(CanSelectSuspendCondition);
- }
- bool CanSelectSuspendCondition(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent)
- && !permanent.IsSuspended
- && permanent.CanSuspend;
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- bool Used = false;
- Permanent selectedPermament = null;
- SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectSuspendCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: 1,
- canNoSelect: true,
- canEndNotMax: false,
- selectPermanentCoroutine: SelectPermanentCoroutine,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Custom,
- cardEffect: activateClass);
- IEnumerator SelectPermanentCoroutine(Permanent permanent)
- {
- selectedPermament = permanent;
- Used = true;
- yield return null;
- }
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SuspendPeremanentAndProcessAccordingToResult(
- new List<Permanent>() { selectedPermament },
- activateClass,
- SuccessProcess,
- null));
- IEnumerator SuccessProcess(List<Permanent> suspendedPermaments)
- {
- card.PermanentOfThisCard().willBeRemoveField = false;
- card.PermanentOfThisCard().HideDeleteEffect();
- card.PermanentOfThisCard().HideHandBounceEffect();
- card.PermanentOfThisCard().HideDeckBounceEffect();
- card.PermanentOfThisCard().HideWillRemoveFieldEffect();
- yield return null;
- }
- if (!Used) activateClass.RemoveUse();
- }
- }
- #endregion
- #endregion
- #region Option Effects
- #region Reduce Play Cost
- if (timing == EffectTiming.BeforePayCost)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Reduce Use Cost -2", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
- activateClass.SetIsSkippable(true);
- cardEffects.Add(activateClass);
- string EffectDescription()
- {
- return "When this card would be used, by suspending 2 Digimon, reduce the cost by 2.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerWhenPermanentWouldPlay(hashtable, cardSource => cardSource == card);
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.MatchConditionPermanentCount(CanSelectSuspendCondition) >= 2;
- }
- bool CanSelectSuspendCondition(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent)
- && !permanent.IsSuspended;
- }
- IEnumerator ActivateCoroutine(Hashtable _hashtable)
- {
- bool canNoSelect = true;
- if (card.PayingCost(SelectCardEffect.Root.Hand, null, checkAvailability: false) >
- card.Owner.MaxMemoryCost)
- {
- canNoSelect = false;
- }
- bool CanTargetCondition_ByPreSelecetedList(List<Permanent> permanents, Permanent permanent)
- {
- foreach (Permanent permanent1 in permanents)
- {
- if (canNoSelect == false
- && !permanent1.CanSuspend)
- {
- return false;
- }
- }
- return true;
- }
- List<Permanent> selectedPermanents = new List<Permanent>();
- SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectSuspendCondition,
- canTargetCondition_ByPreSelecetedList: CanTargetCondition_ByPreSelecetedList,
- canEndSelectCondition: null,
- maxCount: 2,
- canNoSelect: canNoSelect,
- canEndNotMax: false,
- selectPermanentCoroutine: SelectPermanentCoroutine,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Custom,
- cardEffect: activateClass);
- IEnumerator SelectPermanentCoroutine(Permanent permanent)
- {
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SuspendPeremanentAndProcessAccordingToResult(
- new List<Permanent>() { permanent },
- activateClass,
- SuccessProcess,
- null));
- }
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- IEnumerator SuccessProcess(List<Permanent> selectedPermanents)
- {
- if (card.Owner.CanReduceCost(null, card)) ContinuousController.instance.PlaySE(GManager.instance.GetComponent<Effects>().BuffSE);
- ChangeCostClass changeCostClass = new ChangeCostClass();
- changeCostClass.SetUpICardEffect("Use Cost -2", CanUseCondition1, card);
- changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
- card.Owner.UntilCalculateFixedCostEffect.Add((_timing) => changeCostClass);
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ShowReducedCost(_hashtable));
- bool CanUseCondition1(Hashtable hashtable) => true;
- int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
- {
- if (CardSourceCondition(cardSource)
- && RootCondition(root)
- && PermanentsCondition(targetPermanents))
- {
- Cost -= 2;
- }
- return Cost;
- }
- bool PermanentsCondition(List<Permanent> targetPermanents)
- {
- return targetPermanents == null
- || targetPermanents.Count((targetPermanent) => targetPermanent != null) == 0;
- }
- bool CardSourceCondition(CardSource cardSource)
- {
- return cardSource != null
- && cardSource == card;
- }
- bool RootCondition(SelectCardEffect.Root root) => true;
- bool isUpDown() => true;
- }
- }
- }
- if (timing == EffectTiming.None)
- {
- ChangeCostClass changeCostClass = new ChangeCostClass();
- changeCostClass.SetUpICardEffect("Use Cost -2", CanUseCondition, card);
- changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => true, isChangePayingCost: () => true);
- changeCostClass.SetNotShowUI(true);
- cardEffects.Add(changeCostClass);
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnHand(card)
- && CardEffectCommons.MatchConditionPermanentCount(CanSelectSuspendCondition) >= 2;
- }
- bool CanSelectSuspendCondition(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent)
- && !permanent.IsSuspended;
- }
- int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
- {
- if (CardSourceCondition(cardSource)
- && RootCondition(root)
- && PermanentsCondition(targetPermanents))
- {
- Cost -= 2;
- }
- return Cost;
- }
- bool PermanentsCondition(List<Permanent> targetPermanents)
- {
- return targetPermanents == null
- || targetPermanents.Count((targetPermanent) => targetPermanent != null) == 0;
- }
- bool CardSourceCondition(CardSource cardSource)
- {
- return cardSource != null
- && cardSource == card;
- }
- bool RootCondition(SelectCardEffect.Root root) => true;
- bool isUpDown() => true;
- }
- #endregion
- #region Main
- if (timing == EffectTiming.OptionSkill)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("1 enemy Digimon/Tamer can't unsuspend till end of their turn, then for every 2 suspended Digimon, bot deck 1 enemy Digimon", CanUseCondition, card);
- activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
- cardEffects.Add(activateClass);
- string EffectDescription()
- => "[Main] 1 of your opponent's Digimon or tamers can't unsuspend until their turn ends. Then, for every 2 suspended Digimon, return 1 of their Digimon to the bottom of the deck.";
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
- }
- bool CanSelectPermanentCondition(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card)
- && (permanent.IsDigimon
- || permanent.IsTamer);
- }
- bool CanCountDigimonCondition(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent)
- && permanent.IsSuspended;
- }
- bool CanSelectBotDeckCondition(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
- }
- IEnumerator ActivateCoroutine(Hashtable _hashtable)
- {
- if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
- {
- SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectPermanentCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: 1,
- canNoSelect: false,
- canEndNotMax: false,
- selectPermanentCoroutine: SelectPermanentCoroutine,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Custom,
- cardEffect: activateClass);
- selectPermanentEffect.SetUpCustomMessage(
- "Select a Digimon or Tamers that will be unable to unsuspend.",
- "The opponent is selecting a Digimon or Tamers that will be unable to unsuspend.");
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- IEnumerator SelectPermanentCoroutine(Permanent permanent)
- {
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCantUnsuspendUntilOpponentTurnEnd(
- targetPermanent: permanent,
- activateClass: activateClass
- ));
- }
- }
- int maxCount = Math.Min(CardEffectCommons.MatchConditionPermanentCount(CanSelectBotDeckCondition), Mathf.FloorToInt(CardEffectCommons.MatchConditionPermanentCount(CanCountDigimonCondition) / 2));
- if (maxCount > 0)
- {
- SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectBotDeckCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: maxCount,
- canNoSelect: false,
- 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 Arts Digivolution
- if (timing == EffectTiming.None)
- {
- cardEffects.Add(CardEffectFactory.ArtsDigivolveEffect(card));
- }
- #endregion
- #endregion
- return cardEffects;
- }
- }
- }
|