diff options
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/battle.c | 38 | ||||
-rw-r--r-- | src/map/map.h | 2 | ||||
-rw-r--r-- | src/map/pc.c | 26 | ||||
-rw-r--r-- | src/map/pc.h | 2 |
4 files changed, 49 insertions, 19 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); diff --git a/src/map/map.h b/src/map/map.h index dacd81f71..bc479cdcf 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -465,7 +465,7 @@ enum status_point_types { SP_WEAPON_ATK,SP_WEAPON_ATK_RATE, // 1081-1082 SP_DELAYRATE,SP_HP_DRAIN_RATE_RACE,SP_SP_DRAIN_RATE_RACE, // 1083-1085 SP_IGNORE_MDEF_RATE,SP_IGNORE_DEF_RATE,SP_SKILL_HEAL2,SP_ADDEFF_ONSKILL, //1086-1089 - SP_ADD_HEAL_RATE,SP_ADD_HEAL2_RATE, //1090-1091 + SP_ADD_HEAL_RATE, SP_ADD_HEAL2_RATE, SP_HP_VANISH_RATE, //1090-1092 SP_RESTART_FULL_RECOVER=2000,SP_NO_CASTCANCEL,SP_NO_SIZEFIX,SP_NO_MAGIC_DAMAGE,SP_NO_WEAPON_DAMAGE,SP_NO_GEMSTONE, // 2000-2005 SP_NO_CASTCANCEL2,SP_NO_MISC_DAMAGE,SP_UNBREAKABLE_WEAPON,SP_UNBREAKABLE_ARMOR, SP_UNBREAKABLE_HELM, // 2006-2010 diff --git a/src/map/pc.c b/src/map/pc.c index 157f7faab..59232cc7b 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -3168,11 +3168,18 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val) sd->left_weapon.sp_drain[RC_BOSS].type = val; } break; + case SP_HP_VANISH_RATE: + if (sd->state.lr_flag != 2) { + sd->bonus.hp_vanish_rate += type2; + sd->bonus.hp_vanish_per = max(sd->bonus.hp_vanish_per, val); + sd->bonus.hp_vanish_trigger = 0; + } + break; case SP_SP_VANISH_RATE: - if(sd->state.lr_flag != 2) { + if (sd->state.lr_flag != 2) { sd->bonus.sp_vanish_rate += type2; - sd->bonus.sp_vanish_per = max(sd->bonus.sp_vanish_per,val); - sd->bonus.sp_vanish_trigger=0; + sd->bonus.sp_vanish_per = max(sd->bonus.sp_vanish_per, val); + sd->bonus.sp_vanish_trigger = 0; } break; case SP_GET_ZENY_NUM: @@ -3812,11 +3819,18 @@ int pc_bonus3(struct map_session_data *sd,int type,int type2,int type3,int val) } } break; + case SP_HP_VANISH_RATE: + if (sd->state.lr_flag != 2) { + sd->bonus.hp_vanish_rate += type2; + sd->bonus.hp_vanish_per = max(sd->bonus.hp_vanish_per, type3); + sd->bonus.hp_vanish_trigger = val; + } + break; case SP_SP_VANISH_RATE: - if(sd->state.lr_flag != 2) { + if (sd->state.lr_flag != 2) { sd->bonus.sp_vanish_rate += type2; - sd->bonus.sp_vanish_per = max(sd->bonus.sp_vanish_per,type3); - sd->bonus.sp_vanish_trigger=val; + sd->bonus.sp_vanish_per = max(sd->bonus.sp_vanish_per, type3); + sd->bonus.sp_vanish_trigger = val; } break; diff --git a/src/map/pc.h b/src/map/pc.h index 93173f6c8..97f339bf6 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -377,6 +377,8 @@ BEGIN_ZEROED_BLOCK; // this block will be globally zeroed at the beginning of st short add_steal_rate; short add_heal_rate, add_heal2_rate; short sp_gain_value, hp_gain_value, magic_sp_gain_value, magic_hp_gain_value; + short hp_vanish_rate; + short hp_vanish_per, hp_vanish_trigger; short sp_vanish_rate; short sp_vanish_per, sp_vanish_trigger; unsigned short unbreakable; // chance to prevent ANY equipment breaking [celest] |