There is a function at the beginning of calculating damage that gives a bonus to flanking. If you attack from the front, an attack does 90% damage, and damage increases as you move around, 140% at the sides, and 190% in back. (It's a little more complicated, with the direction of least damage being able to change if you haven't been attacked in a while, so an attack from the right could make the left the sweet spot.)
This function is alone in Unit.cpp and Unit.h, and no other files make any reference to its variables. It's hardcoded to do this, and my searching has not found any reference on the entire spring site. It's not mentioned in any changelogs, and it's not tied to a single tag.
I've tested it, it works. If you want to see for yourself, have a unit attacked by two units in opposite directions (and don't have it attacked by anything else first). One will do twice the damage.<tombom> haha
<tombom> it's been there forever
<tombom> all the lines relating to it are revision 2
Near the top of CUnit::DoDamage
Code: Select all
if(attacker){
SetLastAttacker(attacker);
float3 adir=attacker->pos-pos;
adir.Normalize();
bonusShieldDir+=adir*bonusShieldSaved; //not the best way to do it(but fast)
bonusShieldDir.Normalize();
// logOutput.Print("shield mult %f %f %i %i", 2-adir.dot(bonusShieldDir),bonusShieldSaved,id,attacker->id);
bonusShieldSaved=0;
damage*=1.4f-adir.dot(bonusShieldDir)*0.5f;
}