summaryrefslogtreecommitdiff
path: root/src/map/status.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-07 20:23:52 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-07 20:23:52 +0000
commit0224ba74aa451f4103974ea860815683f70c4ef7 (patch)
tree4a3acaa349df1378a0ac41f8f5210de9821d1af9 /src/map/status.c
parent485a54dba08b7899002f3c9321f49af722a6a0d2 (diff)
downloadhercules-0224ba74aa451f4103974ea860815683f70c4ef7.tar.gz
hercules-0224ba74aa451f4103974ea860815683f70c4ef7.tar.bz2
hercules-0224ba74aa451f4103974ea860815683f70c4ef7.tar.xz
hercules-0224ba74aa451f4103974ea860815683f70c4ef7.zip
- Moved the devotion damage reduction to the block that only executes if flag is zero in battle_damage.
- skill_castcancel won't trigger on battle_damage when the passed flag is 1 - The flag in battle_heal is now used to determine whether Berserk blocks the healing or not. - Moved the Fusion HP penalty to battle_calc_weapon_attack - Some cleaning to use battle_heal/damage rather than pc_heal/damage where appropiate. - cleaned up the deadly-poison hp reduction code. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5949 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/status.c')
-rw-r--r--src/map/status.c39
1 files changed, 12 insertions, 27 deletions
diff --git a/src/map/status.c b/src/map/status.c
index 86fc8fb29..336b9165d 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -4113,21 +4113,12 @@ int status_change_start(struct block_list *bl,int type,int rate,int val1,int val
int hp = status_get_hp(bl);
int mhp = status_get_max_hp(bl);
- // MHP?1/4????????
+ //Lose 10/15% of your life as long as it doesn't brings life below 25%
if (hp > mhp>>2) {
- if(bl->type == BL_PC) {
- int diff = mhp*10/100;
- if (hp - diff < mhp>>2)
- diff = hp - (mhp>>2);
- pc_heal((struct map_session_data *)bl, -diff, 0);
- } else if(bl->type == BL_MOB) {
- struct mob_data *md = (struct mob_data *)bl;
- hp -= mhp*15/100;
- if (hp > mhp>>2)
- md->hp = hp;
- else
- md->hp = mhp>>2;
- }
+ int diff = mhp*(bl->type==BL_PC?10:15)/100;
+ if (hp - diff < mhp>>2)
+ diff = hp - (mhp>>2);
+ battle_damage(NULL, bl, diff, 1);
}
} // fall through
case SC_POISON: /* “Å */
@@ -4355,7 +4346,7 @@ int status_change_start(struct block_list *bl,int type,int rate,int val1,int val
}
case SC_COMA: //Coma. Sends a char to 1HP
- battle_damage(NULL, bl, status_get_hp(bl)-1, 0);
+ battle_damage(NULL, bl, status_get_hp(bl)-1, 1);
return 1;
case SC_CLOSECONFINE2:
@@ -5441,7 +5432,7 @@ int status_change_timer(int tid, unsigned int tick, int id, int data)
if((++sc->data[type].val4)%5 == 0 && status_get_hp(bl) > hp>>2) {
hp = hp/100;
if(hp < 1) hp = 1;
- battle_heal(NULL, bl, -hp, 0, 0);
+ battle_damage(NULL, bl, hp, 1);
}
sc->data[type].timer=add_timer(1000+tick,status_change_timer, bl->id, data );
return 0;
@@ -5453,7 +5444,7 @@ int status_change_timer(int tid, unsigned int tick, int id, int data)
break;
case SC_DPOISON:
if ((--sc->data[type].val3) > 0 && sc->data[SC_SLOWPOISON].timer == -1)
- battle_heal(NULL, bl, -sc->data[type].val4, 0, 1);
+ battle_damage(NULL, bl, sc->data[type].val4, 1);
if (sc->data[type].val3 > 0 && !status_isdead(bl))
{
sc->data[type].timer = add_timer (1000 + tick, status_change_timer, bl->id, data );
@@ -5484,13 +5475,9 @@ int status_change_timer(int tid, unsigned int tick, int id, int data)
// To-do: bleeding effect increases damage taken?
if ((sc->data[type].val4 -= 10000) >= 0) {
int hp = rand()%600 + 200;
- battle_heal(NULL,bl,-hp,0,1);
- if (!status_isdead(bl)) {
- // walking and casting effect is lost
- unit_stop_walking (bl, 1);
- unit_skillcastcancel (bl, 2);
+ battle_damage(NULL,bl,hp,0);
+ if (!status_isdead(bl))
sc->data[type].timer = add_timer(10000 + tick, status_change_timer, bl->id, data );
- }
return 0;
}
break;
@@ -5655,10 +5642,8 @@ int status_change_timer(int tid, unsigned int tick, int id, int data)
(sd == NULL || sd->status.sp - sp> 0))
{
if (sd)
- pc_heal(sd,-hp,-sp);
- else if (bl->type == BL_MOB)
- mob_heal((struct mob_data *)bl,-hp);
-
+ pc_damage_sp(sd, sp, 0);
+ battle_damage(NULL, bl, hp, 1);
if ((sc->data[type].val2 -= 10000) > 0) {
sc->data[type].timer = add_timer(
10000+tick, status_change_timer,