//The main stuff is here, but some moves are scattered around, mostly on e_npc.scp and e_player.scp, within
//the calculation parts.

[FUNCTION F_CANCELSPECIALMOVE]
IF (<ISONLINE>)
sendpacket 0bf W05 W021
ENDIF
TAG.DOINGDOUBLESTRIKE
FLAGS &= ~<DEF.STATF_ArcherCanMove>

[FUNCTION F_CANCEL_TALONDEGEN]
IF (<ISEVENT.e_talon_effect>)
TAG0.OVERRIDE.REGENVAL_0 += 25
	IF (<TAG0.OVERRIDE.REGENVAL_0> == 0)
	TAG.OVERRIDE.REGENVAL_0=
	ENDIF
EVENTS -e_talon_effect
ENDIF

[EVENTS e_talon_effect]
ON=@Death
F_CANCEL_TALONDEGEN

[FUNCTION F_PSYCHIC_ATTACK_REMOVEEFFECT]
TAG0.MAGICDAMINCREASE += <TAG0.PSYCHICATTACK>
IF (<ISPLAYER>)
REMOVEBUFF 1017
ENDIF
TAG.PSYCHICATTACK=
IF (<TAG0.MAGICDAMINCREASE> == 0)
TAG.MAGICDAMINCREASE=
ENDIF

[FUNCTION F_LIGHTNING_ARROW]
REF1=<UID>
DAMAGE <R32,45> <DEF.DAM_PHYSICAL> <ARGN1>
FORCHARS 5
	IF (<LOCAL.DAMAGED> >= 2)
	RETURN 1
	ENDIF
	IF ((<UID> != <ARGN1>) && (<UID> != <REF1>))
		IF (<ISFIGHTINGME <ARGN1>>)
		DAMAGE <R30,43> <DEF.DAM_PHYSICAL> <ARGN1>
		LOCAL.DAMAGED ++
		ENDIF
	ENDIF
ENDFOR

[FUNCTION F_SPECIALMOVE_BLOCK_CANCEL]
TAG0.HITCHANCEDECREASE -= 90
IF (!(<TAG0.HITCHANCEDECREASE>))
TAG.HITCHANCEDECREASE=
ENDIF

[FUNCTION F_WHIRLWIND_ATTACK]
REF1=<UID>
FORCHARS 1
	IF (<UID> != <REF1.UID>) && (<UID> != <ARGN2>)
		IF (!<ISBENEFICIAL <REF1>>)
		DAMAGE <ARGN1> <DEF.DAM_PHYSICAL> <REF1>
		ENDIF
	ENDIF
ENDFOR

[FUNCTION F_FRENZIED_WHIRLWIND]
TAG0.FRENZIEDWHIRLWIND --
REF1=<UID>
IF (!(<TAG0.FRENZIEDWHIRLWIND>))
TAG.FRENZIEDWHIRLWIND=
ENDIF
IF (!(<FLAGS>&STATF_DEAD))
SOUND=1318
	FORCHARS 2
		IF (<UID> != <REF1.UID>)
			IF (!<ISBENEFICIAL <REF1>>)
			DAMAGE <ARGN1> <DEF.DAM_PHYSICAL> <REF1>
			ENDIF
		ENDIF
	ENDFOR
ENDIF

[FUNCTION REMOVEMORTALWOUND]
TAG.MORTALWOUNDED=
IF (<ISPLAYER>)
SYSMESSAGELOC -1,1060208
REMOVEBUFF 1027
ENDIF

[ITEMDEF i_bleeding_timer]
ID=i_memory
TYPE=T_EQ_SCRIPT
NAME=bleeding

ON=@Timer
CONT.DAMAGE <EVAL 4+(<MORE1>*3)> <DEF.DAM_PHYSICAL> <LINK>
CONT.SOUND=307
MORE1 --
IF !(<MORE1>)
CONT.SYSMESSAGELOC -1,1060167
REMOVE
ELSE
TIMER=2
ENDIF
RETURN 1

[EVENTS e_paralyze_blow]
ON=@SkillStart
ACTION -1
RETURN 1

