;---------------------------------------------------------------------------
;---------------------------------------------------------------------------
; Shin Gale Kick

[Statedef 31100]
type    = A
movetype= A
physics = N
juggle  = 4
velset = 0,0
anim = 31100
ctrl = 0
sprpriority = 2
poweradd = -1000

[State 31100, 0]
type = Explod
trigger1 = AnimElem = 1
anim = 7004
supermove = 1
removetime = 48
pos = 160, 230
postype = left
bindtime = -1
ontop = 1



[State 31100, 0]
type = SuperPause
trigger1 = AnimElem = 1
time = 48
pos = 12, -47
anim = 102

[State 31100, 0]
type = AfterImage
trigger1 = AnimElem = 2, 1
time = 3

[State 31100, 0]
type = AfterImageTime
trigger1 = AnimElemTime(2) >= 1 && Time < 60
time = 3

[State 31100, 0]
type = NotHitBy
trigger1 = AnimElem = 2
value = , NA, SA, AT
time = 12

[State 31100, 0]
type = NotHitBy
trigger1 = AnimElemTime(2) >= 0 && Time < 30
value2 = C, NA
time = 1

[State 31100, 1]
type = PlaySnd
trigger1 = AnimElem = 1
value = F20, 0
;value = 0, 3200    ; super charge

[State 31100, 5]
type = PlaySnd
trigger1 = AnimElem = 1
value = 196, 14
channel = 0

[State 1007, L]
type = velset
trigger1 = time = 0
x = 4
y = -1.5

[State 1007, L]
type = veladd
trigger1 = time > 0
trigger1 = time <= 6
y = -.1

[State 1007, L]
type = veladd
trigger1 = time > 6
trigger1 = time <= 90
y = .05

[State 1007, L]
type = veladd
trigger1 = time > 96
y = .2

[State 1007, da] ; "Da da"
type = playsnd
trigger1 = animelem = 2
trigger2 = animelem = 6
trigger3 = animelem = 9
trigger4 = animelem = 13
trigger5 = animelem = 16
trigger6 = animelem = 20
value = 200,0

[State 1007, woosh]
type = playsnd
trigger1 = animelem = 2
trigger2 = animelem = 6
trigger3 = animelem = 9
trigger4 = animelem = 13
trigger5 = animelem = 16
trigger6 = animelem = 20
trigger7 = animelem = 23
value = 0,0
channel = 2

[State 1007, siya]
type = playsnd
trigger1 = animelem = 23
value = 200,1

[State 1007, 0]
type = HitDef
trigger1 = animelem = 2
trigger2 = animelem = 6
trigger3 = animelem = 9
trigger4 = animelem = 13
trigger5 = animelem = 16
trigger6 = animelem = 20
affectteam = e
attr = A, HA
animtype  = Hard
damage    = 40, 5
priority  = 5
guardflag = MA
pausetime = 6,6
sparkxy = -10,-70
hitsound = S10, 5
guardsound = S40,2
ground.type = Low
ground.slidetime = 18
ground.hittime  = 18
ground.velocity = -3.5
guard.velocity = -7
air.velocity = -3.5, -2.5
fall = 1

[State 1007, 0]
type = TargetBind
trigger1 = MoveHit = 1 
persistent = 0
pos = 35, -35

[State 1007, 1]
type = HitDef
trigger1 = animelem = 23
attr = A, HA
animtype  = Hard
damage    = 70, 7
priority  = 5
guardflag = MA
pausetime = 12,12
sparkxy = -10,-70
hitsound = S10, 5
guardsound = S40,2
ground.type = Low
ground.slidetime = 18
ground.hittime  = 18
ground.velocity = -5, -2
guard.velocity = -7
air.velocity = -5.5, -2
fall = 1

[State 1051, 2] 
type = ChangeState
trigger1 = pos y > -5
trigger1 = time > 10
value = 52

;------------------------
; Shun Gokusatsu
[Statedef 32000]
physics = N
type = S
movetype = A
velset = -3.3,-1.5
juggle = 7
ctrl = 0
anim = 3200
poweradd = -3000

[State 32000, 2]
type = AfterImage
trigger1 = Time = 0
TimeGap  = 1
FrameGap = 4
length = 8
time = 4

[State 32000, 2]
type = AfterImageTime
trigger1 = Time >= 0
time = 2

[State 32000, 0]
type = Gravity
trigger1 = time > 0
trigger1 = Pos Y < 0

[State 32000, 1]
type = ChangeAnim
trigger1 = anim = 3200
trigger1 = Pos Y > 0
persistent = 0
value = 3201

[State 32000, 2]
type = VelSet
trigger1 = Pos Y > 0
y = 0

[State 32000, 3]
type = PosSet
trigger1 = Pos Y > 0
y = 0

[State 32000, 4]
type = VelMul
trigger1 = anim = 3201
trigger1 = AnimElem = 2, < 0
x = .9

[State 32000, 5]
type = MakeDust
trigger1 = anim = 3201
trigger1 = AnimElem = 2, < 0
trigger1 = !(time%3)
pos = -24, -2
spacing = 1

[State 32000, 6]
type = VelSet
trigger1 = AnimElem = 1, = 24
x = 0

[State 32000, 2]
type = SuperPause
trigger1 = time = 0
time = 40
movetime = 38;26;14
anim = -1

[State 32000, 3]
type = Explod
trigger1 = time = 13
pos = -28, -88
postype = p1
bindtime = 15
supermove = 1
sprpriority = 5
anim = F102

[State 32000, 7]
type = PlaySnd
trigger1 = time = 10
value = 0, 3200

[State 32000, 1]
type = helper; Projectile
trigger1 = time = 25
persistent = 0
id = 77770
stateno = 32300
pos = 30, 5  
postype = p1
bindtime = 1
keyctrl = 0
ownpal = 1
size.xscale = 1
helpertype = normal
supermovetime = 15

[State 32000, 3]
type = PlaySnd
trigger1 = AnimElem = 4 
persistent = 0
channel = 0
value = 777, 0   ; Oyaji!

[State 32000, 5]
type = ChangeState
trigger1 = time = 110
value = 0
ctrl = 1

[State 32000, 6]
type = ChangeState
trigger1 = time >= 26
trigger1 = numhelper(77770)
trigger1 = helper(77770), movecontact
value = 32020

[State 32000, 6]
type = VarAdd
trigger1 = time = 0
v = 4
value = 1

; Jun Kokusatsu success
[Statedef 32020]
physics = S
movetype = A
velset = 0,0
ctrl = 0

[State 32020, 11]
type = AssertSpecial
trigger1 = 1
flag = timerfreeze

[State 32020, 12]
type = NotHitBy
trigger1 = time = [0,60]
value = SCA

[State 32020, 10]
type = ChangeState
trigger1 = time = 61
trigger1 = win
value = 32030 

[State 32020, 0]
type = EnvColor
trigger1 = time >= 5
trigger1 = time <= 60
value = 231,231,231
time = 2 

[State 32020, 0]
type = ChangeAnim
trigger1 = time = 6
value = 3451

[State 32020, 1]
type = ChangeState
trigger1 = time = 170
value = 0
ctrl = 1

[State 32020, 7]
type = Explod
trigger1 = time >= 5
trigger1 = TimeMod = 2, 0
trigger1 = time < 60
anim = F1
postype = p2
pos = 0, -40
bindtime = 1
random = 40,80
ontop = 1

[State 32020, 9]
type = PlaySnd
trigger1 = time = [5, 59]
trigger1 = TimeMod = 5, 0
trigger1 = var(3) = 0
value = F5, 1

[State 32020, 10]
type = PlaySnd
trigger1 = time = [5, 59]
trigger1 = TimeMod = 5, 0
trigger1 = var(3) = 1
value = F5, 2

[State 32020, 11]
type = PlaySnd
trigger1 = time = [5, 59]
trigger1 = TimeMod = 5, 0
trigger1 = var(3) >= 2
value = F5, 3

[State 32020, 8]
type = HitAdd
trigger1 = time = [5, 59]
trigger1 = TimeMod = 5, 0
value = 1

[State 32020, 9]
type = HitAdd
trigger1 = time = 60
value = 1

[State 32020, 11]
type = PosAdd
trigger1 = time = 10
trigger1 = P2Dist X < 60
x = -60

[State 32020, 11]
type = AssertSpecial
trigger1 = time < 160
flag = NoKOSnd
flag2 = NoKOSlow

[State 32020, 12]
type = NotHitBy
trigger1 = time >= 0
value = SCA;C, AT, NA, SA, NP
time = 2

; Jun Kokusatsu (win)
[Statedef 32030]
type = S
movetype = I
physics = S

[State 32030, 2] ; Display Huge Symbol
type = Explod
trigger1 = time = 0
pos = 160,120
postype = left
anim = 7200
sprpriority = -50
time = 100

[State 32030, 2]
type = PlaySnd
trigger1 = time = 0
value = 0,7200

[State 4910, 3]
type = AssertSpecial
trigger1 = time >= 0
flag = NoMusic

[State 32030, 1]
type = EnvColor
trigger1 = time = 0
value = 16, 16, 16
under = 1
time = 100

[State 32030, 4]
type = AssertSpecial
trigger1 = time >= 0
flag = NoKOSlow

[State 32030, 4]
type = AssertSpecial
trigger1 = time = [0,99]
flag = timerfreeze

[State 32030, 4]
type = AssertSpecial
trigger1 = time = [0,51]
flag = NoKOSnd

[State 32030, 6]
type = ChangeState
trigger1 = time = 150
value = 0
ctrl = 1

[State 32030, 12]
type = NotHitBy
trigger1 = time = [0,100]
value = C, AT, NA, SA, NP
time = 2

[State 32030, 13]
type = VarSet
trigger1 = time = 0
v = 6 
value = 2

; Hit by Jun Kokusatsu
[Statedef 32200]
physics = S
movetype = H
velset = 0
ctrl = 0

[State 32200, 0]
type = ChangeAnim2
trigger1 = time = 0
value = 3220

[State 32200, 1]
type = SelfState
trigger1 = time = 180  ; match with state 3201  + 20 or so
trigger1 = life > 0
value = 5120  ; HIT_GETUP

[State 32200, 1]
type = SelfState
trigger1 = time = 180
trigger1 = life <= 0
value = 5150  ; HIT_LIEDEAD

[State 32200, 2]
type = PosAdd
trigger1 = P2Dist X < 100
trigger1 = time = 9
x = -60

[State 32200, 2] ;ARRR1 modified
type = LifeAdd
trigger1 = time = [5,54] ;[5, 59]
trigger1 = TimeMod = 5, 0
value = -40
kill = 0

[State 32200, 2] ;Last hit kills ;ARRR1 added
type = LifeAdd
trigger1 = time = [55, 59]
trigger1 = TimeMod = 5, 0
value = -50
kill = 1

[State 32200, 2]
;type = TargetLifeAdd
type = LifeAdd
trigger1 = time = 0
value = -100000000000

; Oyaji 
[Statedef 32300]
type = S
movetype = A
physics = N
anim = 10000
velset = 0, 0

[State 32300, 2]
type = AfterImage
trigger1 = Time = 0
TimeGap  = 1
FrameGap = 4
length = 20
time = 4

[State 32300, 2]
type = AfterImageTime
trigger1 = Time >= 0
time = 5

[State 32300, 0]
type = PalFX
trigger1 = time < 15
add = 6*(time-15),6*(time-15),6*(time-15)
time = 2

[State 32300, 0]
type = HitDef
trigger1 = time = 15
attr = S, HA
damage = 0,0
getpower = 0
guardflag = N
guard.dist = 0
hitflag = M
sparkno = -1;0, 5
hitsound = -1,-1;5, 3
animtype = light
ground.type = high
p1stateno = 32350
p2stateno = 32200

[State 32300, 1]
type = VelSet
trigger1 = time = 15
x = 2.5

[State 32300, 0]
type = HitDef
trigger1 = time = 60
type = none

[State 32300, 0]
type = PalFX
trigger1 = time >= 60
add = 5*(60-time),5*(60-time),5*(60-time)
time = 2

[State 32300, 2]
type = DestroySelf
trigger1 = time = 80

[Statedef 32350]
type = S
movetype = I
physics = S
anim = 10001

[State 32350, 5]
type = BindToTarget
trigger1 = time = 0
pos = 15,0
bindtime = 5

[State 32350, 10]
type = ChangeState
trigger1 = time = 61
value = ifelse(win,32450,32400) 

; Oyaji pose/fade (normal)
[Statedef 32400]
type = S
movetype = I
physics = S
anim = 3262

[State 32400, 1]
type = BindToTarget
trigger1 = !time
pos = 60,0

[State 32400, 2]
type = PlaySnd
trigger1 = time = 1
value = 5000, 0   ; tanomu zo
channel = 0

;[State 32400, 3]
;type = PlaySnd
;trigger1 = time = 69
;value = 5000, 0  ; musuko yo
;channel = 0

[State 32400, 4]
type = PalFX
trigger1 = time >= 70
add = 5*(70-time),5*(70-time),5*(70-time)
time = 2

[State 32400, 5]
type = DestroySelf
trigger1 = animtime = 0

; Oyaji pose/fade (win)
[Statedef 32450]
type = S
movetype = I
physics = S
anim = 3262

[State 32450, 1]
type = BindToTarget
trigger1 = !time
pos = 60,0

[State 32450, 0]
type = ChangeAnim
trigger1 = AnimTime = 0
trigger1 = anim = 3209
value = 3262

[State 32450, 4]
type = PlaySnd
trigger1 = time = 105
value = 5000, 0   ; makaseta na
channel = 0

[State 32450, 4]
type = PalFX
trigger1 = time >= 70
add = 5*(70-time),5*(70-time),5*(70-time)
time = 2

[State 32450, 5]
type = DestroySelf
trigger1 = animtime = 0

;===================================================================================
; Shin Shun Goku Satsu - Attempt
[Statedef 4900]
type    = S
movetype= A
physics = N
ctrl = 0
anim = 3250

;[State 4900, 0]
type = SuperPause
trigger1 = Time = 0
anim = S852
time = 60
pos = 5,-80

[State 4900, 0]
type = SuperPause
trigger1 = Time = 0
time = 60
pos = 5,-80
anim = 102

[State 4900, 0]
type = PlaySnd
trigger1 = Time = 0
value = 0,3200

;[State 4900, 0]
type = PlaySnd
trigger1 = time = 0
value = 3700, 0  ; Power charge

[State 4900, 1]
type = PlaySnd
trigger1 = Time = 1
value = 3400, 0	; Todome da!

[State 4900, 1]
type = Playsnd
trigger1 = Time = 1
value = 100,0

[State 4900, 2]
type = AfterImage
trigger1 = Time = 0
TimeGap  = 1
FrameGap = 4
length = 15
time = 4

[State 4900, 2]
type = AfterImageTime
trigger1 = Time >= 0
time = 5

[State 4900, 3]
type = Velset
trigger1 = time > 0
x = 10

[State 4900, 3] ; Grab Opponent
type = HitDef
trigger1 = time > 0
trigger1 = movecontact = 0
attr = S, HT
p2facing = 1
hitflag = M
guardflag =
sparkxy =  -10,-60
sparkno = 3
hitsound   = S1,0
guardsound = 6,0
ground.type = High
ground.slidetime = 13
ground.hittime  = 18
p1stateno = 4910
p2stateno = 4850

[State 4900, 4]
type = changestate
trigger1 = animtime = 0
value = 0
ctrl = 1

; Shin Shun Goku Satsu - Success
[Statedef 4910]
type = S
movetype = A
physics = N
ctrl = 0
anim = 3260
poweradd = -3000 
velset = 0

[State 4910, 0]
type = Targetbind
trigger1 = time = 0
pos = 40, 0
time = 150

[State 4910, 0]
type = AfterImageTime
trigger1 = time = 0
Time = 0

[State 4910, 1]
type = AssertSpecial
trigger1 = time >= 20
flag = NoMusic

[State 4910, 2]
type = changeanim
trigger1 = time = 20
value = 3261

[State 4910, 2]
type = Envcolor
trigger1 = Time >= 20
trigger1 = Time <= 210
value = 0,0,0
time = 2

[State 4910, 2]
type = Envcolor
trigger1 = Time >= 20 && TimeMod = 10,0
trigger1 = Time <= 200
value = 200,0,0
under = 1

[State 4910, 3]
type = GameMakeAnim
trigger1 = time >= 20
trigger1 = TimeMod = 10, 0
trigger1 = time <= 200
value = 3
pos = 50, -50
random = 50

[State 4910, 3]
type = PlaySnd
trigger1 = time >= 20
trigger1 = TimeMod = 10, 0
trigger1 = time <= 200
value = F5, 2

[State 4910, 3]
type = HitAdd
trigger1 = time >= 20
trigger1 = TimeMod = 10, 0
trigger1 = time <= 200
value = 1

[State 4910, 4]
type = changestate
trigger1 = animtime = 0
value = 4911
ctrl = 1

; Shin Shun Goku Satsu - End
[Statedef 4911]
type = S
movetype = A
physics = N
ctrl = 0
anim = 32620
velset = 0

[State 4910, 0] ;Last hit kills ;ARRR1 added
type = LifeAdd
trigger1 = time = 1
value = -life
absolute = 1
kill = 1

[State 4910, 1]
type = ChangeAnim
trigger1 = time = 1
value = 5110   ; HIT_LIEDOWN

[State 4910, 2]
type = ChangeState
trigger1 = time = 1
value = ifelse(life>0,5120,5150)

[State 4910, 0]
type = TargetLifeAdd
trigger1 = time = 0
value = -100000000000

[State 4910, 0]
type = posadd
trigger1 = time = 0
trigger1 = P2Dist X < 50
x = -20

[State 4910, 1]
type = Envcolor
trigger1 = Time = 0
value = 0,0,0
time = 100
under = 1

[State 4910, 2]
type = Explod
trigger1 = time = 0
anim = 186 ;Go's Symbol
sprpriority = 4
pos = 9,0
postype = p1
ownpal = 1

[State 4910, 2] ; Display Huge Symbol
type = Explod
trigger1 = time = 0
pos = 160,120
postype = left
anim = 7200
sprpriority = -5
time = 1

[State 4910, 2]
type = PlaySnd
trigger1 = time = 0
value = 0,7200

[State 4910, 3]
type = AssertSpecial
trigger1 = time >= 0
flag = NoMusic

[State 4910, 3]
type = AssertSpecial
trigger1 = time >= 0
flag = NoKOSlow

[State 4910, 4]
type = changestate
trigger1 = animtime = 0
value = 0
ctrl = 1

;===================================================================================
; Shun Goku Satsu (Grabbed)
[Statedef 4850]
type    = S
movetype= H
physics = N
poweradd= 0
ctrl = 0
velset = 0,0,0

[State 4850, 0] ; Grabbed
type = ChangeAnim2
trigger1 = time = 0
value = 3264

[State 4850, 0] ; Attacked
type = ChangeAnim2
trigger1 = time = 20
value = 3265

[State 4850, 0]
type = Velset
trigger1 = time >= 0
x = 0
y = 0

[State 4850, 1]
type = PosFreeze
trigger1 = time >= 0

[State 4850, 2]
type = posset
trigger1 = time = 0
y = 0

[State 4850, 3] ; Lie Down, Dead
type = ChangeAnim2
trigger1 = time = 210
value = 3266

[State 4850, 4]
type = selfstate
trigger1 = time = 350
trigger1 = alive = 0
value = 5150

[State 4850, 4]
type = selfstate
trigger1 = time = 350
trigger1 = alive = 1
value = 5120

;=============================================================================
;Cocomero
[Statedef 9998]
type = S
movetype = A
physics = S
velset = 0, 0
juggle = 0
ctrl = 0
poweradd = 40
anim = 3450

[State 9998, 0]
type = VarAdd
trigger1 = time = 0
v = 4
value = 1

[State 9998, 0]
type = VarSet
trigger1 = !time
var(16) = 0

[State 9998, 0]
type = VarSet
trigger1 = time = 0
var(1) = var(5) = 4

[State 9998, 0]
type = VarSet
trigger1 = time = 0
var(3) = numhelper(3477) = 4

[State 9998, 0]
type = VarSet
trigger1 = time = 0
var(5) = (var(5)+1)%5

[State 9998, 0]
type = VarSet
trigger1 = !time
var(7) = ifelse(command="x",0,ifelse(command="y",1,ifelse(command="z",2,3)))

[State 9998, 0]
type = VarSet
trigger1 = !time
var(17) = ifelse(command="straightfwd",0,ifelse(command="straightdown",1,2))

[State 9998, 0]
type = VarSet
trigger1 = command = "tapback"
trigger1 = command != "releaseback"
var(16) = -facing

[State 9998, 0]
type = VarSet
trigger1 = command = "tapfwd"
trigger1 = command != "releasefwd"
var(16) = facing

[State 9998, 0]
type = helper
trigger1 = AnimElem = 4
trigger1 = var(17) = 0
pos = 40, -140
postype = front
helpertype = normal
id = 3450
stateno = 34700
keyctrl = 0
name = "Dan's Jimmy"
ownpal = 1

[State 9998, 0]
type = helper
trigger1 = AnimElem = 4
trigger1 = var(17) = 1
pos = 60, -200
postype = p1
helpertype = normal
id = 3450
stateno = 34700
keyctrl = 0
name = "Dan's Jimmy"
ownpal = 1

[State 9998, 0]
type = helper
trigger1 = AnimElem = 4
trigger1 = var(17) = 2
pos = -40, -140
postype = back
helpertype = normal
id = 3450
stateno = 34700
keyctrl = 0
name = "Dan's Jimmy"
ownpal = 1

[State 9998, 1]
type = ChangeState
trigger1 = time = 60
trigger1 = var(1) = 0
trigger1 = var(3) = 0
value = 0
ctrl = 1

[State 9998, 2]
type = ChangeState
triggerall = time = 100
trigger1 = var(1) = 1
trigger2 = var(3) = 1
value = 34550

[State 9998, 2]
type = PlaySnd
trigger1 = time = AnimElem = 2
value = 3450, 0   ; yuujou!
channel = 0

[Statedef 34550]
type = S
movetype = I
physics = S
velset = 0, 0
anim = 3451

[State 34550, 0]
type = PlaySnd
trigger1 = time = 3
value = 3455, 0    ; Sorya nai ssu!
channel = 0

[State 34550, 0]
type = ChangeState
trigger1 = time = 90
value = 0
ctrl = 1

; Jimmy's air roll
[Statedef 34700]
type = A
movetype = A
physics = N
;velset = 3.5, -2
anim = 7520

[State 34700, 0]
type = Turn
trigger1 = !time
trigger1 = !parent,var(17)

[State 34700, 0]
type = VelSet
trigger1 = !time
x = ifelse(parent,var(17)-1,3.5,0)
y = ifelse(parent,var(17)-1,-2,0)

[State 34700, 0]
type = VarSet
trigger1 = !time
var(2) = parent, var(7)

[State 34700, 0]
type = VarSet
trigger1 = !time
var(17) = parent, var(17)

[State 34700, 0]
type = ParentVarSet
trigger1 = !time
var(7) = 0

[State 34700, 0]
type = VarSet
trigger1 = 1;!time
var(16) = parent, var(16)

[State 34700, 0]
type = Gravity
trigger1 = time > 0

