using System; using System.Collections; using System.Collections.Generic; // Antylamon namespace DCGO.CardEffects.BT23 { public class BT23_029 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Alternative Digivolution Condition if (timing == EffectTiming.None) { bool PermanentCondition(Permanent targetPermanent) { return targetPermanent.TopCard.EqualsCardName("Turuiemon") || targetPermanent.TopCard.EqualsCardName("Wendigomon") || (targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.IsLevel4 && targetPermanent.TopCard.HasCSTraits); } cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect( permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null) ); } #endregion #region Alliance if (timing == EffectTiming.OnAllyAttack) { cardEffects.Add(CardEffectFactory.AllianceSelfEffect(isInheritedEffect: false, card: card, condition: null)); } #endregion #region All Turns - OPT if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("1 digimon gains can't activate [When Digivolving] effects.", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription()); activateClass.SetHashString("BT23_029_AT"); cardEffects.Add(activateClass); string EffectDiscription() { return "[All Turns] [Once Per Turn] When any of your cards with the [Beast], [Beastkin] or [CS] trait are played, until your opponent's turn ends, 1 of their Digimon can't activate [When Digivolving] effects."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card); } bool PermanentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card) && (permanent.IsTamer || permanent.IsDigimon) && (permanent.TopCard.EqualsTraits("Beast") || permanent.TopCard.EqualsTraits("Beastkin") || permanent.TopCard.HasCSTraits); } bool IsOpponentsDigimon(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card); } IEnumerator ActivateCoroutine(Hashtable hashtable) { if (CardEffectCommons.HasMatchConditionPermanent(IsOpponentsDigimon)) { Permanent selectedPermanent = null; SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(IsOpponentsDigimon)); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: IsOpponentsDigimon, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: maxCount, canNoSelect: false, canEndNotMax: false, selectPermanentCoroutine: SelectedPermanent, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Custom, cardEffect: activateClass); IEnumerator SelectedPermanent(Permanent target) { selectedPermanent = target; yield return null; } selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will gain cant activate [When Digivolving] effects.", "The opponent is selecting 1 Digimon that will gain cant activate [When Digivolving] effects."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); if (selectedPermanent != null) { DisableEffectClass invalidationClass = new DisableEffectClass(); invalidationClass.SetUpICardEffect("Ignore [When Digivolving] Effect", CanUseConditionDebuff, card); invalidationClass.SetUpDisableEffectClass(DisableCondition: InvalidateCondition); selectedPermanent.UntilOwnerTurnEndEffects.Add(_ => invalidationClass); bool CanUseConditionDebuff(Hashtable hashtableDebuff) { return true; } bool InvalidateCondition(ICardEffect cardEffect) { if (selectedPermanent.TopCard != null) { if (cardEffect != null) { if (cardEffect.EffectSourceCard != null) { if (isExistOnField(cardEffect.EffectSourceCard)) { if (cardEffect.EffectSourceCard.PermanentOfThisCard() == selectedPermanent) { if (cardEffect.IsWhenDigivolving) { if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass)) { return true; } } } } } } } return false; } } } } } #endregion #region All Turns - ESS - OPT if (timing == EffectTiming.OnTappedAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("-4k DP", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription()); activateClass.SetIsInheritedEffect(true); activateClass.SetHashString("BT23_029_ESS"); cardEffects.Add(activateClass); string EffectDiscription() { return "[All Turns] [Once Per Turn] When any of your other Digimon suspend, 1 of your opponent's Digimon gets -4000 DP for the turn."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, IsYourDigimon); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card); } bool IsYourDigimon(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) && permanent != card.PermanentOfThisCard(); } bool CanSelectPermanentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card); } IEnumerator ActivateCoroutine(Hashtable hashtable) { if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition)) { Permanent selectedPermament = null; SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition)); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectPermanentCondition, 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) { selectedPermament = permanent; yield return null; } selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to -4k DP.", "The opponent is selecting 1 Digimon to -4k DP."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); if (selectedPermament != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP( targetPermanent: selectedPermament, changeValue: -4000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass)); } } } #endregion return cardEffects; } } }