Beispiel #1
0
        public List <IDamageTakenModifier> GetGlobalDamageTakenModifiers()
        {
            var modifiers = new List <IDamageTakenModifier>();

            foreach (var pokemon in ActivePlayer.GetAllPokemonCards())
            {
                modifiers.AddRange(pokemon.GetAllActiveAbilities(this, ActivePlayer, NonActivePlayer).OfType <DamageTakenModifier>().Where(a => a.IsGlobal));
            }
            foreach (var pokemon in NonActivePlayer.GetAllPokemonCards())
            {
                modifiers.AddRange(pokemon.GetAllActiveAbilities(this, ActivePlayer, NonActivePlayer).OfType <DamageTakenModifier>().Where(a => a.IsGlobal));
            }

            return(modifiers);
        }
Beispiel #2
0
        public void PokemonRetreated(PokemonCard replacementCard, List <EnergyCard> payedEnergy)
        {
            if (!ActivePlayer.Id.Equals(replacementCard.Owner.Id))
            {
                return;
            }

            if (!CanRetreat(ActivePlayer.ActivePokemonCard))
            {
                GameLog.AddMessage("Tried to retreat but did not have enough energy");
                return;
            }

            foreach (var pokemon in NonActivePlayer.GetAllPokemonCards())
            {
                TriggerAbilityOfType(TriggerType.OpponentRetreats, pokemon, 0, ActivePlayer.ActivePokemonCard);
            }

            ActivePlayer.RetreatActivePokemon(replacementCard, new List <EnergyCard>(payedEnergy), this);
            CheckDeadPokemon();
        }
Beispiel #3
0
        public List <PassiveAbility> GetAllPassiveAbilities()
        {
            var passiveAbilities = new List <PassiveAbility>();

            if (ActivePlayer != null)
            {
                passiveAbilities.AddRange(ActivePlayer.GetAllPokemonCards().Where(p => p.Ability != null).Select(pokemon => pokemon.Ability).OfType <PassiveAbility>());
            }
            if (NonActivePlayer != null)
            {
                passiveAbilities.AddRange(NonActivePlayer.GetAllPokemonCards().Where(p => p.Ability != null).Select(pokemon => pokemon.Ability).OfType <PassiveAbility>());
            }

            if (StadiumCard != null && StadiumCard.Ability is PassiveAbility)
            {
                passiveAbilities.Add((PassiveAbility)StadiumCard.Ability);
            }

            passiveAbilities.AddRange(TemporaryPassiveAbilities.OfType <PassiveAbility>());

            if (passiveAbilities.Any(ability => ability.ModifierType == PassiveModifierType.NoPokemonPowers))
            {
                return new List <PassiveAbility>()
                       {
                           passiveAbilities.First(ability => ability.ModifierType == PassiveModifierType.NoPokemonPowers)
                       }
            }
            ;

            var idOfStopper = passiveAbilities.FirstOrDefault(x => x.ModifierType == PassiveModifierType.StopAbilities);

            if (idOfStopper != null)
            {
                return(passiveAbilities.Where(x => x.Id.Equals(idOfStopper) || x.IsBuff).ToList());
            }

            return(passiveAbilities.Where(a => a.CanActivate(this, a.GetActivator(ActivePlayer), GetOpponentOf(a.GetActivator(ActivePlayer)))).ToList());
        }