Ejemplo n.º 1
0
        public void TestDamageCalculation()
        {
            PokemonEngine.Model.Battle.Team team1 = Helper.ConstructTeam("Trainer1", 10, 1);
            PokemonEngine.Model.Battle.Team team2 = Helper.ConstructTeam("Trainer2", 10, 1);

            NumberSequence sequence = new NumberSequence();

            sequence.Add(1.0); // No Critical Hit
            sequence.Add(0);   // Maximum Damage

            IBattle battle = new Battle(sequence, NoOpInputProvider.Instance, PokemonEngine.Model.Weather.ClearSkies, team1, team2);
            List <PokemonEngine.Model.Battle.Slot> targets = new List <PokemonEngine.Model.Battle.Slot> {
                team2[0]
            };
            InflictMoveDamage inflictDamage = new InflictMoveDamage(battle, team1[0].Pokemon.Moves[0], team1[0], targets);

            Assert.AreEqual(1.0f, inflictDamage.STABModifier);
            Assert.AreEqual(1.0f, inflictDamage.TypeModifier(targets[0]));
            Assert.AreEqual(6.0f, inflictDamage.LevelInfluence);

            Assert.AreEqual(1.0f, inflictDamage.TargetsModifier);
            Assert.AreEqual(1.0f, inflictDamage.RandomModifier);
            Assert.AreEqual(1.0f, inflictDamage.Modifier(targets[0]));

            Assert.AreEqual(7, inflictDamage.CalculateDamage(targets[0]));

            team1[0].Pokemon.Stats.ShiftStage(PokemonEngine.Model.Battle.Statistic.Attack, -1);
            sequence = new NumberSequence();
            sequence.Add(1.0); // No Critical Hit
            sequence.Add(15);  // Minimum Damage
            battle        = new Battle(sequence, NoOpInputProvider.Instance, PokemonEngine.Model.Weather.ClearSkies, team1, team2);
            inflictDamage = new InflictMoveDamage(battle, team1[0].Pokemon.Moves[0], team1[0], targets);

            Assert.AreEqual(9, team1[0].Pokemon.Stats[PokemonEngine.Model.Statistic.Attack]);
            Assert.AreEqual(0.85f, inflictDamage.RandomModifier);
            Assert.AreEqual(4, inflictDamage.CalculateDamage(targets[0]));

            sequence = new NumberSequence();
            sequence.Add(1.0); // No Critical Hit
            sequence.Add(0);   // Maximum Damage
            battle        = new Battle(sequence, NoOpInputProvider.Instance, PokemonEngine.Model.Weather.ClearSkies, team1, team2);
            inflictDamage = new InflictMoveDamage(battle, team1[0].Pokemon.Moves[0], team1[0], targets);

            Assert.AreEqual(9, team1[0].Pokemon.Stats[PokemonEngine.Model.Statistic.Attack]);
            Assert.AreEqual(1.0f, inflictDamage.RandomModifier);
            Assert.AreEqual(5, inflictDamage.CalculateDamage(targets[0]));
        }
Ejemplo n.º 2
0
 public BattleEndEventArgs(IBattle battle, Team winner) : base(battle)
 {
     Winner = winner;
 }