| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266 |
- using System.Collections;
- using System.Collections.Generic;
- // Deramon
- namespace DCGO.CardEffects.BT25
- {
- public class BT25_055 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- #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>();
- 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>();
- 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<CardSource> 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>();
- 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;
- }
- }
- }
|