| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- // Dreammon
- namespace DCGO.CardEffects.BT22
- {
- public class BT22_058 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- #region Link Condition
- if (timing == EffectTiming.None)
- {
- static bool PermanentCondition(Permanent targetPermanent)
- {
- return targetPermanent.TopCard.HasAppmonTraits;
- }
- cardEffects.Add(CardEffectFactory.AddSelfLinkConditionStaticEffect(permanentCondition: PermanentCondition, linkCost: 2, card: card));
- }
- #endregion
- #region Link Effect
- if (timing == EffectTiming.OnDeclaration)
- {
- cardEffects.Add(CardEffectFactory.LinkEffect(card));
- }
- #endregion
- #region Alternative Digivolution Condition
- if (timing == EffectTiming.None)
- {
- bool PermanentCondition(Permanent targetPermanent)
- {
- return targetPermanent.TopCard.EqualsTraits("Stnd.");
- }
- cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
- permanentCondition: PermanentCondition,
- digivolutionCost: 2,
- ignoreDigivolutionRequirement: false,
- card: card,
- condition: null)
- );
- }
- #endregion
- #region All Turns - When Linked
- if (timing == EffectTiming.WhenLinked)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("1 digimon cannot be bounced to deck or hand", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
- activateClass.SetHashString("BT22_058_BounceImmunity");
- cardEffects.Add(activateClass);
- string EffectDiscription()
- {
- return "[All Turns] [Once Per Turn] When this Digimon gets linked, your opponent's effects can't return 1 of your Digimon to hands or decks until their turn ends.";
- }
- bool PermanentCondition(Permanent permanent)
- {
- return permanent == card.PermanentOfThisCard();
- }
- bool CardCondition(CardSource source)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
- CardEffectCommons.CanTriggerWhenLinked(hashtable, PermanentCondition, CardCondition);
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
- }
- bool MyDigimonCondition(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, MyDigimonCondition))
- {
- Permanent selectedPermanent = null;
- #region Select Permanent
- int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersPermanentCount(card, MyDigimonCondition));
- SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: MyDigimonCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: maxCount,
- canNoSelect: false,
- canEndNotMax: false,
- selectPermanentCoroutine: SelectPermanentCoroutine,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Custom,
- cardEffect: activateClass);
- IEnumerator SelectPermanentCoroutine(Permanent permanent)
- {
- selectedPermanent = permanent;
- yield return null;
- }
- selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to gain bounce immunity", "The opponent is selecting 1 Digimon gain bounce immunity.");
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- #endregion
- if (selectedPermanent != null)
- {
- yield return ContinuousController.instance.StartCoroutine(
- CardEffectCommons.GainCanNotReturnToDeck(selectedPermanent, null, EffectDuration.UntilOpponentTurnEnd, activateClass, "Can not be bounced to deck"));
- yield return ContinuousController.instance.StartCoroutine(
- CardEffectCommons.GainCanNotReturnToHand(selectedPermanent, null, EffectDuration.UntilOpponentTurnEnd, activateClass, "Can not be bounced to hand"));
- }
- }
- }
- }
- #endregion
- #region When Linked
- if (timing == EffectTiming.WhenLinked)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("De-Digivolve 1", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
- activateClass.SetIsLinkedEffect(true);
- cardEffects.Add(activateClass);
- string EffectDiscription() => "[When Linking] <De-Digivolve 1> 1 of your opponent's Digimon. (Trash the top card. You can't trash past level 3 cards.)";
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerWhenLinking(hashtable, null, card);
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
- && CardEffectCommons.HasMatchConditionOpponentsPermanent(card, OpponentCondition);
- }
- bool OpponentCondition(Permanent permanent) => CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, OpponentCondition))
- {
- Permanent selectedPermanent = null;
- #region Select Permanent
- int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, OpponentCondition));
- SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: OpponentCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: maxCount,
- canNoSelect: false,
- canEndNotMax: false,
- selectPermanentCoroutine: SelectPermanentCoroutine,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Custom,
- cardEffect: activateClass);
- IEnumerator SelectPermanentCoroutine(Permanent permanent)
- {
- selectedPermanent = permanent;
- yield return null;
- }
- selectPermanentEffect.SetUpCustomMessage("Select 1 opponent's Digimon to de-digivolve.", "The opponent is selecting 1 Digimon to de-digivolve.");
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- #endregion
- if (selectedPermanent != null) yield return ContinuousController.instance.StartCoroutine(
- new IDegeneration(selectedPermanent, 1, activateClass).Degeneration());
- }
- }
- }
- #endregion
- return cardEffects;
- }
- }
- }
|