| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251 |
- using Photon.Pun;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using UnityEngine;
- //CresGarurumon
- namespace DCGO.CardEffects.EX9
- {
- public class EX9_020 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- #region Alternate Digivolution Requirement
- //Lv.5 w/[Greymon] in name or w/[DM] trait: Cost 3
- if (timing == EffectTiming.None)
- {
- static bool PermanentCondition(Permanent targetPermanent)
- {
- return (targetPermanent.TopCard.HasGarurumonName || targetPermanent.TopCard.HasDMTraits) && targetPermanent.TopCard.IsLevel5;
- }
- cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
- }
- #endregion
- #region Blast Digivolve
- if (timing == EffectTiming.OnCounterTiming)
- {
- cardEffects.Add(CardEffectFactory.BlastDigivolveEffect(card: card, condition: null));
- }
- #endregion
- #region Alliance/Blocker
- if (timing == EffectTiming.OnAllyAttack)
- {
- cardEffects.Add(CardEffectFactory.AllianceSelfEffect(isInheritedEffect: false, card: card, condition: null));
- }
- if (timing == EffectTiming.None)
- {
- cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(
- isInheritedEffect: false,
- card: card,
- condition: null));
- }
- #endregion
- #region On Play/When Digivolving Shared
- bool CanSelectPermanentCondition(Permanent permanent)
- {
- if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
- {
- if (permanent.TopCard.HasLevel)
- {
- if (permanent.Level <= 5)
- {
- return true;
- }
- }
- }
- return false;
- }
- bool CanActivateSharedCondition(Hashtable hashtable)
- {
- if (CardEffectCommons.IsExistOnBattleArea(card))
- {
- if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
- {
- return true;
- }
- }
- return false;
- }
- #endregion
- #region On Play
- if (timing == EffectTiming.OnEnterFieldAnyone)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Return 1 level 5 or lower Digimon to hand", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateSharedCondition, ActivateCoroutine, -1, false, EffectDescription());
- cardEffects.Add(activateClass);
- string EffectDescription()
- {
- return "[On Play] Return 1 of your opponent's level 5 or lower Digimon to the bottom of the deck.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
- }
- IEnumerator ActivateCoroutine(Hashtable _hashtable)
- {
- 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: null,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.PutLibraryBottom,
- cardEffect: activateClass);
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- }
- }
- #endregion
- #region When Digivolving
- if (timing == EffectTiming.OnEnterFieldAnyone)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Return 1 level 5 or lower Digimon to hand", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateSharedCondition, ActivateCoroutine, -1, false, EffectDescription());
- cardEffects.Add(activateClass);
- string EffectDescription()
- {
- return "[When Digivolving] Return 1 of your opponent's level 5 or lower Digimon to the bottom of the deck.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
- CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
- }
- IEnumerator ActivateCoroutine(Hashtable _hashtable)
- {
- 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: null,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.PutLibraryBottom,
- cardEffect: activateClass);
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- }
- }
- #endregion
- #region All Turns
- if (timing == EffectTiming.WhenRemoveField)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("DNA into [Omnimon Alter-S]", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
- cardEffects.Add(activateClass);
- string EffectDiscription()
- {
- return "[All Turns] When any of your level 6 Digimon would leave the battle area other than in battle, 2 of your Digimon may DNA digivolve into [Omnimon Alter-S] in the hand.";
- }
- bool WouldLeaveBattleArea(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
- permanent.TopCard.IsLevel6;
- }
- bool CanSelectDNACardCondition(CardSource cardSource)
- {
- return cardSource.IsDigimon &&
- cardSource.EqualsCardName("Omnimon Alter-S") &&
- cardSource.CanPlayJogress(true);
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
- {
- if (CardEffectCommons.CanTriggerWhenPermanentRemoveField(hashtable, WouldLeaveBattleArea))
- {
- if (!CardEffectCommons.IsByBattle(hashtable))
- {
- return true;
- }
- }
- }
- return false;
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- yield return ContinuousController.instance.StartCoroutine(
- CardEffectCommons.DNADigivolvePermanentsIntoHandOrTrashCard(
- CanSelectDNACardCondition,
- payCost: true,
- isHand: true,
- activateClass
- ));
- }
- }
- #endregion
- #region Your Turn - ESS
- if (timing == EffectTiming.None)
- {
- CanNotSwitchAttackTargetClass canNotSwitchAttackTargetClass = new CanNotSwitchAttackTargetClass();
- canNotSwitchAttackTargetClass.SetUpICardEffect("This Digimon's attack target can't change.", CanUseCondition, card);
- canNotSwitchAttackTargetClass.SetUpCanNotSwitchAttackTargetClass(PermanentCondition: PermanentCondition);
- canNotSwitchAttackTargetClass.SetIsInheritedEffect(true);
- cardEffects.Add(canNotSwitchAttackTargetClass);
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.IsOwnerTurn(card);
- }
- bool PermanentCondition(Permanent permanent)
- {
- return permanent != null && permanent.TopCard && permanent == card.PermanentOfThisCard();
- }
- }
- #endregion
- return cardEffects;
- }
- }
- }
|