The custom spell is the easy part really, you just have to write the encounter based on if the client has X buff or not they receive Y damage. This is just an example and definitely is not a final version to say the least, I'm just trying to show you how to do it.
Code:
sub EVENT_SPAWN {
quest::setnexthpevent(80);
}
sub EVENT_HP {
if ($hpevent ~~ [20, 40, 60, 80]) {
Spell();
quest::setnexthpevent(($hpevent - 20));
}
}
sub Spell {
my @hate = $npc->GetHateList();
foreach my $hate_ent (@hate) {
if ($hate_ent->GetEnt()->IsClient()) {
if ($hate_ent->GetEnt()->FindBuff(X)) {
$hate_ent->GetEnt()->Damage(100);
$hate_ent->GetEnt()->Message(315, "You have been hit for 100 points of damage, mitigating 900 damage because you have X buff.");
} else {
$hate_ent->GetEnt()->Damage(1000);
$hate_ent->GetEnt()->Message(315, "You have been hit for 1,000 points of damage because you did not have X buff.");
}
}
}
}