diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-08-03 17:15:24 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-08-03 17:15:24 +0000 |
commit | 118828fdec8881c696c3fe70cf07c1115565638a (patch) | |
tree | 5cc6a306b4c807a97d21001c4a447b389e869288 | |
parent | 5794cdd9927a30bb094a144f052dec4883b62412 (diff) | |
download | hercules-118828fdec8881c696c3fe70cf07c1115565638a.tar.gz hercules-118828fdec8881c696c3fe70cf07c1115565638a.tar.bz2 hercules-118828fdec8881c696c3fe70cf07c1115565638a.tar.xz hercules-118828fdec8881c696c3fe70cf07c1115565638a.zip |
- Added a damage cap to CR_ACIDDEMONSTRATION of INT_MAX/2 to prevent overflows. It is not capped to INT_MAX because damage increasing skills would cause it to still over flow afterwards.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@8107 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r-- | Changelog-Trunk.txt | 3 | ||||
-rw-r--r-- | src/map/battle.c | 4 |
2 files changed, 7 insertions, 0 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 945d2ad21..06835a1c8 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -3,6 +3,9 @@ Date Added AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2006/08/03
+ * Added a damage cap to CR_ACIDDEMONSTRATION of INT_MAX/2 to prevent
+ overflows. It is not capped to INT_MAX because damage increasing skills
+ would cause it to still overflow afterwards. [Skotlex]
* Fixed NPC_CRITICALSLASH not being considered as a Critical hit by the
code. [Skotlex]
* Added RUDE_ATTACKED_COUNT so you can easily adjust how many rude-attacks
diff --git a/src/map/battle.c b/src/map/battle.c index 0e53bb9e8..7a7a1d58b 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -2620,6 +2620,10 @@ struct Damage battle_calc_misc_attack( case CR_ACIDDEMONSTRATION: // updated the formula based on a Japanese formula found to be exact [Reddozen] md.damage = 7*tstatus->vit*sstatus->int_*sstatus->int_ / (10*(tstatus->vit+sstatus->int_)); if (tsd) md.damage>>=1; + if (md.damage < 0 || md.damage > INT_MAX>>1) + //Overflow prevention, will anyone whine if I cap it to a few billion? + //Not capped to INT_MAX to give some room for further damage increase. + md.damage = INT_MAX>>1; break; case NJ_ZENYNAGE: md.damage = skill_get_zeny(skill_num ,skill_lv); |