What i mean here is bHPVanishRate and bSPVanishRate bonus only working if we hit players on pvp and gvg mapflags,i want it working on every mapflags & on every monster to(includiing MVPs). bonus2 bSPVanishRate,n,x; Add the (n/10)% chance of decreasing enemy's SP (player) amount by x% when attacking +bonus2 bHPVanishRate,n,x; Add the (n/10)% chance of decreasing enemy's HP (player) amount by x% when attacking
which part do i have to edit?
/*===========================================
* Perform battle drain effects (HP/SP loss)
*-------------------------------------------*/
void battle_drain(TBL_PC *sd, struct block_list *tbl, int64 rdamage, int64 ldamage, int race, int boss)
{
struct weapon_data *wd;
int64 *damage;
int type, thp = 0, tsp = 0, rhp = 0, rsp = 0, hp, sp, i;
for (i = 0; i < 4; i++) {
//First two iterations: Right hand
if (i < 2) { wd = &sd->right_weapon; damage = &rdamage; }
else { wd = &sd->left_weapon; damage = &ldamage; }
if (*damage <= 0) continue;
//First and Third iterations: race, other two boss/nonboss state
if (i == 0 || i == 2)
type = race;
else
type = boss?RC_BOSS:RC_NONBOSS;
hp = wd->hp_drain[type].value;
if (wd->hp_drain[type].rate)
hp += battle_calc_drain(*damage, wd->hp_drain[type].rate, wd->hp_drain[type].per);
sp = wd->sp_drain[type].value;
if (wd->sp_drain[type].rate)
sp += battle_calc_drain(*damage, wd->sp_drain[type].rate, wd->sp_drain[type].per);
if (hp) {
if (wd->hp_drain[type].type)
rhp += hp;
thp += hp;
}
if (sp) {
if (wd->sp_drain[type].type)
rsp += sp;
tsp += sp;
}
}
if (sd->bonus.sp_vanish_rate && rnd()%1000 < sd->bonus.sp_vanish_rate)
status_percent_damage(&sd->bl, tbl, 0, (unsigned char)sd->bonus.sp_vanish_per, false);
if (sd->bonus.hp_vanish_rate && rnd()%1000 < sd->bonus.hp_vanish_rate
&& tbl->type == BL_PC && (map[sd->bl.m].flag.pvp || map[sd->bl.m].flag.gvg))
status_percent_damage(&sd->bl, tbl, (unsigned char)sd->bonus.hp_vanish_per, 0, false);
if( sd->sp_gain_race_attack[race] )
tsp += sd->sp_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);
if (rhp || rsp)
status_zap(tbl, rhp, rsp);
}