ON=@HitTry
ACTION -1
RETURN 1

ON=@GetHit
TAG.NoMoveTill
SYSMESSAGELOC -1,502382
EVENTS -e_paralyze_blow

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

[EVENTS E_SPECIAL_MOVE]
ON=@ItemUnEquip
IF (<ACT.ISWEAPON>)
TAG.SPECIALMOVE
F_CANCELSPECIALMOVE
EVENTS -E_SPECIAL_MOVE
ENDIF

ON=@ItemEquip
IF (<ACT.ISWEAPON>)
TAG.SPECIALMOVE
F_CANCELSPECIALMOVE
EVENTS -E_SPECIAL_MOVE
ENDIF

ON=@LogIn
TAG.SPECIALMOVE
F_CANCELSPECIALMOVE
EVENTS -E_SPECIAL_MOVE

ON=@HitTry
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
IF (<TAG0.SPECIALMOVE> == 21)
FLOAT.MANACOST=<FLOATVAL ((25-<dLOCAL.BONUSMANA>)*(1-(<dTAG0.LOWERMANACOST>/100)))>
	IF (<MANA> >= <FEVAL <FLOAT.MANACOST>>)
	SYSMESSAGELOC -1,1063362
		IF (<FLOAT.MANACOST> > 0)
		MANA -= <FEVAL <FLOAT.MANACOST>>
		ENDIF
	SOUND 1316
	ARGN1=4
	ELSE
	SYSMESSAGELOC -1,1060174,<FEVAL <FLOAT.MANACOST>>
	ENDIF
TAG.SPECIALMOVE
F_CANCELSPECIALMOVE
EVENTS -E_SPECIAL_MOVE
ENDIF

ON=@Hit
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
IF (<TAG0.SPECIALMOVE> == 2)
FLOAT.MANACOST=<FLOATVAL ((30-<dLOCAL.BONUSMANA>)*(1-(<dTAG0.LOWERMANACOST>/100)))>
	IF (<MANA> >= <FEVAL <FLOAT.MANACOST>>)
		IF (<SRC.FINDID.i_bleeding_timer>)
		SYSMESSAGELOC -1,1062052
		ELSE
		SERV.NEWITEM i_bleeding_timer,1,<SRC>
		NEW.MORE1=5
		NEW.TIMER=2
		NEW.LINK=<UID>
		SYSMESSAGELOC -1,1060758,<SRC.NAME>
		SRC.SYSMESSAGELOC -1,1060757
			IF (<FLOAT.MANACOST> > 0)
			MANA -= <FEVAL <FLOAT.MANACOST>>
			ENDIF
		ENDIF
	ELSE
	SYSMESSAGELOC -1,1060174,<FEVAL <FLOAT.MANACOST>>
	ENDIF
ELIF (<TAG0.SPECIALMOVE> == 3)
FLOAT.MANACOST=<FLOATVAL ((25-<dLOCAL.BONUSMANA>)*(1-(<dTAG0.LOWERMANACOST>/100)))>
	IF (<MANA> >= <FEVAL <FLOAT.MANACOST>>)
	FLOAT.PERCENTAGEMANA=<FLOATVAL ((<SRC.MANA>*100)/<SRC.MAXMANA>)>
	FLOAT.PERCENTAGEHITS=<FLOATVAL ((<SRC.HITS>*100)/<SRC.MAXHITS>)>
	LOCAL.DAMAGE=<FEVAL <FLOATVAL ((<FLOAT.PERCENTAGEMANA>-<FLOAT.PERCENTAGEHITS>)/4)>>
	LOCAL.DAMAGE += 10
		IF (<LOCAL.DAMAGE> > 30)
		LOCAL.BONUSDAMAGE=30
		ENDIF
	SRC.DAMAGE <LOCAL.DAMAGE> <DEF.DAM_GOD> <UID>
	SYSMESSAGELOC -1,1060165
	SRC.SYSMESSAGELOC -1,1060166
		IF (<FLOAT.MANACOST> > 0)
		MANA -= <FEVAL <FLOAT.MANACOST>>
		ENDIF
	ELSE
	SYSMESSAGELOC -1,1060174,<FEVAL <FLOAT.MANACOST>>
	ENDIF
