;================================================================================
;                       DSS TODOH 'S CODINGS FILE - part1
;================================================================================


[Data]
life = 1000
attack = 100
defence = 100
fall.defence_up = 50
liedown.time = 60
airjuggle = 15
sparkno = 0
guard.sparkno = 0
KO.echo = 0
volume = 100
IntPersistIndex = 58
FloatPersistIndex = 40

[Size]
xscale = 0.75           ;Horizontal scaling factor.
yscale = 0.75           ;Vertical scaling factor.
ground.back = 15     ;Player width (back, ground)
ground.front = 15    ;Player width (front, ground)
air.back = 12        ;Player width (back, air)
air.front = 12       ;Player width (front, air)
height = 60      ;Height of player (for opponent to jump over)
attack.dist = 160    ;Default attack distance
proj.attack.dist = 90 ;Default attack distance for projectiles
proj.doscale = 0     ;Set to 1 to scale projectiles too
head.pos = -3, -96   ;Approximate position of head
mid.pos = -8, -69    ;Approximate position of midsection
shadowoffset = -1     ;Number of pixels to vertically offset the shadow
draw.offset = 0,0    ;Player drawing offset in pixels (x, y)

[Velocity]
walk.fwd  = 2.7      ;Walk forward
walk.back = -2.6     ;Walk backward
run.fwd  = 7    ;Run forward (x, y)
run.back = -6 ;Hop backward (x, y)
jump.neu = 0,-11   ;Neutral jumping velocity (x, y)
jump.back = -3.5    ;Jump back Speed (x, y)
jump.fwd = 3.5       ;Jump forward Speed (x, y)
runjump.back = -4.25,-9 ;Running jump speeds (opt)
runjump.fwd = 4.25,-9      ;.
airjump.neu = 0,-8.2      ;.
airjump.back = -2.55      ;Air jump speeds (opt)
airjump.fwd = 2.5         ;.

[Movement]
airjump.num = 0      ;Number of air jumps allowed (opt)
airjump.height = 35  ;Minimum distance from ground before you can air jump (opt)
yaccel = .52         ;Vertical acceleration
stand.friction = .8  ;Friction coefficient when standing
crouch.friction = .8 ;Friction coefficient when crouching


;Default language victory quotes (optional).  **MUGEN 1.0**
;If this section is included, the default language victory quotes must be in English.
[Quotes]
; Up to 100 victory quotes can be specified per language (victory0 - victory99)
victory1 = "You have no ability. Try again!"
victory2 = "No one's as strong as me. What a bummer!"
victory3 = "That was disgraceful! Put your mind into your moves!"
victory4 = "Win or lose is fine! Just never give up!"
victory5 = "Hard work is needed to make a real difference in your life!" 
victory6 = "You need to master more than one move in order to win!" 
victory7 = "The way of martial arts is tougher than you thought, huh?"
victory8 = "Fear can never defeat the power of wisdom!"
victory9 = "You thought I was weak, but now you see that I am strong!" 
victory10 = "Basic techniques are the key to the power of Kasane Ate."
;victory quotes taken from AOF1 and Capcom VS SNK 2

;-------------------------------------------------------------

;---------------------------------------------------------------------------
; Stand
[Statedef 0]
type = S
physics = S
sprpriority = 0

[State 0, 1]
type = ChangeAnim
triggerall = life <= 250 && roundstate >= 2
trigger1 = Anim != 1 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0 ;Turn anim over
value = 1

[State 0, 1]
type = ChangeAnim
trigger1 = life > 250
trigger1 = Anim != 0 && Anim != 5
trigger2 = life > 250
trigger2 = Anim = 5 && AnimTime = 0 ;Turn anim over
trigger3 = roundstate < 2 && Anim = 1
value = 0

[State 0, 2]
type = VelSet
trigger1 = Time = 0
y = 0

[State 0, 3] ;Stop moving if low velocity or 4 ticks pass
type = VelSet
trigger1 = abs(vel x) < 2
trigger2 = Time = 4
x = 0

[State 0, 4] ;Are you dead?
type = ChangeState
trigger1 = !alive
value = 5050