[State 34700, 1]
type = VarSet
trigger1 = !time
var(3) = parent,var(1) || parent,var(3)

[State 34700, 1]
type = ChangeState
trigger1 = Pos Y > 0
value = ifelse(var(3),34750,34710)

[State 34700, 1]
type = VarSet
trigger1 = !time
var(0) = 7575   ; desired state after getting hit

[State 34700, 1]
type = HitOverride
trigger1 = 1;!time
time = 1
stateno = 7570
slot = 0
attr = SCA, AA, AT, AP

[State 34700, 2]
type = PlaySnd
trigger1 = time = 1
value = 7470, 0   ; roarr!
channel = 0

[State 34700, 3]
type = PlaySnd
trigger1 = AnimElem = 4
value = 0, 210   ; whoosh

[State 34700, 4]
type = SprPriority
trigger1 = time = 0
value = 3

[State 34700, 5]
type = HitDef
trigger1 = !time ;1
damage = 90,0
animtype = back
sparkxy = -3,-40
id = 3470
nochainid = 3470
attr = A,SA
hitflags=MA
guardflags = N
air.hittime = 14
ground.velocity = -4.2,-5
guard.dist = 50
sparkno = 3
hitsound = 5,3
pausetime = 9,9
air.velocity = -4.8,2
air.fall = 1
air.fall.recover = 0
air.hittime = 8
down.bounce = 1
down.velocity = -3

; Jimmy's banana throw
[Statedef 34710]
type = S
movetype = A
physics = S
velset = 0, 0
anim = ifelse(var(3):=(var(16)=-facing),9999,7510)
; var(3) must be preserved; until banana is thrown

[State 34710, 0]
type = VarSet
trigger1 = RoundState = 3
persistent = 0
var(15) = p2life = p2life

[State 34710, 0]
type = VarSet
trigger1 = RoundState = 3
trigger1 = (p2life = p2life)
fvar(0) = P2Dist X

[State 34710, 0]
type = PosSet
trigger1 = time = 0
y = 0

[State 34710, 0]
type = VarSet
trigger1 = time = 0
v = 1
value = 0

[State 34710, 1]
type = VarSet
trigger1 = !time
var(0) = 7579   ; desired state after getting hit

[State 34710, 1]
type = HitOverride
trigger1 = time >= 0
time = 1
stateno = 75800
forceair = 1
slot = 0
attr = SCA, AA, AT, AP

[State 34710, 1]
type = VarSet
trigger1 = anim = 9999
trigger1 = animelem = 3;6
var(8)=1

[State 34710, 1]
type = VarSet
trigger1 = anim = 9999
trigger1 = animelem = 4;10
var(8)=2

[State 34710, 1]
type = VarSet
trigger1 = anim = 9999
trigger1 = animelem = 6;12
var(8)=0

[State 34710, 1]
type = VarSet
trigger1 = anim = 9999
trigger1 = animelem = 3 || animelem = 5 ;9 || animelem = 11
var(9)=31+!(var(10):=-27)

[State 34710, 1]
type = VarSet
trigger1 = anim = 9999
trigger1 = animelem = 4;10
var(9)=34+!(var(10):=-34)

[State 34710, 0]
type = AttackDist
trigger1 = time = 0
value = 0

[State 34710, 1]
type = VarAdd
trigger1 = var(1) > 0
v = 1
value = 1

[State 34710, 1]
type = PlaySnd
trigger1 = anim = 9999
trigger1 = AnimElem = 4;10
value = 7470, 1    ; munch
channel = 0

[State 34710, 2]
type = helper
helpertype = normal
pos = 7, -68
postype = p1
trigger1 = anim = 9999
trigger1 = animelem = 6;12
keyctrl = 0
ownpal = 1
id = 3477
name = "Dan's Jimmy's banana"
stateno = 34770
size.xscale = 1
size.shadowoffset = 0
facing = -1

[State 34710, 1]
type = Turn
trigger1 = anim = 7510
trigger1 = animtime = 0

[State 34710, 1]
type = ChangeAnim
trigger1 = anim = 7510
trigger1 = animtime = 0
value = 7530

[State 34710, 1]
type = ChangeAnim
trigger1 = anim = 7530
trigger1 = animtime = 0
value = 9999

[State 34710, 2]
type = ChangeState
triggerall = matchover = 0
triggerall = win = 0
trigger1 = time = 160-var(3)*11
trigger2 = time >= 120-var(3)*11
trigger2 = var(1) >= 15
value = 34730

[State 34710, 3]
type = ParentVarSet
trigger1 = matchover = 1
v = 6
value = 1

[State 34710, 4]
type = ChangeState
trigger1 = parent, var(7) = 1
value = 34850

[State 34710, 4]
type = ChangeState
trigger1 = parent, var(7) = 2
trigger1 = time >= 120
value = 34730

; banana thrown (init state) through air
[Statedef 34770]
type = A
physics = N
movetype = A
anim = 9994

[State 34770, 0]
type = SprPriority
trigger1 = !time
value = 3

[State 34770, 0]
type = Turn
trigger1 = !time 
trigger1 = !var(3)
persistent = 0

[State 34770, 0]
type = VarSet
trigger1 = !time
var(0) = parent, var(2)

[State 34770, 0]
type = VarSet
trigger1 = !time
var(15) = parent, var(15)

[State 34770, 0]
type = VarSet
trigger1 = !time
fvar(1) = parent, fvar(0)

[State 34770, 0]
type = VarSet
trigger1 = !time
var(9)= p2life = p2life

[State 34770, 0]
type = VarSet
trigger1 = !time
fvar(0) = 160.0

[State 34770, 0]
type = VarSet
trigger1 = !time
trigger1 = var(0)=3
trigger1 = var(9)
fvar(0)= P2Dist X

[State 34770, 0]
type = VelSet
trigger1 = !time
x = ifelse(var(0)=3,ifelse(fvar(0)>=0,fvar(0)/80.0,2),2**var(0))
y = ifelse(var(0)=3,-8,-5-2*var(0))

[State 34770, 1]
type = HitOverride
trigger1 = time >= 0
time = 1
stateno = 34790
slot = 0
attr = SCA, AA, AT, AP

[State 34770, 0]
type = ChangeState
trigger1 = time!=0
value = 34740

; banana flying through air (general)
[Statedef 34740]
type = A
physics = N
movetype = A

[State 34740, 0]
type = VelAdd
trigger1 = time >= 0
y = .2

[State 34740, 1]
type = HitOverride
trigger1 = time >= 0
time = 1
stateno = 34790
slot = 0
attr = SCA, AA, AT, AP

[State 34740, 0]
type = VelMul
trigger1 = frontedgedist <= -6
;trigger1 = var(0)=2
persistent = 0
x = -.6

[State 34740, 0]
type = Turn
trigger1 = frontedgedist <= -6
;trigger1 = var(0)=2
persistent = 0

[State 34740, 0]
type = HitDef
trigger1 = time = 0
attr = S, SP
damage = 40, 4
guardflag = MA
hitflag = MAF
;sparkno = 0, 5
hitsound = 5, 1
animtype = light
ground.type = high
ground.hittime = 12
ground.velocity = -1
guard.dist = 20
priority = 6
p1getp2facing = -1   ; face opposite direction
getpower = 20

[State 34740, 1]
type = ChangeState
trigger1 = movecontact = 1
value = 34780

[State 34740, 4]
type = VelSet
trigger1 = Pos Y >= -1
y = 0

[State 34740, 5]
type = PosSet
trigger1 = Pos Y >= -1
y = 0

[State 34740, 5]
type = ChangeState
trigger1 = root, var(15) = 1
value = 34990

[State 34740, 4]
type = helper
trigger1 = Pos Y = 0
trigger1 = Vel Y = 0
helpertype = normal
pos = 0, 0
postype = p1
keyctrl = 0
ownpal = 1
id = 3477
name = "Dan's Jimmy's banana"
stateno = 34720
size.xscale = 1
size.shadowoffset = 0
facing = 1

[State 34740, 5]
type = DestroySelf
trigger1 = Pos Y = 0 && Vel Y = 0

; Banana custom hit state
[Statedef 34790]
type = A
movetype = I
physics = N
anim = 9994
facep2 = 1
velset = GetHitVar(xvel), GetHitVar(yvel)
movehitpersist = 1

[State 34790, 1]
type = ChangeState
trigger1 = movecontact
value = 34780

[State 34790, 1]
type = ChangeState
value = 3474
trigger1 = !time

; banana on ground
[Statedef 34720]
type = S
ctrl = 0
movetype = A
velset = 0, 0
anim = 9993

[State 34720, 0]
type = PosSet
trigger1 = time = 0
y = 0

[State 34720, 0]
type = HitDef
trigger1 = !time
velocity = 0
attr = S, SP
damage = 40, 4
guardflag = N
guard.dist = 0
hitflag = MF
sparkno = 1
hitsound = 5, 1
animtype = light
p1getp2facing = 1    ; face same direction
ground.type = trip
ground.velocity = n, -4
hitonce = 1
getpower = 20

[State 34720, 0]
type = ChangeState
trigger1 = movecontact = 1
value = 34760

; play banana removal anim
[Statedef 34760]
type = A
movetype = H
physics = N
anim = 9989

[State 34760, 0]
type = VelSet
trigger1 = time = 1
x = numtarget > 0
y = -3

[State 34760, 1]
type = VelAdd
trigger1 = time > 1
y = .15

[State 34760, 1]
type = DestroySelf
trigger1 = time = 30

; play banana hit anim
[Statedef 34780]
type = A
movetype = H
physics = N
anim = 9989

[State 34780, 0]
type = VelSet
trigger1 = time = 1
x = -1
y = -2

[State 34780, 1]
type = VelAdd
trigger1 = time > 1
y = .15

[State 34780, 1]
type = DestroySelf
trigger1 = time = 30

; Jimmy picks up blender (from normal blender anim)
[Statedef 34690]
type = S
movetype = I
physics = S
velset = 0,0
anim = 7558

[State 34690, 0]
type = VarSet
trigger1 = !time
var(3) = 0

[State 34690, 0]
type = ChangeState
trigger1 = !animtime
value = 34730

[State 34690, 0]
type = HitOverride
trigger1 = !time
slot = 0
time = -1
stateno = 7585
attr = SCA, AA, AT, AP

; Jimmy leaves
[Statedef 34730]
type = A
movetype = I
physics = N
velset = 0, 0
anim = ifelse(var(3),7524,7521)

[State 34730, 0]
type = NotHitBy
trigger1 = 1
value = SCA

[State 34730, 0]
type = ChangeState
trigger1 = var(17) = 1 
value = 34970

[State 34730, 0]
type = VelSet
trigger1 = AnimElem = 2, = 1
x = ifelse(var(3),-5.5,5.5)
y = -12.75

[State 34730, 1]
type = PlaySnd
trigger1 = AnimElem = 6
value = 0, 200   ; whoosh

[State 34730, 2]
type = PlaySnd
trigger1 = AnimElem = 2
value = 7470, 2  ; wahoo!
channel = 0

[State 34730, 3]
type = Gravity
trigger1 = AnimElem = 2, > 2

[State 34730, 1] 
type = DestroySelf
triggerall = AnimElem = 2, > 1
trigger1 = Pos X > 160
trigger2 = Pos Y < -240
trigger3 = Pos Y > 0

; Jimmy don't wanna play
[Statedef 34750]
type = S
movetype = I
physics = S
velset = 0, 0
anim = 7510

[State 34750, 0]
type = HitOverride
trigger1 = !time
time = -1
slot = 0
attr = SCA, AA, AT, AP
stateno = 7585

[State 34750, 0]
type = PosSet
trigger1 = time = 0
y = 0

[State 34750, 1]
type = Turn
trigger1 = anim = 7510
trigger1 = animtime = 0

[State 34750, 1]
type = ChangeAnim
trigger1 = anim = 7510
trigger1 = animtime = 0
value = 7550

[State 34750, 2]
type = ChangeState
trigger1 = time = 230
;trigger1 = win = 0
value = 3469;3473

[State 34750, 3]
type = PlaySnd
triggerall = anim = 7550
trigger1 = AnimElem = 12
trigger2 = AnimElem = 16
value = 7470,3   ; zap

[State 34750, 4]
type = ParentVarSet
trigger1 = var(1):=(win && Pos X = [-215,215])
persistent = 0
v = 6
value = 6

[State 34750, 0]
type = Turn
trigger1 = var(1)
persistent = 0

[State 34750, 0]
type = helper
trigger1 = var(1)
persistent = 0
;trigger1 = !numhelper(7640)
pos = ifelse((Pos X!=[-160,159]),floor((153-abs(Pos X))*ifelse(anim=7510,-1,1)*facing*Pos X/abs(Pos X)),0),0
postype = p1
stateno = 7698
ownpal = 0
id = 7640
helpertype = player
name = "Dan's Jimmy's cameraman"
size.ground.back=0
size.ground.front=0
keyctrl = 0

[State 34750, 0]
type = Turn
trigger1 = var(1)
persistent = 0

[State 34750, 5]
type = ChangeState
trigger1 = win = 1
trigger1 = anim = 7550
trigger1 = AnimElemNo(0) > 20
trigger1 = Pos X = [-200,200]
value = 7640

; Win pose with Jimmy
[Statedef 34800]
type = S
physics = N
anim = 3480  

[State 34800, 0]
type = VarSet
trigger1 = time = 0
v = 7
value = 1  ; notify helper

[State 34800, 0]
type = VelSet
trigger1 = time >= 3
x = 4.4

; Hack to keep a bit ahead of Jimmy
[State 34800, 0]
type = VelSet
trigger1 = helper(3450),facing=facing
trigger1 = helper(3450),RootDist X = [40,75]
x = 4.8

[State 34800, 1]
type = Turn
trigger1 = frontedgedist <= 25

[State 34800, 2]
type = PlaySnd
trigger1 = time = 15
value = 3480, 0   ; Yahoo! Ore tte saikyou!
channel = 0

[State 34800, 2]
type = PlaySnd
trigger1 = time = 175
value = 198, 8    ; Oyaji! 
channel = 0

[State 34800, 3]
type = NotHitBy
trigger1 = time >= 0
value = SCA

[State 34800, 4]
type = PlayerPush
trigger1 = time >= 0
value = 0

[State 34800, 4]
type = ScreenBound
trigger1 = time >= 0
value = 1
movecamera = 0,0

[State 34800, 4]
type = AssertSpecial
trigger1 = time = [0, 280]
flag = roundnotover

; Jimmy's win pose with Dan
[Statedef 34850]
type = S
physics = N
anim = 7522  

[State 34850, 0]
type = VelSet
trigger1 = time >= 3
x = 4.4

[State 34850, 1]
type = Turn
trigger1 = frontedgedist <= 25
trigger1 = backedgedist < 320
trigger1 = RootDist X != [-40,40]
trigger2 = backedgedist >= 320

[State 34850, 2]
type = PlaySnd
trigger1 = time = 20
value = 7470, 4   ; cackle
channel = 0

[State 34850, 2]
type = PlaySnd
trigger1 = time = 105
value = 7470, 5   ; rowww!
channel = 0

[State 34850, 3]
type = NotHitBy
trigger1 = time >= 0
value = SCA

[State 34850, 4]
type = PlayerPush
trigger1 = time >= 0
value = 0

; taunt
[Statedef 34910]
type = S
movetype = I
physics = S
ctrl = 0

[State 34910, 0]
type = VarSet
trigger1 = 1
var(15)=1

; bail if something's wrong.
[State 34910, 0]
type = ChangeState
triggerall = !time
trigger1 = !numhelper(3477)
trigger2 = time =1 && helper(3477),stateno!=34990
value = 0
ctrl = 1

[State 34910, 0]
type = VarAdd
trigger1 = time = 1
var(59) = 1

[State 34910, 0]
type = ChangeAnim
trigger1 = time = 10
trigger1 = (anim = [800,801]) || anim = 195 || anim = 0 || anim = 2102
trigger2 = anim=12 && !animtime
value = 3490 + 0*(var(1):=time)

[State 34910, 1]
type = ChangeAnim
triggerall = time = 6
trigger1 = anim = 11
trigger2 = anim = 802
value = 12

[State 34910, 1]
type = PlaySnd
triggerall = anim = 3490
trigger1 = time = var(1)+3
value = 3491, 0    ; me ga nai ssu!
channel = 0

[State 34910, 2]
type = ChangeState
triggerall = anim = 3490
trigger1 = time = var(1)+75
value = 0
ctrl = 1

[Statedef 34920]
type = S
movetype = I
physics = S

[State 34920, 0]
type = ChangeState
trigger1 = time = 30
value = 0
ctrl = 1

; Banana knocked off Dan's head
[Statedef 34930]
type = A
movetype = H
physics = N
velset = -2, -4
anim = 9989

[State 34930, 0]
type = VelAdd
trigger1 = time > 0
y = .2

[State 34930, 1]
type = DestroySelf
trigger1 = time = 30

; Banana falling naturally off Dan's head
[Statedef 34940]
type = A
movetype = H
physics = N
velset = -1.6, 0
anim = 9989

[State 34940, 0]
type = VelAdd
trigger1 = time > 0
y = .1

[State 34940, 1]
type = DestroySelf
trigger1 = time = 30

; Jimmy leaves -- straight up
[Statedef 34970]
type = A
movetype = I
physics = N
velset = 0, 0
anim = 7521

[State 34970, 0]
type = VelSet
trigger1 = AnimElem = 2, = 1
y = -12.75

[State 34970, 1]
type = PlaySnd
trigger1 = AnimElem = 6
value = 0, 200   ; whoosh

[State 34970, 2]
type = PlaySnd
trigger1 = AnimElem = 2
value = 7470, 2  ; wahoo!
channel = 0

[State 34970, 3]
type = Gravity
trigger1 = AnimElem = 2, > 2

[State 34970, 1] 
type = DestroySelf
triggerall = AnimElem = 2, > 1
trigger1 = Pos Y < -240

[State 34970, 0]
type = NotHitBy
trigger1 = 1
value = SCA

; Banana landing on Dan's head
[Statedef 34990]
type = A
movetype = H
physics = N
anim = 9993
velset = 0, 0

[State 34990, 0]
type = SprPriority
trigger1 = time = 0
value = 3

; note: for desired x offset x_0, use x_0-1+root,facing due to bug (?)

[State 34990, 0]
type = VarSet
trigger1 = !time
var(32)=-1

[State 34990, 0]
type = VarSet
trigger1 = root,anim=0
trigger1 = root,stateno!=var(32)
var(0)=!((var(1):=var(3):=-94)+(var(2):=-92)+(var(4):=var(6):=-99+root,facing)+(var(5):=-101+root,facing))

[State 34990, 0]
type = VarRangeSet
trigger1 = root,anim=0
trigger1 = root,stateno!=var(32)
first = 8
last = 13
value = 4

[State 34990, 1]
type = VarSet
trigger1 = root,anim=195
trigger1 = root,anim!=var(32)
var(0)=(var(1):=-94)+(var(2):=-91)+(var(3):=var(4):=-92)

[State 34990, 1]
type = VarSet
trigger1 = root,anim=195
trigger1 = root,anim!=var(32)
var(0)=!((var(8):=5+root,facing)+(var(9):=13+root,facing)+(var(10):=var(11):=22+root,facing))

[State 34990, 2]
type = VarSet
trigger1 = root,anim=11
trigger1 = root,anim!=var(32)
var(0)=0*((var(1):=-65)+(var(8):=3+root,facing))

[State 34990, 3]
type = VarSet
trigger1 = root,anim=12
trigger1 = root,anim!=var(32)
var(0)=0*((var(8):=var(9):=2+root,facing)+(var(1):=-72)+(var(2):=-89))

[State 34990, 3]
type = VarSet
trigger1 = root,anim=47 || root,anim = 40
trigger1 = root,anim!=var(32)
var(0)=0*((var(8):=2+root,facing)+(var(1):=-89))

[State 34990, 5]
type = VarSet
trigger1 = (root,anim = 2102) || (root,anim=[800,801])
trigger1 = root,anim!=var(32)
var(0)=(var(1):=-72)+(var(2):=-89)+(var(3):=-94)+(var(4):=-91)+(var(5):=var(6):=-92)

[State 34990,5]
type = VarSet
trigger1 = (root,anim=[800,801]) || (root,anim = 2102)
trigger1 = root,anim!=var(32)
var(0)=13+!((var(8):=var(9):=2+root,facing)+(var(10):=5+root,facing)+(var(11):=13+root,facing)+(var(12):=var(13):=22+root,facing))

[State 34990, 5]
type = VarSet
trigger1 = root,anim = 2102
var(0) = 0

[State 34990, 4]
type = VarSet
trigger1 = root,anim=3490
trigger1 = root,anim!=var(32)
var(0)=0*((var(8):=4+root,facing)+(var(9):=var(10):=6+root,facing)+(var(1):=-91)+(var(2):=var(3):=-93))

[State 34990, 5]
type = VarSet
trigger1 = root,anim=802
trigger1 = root,anim!=var(32)
var(0)=(var(1):=var(2):=-65)+(var(3):=var(4):=-67)

[State 34990, 5]
type = VarSet
trigger1 = root,anim=802
trigger1 = root,anim!=var(32)
var(0)=0*((var(8):=5+root,facing)+(var(9):=8+root,facing)+(var(10):=var(11):=17+root,facing))

[State 34990, 6]
type = VarSet
trigger1 = root,anim=100
trigger1 = root,anim!=var(32)
var(0)=(var(1):=var(2):=var(5):=var(6):=-94)+(var(3):=-84)+(var(4):=-85)+(var(7):=-89)

[State 34990, 6.5]
type = VarSet
trigger1 = root,anim=100
trigger1 = root,anim!=var(32)
var(0)=!((var(8):=var(9):=var(12):=7+root,facing)+(var(10):=20+root,facing)+(var(11):=17+root,facing)+(var(13):=5+root,facing)+(var(14):=1+root,facing))

[State 34990, 7]
type = VarSet
trigger1 = root,anim=810
trigger1 = root,anim!=var(32)
var(0)=2+!((var(1):=-94)+(var(2):=var(3):=-91)+(var(8):=5+root,facing)+(var(9):=var(10):=34+root,facing))

[State 34990, 8]
type = VarSet
trigger1 = root,anim = 803
trigger1 = root,anim!=var(32)
var(0)=0*((var(1):=-95)+(var(2):=var(3):=-102)+(var(8):=9)+(var(9):=var(10):=-13))

[State 34990, 9]
type = VarSet
trigger1 = root,anim = [41,43]
trigger1 = root,anim != var(32)
var(0)=0*((var(1):=-106)+(var(2):=-104)+(var(3):=-103)+(var(8):=-2)+(var(9):=2)+(var(10):=4))

[State 34990, 9]
type = VarSet
trigger1 = root,anim = [44,46]
trigger1 = root,anim != var(32)
var(0)=0*((var(1):=var(3):=var(4):=var(5):=-103)+(var(2):=-100)+(var(8):=4)+(var(9):=5)+(var(10):=-4)+(var(11):=var(12):=-1))

[State 34990, 10]
type = VarSet
trigger1 = 1
var(32) = root,anim
 
[State 34990, 0]
type = BindToRoot
trigger1 = root,var(15)
time = 1
pos = var(7+root,animelemno(0)-var(0)),var(root,animelemno(0)-var(0))
facing = 1