ELIF (<TAG0.SPECIALMOVE> == 5)
	IF (<SRC.ISPLAYER>)
	FLOAT.MANACOST=<FLOATVAL ((25-<dLOCAL.BONUSMANA>)*(1-(<dTAG0.LOWERMANACOST>/100)))>
		IF (<MANA> >= <FEVAL <FLOAT.MANACOST>>)
		SRC.UNEQUIP <SRC.FINDLAYER.1.UID>
		SRC.UNEQUIP <SRC.FINDLAYER.2.UID>
		SYSMESSAGELOC -1,1060092
		SRC.SYSMESSAGELOC -1,1060093
			IF (<FLOAT.MANACOST> > 0)
			MANA -= <FEVAL <FLOAT.MANACOST>>
			ENDIF
		ELSE
		SYSMESSAGELOC -1,1060174,<FEVAL <FLOAT.MANACOST>>
		ENDIF
	ELSE
	SYSMESSAGELOC -1,1004001
	ENDIF
ELIF (<TAG0.SPECIALMOVE> == 6)
	IF (<FLAGS>&STATF_ONHORSE)
	SYSMESSAGELOC -1,1061089
	ELIF (<SRC.ISPLAYER>) && (<SRC.FLAGS>&STATF_ONHORSE)
	FLOAT.MANACOST=<FLOATVAL ((20-<dLOCAL.BONUSMANA>)*(1-(<dTAG0.LOWERMANACOST>/100)))>
		IF (<MANA> >= <FEVAL <FLOAT.MANACOST>>)
		SRC.DCLICK <SRC.UID>
		SRC.SYSMESSAGELOC -1,1060083
		SYSMESSAGELOC -1,1060082
			IF (<FLOAT.MANACOST> > 0)
			MANA -= <FEVAL <FLOAT.MANACOST>>
			ENDIF
		ELSE
		SYSMESSAGELOC -1,1060174,<FEVAL <FLOAT.MANACOST>>
		ENDIF
	ELSE
	SYSMESSAGELOC -1,1040022
	ENDIF
ELIF (<TAG0.SPECIALMOVE> == 7)
FLOAT.MANACOST=<FLOATVAL ((30-<dLOCAL.BONUSMANA>)*(1-(<dTAG0.LOWERMANACOST>/100)))>
	IF (<MANA> >= <FEVAL <FLOAT.MANACOST>>)
	SYSMESSAGELOC -1,1060084
	SRC.SYSMESSAGELOC -1,1060085
	TAG.DOINGDOUBLESTRIKE=1
		IF (<FLOAT.MANACOST> > 0)
		MANA -= <FEVAL <FLOAT.MANACOST>>
		ENDIF
	ELSE
	SYSMESSAGELOC -1,1060174,<FEVAL <FLOAT.MANACOST>>
	ENDIF
ELIF (<TAG0.SPECIALMOVE> == 8)
FLOAT.MANACOST=<FLOATVAL ((15-<dLOCAL.BONUSMANA>)*(1-(<dTAG0.LOWERMANACOST>/100)))>
	IF (<MANA> >= <FEVAL <FLOAT.MANACOST>>)
	SRC.SPELLEFFECT S_POISON,<EVAL <POISONING>+10>,<UID>
		IF (<FLOAT.MANACOST> > 0)
		MANA -= <FEVAL <FLOAT.MANACOST>>
		ENDIF
	ELSE
	SYSMESSAGELOC -1,1060174,<FEVAL <FLOAT.MANACOST>>
	ENDIF
