diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-05-29 16:01:02 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-05-29 16:01:02 +0000 |
commit | 6277250d56cf88f1ec22ac20816d887089ebda45 (patch) | |
tree | b7416ccbbfbf054ed23687ce37073b5555db34f3 | |
parent | 874e073947a9f3ef07f1d93338c0875a086afb85 (diff) | |
download | hercules-6277250d56cf88f1ec22ac20816d887089ebda45.tar.gz hercules-6277250d56cf88f1ec22ac20816d887089ebda45.tar.bz2 hercules-6277250d56cf88f1ec22ac20816d887089ebda45.tar.xz hercules-6277250d56cf88f1ec22ac20816d887089ebda45.zip |
- Added a division by zero check in mob_dead to prevent the (impossible) case where a mob dies with received damage of zero.
- Fixed compilation errors with SC_FLING...
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6821 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r-- | Changelog-Trunk.txt | 2 | ||||
-rw-r--r-- | src/map/mob.c | 8 | ||||
-rw-r--r-- | src/map/status.c | 10 |
3 files changed, 12 insertions, 8 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 029a2b217..734c660c4 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -4,6 +4,8 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2006/05/29
+ * Added a division by zero check in mob_dead to prevent the (impossible)
+ case where a mob dies with received damage of zero. [Skotlex]
* Modified skill_get_range2 to return range 9 for skills with range 0 for
Non-Players. This usually signals Self skills, and mobs/pets should be able
to use them in other characters. [Skotlex]
diff --git a/src/map/mob.c b/src/map/mob.c index f564878ea..677e7fbd3 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -1768,10 +1768,12 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) double per; //Your share of the mob's exp int bonus; //Bonus on top of your share. - if (battle_config.exp_calc_type) // eAthena's exp formula based on max hp. - per = (double)md->dmglog[i].dmg/(double)status->max_hp; - else //jAthena's exp formula based on total damage. + if (!battle_config.exp_calc_type && md->tdmg) + //jAthena's exp formula based on total damage. per = (double)md->dmglog[i].dmg/(double)md->tdmg; + else + //eAthena's exp formula based on max hp. + per = (double)md->dmglog[i].dmg/(double)status->max_hp; if (count>1) per *= (9.+(double)((count > 6)? 6:count))/10.; //attackers count bonus. diff --git a/src/map/status.c b/src/map/status.c index be465d848..ab391e092 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -344,7 +344,7 @@ void initChangeTables(void) { set_sc(GS_ADJUSTMENT, SC_ADJUSTMENT, SI_ADJUSTMENT, SCB_HIT|SCB_FLEE); set_sc(GS_INCREASING, SC_INCREASING, SI_ACCURACY, SCB_AGI|SCB_DEX|SCB_HIT); set_sc(GS_GATLINGFEVER, SC_GATLINGFEVER, SI_GATLINGFEVER, SCB_FLEE|SCB_SPEED|SCB_ASPD); - set_sc(GS_FLING, SC_FLING, SI_NONE, SCB_DEF|SCB_DEF2); + set_sc(GS_FLING, SC_FLING, SI_BLANK, SCB_DEF|SCB_DEF2); //Uncomment and update when you plan on implementing. // set_sc(NJ_TATAMIGAESHI, SC_TATAMIGAESHI, SI_BLANK); @@ -2889,8 +2889,8 @@ static unsigned char status_calc_def(struct block_list *bl, struct status_change def -= def * sc->data[SC_PROVOKE].val4/100; if(sc->data[SC_STRIPSHIELD].timer!=-1) def -= def * sc->data[SC_STRIPSHIELD].val2/100; - if (sd->data[SC_FLING].timer!=-1) - def -= def * (sd->data[SC_FLING].val2)/100; + if (sc->data[SC_FLING].timer!=-1) + def -= def * (sc->data[SC_FLING].val2)/100; return cap_value(def,0,UCHAR_MAX); } @@ -2921,8 +2921,8 @@ static unsigned short status_calc_def2(struct block_list *bl, struct status_chan else if(sc->data[SC_JOINTBEAT].val2==4) def2 -= def2 * 25/100; } - if (sd->data[SC_FLING].timer!=-1) - def2 -= def2 * (sd->data[SC_FLING].val3)/100; + if(sc->data[SC_FLING].timer!=-1) + def2 -= def2 * (sc->data[SC_FLING].val3)/100; return cap_value(def2,0,USHRT_MAX); } |