[State 34990, 2]
type = ChangeState
trigger1 = root, movetype = H
value = 34930

[State 34990, 3]
type = ChangeState
trigger1 = !root, var(15)
value = 34940

[Statedef 75800]
type = A
movetype = H
physics = N
velset = root,facing*GetHitVar(xvel)*((P2Dist X < 0)*-2+1),ifelse(GetHitVar(yvel)>-6,-6,GetHitVar(yvel))
;velset = GetHitVar(xvel),GetHitVar(yvel)

[State 75800, 0]
type = Explod
trigger1 = !time && var(8)
pos = var(9),var(10)
anim = ifelse(var(8)=1,9991,9989)
removetime = 45;51
postype = p1
bindtime = 1
vel = 0,-4
accel = 0,0.2
scale = 1
ownpal = 1
sprpriority = 4

[State 75800, 0]
type = VarSet
trigger1 = !time
var(5)=(Vel X <= 0)  

[State 75800, 0]
type = ChangeAnim
trigger1 = !time
value = ifelse(Vel X <=0, 7580, 7582)

[State 75800, 0]
type = Gravity
trigger1 = 1

[State 75800, 1]
type = ChangeState
trigger1 = Pos Y > 0
value = var(0)

[State 75800, 1]
type = HitOverride
trigger1 = 1
time = 1
stateno = 75800
slot = 0
forceair = 1
attr = SCA, AA, AT, AP

;=============================================================================
;Mela
[Statedef 9997]
type = S
movetype = A
physics = S
velset = 0, 0
juggle = 0
ctrl = 0
poweradd = 40
anim = 3450

[State 9997, 0]
type = VarAdd
trigger1 = time = 0
v = 4
value = 1

[State 9997, 0]
type = VarSet
trigger1 = !time
var(16) = 0

[State 9997, 0]
type = VarSet
trigger1 = time = 0
var(1) = var(5) = 4

[State 9997, 0]
type = VarSet
trigger1 = time = 0
var(3) = numhelper(3477) = 4

[State 9997, 0]
type = VarSet
trigger1 = time = 0
var(5) = (var(5)+1)%5

[State 9997, 0]
type = VarSet
trigger1 = !time
var(7) = ifelse(command="x",0,ifelse(command="y",1,ifelse(command="z",2,3)))

[State 9997, 0]
type = VarSet
trigger1 = !time
var(17) = ifelse(command="straightfwd",0,ifelse(command="straightdown",1,2))

[State 9997, 0]
type = VarSet
trigger1 = command = "tapback"
trigger1 = command != "releaseback"
var(16) = -facing

[State 9997, 0]
type = VarSet
trigger1 = command = "tapfwd"
trigger1 = command != "releasefwd"
var(16) = facing

[State 9997, 0]
type = helper
trigger1 = AnimElem = 4
trigger1 = var(17) = 0
pos = 40, -140
postype = front
helpertype = normal
id = 3450
stateno = 347000
keyctrl = 0
name = "Dan's Jimmy"
ownpal = 1

[State 9997, 0]
type = helper
trigger1 = AnimElem = 4
trigger1 = var(17) = 1
pos = 60, -200
postype = p1
helpertype = normal
id = 3450
stateno = 347000
keyctrl = 0
name = "Dan's Jimmy"
ownpal = 1

[State 9997, 0]
type = helper
trigger1 = AnimElem = 4
trigger1 = var(17) = 2
pos = -40, -140
postype = back
helpertype = normal
id = 3450
stateno = 347000
keyctrl = 0
name = "Dan's Jimmy"
ownpal = 1

[State 9997, 1]
type = ChangeState
trigger1 = time = 60
trigger1 = var(1) = 0
trigger1 = var(3) = 0
value = 0
ctrl = 1

[State 9997, 2]
type = ChangeState
triggerall = time = 100
trigger1 = var(1) = 1
trigger2 = var(3) = 1
value = 345500

[State 9997, 2]
type = PlaySnd
trigger1 = time = AnimElem = 2
value = 3450, 0   ; yuujou!
channel = 0

[Statedef 345500]
type = S
movetype = I
physics = S
velset = 0, 0
anim = 3451

[State 345500, 0]
type = PlaySnd
trigger1 = time = 3
value = 3455, 0    ; Sorya nai ssu!
channel = 0

[State 345500, 0]
type = ChangeState
trigger1 = time = 90
value = 0
ctrl = 1

; Jimmy's air roll
[Statedef 347000]
type = A
movetype = A
physics = N
;velset = 3.5, -2
anim = 7520

[State 347000, 0]
type = Turn
trigger1 = !time
trigger1 = !parent,var(17)

[State 347000, 0]
type = VelSet
trigger1 = !time
x = ifelse(parent,var(17)-1,3.5,0)
y = ifelse(parent,var(17)-1,-2,0)

[State 347000, 0]
type = VarSet
trigger1 = !time
var(2) = parent, var(7)

[State 347000, 0]
type = VarSet
trigger1 = !time
var(17) = parent, var(17)

[State 347000, 0]
type = ParentVarSet
trigger1 = !time
var(7) = 0

[State 347000, 0]
type = VarSet
trigger1 = 1;!time
var(16) = parent, var(16)

[State 347000, 0]
type = Gravity
trigger1 = time > 0

[State 347000, 1]
type = VarSet
trigger1 = !time
var(3) = parent,var(1) || parent,var(3)

[State 347000, 1]
type = ChangeState
trigger1 = Pos Y > 0
value = ifelse(var(3),347500,347100)

[State 347000, 1]
type = VarSet
trigger1 = !time
var(0) = 7575   ; desired state after getting hit

[State 347000, 1]
type = HitOverride
trigger1 = 1;!time
time = 1
stateno = 7570
slot = 0
attr = SCA, AA, AT, AP

[State 347000, 2]
type = PlaySnd
trigger1 = time = 1
value = 7470, 0   ; roarr!
channel = 0

[State 347000, 3]
type = PlaySnd
trigger1 = AnimElem = 4
value = 0, 210   ; whoosh

[State 347000, 4]
type = SprPriority
trigger1 = time = 0
value = 3

[State 347000, 5]
type = HitDef
trigger1 = !time ;1
damage = 90,0
animtype = back
sparkxy = -3,-40
id = 3470
nochainid = 3470
attr = A,SA
hitflags=MA
guardflags = N
air.hittime = 14
ground.velocity = -4.2,-5
guard.dist = 50
sparkno = 3
hitsound = 5,3
pausetime = 9,9
air.velocity = -4.8,2
air.fall = 1
air.fall.recover = 0
air.hittime = 8
down.bounce = 1
down.velocity = -3

; Jimmy's banana throw
[Statedef 347100]
type = S
movetype = A
physics = S
velset = 0, 0
anim = ifelse(var(3):=(var(16)=-facing),9997,7510)
; var(3) must be preserved; until banana is thrown

[State 347100, 0]
type = VarSet
trigger1 = RoundState = 3
persistent = 0
var(15) = p2life = p2life

[State 347100, 0]
type = VarSet
trigger1 = RoundState = 3
trigger1 = (p2life = p2life)
fvar(0) = P2Dist X

[State 347100, 0]
type = PosSet
trigger1 = time = 0
y = 0

[State 347100, 0]
type = VarSet
trigger1 = time = 0
v = 1
value = 0

[State 347100, 1]
type = VarSet
trigger1 = !time
var(0) = 7579   ; desired state after getting hit

[State 347100, 1]
type = HitOverride
trigger1 = time >= 0
time = 1
stateno = 758000
forceair = 1
slot = 0
attr = SCA, AA, AT, AP

[State 347100, 1]
type = VarSet
trigger1 = anim = 9997
trigger1 = animelem = 3;6
var(8)=1

[State 347100, 1]
type = VarSet
trigger1 = anim = 9997
trigger1 = animelem = 4;10
var(8)=2

[State 347100, 1]
type = VarSet
trigger1 = anim = 9997
trigger1 = animelem = 6;12
var(8)=0

[State 347100, 1]
type = VarSet
trigger1 = anim = 9997
trigger1 = animelem = 3 || animelem = 5 ;9 || animelem = 11
var(9)=31+!(var(10):=-27)

[State 347100, 1]
type = VarSet
trigger1 = anim = 9997
trigger1 = animelem = 4;10
var(9)=34+!(var(10):=-34)

[State 347100, 0]
type = AttackDist
trigger1 = time = 0
value = 0

[State 347100, 1]
type = VarAdd
trigger1 = var(1) > 0
v = 1
value = 1

[State 347100, 1]
type = PlaySnd
trigger1 = anim = 9997
trigger1 = AnimElem = 4;10
value = 7470, 1    ; munch
channel = 0

[State 347100, 2]
type = helper
helpertype = normal
pos = 7, -68
postype = p1
trigger1 = anim = 9997
trigger1 = animelem = 6;12
keyctrl = 0
ownpal = 1
id = 3477
name = "Dan's Jimmy's banana"
stateno = 347700
size.xscale = 1
size.shadowoffset = 0
facing = -1

[State 347100, 1]
type = Turn
trigger1 = anim = 7510
trigger1 = animtime = 0

[State 347100, 1]
type = ChangeAnim
trigger1 = anim = 7510
trigger1 = animtime = 0
value = 7530

[State 347100, 1]
type = ChangeAnim
trigger1 = anim = 7530
trigger1 = animtime = 0
value = 9997

[State 347100, 2]
type = ChangeState
triggerall = matchover = 0
triggerall = win = 0
trigger1 = time = 160-var(3)*11
trigger2 = time >= 120-var(3)*11
trigger2 = var(1) >= 15
value = 347300

[State 347100, 3]
type = ParentVarSet
trigger1 = matchover = 1
v = 6
value = 1

[State 347100, 4]
type = ChangeState
trigger1 = parent, var(7) = 1
value = 348500

[State 347100, 4]
type = ChangeState
trigger1 = parent, var(7) = 2
trigger1 = time >= 120
value = 347300

; banana thrown (init state) through air
[Statedef 347700]
type = A
physics = N
movetype = A
anim = 9987

[State 347700, 0]
type = SprPriority
trigger1 = !time
value = 3

[State 347700, 0]
type = Turn
trigger1 = !time 
trigger1 = !var(3)
persistent = 0

[State 347700, 0]
type = VarSet
trigger1 = !time
var(0) = parent, var(2)

[State 347700, 0]
type = VarSet
trigger1 = !time
var(15) = parent, var(15)

[State 347700, 0]
type = VarSet
trigger1 = !time
fvar(1) = parent, fvar(0)

[State 347700, 0]
type = VarSet
trigger1 = !time
var(9)= p2life = p2life

[State 347700, 0]
type = VarSet
trigger1 = !time
fvar(0) = 160.0

[State 347700, 0]
type = VarSet
trigger1 = !time
trigger1 = var(0)=3
trigger1 = var(9)
fvar(0)= P2Dist X

[State 347700, 0]
type = VelSet
trigger1 = !time
x = ifelse(var(0)=3,ifelse(fvar(0)>=0,fvar(0)/80.0,2),2**var(0))
y = ifelse(var(0)=3,-8,-5-2*var(0))

[State 347700, 1]
type = HitOverride
trigger1 = time >= 0
time = 1
stateno = 347900
slot = 0
attr = SCA, AA, AT, AP

[State 347700, 0]
type = ChangeState
trigger1 = time!=0
value = 347400

; banana flying through air (general)
[Statedef 347400]
type = A
physics = N
movetype = A

[State 347400, 0]
type = VelAdd
trigger1 = time >= 0
y = .2

[State 347400, 1]
type = HitOverride
trigger1 = time >= 0
time = 1
stateno = 347900
slot = 0
attr = SCA, AA, AT, AP

[State 347400, 0]
type = VelMul
trigger1 = frontedgedist <= -6
;trigger1 = var(0)=2
persistent = 0
x = -.6

[State 347400, 0]
type = Turn
trigger1 = frontedgedist <= -6
;trigger1 = var(0)=2
persistent = 0

[State 347400, 0]
type = HitDef
trigger1 = time = 0
attr = S, SP
damage = 40, 4
guardflag = MA
hitflag = MAF
;sparkno = 0, 5
hitsound = 5, 1
animtype = light
ground.type = high
ground.hittime = 12
ground.velocity = -1
guard.dist = 20
priority = 6
p1getp2facing = -1   ; face opposite direction
getpower = 20

[State 347400, 1]
type = ChangeState
trigger1 = movecontact = 1
value = 347800

[State 347400, 4]
type = VelSet
trigger1 = Pos Y >= -1
y = 0

[State 347400, 5]
type = PosSet
trigger1 = Pos Y >= -1
y = 0

[State 347400, 5]
type = ChangeState
trigger1 = root, var(15) = 1
value = 349900

[State 347400, 4]
type = helper
trigger1 = Pos Y = 0
trigger1 = Vel Y = 0
helpertype = normal
pos = 0, 0
postype = p1
keyctrl = 0
ownpal = 1
id = 3477
name = "Dan's Jimmy's banana"
stateno = 347200
size.xscale = 1
size.shadowoffset = 0
facing = 1

[State 347400, 5]
type = DestroySelf
trigger1 = Pos Y = 0 && Vel Y = 0

; Banana custom hit state
[Statedef 347900]
type = A
movetype = I
physics = N
anim = 9987
facep2 = 1
velset = GetHitVar(xvel), GetHitVar(yvel)
movehitpersist = 1

[State 347900, 1]
type = ChangeState
trigger1 = movecontact
value = 347800

[State 347900, 1]
type = ChangeState
value = 3474
trigger1 = !time

; banana on ground
[Statedef 347200]
type = S
ctrl = 0
movetype = A
velset = 0, 0
anim = 9986

[State 347200, 0]
type = PosSet
trigger1 = time = 0
y = 0

[State 347200, 0]
type = HitDef
trigger1 = !time
velocity = 0
attr = S, SP
damage = 40, 4
guardflag = N
guard.dist = 0
hitflag = MF
sparkno = 1
hitsound = 5, 1
animtype = light
p1getp2facing = 1    ; face same direction
ground.type = trip
ground.velocity = n, -4
hitonce = 1
getpower = 20

[State 347200, 0]
type = ChangeState
trigger1 = movecontact = 1
value = 347600

; play banana removal anim
[Statedef 347600]
type = A
movetype = H
physics = N
anim = 9982

[State 347600, 0]
type = VelSet
trigger1 = time = 1
x = numtarget > 0
y = -3

[State 347600, 1]
type = VelAdd
trigger1 = time > 1
y = .15

[State 347600, 1]
type = DestroySelf
trigger1 = time = 30

; play banana hit anim
[Statedef 347800]
type = A
movetype = H
physics = N
anim = 9982

[State 347800, 0]
type = VelSet
trigger1 = time = 1
x = -1
y = -2

[State 347800, 1]
type = VelAdd
trigger1 = time > 1
y = .15

[State 347800, 1]
type = DestroySelf
trigger1 = time = 30

; Jimmy picks up blender (from normal blender anim)
[Statedef 346900]
type = S
movetype = I
physics = S
velset = 0,0
anim = 7558

[State 346900, 0]
type = VarSet
trigger1 = !time
var(3) = 0

[State 346900, 0]
type = ChangeState
trigger1 = !animtime
value = 347300

[State 346900, 0]
type = HitOverride
trigger1 = !time
slot = 0
time = -1
stateno = 7585
attr = SCA, AA, AT, AP

; Jimmy leaves
[Statedef 347300]
type = A
movetype = I
physics = N
velset = 0, 0
anim = ifelse(var(3),7524,7521)

[State 347300, 0]
type = NotHitBy
trigger1 = 1
value = SCA

[State 347300, 0]
type = ChangeState
trigger1 = var(17) = 1 
value = 349700

[State 347300, 0]
type = VelSet
trigger1 = AnimElem = 2, = 1
x = ifelse(var(3),-5.5,5.5)
y = -12.75

[State 347300, 1]
type = PlaySnd
trigger1 = AnimElem = 6
value = 0, 200   ; whoosh

[State 347300, 2]
type = PlaySnd
trigger1 = AnimElem = 2
value = 7470, 2  ; wahoo!
channel = 0

[State 347300, 3]
type = Gravity
trigger1 = AnimElem = 2, > 2

[State 347300, 1] 
type = DestroySelf
triggerall = AnimElem = 2, > 1
trigger1 = Pos X > 160
trigger2 = Pos Y < -240
trigger3 = Pos Y > 0

; Jimmy don't wanna play
[Statedef 347500]
type = S
movetype = I
physics = S
velset = 0, 0
anim = 7510

[State 347500, 0]
type = HitOverride
trigger1 = !time
time = -1
slot = 0
attr = SCA, AA, AT, AP
stateno = 7585

[State 347500, 0]
type = PosSet
trigger1 = time = 0
y = 0

[State 347500, 1]
type = Turn
trigger1 = anim = 7510
trigger1 = animtime = 0

[State 347500, 1]
type = ChangeAnim
trigger1 = anim = 7510
trigger1 = animtime = 0
value = 7550

[State 347500, 2]
type = ChangeState
trigger1 = time = 230
;trigger1 = win = 0
value = 3469;3473

[State 347500, 3]
type = PlaySnd
triggerall = anim = 7550
trigger1 = AnimElem = 12
trigger2 = AnimElem = 16
value = 7470,3   ; zap

[State 347500, 4]
type = ParentVarSet
trigger1 = var(1):=(win && Pos X = [-215,215])
persistent = 0
v = 6
value = 6

[State 347500, 0]
type = Turn
trigger1 = var(1)
persistent = 0

[State 347500, 0]
type = helper
trigger1 = var(1)
persistent = 0
;trigger1 = !numhelper(7640)
pos = ifelse((Pos X!=[-160,159]),floor((153-abs(Pos X))*ifelse(anim=7510,-1,1)*facing*Pos X/abs(Pos X)),0),0
postype = p1
stateno = 7698
ownpal = 0
id = 7640
helpertype = player
name = "Dan's Jimmy's cameraman"
size.ground.back=0
size.ground.front=0
keyctrl = 0

[State 347500, 0]
type = Turn
trigger1 = var(1)
persistent = 0

[State 347500, 5]
type = ChangeState
trigger1 = win = 1
trigger1 = anim = 7550
trigger1 = AnimElemNo(0) > 20
trigger1 = Pos X = [-200,200]
value = 7640

; Win pose with Jimmy
[Statedef 348000]
type = S
physics = N
anim = 3480  

[State 348000, 0]
type = VarSet
trigger1 = time = 0
v = 7
value = 1  ; notify helper

[State 348000, 0]
type = VelSet
trigger1 = time >= 3
x = 4.4

; Hack to keep a bit ahead of Jimmy
[State 348000, 0]
type = VelSet
trigger1 = helper(3450),facing=facing
trigger1 = helper(3450),RootDist X = [40,75]
x = 4.8

[State 348000, 1]
type = Turn
trigger1 = frontedgedist <= 25

[State 348000, 2]
type = PlaySnd
trigger1 = time = 15
value = 3480, 0   ; Yahoo! Ore tte saikyou!
channel = 0

[State 348000, 2]
type = PlaySnd
trigger1 = time = 175
value = 198, 8    ; Oyaji! 
channel = 0

[State 348000, 3]
type = NotHitBy
trigger1 = time >= 0
value = SCA

[State 348000, 4]
type = PlayerPush
trigger1 = time >= 0
value = 0

[State 348000, 4]
type = ScreenBound
trigger1 = time >= 0
value = 1
movecamera = 0,0

[State 348000, 4]
type = AssertSpecial
trigger1 = time = [0, 280]
flag = roundnotover

; Jimmy's win pose with Dan
[Statedef 348500]
type = S
physics = N
anim = 7522  

[State 348500, 0]
type = VelSet
trigger1 = time >= 3
x = 4.4

[State 348500, 1]
type = Turn
trigger1 = frontedgedist <= 25
trigger1 = backedgedist < 320
trigger1 = RootDist X != [-40,40]
trigger2 = backedgedist >= 320

[State 348500, 2]
type = PlaySnd
trigger1 = time = 20
value = 7470, 4   ; cackle
channel = 0

[State 348500, 2]
type = PlaySnd
trigger1 = time = 105
value = 7470, 5   ; rowww!
channel = 0

[State 348500, 3]
type = NotHitBy
trigger1 = time >= 0
value = SCA

[State 348500, 4]
type = PlayerPush
trigger1 = time >= 0
value = 0

; taunt
[Statedef 349100]
type = S
movetype = I
physics = S
ctrl = 0

[State 349100, 0]
type = VarSet
trigger1 = 1
var(15)=1

; bail if something's wrong.
[State 349100, 0]
type = ChangeState
triggerall = !time
trigger1 = !numhelper(3477)
trigger2 = time =1 && helper(3477),stateno!=349900
value = 0
ctrl = 1

[State 349100, 0]
type = VarAdd
trigger1 = time = 1
var(59) = 1

[State 349100, 0]
type = ChangeAnim
trigger1 = time = 10
trigger1 = (anim = [800,801]) || anim = 195 || anim = 0 || anim = 2102
trigger2 = anim=12 && !animtime
value = 3490 + 0*(var(1):=time)

[State 349100, 1]
type = ChangeAnim
triggerall = time = 6
trigger1 = anim = 11
trigger2 = anim = 802
value = 12

[State 349100, 1]
type = PlaySnd
triggerall = anim = 3490
trigger1 = time = var(1)+3
value = 3491, 0    ; me ga nai ssu!
channel = 0

[State 349100, 2]
type = ChangeState
triggerall = anim = 3490
trigger1 = time = var(1)+75
value = 0
ctrl = 1

[Statedef 349200]
type = S
movetype = I
physics = S

[State 349200, 0]
type = ChangeState
trigger1 = time = 30
value = 0
ctrl = 1

; Banana knocked off Dan's head
[Statedef 349300]
type = A
movetype = H
physics = N
velset = -2, -4
anim = 9982

[State 349300, 0]
type = VelAdd
trigger1 = time > 0
y = .2

[State 349300, 1]
type = DestroySelf
trigger1 = time = 30

; Banana falling naturally off Dan's head
[Statedef 349400]
type = A
movetype = H
physics = N
velset = -1.6, 0
anim = 9982

[State 349400, 0]
type = VelAdd
trigger1 = time > 0
y = .1

[State 349400, 1]
type = DestroySelf
trigger1 = time = 30

; Jimmy leaves -- straight up
[Statedef 349700]
type = A
movetype = I
physics = N
velset = 0, 0
anim = 7521

[State 349700, 0]
type = VelSet
trigger1 = AnimElem = 2, = 1
y = -12.75

[State 349700, 1]
type = PlaySnd
trigger1 = AnimElem = 6
value = 0, 200   ; whoosh

[State 349700, 2]
type = PlaySnd
trigger1 = AnimElem = 2
value = 7470, 2  ; wahoo!
channel = 0

[State 349700, 3]
type = Gravity
trigger1 = AnimElem = 2, > 2

[State 349700, 1] 
type = DestroySelf
triggerall = AnimElem = 2, > 1
trigger1 = Pos Y < -240

[State 349700, 0]
type = NotHitBy
trigger1 = 1
value = SCA

; Banana landing on Dan's head
[Statedef 349900]
type = A
movetype = H
physics = N
anim = 9986
velset = 0, 0