ELIF (<TAG0.SPECIALMOVE> == 9)
FLOAT.MANACOST=<FLOATVAL ((30-<dLOCAL.BONUSMANA>)*(1-(<dTAG0.LOWERMANACOST>/100)))>
	IF (<MANA> >= <FEVAL <FLOAT.MANACOST>>)
	SRC.TAG.MORTALWOUNDED=1
	SRC.TIMERF 6,REMOVEMORTALWOUND
	SYSMESSAGELOC -1,1060086
		IF (<SRC.ISPLAYER>)
		SRC.SYSMESSAGELOC -1,1060087
		SRC.ADDBUFF 1027 1028846 1060087 6 oi
		ENDIF
		IF (<FLOAT.MANACOST> > 0)
		MANA -= <FEVAL <FLOAT.MANACOST>>
		ENDIF
	ELSE
	SYSMESSAGELOC -1,1060174,<FEVAL <FLOAT.MANACOST>>
	ENDIF
ELIF (<TAG0.SPECIALMOVE> == 11)
FLOAT.MANACOST=<FLOATVAL ((30-<dLOCAL.BONUSMANA>)*(1-(<dTAG0.LOWERMANACOST>/100)))>
	IF (<SRC.ISEVENT.e_paralyze_blow>) || (<TAG0.JUSTGAVEAPARALYZEBLOW>)
	SYSMESSAGELOC -1,1004010
	ELIF (<MANA> >= <FEVAL <FLOAT.MANACOST>>)
	TAG.JUSTGAVEAPARALYZEBLOW=1
		IF (<SRC.ISPLAYER>)
		SRC.TIMERF 4,EVENTS -e_paralyze_blow
		TIMERF 4,TAG.JUSTGAVEAPARALYZEBLOW=
		SRC.TAG.NoMoveTill=<EVAL <SERV.TIME>+40>
		SRC.TIMERF 4,TAG.NoMoveTill
		ELSE
		SRC.TIMERF 7,EVENTS -e_paralyze_blow
		TIMERF 7,TAG.JUSTGAVEAPARALYZEBLOW=
		SRC.TAG.NoMoveTill=<EVAL <SERV.TIME>+70>
		SRC.TIMERF 7,TAG.NoMoveTill
		ENDIF
	SYSMESSAGELOC -1,1060163
	SRC.SYSMESSAGELOC -1,1060164
	SRC.TIMERF 1,EVENTS +e_paralyze_blow
		IF (<FLOAT.MANACOST> > 0)
		MANA -= <FEVAL <FLOAT.MANACOST>>
		ENDIF
	ELSE
	SYSMESSAGELOC -1,1060174,<FEVAL <FLOAT.MANACOST>>
	ENDIF
ELIF (<TAG0.SPECIALMOVE> == 23)
FLOAT.MANACOST=<FLOATVAL ((30-<dLOCAL.BONUSMANA>)*(1-(<dTAG0.LOWERMANACOST>/100)))>
	IF (<MANA> >= <FEVAL <FLOAT.MANACOST>>)
	SYSMESSAGELOC -1,1063350
	SRC.SYSMESSAGELOC -1,1063351
		IF (<FLOAT.MANACOST> > 0)
		MANA -= <FEVAL <FLOAT.MANACOST>>
		ENDIF
	SRC.DAMAGE <EVAL ((<ARGN1>*50)/100)> <DEF.DAM_PHYSICAL> <UID>
	ELSE
	SYSMESSAGELOC -1,1060174,<FEVAL <FLOAT.MANACOST>>
	ENDIF
ELIF (<TAG0.SPECIALMOVE> == 22)
FLOAT.MANACOST=<FLOATVAL ((30-<dLOCAL.BONUSMANA>)*(1-(<dTAG0.LOWERMANACOST>/100)))>
	IF (<MANA> >= <FEVAL <FLOAT.MANACOST>>)
	SYSMESSAGELOC -1,1063348
	SRC.SYSMESSAGELOC -1,1063349
		IF (<FLOAT.MANACOST> > 0)
		MANA -= <FEVAL <FLOAT.MANACOST>>
		ENDIF
	SOUND 1314
	SRC.DAMAGE <ARGN1> <DEF.DAM_PHYSICAL> <UID>
	ELSE
	SYSMESSAGELOC -1,1060174,<FEVAL <FLOAT.MANACOST>>
	ENDIF
