[ITEMDEF 0e21]
DEFNAME=i_bandage
RESOURCES=i_cloth
TYPE=T_NORMAL
WEIGHT=0.1
DUPELIST=0ee9
CATEGORY=Items by Professions
SUBSECTION=Healer
DESCRIPTION=Clean Bandages
VALUE=1

ON=@Dclick
IF (<src.flags>&statf_freeze) || (<src.flags>&statf_stone)
src.sysmessageloc -1,1005000
ELSE
TARGET @,,2 500948
ENDIF
RETURN 1

ON=@targon_item
src.sysmessageloc -1,500970
return 1

On=@targon_char
IF (<src.targ.tag0.mortalwounded>) || (<src.targ.isevent.e_animated_dead>)
src.sysmessageloc -1,500951
ELIF ((<SRC.ISEVENT.e_young>) && (!(<ARGO.ISEVENT.e_young>))) && (<ARGO.ISPLAYER>)
src.sysmessageloc -1,500952
ELIF (((<src.flags>&statf_freeze) || (<src.flags>&statf_stone)) && (<SRC.TARG.UID> == <SRC>))
src.sysmessageloc -1,1005000
ELIF !(<src.targ.canseelos>)
src.sysmessageloc -1,500950
ELIF (<src.targ.distance> > 3)
src.sysmessageloc -1,500953
ELIF (<src.targ.hits> >= <src.targ.maxhits>) && (!(<src.targ.flags>&statf_poisoned)) && (!(<src.targ.flags>&statf_invul))
src.sysmessageloc -1,500955
ELIF (<src.targ.flags>&statf_poisoned) && (((<src.anatomy> < 61.0) && (<src.healing> < 61.0) && (<SRC.targ.isplayer>)) || ((<src.animallore> < 61.0) && (<src.veterinary> < 61.0) && (!(<SRC.targ.isplayer>))))
src.sysmessageloc -1,1042032
ELSE
REF1=<src.findid.i_mem_heal>
	IF (!(<REF1.UID>))
	serv.newitem i_mem_heal
	new.link=<src.targ.uid>
	src.equip <new>
	ELSE
	REF1.link=<src.targ.uid>
	REF1.TRIGGER @Equip
	ENDIF
src.sysmessageloc -1,500956
consume 1 i_bandage
ENDIF
return 1

/////////////////////////////

[ITEMDEF i_mem_heal]
NAME=healing mem
ID=i_memory
TYPE=t_eq_script

ON=@create
attr=attr_invis|attr_decay

ON=@Equip
SRC.EVENTS +e_healing_timer
IF (<LINK> == <SRC>)
LOCAL.TIMER=<EVAL 11-(<SRC.DEX>/20)>
	if (<LOCAL.TIMER> < 2)
	LOCAL.TIMER=2
	endif
ELSE
LOCAL.TIMER=<EVAL 4-(<SRC.DEX>/60)>
	IF (<LOCAL.TIMER> < 2)
	LOCAL.TIMER=2
	ENDIF
ENDIF
IF (<LINK.ISPLAYER>) || (<LINK.BODY>==c_man) || (<LINK.BODY>==c_woman) || (<LINK.BODY>==c_elf_male) || (<LINK.BODY>==c_elf_female)
LOCAL.SKILLUSO=Healing
ELSE
LOCAL.SKILLUSO=Veterinary
LOCAL.TIMER=2
ENDIF
IF (<LINK.UID> != <SRC.UID>) && (<LINK.ISPLAYER>)
LINK.SYSMESSAGELOCEX -1,1008078,01,<SRC.NAME>
ENDIF
IF !(STRCMPI(<LOCAL.SKILLUSO>,Healing))
LOCAL.MINHEALED=<FEVAL <FLOATVAL ((<SRC.ANATOMY>/6.0)+(<SRC.<LOCAL.SKILLUSO>>/5.5))+3.0>>
LOCAL.MAXHEALED=<FEVAL <FLOATVAL ((<SRC.ANATOMY>/6.0)+(<SRC.<LOCAL.SKILLUSO>>/2.5))+10.0>>
ELSE
LOCAL.MINHEALED=<FEVAL <FLOATVAL ((((<SRC.ANIMALLORE>/6.0)+(<SRC.<LOCAL.SKILLUSO>>/5.0))+3.0)+(<LINK.MAXHITS>/100))>>
LOCAL.MAXHEALED=<FEVAL <FLOATVAL ((((<SRC.ANIMALLORE>/6.0)+(<SRC.<LOCAL.SKILLUSO>>/2.0))+10.0)+(<LINK.MAXHITS>/100))>>
ENDIF
MORE2=<R<LOCAL.MINHEALED>,<EVAL <LOCAL.MAXHEALED>+1>>
more1=0
morex=0
timer=<LOCAL.TIMER>