[State 349900, 0]
type = SprPriority
trigger1 = time = 0
value = 3

; note: for desired x offset x_0, use x_0-1+root,facing due to bug (?)

[State 349900, 0]
type = VarSet
trigger1 = !time
var(32)=-1

[State 349900, 0]
type = VarSet
trigger1 = root,anim=0
trigger1 = root,stateno!=var(32)
var(0)=!((var(1):=var(3):=-94)+(var(2):=-92)+(var(4):=var(6):=-99+root,facing)+(var(5):=-101+root,facing))

[State 349900, 0]
type = VarRangeSet
trigger1 = root,anim=0
trigger1 = root,stateno!=var(32)
first = 8
last = 13
value = 4

[State 349900, 1]
type = VarSet
trigger1 = root,anim=195
trigger1 = root,anim!=var(32)
var(0)=(var(1):=-94)+(var(2):=-91)+(var(3):=var(4):=-92)

[State 349900, 1]
type = VarSet
trigger1 = root,anim=195
trigger1 = root,anim!=var(32)
var(0)=!((var(8):=5+root,facing)+(var(9):=13+root,facing)+(var(10):=var(11):=22+root,facing))

[State 349900, 2]
type = VarSet
trigger1 = root,anim=11
trigger1 = root,anim!=var(32)
var(0)=0*((var(1):=-65)+(var(8):=3+root,facing))

[State 349900, 3]
type = VarSet
trigger1 = root,anim=12
trigger1 = root,anim!=var(32)
var(0)=0*((var(8):=var(9):=2+root,facing)+(var(1):=-72)+(var(2):=-89))

[State 349900, 3]
type = VarSet
trigger1 = root,anim=47 || root,anim = 40
trigger1 = root,anim!=var(32)
var(0)=0*((var(8):=2+root,facing)+(var(1):=-89))

[State 349900, 5]
type = VarSet
trigger1 = (root,anim = 2102) || (root,anim=[800,801])
trigger1 = root,anim!=var(32)
var(0)=(var(1):=-72)+(var(2):=-89)+(var(3):=-94)+(var(4):=-91)+(var(5):=var(6):=-92)

[State 349900,5]
type = VarSet
trigger1 = (root,anim=[800,801]) || (root,anim = 2102)
trigger1 = root,anim!=var(32)
var(0)=13+!((var(8):=var(9):=2+root,facing)+(var(10):=5+root,facing)+(var(11):=13+root,facing)+(var(12):=var(13):=22+root,facing))

[State 349900, 5]
type = VarSet
trigger1 = root,anim = 2102
var(0) = 0

[State 349900, 4]
type = VarSet
trigger1 = root,anim=3490
trigger1 = root,anim!=var(32)
var(0)=0*((var(8):=4+root,facing)+(var(9):=var(10):=6+root,facing)+(var(1):=-91)+(var(2):=var(3):=-93))

[State 349900, 5]
type = VarSet
trigger1 = root,anim=802
trigger1 = root,anim!=var(32)
var(0)=(var(1):=var(2):=-65)+(var(3):=var(4):=-67)

[State 349900, 5]
type = VarSet
trigger1 = root,anim=802
trigger1 = root,anim!=var(32)
var(0)=0*((var(8):=5+root,facing)+(var(9):=8+root,facing)+(var(10):=var(11):=17+root,facing))

[State 349900, 6]
type = VarSet
trigger1 = root,anim=100
trigger1 = root,anim!=var(32)
var(0)=(var(1):=var(2):=var(5):=var(6):=-94)+(var(3):=-84)+(var(4):=-85)+(var(7):=-89)

[State 349900, 6.5]
type = VarSet
trigger1 = root,anim=100
trigger1 = root,anim!=var(32)
var(0)=!((var(8):=var(9):=var(12):=7+root,facing)+(var(10):=20+root,facing)+(var(11):=17+root,facing)+(var(13):=5+root,facing)+(var(14):=1+root,facing))

[State 349900, 7]
type = VarSet
trigger1 = root,anim=810
trigger1 = root,anim!=var(32)
var(0)=2+!((var(1):=-94)+(var(2):=var(3):=-91)+(var(8):=5+root,facing)+(var(9):=var(10):=34+root,facing))

[State 349900, 8]
type = VarSet
trigger1 = root,anim = 803
trigger1 = root,anim!=var(32)
var(0)=0*((var(1):=-95)+(var(2):=var(3):=-102)+(var(8):=9)+(var(9):=var(10):=-13))

[State 349900, 9]
type = VarSet
trigger1 = root,anim = [41,43]
trigger1 = root,anim != var(32)
var(0)=0*((var(1):=-106)+(var(2):=-104)+(var(3):=-103)+(var(8):=-2)+(var(9):=2)+(var(10):=4))

[State 349900, 9]
type = VarSet
trigger1 = root,anim = [44,46]
trigger1 = root,anim != var(32)
var(0)=0*((var(1):=var(3):=var(4):=var(5):=-103)+(var(2):=-100)+(var(8):=4)+(var(9):=5)+(var(10):=-4)+(var(11):=var(12):=-1))

[State 349900, 10]
type = VarSet
trigger1 = 1
var(32) = root,anim
 
[State 349900, 0]
type = BindToRoot
trigger1 = root,var(15)
time = 1
pos = var(7+root,animelemno(0)-var(0)),var(root,animelemno(0)-var(0))
facing = 1

[State 349900, 2]
type = ChangeState
trigger1 = root, movetype = H
value = 34930

[State 349900, 3]
type = ChangeState
trigger1 = !root, var(15)
value = 349400

[Statedef 758000]
type = A
movetype = H
physics = N
velset = root,facing*GetHitVar(xvel)*((P2Dist X < 0)*-2+1),ifelse(GetHitVar(yvel)>-6,-6,GetHitVar(yvel))
;velset = GetHitVar(xvel),GetHitVar(yvel)

[State 758000, 0]
type = Explod
trigger1 = !time && var(8)
pos = var(9),var(10)
anim = ifelse(var(8)=1,9984,9982)
removetime = 45;51
postype = p1
bindtime = 1
vel = 0,-4
accel = 0,0.2
scale = 1
ownpal = 1
sprpriority = 4

[State 758000, 0]
type = VarSet
trigger1 = !time
var(5)=(Vel X <= 0)  

[State 758000, 0]
type = ChangeAnim
trigger1 = !time
value = ifelse(Vel X <=0, 7580, 7582)

[State 758000, 0]
type = Gravity
trigger1 = 1

[State 758000, 1]
type = ChangeState
trigger1 = Pos Y > 0
value = var(0)

[State 758000, 1]
type = HitOverride
trigger1 = 1
time = 1
stateno = 758000
slot = 0
forceair = 1
attr = SCA, AA, AT, AP


;=============================================================================
;Ananas
[Statedef 9996]
type = S
movetype = A
physics = S
velset = 0, 0
juggle = 0
ctrl = 0
poweradd = 40
anim = 3450

[State 9996, 0]
type = VarAdd
trigger1 = time = 0
v = 4
value = 1

[State 9996, 0]
type = VarSet
trigger1 = !time
var(16) = 0

[State 9996, 0]
type = VarSet
trigger1 = time = 0
var(1) = var(5) = 4

[State 9996, 0]
type = VarSet
trigger1 = time = 0
var(3) = numhelper(3477) = 4

[State 9996, 0]
type = VarSet
trigger1 = time = 0
var(5) = (var(5)+1)%5

[State 9996, 0]
type = VarSet
trigger1 = !time
var(7) = ifelse(command="x",0,ifelse(command="y",1,ifelse(command="z",2,3)))

[State 9996, 0]
type = VarSet
trigger1 = !time
var(17) = ifelse(command="straightfwd",0,ifelse(command="straightdown",1,2))

[State 9996, 0]
type = VarSet
trigger1 = command = "tapback"
trigger1 = command != "releaseback"
var(16) = -facing

[State 9996, 0]
type = VarSet
trigger1 = command = "tapfwd"
trigger1 = command != "releasefwd"
var(16) = facing

[State 9996, 0]
type = helper
trigger1 = AnimElem = 4
trigger1 = var(17) = 0
pos = 40, -140
postype = front
helpertype = normal
id = 3450
stateno = 347001
keyctrl = 0
name = "Dan's Jimmy"
ownpal = 1

[State 9996, 0]
type = helper
trigger1 = AnimElem = 4
trigger1 = var(17) = 1
pos = 60, -200
postype = p1
helpertype = normal
id = 3450
stateno = 347001
keyctrl = 0
name = "Dan's Jimmy"
ownpal = 1

[State 9996, 0]
type = helper
trigger1 = AnimElem = 4
trigger1 = var(17) = 2
pos = -40, -140
postype = back
helpertype = normal
id = 3450
stateno = 347001
keyctrl = 0
name = "Dan's Jimmy"
ownpal = 1

[State 9996, 1]
type = ChangeState
trigger1 = time = 60
trigger1 = var(1) = 0
trigger1 = var(3) = 0
value = 0
ctrl = 1

[State 9996, 2]
type = ChangeState
triggerall = time = 100
trigger1 = var(1) = 1
trigger2 = var(3) = 1
value = 345501
[State 9996, 2]
type = PlaySnd
trigger1 = time = AnimElem = 2
value = 3450, 0   ; yuujou!
channel = 0

[Statedef 345501]
type = S
movetype = I
physics = S
velset = 0, 0
anim = 3451

[State 345501, 0]
type = PlaySnd
trigger1 = time = 3
value = 3455, 0    ; Sorya nai ssu!
channel = 0

[State 345501, 0]
type = ChangeState
trigger1 = time = 90
value = 0
ctrl = 1

; Jimmy's air roll
[Statedef 347001]
type = A
movetype = A
physics = N
;velset = 3.5, -2
anim = 7520

[State 347001, 0]
type = Turn
trigger1 = !time
trigger1 = !parent,var(17)

[State 347001, 0]
type = VelSet
trigger1 = !time
x = ifelse(parent,var(17)-1,3.5,0)
y = ifelse(parent,var(17)-1,-2,0)

[State 347001, 0]
type = VarSet
trigger1 = !time
var(2) = parent, var(7)

[State 347001, 0]
type = VarSet
trigger1 = !time
var(17) = parent, var(17)

[State 347001, 0]
type = ParentVarSet
trigger1 = !time
var(7) = 0

[State 347001, 0]
type = VarSet
trigger1 = 1;!time
var(16) = parent, var(16)

[State 347001, 0]
type = Gravity
trigger1 = time > 0

[State 347001, 1]
type = VarSet
trigger1 = !time
var(3) = parent,var(1) || parent,var(3)

[State 347001, 1]
type = ChangeState
trigger1 = Pos Y > 0
value = ifelse(var(3),347501,347101)

[State 347001, 1]
type = VarSet
trigger1 = !time
var(0) = 7575   ; desired state after getting hit

[State 347001, 1]
type = HitOverride
trigger1 = 1;!time
time = 1
stateno = 7570
slot = 0
attr = SCA, AA, AT, AP

[State 347001, 2]
type = PlaySnd
trigger1 = time = 1
value = 7470, 0   ; roarr!
channel = 0

[State 347001, 3]
type = PlaySnd
trigger1 = AnimElem = 4
value = 0, 210   ; whoosh

[State 347001, 4]
type = SprPriority
trigger1 = time = 0
value = 3

[State 347001, 5]
type = HitDef
trigger1 = !time ;1
damage = 90,0
animtype = back
sparkxy = -3,-40
id = 3470
nochainid = 3470
attr = A,SA
hitflags=MA
guardflags = N
air.hittime = 14
ground.velocity = -4.2,-5
guard.dist = 50
sparkno = 3
hitsound = 5,3
pausetime = 9,9
air.velocity = -4.8,2
air.fall = 1
air.fall.recover = 0
air.hittime = 8
down.bounce = 1
down.velocity = -3

; Jimmy's banana throw
[Statedef 347101]
type = S
movetype = A
physics = S
velset = 0, 0
anim = ifelse(var(3):=(var(16)=-facing),9995,7510)
; var(3) must be preserved; until banana is thrown

[State 347101, 0]
type = VarSet
trigger1 = RoundState = 3
persistent = 0
var(15) = p2life = p2life

[State 347101, 0]
type = VarSet
trigger1 = RoundState = 3
trigger1 = (p2life = p2life)
fvar(0) = P2Dist X

[State 347101, 0]
type = PosSet
trigger1 = time = 0
y = 0

[State 347101, 0]
type = VarSet
trigger1 = time = 0
v = 1
value = 0

[State 347101, 1]
type = VarSet
trigger1 = !time
var(0) = 7579   ; desired state after getting hit

[State 347101, 1]
type = HitOverride
trigger1 = time >= 0
time = 1
stateno = 758001
forceair = 1
slot = 0
attr = SCA, AA, AT, AP

[State 347101, 1]
type = VarSet
trigger1 = anim = 9995
trigger1 = animelem = 3;6
var(8)=1

[State 347101, 1]
type = VarSet
trigger1 = anim = 9995
trigger1 = animelem = 4;10
var(8)=2

[State 347101, 1]
type = VarSet
trigger1 = anim = 9995
trigger1 = animelem = 6;12
var(8)=0

[State 347101, 1]
type = VarSet
trigger1 = anim = 9995
trigger1 = animelem = 3 || animelem = 5 ;9 || animelem = 11
var(9)=31+!(var(10):=-27)

[State 347101, 1]
type = VarSet
trigger1 = anim = 9995
trigger1 = animelem = 4;10
var(9)=34+!(var(10):=-34)

[State 347101, 0]
type = AttackDist
trigger1 = time = 0
value = 0

[State 347101, 1]
type = VarAdd
trigger1 = var(1) > 0
v = 1
value = 1

[State 347101, 1]
type = PlaySnd
trigger1 = anim = 9995
trigger1 = AnimElem = 4;10
value = 7470, 1    ; munch
channel = 0

[State 347101, 2]
type = helper
helpertype = normal
pos = 7, -68
postype = p1
trigger1 = anim = 9995
trigger1 = animelem = 6;12
keyctrl = 0
ownpal = 1
id = 3477
name = "Dan's Jimmy's banana"
stateno = 347701
size.xscale = 1
size.shadowoffset = 0
facing = -1

[State 347101, 1]
type = Turn
trigger1 = anim = 7510
trigger1 = animtime = 0

[State 347101, 1]
type = ChangeAnim
trigger1 = anim = 7510
trigger1 = animtime = 0
value = 7530

[State 347101, 1]
type = ChangeAnim
trigger1 = anim = 7530
trigger1 = animtime = 0
value = 9995

[State 347101, 2]
type = ChangeState
triggerall = matchover = 0
triggerall = win = 0
trigger1 = time = 160-var(3)*11
trigger2 = time >= 120-var(3)*11
trigger2 = var(1) >= 15
value = 347301

[State 347101, 3]
type = ParentVarSet
trigger1 = matchover = 1
v = 6
value = 1

[State 347101, 4]
type = ChangeState
trigger1 = parent, var(7) = 1
value = 348501

[State 347101, 4]
type = ChangeState
trigger1 = parent, var(7) = 2
trigger1 = time >= 120
value = 347301

; banana thrown (init state) through air
[Statedef 347701]
type = A
physics = N
movetype = A
anim = 9980

[State 347701, 0]
type = SprPriority
trigger1 = !time
value = 3

[State 347701, 0]
type = Turn
trigger1 = !time 
trigger1 = !var(3)
persistent = 0

[State 347701, 0]
type = VarSet
trigger1 = !time
var(0) = parent, var(2)

[State 347701, 0]
type = VarSet
trigger1 = !time
var(15) = parent, var(15)

[State 347701, 0]
type = VarSet
trigger1 = !time
fvar(1) = parent, fvar(0)

[State 347701, 0]
type = VarSet
trigger1 = !time
var(9)= p2life = p2life

[State 347701, 0]
type = VarSet
trigger1 = !time
fvar(0) = 160.0

[State 347701, 0]
type = VarSet
trigger1 = !time
trigger1 = var(0)=3
trigger1 = var(9)
fvar(0)= P2Dist X

[State 347701, 0]
type = VelSet
trigger1 = !time
x = ifelse(var(0)=3,ifelse(fvar(0)>=0,fvar(0)/80.0,2),2**var(0))
y = ifelse(var(0)=3,-8,-5-2*var(0))

[State 347701, 1]
type = HitOverride
trigger1 = time >= 0
time = 1
stateno = 347901
slot = 0
attr = SCA, AA, AT, AP

[State 347701, 0]
type = ChangeState
trigger1 = time!=0
value = 347401

; banana flying through air (general)
[Statedef 347401]
type = A
physics = N
movetype = A

[State 347401, 0]
type = VelAdd
trigger1 = time >= 0
y = .2

[State 347401, 1]
type = HitOverride
trigger1 = time >= 0
time = 1
stateno = 347901
slot = 0
attr = SCA, AA, AT, AP

[State 347401, 0]
type = VelMul
trigger1 = frontedgedist <= -6
;trigger1 = var(0)=2
persistent = 0
x = -.6

[State 347401, 0]
type = Turn
trigger1 = frontedgedist <= -6
;trigger1 = var(0)=2
persistent = 0

[State 347401, 0]
type = HitDef
trigger1 = time = 0
attr = S, SP
damage = 40, 4
guardflag = MA
hitflag = MAF
;sparkno = 0, 5
hitsound = 5, 1
animtype = light
ground.type = high
ground.hittime = 12
ground.velocity = -1
guard.dist = 20
priority = 6
p1getp2facing = -1   ; face opposite direction
getpower = 20

[State 347401, 1]
type = ChangeState
trigger1 = movecontact = 1
value = 347801

[State 347401, 4]
type = VelSet
trigger1 = Pos Y >= -1
y = 0

[State 347401, 5]
type = PosSet
trigger1 = Pos Y >= -1
y = 0

[State 347401, 5]
type = ChangeState
trigger1 = root, var(15) = 1
value = 349901

[State 347401, 4]
type = helper
trigger1 = Pos Y = 0
trigger1 = Vel Y = 0
helpertype = normal
pos = 0, 0
postype = p1
keyctrl = 0
ownpal = 1
id = 3477
name = "Dan's Jimmy's banana"
stateno = 347201
size.xscale = 1
size.shadowoffset = 0
facing = 1

[State 347401, 5]
type = DestroySelf
trigger1 = Pos Y = 0 && Vel Y = 0

; Banana custom hit state
[Statedef 347901]
type = A
movetype = I
physics = N
anim = 9980
facep2 = 1
velset = GetHitVar(xvel), GetHitVar(yvel)
movehitpersist = 1

[State 347901, 1]
type = ChangeState
trigger1 = movecontact
value = 347801

[State 347901, 1]
type = ChangeState
value = 3474
trigger1 = !time

; banana on ground
[Statedef 347201]
type = S
ctrl = 0
movetype = A
velset = 0, 0
anim = 9979

[State 347201, 0]
type = PosSet
trigger1 = time = 0
y = 0

[State 347201, 0]
type = HitDef
trigger1 = !time
velocity = 0
attr = S, SP
damage = 40, 4
guardflag = N
guard.dist = 0
hitflag = MF
sparkno = 1
hitsound = 5, 1
animtype = light
p1getp2facing = 1    ; face same direction
ground.type = trip
ground.velocity = n, -4
hitonce = 1
getpower = 20

[State 347201, 0]
type = ChangeState
trigger1 = movecontact = 1
value = 347601

; play banana removal anim
[Statedef 347601]
type = A
movetype = H
physics = N
anim = 9975

[State 347601, 0]
type = VelSet
trigger1 = time = 1
x = numtarget > 0
y = -3

[State 347601, 1]
type = VelAdd
trigger1 = time > 1
y = .15

[State 347601, 1]
type = DestroySelf
trigger1 = time = 30

; play banana hit anim
[Statedef 347801]
type = A
movetype = H
physics = N
anim = 9975

[State 347801, 0]
type = VelSet
trigger1 = time = 1
x = -1
y = -2

[State 347801, 1]
type = VelAdd
trigger1 = time > 1
y = .15

[State 347801, 1]
type = DestroySelf
trigger1 = time = 30

; Jimmy picks up blender (from normal blender anim)
[Statedef 346901]
type = S
movetype = I
physics = S
velset = 0,0
anim = 7558

[State 346901, 0]
type = VarSet
trigger1 = !time
var(3) = 0

[State 346901, 0]
type = ChangeState
trigger1 = !animtime
value = 347301

[State 346901, 0]
type = HitOverride
trigger1 = !time
slot = 0
time = -1
stateno = 7585
attr = SCA, AA, AT, AP

; Jimmy leaves
[Statedef 347301]
type = A
movetype = I
physics = N
velset = 0, 0
anim = ifelse(var(3),7524,7521)

[State 347301, 0]
type = NotHitBy
trigger1 = 1
value = SCA

[State 347301, 0]
type = ChangeState
trigger1 = var(17) = 1 
value = 349701

[State 347301, 0]
type = VelSet
trigger1 = AnimElem = 2, = 1
x = ifelse(var(3),-5.5,5.5)
y = -12.75

[State 347301, 1]
type = PlaySnd
trigger1 = AnimElem = 6
value = 0, 200   ; whoosh

[State 347301, 2]
type = PlaySnd
trigger1 = AnimElem = 2
value = 7470, 2  ; wahoo!
channel = 0

[State 347301, 3]
type = Gravity
trigger1 = AnimElem = 2, > 2

[State 347301, 1] 
type = DestroySelf
triggerall = AnimElem = 2, > 1
trigger1 = Pos X > 160
trigger2 = Pos Y < -240
trigger3 = Pos Y > 0

; Jimmy don't wanna play
[Statedef 347501]
type = S
movetype = I
physics = S
velset = 0, 0
anim = 7510

[State 347501, 0]
type = HitOverride
trigger1 = !time
time = -1
slot = 0
attr = SCA, AA, AT, AP
stateno = 7585

[State 347501, 0]
type = PosSet
trigger1 = time = 0
y = 0

[State 347501, 1]
type = Turn
trigger1 = anim = 7510
trigger1 = animtime = 0

[State 347501, 1]
type = ChangeAnim
trigger1 = anim = 7510
trigger1 = animtime = 0
value = 7550

[State 347501, 2]
type = ChangeState
trigger1 = time = 230
;trigger1 = win = 0
value = 3469;3473

[State 347501, 3]
type = PlaySnd
triggerall = anim = 7550
trigger1 = AnimElem = 12
trigger2 = AnimElem = 16
value = 7470,3   ; zap

[State 347501, 4]
type = ParentVarSet
trigger1 = var(1):=(win && Pos X = [-215,215])
persistent = 0
v = 6
value = 6

[State 347501, 0]
type = Turn
trigger1 = var(1)
persistent = 0

[State 347501, 0]
type = helper
trigger1 = var(1)
persistent = 0
;trigger1 = !numhelper(7640)
pos = ifelse((Pos X!=[-160,159]),floor((153-abs(Pos X))*ifelse(anim=7510,-1,1)*facing*Pos X/abs(Pos X)),0),0
postype = p1
stateno = 7698
ownpal = 0
id = 7640
helpertype = player
name = "Dan's Jimmy's cameraman"
size.ground.back=0
size.ground.front=0
keyctrl = 0

[State 347501, 0]
type = Turn
trigger1 = var(1)
persistent = 0