ELIF (<TAG0.SPECIALMOVE> == 16)
FLOAT.MANACOST=<FLOATVAL ((30-<dLOCAL.BONUSMANA>)*(1-(<dTAG0.LOWERMANACOST>/100)))>
	IF (<MANA> >= <FEVAL <FLOAT.MANACOST>>)
	SYSMESSAGELOC -1,1063345
	SRC.SYSMESSAGELOC -1,1063346
		IF (<FLOAT.MANACOST> > 0)
		MANA -= <FEVAL <FLOAT.MANACOST>>
		ENDIF
	TAG0.HITCHANCEDECREASE += 90
	SOUND 1312
	TIMERF 3,F_SPECIALMOVE_BLOCK_CANCEL
	ELSE
	SYSMESSAGELOC -1,1060174,<FEVAL <FLOAT.MANACOST>>
	ENDIF
ELIF (<TAG0.SPECIALMOVE> == 20)
FLOAT.MANACOST=<FLOATVAL ((30-<dLOCAL.BONUSMANA>)*(1-(<dTAG0.LOWERMANACOST>/100)))>
	IF (<TAG0.FEINTABILITY>)
	SYSMESSAGELOC -1,1060089
	ELIF (<MANA> >= <FEVAL <FLOAT.MANACOST>>)
	SYSMESSAGELOC -1,1063360
	SRC.SYSMESSAGELOC -1,1063361
		IF (<FLOAT.MANACOST> > 0)
		MANA -= <FEVAL <FLOAT.MANACOST>>
		ENDIF
	TAG.FEINTABILITY=1
	TIMERF 4,TAG.FEINTABILITY=
	SOUND 1317
	ELSE
	SYSMESSAGELOC -1,1060174,<FEVAL <FLOAT.MANACOST>>
	ENDIF
ELIF (<TAG0.SPECIALMOVE> == 18)
FLOAT.MANACOST=<FLOATVAL ((30-<dLOCAL.BONUSMANA>)*(1-(<dTAG0.LOWERMANACOST>/100)))>
	IF (<MANA> >= <FEVAL <FLOAT.MANACOST>>)
	SYSMESSAGELOC -1,1063356
	SRC.SYSMESSAGELOC -1,1063357
		IF (<FLOAT.MANACOST> > 0)
		MANA -= <FEVAL <FLOAT.MANACOST>>
		ENDIF
	SOUND 1468
	SRC.DAMAGE <FEVAL <FLOATVAL ((((<BUSHIDO>-50)*3)/14)+<R0,10>)>> <DEF.DAM_GOD> <UID>
	SRC.SPELLEFFECT S_PARALYZE,0.1,<UID>
	ELSE
	SYSMESSAGELOC -1,1060174,<FEVAL <FLOAT.MANACOST>>
	ENDIF
ELIF (<TAG0.SPECIALMOVE> == 14)
	IF (<SRC.ISPLAYER>) && (<SRC.FLAGS>&STATF_ONHORSE)
	FLOAT.MANACOST=<FLOATVAL ((30-<dLOCAL.BONUSMANA>)*(1-(<dTAG0.LOWERMANACOST>/100)))>
		IF (<MANA> >= <FEVAL <FLOAT.MANACOST>>)
			IF (!(<FLAGS>&STATF_ONHORSE))
			SRC.DAMAGE <FEVAL <FLOATVAL ((((<BUSHIDO>-50)*3)/14)+<R0,10>)>> <DEF.DAM_GOD> <UID>
			SRC.DCLICK <SRC.UID>
			ELSE
			SRC.DAMAGE <FEVAL <FLOATVAL ((((<BUSHIDO>-50)*3)/14)+<R5,18>)>> <DEF.DAM_GOD> <UID>
			ENDIF
		SRC.SYSMESSAGELOC -1,1060083
		SYSMESSAGELOC -1,1060082
			IF (<FLOAT.MANACOST> > 0)
			MANA -= <FEVAL <FLOAT.MANACOST>>
			ENDIF
		ELSE
		SYSMESSAGELOC -1,1060174,<FEVAL <FLOAT.MANACOST>>
		ENDIF
	ELSE
	SYSMESSAGELOC -1,1040022
	ENDIF
