diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-05-30 04:07:27 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-05-30 04:07:27 +0000 |
commit | 6343274ad8e270888df854926bc47a0bc5713f47 (patch) | |
tree | c33b3baa689b1f352ed75fc57ba7645bd1edce78 /src/map/status.c | |
parent | cf4023f83aa1e2f5ed3009f0e7d020e387d6ef57 (diff) | |
download | hercules-6343274ad8e270888df854926bc47a0bc5713f47.tar.gz hercules-6343274ad8e270888df854926bc47a0bc5713f47.tar.bz2 hercules-6343274ad8e270888df854926bc47a0bc5713f47.tar.xz hercules-6343274ad8e270888df854926bc47a0bc5713f47.zip |
- Changed status_heal and status_damage to receive signed int values. They will invoke each other as needed when the passed values are negative.
- Updated battle_calc_attack to set atk type to ATK_FLEE and dmotion to 0 when the damage is less than 1 (missed or absorbed)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6832 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/status.c')
-rw-r--r-- | src/map/status.c | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/src/map/status.c b/src/map/status.c index 3d574d314..952045c33 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -467,7 +467,7 @@ int status_getrefinebonus(int lv,int type) //If flag&1, damage is passive and does not triggers cancelling status changes. //If flag&2, fail if target does not has enough to substract. //If flag&4, if killed, mob must not give exp/loot. -int status_damage(struct block_list *src,struct block_list *target,unsigned int hp, unsigned sp, int walkdelay, int flag) +int status_damage(struct block_list *src,struct block_list *target,int hp, int sp, int walkdelay, int flag) { struct status_data *status; struct status_change *sc; @@ -475,8 +475,19 @@ int status_damage(struct block_list *src,struct block_list *target,unsigned int if(sp && target->type != BL_PC) sp = 0; //Only players get SP damage. + if (hp < 0) { //Assume absorbed damage. + status_heal(target, -hp, 0, 1); + hp = 0; + } + + if (sp < 0) { + status_heal(target, 0, -sp, 1); + sp = 0; + } + if (!hp && !sp) return 0; + if (target->type == BL_SKILL) return skill_unit_ondamaged((struct skill_unit *)target, src, hp, gettick()); @@ -586,7 +597,7 @@ int status_damage(struct block_list *src,struct block_list *target,unsigned int //Heals a character. If flag&1, this is forced healing (otherwise stuff like Berserk can block it) //If flag&2, when the player is healed, show the HP/SP heal effect. -int status_heal(struct block_list *bl,unsigned int hp,unsigned int sp, int flag) +int status_heal(struct block_list *bl,int hp,int sp, int flag) { struct status_data *status; struct status_change *sc; @@ -599,15 +610,26 @@ int status_heal(struct block_list *bl,unsigned int hp,unsigned int sp, int flag) sc = status_get_sc(bl); if (sc && !sc->count) sc = NULL; + + if (hp < 0) { + status_damage(NULL, bl, -hp, 0, 0, 1); + hp = 0; + } if(hp) { if (!(flag&1) && sc && sc->data[SC_BERSERK].timer!=-1) hp = 0; - + + if(hp > status->max_hp - status->hp) hp = status->max_hp - status->hp; } - + + if(sp < 0) { + status_damage(NULL, bl, 0, -sp, 0, 1); + sp = 0; + } + if(sp) { if(sp > status->max_sp - status->sp) sp = status->max_sp - status->sp; |