void main()
{
object oPC = GetFirstPC();
object oDamager = GetLastDamager();

int DoOnce = GetLocalInt(OBJECT_SELF, GetTag(OBJECT_SELF));
if (DoOnce==FALSE)
 {
 SetLocalInt(oPC, "FF_PreviousHP", 20);
 SetLocalInt(OBJECT_SELF, GetTag(OBJECT_SELF), TRUE);
 }

int nCurrent = GetCurrentHitPoints(OBJECT_SELF);
int nPrevious = GetLocalInt(oPC, "FF_PreviousHP");
int nDMG = (nPrevious - nCurrent);

effect eEffect = EffectDamage(nDMG, DAMAGE_TYPE_MAGICAL, DAMAGE_POWER_ENERGY);
if (nDMG > 0)
 {
 ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oDamager);
 ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_HIT_ELECTRICAL), oDamager);
 }

SetLocalInt(oPC, "FF_PreviousHP", nCurrent);
}
