コード例 #1
0
        public List <Ability> GetAllActiveAbilities(GameField game, Player caster, Player opponent)
        {
            var abilities           = new List <Ability>();
            var areAbilitiesBlocked = game == null ? false : game.IsAbilitiesBlocked();


            if (Ability != null && game != null && !areAbilitiesBlocked && Ability.CanActivate(game, caster, opponent))
            {
                abilities.Add(Ability);
            }

            if (game != null)
            {
                abilities.AddRange(game.TemporaryPassiveAbilities);
            }

            abilities.AddRange(TemporaryAbilities.Where(x => x.CanActivate(game, caster, opponent)).ToList());

            return(abilities);
        }
コード例 #2
0
        public virtual void EndTurn(GameField game)
        {
            if (TemporaryAbilities == null)
            {
                TemporaryAbilities = new List <Ability>();
            }

            foreach (var ability in TemporaryAbilities)
            {
                ability.EndTurn();

                if (ability.TurnDuration <= 0)
                {
                    ability.OnDestroyed(game);
                }
            }

            TemporaryAbilities = TemporaryAbilities.Where(x => x.TurnDuration > 0).ToList();
            foreach (var attack in Attacks)
            {
                attack.DamageModifier?.ReduceTurnCount();

                if (attack.DamageModifier != null && attack.DamageModifier.TurnsLeft <= 0)
                {
                    attack.DamageModifier = null;
                }

                foreach (var effect in attack.Effects.OfType <DamageEffect>())
                {
                    effect.DamageModifier?.ReduceTurnCount();
                }
            }

            PlayedThisTurn  = false;
            EvolvedThisTurn = false;

            if (!ParalyzedThisTurn)
            {
                IsParalyzed = false;
            }

            if (IsBurned)
            {
                DealDamage(20, game, new PokemonCard()
                {
                    Type = EnergyTypes.Fire
                }, false);
                IsBurned = game.FlipCoins(1) == 0;
            }

            if (IsPoisoned)
            {
                DealDamage(DoublePoison ? 20 : 10, game, new PokemonCard()
                {
                    Type = EnergyTypes.Psychic
                }, false);
            }

            if (IsAsleep)
            {
                IsAsleep = game.FlipCoins(1) == 0;
            }

            if (Ability != null)
            {
                Ability.UsedTimes = 0;
                Ability.EndTurn();
            }

            ParalyzedThisTurn = false;

            AttachedTools = AttachedTools.Where(tool => !Owner.DiscardPile.Contains(tool)).ToList();

            foreach (var damagestopper in DamageStoppers)
            {
                if (!damagestopper.LastsUntilDamageTaken)
                {
                    damagestopper.TurnsLeft--;
                }
            }

            DamageStoppers = DamageStoppers.Where(x => x.TurnsLeft > 0).ToList();
        }