Exemplo n.º 1
0
    private void ApplyDamage(AttributesTable newAttributes)
    {
        int damage   = newAttributes.Get(BattalionAttribute.Damage);
        int apDamage = newAttributes.Get(BattalionAttribute.ArmorPiercingDamage);
        int armor    = newAttributes.Get(BattalionAttribute.Armor);

        newAttributes.Set(BattalionAttribute.Damage, 0);
        newAttributes.Set(BattalionAttribute.ArmorPiercingDamage, 0);

        int hitpointDamage = Mathf.Max(0, damage - armor) + apDamage;

        newAttributes.Add(BattalionAttribute.RemainingHitpoints, -hitpointDamage);
    }
Exemplo n.º 2
0
    private void ApplyHealing(AttributesTable newAttributes)
    {
        int hitpoints = newAttributes.Get(BattalionAttribute.RemainingHitpoints);

        if (hitpoints > 0) // Can't heal the dead
        {
            int regeneration = newAttributes.Get(BattalionAttribute.Regeneration);
            int maxHitpoints = newAttributes.Get(BattalionAttribute.MaxHitpoints);
            int newHitpoints = Mathf.Min(maxHitpoints, hitpoints + regeneration);
            newAttributes.Set(BattalionAttribute.RemainingHitpoints, newHitpoints);
        }
    }