; Jump Start
[Statedef 40]
type = S
physics = S
anim = 40
ctrl = 0
sprpriority = 1

[State 40, 1]
type = VarSet
trigger1 = Time = 0
sysvar(1) = 0

[State 40, 4]
type = VarSet
trigger1 = command = "holdfwd"
sysvar(1) = 1

[State 40, 5]
type = VarSet
trigger1 = command = "holdback"
sysvar(1) = -1

[State 40, 6]
type = VelSet
trigger1 = AnimTime = 0
x = ifelse(sysvar(1)=0, const(velocity.jump.neu.x), ifelse(sysvar(1)=1, const(velocity.jump.fwd.x), const(velocity.jump.back.x)))
y = const(velocity.jump.y)

[State 40, 9]
type = ChangeState
trigger1 = AnimTime = 0 && command != "holdup"
value = 950
ctrl = 1

[State 40, 10]
type = ChangeState
trigger1 = AnimTime = 0
value = 50
ctrl = 1

; Jump Up
[Statedef 50]
type    = A
physics = A

[State 40, 6]
type = Velset
trigger1 = time = [19,30]
y = 0

[State 40, 6]
type = VelSet
trigger1 = time < 1
y = const(velocity.jump.y)

[State 40, 6]
type = Veladd
trigger1 = time = [3,18]
trigger2 = time > 28
y = .18

[State 50, 1]
type = VarSet
trigger1 = Time = 0
sysvar(1) = 0

[State 50, 2]
type = VelSet
trigger1 = Time = 0 && Var(5)
x = IfElse(vel x = 0,0,IfElse(vel x < 0,-5,6))

[State 50, 3]
type = ChangeAnim
trigger1 = Time = 0
value = ifelse((vel x)=0, 41, ifelse((vel x)>0, 42, 43))

; Short jump
[Statedef 950]
type = A
movetype = I
physics = A
anim = 950

[State 950, 1]
type = VelSet
trigger1 = Time = 0
x = IfElse(vel x = 0,0,IfElse(vel x < 0,-3.1,3.4))
y = -7.5

[State 950, 2]
type = VelSet
trigger1 = Time = 0 && Var(5)
x = IfElse(vel x = 0,0,IfElse(vel x < 0,-5,5))

[State 950, 3]
type = AfterImage
trigger1 = Time = 0 && Var(5) && Vel X != 0
time = 10
timegap = 1
framegap = 2
length = 8
trans = add1
palbright = 0,0,0
palcontrast = 128,128,128
palmul = 1,1,1

[State 950, 4]
type = ChangeState
trigger1 = Pos Y >= 0 && Vel Y > 0
value = 52

; Jump Land
[Statedef 52]
type    = S
physics = S
ctrl = 1
anim = 47
velset = 0,0
facep2 = 1

[State 52, anim]
type = Changeanim
trigger1 = prevstateno = 1200
value = 1201
persistent = 0

[State 52, Landing Sound]
type = PlaySnd
trigger1 = Time = 0
value = 0, 2

[State 52, 1]
type = VelSet
trigger1 = Time = 0
y = 0

[State 52, 2]
type = PosSet
trigger1 = Time = 0
y = 0

[State 52, 4]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

;==================
;DASH
;==================
[Statedef 100]
type = S
movetype = I
physics = S
anim = 100
velset = 0
ctrl = 0

[State 100, 1]
type = ChangeState
trigger1 = AnimTime = 0
value = 101

[Statedef 101]
type = S
movetype = I
physics = S
anim = 101
ctrl = 0

[State 100, 1]
type = VelSet
trigger1 = 1
x = const(velocity.run.fwd.x)

[State 100, 0]
type = PlaySnd
trigger1 = AnimElem = 1
value = 0,4

[State 101, 3]
type = ChangeState
trigger1 = command = "holdup"
value = 40

[State 101, 3]
type = ChangeState
trigger1 = command = "holdback" && time > 10
value = 20
ctrl = 1

[State 101, 3]
type = ChangeState
trigger1 = Animtime = 0
value = 102

