;========================================================
; To turn Kikyo's Anti-cheapo mode on or off, scroll down
;========================================================

;---------------------------------------------------------------------------
; Override common states (use same number to override) :
;---------------------------------------------------------------------------

;---------------------------------------------------------------------------
; States that are always executed (use statedef -2)
;---------------------------------------------------------------------------

[Statedef -2]
;Double Team Selector
[State -2, Helper]
type = Helper
trigger1 = (TeamMode = Single) || (Teammode = turns)
trigger1 = time = 0
trigger1 = roundstate = 0 ;Intro
;trigger1 = roundsexisted <= 0 ;First round only
ID = 10000 ;ID
stateno = 10000 ;State No of the groove which i will explain later
postype = p1
pos = 0,0 ;DO NOT CHANGE THIS,its just an invisible helper
name = "Tag Select" ;Name of the invis helper
ontop = 1
bindtime = -1

[State -2, VarSet]
type = Varset
trigger1 = teammode = simul
v = 47
value = 0

[State -2, Anti Cheapo Mode On/Off]
type = VarSet
trigger1 = Name = "Metal_Kikyo"
v = 10
value = 1 ;0             ; Anti-cheap Mode replaced with Metal Kikyo

[State -2, Anti Cheapo Mode Active]
type = VarSet
trigger1 = Name = "Metal_Kikyo"
v = 11
value = 1

[State -2, Metal Heal]
type = LifeAdd
triggerall = Var(10) != 0
triggerall = Var(11) != 0
triggerall = StateNo = 2000 ; Can only heal when Curse Deflector is used
trigger1 = AnimElem = 16
value = 200
;absolute = 1

[State -2, Metal Invincible]
type = NotHitBy
triggerall = Var(10) != 0
triggerall = Var(11) != 0
trigger1 = StateNo = 2000 ; when Curse Deflector is used
;trigger1 = MoveType = A
trigger2 = (Enemy,Name = "OmegaTH") && (Enemy,Authorname = "Neo Ankh & ShinRyoga")
; Always active if facing Omega Tom Hanks
value = SCA

[State -2, Metal Armor "Save the States!" Campaign]
type = VarSet
triggerall = Var(10) != 0
triggerall = Var(11) != 0
trigger1 = Life > 1
trigger1 = MoveType != H
;trigger1 = StateNo != 9000
var(46) = StateNo
ignorehitpause = 1

;[State -2, Metal Armor "Save the States!" Campaign]
;type = VarSet
;triggerall = Var(10) != 0
;triggerall = Var(11) != 0
;trigger1 = Life > 1
;trigger1 = StateNo != [120,159]
;trigger1 = StateNo != 9000
;var(46) = StateNo
;ignorehitpause = 1

;---------------------------------------------------------------------------
; States that are executed when in self's state file (use statedef -3)
;---------------------------------------------------------------------------

[State -3, Metal Armor]
type = HitOverride
triggerall = Var(10) != 0
triggerall = Var(11) != 0
trigger1 = Random <= 1000
trigger1 = MoveType != H
;trigger1 = Anim != 5300
;trigger1 = StateNo != [120,159]
;trigger1 = PrevStateNo != 9000
;ignorehitpause = 1
time = 1
slot = 2
attr = SCA,AA,AP,AT
stateno = 9000

[Statedef -3]
;This controller plays a sound everytime Kikyo lands from a jump, or
;from her back-dash.
[State -3, Landing Sound]
type = PlaySnd
triggerall = Time = 1
triggerall = name != "Metal_Kikyo"
trigger1 = stateno = 52 ;Jump land
trigger2 = stateno = 106 ;Run-back land
value = 40, 0

[State -3, Landing Sound]
type = PlaySnd
triggerall = Time = 1
triggerall = name = "Metal_Kikyo"
trigger1 = stateno = 52 ;Jump land
trigger2 = stateno = 106 ;Run-back land
trigger3 = (stateno = 20) && (animelem = 5)
trigger4 = (stateno = 21) && (animelem = 14)
;trigger5 = (anim = 21) && (animelem = 2)
;trigger6 = (anim = 21) && (animelem = 11)
value = 9000, 0

[State -3, Dashing Sound]
type = PlaySnd
trigger1 = (stateno = 100) && (AnimElem = 4)
trigger2 = (stateno = 105) && (AnimElem = 2)
value = 100, 0

[State -3, Dust]
type = MakeDust
trigger1 = (stateno = 105) && (AnimElem = 2)
pos = 0,0
spacing = 1

[State -3, Hitsound 1]
type = PlaySnd
triggerall = Time = 1
triggerall = Random <= 500
triggerall = Life > 0 ;Too lazy to use Alive trigger
trigger1 = StateNo = 5000
trigger2 = StateNo = 5020
value = 5000, 0
channel = 0

[State -3, Hitsound 2]
type = PlaySnd
triggerall = Time = 1
triggerall = Random <= 500
triggerall = Life > 0 ;Too lazy to use Alive trigger
trigger1 = StateNo = 5010
trigger2 = StateNo = 5030
trigger3 = StateNo = 5070
value = 5000, 1
channel = 0

[State -3, Kikyo gets up]
type = PlaySnd
triggerall = Time = 1
triggerall = Random <= 350
triggerall = Life <= 333 ;Only said if 33% health to reduce annoyance
triggerall = Life > 0 ;Too lazy to use Alive trigger
trigger1 = StateNo = 5120
value = 5120, 0
channel = 0

; AI Guard/Block, taken from Necromancer's code archive
[State -3, StandGuard]
type = ChangeState
triggerall = (Var(59) = 1) && (StateType = S) && (Pos Y >= 0) && (P2BodyDist Y <= 0)
triggerall = (P2BodyDist Y >= -120) && (P2StateType != C) && (P2MoveType = A)
trigger1 = (P2BodyDist X <= 120) && (Random <= 799) && (Ctrl)
trigger2 = (StateNo = [140, 155]) || (StateNo = [100, 105])
value = 130

[State -3, CrouchGuard]
type = ChangeState
triggerall = (Var(59) = 1) && (StateType != A) && (Pos Y >= 0) && (P2BodyDist Y <= 0)
triggerall = (P2BodyDist Y >= -50) && (P2StateType = C) && (P2MoveType = A)
trigger1 = (P2BodyDist X <= 120) && (Random <= 799) && (Ctrl)
trigger2 = (StateNo = [140, 155]) || (StateNo = [100, 105])
value = 131

[State -3, AirGuard]
type = ChangeState
triggerall = (Var(59) = 1) && (StateType = A) && (Pos Y < 0) && (P2BodyDist Y >= -120)
triggerall = (StateType = A) && (P2MoveType = A)
trigger1 = ((P2BodyDist X <= 120) && (Ctrl)) || (StateNo = [140, 155])
value = 132
