Exemplo n.º 1
0
        public void PokemonShouldFaint()
        {
            IPokemon pokemon = PokemonFactory.CreatePokemon <Pikachu>();

            pokemon?.ReceiveDamage((int)pokemon?.TotalHealthPoints);
            Assert.True(pokemon?.HasFainted());
        }
Exemplo n.º 2
0
        public void PokemonShouldReceiveDamage()
        {
            IPokemon pokemon = PokemonFactory.CreatePokemon <Eevee>();

            pokemon?.ReceiveDamage(10);
            Assert.True(pokemon?.CurrentHealthPoints < pokemon.TotalHealthPoints);
        }
Exemplo n.º 3
0
        private static void ProcessAttack(IPokemon attackingPokemon, IPokemon targetPokemon, IMove move)
        {
            TypeEffect moveEffectOnPokemon = TypeComparer.GetMoveEffectivenessBasedOnPokemonType(move.Type, targetPokemon.Types.FirstOrDefault());

            int calculatedDamage = TypeDamageCalculator.CalculateDamage(attackingPokemon, targetPokemon, move, moveEffectOnPokemon);

            attackingPokemon.UseMove(move);

            if (move.StatusMoves != null)
            {
                BattleAux.ProcessStatusAttack(attackingPokemon, targetPokemon, move);
            }
            else
            {
                targetPokemon.ReceiveDamage(calculatedDamage);
                ConsoleBattleInfoPokemon.ShowPokemonReceivedDamage(targetPokemon, calculatedDamage);
                ConsoleBattleInfoTypes.ShowHowEffectiveTheMoveWas(moveEffectOnPokemon);
            }
        }