ON=@Timer
IF (<morex>)
remove
return 1
ENDIF
IF (<LINK.ISPLAYER>) || (<LINK.BODY>==c_man) || (<LINK.BODY>==c_woman) || (<LINK.BODY>==c_elf_male) || (<LINK.BODY>==c_elf_female)
LOCAL.SKILLUSO=Healing
ELSE
LOCAL.SKILLUSO=Veterinary
ENDIF
IF (<link.distance <cont>> > 3)
cont.sysmessageloc -1,500963
cont.events -e_healing_timer
remove
return 1
ENDIF
IF (<link.tag0.mortalwounded>)
cont.sysmessageloc -1,500951
cont.events -e_healing_timer
remove
return 1
ENDIF
IF (<link.flags>&statf_dead) || ((<LINK.FLAGS>&statf_invul) && (<LINK.FLAGS>&STATF_PET))
	IF ((<CONT.ANATOMY> >= 90.0) && (<CONT.HEALING> >= 90.0) && (<LINK.ISPLAYER>)) || ((<CONT.ANIMALLORE> >= 90.0) && (<CONT.VETERINARY> >= 90.0) && (!(<LINK.ISPLAYER>)))
	TRYSRC <CONT> LINK.SPELLEFFECT S_RESURRECTION,1000,<CONT>
	CONT.SYSMESSAGELOC -1,500965
	ENDIF
MOREX=1
TIMER=5
RETURN 1
ENDIF
IF (<LINK.FLAGS>&statf_poisoned)
	IF (((<CONT.ANATOMY> >= 61.0) && (<CONT.HEALING> >= 61.0) && (<LINK.ISPLAYER>)) || ((<CONT.ANIMALLORE> >= 61.0) && (<CONT.VETERINARY> >= 61.0) && (!(<LINK.ISPLAYER>))))  //1042032
	TRYSRC <CONT> LINK.SPELLEFFECT S_CURE,2000,<CONT>
	TRYSRC <LINK> LINK.MESSAGE @,,2 1008072
	ELSE
	CONT.SYSMESSAGELOC -1,1042032
	ENDIF
REMOVE
RETURN 1
ENDIF
FLOAT.CHANCE=<FLOATVAL ((<CONT.<LOCAL.SKILLUSO>>+10.0)/100.0)> //healing chance
IF (<LINK.HITS> >= <LINK.MAXHITS>)
cont.sysmessageloc -1,500955
cont.events -e_healing_timer
remove
return 1
ENDIF
IF ((<cont.flags>&statf_freeze) || (<cont.flags>&statf_stone))
cont.sysmessage @946,3,1 You can't heal anyone while paralyzed.
cont.events -e_healing_timer
remove
return 1
ENDIF
IF (<LINK.FINDID.i_bleeding_timer>)
LINK.FINDID.i_bleeding_timer.REMOVE
LINK.SYSMESSAGELOC -1,1060088
ENDIF
LOCAL.OLDHITS=<LINK.HITS>
IF (<FLOAT.CHANCE> > <RANDOMDOUBLE>)
LINK.HITS += <MORE2>
CONT.SYSMESSAGELOC -1,503260
ELSE
LINK.HITS += 3
CONT.SYSMESSAGELOC -1,500968
ENDIF
IF (<LINK.HITS> > <LINK.MAXHITS>)
LINK.HITS=<LINK.MAXHITS>
ENDIF
IF (<LINK> != <CONT>)
LINK.SYSMESSAGELOC -1,1060203,<EVAL <LINK.HITS>-<LOCAL.OLDHITS>>
CONT.SYSMESSAGELOCEX -1,1008158,00,<EVAL <LINK.HITS>-<LOCAL.OLDHITS>>
ELSE
CONT.SYSMESSAGELOC -1,1060203,<EVAL <LINK.HITS>-<LOCAL.OLDHITS>>
ENDIF
cont.karma += 25
cont.skillgain <LOCAL.SKILLUSO> <EVAL (<CONT.<LOCAL.SKILLUSO>>/10)+2>
cont.events -e_healing_timer
remove
return 1

/////////////////////////////

[EVENTS e_healing_timer]
ON=@LogOut
sysmessage You fail to heal <findid.i_mem_heal.link.name>
findid.i_mem_heal.link.sysmessage <name> fails to heal you.
findid.i_mem_heal.remove
events -e_healing_timer

ON=@GetHit
IF !(<TAG0.GOTHIT>)
	IF (<SRC.ISPLAYER>)
		IF (<ARGN1> >= 18)
		FINDID.i_mem_heal.MORE2 -= <EVAL (<FINDID.i_mem_heal.MORE2>*35)/100>
		SYSMESSAGELOC -1,500961
		ENDIF
	ELSE
		IF (<ARGN1> >= 30)
		FINDID.i_mem_heal.MORE2 -= <EVAL (<FINDID.i_mem_heal.MORE2>*35)/100>
		SYSMESSAGELOC -1,500961
		ENDIF
	ENDIF
	IF (<FINDID.i_mem_heal.MORE2> <= 0)
	FINDID.i_mem_heal.MORE2=1
	ENDIF
ENDIF

ON=@Death
sysmessageloc -1,500962
findid.i_mem_heal.remove
events -e_healing_timer

[EOF]