Beispiel #1
0
    public void Test_FighterCanChargeUpToThreeTimesButNotMore()
    {
        FighterStatsClass stats = new FighterStatsClass();
        int normalAttackValue   = stats.GetCurrentAttackDamage(false);

        stats.UseChargeForDamageBoost(true);
        int firstBoostValue = stats.GetCurrentAttackDamage(false);

        stats.UseChargeForDamageBoost(true);
        int secondBoostValue = stats.GetCurrentAttackDamage(false);

        stats.UseChargeForDamageBoost(true);
        int thirdBoostValue = stats.GetCurrentAttackDamage(false);

        stats.UseChargeForDamageBoost(true);
        int forthBoostValue = stats.GetCurrentAttackDamage(false);

        // TODO: Rechnung irgendwie hier rausziehen?
        int expectedDamage = Mathf.FloorToInt(stats.GetDefaultAttackDamage() * (1 + stats.GetMaxAmountOfChargings() * stats.GetChargeDamageBoost()));

        Assert.Less(normalAttackValue, firstBoostValue, "First charge for damage boost didn't increase damage!");
        Assert.Less(firstBoostValue, secondBoostValue, "Second charge for damage boost didn't increase damage!");
        Assert.Less(secondBoostValue, thirdBoostValue, "Third charge for damage boost didn't increase damage!");
        Assert.AreEqual(thirdBoostValue, forthBoostValue, "Forth charge for damage boost increased damage, but three boosts is the maximum!");
        Assert.AreEqual(expectedDamage, thirdBoostValue, "Fighter didn't deal 3x boost damage after trying to boost 4 times");
    }