[State 347501, 5]
type = ChangeState
trigger1 = win = 1
trigger1 = anim = 7550
trigger1 = AnimElemNo(0) > 20
trigger1 = Pos X = [-200,200]
value = 7640

; Win pose with Jimmy
[Statedef 348001]
type = S
physics = N
anim = 3480  

[State 348001, 0]
type = VarSet
trigger1 = time = 0
v = 7
value = 1  ; notify helper

[State 348001, 0]
type = VelSet
trigger1 = time >= 3
x = 4.4

; Hack to keep a bit ahead of Jimmy
[State 348001, 0]
type = VelSet
trigger1 = helper(3450),facing=facing
trigger1 = helper(3450),RootDist X = [40,75]
x = 4.8

[State 348001, 1]
type = Turn
trigger1 = frontedgedist <= 25

[State 348001, 2]
type = PlaySnd
trigger1 = time = 15
value = 3480, 0   ; Yahoo! Ore tte saikyou!
channel = 0

[State 348001, 2]
type = PlaySnd
trigger1 = time = 175
value = 198, 8    ; Oyaji! 
channel = 0

[State 348001, 3]
type = NotHitBy
trigger1 = time >= 0
value = SCA

[State 348001, 4]
type = PlayerPush
trigger1 = time >= 0
value = 0

[State 348001, 4]
type = ScreenBound
trigger1 = time >= 0
value = 1
movecamera = 0,0

[State 348001, 4]
type = AssertSpecial
trigger1 = time = [0, 280]
flag = roundnotover

; Jimmy's win pose with Dan
[Statedef 348501]
type = S
physics = N
anim = 7522  

[State 348501, 0]
type = VelSet
trigger1 = time >= 3
x = 4.4

[State 348501, 1]
type = Turn
trigger1 = frontedgedist <= 25
trigger1 = backedgedist < 320
trigger1 = RootDist X != [-40,40]
trigger2 = backedgedist >= 320

[State 348501, 2]
type = PlaySnd
trigger1 = time = 20
value = 7470, 4   ; cackle
channel = 0

[State 348501, 2]
type = PlaySnd
trigger1 = time = 105
value = 7470, 5   ; rowww!
channel = 0

[State 348501, 3]
type = NotHitBy
trigger1 = time >= 0
value = SCA

[State 348501, 4]
type = PlayerPush
trigger1 = time >= 0
value = 0

; taunt
[Statedef 349101]
type = S
movetype = I
physics = S
ctrl = 0

[State 349101, 0]
type = VarSet
trigger1 = 1
var(15)=1

; bail if something's wrong.
[State 349101, 0]
type = ChangeState
triggerall = !time
trigger1 = !numhelper(3477)
trigger2 = time =1 && helper(3477),stateno!=349901
value = 0
ctrl = 1

[State 349101, 0]
type = VarAdd
trigger1 = time = 1
var(59) = 1

[State 349101, 0]
type = ChangeAnim
trigger1 = time = 10
trigger1 = (anim = [800,801]) || anim = 195 || anim = 0 || anim = 2102
trigger2 = anim=12 && !animtime
value = 3490 + 0*(var(1):=time)

[State 349101, 1]
type = ChangeAnim
triggerall = time = 6
trigger1 = anim = 11
trigger2 = anim = 802
value = 12

[State 349101, 1]
type = PlaySnd
triggerall = anim = 3490
trigger1 = time = var(1)+3
value = 3491, 0    ; me ga nai ssu!
channel = 0

[State 349101, 2]
type = ChangeState
triggerall = anim = 3490
trigger1 = time = var(1)+75
value = 0
ctrl = 1

[Statedef 349201]
type = S
movetype = I
physics = S

[State 349201, 0]
type = ChangeState
trigger1 = time = 30
value = 0
ctrl = 1

; Banana knocked off Dan's head
[Statedef 349301]
type = A
movetype = H
physics = N
velset = -2, -4
anim = 9975

[State 349301, 0]
type = VelAdd
trigger1 = time > 0
y = .2

[State 349301, 1]
type = DestroySelf
trigger1 = time = 30

; Banana falling naturally off Dan's head
[Statedef 349401]
type = A
movetype = H
physics = N
velset = -1.6, 0
anim = 9975

[State 349401, 0]
type = VelAdd
trigger1 = time > 0
y = .1

[State 349401, 1]
type = DestroySelf
trigger1 = time = 30

; Jimmy leaves -- straight up
[Statedef 349701]
type = A
movetype = I
physics = N
velset = 0, 0
anim = 7521

[State 349701, 0]
type = VelSet
trigger1 = AnimElem = 2, = 1
y = -12.75

[State 349701, 1]
type = PlaySnd
trigger1 = AnimElem = 6
value = 0, 200   ; whoosh

[State 349701, 2]
type = PlaySnd
trigger1 = AnimElem = 2
value = 7470, 2  ; wahoo!
channel = 0

[State 349701, 3]
type = Gravity
trigger1 = AnimElem = 2, > 2

[State 349701, 1] 
type = DestroySelf
triggerall = AnimElem = 2, > 1
trigger1 = Pos Y < -240

[State 349701, 0]
type = NotHitBy
trigger1 = 1
value = SCA

; Banana landing on Dan's head
[Statedef 349901]
type = A
movetype = H
physics = N
anim = 9979
velset = 0, 0

[State 349901, 0]
type = SprPriority
trigger1 = time = 0
value = 3

; note: for desired x offset x_0, use x_0-1+root,facing due to bug (?)

[State 349901, 0]
type = VarSet
trigger1 = !time
var(32)=-1

[State 349901, 0]
type = VarSet
trigger1 = root,anim=0
trigger1 = root,stateno!=var(32)
var(0)=!((var(1):=var(3):=-94)+(var(2):=-92)+(var(4):=var(6):=-99+root,facing)+(var(5):=-101+root,facing))

[State 349901, 0]
type = VarRangeSet
trigger1 = root,anim=0
trigger1 = root,stateno!=var(32)
first = 8
last = 13
value = 4

[State 349901, 1]
type = VarSet
trigger1 = root,anim=195
trigger1 = root,anim!=var(32)
var(0)=(var(1):=-94)+(var(2):=-91)+(var(3):=var(4):=-92)

[State 349901, 1]
type = VarSet
trigger1 = root,anim=195
trigger1 = root,anim!=var(32)
var(0)=!((var(8):=5+root,facing)+(var(9):=13+root,facing)+(var(10):=var(11):=22+root,facing))

[State 349901, 2]
type = VarSet
trigger1 = root,anim=11
trigger1 = root,anim!=var(32)
var(0)=0*((var(1):=-65)+(var(8):=3+root,facing))

[State 349901, 3]
type = VarSet
trigger1 = root,anim=12
trigger1 = root,anim!=var(32)
var(0)=0*((var(8):=var(9):=2+root,facing)+(var(1):=-72)+(var(2):=-89))

[State 349901, 3]
type = VarSet
trigger1 = root,anim=47 || root,anim = 40
trigger1 = root,anim!=var(32)
var(0)=0*((var(8):=2+root,facing)+(var(1):=-89))

[State 349901, 5]
type = VarSet
trigger1 = (root,anim = 2102) || (root,anim=[800,801])
trigger1 = root,anim!=var(32)
var(0)=(var(1):=-72)+(var(2):=-89)+(var(3):=-94)+(var(4):=-91)+(var(5):=var(6):=-92)

[State 349901,5]
type = VarSet
trigger1 = (root,anim=[800,801]) || (root,anim = 2102)
trigger1 = root,anim!=var(32)
var(0)=13+!((var(8):=var(9):=2+root,facing)+(var(10):=5+root,facing)+(var(11):=13+root,facing)+(var(12):=var(13):=22+root,facing))

[State 349901, 5]
type = VarSet
trigger1 = root,anim = 2102
var(0) = 0

[State 349901, 4]
type = VarSet
trigger1 = root,anim=3490
trigger1 = root,anim!=var(32)
var(0)=0*((var(8):=4+root,facing)+(var(9):=var(10):=6+root,facing)+(var(1):=-91)+(var(2):=var(3):=-93))

[State 349901, 5]
type = VarSet
trigger1 = root,anim=802
trigger1 = root,anim!=var(32)
var(0)=(var(1):=var(2):=-65)+(var(3):=var(4):=-67)

[State 349901, 5]
type = VarSet
trigger1 = root,anim=802
trigger1 = root,anim!=var(32)
var(0)=0*((var(8):=5+root,facing)+(var(9):=8+root,facing)+(var(10):=var(11):=17+root,facing))

[State 349901, 6]
type = VarSet
trigger1 = root,anim=100
trigger1 = root,anim!=var(32)
var(0)=(var(1):=var(2):=var(5):=var(6):=-94)+(var(3):=-84)+(var(4):=-85)+(var(7):=-89)

[State 349901, 6.5]
type = VarSet
trigger1 = root,anim=100
trigger1 = root,anim!=var(32)
var(0)=!((var(8):=var(9):=var(12):=7+root,facing)+(var(10):=20+root,facing)+(var(11):=17+root,facing)+(var(13):=5+root,facing)+(var(14):=1+root,facing))

[State 349901, 7]
type = VarSet
trigger1 = root,anim=810
trigger1 = root,anim!=var(32)
var(0)=2+!((var(1):=-94)+(var(2):=var(3):=-91)+(var(8):=5+root,facing)+(var(9):=var(10):=34+root,facing))

[State 349901, 8]
type = VarSet
trigger1 = root,anim = 803
trigger1 = root,anim!=var(32)
var(0)=0*((var(1):=-95)+(var(2):=var(3):=-102)+(var(8):=9)+(var(9):=var(10):=-13))

[State 349901, 9]
type = VarSet
trigger1 = root,anim = [41,43]
trigger1 = root,anim != var(32)
var(0)=0*((var(1):=-106)+(var(2):=-104)+(var(3):=-103)+(var(8):=-2)+(var(9):=2)+(var(10):=4))

[State 349901, 9]
type = VarSet
trigger1 = root,anim = [44,46]
trigger1 = root,anim != var(32)
var(0)=0*((var(1):=var(3):=var(4):=var(5):=-103)+(var(2):=-100)+(var(8):=4)+(var(9):=5)+(var(10):=-4)+(var(11):=var(12):=-1))

[State 349901, 10]
type = VarSet
trigger1 = 1
var(32) = root,anim
 
[State 349901, 0]
type = BindToRoot
trigger1 = root,var(15)
time = 1
pos = var(7+root,animelemno(0)-var(0)),var(root,animelemno(0)-var(0))
facing = 1

[State 349901, 2]
type = ChangeState
trigger1 = root, movetype = H
value = 349301

[State 349901, 3]
type = ChangeState
trigger1 = !root, var(15)
value = 349401

[Statedef 758001]
type = A
movetype = H
physics = N
velset = root,facing*GetHitVar(xvel)*((P2Dist X < 0)*-2+1),ifelse(GetHitVar(yvel)>-6,-6,GetHitVar(yvel))
;velset = GetHitVar(xvel),GetHitVar(yvel)

[State 758001, 0]
type = Explod
trigger1 = !time && var(8)
pos = var(9),var(10)
anim = ifelse(var(8)=1,9977,9975)
removetime = 45;51
postype = p1
bindtime = 1
vel = 0,-4
accel = 0,0.2
scale = 1
ownpal = 1
sprpriority = 4

[State 758001, 0]
type = VarSet
trigger1 = !time
var(5)=(Vel X <= 0)  

[State 758001, 0]
type = ChangeAnim
trigger1 = !time
value = ifelse(Vel X <=0, 7580, 7582)

[State 758001, 0]
type = Gravity
trigger1 = 1

[State 758001, 1]
type = ChangeState
trigger1 = Pos Y > 0
value = var(0)

[State 758001, 1]
type = HitOverride
trigger1 = 1
time = 1
stateno = 758001
slot = 0
forceair = 1
attr = SCA, AA, AT, AP

;=============================================================================
;Mela2
[Statedef 9995]
type = S
movetype = A
physics = S
velset = 0, 0
juggle = 0
ctrl = 0
poweradd = 40
anim = 3450

[State 9995, 0]
type = VarAdd
trigger1 = time = 0
v = 4
value = 1

[State 9995, 0]
type = VarSet
trigger1 = !time
var(16) = 0

[State 9995, 0]
type = VarSet
trigger1 = time = 0
var(1) = var(5) = 4

[State 9995, 0]
type = VarSet
trigger1 = time = 0
var(3) = numhelper(3477) = 4

[State 9995, 0]
type = VarSet
trigger1 = time = 0
var(5) = (var(5)+1)%5

[State 9995, 0]
type = VarSet
trigger1 = !time
var(7) = ifelse(command="x",0,ifelse(command="y",1,ifelse(command="z",2,3)))

[State 9995, 0]
type = VarSet
trigger1 = !time
var(17) = ifelse(command="straightfwd",0,ifelse(command="straightdown",1,2))

[State 9995, 0]
type = VarSet
trigger1 = command = "tapback"
trigger1 = command != "releaseback"
var(16) = -facing

[State 9995, 0]
type = VarSet
trigger1 = command = "tapfwd"
trigger1 = command != "releasefwd"
var(16) = facing

[State 9995, 0]
type = helper
trigger1 = AnimElem = 4
trigger1 = var(17) = 0
pos = 40, -140
postype = front
helpertype = normal
id = 3450
stateno = 347002
keyctrl = 0
name = "Dan's Jimmy"
ownpal = 1

[State 9995, 0]
type = helper
trigger1 = AnimElem = 4
trigger1 = var(17) = 1
pos = 60, -200
postype = p1
helpertype = normal
id = 3450
stateno = 347002
keyctrl = 0
name = "Dan's Jimmy"
ownpal = 1

[State 9995, 0]
type = helper
trigger1 = AnimElem = 4
trigger1 = var(17) = 2
pos = -40, -140
postype = back
helpertype = normal
id = 3450
stateno = 347002
keyctrl = 0
name = "Dan's Jimmy"
ownpal = 1

[State 9995, 1]
type = ChangeState
trigger1 = time = 60
trigger1 = var(1) = 0
trigger1 = var(3) = 0
value = 0
ctrl = 1

[State 9995, 2]
type = ChangeState
triggerall = time = 100
trigger1 = var(1) = 1
trigger2 = var(3) = 1
value = 345502
[State 9996, 2]
type = PlaySnd
trigger1 = time = AnimElem = 2
value = 3450, 0   ; yuujou!
channel = 0

[Statedef 345502]
type = S
movetype = I
physics = S
velset = 0, 0
anim = 3451

[State 345502, 0]
type = PlaySnd
trigger1 = time = 3
value = 3455, 0    ; Sorya nai ssu!
channel = 0

[State 345502, 0]
type = ChangeState
trigger1 = time = 90
value = 0
ctrl = 1

; Jimmy's air roll
[Statedef 347002]
type = A
movetype = A
physics = N
;velset = 3.5, -2
anim = 7520

[State 347002, 0]
type = Turn
trigger1 = !time
trigger1 = !parent,var(17)

[State 347002, 0]
type = VelSet
trigger1 = !time
x = ifelse(parent,var(17)-1,3.5,0)
y = ifelse(parent,var(17)-1,-2,0)

[State 347002, 0]
type = VarSet
trigger1 = !time
var(2) = parent, var(7)

[State 347002, 0]
type = VarSet
trigger1 = !time
var(17) = parent, var(17)

[State 347002, 0]
type = ParentVarSet
trigger1 = !time
var(7) = 0

[State 347002, 0]
type = VarSet
trigger1 = 1;!time
var(16) = parent, var(16)

[State 347002, 0]
type = Gravity
trigger1 = time > 0

[State 347002, 1]
type = VarSet
trigger1 = !time
var(3) = parent,var(1) || parent,var(3)

[State 347002, 1]
type = ChangeState
trigger1 = Pos Y > 0
value = ifelse(var(3),347502,347102)

[State 347002, 1]
type = VarSet
trigger1 = !time
var(0) = 7575   ; desired state after getting hit

[State 347002, 1]
type = HitOverride
trigger1 = 1;!time
time = 1
stateno = 7570
slot = 0
attr = SCA, AA, AT, AP

[State 347002, 2]
type = PlaySnd
trigger1 = time = 1
value = 7470, 0   ; roarr!
channel = 0

[State 347002, 3]
type = PlaySnd
trigger1 = AnimElem = 4
value = 0, 210   ; whoosh

[State 347002, 4]
type = SprPriority
trigger1 = time = 0
value = 3

[State 347002, 5]
type = HitDef
trigger1 = !time ;1
damage = 90,0
animtype = back
sparkxy = -3,-40
id = 3470
nochainid = 3470
attr = A,SA
hitflags=MA
guardflags = N
air.hittime = 14
ground.velocity = -4.2,-5
guard.dist = 50
sparkno = 3
hitsound = 5,3
pausetime = 9,9
air.velocity = -4.8,2
air.fall = 1
air.fall.recover = 0
air.hittime = 8
down.bounce = 1
down.velocity = -3

; Jimmy's banana throw
[Statedef 347102]
type = S
movetype = A
physics = S
velset = 0, 0
anim = ifelse(var(3):=(var(16)=-facing),9996,7510)
; var(3) must be preserved; until banana is thrown

[State 347102, 0]
type = VarSet
trigger1 = RoundState = 3
persistent = 0
var(15) = p2life = p2life

[State 347102, 0]
type = VarSet
trigger1 = RoundState = 3
trigger1 = (p2life = p2life)
fvar(0) = P2Dist X

[State 347102, 0]
type = PosSet
trigger1 = time = 0
y = 0

[State 347102, 0]
type = VarSet
trigger1 = time = 0
v = 1
value = 0

[State 347102, 1]
type = VarSet
trigger1 = !time
var(0) = 7579   ; desired state after getting hit

[State 347102, 1]
type = HitOverride
trigger1 = time >= 0
time = 1
stateno = 758002
forceair = 1
slot = 0
attr = SCA, AA, AT, AP

[State 347102, 1]
type = VarSet
trigger1 = anim = 9996
trigger1 = animelem = 3;6
var(8)=1

[State 347102, 1]
type = VarSet
trigger1 = anim = 9996
trigger1 = animelem = 4;10
var(8)=2

[State 347102, 1]
type = VarSet
trigger1 = anim = 9996
trigger1 = animelem = 6;12
var(8)=0

[State 347102, 1]
type = VarSet
trigger1 = anim = 9996
trigger1 = animelem = 3 || animelem = 5 ;9 || animelem = 11
var(9)=31+!(var(10):=-27)

[State 347102, 1]
type = VarSet
trigger1 = anim = 9996
trigger1 = animelem = 4;10
var(9)=34+!(var(10):=-34)

[State 347102, 0]
type = AttackDist
trigger1 = time = 0
value = 0

[State 347102, 1]
type = VarAdd
trigger1 = var(1) > 0
v = 1
value = 1

[State 347102, 1]
type = PlaySnd
trigger1 = anim = 9996
trigger1 = AnimElem = 4;10
value = 7470, 1    ; munch
channel = 0

[State 347102, 2]
type = helper
helpertype = normal
pos = 7, -68
postype = p1
trigger1 = anim = 9996
trigger1 = animelem = 6;12
keyctrl = 0
ownpal = 1
id = 3477
name = "Dan's Jimmy's banana"
stateno = 347702
size.xscale = 1
size.shadowoffset = 0
facing = -1

[State 347102, 1]
type = Turn
trigger1 = anim = 7510
trigger1 = animtime = 0

[State 347102, 1]
type = ChangeAnim
trigger1 = anim = 7510
trigger1 = animtime = 0
value = 7530

[State 347102, 1]
type = ChangeAnim
trigger1 = anim = 7530
trigger1 = animtime = 0
value = 9996

[State 347102, 2]
type = ChangeState
triggerall = matchover = 0
triggerall = win = 0
trigger1 = time = 160-var(3)*11
trigger2 = time >= 120-var(3)*11
trigger2 = var(1) >= 15
value = 347302

[State 347102, 3]
type = ParentVarSet
trigger1 = matchover = 1
v = 6
value = 1

[State 347102, 4]
type = ChangeState
trigger1 = parent, var(7) = 1
value = 348502

[State 347102, 4]
type = ChangeState
trigger1 = parent, var(7) = 2
trigger1 = time >= 120
value = 347302

; banana thrown (init state) through air
[Statedef 347702]
type = A
physics = N
movetype = A
anim = 9960

[State 347702, 0]
type = SprPriority
trigger1 = !time
value = 3

[State 347702, 0]
type = Turn
trigger1 = !time 
trigger1 = !var(3)
persistent = 0

[State 347702, 0]
type = VarSet
trigger1 = !time
var(0) = parent, var(2)

[State 347702, 0]
type = VarSet
trigger1 = !time
var(15) = parent, var(15)

[State 347702, 0]
type = VarSet
trigger1 = !time
fvar(1) = parent, fvar(0)

[State 347702, 0]
type = VarSet
trigger1 = !time
var(9)= p2life = p2life

[State 347702, 0]
type = VarSet
trigger1 = !time
fvar(0) = 160.0

[State 347702, 0]
type = VarSet
trigger1 = !time
trigger1 = var(0)=3
trigger1 = var(9)
fvar(0)= P2Dist X

[State 347702, 0]
type = VelSet
trigger1 = !time
x = ifelse(var(0)=3,ifelse(fvar(0)>=0,fvar(0)/80.0,2),2**var(0))
y = ifelse(var(0)=3,-8,-5-2*var(0))

[State 347702, 1]
type = HitOverride
trigger1 = time >= 0
time = 1
stateno = 347902
slot = 0
attr = SCA, AA, AT, AP

[State 347702, 0]
type = ChangeState
trigger1 = time!=0
value = 347402

; banana flying through air (general)
[Statedef 347402]
type = A
physics = N
movetype = A

[State 347402, 0]
type = VelAdd
trigger1 = time >= 0
y = .2

[State 347402, 1]
type = HitOverride
trigger1 = time >= 0
time = 1
stateno = 347902
slot = 0
attr = SCA, AA, AT, AP

[State 347402, 0]
type = VelMul
trigger1 = frontedgedist <= -6
;trigger1 = var(0)=2
persistent = 0
x = -.6

[State 347402, 0]
type = Turn
trigger1 = frontedgedist <= -6
;trigger1 = var(0)=2
persistent = 0

[State 347402, 0]
type = HitDef
trigger1 = time = 0
attr = S, SP
damage = 40, 4
guardflag = MA
hitflag = MAF
;sparkno = 0, 5
hitsound = 5, 1
animtype = light
ground.type = high
ground.hittime = 12
ground.velocity = -1
guard.dist = 20
priority = 6
p1getp2facing = -1   ; face opposite direction
getpower = 20

[State 347402, 1]
type = ChangeState
trigger1 = movecontact = 1
value = 347802

[State 347402, 4]
type = VelSet
trigger1 = Pos Y >= -1
y = 0

[State 347402, 5]
type = PosSet
trigger1 = Pos Y >= -1
y = 0

[State 347402, 5]
type = ChangeState
trigger1 = root, var(15) = 1
value = 349902

[State 347402, 4]
type = helper
trigger1 = Pos Y = 0
trigger1 = Vel Y = 0
helpertype = normal
pos = 0, 0
postype = p1
keyctrl = 0
ownpal = 1
id = 3477
name = "Dan's Jimmy's banana"
stateno = 347202
size.xscale = 1
size.shadowoffset = 0
facing = 1

