[FUNCTION F_CHECK_PROVOKEDDISTANCE]
REF1=<TAG0.PROVOKER> //player that provoked me
IF (!(<ISEVENT.E_PROVOKED>))
TAG.PROVOKER=
ELIF ((!(<REF1.CANSEELOS <UID>>)) || (<DISTANCE <REF1>> > <EVAL 8+(<REF1.MUSICIANSHIP>/150)>))
REMOVEALLMEMS memory_war_targ
FLAGS &= ~statf_war
ACTION=06d
TAG.PROVOKER=
EVENTS -e_provoked
ELIF (!(<REF1.ISONLINE>))
REMOVEALLMEMS memory_war_targ
FLAGS &= ~statf_war
ACTION=06d
TAG.PROVOKER=
EVENTS -e_provoked
ELSE
TIMERF 1,F_CHECK_PROVOKEDDISTANCE
ENDIF

[EVENTS E_PROVOKED]
ON=@Attack
IF (<TAG0.PROVOKER>)
	IF (<SRC.TAG0.PROVOKER> != <TAG0.PROVOKER>)
	RETURN 1
	ENDIF
ELSE
EVENTS -e_provoked
ENDIF

ON=@HitTry
IF (<TAG0.PROVOKER>)
	IF (<SRC.TAG0.PROVOKER> != <TAG0.PROVOKER>)
	RETURN 1
	ENDIF
ELSE
EVENTS -e_provoked
ENDIF

ON=@DeathCorpse
TAG.PROVOKER
EVENTS -e_provoked

ON=@Kill
IF (<TAG0.PROVOKER> == <ARGO.TAG0.PROVOKER>)
TAG.PROVOKER=
EVENTS -e_provoked
ENDIF

[FUNCTION F_PROVOCATION]
IF (!(<ARGO.CANSEELOS>))
SYSMESSAGELOC -1,501583
ELIF (<ARGO.ISITEM>)
SYSMESSAGELOC -1,501589
ELIF (<ARGO.TAG0.PROVOKER>)
SYSMESSAGELOC -1,1049447
ELIF ((<ARGO.ISPLAYER>) || (<ARGO.NPC> == brain_vendor) || (<ARGO.NPC> == brain_banker) || (<ARGO.TAG0.IAMACHAMPION>))
SYSMESSAGELOC -1,501589
ELIF (!(<FINDTYPE.t_musical>))
SYSMESSAGE @946,3,1 You must have a musical instrument with you.
ELSE
TARGETFW F_PROVOKE_NEW <ARGO.UID>
SYSMESSAGELOC -1,501587
ENDIF

[FUNCTION F_PROVOKE_NEW]
REF1=<ARGN1> //monster incited
//ARGO = monster ref1 is being incited AT
IF (!(<FINDTYPE.t_musical>))
SYSMESSAGE @946,3,1 You must have a musical instrument with you.
ELIF (<CTAG0.FIXMUSIC>)
SYSMESSAGE @946,3,1 You must wait before provoking other creatures.
ELIF (!(<ARGO.CANSEELOS>))
SYSMESSAGELOC -1,501583
ELIF (<ARGO.DISTANCE <UID>> > <EVAL 8+(<MUSICIANSHIP>/150)>) || (<REF1.DISTANCE <UID>> > <EVAL 8+(<MUSICIANSHIP>/150)>)
SYSMESSAGELOC -1,1049449
ELIF (<ARGO.DISTANCE <REF1.UID>> > 18)
SYSMESSAGELOC -1,1049450
ELIF (<ARGO.ISPLAYER>)
SYSMESSAGELOC -1,501595
ELIF (<ARGO.ISITEM>)
SYSMESSAGELOC -1,501589
ELIF (<ARGO.UID> == <REF1>)
SYSMESSAGELOC -1,501593
ELIF (<ARGO.TAG0.PROVOKER>)
SYSMESSAGELOC -1,1049447
ELIF (<REF1.TAG0.PROVOKER>)
SYSMESSAGELOC -1,1049448
ELIF ((<ARGO.TAG0.IAMACHAMPION>) || (<ARGO.NPC> == brain_vendor) || (<ARGO.NPC> == brain_banker) || (<ARGO.FLAGS>&STATF_PET) || (<REF1.FLAGS>&STATF_PET) || ((<REF1.TAG0.QUESTS>) && (!(<REF1.ISPLAYER>))) || ((<ARGO.TAG0.QUESTS>) && (!(<ARGO.ISPLAYER>))))
SYSMESSAGELOC -1,501589
ELSE
USEITEM <FINDTYPE.t_musical>
LOCAL.BARDDIFF=<REF1.BARDDIFF <UID>>
LOCAL.BARDDIFF2=<ARGO.BARDDIFF <UID>>
LOCAL.FINALDIFF=<EVAL ((<LOCAL.BARDDIFF>+<LOCAL.BARDDIFF2>)/2)>
FLOAT.CHANCE=<FLOATVAL (55+(2*(((<Provocation>/2)+(<MUSICIANSHIP>/2))-<dLOCAL.FINALDIFF>)))/100>
	IF (<FLOAT.CHANCE> < <FLOATVAL 0.025>)
	FLOAT.CHANCE=<FLOATVAL 0.025>
	ENDIF
	IF (<FLOAT.CHANCE> > <RANDOMDOUBLE>)
	REF1.FLAGS &= ~statf_war
	REF1.MEMORYFINDTYPE.memory_war_targ.remove
	REF1.ACTION=06d
	ARGO.FLAGS &= ~statf_war
	ARGO.MEMORYFINDTYPE.memory_war_targ.remove
	ARGO.ACTION=06d
	REF1.TAG.PEACED.PLAYER=
	ARGO.TAG.PEACED.PLAYER=
	REF1.EVENTS -E_PEACEMAKED
	ARGO.EVENTS -E_PEACEMAKED
	REF1.ATTACK <ARGO.UID>
	ARGO.ATTACK <REF1.UID>
	REF1.EVENTS +E_PROVOKED
	ARGO.EVENTS +E_PROVOKED
	REF1.TAG.PROVOKER=<UID>
	ARGO.TAG.PROVOKER=<UID>
	REF1.TIMERF 1,F_CHECK_PROVOKEDDISTANCE
	ARGO.TIMERF 1,F_CHECK_PROVOKEDDISTANCE
	SYSMESSAGELOC -1,501602
	SKILLGAIN Musicianship <EVAL (<MUSICIANSHIP>/10)+1>
	SKILLGAIN Provocation <EVAL (<Provocation>/10)+1>
	SOUND=1418
	REF2=<UID>
		FORCLIENTS 16
		SYSMESSAGELOC -1,1080028,<REF2.NAME>,<REF1.NAME>,<ARGO.NAME>
		ENDFOR
	ELSE
	REF1.ATTACK <UID>
	ARGO.ATTACK <UID>
	SYSMESSAGELOC -1,501599
	SKILLGAIN Musicianship <EVAL (<MUSICIANSHIP>/10)+1>
	SKILLGAIN Provocation <EVAL <LOCAL.FINALDIFF>-40>
	ENDIF
ENDIF

[EOF]