summaryrefslogtreecommitdiff
path: root/src/map/pet.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-02-21 10:36:26 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-02-21 10:36:26 +0000
commitc6b0361bd56ee72df8b9b3ee7eca824e0619d407 (patch)
tree8a178d1eff82e4329685dd8130c9b2364412ce4f /src/map/pet.c
parent095fe33b1d22e4bc821847b968ac508a983ae50b (diff)
downloadhercules-c6b0361bd56ee72df8b9b3ee7eca824e0619d407.tar.gz
hercules-c6b0361bd56ee72df8b9b3ee7eca824e0619d407.tar.bz2
hercules-c6b0361bd56ee72df8b9b3ee7eca824e0619d407.tar.xz
hercules-c6b0361bd56ee72df8b9b3ee7eca824e0619d407.zip
- Added status_calc_life to properly calculate hp/max_hp as a ratio taking into accounts overflows (and for now also avoids divisions by 0). Applied this function around clif.c, mob.c and pet.c
- Implemented the correct walk-speed bonus from the Bard/Dancer spirit. - Added a few error messages in case something goes wrong in the new auth db system. - Fixed logarithmic drops turning 0% drop rates into 100%. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12225 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/pet.c')
-rw-r--r--src/map/pet.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/map/pet.c b/src/map/pet.c
index a792924f5..f413863a0 100644
--- a/src/map/pet.c
+++ b/src/map/pet.c
@@ -554,7 +554,8 @@ int pet_catch_process2(struct map_session_data* sd, int target_id)
return 1;
}
- pet_catch_rate = (pet_db[i].capture + (sd->status.base_level - md->level)*30 + sd->battle_status.luk*20)*(200 - md->status.hp*100/md->status.max_hp)/100;
+ pet_catch_rate = (pet_db[i].capture + (sd->status.base_level - md->level)*30 + sd->battle_status.luk*20)*(200 - status_calc_life(md->status.hp, md->status.max_hp))/100;
+
if(pet_catch_rate < 1) pet_catch_rate = 1;
if(battle_config.pet_catch_rate != 100)
pet_catch_rate = (pet_catch_rate*battle_config.pet_catch_rate)/100;
@@ -1161,8 +1162,8 @@ int pet_heal_timer(int tid,unsigned int tick,int id,int data)
status = status_get_status_data(&sd->bl);
if(pc_isdead(sd) ||
- (rate = status->sp*100/status->max_sp) > pd->s_skill->sp ||
- (rate = status->hp*100/status->max_hp) > pd->s_skill->hp ||
+ (rate = status_calc_life(status->sp, status->max_sp)) > pd->s_skill->sp ||
+ (rate = status_calc_life(status->hp, status->max_hp)) > pd->s_skill->hp ||
(rate = (pd->ud.skilltimer != -1)) //Another skill is in effect
) { //Wait (how long? 1 sec for every 10% of remaining)
pd->s_skill->timer=add_timer(gettick()+(rate>10?rate:10)*100,pet_heal_timer,sd->bl.id,0);
@@ -1204,8 +1205,8 @@ int pet_skill_support_timer(int tid,unsigned int tick,int id,int data)
}
if(pc_isdead(sd) ||
- (rate = status->sp*100/status->max_sp) > pd->s_skill->sp ||
- (rate = status->hp*100/status->max_hp) > pd->s_skill->hp ||
+ (rate = status_calc_life(status->sp, status->max_sp)) > pd->s_skill->sp ||
+ (rate = status_calc_life(status->hp, status->max_hp)) > pd->s_skill->hp ||
(rate = (pd->ud.skilltimer != -1)) //Another skill is in effect
) { //Wait (how long? 1 sec for every 10% of remaining)
pd->s_skill->timer=add_timer(tick+(rate>10?rate:10)*100,pet_skill_support_timer,sd->bl.id,0);