diff options
author | Jedzkie <jedzkie13@rocketmail.com> | 2015-12-24 10:43:11 +0800 |
---|---|---|
committer | Jedzkie <jedzkie13@rocketmail.com> | 2015-12-24 10:43:11 +0800 |
commit | 3f13598714f2d6cecb1c1e5c382592a904798624 (patch) | |
tree | b527f2652e10f4b3bd446e26f6473aef0f358de9 /src/map/battle.c | |
parent | 9c137f8d979f9cde9f3c54c754d0a26912f4f208 (diff) | |
download | hercules-3f13598714f2d6cecb1c1e5c382592a904798624.tar.gz hercules-3f13598714f2d6cecb1c1e5c382592a904798624.tar.bz2 hercules-3f13598714f2d6cecb1c1e5c382592a904798624.tar.xz hercules-3f13598714f2d6cecb1c1e5c382592a904798624.zip |
Item Update:
- Fix items that uses SPVanishRate bonus are not working properly.
- Fix Velum Katzbalger item effect.
- Added HPVanishRate bonus.
Diffstat (limited to 'src/map/battle.c')
-rw-r--r-- | src/map/battle.c | 38 |
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); |