[DEFNAME PEERLESS_STUFF]
random_peerless_reagent {i_blight 1 i_corruption 1 i_taint 1 i_putrefaction 1 i_muculent 1 i_scourge 1}

[REGIONTYPE r_peerless_area]
ON=@Exit
IF (<SRC.ISPLAYER>)
	IF (<CLIENTS> == 1)
	SRC.CLEARPEERLESSAREA
	ENDIF
ENDIF

[FUNCTION CLEARPEERLESSAREA]
FORITEMS 100
	IF (<BASEID> == I_PEERLESS_TIMER)
	TIMER=1
	ENDIF
ENDFOR

[EVENTS E_PEERLESS_BOSS]
ON=@Death
LOCAL.OLDNEW=<NEW>
TAG0.DEATHSAMOUNT --
IF (<TAG0.DEATHSAMOUNT> > 0)
HITS=<MAXHITS>
ACTION -1
RETURN 1
ENDIF
REF1=<TAG.COUNTDOWN>
REF1.TIMER=<EVAL 60*10>
REGION.ALLCLIENTS SYSMESSAGELOC -1,1072681
FOR 10
NEWLOOT=<HVAL <DEF.random_peerless_reagent>>
ENDFOR
IF (<FLOATVAL 0.03> > <RANDOMDOUBLE>)
NEWLOOT=i_crimson_cinture
ENDIF
IF (<FLOATVAL 0.25725> > <RANDOMDOUBLE>)
NEWLOOT=<HVAL <DEF.MINORARTIS>>
ENDIF
IF (<FLOATVAL 0.4275> > <RANDOMDOUBLE>)
NEWLOOT=<HVAL <DEF.RANDOM_ML_SETS_DROP_LIST>>
ENDIF
FOR 12
RANDMAGICITEMGREAT
ENDFOR
FOR <R5,7>
serv.newitem=i_osi_treasure_map
new.tag.level=5
	IF (<FLOATVAL 0.15> > <RANDOMDOUBLE>)
	new.tag.level=6
	ENDIF
bounce <new>
ENDFOR
IF (<BASEID> == c_peerless_dreadhorn)
NEWGOLD=<R25000,35000>
ELSE
NEWGOLD=<R45500,72500>
ENDIF
NEW=<LOCAL.OLDNEW>
SERV.B @0ad The Peerless <NAME> has been slain!

[TYPEDEF t_peerless_key]
ON=@ClientToolTip
SRC.ADDCLILOC 1038021

[ITEMDEF I_PEERLESS_TIMER]
ID=i_worldgem_bit
NAME=Peerless Timer (don't delete!)
TYPE=T_NORMAL

ON=@Create
COLOR=04ac
ATTR=attr_invis|attr_move_never

ON=@Timer
FOR <LINK.TAG0.PLAYERS>
REF1=<LINK.TAG0.PLAYERS.<dLOCAL._FOR>>
	IF (!(STRCMPI(<REF1.REGION.NAME>,<REGION.NAME>)))
	REF1.EXITPEERLESSAREA <LINK.TAG0.EXITPOINT>
	ENDIF
ENDFOR
REF2=<UID>
FORCHARS 75
	IF (<FLAGS>&STATF_PET) && (!(STRCMPI(<REGION.NAME>,<REF2.REGION.NAME>)))
	GO <OWNER.P>
	ENDIF
	IF (<ISEVENT.e_peerless_boss>) || (<TAG0.PEERLESSSPAWN>)
	REMOVE
	ENDIF
ENDFOR
REF2.LINK.COLOR=015c
REF2.LINK.TAG.PARTIES=
REF2.LINK.TAG.PEERLESSTIMER=
FOR <REF2.LINK.dTAG0.PLAYERS>
TRY REF2.LINK.TAG.PLAYERS.<dLOCAL._FOR>=
ENDFOR
REF2.LINK.TAG.PLAYERS=
REF2.REMOVE
RETURN 1

[FUNCTION EXITPEERLESSAREA]
IF (<ISPLAYER>)
	IF (<FLAGS>&statf_dead)
	TIMERF 1,SPELLEFFECT S_resurrection,1000,<UID>
	ENDIF
SYSMESSAGELOC 55,1072677
GO <ARGS>
ENDIF

[EOF]