summaryrefslogtreecommitdiff
path: root/src/map/battle.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/battle.c')
-rw-r--r--src/map/battle.c38
1 files changed, 26 insertions, 12 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index 96289fcc8..6c0e57863 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -5668,11 +5668,20 @@ struct Damage battle_calc_attack(int attack_type,struct block_list *bl,struct bl
} else // Some skills like Weaponry Research will cause damage even if attack is dodged
d.dmg_lv = ATK_DEF;
- if(sd && d.damage+d.damage2>1) {
- if(sd->bonus.sp_vanish_rate && sd->bonus.sp_vanish_trigger && rnd()%10000<sd->bonus.sp_vanish_rate &&
- ( (d.flag&sd->bonus.sp_vanish_trigger&BF_WEAPONMASK) || (d.flag&sd->bonus.sp_vanish_trigger&BF_RANGEMASK)
- || (d.flag&sd->bonus.sp_vanish_trigger&BF_SKILLMASK) ))
- status_percent_damage(&sd->bl,target,0,-sd->bonus.sp_vanish_per,false);
+ // HPVanishRate
+ if (sd && d.damage + d.damage2 > 1) {
+ if (sd->bonus.hp_vanish_rate && sd->bonus.hp_vanish_trigger && rnd() % 1000 < sd->bonus.hp_vanish_rate &&
+ ((d.flag&sd->bonus.hp_vanish_trigger&BF_WEAPONMASK) || (d.flag&sd->bonus.hp_vanish_trigger&BF_RANGEMASK)
+ || (d.flag&sd->bonus.hp_vanish_trigger&BF_SKILLMASK)))
+ status_percent_damage(&sd->bl, target, -sd->bonus.hp_vanish_per, 0, false);
+ }
+
+ // SPVanishRate
+ if (sd && d.damage + d.damage2 > 1) {
+ if (sd->bonus.sp_vanish_rate && sd->bonus.sp_vanish_trigger && rnd() % 1000 < sd->bonus.sp_vanish_rate &&
+ ((d.flag&sd->bonus.sp_vanish_trigger&BF_WEAPONMASK) || (d.flag&sd->bonus.sp_vanish_trigger&BF_RANGEMASK)
+ || (d.flag&sd->bonus.sp_vanish_trigger&BF_SKILLMASK)))
+ status_percent_damage(&sd->bl, target, 0, -sd->bonus.sp_vanish_per, false);
}
return d;
}
@@ -5902,7 +5911,7 @@ void battle_drain(TBL_PC *sd, struct block_list *tbl, int64 rdamage, int64 ldama
if (i == 0 || i == 2)
type = race;
else
- type = boss?RC_BOSS:RC_NONBOSS;
+ type = boss ? RC_BOSS : RC_NONBOSS;
hp = wd->hp_drain[type].value;
if (wd->hp_drain[type].rate)
@@ -5912,6 +5921,14 @@ void battle_drain(TBL_PC *sd, struct block_list *tbl, int64 rdamage, int64 ldama
if (wd->sp_drain[type].rate)
sp += battle->calc_drain(*damage, wd->sp_drain[type].rate, wd->sp_drain[type].per);
+ // HPVanishRate
+ if (sd->bonus.hp_vanish_rate && rnd() % 1000 < sd->bonus.hp_vanish_rate && !sd->bonus.hp_vanish_trigger)
+ status_percent_damage(&sd->bl, tbl, (unsigned char)sd->bonus.hp_vanish_per, 0, false);
+
+ // SPVanishRate
+ if (sd->bonus.sp_vanish_rate && rnd() % 1000 < sd->bonus.sp_vanish_rate && !sd->bonus.sp_vanish_trigger)
+ status_percent_damage(&sd->bl, tbl, 0, (unsigned char)sd->bonus.sp_vanish_per, false);
+
if (hp) {
if (wd->hp_drain[type].type)
rhp += hp;
@@ -5924,17 +5941,14 @@ void battle_drain(TBL_PC *sd, struct block_list *tbl, int64 rdamage, int64 ldama
}
}
- if (sd->bonus.sp_vanish_rate && rnd()%1000 < sd->bonus.sp_vanish_rate && !sd->bonus.sp_vanish_trigger)
- status_percent_damage(&sd->bl, tbl, 0, (unsigned char)sd->bonus.sp_vanish_per, false);
-
- if( sd->sp_gain_race_attack[race] )
+ if (sd->sp_gain_race_attack[race])
tsp += sd->sp_gain_race_attack[race];
- if( sd->hp_gain_race_attack[race] )
+ if (sd->hp_gain_race_attack[race])
thp += sd->hp_gain_race_attack[race];
if (!thp && !tsp) return;
- status->heal(&sd->bl, thp, tsp, battle_config.show_hp_sp_drain?3:1);
+ status->heal(&sd->bl, thp, tsp, battle_config.show_hp_sp_drain ? 3 : 1);
if (rhp || rsp)
status_zap(tbl, rhp, rsp);