Exemplo n.º 1
0
    public void GroupCombatRound(Warrior w1, List <Warrior> group)
    {
        roundCounter += 1;
        int attackValueW1  = w1.CalcAttack(rnd);
        int defenceValueG1 = group[0].CalcDefence(rnd);

        if (attackValueW1 > defenceValueG1)
        {
            int currentDam = w1.CalcDamage(rnd);
            group[0].TakeDamage(currentDam);
            PrintHitAttack(w1, group[0], currentDam);
        }
        else
        {
            PrintParry(w1, group[0]);
        }
        for (int i = 0; i < group.Count; i++)
        {
            if (group[0].CalcAttack(rnd) > w1.CalcDefenceMultibleOpponents(rnd, group.Count))
            {
                int currentDam = group[0].CalcDamage(rnd);
                w1.TakeDamage(currentDam);
                PrintHitAttack(group[i], w1, currentDam);
            }
            else
            {
                PrintParry(group[i], w1);
            }
        }
        print("b4 dead members are removed");
        RemoveDeadMembers(group);
        print("dead members removed. " + group.Count + " members left");
        GroupCombatOverCheck(w1, group, false);
    }
Exemplo n.º 2
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);
    }