Esempio n. 1
0
    public static int calculateDamage(double movePower, CreatureStats sourceCreature, CreatureStats receivingCreature)
    {
        int attackerSTR = sourceCreature.getStat(StatName.STR);
        int defenderARM = receivingCreature.getStat(StatName.ARM);

        return((int)(movePower + (attackerSTR - defenderARM)));
    }
Esempio n. 2
0
        public void testGetCreatureStatsWithMods()
        {
            List <Pair <StatName, StatModifier> > mods = new List <Pair <StatName, StatModifier> >();

            mods.Add(new Pair <StatName, StatModifier>(StatName.STR, new StatModifier(10, 1)));
            mods.Add(new Pair <StatName, StatModifier>(StatName.STR, new StatModifier(30, 2)));
            mods.Add(new Pair <StatName, StatModifier>(StatName.ARM, new StatModifier(0, 3)));
            mods.Add(new Pair <StatName, StatModifier>(StatName.SPD, new StatModifier(10, 0.5)));
            mods.Add(new Pair <StatName, StatModifier>(StatName.SPD, new StatModifier(-20, 0.25)));

            CreatureStats result = testBase.getStatsWithMods(mods);

            Assert.That(result.getStat(StatName.HP) == 100);
            Assert.That(result.getStat(StatName.STR) == 280);
            Assert.That(result.getStat(StatName.ARM) == 300);
            Assert.That(result.getStat(StatName.SPD) == (int)(90 * 0.5 * 0.25));
        }