コード例 #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");
    }
コード例 #2
0
    public void Test_FighterGetCurrentAttackDamageCanBeDisplayedWithoutReset()
    {
        FighterStatsClass stats = new FighterStatsClass();

        stats.UseChargeForDamageBoost(true);
        int chargedValueDisplayed = stats.GetCurrentAttackDamage(false);
        int chargedValueForAttack = stats.GetCurrentAttackDamage();
        int resettedValue         = stats.GetCurrentAttackDamage(false);


        Assert.AreEqual(chargedValueDisplayed, chargedValueForAttack, "Displaying the attack damage resetted heavy damage even if it shouldn't have done that!");
        Assert.Less(resettedValue, chargedValueForAttack, "Heavy damage wasn't reset after one attack!");
    }
コード例 #3
0
    public void Test_FighterCanChargeForHeavyDamage()
    {
        FighterStatsClass stats        = new FighterStatsClass();
        int dummyEnemyLifeNormalDamage = 100;
        int dummyEnemyLifeHeavyDamage  = 100;

        dummyEnemyLifeNormalDamage -= stats.GetCurrentAttackDamage();
        stats.UseChargeForDamageBoost(true);
        dummyEnemyLifeHeavyDamage -= stats.GetCurrentAttackDamage();

        Assert.AreNotEqual(dummyEnemyLifeHeavyDamage, dummyEnemyLifeNormalDamage, "Heavy damage and normal attack damage are equal!");
        Assert.Less(dummyEnemyLifeHeavyDamage, dummyEnemyLifeNormalDamage, "Heavy damage wasn't more that normal attack damage!");
    }
コード例 #4
0
    public void Test_FighterChargeHeavyDamageIsRemovedAfterAttack()
    {
        FighterStatsClass stats         = new FighterStatsClass();
        int dummyEnemyLifeNormalDamage1 = 100;
        int dummyEnemyLifeHeavyDamage   = 100;
        int dummyEnemyLifeNormalDamage2 = 100;

        dummyEnemyLifeNormalDamage1 -= stats.GetCurrentAttackDamage();
        stats.UseChargeForDamageBoost(true);
        dummyEnemyLifeHeavyDamage   -= stats.GetCurrentAttackDamage();
        dummyEnemyLifeNormalDamage2 -= stats.GetCurrentAttackDamage();

        Assert.Less(dummyEnemyLifeHeavyDamage, dummyEnemyLifeNormalDamage2, "Heavy damage wasn't more that normal attack damage!");
        Assert.AreEqual(dummyEnemyLifeNormalDamage1, dummyEnemyLifeNormalDamage2, "Heavy damage wasn't reset after one attack!");
    }