ELIF (<TAG0.SPECIALMOVE> == 25)
FLOAT.MANACOST=<FLOATVAL ((20-<dLOCAL.BONUSMANA>)*(1-(<dTAG0.LOWERMANACOST>/100)))>
	IF (<MANA> >= <FEVAL <FLOAT.MANACOST>>)
	SYSMESSAGELOC -1,1074381
	SRC.SYSMESSAGELOC -1,1074382
		IF (<FLOAT.MANACOST> > 0)
		MANA -= <FEVAL <FLOAT.MANACOST>>
		ENDIF
	SRC.DAMAGE 15 <DEF.DAM_GOD> <UID>
		IF (!(<SRC.ISPLAYER>))
			IF (50 >= <R100>)
			SRC.FLAGS &= ~statf_war
			SRC.REMOVEALLMEMS memory_war_targ
			SRC.ACTION=06d
			ENDIF
		ENDIF
	ELSE
	SYSMESSAGELOC -1,1060174,<FEVAL <FLOAT.MANACOST>>
	ENDIF
ELIF (<TAG0.SPECIALMOVE> == 26)
FLOAT.MANACOST=<FLOATVAL ((20-<dLOCAL.BONUSMANA>)*(1-(<dTAG0.LOWERMANACOST>/100)))>
	IF (<MANA> >= <FEVAL <FLOAT.MANACOST>>)
		IF (<FLOAT.MANACOST> > 0)
		MANA -= <FEVAL <FLOAT.MANACOST>>
		ENDIF
	SRC.F_LIGHTNING_ARROW <UID>
	ELSE
	SYSMESSAGELOC -1,1060174,<FEVAL <FLOAT.MANACOST>>
	ENDIF
ELIF (<TAG0.SPECIALMOVE> == 28)
FLOAT.MANACOST=<FLOATVAL ((40-<dLOCAL.BONUSMANA>)*(1-(<dTAG0.LOWERMANACOST>/100)))>
	IF (<MANA> >= <FEVAL <FLOAT.MANACOST>>)
		IF (<FLOAT.MANACOST> > 0)
		MANA -= <FEVAL <FLOAT.MANACOST>>
		ENDIF
	SRC.SPELLEFFECT S_POISON,<EVAL <POISONING>+100>,<UID>
	SKILLGAIN POISONING <EVAL (<POISONING>/10)+1>
	ELSE
	SYSMESSAGELOC -1,1060174,<FEVAL <FLOAT.MANACOST>>
	ENDIF
ELIF (<TAG0.SPECIALMOVE> == 27)
FLOAT.MANACOST=<FLOATVAL ((30-<dLOCAL.BONUSMANA>)*(1-(<dTAG0.LOWERMANACOST>/100)))>
	IF (<SRC.TAG0.PSYCHICATTACK>)
	SYSMESSAGELOC -1,1060089
	ELIF (<MANA> >= <FEVAL <FLOAT.MANACOST>>)
		IF (<FLOAT.MANACOST> > 0)
		MANA -= <FEVAL <FLOAT.MANACOST>>
		ENDIF
	SYSMESSAGELOC -1,1074383
	LOCAL.FORCE=<EVAL 4+(<INT>/10)>
		IF (<SRC.ISPLAYER>)
		SRC.SYSMESSAGELOC -1,1074384
		SRC.ADDBUFF 1017 1074384 1060483 6 -<dLOCAL.FORCE>
		ENDIF
	SRC.TAG0.MAGICDAMINCREASE -= <LOCAL.FORCE>
	SRC.TAG.PSYCHICATTACK=<LOCAL.FORCE>
	SRC.TIMERF 6,F_PSYCHIC_ATTACK_REMOVEEFFECT
	ELSE
	SYSMESSAGELOC -1,1060174,<FEVAL <FLOAT.MANACOST>>
	ENDIF
ENDIF
IF (<TAG0.SPECIALMOVE> != 1)
TAG.SPECIALMOVE
F_CANCELSPECIALMOVE
EVENTS -E_SPECIAL_MOVE
ENDIF

ON=@GetHit
IF (<TAG0.FEINTABILITY>)
ARGN1 /= 2
ENDIF

[EOF]