solution:
case SA_DISPELL:
if (flag&1 || (i = skill_get_splash(skill_id, skill_lv)) < 1) {
if (sd && dstsd && !map_flag_vs(sd->bl.m) && (!sd->duel_group || sd->duel_group != dstsd->duel_group) && (!sd->status.party_id || sd->status.party_id != dstsd->status.party_id))
break; // Outside PvP it should only affect party members and no skill fail message
clif_skill_nodamage(src,bl,skill_id,skill_lv,1);
if((dstsd && (dstsd->class_&MAPID_UPPERMASK) == MAPID_SOUL_LINKER)
|| (tsc && tsc->getSCE(SC_SPIRIT) && tsc->getSCE(SC_SPIRIT)->val2 == SL_ROGUE) //Rogue's spirit defends againt dispel.
|| rnd()%100 >= 50+10*skill_lv)
{
if (sd)
clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
break;
}
if(status_isimmune(bl))
break;
//Remove bonus berserk by Dispell
if (dstsd)
pc_bonus_script_clear(dstsd,BSF_REM_ON_DISPELL);
if(!tsc || !tsc->count)
break;
for (const auto &it : status_db) {
sc_type status = static_cast<sc_type>(it.first);
if (!tsc->getSCE(SC_BERSERK))
continue;
if (it.second->flag[SCF_NODISPELL])
continue;
if (i == SC_BERSERK)
tsc->getSCE(status)->val2 = 0; //Mark a dispelled berserk to avoid setting hp to 100 by setting hp penalty to 0.
status_change_end(bl, status);
status_percent_heal(bl, 100, 0);
}
//Statuses that can't be Dispelled
for (const auto &it : status_db) {
sc_type status = static_cast<sc_type>(it.first);
if (!tsc->getSCE(status))
continue;
if (it.second->flag[SCF_NODISPELL])
continue;
switch (status) {
// bugreport:4888 these songs may only be dispelled if you're not in their song area anymore
case SC_WHISTLE: case SC_ASSNCROS: case SC_POEMBRAGI:
case SC_APPLEIDUN: case SC_HUMMING: case SC_DONTFORGETME:
case SC_FORTUNE: case SC_SERVICE4U:
if (!battle_config.dispel_song || tsc->getSCE(status)->val4 == 0)
continue; //If in song area don't end it, even if config enabled
break;
case SC_ASSUMPTIO:
if( bl->type == BL_MOB )
continue;
break;
}
if (i == SC_SATURDAYNIGHTFEVER)
tsc->getSCE(status)->val2 = 0; //Mark a dispelled berserk to avoid setting hp to 100 by setting hp penalty to 0.
status_change_end(bl, status);
}
break;
}