Code:
// If the enemy is way stronger, a creature may be scared anyway
long long enmstrength,ownstrength;
if (player_creature_tends_to(thing->owner,CrTend_Flee) || (crstat->fear_noflee_factor <= 0)) {
fear = crstat->fear_stronger;
} else {
fear = (long)crstat->fear_stronger * crstat->fear_noflee_factor;
}
enmstrength = calculate_melee_damage(enmtng) * enmtng->health;
ownstrength = calculate_melee_damage(thing) * thing->health;
if (enmstrength >= (fear * ownstrength) / 100)
{
SYNCDBG(8,"The %s is scared due to enemy %s strength (%ld vs. %ld)",thing_model_name(thing),thing_model_name(enmtng),(long)ownstrength,(long)enmstrength);
return true;
I'm a bit concerned about the way the creature strength is calculated here.
1. It only accounts for their health and melee strength.
example
a wizards strength according to this is:
350 * 20 (lvl 1)
while a spiders is
400 * 40 (lvl 1)
now at low levels the spider has a chance of winning, but a level 10 wizard can beat a level 10 spider, yet the code seems to indicate that the wizard should flee?
2. It doesn't seem to account for multiple creatures in the same combat,
so from how I'm reading it
8 lvl 10 mistresses would flee independently from 1 lvl 10 avatar
so perhaps something like this for creature strength instead ?
Code:
skill_strength = sum of damage of all single target abilities (ie fireball, missile, etc + heal )
buff_strength = sum of worth of buffing abilities against given target (rebound, armour, conceal creature)
ie rebound is largely irrelevant against melee fighters while
also should include keeper spells
ownstrength =(1+allied_creature_number/allied_creature_modifier) *(1+ buff_strengths)* ( melee_damage * health + skill_strength)