Exemplo n.º 1
0
    // The body of combat rounds. Ends in CombatOverCheck()
    public void CombatRound(Warrior w1, Warrior w2)
    {
        roundCounter += 1;
        int attackValueW1  = w1.CalcAttack(rnd);
        int attackValueW2  = w2.CalcAttack(rnd);
        int defenceValueW1 = w1.CalcDefence(rnd);
        int defenceValueW2 = w2.CalcDefence(rnd);

        if (attackValueW1 > defenceValueW2)
        {
            int currentDam = w1.CalcDamage(rnd);
            w2.TakeDamage(currentDam);
            PrintHitAttack(w1, w2, currentDam);
        }
        else
        {
            PrintParry(w1, w2);
        }

        if (attackValueW2 > defenceValueW1)
        {
            int currentDam = w2.CalcDamage(rnd);
            w1.TakeDamage(currentDam);
            PrintHitAttack(w2, w1, currentDam);
        }
        else
        {
            PrintParry(w2, w1);
        }
        CombatOverCheck(w1, w2, false);
    }