;===============================================================================
; ------- Damage Dampener --------
;===============================================================================
;[State -2, Hit Count Super Handling]
;type = VarAdd
;triggerall = StateNo = SUPERSTATE
;trigger1 = !IsHelper
;trigger1 = MoveHit = 1
;trigger1 = !HitPauseTime
;trigger1 = !(HitDefAttr = SCA, AT)
;fvar(13) = 0
;[State 0, Super Scaling]
;type = varset
;trigger1 = movehit
;trigger1 = fvar(10) < 0.50
;fvar(11) = 0.5
;ignorehitpause = 1
;This block of code ensures that Supers do two things. 1, add ONLY 1 to damage scaling, and 2, do a minimum
;of 50% damage regardleess of previous scaling. All you need to do is add
;triggerall = stateno =SUPERSTATE
;to each section
;[State -2, Hit Count Certain Specials Handling]
;type = VarAdd
;triggerall = StateNo = SPECIALSTATE
;trigger1 = !IsHelper
;trigger1 = MoveHit = 1
;trigger1 = !HitPauseTime
;trigger1 = !(HitDefAttr = SCA, AT)
;fvar(13) = O
;Used in instances where you want a special move, or a normal if you so choose, to add only 1 to the damage
;scaling, regardless of how many hits are in the move. An example being Kens Heavy tatsumaki from USFIV.
;The first hit adds 1 point t damage scaling, while the rest don't regardless of which kick hits the opponent
;Used to add Counter Hit Scaling
[State -2, Counter Flag]
type = VarSet
trigger1 = (enemynear, movetype = A)
fvar(1) = 1
ignoreHitPause = 1
[State -2, Counter Flag Reset]
type = VarSet
trigger1 = (enemynear,movetype != A)
fvar(1) = 0
ignoreHitPause = 1
;Decreases damage if opponent has 50 or 30% life
[State -2, Life Scaling]
type = varset
trigger1 = (enemynear, life > lifemax * 0.50) ;No scaling if over 50% life
fvar(2) = 1
ignorehitpause = 1
; Reduction of 10% at 50% life
[State -2, Life Scaling reduction1]
type = varset
trigger1 = 1
fvar(2) = ifelse((enemynear, life <= lifemax * 0.50), (1 - 0.10), 1)
ignorehitpause = 1
;Additional 5% reduction at 30%
[State -2, Life Scaling reduction2]
type = varset
trigger1 = fvar(9) < 1
fvar(2) = ifelse((enemynear, life <= lifemax * 0.30), (1 - 0.15), 0.90)
ignorehitpause = 1
;Keeps track of current combo count
[State -2, Hit Count]
type = VarAdd
trigger1 = !IsHelper
trigger1 = MoveHit = 1
trigger1 = !HitPauseTime
trigger1 = !(HitDefAttr = SCA, AT)
fvar(13) = 1
[State -2, Hit Count Reset]
type = VarSet
trigger1 = NumEnemy && fvar(13)
trigger1 = (EnemyNear, MoveType != H) && (EnemyNear, StateNo != 5300)
trigger2 = moveguarded = 1
fvar(13) = 0
ignoreHitPause = 1
[State -2, Scaling]
type = VarSet
trigger1 = 1
fvar(10) = ifElse(fvar(13) >= 2, 1 - (0.10 * fvar(13)), 1)
ignoreHitPause = 1
[State -2, Scaling Limit]
type = VarSet
trigger1 = fvar(10) <= 0.10
fvar(10) = 0.10
ignoreHitPause = 1
[State -2, Root Dampener]
type = VarSet
trigger1 = 1
fvar(19) = fvar(10) * ifElse(fvar(1) = 1, 1.25, 1) * fvar(2)
ignoreHitPause = 1
;IMPORTANT
;ADD TO HITDEF TO APPLY SCALING
;damage = ceil(fvar(19) * BASE_DAMAGE),CHIP_DAMAGE