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

;;Victim Lost, on ground
[Statedef 50005]
type = S
movetype= I
physics = N
sprpriority = 2
juggle = 0

[State 757, 9]; Get into self minigame
type = SelfState
trigger1 = time >= 0 && prevstateno = 60000
value = 50005

[State 757, 3]
type = VelSet
trigger1 = time = 0
X = 0
Y = 0

[State 0, Helper]; 
type = Helper
trigger1 = time = 0 && numhelper(50150) = 0 
helpertype = normal
name = "Victim lost"
pos = 999,999
ID = 50150
size.xscale = 0
size.yscale = 0
stateno = 50150 
postype = p1  
keyctrl = 0
ownpal = 0
supermovetime = 0
pausemovetime = 0

[State 0, Helper]; 
type = Helper
trigger1 = time = 0 && numhelper(50250) = 0
helpertype = normal
name = "Helper Minigame"
pos = -50, -39
ID = 50250
size.xscale = .5
size.yscale = .5
stateno = 50250 
postype = p1  
keyctrl = 0
ownpal = 0
supermovetime = 0
pausemovetime = 0

[State 0, Explod]
type = Explod
triggerall = numexplod(113200) < 5 && numhelper(50250) = 1
trigger1 = helper(50250),fvar(32) >= 50  && helper(50250),fvar(32) <= 52
trigger2 = helper(50250),fvar(32) >= 40  && helper(50250),fvar(32) <= 42
trigger3 = helper(50250),fvar(32) >= 30  && helper(50250),fvar(32) <= 32
trigger4 = helper(50250),fvar(32) >= 20  && helper(50250),fvar(32) <= 22
trigger5 = helper(50250),fvar(32) >= 10  && helper(50250),fvar(32) <= 12
trigger6 = helper(50250),fvar(32) >= 3  && helper(50250),fvar(32) <= 5
trigger7 = time = 0 && Random < 100
anim = 113200+random%5
ID = 113200
pos = 0 , -8
facing = ifElse(random < 500,1,-1)
postype = p1
scale = 1+(Random%400)*.001, .8+(Random%200)*.001
sprpriority = 5

[State 0, PlaySnd]; Cum sounds
type = PlaySnd
triggerall = numhelper(50250) = 1
trigger1 = helper(50250),fvar(32) >= 50  && helper(50250),fvar(32) <= 51
trigger2 = helper(50250),fvar(32) >= 40  && helper(50250),fvar(32) <= 41
trigger3 = helper(50250),fvar(32) >= 30  && helper(50250),fvar(32) <= 31
trigger4 = helper(50250),fvar(32) >= 20  && helper(50250),fvar(32) <= 21
trigger5 = helper(50250),fvar(32) >= 10  && helper(50250),fvar(32) <= 11
trigger6 = helper(50250),fvar(32) >= 3  && helper(50250),fvar(32) <= 4
value = 45645,7+random%2
channel = 6
lowpriority = 1

[State 0, NotHitBy]; Avoid Normal Grabs COMPATIBLE VICTIM
trigger1 = SelfAnimExist(71101) = 1
type = NotHitBy
value = ,NT,ST

[State 0, AssertSpecial]; Don't turn
type = AssertSpecial
trigger1 = 1
flag = Noautoturn

[State 0, PosSet]; Hitbox position
type = PlayerPush
trigger1 = 1
value = 0

[State 0, PlaySnd]; Hit Moans
type = PlaySnd
triggerall = numhelper(50250) = 1
trigger1 = time = 0
trigger2 = helper(50250),fvar(32) >= 50  && helper(50250),fvar(32) <= 51
trigger3 = helper(50250),fvar(32) >= 40  && helper(50250),fvar(32) <= 41
trigger4 = helper(50250),fvar(32) >= 30  && helper(50250),fvar(32) <= 31
trigger5 = helper(50250),fvar(32) >= 20  && helper(50250),fvar(32) <= 21
trigger6 = helper(50250),fvar(32) >= 10  && helper(50250),fvar(32) <= 11
trigger7 = helper(50250),fvar(32) >= 3  && helper(50250),fvar(32) <= 4
value = 4218,25 +random%3
channel = 5
lowpriority = 1