[Statedef 102]
type = S
movetype = I
physics = S
anim = 102
velset = 0

[State 102, 1]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

;==================
;BACK DASH
;==================
[Statedef 105]
type = S
movetype = I
physics = S
anim = 105
velset = 0
ctrl = 0

[State 100, 1]
type = ChangeState
trigger1 = AnimTime = 0
value = 106

[Statedef 106]
type = S
movetype = I
physics = S
anim = 106
ctrl = 0

[State 105, 1]
type = VelSet
trigger1 = 1
x = const(velocity.run.back.x)

[State 100, 0]
type = PlaySnd
trigger1 = AnimElem = 1
value = 0,4

[State 101, 3]
type = ChangeState
trigger1 = command = "holdup"
value = 40

[State 101, 3]
type = ChangeState
trigger1 = command = "holdfwd" && time > 10
value = 20
ctrl = 1

[State 101, 3]
type = ChangeState
trigger1 = Animtime = 0
value = 107

[Statedef 107]
type = S
movetype = I
physics = S
anim = 107
velset = 0

[State 102, 1]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1
;---------------------------------------------------------------------------
; Lose by Time Over
[Statedef 170]
type = S
ctrl = 0
anim = 170
velset = 0,0

[State 170, 1]
type = NotHitBy
trigger1 = 1
value = SCA
time = 1

;---------------------------------------------------------------------------
; Win state decider
[Statedef 180]
type = S

[State 180, win detect]
type = Varadd
trigger1 = time = 0
var(58) = 1

[State 180, 2]
type = ChangeState
trigger1 = Time = 0
trigger1 = life >= 1000
value = 182

[State 180, 2]
type = ChangeState
trigger1 = Time = 0
trigger1 = life < 1000
value = 181
;--------------------------------------------------------------------------
; Win pose 1
[Statedef 181]
type = S
ctrl = 0
anim = 181
velset = 0,0

[State 181, end]
type = AssertSpecial
trigger1 = AnimElem = 4 , <= 180
flag = RoundNotOver

[State 191, 3]
type = PlaySnd
trigger1 = AnimElem = 3
value = 181,0

; Win pose 2
[Statedef 182]
type = S
ctrl = 0
anim = 182
velset = 0,0

[State 181, end]
type = AssertSpecial
trigger1 = time <= 190
flag = RoundNotOver

[State 191, 3]
type = PlaySnd
trigger1 = AnimElem = 1
value = 182,0

;---------------------------------------------------------------------------
; Initialize (at the start of the round)
[Statedef 5900]
type = S

[State 5900, 1] ;Clear all int variables
type = VarRangeSet
trigger1 = roundno = 1
value = 0

[State 5900, 2] ;Clear all float variables
type = VarRangeSet
trigger1 = roundno = 1
fvalue = 0

[State 5900, turn]
type = ChangeState
trigger1 = TeamMode = Turns
trigger1 = roundno > 1
trigger1 = RoundsExisted > 0
value = 199

[State 5900, turn]
type = ChangeState
trigger1 = TeamMode = Turns
trigger1 = roundno > 1
trigger1 = RoundsExisted = 0
value = 187

[State 5900, 3] ;Intro
type = ChangeState
trigger1 = roundno = 1
value = 190

;-------------- Turn team taunt if won before
[Statedef 199]
type = S
movetype = I
physics = N
anim = 0
velset = 0,0
ctrl = 0

[State 187,]
type = AssertSpecial
trigger1 = 1
flag = Intro

[State 5900, ] ;Intro
type = ChangeState
trigger1 = time = 45
value = 196