[State 347402, 5]
type = DestroySelf
trigger1 = Pos Y = 0 && Vel Y = 0

; Banana custom hit state
[Statedef 347902]
type = A
movetype = I
physics = N
anim = 9960
facep2 = 1
velset = GetHitVar(xvel), GetHitVar(yvel)
movehitpersist = 1

[State 347902, 1]
type = ChangeState
trigger1 = movecontact
value = 347802

[State 347902, 1]
type = ChangeState
value = 3474
trigger1 = !time

; banana on ground
[Statedef 347202]
type = S
ctrl = 0
movetype = A
velset = 0, 0
anim = 9973

[State 347202, 0]
type = PosSet
trigger1 = time = 0
y = 0

[State 347202, 0]
type = HitDef
trigger1 = !time
velocity = 0
attr = S, SP
damage = 40, 4
guardflag = N
guard.dist = 0
hitflag = MF
sparkno = 1
hitsound = 5, 1
animtype = light
p1getp2facing = 1    ; face same direction
ground.type = trip
ground.velocity = n, -4
hitonce = 1
getpower = 20

[State 347202, 0]
type = ChangeState
trigger1 = movecontact = 1
value = 347602

; play banana removal anim
[Statedef 347602]
type = A
movetype = H
physics = N
anim = 9970

[State 347602, 0]
type = VelSet
trigger1 = time = 1
x = numtarget > 0
y = -3

[State 347602, 1]
type = VelAdd
trigger1 = time > 1
y = .15

[State 347602, 1]
type = DestroySelf
trigger1 = time = 30

; play banana hit anim
[Statedef 347802]
type = A
movetype = H
physics = N
anim = 9970

[State 347802, 0]
type = VelSet
trigger1 = time = 1
x = -1
y = -2

[State 347802, 1]
type = VelAdd
trigger1 = time > 1
y = .15

[State 347802, 1]
type = DestroySelf
trigger1 = time = 30

; Jimmy picks up blender (from normal blender anim)
[Statedef 346902]
type = S
movetype = I
physics = S
velset = 0,0
anim = 7558

[State 346902, 0]
type = VarSet
trigger1 = !time
var(3) = 0

[State 346902, 0]
type = ChangeState
trigger1 = !animtime
value = 347302

[State 346902, 0]
type = HitOverride
trigger1 = !time
slot = 0
time = -1
stateno = 7585
attr = SCA, AA, AT, AP

; Jimmy leaves
[Statedef 347302]
type = A
movetype = I
physics = N
velset = 0, 0
anim = ifelse(var(3),7524,7521)

[State 347302, 0]
type = NotHitBy
trigger1 = 1
value = SCA

[State 347302, 0]
type = ChangeState
trigger1 = var(17) = 1 
value = 349702

[State 347302, 0]
type = VelSet
trigger1 = AnimElem = 2, = 1
x = ifelse(var(3),-5.5,5.5)
y = -12.75

[State 347302, 1]
type = PlaySnd
trigger1 = AnimElem = 6
value = 0, 200   ; whoosh

[State 347302, 2]
type = PlaySnd
trigger1 = AnimElem = 2
value = 7470, 2  ; wahoo!
channel = 0

[State 347302, 3]
type = Gravity
trigger1 = AnimElem = 2, > 2

[State 347302, 1] 
type = DestroySelf
triggerall = AnimElem = 2, > 1
trigger1 = Pos X > 160
trigger2 = Pos Y < -240
trigger3 = Pos Y > 0

; Jimmy don't wanna play
[Statedef 347502]
type = S
movetype = I
physics = S
velset = 0, 0
anim = 7510

[State 347502, 0]
type = HitOverride
trigger1 = !time
time = -1
slot = 0
attr = SCA, AA, AT, AP
stateno = 7585

[State 347502, 0]
type = PosSet
trigger1 = time = 0
y = 0

[State 347502, 1]
type = Turn
trigger1 = anim = 7510
trigger1 = animtime = 0

[State 347502, 1]
type = ChangeAnim
trigger1 = anim = 7510
trigger1 = animtime = 0
value = 7550

[State 347502, 2]
type = ChangeState
trigger1 = time = 230
;trigger1 = win = 0
value = 3469;3473

[State 347502, 3]
type = PlaySnd
triggerall = anim = 7550
trigger1 = AnimElem = 12
trigger2 = AnimElem = 16
value = 7470,3   ; zap

[State 347502, 4]
type = ParentVarSet
trigger1 = var(1):=(win && Pos X = [-215,215])
persistent = 0
v = 6
value = 6

[State 347502, 0]
type = Turn
trigger1 = var(1)
persistent = 0

[State 347502, 0]
type = helper
trigger1 = var(1)
persistent = 0
;trigger1 = !numhelper(7640)
pos = ifelse((Pos X!=[-160,159]),floor((153-abs(Pos X))*ifelse(anim=7510,-1,1)*facing*Pos X/abs(Pos X)),0),0
postype = p1
stateno = 7698
ownpal = 0
id = 7640
helpertype = player
name = "Dan's Jimmy's cameraman"
size.ground.back=0
size.ground.front=0
keyctrl = 0

[State 347502, 0]
type = Turn
trigger1 = var(1)
persistent = 0

[State 347502, 5]
type = ChangeState
trigger1 = win = 1
trigger1 = anim = 7550
trigger1 = AnimElemNo(0) > 20
trigger1 = Pos X = [-200,200]
value = 7640

; Win pose with Jimmy
[Statedef 348002]
type = S
physics = N
anim = 3480  

[State 348002, 0]
type = VarSet
trigger1 = time = 0
v = 7
value = 1  ; notify helper

[State 348002, 0]
type = VelSet
trigger1 = time >= 3
x = 4.4

; Hack to keep a bit ahead of Jimmy
[State 348002, 0]
type = VelSet
trigger1 = helper(3450),facing=facing
trigger1 = helper(3450),RootDist X = [40,75]
x = 4.8

[State 348002, 1]
type = Turn
trigger1 = frontedgedist <= 25

[State 348002, 2]
type = PlaySnd
trigger1 = time = 15
value = 3480, 0   ; Yahoo! Ore tte saikyou!
channel = 0

[State 348002, 2]
type = PlaySnd
trigger1 = time = 175
value = 198, 8    ; Oyaji! 
channel = 0

[State 348002, 3]
type = NotHitBy
trigger1 = time >= 0
value = SCA

[State 348002, 4]
type = PlayerPush
trigger1 = time >= 0
value = 0

[State 348002, 4]
type = ScreenBound
trigger1 = time >= 0
value = 1
movecamera = 0,0

[State 348002, 4]
type = AssertSpecial
trigger1 = time = [0, 280]
flag = roundnotover

; Jimmy's win pose with Dan
[Statedef 348502]
type = S
physics = N
anim = 7522  

[State 348502, 0]
type = VelSet
trigger1 = time >= 3
x = 4.4

[State 348502, 1]
type = Turn
trigger1 = frontedgedist <= 25
trigger1 = backedgedist < 320
trigger1 = RootDist X != [-40,40]
trigger2 = backedgedist >= 320

[State 348502, 2]
type = PlaySnd
trigger1 = time = 20
value = 7470, 4   ; cackle
channel = 0

[State 348502, 2]
type = PlaySnd
trigger1 = time = 105
value = 7470, 5   ; rowww!
channel = 0

[State 348502, 3]
type = NotHitBy
trigger1 = time >= 0
value = SCA

[State 348502, 4]
type = PlayerPush
trigger1 = time >= 0
value = 0

; taunt
[Statedef 349102]
type = S
movetype = I
physics = S
ctrl = 0

[State 349102, 0]
type = VarSet
trigger1 = 1
var(15)=1

; bail if something's wrong.
[State 349102, 0]
type = ChangeState
triggerall = !time
trigger1 = !numhelper(3477)
trigger2 = time =1 && helper(3477),stateno!=349902
value = 0
ctrl = 1

[State 349102, 0]
type = VarAdd
trigger1 = time = 1
var(59) = 1

[State 349102, 0]
type = ChangeAnim
trigger1 = time = 10
trigger1 = (anim = [800,801]) || anim = 195 || anim = 0 || anim = 2102
trigger2 = anim=12 && !animtime
value = 3490 + 0*(var(1):=time)

[State 349102, 1]
type = ChangeAnim
triggerall = time = 6
trigger1 = anim = 11
trigger2 = anim = 802
value = 12

[State 349102, 1]
type = PlaySnd
triggerall = anim = 3490
trigger1 = time = var(1)+3
value = 3491, 0    ; me ga nai ssu!
channel = 0

[State 349102, 2]
type = ChangeState
triggerall = anim = 3490
trigger1 = time = var(1)+75
value = 0
ctrl = 1

[Statedef 349202]
type = S
movetype = I
physics = S

[State 349202, 0]
type = ChangeState
trigger1 = time = 30
value = 0
ctrl = 1

; Banana knocked off Dan's head
[Statedef 349302]
type = A
movetype = H
physics = N
velset = -2, -4
anim = 9970

[State 349302, 0]
type = VelAdd
trigger1 = time > 0
y = .2

[State 349302, 1]
type = DestroySelf
trigger1 = time = 30

; Banana falling naturally off Dan's head
[Statedef 349402]
type = A
movetype = H
physics = N
velset = -1.6, 0
anim = 9970

[State 349402, 0]
type = VelAdd
trigger1 = time > 0
y = .1

[State 349402, 1]
type = DestroySelf
trigger1 = time = 30

; Jimmy leaves -- straight up
[Statedef 349702]
type = A
movetype = I
physics = N
velset = 0, 0
anim = 7521

[State 349702, 0]
type = VelSet
trigger1 = AnimElem = 2, = 1
y = -12.75

[State 349702, 1]
type = PlaySnd
trigger1 = AnimElem = 6
value = 0, 200   ; whoosh

[State 349702, 2]
type = PlaySnd
trigger1 = AnimElem = 2
value = 7470, 2  ; wahoo!
channel = 0

[State 349702, 3]
type = Gravity
trigger1 = AnimElem = 2, > 2

[State 349702, 1] 
type = DestroySelf
triggerall = AnimElem = 2, > 1
trigger1 = Pos Y < -240

[State 349702, 0]
type = NotHitBy
trigger1 = 1
value = SCA

; Banana landing on Dan's head
[Statedef 349902]
type = A
movetype = H
physics = N
anim = 9973
velset = 0, 0

[State 349902, 0]
type = SprPriority
trigger1 = time = 0
value = 3

; note: for desired x offset x_0, use x_0-1+root,facing due to bug (?)

[State 349902, 0]
type = VarSet
trigger1 = !time
var(32)=-1

[State 349902, 0]
type = VarSet
trigger1 = root,anim=0
trigger1 = root,stateno!=var(32)
var(0)=!((var(1):=var(3):=-94)+(var(2):=-92)+(var(4):=var(6):=-99+root,facing)+(var(5):=-101+root,facing))

[State 349902, 0]
type = VarRangeSet
trigger1 = root,anim=0
trigger1 = root,stateno!=var(32)
first = 8
last = 13
value = 4

[State 349902, 1]
type = VarSet
trigger1 = root,anim=195
trigger1 = root,anim!=var(32)
var(0)=(var(1):=-94)+(var(2):=-91)+(var(3):=var(4):=-92)

[State 349902, 1]
type = VarSet
trigger1 = root,anim=195
trigger1 = root,anim!=var(32)
var(0)=!((var(8):=5+root,facing)+(var(9):=13+root,facing)+(var(10):=var(11):=22+root,facing))

[State 349902, 2]
type = VarSet
trigger1 = root,anim=11
trigger1 = root,anim!=var(32)
var(0)=0*((var(1):=-65)+(var(8):=3+root,facing))

[State 349902, 3]
type = VarSet
trigger1 = root,anim=12
trigger1 = root,anim!=var(32)
var(0)=0*((var(8):=var(9):=2+root,facing)+(var(1):=-72)+(var(2):=-89))

[State 349902, 3]
type = VarSet
trigger1 = root,anim=47 || root,anim = 40
trigger1 = root,anim!=var(32)
var(0)=0*((var(8):=2+root,facing)+(var(1):=-89))

[State 349902, 5]
type = VarSet
trigger1 = (root,anim = 2102) || (root,anim=[800,801])
trigger1 = root,anim!=var(32)
var(0)=(var(1):=-72)+(var(2):=-89)+(var(3):=-94)+(var(4):=-91)+(var(5):=var(6):=-92)

[State 349902,5]
type = VarSet
trigger1 = (root,anim=[800,801]) || (root,anim = 2102)
trigger1 = root,anim!=var(32)
var(0)=13+!((var(8):=var(9):=2+root,facing)+(var(10):=5+root,facing)+(var(11):=13+root,facing)+(var(12):=var(13):=22+root,facing))

[State 349902, 5]
type = VarSet
trigger1 = root,anim = 2102
var(0) = 0

[State 349902, 4]
type = VarSet
trigger1 = root,anim=3490
trigger1 = root,anim!=var(32)
var(0)=0*((var(8):=4+root,facing)+(var(9):=var(10):=6+root,facing)+(var(1):=-91)+(var(2):=var(3):=-93))

[State 349902, 5]
type = VarSet
trigger1 = root,anim=802
trigger1 = root,anim!=var(32)
var(0)=(var(1):=var(2):=-65)+(var(3):=var(4):=-67)

[State 349902, 5]
type = VarSet
trigger1 = root,anim=802
trigger1 = root,anim!=var(32)
var(0)=0*((var(8):=5+root,facing)+(var(9):=8+root,facing)+(var(10):=var(11):=17+root,facing))

[State 349902, 6]
type = VarSet
trigger1 = root,anim=100
trigger1 = root,anim!=var(32)
var(0)=(var(1):=var(2):=var(5):=var(6):=-94)+(var(3):=-84)+(var(4):=-85)+(var(7):=-89)

[State 349902, 6.5]
type = VarSet
trigger1 = root,anim=100
trigger1 = root,anim!=var(32)
var(0)=!((var(8):=var(9):=var(12):=7+root,facing)+(var(10):=20+root,facing)+(var(11):=17+root,facing)+(var(13):=5+root,facing)+(var(14):=1+root,facing))

[State 349902, 7]
type = VarSet
trigger1 = root,anim=810
trigger1 = root,anim!=var(32)
var(0)=2+!((var(1):=-94)+(var(2):=var(3):=-91)+(var(8):=5+root,facing)+(var(9):=var(10):=34+root,facing))

[State 349902, 8]
type = VarSet
trigger1 = root,anim = 803
trigger1 = root,anim!=var(32)
var(0)=0*((var(1):=-95)+(var(2):=var(3):=-102)+(var(8):=9)+(var(9):=var(10):=-13))

[State 349902, 9]
type = VarSet
trigger1 = root,anim = [41,43]
trigger1 = root,anim != var(32)
var(0)=0*((var(1):=-106)+(var(2):=-104)+(var(3):=-103)+(var(8):=-2)+(var(9):=2)+(var(10):=4))

[State 349902, 9]
type = VarSet
trigger1 = root,anim = [44,46]
trigger1 = root,anim != var(32)
var(0)=0*((var(1):=var(3):=var(4):=var(5):=-103)+(var(2):=-100)+(var(8):=4)+(var(9):=5)+(var(10):=-4)+(var(11):=var(12):=-1))

[State 349902, 10]
type = VarSet
trigger1 = 1
var(32) = root,anim
 
[State 349902, 0]
type = BindToRoot
trigger1 = root,var(15)
time = 1
pos = var(7+root,animelemno(0)-var(0)),var(root,animelemno(0)-var(0))
facing = 1

[State 349902, 2]
type = ChangeState
trigger1 = root, movetype = H
value = 349302

[State 349902, 3]
type = ChangeState
trigger1 = !root, var(15)
value = 349402

[Statedef 758002]
type = A
movetype = H
physics = N
velset = root,facing*GetHitVar(xvel)*((P2Dist X < 0)*-2+1),ifelse(GetHitVar(yvel)>-6,-6,GetHitVar(yvel))
;velset = GetHitVar(xvel),GetHitVar(yvel)

[State 758002, 0]
type = Explod
trigger1 = !time && var(8)
pos = var(9),var(10)
anim = ifelse(var(8)=1,9971,9970)
removetime = 45;51
postype = p1
bindtime = 1
vel = 0,-4
accel = 0,0.2
scale = 1
ownpal = 1
sprpriority = 4

[State 758002, 0]
type = VarSet
trigger1 = !time
var(5)=(Vel X <= 0)  

[State 758002, 0]
type = ChangeAnim
trigger1 = !time
value = ifelse(Vel X <=0, 7580, 7582)

[State 758002, 0]
type = Gravity
trigger1 = 1

[State 758002, 1]
type = ChangeState
trigger1 = Pos Y > 0
value = var(0)

[State 758002, 1]
type = HitOverride
trigger1 = 1
time = 1
stateno = 758002
slot = 0
forceair = 1
attr = SCA, AA, AT, AP

;----------------------------------------------------
[Statedef 9990]
type = S

[State 9990, 0]
type = VarAdd
trigger1 = time = 0
v = 29
value = 1

[State 9990, 1random]
type = VarRandom
trigger1 = Time = 0
v = 29
range = 0,1

[State 9990, 2]
type = ChangeState
trigger1 = time = 0
trigger1 = var(29) = 0
value = 9997

[State 9990, 3]
type = ChangeState
trigger1 = time = 0
trigger1 = var(29) = 1
value = 9995

;---------------------------------------------------------------------------
; Shin Gale Kick

[Statedef 931100]
type    = A
movetype= A
physics = N
juggle  = 4
velset = 0,0
anim = 31100
ctrl = 0
sprpriority = 2
poweradd = -1000

[State 931100, 0]
type = Explod
trigger1 = AnimElem = 1
anim = 7004
supermove = 1
removetime = 48
pos = 160, 230
postype = left
bindtime = -1
ontop = 1

[State 931100, 0]
type = SuperPause
trigger1 = AnimElem = 1
time = 48
pos = 12, -47
anim = 102

[State 931100, 0]
type = AfterImage
trigger1 = AnimElem = 2, 1
time = 3

[State 931100, 0]
type = AfterImageTime
trigger1 = AnimElemTime(2) >= 1 && Time < 60
time = 3

[State 931100, 0]
type = NotHitBy
trigger1 = AnimElem = 2
value = , NA, SA, AT
time = 12

[State 931100, 0]
type = NotHitBy
trigger1 = AnimElemTime(2) >= 0 && Time < 30
value2 = C, NA
time = 1

[State 931100, 1]
type = PlaySnd
trigger1 = AnimElem = 1
value = F20, 0
;value = 0, 3200    ; super charge

[State 931100, 5]
type = PlaySnd
trigger1 = AnimElem = 1
value = 195, 3
channel = 0

[State 1007, L]
type = velset
trigger1 = time = 0
x = 4
y = -1.5

[State 1007, L]
type = veladd
trigger1 = time > 0
trigger1 = time <= 6
y = -.1

[State 1007, L]
type = veladd
trigger1 = time > 6
trigger1 = time <= 90
y = .05

[State 1007, L]
type = veladd
trigger1 = time > 96
y = .2

[State 1007, da] ; "Da da"
type = playsnd
trigger1 = animelem = 2
trigger2 = animelem = 6
trigger3 = animelem = 9
trigger4 = animelem = 13
trigger5 = animelem = 16
trigger6 = animelem = 20
value = 200,0

[State 1007, woosh]
type = playsnd
trigger1 = animelem = 2
trigger2 = animelem = 6
trigger3 = animelem = 9
trigger4 = animelem = 13
trigger5 = animelem = 16
trigger6 = animelem = 20
trigger7 = animelem = 23
value = 0,0
channel = 2

[State 1007, siya]
type = playsnd
trigger1 = animelem = 23
value = 200,1

[State 1007, 0]
type = HitDef
trigger1 = animelem = 2
trigger2 = animelem = 6
trigger3 = animelem = 9
trigger4 = animelem = 13
trigger5 = animelem = 16
trigger6 = animelem = 20
affectteam = e
attr = A, HA
animtype  = Hard
damage    = 40, 5
priority  = 5
guardflag = MA
pausetime = 3,3
sparkxy = -10,-70
hitsound = S10, 5
guardsound = S40,2
ground.type = Low
ground.slidetime = 18
ground.hittime  = 18
ground.velocity = -3.5
guard.velocity = -7
air.velocity = -3.5, -2.5
fall = 1

[State 1007, 0]
type = TargetBind
trigger1 = MoveHit = 1 
persistent = 0
pos = 35, -35

[State 1007, 1]
type = HitDef
trigger1 = animelem = 23
attr = A, HA
animtype  = Hard
damage    = 70, 7
priority  = 5
guardflag = MA
pausetime = 12,12
sparkxy = -10,-70
hitsound = S10, 5
guardsound = S40,2
ground.type = Low
ground.slidetime = 18
ground.hittime  = 18
ground.velocity = -5, -2
guard.velocity = -7
air.velocity = -5.5, -2
fall = 1

[State 1051, 2] 
type = ChangeState
trigger1 = time > 90
;value = 52
value = 31100

;------------------------
;---------------------------------------------------------------------------
; Shin Gale Kick

[Statedef 831100]
type    = A
movetype= A
physics = N
juggle  = 4
velset = 0,0
anim = 31100
ctrl = 0
sprpriority = 2
poweradd = -1000

[State 831100, 0]
type = Explod
trigger1 = AnimElem = 1
anim = 7004
supermove = 1
removetime = 48
pos = 160, 230
postype = left
bindtime = -1
ontop = 1

[State 831100, 0]
type = SuperPause
trigger1 = AnimElem = 1
time = 48
pos = 12, -47
anim = 102

[State 831100, 0]
type = AfterImage
trigger1 = AnimElem = 2, 1
time = 3

[State 831100, 0]
type = AfterImageTime
trigger1 = AnimElemTime(2) >= 1 && Time < 60
time = 3

[State 831100, 0]
type = NotHitBy
trigger1 = AnimElem = 2
value = , NA, SA, AT
time = 12

[State 831100, 0]
type = NotHitBy
trigger1 = AnimElemTime(2) >= 0 && Time < 30
value2 = C, NA
time = 1

[State 831100, 1]
type = PlaySnd
trigger1 = AnimElem = 1
value = F20, 0
;value = 0, 3200    ; super charge

[State 831100, 5]
type = PlaySnd
trigger1 = AnimElem = 1
value = 197, 14
channel = 0

[State 1007, L]
type = velset
trigger1 = time = 0
x = 4
y = -1.5

[State 1007, L]
type = veladd
trigger1 = time > 0
trigger1 = time <= 6
y = -.1

[State 1007, L]
type = veladd
trigger1 = time > 6
trigger1 = time <= 90
y = .05

[State 1007, L]
type = veladd
trigger1 = time > 96
y = .2

[State 1007, da] ; "Da da"
type = playsnd
trigger1 = animelem = 2
trigger2 = animelem = 6
trigger3 = animelem = 9
trigger4 = animelem = 13
trigger5 = animelem = 16
trigger6 = animelem = 20
value = 200,0

