[EVENTS e_player]
ON=@StatChange
IF (<TAG0.OVERRIDE.STATSUM>)
LOCAL.STATSUM=<TAG0.OVERRIDE.STATSUM>
ELSE
LOCAL.STATSUM=<SERV.SKILLCLASS.0.STATSUM>
ENDIF
LOCAL.STATS=<EVAL <OSTR>+<ODEX>+<OINT>>
IF (<LOCAL.STATS> == <LOCAL.STATSUM>)
	IF (<STATLOCK[<ARGN1>]> == lock_locked)
	RETURN 1
	ENDIF
	IF (<STATLOCK[<ARGN1>]> == lock_up)
		FOR 0 2
			IF (<LOCAL._FOR> != <ARGN1>)
				IF (<STATLOCK[<dLOCAL._FOR>]> == lock_down)
					IF (<LOCAL._FOR> == 0)
						IF (<EVAL <OSTR>-1> > 0)
						OSTR --
						MAXHITS --
							IF (<ARGN1> == 0)
							MAXHITS += <EVAL <ARGN2>-<OSTR>>
							ELIF (<ARGN1> == 1)
							MAXMANA += <EVAL <ARGN2>-<OINT>>
							ELIF (<ARGN1> == 2)
							MAXSTAM += <EVAL <ARGN2>-<ODEX>>
							ENDIF
						RETURN 0
						ENDIF
					ELIF (<LOCAL._FOR> == 1)
						IF (<EVAL <OINT>-1> > 0)
						OINT --
						MAXMANA --
							IF (<ARGN1> == 0)
							MAXHITS += <EVAL <ARGN2>-<OSTR>>
							ELIF (<ARGN1> == 1)
							MAXMANA += <EVAL <ARGN2>-<OINT>>
							ELIF (<ARGN1> == 2)
							MAXSTAM += <EVAL <ARGN2>-<ODEX>>
							ENDIF
						RETURN 0
						ENDIF
					ELIF (<LOCAL._FOR> == 2)
						IF (<EVAL <ODEX>-1> > 0)
						ODEX --
						MAXSTAM --
							IF (<ARGN1> == 0)
							MAXHITS += <EVAL <ARGN2>-<OSTR>>
							ELIF (<ARGN1> == 1)
							MAXMANA += <EVAL <ARGN2>-<OINT>>
							ELIF (<ARGN1> == 2)
							MAXSTAM += <EVAL <ARGN2>-<ODEX>>
							ENDIF
						RETURN 0
						ENDIF
					ENDIF
				RETURN 1
				ENDIF
			ENDIF
		ENDFOR	
	RETURN 1
	ENDIF
ELIF (<LOCAL.STATS> < <LOCAL.STATSUM>)
	IF (<ARGN1> == 0)
	MAXHITS += <EVAL <ARGN2>-<OSTR>>
	ELIF (<ARGN1> == 1)
	MAXMANA += <EVAL <ARGN2>-<OINT>>
	ELIF (<ARGN1> == 2)
	MAXSTAM += <EVAL <ARGN2>-<ODEX>>
	ENDIF
ENDIF

ON=@KarmaChange
IF (<ARGN1> > 0) && (<TAG0.KARMALOCKED>)
RETURN 1
ENDIF
ARGN1 *= 3
RETURN 0

ON=@FameChange
ARGN1 *= 100
RETURN 0

ON=@PersonalSpace
ARGN1=0

ON=@UserSpecialMove
IF (<ARGN1>)
	REF1=<WEAPON>
	IF (<TACTICS> < 70.0)
	SYSMESSAGELOC -1,1063013,70,Tactics
	TAG.SPECIALMOVE
	F_CANCELSPECIALMOVE
	RETURN 1
	ELIF ((!(<REF1>)) && (<WRESTLING> < 70.0))
	SYSMESSAGELOC -1,1063013,70,Wrestling
	TAG.SPECIALMOVE
	F_CANCELSPECIALMOVE
	RETURN 1
	ELIF (<REF1.TAG0.OVERRIDE.SKILL>)
		IF (<I.<EVAL <REF1.dTAG0.OVERRIDE.SKILL>-1>> < 70.0)
		SYSMESSAGELOC -1,1063013,70,<SERV.SKILL.<REF1.SKILL>.KEY>
		TAG.SPECIALMOVE
		F_CANCELSPECIALMOVE
		RETURN 1
		ENDIF
	ELIF (<I.<REF1.SKILL>> < 70.0)
	SYSMESSAGELOC -1,1063013,70,<SERV.SKILL.<REF1.SKILL>.KEY>
	TAG.SPECIALMOVE
	F_CANCELSPECIALMOVE
	RETURN 1
	ENDIF
EVENTS +E_SPECIAL_MOVE
	IF (<ARGN1> != 24)
	TAG.SPECIALMOVE=<ARGN1>
		IF (<ARGN1> == 10)
			LOCAL.COMBATSKILLSUM=<EVAL <SWORDSMANSHIP>+<MACEFIGHTING>+<FENCING>+<ARCHERY>+<PARRYING>+<LUMBERJACKING>+<STEALTH>+<POISONING>+<BUSHIDO>+<NINJITSU>>
			IF (<LOCAL.COMBATSKILLSUM> > 300.0)
			LOCAL.BONUSMANA=10
			ELIF (<LOCAL.COMBATSKILLSUM> > 200.0)
			LOCAL.BONUSMANA=5
			ENDIF
			LOCAL.MANACOST=<FEVAL <FLOATVAL ((15-<dLOCAL.BONUSMANA>)*(1-(<TAG0.LOWERMANACOST>/100)))>>
			IF (<MANA> >= <LOCAL.MANACOST>)
				IF (<LOCAL.MANACOST> > 0)
				MANA -= <LOCAL.MANACOST>
				ENDIF
			FLAGS |= <DEF.STATF_ArcherCanMove>
			ELSE
			SYSMESSAGELOC -1,1060174,<dLOCAL.MANACOST>
			ENDIF
		ENDIF
	ELSE
	TAG.SPECIALMOVE=<HVAL {1 1 2 1 3 1 4 1 7 1 9 1 11 1 16 1 20 1}>
	ENDIF
ELSE
EVENTS -E_SPECIAL_MOVE
TAG.SPECIALMOVE
FLAGS &= ~<DEF.STATF_ArcherCanMove>
ENDIF

ON=@Kill
TAG.DOINGDOUBLESTRIKE=
IF (!(<ARGO.ISPLAYER>))
	IF (<ARGO.KARMA> > 0) || (<ARGO.NOTOGETFLAG <UID>,0> == 1) || (<ARGO.NOTOGETFLAG <UID>,0> == 2)
		IF (<EVAL <KILLS>-1> >= 0)
		KILLS --
		ENDIF
	ENDIF
