using System.Collections; using System.Collections.Generic; using System.Linq; namespace DCGO.CardEffects.BT20 { public class BT20_059 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Alternate Digivolution Requirement if (timing == EffectTiming.None) { static bool PermanentCondition(Permanent targetPermanent) { return targetPermanent.TopCard.EqualsCardName("Gankoomon"); } cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null)); } #endregion #region When Digivolving if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect(", then your Digimon or unaffected by Digimon effects", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); activateClass.SetIsDigimonEffect(true); cardEffects.Add(activateClass); string EffectDiscription() { return "[When Digivolving] 1 of your opponent's Digimon. Then, if [Gankoomon] or [X Antibody] is in this Digimon's digivolution cards, until the end of your opponent's turn, none of your Digimon are affected by your opponent's Digimon effects."; } bool CanSelectDeDigivolveTarget(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card); } bool HasGankooOrXAnti() { return card.PermanentOfThisCard().DigivolutionCards.Count(source => source.EqualsCardName("Gankoomon") || source.EqualsCardName("X Antibody")) > 0; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card); } IEnumerator ActivateCoroutine(Hashtable hashtable) { if (CardEffectCommons.HasMatchConditionPermanent(CanSelectDeDigivolveTarget)) { SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectDeDigivolveTarget, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: false, canEndNotMax: false, selectPermanentCoroutine: SelectPermanentCoroutine, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Custom, cardEffect: activateClass); selectPermanentEffect.SetUpCustomMessage("Select Digimon to De-Digivolve.", "The opponent is selecting Digimon to De-Digivolve."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); IEnumerator SelectPermanentCoroutine(Permanent permanent) { if (permanent != null) yield return ContinuousController.instance.StartCoroutine(new IDegeneration(permanent, 2, activateClass).Degeneration()); yield return null; } } if (HasGankooOrXAnti()) { CanNotAffectedClass canNotAffectedClass = new CanNotAffectedClass(); canNotAffectedClass.SetUpICardEffect("Isn't affected by opponent's Digimon's effects", CanUseConditionImmunity, card); canNotAffectedClass.SetUpCanNotAffectedClass(CardCondition: CardCondition, SkillCondition: SkillCondition); card.Owner.UntilOpponentTurnEndEffects.Add(GetCardEffect); card.Owner.UntilOpponentTurnEndEffects.Add(GetDetailEffect); bool CanUseConditionImmunity(Hashtable hashtable) { return true; } bool CardCondition(CardSource cardSource) { if (CardEffectCommons.IsExistOnBattleAreaDigimon(cardSource)) { if (card.Owner == cardSource.Owner) { return true; } } return false; } bool SkillCondition(ICardEffect cardEffect) { if (CardEffectCommons.IsOpponentEffect(cardEffect, card)) { if (cardEffect.IsDigimonEffect) { return true; } } return false; } ICardEffect GetCardEffect(EffectTiming _timing) { if (_timing == EffectTiming.None) { return canNotAffectedClass; } return null; } bool PermanentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card); } ICardEffect GetDetailEffect(EffectTiming timing) { if (timing == EffectTiming.None) { return CardEffectFactory.AddDetailClass(CanUseConditionImmunity, PermanentCondition, "Isn't affected by opponent's Digimon's effects", false, card); } return null; } } } } #endregion #region Opponents Turn if (timing == EffectTiming.None) { bool PermanentCondition(Permanent permanent) { if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)) { if (permanent.TopCard.ContainsCardName("Sistermon") || permanent.TopCard.ContainsCardName("Huckmon")) return true; if (permanent.TopCard.HasRoyalKnightTraits) return true; } return false; } bool Condition() { if (CardEffectCommons.IsExistOnBattleAreaDigimon(card)) { if (CardEffectCommons.IsOpponentTurn(card)) { return true; } } return false; } cardEffects.Add(CardEffectFactory.RebootStaticEffect(permanentCondition: PermanentCondition, isInheritedEffect: false, card: card, Condition)); cardEffects.Add(CardEffectFactory.BlockerStaticEffect(permanentCondition: PermanentCondition, isInheritedEffect: false, card: card, Condition)); } #endregion #region Opponents Turn - ESS if (timing == EffectTiming.None) { bool PermanentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card); } bool Condition() { if (CardEffectCommons.IsExistOnBattleAreaDigimon(card)) { if (CardEffectCommons.IsOpponentTurn(card)) { return card.PermanentOfThisCard().TopCard.EqualsCardName("Jesmon GX"); } } return false; } cardEffects.Add(CardEffectFactory.RebootStaticEffect(permanentCondition: PermanentCondition, isInheritedEffect: true, card: card, Condition)); cardEffects.Add(CardEffectFactory.BlockerStaticEffect(permanentCondition: PermanentCondition, isInheritedEffect: true, card: card, Condition)); } #endregion return cardEffects; } } }