[State 1007, woosh]
type = playsnd
trigger1 = animelem = 2
trigger2 = animelem = 6
trigger3 = animelem = 9
trigger4 = animelem = 13
trigger5 = animelem = 16
trigger6 = animelem = 20
trigger7 = animelem = 23
value = 0,0
channel = 2

[State 1007, siya]
type = playsnd
trigger1 = animelem = 23
value = 200,1

[State 1007, 0]
type = HitDef
trigger1 = animelem = 2
trigger2 = animelem = 6
trigger3 = animelem = 9
trigger4 = animelem = 13
trigger5 = animelem = 16
trigger6 = animelem = 20
affectteam = e
attr = A, HA
animtype  = Hard
damage    = 40, 5
priority  = 5
guardflag = MA
pausetime = 1,1
sparkxy = -10,-70
hitsound = S10, 5
guardsound = S40,2
ground.type = Low
ground.slidetime = 18
ground.hittime  = 18
ground.velocity = -3.5
guard.velocity = -7
air.velocity = -3.5, -2.5
fall = 1

[State 1007, 0]
type = TargetBind
trigger1 = MoveHit = 1 
persistent = 0
pos = 35, -35

[State 1007, 1]
type = HitDef
trigger1 = animelem = 23
attr = A, HA
animtype  = Hard
damage    = 70, 7
priority  = 5
guardflag = MA
pausetime = 12,12
sparkxy = -10,-70
hitsound = S10, 5
guardsound = S40,2
ground.type = Low
ground.slidetime = 18
ground.hittime  = 18
ground.velocity = -5, -2
guard.velocity = -7
air.velocity = -5.5, -2
fall = 1

[State 1051, 2] 
type = ChangeState
;trigger1 = pos y > -5
trigger1 = time > 90
;value = 52
value = 931100

;----------------------------------------------------
;----------------------------------------------------
;----------------------------------------------------
;----------------------------------------------------
[Statedef 93450]
type = S
movetype = A
physics = S
velset = 0, 0
juggle = 0
ctrl = 0
poweradd = 40
anim = 3450


[State 93450, 0]
type = helper
trigger1 = AnimElem = 4
pos = -120, -200
postype = back
helpertype = normal
id = 3450
stateno = 93470
keyctrl = 0
name = "Dan's Jimmy"
ownpal = 1

[State 93450, 1]
type = ChangeState
trigger1 = time > 80
trigger1 = var(1) = 0
trigger1 = var(3) = 0
value = 0
ctrl = 1

[State 93450, 2]
type = PlaySnd
trigger1 = time = AnimElem = 2
value = 3450, 0   ; yuujou!
channel = 0

[State 93450, 3] 
type = ChangeState
trigger1 = time > 80
value = 0
ctrl = 1

[Statedef 93470]
type = A
movetype = A
physics = N
;velset = 3.5, -2
anim = 7520

;[State 93470, 0]
;type = Turn
;trigger1 = !time
;trigger1 = !parent,var(17)

[State 93470, 0]
type = VelSet
trigger1 = !time
x = ifelse(parent,var(17)-1,3.5,0)
y = ifelse(parent,var(17)-1,-2,0)

[State 93470, 0]
type = VarSet
trigger1 = !time
var(2) = parent, var(7)

[State 93470, 0]
type = VarSet
trigger1 = !time
var(17) = parent, var(17)

[State 93470, 0]
type = ParentVarSet
trigger1 = !time
var(7) = 0

[State 93470, 0]
type = VarSet
trigger1 = 1;!time
var(16) = parent, var(16)

[State 93470, 0]
type = Gravity
trigger1 = time > 0

[State 93470, 1]
type = VarSet
trigger1 = !time
var(3) = parent,var(1) || parent,var(3)

[State 93470, 1]
type = ChangeState
trigger1 = Pos Y > 0
value = 93471

[State 93470, 1]
type = VarSet
trigger1 = !time
var(0) = 7575   ; desired state after getting hit

[State 93470, 1]
type = HitOverride
trigger1 = 1;!time
time = 1
stateno = 7570
slot = 0
attr = SCA, AA, AT, AP

[State 93470, 2]
type = PlaySnd
trigger1 = time = 1
value = 7470, 0   ; roarr!
channel = 0

[State 93470, 3]
type = PlaySnd
trigger1 = AnimElem = 4
value = 0, 210   ; whoosh

[State 93470, 4]
type = SprPriority
trigger1 = time = 0
value = 3

[State 93470, 5]
type = HitDef
trigger1 = !time ;1
damage = 90,0
animtype = back
sparkxy = -3,-40
id = 3470
nochainid = 3470
attr = A,SA
hitflags=MA
guardflags = N
air.hittime = 14
ground.velocity = -4.2,-5
guard.dist = 50
sparkno = 3
hitsound = 5,3
pausetime = 9,9
air.velocity = -4.8,2
air.fall = 1
air.fall.recover = 0
air.hittime = 8
down.bounce = 1
down.velocity = -3

[Statedef 93471]
type = S
movetype = A
physics = S
velset = 0, 0
anim = 7576
poweradd = -1000

[State 93471, 0]
type = PosSet
trigger1 = time = 0
y = 0

[State 93471, 0]
type = VarSet
trigger1 = time = 0
v = 1
value = 0

[State 93471, 1]
type = VarSet
trigger1 = !time
var(0) = 7579   ; desired state after getting hit

[State 93471, 1]
type = HitOverride
trigger1 = time >= 0
time = 1
stateno = 7580
forceair = 1
slot = 0
attr = SCA, AA, AT, AP

;[State 93471, 0]
type = Explod
trigger1 = AnimElem = 2
anim = 7004
supermove = 1
removetime = 48
pos = 60, 230
postype = left
bindtime = -1
ontop = 1

[State 93471, 0]
type = SuperPause
trigger1 = AnimElem = 2
time = 48
pos = 12, -47
anim = 102

[State 93471, 1]
type = PlaySnd
trigger1 = AnimElem = 2
value = F20, 0
;value = 0, 3200
persistent = 0

[State 93471, 2]
type = PlaySnd
trigger1 = AnimElem = 3
trigger2 = AnimElem = 5
value = 7470, 3
persistent = 1

[State 3000,2]
type = Pause
trigger1 = AnimElem = 1
time = 100
movetime = 100

[State 93471, 1]
type = ChangeState
trigger1 = time = 100
value = 93479

[Statedef 93479]
type = A
movetype = A
physics = N
velset = 10, 0
anim = 7576

[State 93479, 0]
type = AfterImage
trigger1 = AnimElem = 1
time = 30

[State 93479, 0]
type = AfterImageTime
trigger1 = AnimElemTime(2) >= 1 && Time < 60
time = 30

[State 93479, 1]
type = PlaySnd
trigger1 = AnimElem = 6
value = 0, 200   ; whoosh

[State 93479, 2]
type = PlaySnd
trigger1 = AnimElem = 2
value = 7470, 2  ; wahoo!
channel = 0

[State 93479, 0]
type = PosSet
trigger1 = !time
y = -10

[State 93479, 1]
type = VarSet
trigger1 = !time
var(0) = 7579   ; desired state after getting hit

[State 93479, 1]
type = VarSet
trigger1 = !time
var(5) = 1

[State 93479, 1]
type = HitOverride
trigger1 = 1
time = 1
stateno = 7570
slot = 0
attr = SCA, AA, AT, AP

[State 93479, 1]
type = DestroySelf
trigger1 = time = 100 || backedgedist > 320

[State 93479, 2]
type = HitDef
trigger1 = AnimElem = 2
persistent = 0
attr = A, SA
damage   = 200
animtype = Hard
;guardflag = MA
pausetime = 3,6
sparkxy = -40,-80
sparkno = 11
hitsound   = 5,3
guardsound = 6,0
affectteam = B
ground.type = High
ground.slidetime = 30
ground.hittime  = 30
ground.velocity = -12;-1.4, -7
air.animtype = Back
air.velocity = -7,-4;-1.4,-7
airguard.velocity = -4, -3.3
priority = 5
p2stateno = 9797
;fall = 1

[State 93479, 3]
type = PlaySnd
trigger1 = AnimElem = 4
value = 0, 210   ; whoosh

[State 93479, 4]
type = ChangeState
trigger1 = movecontact
value = 97577

; Hit with rolling attack
[Statedef 97577]
type = A
physics = N
movetype = I
velset = -2.1,-8.5

[State 97577, 0]
type = Gravity
trigger1 = 1

[State 97577, 1]
type = ChangeState
trigger1 = Pos Y > 0
value = 7578

[State 97577, 2]
type = PlaySnd
trigger1 = AnimElem = 4
value = 0, 210   ; whoosh

[State 97577, 3]
type = VelMul
trigger1 = Vel Y > -1
x = .99

[Statedef 9797]
type = A
movetype = A
physics = N
velset = 0, 0
anim = 5030

[State 9797, 1]
type = LifeAdd
trigger1 = !time
value = -230

[State 9797, 0]
type = AfterImage
trigger1 = AnimElem = 1
time = 3

[State 9797, 0]
type = AfterImageTime
trigger1 = AnimElemTime(1) >= 1 && Time < 60
time = 3

[State 9797, 2]
type = PlaySnd
trigger1 = time = 0
value = 5070, 0
channel = 2

[State 1007, L]
type = velset
trigger1 = time = 0
x = 10
y = -1.5

[State 1007, L]
type = veladd
trigger1 = time > 0
trigger1 = time <= 6
y = -.5

[State 1007, L]
type = veladd
trigger1 = time > 6
trigger1 = time <= 90
y = .305

[State 1007, L]
type = veladd
trigger1 = time > 96
y = .2

[State 9797, 2]
type = HitDef
trigger1 = time >= 0
persistent = 0
attr = A, SA
damage   = 325
animtype = Hard
;guardflag = MA
pausetime = 3,6
sparkxy = -40,-80
sparkno = 11
hitsound   = 0, 450
guardsound = 6,0
;affectteam = B
ground.type = High
ground.slidetime = 30
ground.hittime  = 30
ground.velocity = -12;-1.4, -7
air.animtype = Back
air.velocity = -7,-4;-1.4,-7
airguard.velocity = -4, -3.3
priority = 5
fall = 1
fall.recover = 0
air.fall = 1
air.fall.recover = 0

[State 9797, 2]
type = PlaySnd
trigger1 = movecontact = 1
;trigger1 = pos y > -5
;trigger1 = time > 10
value = 0, 450
persistent = 0

[State 1051, 3]
type = LifeAdd
trigger1 = pos y > -10
trigger1 = time > 10
value = -20

[State 1051, 3] 
type = SelfState
trigger1 = pos y > -5
trigger1 = time > 10
value = 5110

;=======================================================================
;                     ||  Super Salto ||
;=======================================================================
;------------------------------------------------------------------------------
; Super Jump

[Statedef 999]
type    = A
physics = A
ctrl = 1
anim = 41
velset = 0, -13

[State 999, 2]
type = ChangeAnim
trigger1 = Time = 0
value = ifelse((vel x)=0, 41, ifelse((vel x)>0, 42, 43))
[State 999, 3]
type = ChangeAnim
trigger1 = Vel y > -2
trigger1 = SelfAnimExist(anim + 3)
persistent = 0
value = Anim + 3

[State 999, 1]
type = PlaySnd
trigger1 = AnimElem = 1
value = 1000,1
persistent = 0
[State 999, 1a]
type = VelAdd
triggerall = Vel X >= -2
trigger1 = Command = "holdback"
trigger1 = Anim != 043
x = -0.1
[State 999, 1b]
type = VelAdd
triggerall = Vel X <= 2.5
trigger1 = Command = "holdfwd"
trigger1 = Anim != 042
x = 0.25
[State 999, 2a]
type = VelSet
trigger1 = Anim = 042
trigger1 = Time = [0,5]
x = 4
[State 1531, 5]
type = Explod
trigger1 = Time >= 0
trigger1 = TimeMod = 2, 1
trigger1 = Time <= 20
Anim = 7061
pos = 0, 0
random = 100,100
ontop = 1
accel = 0,-0.5
[State 1531, 5]
type = Explod
trigger1 = Time >= 0
trigger1 = TimeMod = 2, 1
trigger1 = Time <= 20
Anim = 7061
pos = 0, 0
random = 100,100
ontop = 1
accel = 0,-0.5
[State 999, Explod]
type = Explod
trigger1 = Time = 0
anim = 7062
id = 7062
postype = P1
pos = 0,20
sprpriority = 2
ownpal = 1 
[State 999, 2b]
type = VelSet
trigger1 = Anim = 043
trigger1 = Time = [0,5]
x = -3.5
[State 999, ChangeAnim]
type = ChangeAnim
trigger1 = Vel X > 0
trigger1 = Time = [0,5]
trigger2 = var(3) = 1 && Time = [0,5]
value = 042
[State 998, ChangeAnim2]
type = ChangeAnim
trigger1 = Vel X < 0
trigger1 = Time = [0,5]
value = 043

;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------

; Saikyou Zenten Hissatsu Waza
[Statedef 72100]
type = A
physics = N
movetype = I
anim = 2100
velset = 2.9,-5
poweradd = 60
juggle = 4
ctrl = 0

[State 72100, 0]
type = AfterImage
trigger1 = AnimElem = 2
time = 3

[State 72100, 0]
type = AfterImageTime
trigger1 = AnimElemTime(2) >= 1 && Time < 40
time = 3

[State 72100, 0]
type = PlaySnd
trigger1 = AnimElem = 2
persistent = 0
value = 2100, 0    ; araa!
channel = 0

[State 72100, 0]
type = Explod
trigger1 = AnimElem = 2
anim = 7004
supermove = 1
removetime = 48
pos = 160, 230
postype = left
bindtime = -1
ontop = 1

[State 72100, 0]
type = SuperPause
trigger1 = AnimElem = 2
time = 48
pos = 12, -47
anim = 102
poweradd = -3000

[State 72100, 0]
type = PlaySnd
trigger1 = AnimElem = 2
value = F20, 0
;value = 0, 3200    ; super charge

[State 72100, 1]
type = ChangeState
trigger1 = Pos Y > 0
value = 72101

[State 72100, 2]
type = Gravity
trigger1 = time > 0

[State 72100, 0]
type = VarAdd
trigger1 = time = 0
v = 4
value = 1

[Statedef 72101]
type = C
physics = N
movetype = A
anim = 72100
velset = 0, 0

[State 72100, 0]
type = AfterImage
trigger1 = AnimElem = 1
time = 3

[State 72100, 0]
type = AfterImageTime
trigger1 = AnimElemTime(1) >= 1
time = 3

[State 72101, 0]
type = PlaySnd
trigger1 = time = 0
value = 0,52

[State 72101, 0]
type = VarSet
trigger1 = time = 0
v = 3
value = 0

[State 72101, 0]
type = PosSet
trigger1 = time = 0
y = 0

[State 72101, 1]
type = VelSet
trigger1 = AnimElem = 2
persistent = 0
x = 4

[State 72101, 2]
type = HitDef
trigger1 = AnimElem = 2
persistent = 0
ID = 2101
attr = C, SA
hitflag = MAF
guardflag = L
damage   = 50 
animtype = Back
guardflag = MA
pausetime = 5,5
sparkxy =  0,-27
hitsound   = 5,2
guardsound = 6,0
ground.type = High
ground.slidetime = 13
ground.hittime  = 17
p2facing = 1
p2stateno = 2110
down.bounce = 1
down.velocity = -3

[State 72101, 0]
type = VarAdd
trigger1 = time = 0
v = 39
value = 1

[State 72101, 1random]
type = VarRandom
trigger1 = Time = 0
v = 39
range = 0,5

[State 72101, 2]
type = PlaySnd
trigger1 = MoveHit = 1
trigger1 = var(39) = 0
persistent = 0
value = 198,3

[State 72101, 2]
type = PlaySnd
trigger1 = MoveHit = 1
trigger1 = var(39) = 1
persistent = 0
value = 197,3

[State 72101, 2]
type = PlaySnd
trigger1 = MoveHit = 1
trigger1 = var(39) = 2
persistent = 0
value = 196,14

[State 72101, 2]
type = PlaySnd
trigger1 = MoveHit = 1
trigger1 = var(39) = 3
persistent = 0
value = 196,3

[State 72101, 2]
type = PlaySnd
trigger1 = MoveHit = 1
trigger1 = var(39) = 4
persistent = 0
value = 195,3

[State 72101, 2]
type = PlaySnd
trigger1 = MoveHit = 1
trigger1 = var(39) = 5
persistent = 0
value = 197,14

[State 72101, 4]
type = VarSet
trigger1 = movehit = 1
persistent = 0
v = 3
value = 1

[State 72101, 5]
type = PlayerPush
trigger1 = time > 0
value = 0

; give player some control over velocity
[State 72101, 6]
type = ChangeState
trigger1 = AnimElem = 2, > 0
trigger1 = command = "holdback"
;trigger1 = Vel X < 6.58
value = 6667

[State 72101, 6]
type = VelSet
trigger1 = Vel X < 6
x = 9

;[State 72101, 6]
;type = VelSet
;trigger1 = Vel X < 2
;x = 2

; hit on the bounce
[State 72101, 2]
type = HitDef
ID = 2103   ; can't be chained again
trigger1 = var(3) = 1
trigger1 = time%2  ;hakkkkkkkkk
ID = 2101
attr = C, SA
hitflag = MAF
guardflag = L
damage   = 50 
animtype = Back
guardflag = MA
pausetime = 5,5
sparkxy =  0,-27
hitsound   = 5,2
guardsound = 6,0
ground.type = High
ground.slidetime = 13
ground.hittime  = 17
p2facing = 1
p2stateno = 2110
down.bounce = 1
down.velocity = -3

; hit a second person
[State 72101, 3]
type = HitDef
ID = 2102
trigger1 = var(3) = 1
trigger1 = !(time%2)
ID = 2101
attr = C, SA
hitflag = MAF
guardflag = L
damage   = 50 
animtype = Back
guardflag = MA
pausetime = 5,5
sparkxy =  0,-27
hitsound   = 5,2
guardsound = 6,0
ground.type = High
ground.slidetime = 13
ground.hittime  = 17
p2facing = 1
p2stateno = 2110
down.bounce = 1
down.velocity = -3

[State 72101, 4]
type = ChangeState
trigger1 = frontedgedist = 0
value = 6667

[State 72101, 4]
type = ChangeState
trigger1 = win
value = 2102

[State 7201, 3]
type = ChangeState
trigger1 = moveguarded = 1
value = 72105

; Saikyou Zenten Hissatsu Waza (get up and taunt)
[Statedef 72102]
type = S
movetype = A
physics = S
velset = 0,0
anim = 2102
facep2 = 1

[State 72102, 0]
type = VarSet
trigger1 = !time
var(3) = 0

[State 72102, 0]
type = PlaySnd
trigger1 = AnimElem = 3
value = 197, 13   ; Saikyou! ; 2100,2     ; Oh yeah!
channel = 0

[State 72102, 1]
type = Turn
trigger1 = AnimElem = 2, < 0
trigger1 = P2Dist X < 0

[State 72102, 1]
type = ChangeState
trigger1 = time = 80
value = var(3)
ctrl = !var(3)

; hit first person on the bounce
[State 72102, 2]
type = HitDef
ID = 2103   ; can't be chained again
trigger1 = time%2  ;hakkkkkkkkk
ID = 2101
attr = C, SA
hitflag = MAF
guardflag = L
damage   = 50 
animtype = Back
guardflag = MA
pausetime = 5,5
sparkxy =  0,-27
hitsound   = 5,2
guardsound = 6,0
ground.type = High
ground.slidetime = 13
ground.hittime  = 17
p2facing = 1
p2stateno = 2110
down.bounce = 1
down.velocity = -3


; hit the second person on the bounce
[State 72102, 3]
type = HitDef
ID = 2103
trigger1 = !(time%2)
ID = 2101
attr = C, SA
hitflag = MAF
guardflag = L
damage   = 50 
animtype = Back
guardflag = MA
pausetime = 5,5
sparkxy =  0,-27
hitsound   = 5,2
guardsound = 6,0
ground.type = High
ground.slidetime = 13
ground.hittime  = 17
p2facing = 1
p2stateno = 2110
down.bounce = 1
down.velocity = -3


[State 72102, 4] ; added
type = VarSet
triggerall = numhelper(3477)
triggerall = helper(3477),movetype!=H  ; not in hit state
triggerall = helper(3477),Vel Y >= -1
trigger1 = AnimElemNo(0) = 1
trigger1 = facing*(helper(3477),Pos X-Pos X) = [-2,9]
trigger1 = helper(3477),RootDist Y = [67,77];[69,75]
trigger2 = AnimElemNo(0) = 2
trigger2 = facing*(helper(3477),Pos X-Pos X) = [2,-9]
trigger2 = helper(3477),RootDist Y = [85,94];[86,92]
trigger3 = animelemno(0)=3
trigger3 = facing*(helper(3477),Pos X-Pos X) = [1,11]
trigger3 = helper(3477),RootDist Y = [89,97];[90,96]
trigger4 = animelemno(0)=4
trigger4 = facing*(helper(3477),Pos X-Pos X) = [8,18]
trigger4 = helper(3477),RootDist Y = [88,96];[89,95]
trigger5 = animelemno(0)>=5
trigger5 = facing*(helper(3477),Pos X-Pos X) = [15,26]
trigger5 = helper(3477),RootDist Y = [88,96];[89,95]
var(3) = 3491

[State 72102, 5]
type = VarSet
trigger1 = var(3)
var(15) = 1

; After hitting second person the first time
[Statedef 72103]
type = C
physics = N
movetype = A

[State 72103, 0]
type = VarSet
trigger1 = time = 0
v = 3
value = 0

; hit first person on the bounce
[State 72103, 2]
type = HitDef
ID = 2103   ; can't be chained again
trigger1 = time%2 ;hakkkkkkkkk
ID = 2101
attr = C, SA
hitflag = MAF
guardflag = L
damage   = 50 
animtype = Back
guardflag = MA
pausetime = 5,5
sparkxy =  0,-27
hitsound   = 5,2
guardsound = 6,0
ground.type = High
ground.slidetime = 13
ground.hittime  = 17
p2facing = 1
p2stateno = 2110
down.bounce = 1
down.velocity = -3


; hit the second person on the bounce
[State 72103, 3]
type = HitDef
ID = 2103
trigger1 = !(time%2)
ID = 2101
attr = C, SA
hitflag = MAF
guardflag = L
damage   = 50 
animtype = Back
guardflag = MA
pausetime = 5,5
sparkxy =  0,-27
hitsound   = 5,2
guardsound = 6,0
ground.type = High
ground.slidetime = 13
ground.hittime  = 17
p2facing = 1
p2stateno = 2110
down.bounce = 1
down.velocity = -3


[State 72103, 4]
type = ChangeState
trigger1 = frontedgedist = 0
trigger2 = time = 60
value = 72102

; give player some control over velocity
[State 72103, 6]
type = VelAdd
trigger1 = AnimElem = 2, > 0
trigger1 = command = "holdfwd"
trigger1 = Vel X < 4.4
x = .1

[State 72103, 6]
type = VelAdd
trigger1 = AnimElem = 2, < 0
trigger1 = command = "holdback"
trigger1 = Vel X > 2.9
x = -.1

[State 72103, 5]
type = PlayerPush
trigger1 = time >= 0
value = 0