[State 0, ChangeAnim];
type = ChangeAnim
trigger1 = time = 0
trigger2 = numexplod(113200) > 0
value = 71101

[State 0, LifeAdd]
type = LifeAdd
trigger1 = (Gametime % 25) = 0
kill = 0
value = -1

[State 757, 9]; Get into self minigame
type = SelfState
trigger1 = numhelper(50250) = 0;helper(50250),numexplod(40012)= 0;(fvar(32) <= 0
value = 5110

;--------------------------------------
;Victim stay HELPER
[Statedef 50150]
type = U
movetype= A
physics = N
anim = -1

[State 0, DestroySelf];wakeup
type = Null
trigger1 = 1

[State 0, Destroyself]; Victim free
type = Destroyself
trigger1 = root,numhelper(50250) = 0

;Helper Expel Minigame
[Statedef 50250]
type = U
movetype= A
physics = N
sprpriority = 2
juggle = 0
anim = 40011

[State 757, 3]
type = VelSet
trigger1 = time = 0
X = 0
Y = 0

[State 757, 3]
type = PosSet
trigger1 = 1
X = root,pos x  - 50
Y = root,pos y  - 39

[State 757, 3]
type = Assertspecial
trigger1 = 1
flag = noshadow

[State 757, 3]
type = Assertspecial
triggerall = root,Stateno != 50002 && root,Stateno != 50004 && root,Stateno != 70002 && root,Stateno != 70004 && root,Stateno != 50005 && root,Stateno != 5000 && root,Stateno != 5070
trigger1 = 1
flag = invisible

[State 0, VarSet]; Minigame Cum amount START
type = VarSet
trigger1 = time = 0
fv = 32
value = 60
persistent = 0

[State 0, VarSet]; Minigame Cum amount reFill
type = VarAdd
trigger1 = enemynear,numexplod(443009) = 1 && fvar(32) < 60
fv = 32
value = 2


[State 0, VarAdd]; Minigame Cum amount decrease
type = VarAdd
triggerall = root,AILevel = 0
trigger1 = root,command = "b" || root,command = "a" || root,time = 0
fv = 32
value = -.1

[State 0, VarAdd]; Minigame Cum amount decrease
type = VarAdd
triggerall = root,AILevel > 0 && root,stateno = 50005
trigger1 = (Gametime % 10) = 0 || root,time = 0
fv = 32
value = -.1

[State 0, VarAdd]; Minigame Cum amount decrease
type = VarAdd
triggerall = root,numexplod(113200) > 0
trigger1 = helper(50250),fvar(32) >= 50  && helper(50250),fvar(32) <= 52
trigger2 = helper(50250),fvar(32) >= 40  && helper(50250),fvar(32) <= 42
trigger3 = helper(50250),fvar(32) >= 30  && helper(50250),fvar(32) <= 32
trigger4 = helper(50250),fvar(32) >= 20  && helper(50250),fvar(32) <= 22
trigger5 = helper(50250),fvar(32) >= 10  && helper(50250),fvar(32) <= 12
trigger6 = helper(50250),fvar(32) >= 3  && helper(50250),fvar(32) <= 5
fv = 32
value = -1

[State 0, Explod]; Cum Bar Expel Amount
type = Explod
trigger1 = numexplod(40012) = 0
anim = 40012
ID = 40012
pos = 0, 2
postype = p1
scale = .5, .5
sprpriority = 4
bindtime = -1
removetime = -1

[State 0, ModifyExplod]; Cum Bar Expel updater
type = Modifyexplod
trigger1 = 1
ID = 40012
postype = p1
pos = 0, 2
scale = .5, .5-fvar(32)

[State 0, Destroyself]; Cum Bar Expel updater
type = RemoveExplod
trigger1 = fvar(32) <= 0
ID = 40012

[State 0, Destroyself]; Remove once depleted
type = Destroyself
trigger1 = fvar(32) <= 0

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

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

;Futa or Victim react to Defeated Victim or Sex scene
[Statedef 52155]
type = S
movetype= I
physics = N
sprpriority = 2
juggle = 0

[State 757, 3]
type = VelSet
trigger1 = time = 0
X = 1
Y = 0

[State 757, 3]
type = Posset
trigger1 = time = 0
Y = 0

[State 0, NotHitBy]; Avoid Normal Grabs
trigger1 = 1
type = NotHitBy
value = SCA,AA

[State 0, AssertSpecial]; Don't turn
type = AssertSpecial
trigger1 = 1
flag = Noautoturn

[State 0, PosSet]; Hitbox position
type = PlayerPush
trigger1 = 1
value = 0

[State 20, 3]
type = ChangeAnim
trigger1 = time = 0; && Anim != 5
;trigger2 = Anim = 5 && AnimTime = 0
value = 20

[State 757, 9]; REACT to ALLY FUTA
type = ChangeState
trigger1 = enemynear,stateno = 50004 && abs(enemynear,Pos X - Pos X) < 90
value = 52156
ctrl = 0

[State 757, 9]; REACT to ENEMY FUTA
type = ChangeState
trigger1 = enemynear,stateno = 50003 && abs(enemynear,Pos X - Pos X) < 90
value = 52157
ctrl = 0

[State 757, 9]; Get up on time out
type = SelfState
trigger1 = enemynear,stateno != 50003 && abs(enemynear,Pos X - Pos X) < 90
trigger2 = enemynear,stateno != 50004 && abs(enemynear,Pos X - Pos X) < 90
value = 0
ctrl = 1

;Futa or Victim react to Defeated Victim or Sex scene ALLY FUTA
[Statedef 52156]
type = S
movetype= I
physics = N
sprpriority = 2
velset = 0,0
juggle = 0

[State 0, NotHitBy]; Avoid Normal Grabs
trigger1 = 1
type = NotHitBy
value = SCA,AA

[State 0, AssertSpecial]; Don't turn
type = AssertSpecial
trigger1 = 1
flag = Noautoturn

[State 0, PosSet]; Hitbox position
type = PlayerPush
trigger1 = 1
value = 0

[State 20, 3]
type = ChangeAnim
trigger1 = time = 0 || animtime = 0; && Anim != 5
;trigger2 = Anim = 5 && AnimTime = 0
value = 181

[State 757, 9]; Get up on time out
type = SelfState
trigger1 = enemynear,stateno != 50003 && abs(enemynear,Pos X - Pos X) < 90
value = 0
ctrl = 1

;Futa or Victim react to Defeated Victim or Sex scene ENEMY FUTA
[Statedef 52157]
type = S
movetype= I
physics = N
sprpriority = 2
velset = 0,0
juggle = 0

[State 0, NotHitBy]; Avoid Normal Grabs
trigger1 = 1
type = NotHitBy
value = SCA,AA

[State 0, AssertSpecial]; Don't turn
type = AssertSpecial
trigger1 = 1
flag = Noautoturn

[State 0, PosSet]; Hitbox position
type = PlayerPush
trigger1 = 1
value = 0

[State 20, 3]
type = ChangeAnim
trigger1 = time = 0 || animtime = 0; && Anim != 5
;trigger2 = Anim = 5 && AnimTime = 0
value = 170

[State 757, 9]; Get up on time out
type = SelfState
trigger1 = enemynear,stateno != 50003 && abs(enemynear,Pos X - Pos X) < 90
value = 0
ctrl = 1
;---------------------------------------------------------------------------------------------------------





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

;Helper cooldown
[Statedef 50251]
type = S
movetype= I
physics = N
sprpriority = 2
juggle = 0

;[State 0, HitDef]
;type = HitDef
;Triggerall = abs(enemynear(1),Pos X - Pos X) <= 90
;triggerall = enemynear(1),numhelper(50251) = 0
;triggerall = target,stateno != [50000,50005]
;triggerall = target,stateno != 52155
;trigger1 = (gametime%20) = 0 
;attr = S, SA
;hitflag = MAF
;affectteam = F
;priority = 1, Miss
;sparkno = -1
;p1sprpriority = 1
;hitsound = S45645,0
;fall = 0

;[State 0, TargetState]; Defeated Victim loop
;type = TargetState
;triggerall = enemynear(1),numhelper(50251) = 0
;triggerall = target,stateno != [50000,50005]
;triggerall = target,stateno != 52155
;trigger1 = Movehit
;trigger1 = NumTarget
;value = 52155

[State 0, DestroySelf];wakeup
type = Destroyself
trigger1 = root,stateno = 52155 && root,animtime = 0