;--------------Turn team jump intro (inspired fom Sander's coding)
[Statedef 187]
type = S
movetype = I
physics = N
anim = 999
velset = 0,0
ctrl = 0

[State 187,]
type = AssertSpecial
trigger1 = 1
flag = Intro

[State 5900, ] ;Intro
type = ChangeState
trigger1 = animtime = 0
value = 188

[Statedef 188]
type = A
movetype = I
physics = N
anim = 950
velset = 4.8,-1
ctrl = 0

[State 189,]
type = screenbound
trigger1 = 1
value = 0

[State 189,]
type = posadd
trigger1 = time = 0
y = -70
x = -100

[State 189,]
type = veladd
trigger1 = 1
y = .4

[State 189,]
type = AssertSpecial
trigger1 = 1
flag = Intro

[State 189,]
type = ChangeState
trigger1 = pos y >= 0 && vel y > 0
value = 189

[Statedef 189]
type = S
movetype = I
physics = N
anim = 47
velset = 0,0
ctrl = 0

[State 197, 1]
type = posset
trigger1 = time = 0
y = 0

[State 197, 2]
type = PlaySnd
trigger1 = Time = 0
value = 0,2

[State 197, AS]
type = AssertSpecial
trigger1 = 1
flag = Intro

[State 197, 3]
type = ChangeState
trigger1 = animtime = 0
value = 190


; Introduction

[Statedef 190]
type = S

[State 180, 2]
type = ChangeState
trigger1 = Time = 0
value = 191

[Statedef 191]
type = S
ctrl = 0
anim = 191
velset = 0,0

[State 192, Ryuhaku Todo]
type = Helper
triggerall = NumHelper(192) = 0
triggerall = time = 0
trigger1 = p2name = "Ryo Sakazaki" || p4name = "Ryo Sakazaki"
trigger2 = p2name = "Robert Garcia" || p4name = "Robert Garcia"
trigger3 = p2name = "Takuma Sakazaki" || p4name = "Takuma Sakazaki"
trigger4 = p2name = "Yuri Sakazaki" || p4name = "Yuri Sakazaki"
helpertype = normal
name = "Kasumi Todoh"
id = 192
postype = p1
pos = -50,0
stateno = 192
keyctrl = 0
ownpal = 1
facep2 = 0
ignorehitpause = 1

[State 191, 1]
type = ChangeAnim
trigger1 = RoundState = 0
value = 191

[State 191, 3]
type = PlaySnd
trigger1 = AnimElem = 2
value = 191,0

[State 191, 2]
type = AssertSpecial
trigger1 = 1
flag = Intro

[State 191, 4]
type = ChangeState
trigger1 = AnimTime = 0
value = 0

[Statedef 192]
type = S
ctrl = 0
anim = 192
velset = 0,0
sprpriority = 2

[State 191, 1]
type = ChangeAnim
trigger1 = RoundState = 0
value = 192

[State 191, 4]
type = ChangeState
trigger1 = AnimTime = 0
value = 193

[Statedef 193]
type = S
ctrl = 0
anim = 193
velset = 0,0
sprpriority = 0

[State 195, 1]
type = PlaySnd
trigger1 = time = 0
value = 0,1

[State 191, 3]
type = Velset
trigger1 = 1
x = -5

[State 191, 3]
type = Velset
trigger1 = AnimElem = 1, >= 0
trigger1 = AnimElem = 1, < 2
y = -10

[State 191, 3]
type = Veladd
trigger1 = AnimElem = 1, > 1
y = .5

[State 191, 4]
type = Destroyself
trigger1 = AnimTime = 0

;-------------------------------TAUNT
[Statedef 195]
type = S
movetype = A
physics = S
anim = 195
ctrl = 0

[State 195, 1]
type = PlaySnd
trigger1 = AnimElem = 2
value = 195,0

[State 195, 3]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

[Statedef 196]
type = S
ctrl = 0
anim = 195
velset = 0,0

[State 191, 1]
type = ChangeAnim
trigger1 = RoundState = 0
value = 195

[State 191, 2]
type = AssertSpecial
trigger1 = 1
flag = Intro

[State 195, 1]
type = PlaySnd
trigger1 = AnimElem = 2
value = 195,0

[State 191, 4]
type = ChangeState
trigger1 = AnimTime = 0
value = 0


;---------------Special KO detect
[Statedef 169]
type = S
physics = S
anim = 999
poweradd = 0
sprpriority = -1
velset = 0,0
ctrl = 0
facep2 = 1

[State 220, 3]
type = ChangeState
trigger1 = AnimTime = 0
value = 169
;---------------------------------------------------------------------------
; States that are always executed (use statedef -2)
;---------------------------------------------------------------------------
[Statedef -2]

[State -2, DEBUG]
trigger1 = 1
type = DisplayToClipboard
ignorehitpause = 1
text = "juggles: %d & %d - mode: %d\nDSS Todoh by David Demianoff"
params = var(7),var(8),var(59)

;--------------------------


[State 100, 0]
type = StopSnd
trigger1 = stateno != 310 && stateno != 311 && stateno != 2000 && stateno != 2010
channel = 3

[State 100, 0]
type = StopSnd
trigger1 = stateno != 1200 && stateno != 1205 && stateno != 1201
channel = 5

[State -2, cheese!!!]
type = null;ChangeState
triggerall = prevstateno = [120,152]
;trigger1 = statetype != A
triggerall = !alive
trigger1 = enemy,hitdefattr = SCA, SA, SP, HA, HP
trigger2 = enemy,ProjHit = 1, < 20
value = 6010
ignorehitpause = 1

[State -2, ranbu juggle]
type = VarAdd
trigger1 = var(8) != 0
trigger1 = (gametime%3) = 0
var(8) = -1

[State -2, ranbu juggle]
type = Assertspecial
trigger1 = var(8) != 0
flag = nojugglecheck

;----------------Throw limit

[State -2, gethit state]
type = Varset
trigger1 = p2movetype = H
var(30) = 5

[State -2, gethit state]
type = VarAdd
trigger1 = var(30) != 0
trigger1 = (gametime%3) = 0
var(30) = -1

[State 200, 1]
type = PlaySnd
trigger1 = p2stateno = 1106 && enemy,time = 1
trigger1 = p2movetype = H
value = 1002,0
persistent = 0

;----------------VAR(50) for detecting the AOF2 selfstate

[State -2, var]
type = Varset
trigger1 = 1
var(50) = 69

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

[Statedef -3]

[state -3, stance]
type = Varset
trigger1 = movetype = H
var(7) = 0

[State 52, Landing Sound]
type = PlaySnd
trigger1 = Time = 1
trigger1 = stateno = 5201
value = 400,0

[State -3, Jumping Sound]
type = PlaySnd
triggerall = Time = 1 && var(5) = 0
trigger1 = stateno = 50
trigger2 = stateno = 950
value = S0,0

[State -3, Jumping Sound]
type = PlaySnd
triggerall = Time = 1 && var(5) = 1
trigger1 = stateno = 50
trigger2 = stateno = 950
value = S0,1

[State -2, 5]
type = PlaySnd
triggerall = Time = 1
triggerall = alive = 1
triggerall = stateno = 5000 || stateno = 5010 || stateno = 5020
trigger1 = anim = 5000
trigger2 = anim = 5010
trigger3 = anim = 5020
value = 5000,0
channel = 0

[State -2, 6]
type = PlaySnd
triggerall = Time = 1
triggerall = alive = 1
triggerall = stateno = 5000 || stateno = 5010 || stateno = 5020
trigger1 = anim = 5001
trigger2 = anim = 5011
trigger3 = anim = 5021
trigger4 = anim = 5002
trigger5 = anim = 5012
trigger6 = anim = 5022
trigger7 = anim = 5030 && numenemy && enemy,var(26) = 1
value = 5000,1
channel = 0

[State -2, 5]
type = PlaySnd
triggerall = Time = 5
triggerall = numenemy
triggerall = alive = 1
triggerall = stateno = 5000 || stateno = 5010 || stateno = 5020
trigger1 = anim = 5030 && enemy,var(26) = 0
trigger2 = anim = 5051
trigger3 = anim = 5052
value = 5000,2
channel = 0



[State -3, ai1]
type = Varset
triggerall = var(9) != 1
triggerall = RoundState != 3
trigger1 = command = "AI_1"
trigger2 = command = "AI_2"
trigger3 = command = "AI_3"
trigger4 = command = "AI_4"
trigger5 = command = "AI_5"
trigger6 = command = "AI_6"
trigger7 = command = "AI_7"
trigger8 = command = "AI_8"
trigger9 = command = "AI_9"
trigger10 = command = "AI_10"
var(9) = 1

[State -3, ai1]
type = Varset
triggerall = var(9) != 1
triggerall = RoundState != 3
trigger1 = command = "AI_11"
trigger2 = command = "AI_12"
trigger3 = command = "AI_13"
trigger4 = command = "AI_14"
trigger5 = command = "AI_15"
trigger6 = command = "AI_16"
trigger7 = command = "AI_17"
trigger8 = command = "AI_18"
trigger9 = command = "AI_19"
trigger10 = command = "AI_20"
var(9) = 1

[State -3, SetAI]
type = VarSet
triggerall = Alive && RoundState = 2
triggerall = IsHomeTeam && !IsHelper
trigger1 = TeamSide = 2
trigger2 = MatchNo > 1
var(9) = 1

[State -3, ai2]
type = Varset
trigger1 = RoundState = 3
var(9) = 0

[State -3, anim]
type = changeanim
trigger1 = roundstate != 2 && var(59) = 1 && anim != 1 && stateno = 5900
value = 1

[State -3, anim]
type = changeanim
trigger1 = roundstate != 2 && var(59) = 2 && anim != 2 && stateno = 5900
value = 2

[State -3, anim]
type = changeanim
trigger1 = roundstate != 2 && var(59) = 3 && anim != 3 && stateno = 5900
value = 3

[State -3, Corner]
type = Velset
trigger1 = FrontEdgeDist < 10 && vel x > 0.1
x = 0.1

;============================
;End of the round stuff
;============================

[State -3, nothitby]
type = NotHitBy
trigger1 = roundstate = 3
value = SCA
time = 1

[State -3, nothitby]
type = AssertSpecial
trigger1 = roundstate = 3
flag = nowalk

[State -3, nothitby]
type = Changestate
triggerall = roundstate = 3
;triggerall = time = 0
trigger1 = anim = 10
trigger2 = stateno = 10
trigger3 = stateno = 11
trigger4 = anim = 11
value = 0


;--------------------------------------------------------------------------- 
; Basic force recover, by Vans 
;--------------------------------------------------------------------------- 
[State -3, FlagFallsHit] 
type = VarSet 
triggerall = P2MoveType = H && P2StateType = A 
triggerall = MoveHit = 1 
triggerall = StateNo != [300,330] 
trigger1 = (StateNo = [200,799]) ; From basic attacks 
trigger1 = StateNo != 231 ; combo finisher
trigger1 = StateNo != 421 ; combo finisher
trigger1 = StateNo != 431 ; combo finisher
trigger1 = Stateno != 223 ; 
trigger1 = Stateno != 240 ; 
trigger1 = Stateno != 241 ; 
var(26) = 1 
ignorehitpause = 1 

[State -3, ResetFallsHit] 
type = VarSet 
trigger1 = !NumTarget 
trigger2 = P2MoveType != H 
trigger3 = P2MoveType = H && P2StateType = A 
trigger3 = MoveHit = 1 
trigger3 = !(StateNo = [200,799]) ; From basic attacks 
trigger4 = StateNo = 231 ; combo finisher
trigger5 = StateNo = 421 ; combo finisher
trigger6 = StateNo = 431 ; combo finisher
trigger7 = Stateno = 223 ; 
trigger8 = Stateno = 240 ; 
trigger9 = Stateno = 241 ; 
var(26) = 0 
ignorehitpause = 1 

[State -3, SendTargetToRecover] 
type = TargetState 
triggerall = NumTarget 
triggerall = Var(26) 
trigger1 = (Target, StateNo) = 5050 
trigger1 = (Target, Alive) 
value = 8400



;--------------------------------------------------------------------------- 
; HITA_RECOV (recovering in air, not falling)
; by Vans 
[Statedef 8400] 
type = A 
movetype= H 
physics = N 

[State 5040, GoToDeath] 
type = SelfState 
trigger1 = !Alive 
value = 5050 

[State 5040, GoToRecover] 
type = SelfState 
trigger1 = 1 
value = 5040 
