| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- //Ginryumon
- namespace DCGO.CardEffects.BT24
- {
- public class BT24_055 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- #region Alternate Digivolution
- if (timing == EffectTiming.None)
- {
- static bool PermanentCondition(Permanent targetPermanent)
- {
- return (targetPermanent.TopCard.EqualsTraits("DigiPolice")
- || targetPermanent.TopCard.EqualsTraits("SEEKERS"))
- && targetPermanent.TopCard.IsLevel3;
- }
- cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: 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 OP/WD
- string SharedEffectName() => "Place [Shuu Yulin] under to prevent De-Digivolve on 1 Digimon.";
- string SharedEffectDescription(string tag) => $"[{tag}] By placing 1 [Shuu Yulin] from your hand as this Digimon's bottom digivolution card, your opponent's <De-Digivolve> effects don't affect 1 of your [DigiPolice] or [SEEKERS] trait Digimon until their turn ends.";
- bool SharedCanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
- && card.Owner.HandCards.Count(CanSelectCardCondition) >= 1;
- }
- bool CanSelectCardCondition(CardSource cardSource)
- {
- return cardSource.EqualsCardName("Shuu Yulin");
- }
- bool CanSelectPermanentConditionShared(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
- && (permanent.TopCard.EqualsTraits("DigiPolice")
- || permanent.TopCard.EqualsTraits("SEEKERS"));
- }
- #region Can't Be De-Digivolved
- Permanent selectedPermanent = null;
- IEnumerator AfterSelectPermanent(List<Permanent> permanents)
- {
- if (permanents.Count >= 1)
- selectedPermanent = permanents[0];
- yield return null;
- }
- void ActivateDeDigivolveProtection()
- {
- ImmuneFromDeDigivolveClass immuneFromDeDigivolveClass = new ImmuneFromDeDigivolveClass();
- immuneFromDeDigivolveClass.SetUpICardEffect("Isn't affected by <De-Digivolve>", CanUseDeDigivolveCondition, selectedPermanent.TopCard);
- immuneFromDeDigivolveClass.SetUpImmuneFromDeDigivolveClass(PermanentCondition: PermanentDeDigivolveCondition);
- selectedPermanent.UntilOpponentTurnEndEffects.Add((_timing) => immuneFromDeDigivolveClass);
- }
- bool CanUseDeDigivolveCondition(Hashtable hashtable1)
- {
- return selectedPermanent.TopCard != null;
- }
- bool PermanentDeDigivolveCondition(Permanent permanent)
- {
- return permanent == selectedPermanent;
- }
- #endregion
- IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
- {
- List<CardSource> selectedCards = new List<CardSource>();
- SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
- selectHandEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectCardCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: 1,
- canNoSelect: true,
- canEndNotMax: false,
- isShowOpponent: true,
- selectCardCoroutine: SelectCardCoroutine,
- afterSelectCardCoroutine: null,
- mode: SelectHandEffect.Mode.Custom,
- cardEffect: activateClass);
- selectHandEffect.SetUpCustomMessage("Select 1 card to place on bottom of digivolution cards.", "The opponent is selecting 1 card to place on bottom of digivolution cards.");
- selectHandEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
- yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
- IEnumerator SelectCardCoroutine(CardSource source)
- {
- if (source != null)
- selectedCards.Add(source);
- yield return null;
- }
- if (selectedCards.Count >= 1)
- {
- yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(selectedCards, activateClass));
- SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
- int maxCount1 = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentConditionShared));
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectPermanentConditionShared,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: maxCount1,
- canNoSelect: false,
- canEndNotMax: false,
- selectPermanentCoroutine: null,
- afterSelectPermanentCoroutine: AfterSelectPermanent,
- mode: SelectPermanentEffect.Mode.Custom,
- cardEffect: activateClass);
- selectPermanentEffect.SetUpCustomMessage(
- "Select Digimon that will get effects.",
- "The opponent is selecting Digimon that will get effects.");
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- if (selectedPermanent != null)
- {
- ActivateDeDigivolveProtection();
- }
- }
- }
- #endregion
- #region On Play
- if (timing == EffectTiming.OnEnterFieldAnyone)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect(SharedEffectName(), CanUseCondition, card);
- activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), -1, true, SharedEffectDescription("On Play"));
- cardEffects.Add(activateClass);
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
- && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
- }
- }
- #endregion
- #region When Digivolving
- if (timing == EffectTiming.OnEnterFieldAnyone)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect(SharedEffectName(), CanUseCondition, card);
- activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), -1, true, SharedEffectDescription("When Digivolving"));
- cardEffects.Add(activateClass);
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
- && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
- }
- }
- #endregion
- #region Inherited
- if (timing == EffectTiming.OnTappedAnyone)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Suspend opponent's Digimon or Tamers with play cost less than this Digimon.", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
- activateClass.SetIsInheritedEffect(true);
- activateClass.SetHashString("BT24_055_Inherited");
- cardEffects.Add(activateClass);
- string EffectDescription()
- {
- return "[All Turns] [Once Per Turn] When this Digimon suspends, suspend 1 of your opponent's Digimon or Tamers with as high or lower a playcost as this digimon.";
- }
- bool CanSelectPermanentCondition(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card)
- && permanent.TopCard.HasPlayCost
- && (permanent.IsDigimon
- || permanent.IsTamer)
- && permanent.TopCard.GetCostItself <= card.PermanentOfThisCard().TopCard.GetCostItself;
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleArea(card);
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleArea(card)
- && CardEffectCommons.CanTriggerWhenSelfPermanentSuspends(hashtable, card);
- }
- IEnumerator ActivateCoroutine(Hashtable _hashtable)
- {
- int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
- SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectPermanentCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: maxCount,
- canNoSelect: false,
- canEndNotMax: false,
- selectPermanentCoroutine: null,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Tap,
- cardEffect: activateClass);
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- }
- }
- #endregion
- return cardEffects;
- }
- }
- }
|