Originally posted by [b]HiddenDragon[/b]
http://www.eathena.ws/board/index.php?autocom=bugtracker&showbug=3620
Set any castle to 100 defense and have battle_config.castle_defense_rate = 100 (default) and the result is all guardians, plus the emperium itself become invulnerable to damage.
The cause is this little snippet in battle_calc_gvg:
CODE
switch (skill_num) {
//Skills with no damage reduction.
case PA_PRESSURE:
case HW_GRAVITATION:
case NJ_ZENYNAGE:
break;
default:
if (md && md->guardian_data) {
damage -= damage * (md->guardian_data->castle->defense/100) * battle_config.castle_defense_rate/100;
}
It's rather odd because:
1. "(md->guardian_data->castle->defense/100)" normally returns
0 because most of the time, the castle defense is between 0 and 99 which means this division equates to zero (integer division discards decimal remainders) as a result of order of operations. Hence, most of the time defense investment in castles produces no benefit in damage reduction so it's unnecessary at all o_O.
2. Second, if the defense is 100 and battle_config.castle_defense_rate is also set to 100 (as is default on eAthena), the line becomes:
CODE
damage -= damage * 1 * 1;
Thus, the damage is
completely negated and both guardians and emperium are invulnerable to damage (except via those three skills).
Is this line even official behavior? It was added to stable wayyyyyyy back in
r699 by celest.