; Saikyou Zenten Hissatsu Waza (blocked)
[Statedef 72105]
type = A
movetype = H
physics = N
velset = -3.5, -8.8
anim = 7604

[State 72105, 0]
type = Gravity
trigger1 = time > 0

[State 72105, 1]
type = PlaySnd
trigger1 = time = 5
value = 2100, 1    ; maketa ssu.
channel = 0

[State 72105, 2]
type = ChangeAnim
trigger1 = Vel Y > -.5
persistent = 0
value = 5061

[State 72105, 2]
type = PosAdd
trigger1 = Vel Y > -.5
y = 40
persistent = 0

[State 72105, 3]
type = LifeAdd
trigger1 = !time
value = -10

[State 72105, 3]
type = LifeAdd
trigger1 = Pos Y > 0
trigger1 = Vel Y > 0
value = -30

[State 72105, 3]
type = ChangeState
trigger1 = Pos Y > 0
trigger1 = Vel Y > 0
value = 5100

[State 72105, 4]
type = ChangeState
trigger1 = command = "recovery"
trigger1 = time = [0,5] 
value = 72106

; Recovering out of blocked Saikyou Zenten Hissatsu Waza
[Statedef 72106]
type = A
movetype = I
physics = N

[State 72106, 0]
type = Gravity
trigger1 = statetype = A

[State 72106, 0]
type = PalFX
trigger1 = !time
add = 255,255,255
time = 6

[State 72106, 1]
type = PlaySnd
trigger1 = !time
value = 7610, 0   ; araraa?
;value = 195, 3  ; Hyahuui!

[State 72106, 0]
type = ChangeState
trigger1 = Pos Y > 0
value = 72107

[Statedef 72107]
type = C
movetype = I
physics = N

[State 72107, 0]
type = VelSet
trigger1 = !time
y = 0

[State 72107, 0]
type = PosSet 
trigger1 = !time
y = 0

[State 72107, 1]
type = ChangeState
trigger1 = time >= 10
trigger1 = animelem = 4, = 2
value = 72108

[Statedef 72108]
type = C
movetype = I
physics = N
velset = 0,0
anim = 7607

[State 72108, 0]
type = PlaySnd
trigger1 = AnimElem = 3
persistent = 0
value = 197, 6;   Ora!!!
channel = 0

[State 72108, 0]
type = ChangeState
trigger1 = time = 60
value = 11
ctrl = 1

[Statedef 6667]
type = C
physics = N
movetype = A
anim = 72101
velset = 0, 0

[State 72100, 0]
type = AfterImage
trigger1 = AnimElem = 1
time = 3

[State 72100, 0]
type = AfterImageTime
trigger1 = AnimElemTime(1) >= 1
time = 3

[State 6667, 0]
type = PlaySnd
trigger1 = time = 0
value = 0,52

[State 6667, 0]
type = VarSet
trigger1 = time = 0
v = 3
value = 0

[State 6667, 0]
type = PosSet
trigger1 = time = 0
y = 0

[State 6667, 1]
type = VelSet
trigger1 = AnimElem = 2
persistent = 0
x = -4

[State 6667, 2]
type = HitDef
trigger1 = AnimElem = 2
persistent = 0
ID = 2101
attr = C, SA
hitflag = MAF
guardflag = L
damage   = 50 
animtype = Back
guardflag = MA
pausetime = 5,5
sparkxy =  0,-27
hitsound   = 5,2
guardsound = 6,0
ground.type = High
ground.slidetime = 13
ground.hittime  = 17
p2facing = 1
p2stateno = 2110
down.bounce = 1
down.velocity = -3

[State 6667, 0]
type = VarAdd
trigger1 = time = 0
v = 49
value = 1

[State 6667, 1random]
type = VarRandom
trigger1 = Time = 0
v = 49
range = 0,5

[State 6667, 2]
type = PlaySnd
trigger1 = MoveHit = 1
trigger1 = var(49) = 0
persistent = 0
value = 198,3

[State 6667, 2]
type = PlaySnd
trigger1 = MoveHit = 1
trigger1 = var(49) = 1
persistent = 0
value = 197,3

[State 6667, 2]
type = PlaySnd
trigger1 = MoveHit = 1
trigger1 = var(49) = 2
persistent = 0
value = 196,14

[State 6667, 2]
type = PlaySnd
trigger1 = MoveHit = 1
trigger1 = var(49) = 3
persistent = 0
value = 196,3

[State 6667, 2]
type = PlaySnd
trigger1 = MoveHit = 1
trigger1 = var(49) = 4
persistent = 0
value = 195,3

[State 6667, 2]
type = PlaySnd
trigger1 = MoveHit = 1
trigger1 = var(49) = 5
persistent = 0
value = 197,14

[State 6667, 3]
type = ChangeState
trigger1 = moveguarded = 1
value = 72105

[State 6667, 4]
type = VarSet
trigger1 = movehit = 1
persistent = 0
v = 3
value = 1

[State 6667, 5]
type = PlayerPush
trigger1 = time > 0
value = 0

; give player some control over velocity
[State 6667, 6]
type = ChangeState
trigger1 = AnimElem = 2, > 0
trigger1 = command = "holdfwd"
trigger1 = Vel X < 5.58
value = 72101

[State 6667, 6]
type = VelSet
trigger1 = Vel X < 6
x = -9

; hit on the bounce
[State 6667, 2]
type = HitDef
ID = 2103   ; can't be chained again
trigger1 = var(3) = 1
trigger1 = time%2  ;hakkkkkkkkk
ID = 2101
attr = C, SA
hitflag = MAF
guardflag = L
damage   = 50 
animtype = Back
guardflag = MA
pausetime = 5,5
sparkxy =  0,-27
hitsound   = 5,2
guardsound = 6,0
ground.type = High
ground.slidetime = 13
ground.hittime  = 17
p2facing = 1
p2stateno = 2110
down.bounce = 1
down.velocity = -3


; hit a second person
[State 6667, 3]
type = HitDef
ID = 2102
trigger1 = var(3) = 1
trigger1 = !(time%2)
ID = 2101
attr = C, SA
hitflag = MAF
guardflag = L
damage   = 50 
animtype = Back
guardflag = MA
pausetime = 5,5
sparkxy =  0,-27
hitsound   = 5,2
guardsound = 6,0
ground.type = High
ground.slidetime = 13
ground.hittime  = 17
p2facing = 1
p2stateno = 2110
down.bounce = 1
down.velocity = -3


[State 6667, 4]
type = ChangeState
trigger1 = backedgedist = 0
value = 72101

[State 6667, 4]
type = ChangeState
trigger1 = win
value = 2102

;===============================================================================
;==================================================================================
;======| RELACIONADO À AI - AI RELATED |===========================================
;==================================================================================

; (Credit to ANMC, Bagaliao, and FlowaGirl for the basic helper method concept.)
;
;------------------
; AI Activation Helper State - Primary Version
; (Credit to YongMing for the basic HitPause bugfix concept.)
;
; var(1) - First tick button activation prevention.
; var(2) - Used for pause/superpause and custom state check, basically.
; var(3) - (Super/)Pause & custom state-triggered dir detection disabler.
; var(4) - Persistent direction command detection enabler (due to 2002.04.14).
; var(9) - AutoTurn bug fixer.
; parent's var(57) - Parent's GameTime var, for pause and custom state check.
; parent's var(59) - Parent's primary AI variable.
;
; The code in this state is mostly simply copy/pasteable.
; But if you're using different indices for the parent's variables,
; or if you change your character's basic commands' names, you'll
; of course need to change the code in this state accordingly.

[StateDef 9741]
type = S
movetype = I
physics = N
anim = 9741
ctrl = 0

[State 9741, Safety]; Just in case your opponent is very poorly coded.
type = SelfState
trigger1 = !IsHelper
value = 0

[State 9741, PauseCheck]
type = VarSet
trigger1 = (GameTime>(Parent,var(57)))
trigger2 = !(Parent,Alive)
trigger3 = (RoundState != 2)
trigger4 = Parent,var(20)
trigger5 = (var(3):=0)
var(2) = (var(3):=1)+(var(4):=0)

[State 9741, Facing]
type = Turn
trigger1 = (var(9):=(Facing != Parent,Facing))

[State 9741, DirTurnOnAI]
type = ParentVarSet
triggerall = !var(3)
triggerall = !var(9)
trigger1 = (Parent,command = "holdfwd")
trigger2 = (Parent,command = "holdback")
trigger3 = (Parent,command = "holdup")
trigger4 = (Parent,command = "holddown")
trigger5 = !(var(4):=1)
var(30) = var(4)

[State 9741, DirTurnOffAI]
type = ParentVarSet
triggerall = !var(3)
triggerall = Parent,var(30)
trigger1 = (command = "holdfwd")
trigger1 = (Parent,command = "holdfwd")
trigger2 = (command = "holdback")
trigger2 = (Parent,command = "holdback")
trigger3 = (command = "holdup")
trigger3 = (Parent,command = "holdup")
trigger4 = (command = "holddown")
trigger4 = (Parent,command = "holddown")
var(30) = (var(4):=0)

[State 9741, ButtonTurnOnAI]
type = ParentVarSet
triggerall = var(1)
triggerall = !var(2)
trigger1 = (Parent,command = "a")
trigger2 = (Parent,command = "b")
trigger3 = (Parent,command = "c")
trigger4 = (Parent,command = "x")
trigger5 = (Parent,command = "y")
trigger6 = (Parent,command = "z")
trigger7 = (Parent,command = "s")
var(30) = 59

[State 9741, ButtonTurnOffAI]
type = ParentVarSet
triggerall = !var(2)
trigger1 = (command = "a")
trigger1 = (Parent,command = "a")
trigger2 = (command = "b")
trigger2 = (Parent,command = "b")
trigger3 = (command = "c")
trigger3 = (Parent,command = "c")
trigger4 = (command = "x")
trigger4 = (Parent,command = "x")
trigger5 = (command = "y")
trigger5 = (Parent,command = "y")
trigger6 = (command = "z")
trigger6 = (Parent,command = "z")
trigger7 = (command = "s")
trigger7 = (Parent,command = "s")
var(30) = -1

[State 9741, UnPauseCheck]
type = VarSet
triggerall = var(2)
trigger1 = (Parent,command = "a")
trigger2 = (Parent,command = "b")
trigger3 = (Parent,command = "c")
trigger4 = (Parent,command = "x")
trigger5 = (Parent,command = "y")
trigger6 = (Parent,command = "z")
trigger7 = (Parent,command = "s")
trigger8 = (var(2) = 2)
trigger8 = (var(2):=0)
var(2) = 2

[State 9741, Goodbye]
type = DestroySelf
triggerall = (var(1):=1)
trigger1 = Parent,var(20)
trigger2 = !(Parent,Alive)
trigger3 = (RoundState != 2)


;------------------
; AI Activation Helper State - Compatibly Partnered Version
;
; var(1) - First tick dir activation prevention
; var(2) - Used for pause/superpause and custom state check, basically.
; var(3) - (Super/)Pause & custom state-triggered dir detection disabler.
; var(4) - Hitpause check.
; var(5) - No button on previous tick.
; var(6) - Any dir on this tick.
; var(7) - Any button on this tick.
; var(8) - Matching partner button detected.
; var(9) - AutoTurn bug fixer.
; parent's var(57) - Parent's GameTime var, for pause and custom state check.
; parent's var(59) - Parent's primary AI variable.
;
; The code in this state is mostly simply copy/pasteable.
; But if you're using different indices for the parent's variables,
; or if you change your character's basic commands' names, you'll
; of course need to change the code in this state accordingly.

[StateDef 9742]
type = S
movetype = I
physics = N
anim = 9741
ctrl = 0

[State 9742, Safety]; Just in case your opponent is very poorly coded.
type = SelfState
trigger1 = !IsHelper
value = 0

[State 9742, PauseCheck]
type = VarSet
trigger1 = (GameTime>Parent,var(57))
trigger2 = !(Parent,Alive)
trigger3 = (RoundState != 2)
trigger4 = Parent,var(20)
trigger5 = (var(3):=0)
var(2) = (var(3):=1)

[State 9742, Facing]
type = Turn
trigger1 = (var(9):=(Facing != Parent,Facing))

[State 9742, ParentDirCheck]
type = VarSet
trigger1 = (Parent,command = "holdfwd")
trigger2 = (Parent,command = "holdback")
trigger3 = (Parent,command = "holdup")
trigger4 = (Parent,command = "holddown")
trigger5 = (var(6):=0)
var(6) = 1

[State 9742, ParentButtonCheck]
type = VarSet
trigger1 = (Parent,command = "a")
trigger2 = (Parent,command = "b")
trigger3 = (Parent,command = "c")
trigger4 = (Parent,command = "x")
trigger5 = (Parent,command = "y")
trigger6 = (Parent,command = "z")
trigger7 = (Parent,command = "s")
trigger8 = (var(7):=0)
var(7) = 1

[State 9742, SameButtonCheck]
type = VarSet
triggerall = var(7)
triggerall = !var(2)
triggerall = NumPartner
trigger1 = (Parent,command = "a")
trigger1 = (Partner,command = "a")
trigger2 = (Parent,command = "b")
trigger2 = (Partner,command = "b")
trigger3 = (Parent,command = "c")
trigger3 = (Partner,command = "c")
trigger4 = (Parent,command = "x")
trigger4 = (Partner,command = "x")
trigger5 = (Parent,command = "y")
trigger5 = (Partner,command = "y")
trigger6 = (Parent,command = "z")
trigger6 = (Partner,command = "z")
trigger7 = (Parent,command = "s")
trigger7 = (Partner,command = "s")
trigger8 = (var(8):=0)
var(8) = 1

[State 9742, DirTurnOnAI]
type = ParentVarSet
trigger1 = var(1)
trigger1 = var(6)
trigger1 = !var(3)
trigger1 = !var(4)
trigger1 = !var(9)
var(30) = 59

[State 9742, DirTurnOffAI]
type = ParentVarSet
triggerall = var(6)
triggerall = !var(3)
triggerall = Parent,var(30)
trigger1 = (command = "holdfwd")
trigger1 = (Parent,command = "holdfwd")
trigger2 = (command = "holdback")
trigger2 = (Parent,command = "holdback")
trigger3 = (command = "holdup")
trigger3 = (Parent,command = "holdup")
trigger4 = (command = "holddown")
trigger4 = (Parent,command = "holddown")
var(30) = 0

[State 9742, ButtonTurnOnAI]
type = ParentVarSet
trigger1 = var(5)
trigger1 = var(7)
trigger1 = !var(2)
trigger1 = !var(8)
var(30) = 59

[State 9742, ButtonTurnOffAI]
type = ParentVarSet
triggerall = var(7)
triggerall = !var(2)
triggerall = !var(8)
trigger1 = (command = "a")
trigger1 = (Parent,command = "a")
trigger2 = (command = "b")
trigger2 = (Parent,command = "b")
trigger3 = (command = "c")
trigger3 = (Parent,command = "c")
trigger4 = (command = "x")
trigger4 = (Parent,command = "x")
trigger5 = (command = "y")
trigger5 = (Parent,command = "y")
trigger6 = (command = "z")
trigger6 = (Parent,command = "z")
trigger7 = (command = "s")
trigger7 = (Parent,command = "s")
var(30) = -1

[State 9742, UnPauseCheck]
type = VarSet
triggerall = var(2)
triggerall = !var(4)
trigger1 = var(7)
trigger2 = (var(2) = 2)
trigger2 = (var(2):=0)
var(2) = 2

[State 9742, Goodbye]
type = DestroySelf
trigger1 = Parent,var(20)
trigger2 = !(Parent,Alive)
trigger3 = (RoundState != 2)

[State 9742, HitPauseCheck]
type = VarSet
trigger1 = var(6)
trigger2 = var(7)
trigger3 = !(Parent,HitPauseTime)
var(4) = Parent,HitPauseTime

[State 9742, Delay]
type = VarSet
trigger1 = (var(1):=1)
var(5) = !var(7)


;------------------
; XOR Method's HitPauseTime Helper State

[StateDef 9743]
type = S
movetype = I
physics = N
anim = 9741
ctrl = 0

[State 9743, Safety]; Just in case your opponent is very poorly coded.
type = SelfState
trigger1 = !IsHelper
value = 0

[State 9743, HitPauseTime]
type = VarSet
trigger1 = !(Parent,HitPauseTime)
trigger2 = (GameTime>Parent,var(57))
var(1) = Parent,HitPauseTime

[State 9742, Goodbye]
type = DestroySelf
trigger1 = (Parent,var(30) = 59)
trigger2 = !(Parent,Alive)
trigger3 = (RoundState != 2)



;==================================================================================
;==================================================================================
;==================================================================================
;---------------------------------------------------------------------------
; States that are always executed (use statedef -2)
;---------------------------------------------------------------------------
[StateDef -2]

;==================================================================================
;======| RELACIONADO À AI - AI RELATED |===========================================
;==================================================================================

; Within StateDef -2, none of your own AI-related code should be placed
; above these next two controllers.

[State -2, StopAI]
type = VarSet
triggerall = (var(30) > 0)
trigger1 = (RoundState != 2)
trigger2 = !Alive
var(30) = -2
IgnoreHitPause = 1

; This controller is optional.  It allows you treat the AI flag as a boolean
; value rather than an integer value, letting you trigger your AI directives
; with "var(0)" instead of "var(59)>0", and letting you make moves usable only
; by humans by using "!var(0)" instead of "var(59)<1", thus slightly improving
; the size and efficiency of your code.
; Another benefit is that it makes it much easier for users to disable your AI,
; if they so choose.
[State -2, Simplifier]
type = VarSet
trigger1 = (var(30) = 59)
trigger2 = (var(0):=0)
var(0) = 1	; Another option is to replace 1 with something like MatchNo, if
		; you want to design your AI to have varying levels of difficulty.
IgnoreHitPause = 1

;==================================================================================
;==================================================================================
;==================================================================================


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

[Statedef -3]

;==================================================================================
;======| RELACIONADO À AI - AI RELATED |===========================================
;==================================================================================

; Kamek and Luchini appear to have been the first ones to use the IsHomeTeam AI activation concept.
; Feel free to move this controller to your character's intro state for slightly better efficiency.
[State -3, SetAI]
type = VarSet
triggerall = !RoundState
triggerall = IsHomeTeam
trigger1 = (TeamSide = 2)
trigger2 = (MatchNo > 1)
var(30) = 59

; Feel free to move this controller to your character's intro state for slightly better efficiency.
; Note that it may give P2 a slight unfair advantage in simul team vs mode, so you
; may want to disable it.  But then, since when has Mugen been about fairness? =P
[State -3, Unfair]; Is this reliable?
type = VarSet
trigger1 = !RoundState
trigger1 = (var(30) != 59)
trigger1 = NumPartner
trigger1 = (ID > Partner,ID)
trigger1 = (TeamSide = 2)
var(30) = 59

[State -3, AI Helper (Compatibly Partnered Version)]
type = Helper
trigger1 = !var(30)
trigger1 = !NumHelper(9742)
trigger1 = (RoundState = 2)
trigger1 = Alive
trigger1 = NumPartner
trigger1 = Partner,SelfAnimExist(9741)
HelperType = normal
name = "AI Helper (Simul Version)"
ID = 9742
pos = 9999999,99999
StateNo = 9742
KeyCtrl = 1
PauseMoveTime = 999999999
SuperMoveTime = 999999999

; If you want to use the Guard mode, Dummy mode, Distance, or Button jam dummy control
; options in Training mode without activating the dummy's AI while working on your
; character, then all you need to do is temporarily disable this controller.
; Or, if you want to permanently disable this controller in Training mode,
; then you could use the Training mode detection code available on my site
; ( http://www.shinmugen.net/winane/ ), and then just add a "(var(59)&63)>30"
; triggerall to this controller.
[State -3, AI Helper]
type = Helper
triggerall = !var(30)
triggerall = !NumHelper(9741)
triggerall = (RoundState = 2)
triggerall = Alive
trigger1 = !NumPartner
trigger2 = !(Partner,SelfAnimExist(9741))
HelperType = normal
name = "AI Helper"
ID = 9741
pos = 9999999,99999
StateNo = 9741
KeyCtrl = 1
PauseMoveTime = 999999999
SuperMoveTime = 999999999

[State -3, TurnBackOnAI]
type = VarSet
trigger1 = (var(30) = -2)
trigger1 = (RoundState = 2)
trigger1 = Alive
var(30) = 59

[State -3, HitPauseTime Helper]
type = Helper
triggerall = var(30)!=59
triggerall = !NumHelper(9743)
triggerall = (RoundState = 2)
triggerall = Alive
trigger1 = (MatchNo = 1)
trigger2 = NumPartner
trigger2 = (ID > Partner,ID)
HelperType = normal
name = "HitPauseTime"
ID = 9743
pos = 9999999,99999
StateNo = 9743
PauseMoveTime = 999999999
SuperMoveTime = 999999999

[Statedef -3]
; According to Roque, this method works in Linux Mugen version 2002.04.14,
; whereas the old humanly-impossible commands method does not.
; It is very important that this controller NOT be moved to State -2.
; Note that this part won't work if AI.Cheat is turned off in mugen.cfg.
[State -3, XOR]
type = VarSet
triggerall = var(30)!=1
triggerall = (var(57) = GameTime-1)
triggerall = NumHelper(9743)
triggerall = !(Helper(9743),var(1))
trigger1 = (command = "a") ^^ (command = "CPU1")
trigger2 = (command = "b") ^^ (command = "CPU2")
trigger3 = (command = "c") ^^ (command = "CPU3")
trigger4 = (command = "x") ^^ (command = "CPU4")
trigger5 = (command = "y") ^^ (command = "CPU5")
trigger6 = (command = "z") ^^ (command = "CPU6")
trigger7 = (command = "s") ^^ (command = "CPU7")
trigger8 = (command = "holda") ^^ (command = "CPU8")
trigger9 = (command = "holdb") ^^ (command = "CPU9")
trigger10 = (command = "holdc") ^^ (command = "CPU10")
trigger11 = (command = "holdx") ^^ (command = "CPU11")
trigger12 = (command = "holdy") ^^ (command = "CPU12")
trigger13 = (command = "holdz") ^^ (command = "CPU13")
trigger14 = (command = "holdstart") ^^ (command = "CPU14")
trigger15 = (command = "holdfwd") ^^ (command = "CPU15")
trigger16 = (command = "holdback") ^^ (command = "CPU16")
trigger17 = (command = "holdup") ^^ (command = "CPU17")
trigger18 = (command = "holddown") ^^ (command = "CPU18")
trigger19 = (command = "recovery") ^^ (command = "CPU19")
;Add more as desired. (See my notes in the CMD.)
var(30) = 59

; It is very important that this controller NOT be moved to State -2, as putting
; it there would defeat the entire purpose of the controller, allowing the
; helper method or the XOR method to erroneously set the AI variable.
; And within State -3, don't put any ChangeState controllers before this
; controller, lest you unnecessarily delay your character's AI activation.
[State -3, GameTimeVar]
type = VarSet
trigger1 = 1
var(57) = GameTime
IgnoreHitPause = 1

; Within StateDef -3, none of your own AI-related code should come after the code
; provided here (and putting it before the code is also generally a bad idea).
; It's better to use State -1 (or, in special circumstances, State -2) instead.

;==================================================================================
;==================================================================================
;==================================================================================
