using System; using System.Collections; using System.Collections.Generic; // Namakemon namespace DCGO.CardEffects.BT16 { public class BT16_055 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); # region Alternate Digivolution Requirement if (timing == EffectTiming.None) { bool PermanentCondition(Permanent targetPermanent) { if (targetPermanent.TopCard.CardNames.Contains("Pulsemon")) { return true; } return false; } cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect( permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null)); } #endregion #region Shared OP/WD string SharedEffectName() => "Conditionally 1 of your Digimon can't be DP reduced or De-Digivolved, Conditionally 1 of your Digimon gains and "; string SharedEffectDescription(string tag) => $"[{tag}] If you have 3 or more security cards, 1 of your Digimon can't have its DP reduced by your opponent's effects, and isn't affected by effects until the end of your opponent's turn. If you have 3 or fewer security cards, 1 of your Digimon gains and until the end of your opponent's turn."; bool SharedCanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card); } bool CanSelectPermanentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card); } Permanent selectedPermanent1 = null; #region Can't Be De-Digivolved Permanent selectedPermanent = null; IEnumerator AfterSelectPermanent(List permanents) { if (permanents.Count >= 1) selectedPermanent = permanents[0]; yield return null; } void ActivateDeDigivolveProtection() { ImmuneFromDeDigivolveClass immuneFromDeDigivolveClass = new ImmuneFromDeDigivolveClass(); immuneFromDeDigivolveClass.SetUpICardEffect("Isn't affected by ", 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) { if (card.Owner.SecurityCards.Count >= 3) { SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectPermanentCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: false, canEndNotMax: false, selectPermanentCoroutine: null, afterSelectPermanentCoroutine: AfterSelectPermanent, mode: SelectPermanentEffect.Mode.Custom, cardEffect: activateClass); selectPermanentEffect.SetUpCustomMessage( "Select 1 Digimon that can't have its DP reduced by your opponent's effects and isn't affected by effects until the end of your opponent's turn.", "The opponent is selecting 1 Digimon that can't have its DP reduced by your opponent's effects and isn't affected by effects until the end of your turn."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); if (selectedPermanent != null) { ActivateDeDigivolveProtection(); yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainImmuneFromDPMinus( targetPermanent: selectedPermanent, cardEffectCondition: cardEffect => CardEffectCommons.IsOpponentEffect(cardEffect, card), effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass, effectName: "Can't have DP reduced")); } } if (card.Owner.SecurityCards.Count <= 3) { SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); 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 1 Digimon that gains and until the end of your opponent's turn.", "The opponent is selecting 1 Digimon that gains and until the end of your turn."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); IEnumerator SelectPermanentCoroutine(Permanent permanent) { selectedPermanent1 = permanent; yield return null; } if (selectedPermanent1 != null) { yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainReboot( targetPermanent: selectedPermanent1, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass)); yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBlocker( targetPermanent: selectedPermanent1, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass)); } } } #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, false, 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, false, SharedEffectDescription("When Digivolving")); cardEffects.Add(activateClass); bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card); } } #endregion #region Inherited Effect if (timing == EffectTiming.None) { bool condition() { return card.PermanentOfThisCard().TopCard.HasText("Pulsemon"); } cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect>( changeValue: () => 1000, isInheritedEffect: true, card: card, condition: condition)); } #endregion return cardEffects; } } }