ENDIF

ON=@SpellSelect
LOCAL.CastRecovery=<SRC.TAG0.FASTERCASTRECOVERY>
IF (<LOCAL.CastRecovery> > 6)
LOCAL.CastRecovery=6
ENDIF
FLOAT.RecoveryTime=<FLOATVAL (((0.25*<dSPELLCIRCLE <ARGN1>>)-(<dLOCAL.CastRecovery>*0.25))*10)>
CTAG.LASTCASTING=<EVAL <SERV.TIME>+<FEVAL <FLOAT.RecoveryTime>>>
IF (<TAG0.LOWERMANACOST>)
LOCAL.LOWERCOST=<TAG0.LOWERMANACOST>
	IF (<LOCAL.LOWERCOST> > 50)
	LOCAL.LOWERCOST=50
	ENDIF
ARGN2 -= <EVAL (<ARGN2>*<LOCAL.LOWERCOST>)/100>
ENDIF

ON=@SpellCast
LOCAL.FASTCASTING=<SRC.TAG0.FASTERCASTING>
IF (<LOCAL.FASTCASTING> > 2) && (<ACTION> != SKILL_CHIVALRY)
LOCAL.FASTCASTING=2
ELIF (<LOCAL.FASTCASTING> > 4) && (<ACTION> == SKILL_CHIVALRY)
LOCAL.FASTCASTING=4
ENDIF
IF (<FINDID.i_rune_protection>)
LOCAL.FASTCASTING -= 2
ENDIF
ARGN3=<EVAL <FLOATVAL ((<ARGN3>/10)-(0.2*<dLOCAL.FASTCASTING>))>/100000>
IF (<ARGN3> < 0)
ARGN3=0
ENDIF

ON=@ClientToolTip
IF !(<TAG0.EVENT.ID>)
	IF !(<ISEMPTY <TAG.SHOWTITLE>>)
		IF (<EHNUM <TAG.SHOWTITLE>>)
		SRC.ADDCLILOC <dTAG.SHOWTITLE>
		ELSE
		SRC.ADDCLILOC 1042971,<<TAG.SHOWTITLE>>
		ENDIF
	ENDIF
ENDIF

ON=@Mount
IF (<ARGO.FLAGS>&STATF_POISONED)
SYSMESSAGELOC -1,1049692
RETURN 1
ELIF (<ARGO.FLAGS>&STATF_FREEZE)
SYSMESSAGELOC -1,1062934
RETURN 1
ELIF (<ARGO.DISTANCE> > 1)
SYSMESSAGELOC -1,500206
RETURN 1
ENDIF

ON=@UserGuildButton
src.fex_guild_online_users
IF (<GUILD>)
src.groster
return 1
ENDIF

ON=@CallGuards
IF (<GUILD>)
	IF (<SRC.ISPLAYER>)
		IF (<SRC.GUILD> == <GUILD>)
		RETURN 1
		ENDIF
	ENDIF
ENDIF
IF (<iscriminal>) || (<ispk>)
sysmessage @36 PKs and criminals can not call the guards.
RETURN 1
ENDIF
IF (<FLAGS>&statf_dead)
RETURN 1
ENDIF

ON=@ItemTargon_Item
IF (<TARG.TYPE> == T_CORPSE)
	IF (<TARG.TAG0.LOOTRIGHTLIST>)
		IF !(STRMATCH(*<UID>*,<TARG.TAG0.LOOTRIGHTLIST>))
		sysmessageloc 55,1005016
		ENDIF
	ENDIF
ENDIF

ON=@MurderDecay
RETURN 1

ON=@SpellSuccess
IF (<ARGN1> < 200)
	IF !(<TAG0.LOWERREAGENTCOST> >= <R1,100>)
		IF (!(<RESTEST <SERV.SPELL.<ARGN1>.RESOURCES>>))
		SYSMESSAGELOC -1,501904
		ACTION -1
		RETURN 1
		ELSE
		CONSUME <SERV.SPELL.<ARGN1>.RESOURCES>
		ENDIF
	ENDIF
ENDIF

ON=@SpellEffect
IF (<ISRESISTSPELL <ARGN1>>)
	IF (<EVAL <MagicResistance>/20> >= <R1,<EVAL (<ARGN2>/10)+20>>)
	skillgain magicresistance <EVAL (<MAGICRESISTANCE>/10)+1>
	effect 3,i_fx_glow,16,20
	sysmessageloc -1,502635
	RETURN 1
	ENDIF
SKILLGAIN MAGICRESISTANCE <EVAL (<ARGN2>/10)+1>
	IF (<MAGICRESISTANCE> > 5.0)
	ARGN2 -= <EVAL ((<MAGICRESISTANCE>/4)-5.0)>
	ENDIF
	IF (<ARGN2> < 1.0)
	ARGN2=1.0
	ENDIF
ENDIF
IF (<SRC> != <UID>)
	IF (<SRC.ISPLAYER>) && (<REGION.FLAGS>&REGION_FLAG_NO_PVP) && (<SERV.SPELL.<ARGN1>.FLAGS>&SPELLFLAG_HARM)
	RETURN 1
	ENDIF
	IF (!(<SERV.SPELL.<ARGN1>.FLAGS>&spellflag_good))
		IF ((<ISEVENT.e_young>) && ((<SRC.ISPLAYER>) && (!(<SRC.ISEVENT.e_young>))))
		RETURN 1
		ENDIF
	ENDIF
	IF (<ISDAMAGESPELL <ARGN1>>)
	TAG.GOTHITBYSPELL=<ARGN1>
	ENDIF
ENDIF

ON=@HitTry
IF ((<SRC.REGION.FLAGS>&region_flag_safe) || ((<SRC.REGION.FLAGS>&region_flag_no_pvp) && (<SRC.ISPLAYER>)) || (<SRC.FLAGS>&statf_invul) || (<SRC.FLAGS>&statf_stone) || ((<SRC.ISEVENT.e_young>) && (!(<SRC.TAG0.EVENT.ID>))) || (<SRC.NPC> == <DEF.BRAIN_HEALER>))
RETURN 1
ENDIF

LOCAL.BONUSSWINGSPEEDINCREASE=<TAG0.SWINGINCREASE>
IF ((<ACTION> != SKILL_WRESTLING) && (<ARGO.SPEED>))
FLOAT.FINALWEAPONSPEED=<FLOATVAL (<ARGO.SPEED>*(1+(<dLOCAL.BONUSSWINGSPEEDINCREASE>/100)))>
ELSE
FLOAT.FINALWEAPONSPEED=<FLOATVAL (50*(1+(<dLOCAL.BONUSSWINGSPEEDINCREASE>/100)))>
ENDIF
FLOAT.SWINGSPEED=<FLOATVAL ((80000/((<STAM>+100)*<FLOAT.FINALWEAPONSPEED>))/4)-0.5>
ARGN1=<EVAL <FLOAT.SWINGSPEED>/100000>

