summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-05-29 16:01:02 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-05-29 16:01:02 +0000
commit6277250d56cf88f1ec22ac20816d887089ebda45 (patch)
treeb7416ccbbfbf054ed23687ce37073b5555db34f3 /src
parent874e073947a9f3ef07f1d93338c0875a086afb85 (diff)
downloadhercules-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
Diffstat (limited to 'src')
-rw-r--r--src/map/mob.c8
-rw-r--r--src/map/status.c10
2 files changed, 10 insertions, 8 deletions
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);
}