Esempio n. 1
0
    public void Fight(ICombatable attacker, ICombatable defender)
    {
        int damage = CalculateAttackerDamage(attacker, defender);

        attacker.OnAttack(defender);
        attacker.CurrentActionPoints -= attacker.AttackActionPointCost;
        defender.CurrentHealth       -= damage;

        if (defender.CurrentHealth <= 0)
        {
            defender.OnDeath();
        }
        else if (defender.CanRetaliate())
        {
            int dist = HexHeuristic.MinDistTile(defender.Tile, attacker.Tile);
            if (dist > defender.Range)
            {
                return;
            }

            damage = CalculateDefenderDamage(defender);
            defender.OnAttack(attacker);
            attacker.CurrentHealth -= damage;
            if (attacker.CurrentHealth <= 0)
            {
                attacker.OnDeath();
            }
        }
    }
Esempio n. 2
0
    public void Fight(ICombatable attacker, ICombatable defender)
    {
        int damage = CalculateAttackerDamage(attacker, defender);

        attacker.OnAttack(defender);
        attacker.CurrentActionPoints -= attacker.AttackActionPointCost;
        defender.CurrentHealth       -= damage;

        if (defender.CurrentHealth <= 0)
        {
            defender.OnDeath();
        }
    }