[ITEMDEF i_pain_spike_timer]
ID=i_memory
NAME=Pain Spike
TYPE=T_EQ_SCRIPT

ON=@Timer
CONT.HITS += <MORE1>
IF (<CONT.HITS> > <CONT.MAXHITS>)
CONT.HITS=<CONT.MAXHITS>
ENDIF
IF (<CONT.RESCOUNT i_pain_spike_timer> == 1)
	IF (<CONT.ISPLAYER>)
	CONT.REMOVEBUFF 1018
	ENDIF
CONT.EVENTS -E_PAIN_SPIKE
ENDIF
REMOVE
RETURN 1

[EVENTS E_PAIN_SPIKE]
ON=@Death
CONSUME <RESCOUNT i_pain_spike_timer> i_pain_spike_timer
IF (<ISPLAYER>)
REMOVEBUFF 1018
ENDIF
EVENTS -E_PAIN_SPIKE

[Spell 109]
DEFNAME=s_Pain_Spike
NAME=Pain Spike
SOUND=0
RUNES=
CAST_TIME=1.0
RESOURCES=1 i_reag_pig_iron,1 i_reag_grave_dust
RUNE_ITEM=0
SCROLL_ITEM=0
FLAGS=spellflag_playeronly|spellflag_targ_char|spellflag_harm|spellflag_targ_noself
EFFECT_ID=
EFFECT=
DURATION=0.0
MANAUSE=5
SKILLREQ=SKILL_NECROMANCY 20.0
INTERRUPT=0.0,0.0

ON=@Start
IF (<ISPLAYER>)
SAY @,3,1 In Sar
ENDIF

ON=@Effect
IF (<SRC> == <UID>)
RETURN 1
ENDIF
IF (<SRC.TAG0.MAGICDAMINCREASE>)
LOCAL.ITEMSPELLDAMAGEINCREASE=<SRC.TAG0.MAGICDAMINCREASE>
ENDIF
IF (<ISPLAYER>) && (<SRC.ISPLAYER>)
	IF (<LOCAL.ITEMSPELLDAMAGEINCREASE> > 15)
	LOCAL.ITEMSPELLDAMAGEINCREASE=15
	ENDIF
LOCAL.DAMAGE=<FEVAL <FLOATVAL ((((<SRC.SPIRITSPEAK>-<MAGICRESISTANCE>)/100)+18)*(1+(<dLOCAL.ITEMSPELLDAMAGEINCREASE>/100)))>>
ELSE
LOCAL.DAMAGE=<FEVAL <FLOATVAL ((((<SRC.SPIRITSPEAK>-<MAGICRESISTANCE>)/10)+30)*(1+(<dLOCAL.ITEMSPELLDAMAGEINCREASE>/100)))>>
ENDIF
IF (<LOCAL.DAMAGE> < 1)
LOCAL.DAMAGE=1
ENDIF
IF (<FINDID.i_pain_spike_timer>)
LOCAL.DAMAGE=<R3,7>
LOCAL.TIMEBONUS=2
ENDIF
SKILLGAIN MagicResistance <EVAL (<SRC.SPIRITSPEAK>/10)+5>
DAMAGE <LOCAL.DAMAGE> <DEF.DAM_MAGIC> <SRC.UID>
SERV.NEWITEM i_pain_spike_timer,1,<UID>
NEW.MORE1=<LOCAL.DAMAGE>
NEW.TIMER=<EVAL 10+<LOCAL.TIMEBONUS>>
SOUND=0210
effect 3,i_fx_glow_spike,1,18,0,39,3
effect 3,i_fx_glow_spike,1,18,0,39,4
IF (<ISPLAYER>)
ADDBUFF 1018 1075667 1075668 <EVAL 10+<LOCAL.TIMEBONUS>> <dLOCAL.DAMAGE>
ENDIF
EVENTS +E_PAIN_SPIKE

[EOF]