IF (<TAG0.DOINGDOUBLESTRIKE>)
ARGN1=1
TAG.DOINGDOUBLESTRIKE=
ELIF (<TAG0.FIRSTHIT> != <SRC>) && (<MEMORYFINDTYPE.MEMORY_WAR_TARG.LINK> == <SRC>)
ARGN1=1
TAG.FIRSTHIT=<SRC>
ELIF (<ARGN1> < 11)
ARGN1=11
ELIF (<ARGN1> > 85)
ARGN1=85
ENDIF

LOCAL.HITCHANCEINCREASE=<TAG0.HITCHANCEINCREASE>
IF (<LOCAL.HITCHANCEINCREASE> > 50)
LOCAL.HITCHANCEINCREASE=50
ENDIF
LOCAL.ANATOMYEVALINT=<EVAL (((<SRC.ANATOMY>+<SRC.EVALUATINGINTEL>)/10)+20)/2>
FLOAT.ATTACKERABILITY=<FLOATVAL ((<I.<SERV.SKILL.<ACTION>.KEY>>+20.0)*(1+(<dLOCAL.HITCHANCEINCREASE>/100)))>
REF1=<SRC.WEAPON>
IF (<REF1.TAG0.USEBESTWEAPONSKILL>)
LOCAL.SKILL1=<REF1.TAG0.USEBESTWEAPONSKILL>
ELSE
LOCAL.SKILL1=<REF1.SKILL>
ENDIF
LOCAL.DEFENSECHANCEINCREASE=<SRC.TAG0.HITCHANCEDECREASE>
IF (<LOCAL.DEFENSECHANCEINCREASE> > 50)
LOCAL.DEFENSECHANCEINCREASE=50
ENDIF
IF (!(<REF1>))
	IF (<EVAL <SRC.WRESTLING>/10> > <LOCAL.ANATOMYEVALINT>)
	FLOAT.DEFENDERABILITY=<FLOATVAL (((<SRC.WRESTLING>+20.0)*(1+(<dLOCAL.DEFENSECHANCEINCREASE>/100)))*2.0)>
	LOCAL.SKILLTOCOMPARE=<SRC.WRESTLING>
	ELSE
	FLOAT.DEFENDERABILITY=<FLOATVAL (((<dLOCAL.ANATOMYEVALINT>+20.0)*(1+(<dLOCAL.DEFENSECHANCEINCREASE>/100)))*2.0)>
	LOCAL.SKILLTOCOMPARE=<LOCAL.ANATOMYEVALINT>
	ENDIF
ELSE
FLOAT.DEFENDERABILITY=<FLOATVAL (((<SRC.<SERV.SKILL.<dLOCAL.SKILL1>.KEY>>+20.0)*(1+(<dLOCAL.DEFENSECHANCEINCREASE>/100)))*2.0)>
LOCAL.SKILLTOCOMPARE=<SRC.<SERV.SKILL.<dLOCAL.SKILL1>.KEY>>
ENDIF
FLOAT.HITCHANCE=<FLOATVAL (<FLOAT.ATTACKERABILITY>/<FLOAT.DEFENDERABILITY>)>
IF (<FLOAT.HITCHANCE> < <FLOATVAL 0.020000>)
FLOAT.HITCHANCE=<FLOATVAL 0.020000>
ENDIF
TAG.COMBAT.SKILLTOCOMPARE=<EVAL (<LOCAL.SKILLTOCOMPARE>/10)+1>
TAG.COMBAT.LASTACTION=<ACTION>
IF (<FLOAT.HITCHANCE> > <RANDOMDOUBLE>)
ACTDIFF=500
ELSE
ACTDIFF=-500
ENDIF

IF (<SRC.ISPLAYER>)
	IF (<SRC.FINDLAYER.2.TYPE> == T_SHIELD)
	LOCAL.BASEPARRYCHANCE=<EVAL (<SRC.PARRYING>/40)>
		IF (<LOCAL.BASEPARRYCHANCE> <= 0)
		LOCAL.BASEPARRYCHANCE=1
		ENDIF
	ELIF (<SRC.FINDLAYER.1.ISWEAPON>)
		LOCAL.BUSHIDOGAIN=1
		LOCAL.PARRYNEW=<EVAL (<SRC.PARRYING>*<SRC.BUSHIDO>)/48000>
		LOCAL.PARRYLEGACY=<EVAL <SRC.PARRYING>/80>
		IF (<LOCAL.PARRYNEW> > <LOCAL.PARRYLEGACY>)
		LOCAL.BASEPARRYCHANCE=<EVAL <LOCAL.PARRYNEW>+1>
		ELSE
		LOCAL.BASEPARRYCHANCE=<EVAL <LOCAL.PARRYLEGACY>+1>
		ENDIF
	ELIF (<SRC.FINDLAYER.2.ISWEAPON>)
		LOCAL.BUSHIDOGAIN=1
		LOCAL.PARRYNEW=<EVAL (<SRC.PARRYING>*<SRC.BUSHIDO>)/41140>
		LOCAL.PARRYLEGACY=<EVAL <SRC.PARRYING>/80>
		IF (<LOCAL.PARRYNEW> > <LOCAL.PARRYLEGACY>)
		LOCAL.BASEPARRYCHANCE=<EVAL <LOCAL.PARRYNEW>+1>
		ELSE
		LOCAL.BASEPARRYCHANCE=<EVAL <LOCAL.PARRYLEGACY>+1>
		ENDIF
	ENDIF
ENDIF
IF (<LOCAL.BASEPARRYCHANCE>)
	SRC.SKILLGAIN Parrying <EVAL <I.<SERV.SKILL.<ACTION>.KEY>>/10>
		IF (<LOCAL.BUSHIDOGAIN>)
		SRC.SKILLGAIN bushido <EVAL <I.<SERV.SKILL.<ACTION>.KEY>>/10>
		ENDIF
	IF (<SRC.PARRYING> >= 100.0) || (<SRC.BUSHIDO> >= 100.0)
	LOCAL.BASEPARRYCHANCE += 5
	ENDIF
	IF (<LOCAL.BASEPARRYCHANCE> > <R100>)
	ACTDIFF=-500
	ENDIF
ENDIF

ON=@HitMiss
IF (33 >= <R1,100>)
	IF (<dTAG0.COMBAT.SKILLTOCOMPARE> <= <EVAL (<I.<SERV.SKILL.<TAG0.COMBAT.LASTACTION>.KEY>>/10)+20>
	SKILLGAIN <SERV.SKILL.<TAG0.COMBAT.LASTACTION>.KEY> <dTAG0.COMBAT.SKILLTOCOMPARE>
	ELSE
	SKILLGAIN <SERV.SKILL.<TAG0.COMBAT.LASTACTION>.KEY> <EVAL (<I.<SERV.SKILL.<TAG0.COMBAT.LASTACTION>.KEY>>/10)+1>
	ENDIF
	IF (<dTAG0.COMBAT.SKILLTOCOMPARE> <= <EVAL (<I.TACTICS>/10)+20>
	SKILLGAIN TACTICS <dTAG0.COMBAT.SKILLTOCOMPARE>
	ELSE
	SKILLGAIN TACTICS <EVAL (<I.TACTICS>/10)+1>
	ENDIF
SKILLGAIN ANATOMY <EVAL (<ANATOMY>/10)+1>
ENDIF
TAG.COMBAT.LASTACTION=
TAG.COMBAT.SKILLTOCOMPARE=

on=@Hit
IF (<TAG0.SPECIALMOVE>)
LOCAL.COMBATSKILLSUM=<EVAL <SWORDSMANSHIP>+<MACEFIGHTING>+<FENCING>+<ARCHERY>+<PARRYING>+<LUMBERJACKING>+<STEALTH>+<POISONING>+<BUSHIDO>+<NINJITSU>>
	IF (<LOCAL.COMBATSKILLSUM> > 300.0)
	LOCAL.BONUSMANA=10
	ELIF (<LOCAL.COMBATSKILLSUM> > 200.0)
	LOCAL.BONUSMANA=5
	ENDIF
ENDIF
	IF (<dTAG0.COMBAT.SKILLTOCOMPARE> <= <EVAL (<I.<SERV.SKILL.<TAG0.COMBAT.LASTACTION>.KEY>>/10)+20>
	SKILLGAIN <SERV.SKILL.<TAG0.COMBAT.LASTACTION>.KEY> <dTAG0.COMBAT.SKILLTOCOMPARE>
	ELSE
	SKILLGAIN <SERV.SKILL.<TAG0.COMBAT.LASTACTION>.KEY> <EVAL (<I.<SERV.SKILL.<TAG0.COMBAT.LASTACTION>.KEY>>/10)+1>
	ENDIF
	IF (<dTAG0.COMBAT.SKILLTOCOMPARE> <= <EVAL (<I.TACTICS>/10)+20>
	SKILLGAIN TACTICS <dTAG0.COMBAT.SKILLTOCOMPARE>
	ELSE
	SKILLGAIN TACTICS <EVAL (<I.TACTICS>/10)+1>
	ENDIF
SKILLGAIN ANATOMY <EVAL (<ANATOMY>/10)+1>
TAG.COMBAT.LASTACTION=
TAG.COMBAT.SKILLTOCOMPARE=
IF (0<ARGO.UID>)
LOCAL.BASEDAMAGE=<R<ARGO.DAM>>
ELSE
LOCAL.BASEDAMAGE=<R1,3>
ENDIF
IF (<LOCAL.BASEDAMAGE>)
	IF (<TACTICS> < 100.0)
	FLOAT.TACTICSBONUS=<FLOATVAL <TACTICS>/1.5>
	ELSE
	FLOAT.TACTICSBONUS=<FLOATVAL (<TACTICS>/1.5)+6.25>
	ENDIF
FLOAT.ANATOMYBONUS=<FLOATVAL (<ANATOMY>/2)+5>
	IF (<ARGO.TYPE> == t_weapon_mace_sharp)
		IF (<LUMBERJACKING> < 100.0)
		FLOAT.LUMBERBONUS=<FLOATVAL <LUMBERJACKING>/5>
		ELSE
		FLOAT.LUMBERBONUS=<FLOATVAL (<LUMBERJACKING>/5)+10>
		ENDIF
	ENDIF
	IF (<STR> < 100)
	FLOAT.STRBONUS=<FLOATVAL <STR>*0.3>
	ELSE
	FLOAT.STRBONUS=<FLOATVAL (<STR>*0.3)+5>
	ENDIF
LOCAL.ITEMDAMAGEINCREASE=<dTAG0.DAMINCREASE>
	IF (<LOCAL.ITEMDAMAGEINCREASE> > 125)
	LOCAL.ITEMDAMAGEINCREASE=125
	ENDIF
FLOAT.TOTALDAMAGEBONUS=<FLOATVAL <FLOAT.TACTICSBONUS>+<FLOAT.ANATOMYBONUS>+<FLOAT.LUMBERBONUS>+<FLOAT.STRBONUS>+<dLOCAL.ITEMDAMAGEINCREASE>>
	IF (<TAG0.SPECIALMOVE> == 4)
	LOCAL.MANACOST=<FEVAL <FLOATVAL ((25-<dLOCAL.BONUSMANA>)*(1-(<TAG0.LOWERMANACOST>/100)))>>
		IF (<MANA> >= <LOCAL.MANACOST>)
		SYSMESSAGELOC -1,1060090
		SRC.SYSMESSAGELOC -1,1060091
			IF (<LOCAL.MANACOST> > 0)
			MANA -= <LOCAL.MANACOST>
			ENDIF
		FLOAT.TOTALDAMAGEBONUS=<FLOATVAL <FLOAT.TOTALDAMAGEBONUS>+50.0>
		ELSE
		SYSMESSAGELOC -1,1060174,<dLOCAL.MANACOST>
		ENDIF
	ELIF (<TAG0.SPECIALMOVE> == 12)
	LOCAL.MANACOST=<FEVAL <FLOATVAL ((20-<dLOCAL.BONUSMANA>)*(1-(<TAG0.LOWERMANACOST>/100)))>>
		IF (<STEALTH> < 80.0)
		SYSMESSAGELOC -1,1063013,80,Stealth
		ELIF (<MANA> >= <LOCAL.MANACOST>)
		SYSMESSAGELOC -1,1060078
		SRC.SYSMESSAGELOC -1,1060079
			IF (<LOCAL.MANACOST> > 0)
			MANA -= <LOCAL.MANACOST>
			ENDIF
		FLOAT.TOTALDAMAGEBONUS=<FLOATVAL <FLOAT.TOTALDAMAGEBONUS>+25.0>
		WARMODE 0
		FLAGS=<HVAL <FLAGS>|STATF_HIDDEN>
		UPDATE
		ELSE
		SYSMESSAGELOC -1,1060174,<dLOCAL.MANACOST>
		ENDIF
	ELIF (<TAG0.SPECIALMOVE> == 19)
	LOCAL.MANACOST=<FEVAL <FLOATVAL ((30-<dLOCAL.BONUSMANA>)*(1-(<TAG0.LOWERMANACOST>/100)))>>
		IF (<SRC.ISEVENT.e_talon_effect>)
		SYSMESSAGELOC -1,1060089
		ELIF (<MANA> >= <LOCAL.MANACOST>)
		SYSMESSAGELOC -1,1063358
		SRC.SYSMESSAGELOC -1,1063359
			IF (<LOCAL.MANACOST> > 0)
			MANA -= <LOCAL.MANACOST>
			ENDIF
		FLOAT.TOTALDAMAGEBONUS=<FLOATVAL <FLOAT.TOTALDAMAGEBONUS>+20.0>
		SRC.TAG0.OVERRIDE.REGENVAL_0 -= 25
		SRC.EVENTS +e_talon_effect
		SRC.TIMERF 10,F_CANCEL_TALONDEGEN
		ELSE
		SYSMESSAGELOC -1,1060174,<dLOCAL.MANACOST>
		ENDIF
	ENDIF
FLOAT.FINALDAMAGE=<FLOATVAL <dLOCAL.BASEDAMAGE>*(1+(<FLOAT.TOTALDAMAGEBONUS>/100))>
ARGN1=<EVAL <FEVAL <FLOAT.FINALDAMAGE>>+1>
	IF (<TAG0.SPECIALMOVE> == 13)
	LOCAL.MANACOST=<FEVAL <FLOATVAL ((15-<dLOCAL.BONUSMANA>)*(1-(<TAG0.LOWERMANACOST>/100)))>>
		IF (<MANA> >= <LOCAL.MANACOST>)
		F_WHIRLWIND_ATTACK <ARGN1> <SRC.UID>
		SOUND 673
			IF (<LOCAL.MANACOST> > 0)
			MANA -= <LOCAL.MANACOST>
			ENDIF
		ELSE
		SYSMESSAGELOC -1,1060174,<dLOCAL.MANACOST>
		ENDIF
	ELIF (<TAG0.SPECIALMOVE> == 15)
	LOCAL.MANACOST=<FEVAL <FLOATVAL ((30-<dLOCAL.BONUSMANA>)*(1-(<TAG0.LOWERMANACOST>/100)))>>
		IF (<TAG0.FRENZIEDWHIRLWIND>)
		SYSMESSAGELOC -1,1060089
		ELIF (<MANA> >= <LOCAL.MANACOST>)
			IF (<LOCAL.MANACOST> > 0)
			MANA -= <LOCAL.MANACOST>
			ENDIF
		TAG.FRENZIEDWHIRLWIND=2
		F_FRENZIED_WHIRLWIND=<EVAL ((<ARGN1>/3)*2)>
		TIMERF 2,F_FRENZIED_WHIRLWIND=<EVAL ((<ARGN1>/3)*2)>
		ELSE
		SYSMESSAGELOC -1,1060174,<dLOCAL.MANACOST>
		ENDIF
	ELIF (<TAG0.SPECIALMOVE> == 29)
	LOCAL.MANACOST=<FEVAL <FLOATVAL ((40-<dLOCAL.BONUSMANA>)*(1-(<TAG0.LOWERMANACOST>/100)))>>
		IF (<MANA> >= <LOCAL.MANACOST>)
		SYSMESSAGELOC -1,1074374
		SRC.SYSMESSAGELOC -1,1074375
			IF (<LOCAL.MANACOST> > 0)
			MANA -= <LOCAL.MANACOST>
			ENDIF
		ARGN1=<FEVAL <FLOATVAL <ARGN1>*1.65>>
		DAMAGE <R30,45> <DEF.DAM_PHYSICAL> <SRC>
		ELSE
		SYSMESSAGELOC -1,1060174,<dLOCAL.MANACOST>
		ENDIF
	ENDIF
	IF (<ARGO.TAG0.VELOCITY>)
		IF (<ARGO.TAG0.VELOCITY> >= <R1,100>)
		ARGN1 += <DISTANCE>
		ENDIF
	ENDIF
	IF !(<SRC.ISPLAYER>)
		IF (!(<ISEMPTY <TAG.ENEMYOFONE.TARGET>>))
			IF (<SRC.BASEID> == <TAG.ENEMYOFONE.TARGET>)
			ARGN1 += <EVAL <ARGN1>/2>
			SRC.EFFECT 3,i_fx_glow,16,20,,43
			ENDIF
		ENDIF
	ENDIF
	IF (<ARGO.TAG0.HITDISPEL>)
		IF (<SRC.FLAGS>&STATF_CONJURED)
			IF (<ARGO.TAG0.HITDISPEL> >= <R1,100>)
			SRC.SPELLEFFECT S_DISPEL,100.0,<UID>
			ENDIF
		ENDIF
	ENDIF
	IF (<ARGO.TAG0.HITFIREBALL>)
		IF (<ARGO.TAG0.HITFIREBALL> >= <R1,100>)
		SRC.SPELLEFFECT S_FIREBALL,<R500,1000>,<UID>
		ENDIF
	ENDIF
	IF (<ARGO.TAG0.HITHARM>)
		IF (<ARGO.TAG0.HITHARM> >= <R1,100>)
		SRC.SPELLEFFECT S_HARM,<R500,1000>,<UID>
		ENDIF
	ENDIF
	IF (<ARGO.TAG0.HITLIGHTNING>)
		IF (<ARGO.TAG0.HITLIGHTNING> >= <R1,100>)
		SRC.SPELLEFFECT s_lightning,<R500,1000>,<UID>
		ENDIF
	ENDIF
	IF (<ARGO.TAG0.MAGICARROW>)
		IF (<ARGO.TAG0.MAGICARROW> >= <R1,100>)
		SRC.SPELLEFFECT s_magic_arrow,<R650,1000>,<UID>
		ENDIF
	ENDIF
	IF (<ARGO.TAG0.HITPOISONAREA>)
		IF (<ARGO.TAG0.HITPOISONAREA> >= <R1,100>)
		POISONDAMAGEAREA <UID>
		ENDIF
	ENDIF
	IF (<ARGO.TAG0.ORB.EFEITO>)
	LOCAL.EFEITO=<ARGO.TAG0.ORB.EFEITO>
	ARGN2 |= <ARGO.TAG0.ORB.EFEITO>
		IF (<LOCAL.EFEITO>&08) && !(<SRC.FLAGS>&statf_poisoned)
		SRC.SPELLEFFECT s_poison,<magery>,<uid>
		ENDIF
		IF (<LOCAL.EFEITO>&010)
		ARGN1 += <R1,5>
		ENDIF
		IF (<LOCAL.EFEITO>&020)
		ARGN1 += <R1,5>
		ENDIF
		IF (<LOCAL.EFEITO>&0200) && !(<SRC.FLAGS>&statf_freeze)
		SRC.SPELLEFFECT s_paralyze,<magery>,<uid>
		ENDIF
		IF (<LOCAL.EFEITO>&01000)
		TRYSRC <UID> DAMAGEAREA <R<ARGO.DAM>> <SRC> <ARGO.UID>
		ENDIF
	ENDIF
	IF (3 >= <R1,100>) && (<WEAPON>)
	REF1=<WEAPON>
		IF (<REF1.HITS>)
		REF1.HITS --
		ELSE
		TRYSRC <UID> MESSAGE @,,2 1061121
		REF1.MAXHITS --
			IF (<REF1.MAXHITS> <= 0)
			REF1.REMOVE
			ENDIF
		ENDIF
		IF (<REF1.TAG0.SELFREPAIR>) && (!(<REF1.TAG0.JUSTREPAIRED>))
			IF (<REF1.HITS> < <REF1.MAXHITS>)
			REF1.HITS += <REF1.TAG0.SELFREPAIR>
				IF (<REF1.HITS> > <REF1.MAXHITS>)
				REF1.HITS=<REF1.MAXHITS>
				ENDIF
			REF1.TAG0.JUSTREPAIRED=1
			REF1.TIMERF 60,TAG.JUSTREPAIRED=
			ENDIF
		ENDIF
	REF1.RESENDTOOLTIP 1
	ENDIF
ENDIF
IF ((<TAG0.LIFELEECH>) || (<TAG0.STAMLEECH>) || (<TAG0.MANALEECH>))
	LOCAL.REALDEF=<SRC.AC>
	IF ((<LOCAL.REALDEF> > 80) && (!(<SRC.ISPLAYER>)))
	LOCAL.REALDEF=80
	ELIF ((<LOCAL.REALDEF> > 70) && (<SRC.ISPLAYER>))
	LOCAL.REALDEF=70
	ENDIF
LOCAL.DAMAGEGIVEN=<FEVAL <FLOATVAL <ARGN1>*(1-(<dLOCAL.REALDEF>/100))>>
	IF (<TAG0.LIFELEECH>)
	HITS += <R0,<FEVAL <FLOATVAL ((<dLOCAL.DAMAGEGIVEN>*0.45)*(<dTAG0.LIFELEECH>/100))>>>
		IF (<HITS> > <MAXHITS>)
		HITS=<MAXHITS>
		ENDIF
	ENDIF
	IF (<TAG0.STAMLEECH>)
		IF (<TAG0.STAMLEECH> >= <R1,100>)
		STAM += <dLOCAL.DAMAGEGIVEN>
			IF (<STAM> > <MAXSTAM>)
			STAM=<MAXSTAM>
			ENDIF
		ENDIF
	ENDIF
	IF (<TAG0.MANALEECH>)
	MANA += <R0,<FEVAL <FLOATVAL ((<dLOCAL.DAMAGEGIVEN>*0.45)*(<dTAG0.MANALEECH>/100))>>>
		IF (<MANA> > <MAXMANA>)
		MANA=<MAXMANA>
		ENDIF
	ENDIF
ENDIF

ON=@Death
SERV.LOG @DEATH: <name> (<uid>) at <region.name> (<p>), killed by <act.name> (<ACT>), who was in <act.region.name> (<act.p>)
IF (<ATTACKER>)
	FOR y 0 <EVAL <ATTACKER>-1>
		IF (<ATTACKER.<dLOCAL.Y>>)
			IF (<ATTACKER.<dLOCAL.Y>.DAM>)
			REF401=<ATTACKER.<dLOCAL.Y>>
				IF (<REF401.ISPLAYER>)
					IF (!(<REF401.ISINPARTY>))
					TAG.LOOTRIGHTLIST .= <REF401>;
					ELSE
					TAG.LOOTRIGHTLIST .= <REF401.F_LIST_ALLPARTYMEMBERS>
					ENDIF
				ENDIF
			ENDIF
		ENDIF
	ENDFOR
ENDIF
IF (<ATTACKER.LAST>)
	FORCHARMEMORYTYPE MEMORY_FIGHT
	COLOR |= <DEF.memory_harmedby>
	ENDFOR
ENDIF
MUSIC=42
FORCONT <UID> 0
	IF (!(<ATTR>&ATTR_NEWBIE))
		IF (<ISARMOR>) || (<ISWEAPON>) || (<TYPE> == T_CLOTHING) || (<TYPE> == T_JEWELRY)
		TAG.THIS.WASEQUIPPED=1
		ENDIF
	ENDIF
ENDFOR

ON=@DeathCorpse
ARGO.TAG.LOOTRIGHTLIST=<TAG.LOOTRIGHTLIST>
TAG.LOOTRIGHTLIST
LOCAL.INSUREGOLDGIVE=0
FORCONT <ARGO.UID> 9999
	IF (<ISEVENT.T_ITEM_INSURED>)
	LOCAL.INSUREGOLDGIVE += <EVAL (<DEF.INSURANCE_PRICE>*70)/100>
	EVENTS -T_ITEM_INSURED
	CONT=<SRC.FINDLAYER.21>
		IF (<SRC.TAG0.AUTORENEWINSURANCE>)
		SRC.TARGET_INSURE <UID>
		ENDIF
	ENDIF
ENDFOR
ARGO.UPDATE
IF (<LOCAL.INSUREGOLDGIVE>)
REF1=<ATTACKER.LAST>
	IF (<REF1.ISPLAYER>)
	REF1.GOLD += <LOCAL.INSUREGOLDGIVE>
	REF1.SYSMESSAGELOC -1,1042763,<dLOCAL.INSUREGOLDGIVE>
	ENDIF
ENDIF
SRC.FLAGS &= ~statf_war

ON=@ITEMDROPON_Ground
ACT.TIMERF 1,F_CHECK_PILING

ON=@ITEMDROPON_ITEM
REF1=<ARGO.UID>
IF (<REF1.TOPOBJ.TAG0.SALARY>)
	IF (<REF1.TOPOBJ.TAG0.OWNER> == <UID>)
		IF (<EVAL <REF1.TOPOBJ.WEIGHT>+<ACT.WEIGHT>> > 4110)
			REF1.TOPOBJ.SAY @,,2 503211 // I can't carry any more.
			RETURN 1
		ENDIF
		IF !(STRMATCH(<REF1.TAG.PRICE>,notforsell)) 
			IF (<REF1.TOPOBJ.UID>!=<REF1.CONT.UID>) && (<ISEMPTY <ACT.TAG.PRICE>>)
				SYSMESSAGE @,3,1 <DEF.SYS_NOTDROPON>
				RETURN 1
			ENDIF
		ENDIF
		IF (<ISEMPTY <ACT.TAG.PRICE>>)
			CTAG.VENDORUSER <ACT.UID>
			SYSMESSAGE @,,2 1043303,<ACT.NAME> // Type in a price and description for ~1_ITEM~ (ESC=not for sale)
			CTAG.REF1 <ACT.UID>
			ACT.TAG.PRICE notforsell
			ACT.EVENTS +T_ITENSOSELLING
			PROMPTCONSOLE F_SETPRICE
			ACT.FIX
			RETURN 0
		ENDIF
	ENDIF
ENDIF
SERV.LOG <name> (<uid>) stores <act.amount> <act.name> (<ACT>) in <argo.name> (<argo.uid>) [POS:<p>]

ON=@itemContextMenuSelect
IF (<ARGN1> == 687)
	SRC.CTAG.BUYING <ACT.UID>
	SRC.SDIALOG d_SELLCONFIRM
ENDIF

ON=@ContextMenuRequest
IF (<ARGN> == 1)
ARGN=2
ELSE
	IF (<SRC> == <UID>)
	SRC.AddContextEntry 300,6201
		IF (!<TAG0.AUTORENEWINSURANCE>)
		SRC.AddContextEntry 301,6200
		ELSE
		SRC.AddContextEntry 302,6202
		ENDIF
		IF (<SRC.ISEVENT.e_justice_protected>)
		SRC.AddContextEntry 303,100
		ENDIF
	SRC.AddContextEntry 304,6229
	SRC.AddContextEntry 305,6125
		IF (<SKILLTOTAL> >= 720.0)
			FOR 0 52
				IF (<I.<SERV.SKILL.<dLOCAL._FOR>.KEY>>)
				SRC.AddContextEntry <EVAL 1000+<LOCAL._FOR>>,<EVAL <DEF.TRAIN_SKILL_<dLOCAL._FOR>>>
				ENDIF
			ENDFOR
		ENDIF
	ENDIF
ENDIF

ON=@ContextMenuSelect
IF ((<ARGN> == 300) && !(<SRC.FLAGS>&STATF_DEAD))
SRC.INSURE
ELIF (<ARGN> == 301)
SRC.SYSMESSAGELOC 023,1060881
TAG.AUTORENEWINSURANCE=1
ELIF (<ARGN> == 302)
SRC.SYSMESSAGELOC 023,1061075
SRC.TAG.AUTORENEWINSURANCE=
ELIF (<ARGN> == 303)
cancelprotection
ELIF (<ARGN> == 304)
DIALOG D_REWARD_TITLE_SELECT
ELIF (<ARGN> == 305)
PROPS
ELIF (<ARGN> >= 1000)
DIALOG D_ZERAR_SKILL 1 <EVAL <ARGN1>-1000>
ENDIF

on=@Login
IF (<TAG0.PAGES_RESP.TOTAL>)
SDIALOG d_pages_resp_alerta
ENDIF
IF (<GUILD>)
	FOR 0 <EVAL <GUILD.MEMBER.COUNT>-1>
	REF2=<GUILD.MEMBER.<dLOCAL._FOR>.UID>
	REF2.SYSMESSAGE @0ad,3,1 Guild : <NAME> logged in at <REGION.NAME> (<MAPNAME>)
	ENDFOR
ENDIF
FINDID.i_peerless_logout_timer.REMOVE
FINDID.i_doom_gauntlet_logout.REMOVE
SERV.LOG @logIN <name> (<uid>) logou em <region.name> (<p>) (client <CLIENTVERSION>)

on=@logout
IF (<REGION.ISEVENT.r_peerless_area>) && (!(<ISGM>))
SERV.NEWITEM i_peerless_logout_timer,1,<UID>
ARGN1 *= 20
NEW.TIMER=<EVAL (<ARGN1>/10)-1>
ELIF (!(STRCMPI(<REGION.NAME>,Doom Gauntlet)))
SERV.NEWITEM i_doom_gauntlet_logout,1,<UID>
NEW.TIMER=<EVAL <SERV.CLIENTLINGER>+(6*60)>
ENDIF
LIST.LesserToTGive_<UID>.CLEAR
IF (<findid.i_rune_recall>)
findid.i_rune_recall.remove
ENDIF
IF (<GUILD>)
	FOR 0 <EVAL <GUILD.MEMBER.COUNT>-1>
	REF1=<GUILD.MEMBER.<dLOCAL._FOR>.UID>
	REF1.SYSMESSAGE @0ad Guild : <NAME> unlogged at <REGION.NAME> (<MAPNAME>)
	ENDFOR
ENDIF
IF (<uid.<region.uid>.type> == t_ship) 
	IF (<uid.<region.uid>.more1> == <uid>) 
		IF (<uid.<region.uid>.timer> > -1)
		TRY UID.<REGION.UID>.TIMER -1
		ENDIF
	ENDIF
ENDIF
SERV.LOG @logOUT <name> (<uid>) deslogou em <region.name> (<p>)

On=@GetHit
IF (<SRC.ISPLAYER>) && (<REGION.FLAGS>&REGION_FLAG_NO_PVP)
RETURN 1
ENDIF
IF (<ACTION> == SKILL_MAGERY) || (<ACTION> == SKILL_CHIVALRY) || (<ACTION> == SKILL_NECROMANCY)
	IF (!(<FINDID.i_rune_protection>))
	ACTION=-1
	ENDIF
ENDIF
IF (<SRC.TAG0.SPECIALMOVE>)
LOCAL.COMBATSKILLSUM=<EVAL <SRC.SWORDSMANSHIP>+<SRC.MACEFIGHTING>+<SRC.FENCING>+<SRC.ARCHERY>+<SRC.PARRYING>+<SRC.LUMBERJACKING>+<SRC.STEALTH>+<SRC.POISONING>+<SRC.BUSHIDO>+<SRC.NINJITSU>>
	IF (<LOCAL.COMBATSKILLSUM> > 300.0)
	LOCAL.BONUSMANA=10
	ELIF (<LOCAL.COMBATSKILLSUM> > 200.0)
	LOCAL.BONUSMANA=5
	ENDIF
ENDIF
IF (<REGION.SAFE> == 1)
RETURN 0
ENDIF
IF !(<TAG0.GOTHIT>)
	IF (!(<AC>))
	LOCAL.DEFEND=<EVAL (((<MAGICRESISTANCE>/10)-50)/3)*2>
	ELSE
	LOCAL.DEFEND=<AC>
	ENDIF
	IF (<FINDID.i_rune_protection>)
	LOCAL.DEFEND -= 10
	ENDIF
	IF (!(<SRC.ISPLAYER>))
		IF (<LOCAL.DEFEND> > 80)
		LOCAL.DEFEND=80
		ENDIF
	ELSE
		IF (<LOCAL.DEFEND> > 75)
		LOCAL.DEFEND=75
		ENDIF
	ENDIF
	IF (<FINDID.i_rune_protection>)
	LOCAL.DEFEND -= 5
		IF (<LOCAL.DEFEND> < 0)
		LOCAL.DEFEND=0
		ENDIF
	ENDIF
	IF (<TAG0.GOTHITBYSPELL>)
		IF (!(<SRC.ISPLAYER>))
			IF (!(<SRC.EVALUATINGINTEL>))
			SRC.EVALUATINGINTEL=<SRC.MAGERY>
			ENDIF
		ENDIF
	FLOAT.SPELLBASEDAMAGE=<FLOATVAL <R<SERV.SPELL.<dTAG0.GOTHITBYSPELL>.EFFECT>>>
	FLOAT.EVALUATEINTELBONUS=<FLOATVAL (((<SRC.EVALUATINGINTEL>*3)/100)+1)>
	FLOAT.SPELLDAMAGEINCREASE=<FLOATVAL <SRC.INT>/10>
		IF (<SRC.INSCRIPTION> >= 100.0)
		FLOAT.SPELLDAMAGEINCREASE=<FLOATVAL <FLOAT.SPELLDAMAGEINCREASE>+10>
		ENDIF
		IF (<SRC.TAG0.MAGICDAMINCREASE>)
		LOCAL.ITEMSPELLDAMAGEINCREASE=<SRC.TAG0.MAGICDAMINCREASE>
			IF (<LOCAL.ITEMSPELLDAMAGEINCREASE> > 15)
			LOCAL.ITEMSPELLDAMAGEINCREASE=15
			ENDIF
		FLOAT.SPELLDAMAGEINCREASE=<FLOATVAL <FLOAT.SPELLDAMAGEINCREASE>+<dLOCAL.ITEMSPELLDAMAGEINCREASE>>
		ENDIF
	FLOAT.SPELLBASEDAMAGE=<FLOATVAL ((<FLOAT.SPELLBASEDAMAGE>*<FLOAT.EVALUATEINTELBONUS>)*((<FLOAT.SPELLDAMAGEINCREASE>/100)+1))>
	ARGN1=<FEVAL <FLOAT.SPELLBASEDAMAGE>>
		IF (<TAG0.GOTHITBYSPELL> == 12) //harm
			IF (<DISTANCE> == 2)
			ARGN1 /= 2
			ELIF (<DISTANCE> > 2)
			ARGN1 /= 4
			ENDIF
		ENDIF
	TAG.GOTHITBYSPELL
	ENDIF
	IF !(<ARGN2>&DAM_GOD)
		IF (<ARGN1> > 330)
		ARGN1=330
		ENDIF
		IF (<SRC.TAG0.SPECIALMOVE> == 1)
		LOCAL.MANACOST=<FEVAL <FLOATVAL ((30-<dLOCAL.BONUSMANA>)*(1-(<SRC.TAG0.LOWERMANACOST>/100)))>>
			IF (<SRC.MANA> >= <LOCAL.MANACOST>)
			LOCAL.DEFEND=5
			SRC.SYSMESSAGELOC -1,1060076
				IF (<LOCAL.MANACOST> > 0)
				SRC.MANA -= <LOCAL.MANACOST>
				ENDIF
			ELSE
			SRC.SYSMESSAGELOC -1,1060174,<dLOCAL.MANACOST>
			ENDIF
		SRC.TAG.SPECIALMOVE
		SRC.F_CANCELSPECIALMOVE
		SRC.EVENTS -E_SPECIAL_MOVE
		ENDIF
	ARGN1=<FEVAL <FLOATVAL <ARGN1>*(1-(<dLOCAL.DEFEND>/100))>>
		IF (!(<SRC.ISPLAYER>))
			IF (!(<ISEMPTY <TAG.ENEMYOFONE.TARGET>>))
				IF (<TAG.ENEMYOFONE.TARGET> != <SRC.BASEID>)
				ARGN1 *= 2
				ENDIF
			ENDIF
			IF ((<ARGN1> > 75)
			ARGN1=75
			ENDIF
		ENDIF
		IF (<TAG0.DAMAGERETURN>) && (<SRC.UID> != <UID>)
			IF !(<R4>) && (!(<ARGN2>&DAM_MAGIC)) && (!(<ARGN2>&<DEF.dam_drain>)) && (!(<TAG0.GOTHITBYSPELL>))
			LOCAL.DAMAGERETURN=<TAG0.DAMAGERETURN>
				IF (<LOCAL.DAMAGERETURN> > 35)
				LOCAL.DAMAGERETURN=35
				ENDIF
			SRC.DAMAGE <EVAL ((<ARGN1>*<LOCAL.DAMAGERETURN>)/100)> <DEF.dam_physical> <UID>
			ENDIF
		ENDIF
	TAG.GOTHIT=1
		IF (!(<ARGN2>&<DEF.DAM_MAGIC>))
		STAM -= <EVAL <ARGN1>/3>
		ENDIF
		IF (<STAM> < 1)
		STAM=1
		ENDIF
	REF1=<FINDLAYER.<DEF.layer_horse>.UID>
		IF (<REF1>)
			IF (<REF1.TAG0.BARDINGEFFECT>)
			LOCAL.DAMAGEREDUCTION=<EVAL (<ARGN1>*<REF1.TAG0.BARDINGEFFECT>)/100>
			ARGN1 -= <LOCAL.DAMAGEREDUCTION>
				IF (<EVAL <REF1.HITS>-<LOCAL.DAMAGEREDUCTION>> > 0)
				REF1.HITS -= <LOCAL.DAMAGEREDUCTION>
				ELSE
				REF1.KILL
				ENDIF
			ENDIF
		ENDIF	
		IF (!(<SRC.OWNER>))
		DAMAGE <ARGN1> <HVAL <ARGN2>|<DEF.DAM_GOD>> <SRC>
		ELSE
		DAMAGE <ARGN1> <HVAL <ARGN2>|<DEF.DAM_GOD>|<DEF.dam_noreveal>> <SRC.OWNER>
		ENDIF
		IF (2 > <R100>)
		DAMAGEARMOR
		ENDIF
	RETURN 1
	ENDIF
ELSE
SRC.TRIGGER @GaveDamage,<def.TAT_AS_ARGN>,<ARGN1>,<ARGN2>,<UID>
TAG.GOTHIT
ENDIF

[EOF]