=====
Armor
=====
Created by SorrowEdge

;---------------------------------------------------------------------------
Armor -- The increase of a character's resistance. This particular code also 
gives the character a special trait: He/She will not be able to be knocked down
as easily, giving some sort of a "brick wall" feel.
;---------------------------------------------------------------------------
This will require several things:

1.) In the StateDef of all of your character's states, (excluding getting hit states)
add in:

velset = (prevstateno = 9000)* X,(prevstateno = 9000)* Y

X is the character's horizontal velocity, and Y is the character's Y velocity.

facep2 = !(prevstateno = 9000)

facep2 causes your character to face the opponent at the beginning of the state.

ctrl = 1

The ctrl parameter is only required in state 0, (standing state) and in state 11, 
(crouching state) as you want to retain control when getting hit.

2.) Next, the required animation parameter:

[State ***, ChangeAnim]
type = ChangeAnim
trigger1 = Time = 0 && Anim != ***
value = ***

3.) The required -2/-3 states:

;The armor effect only occurs when your character not in his/her basic states. 
(standing, walking, etc...)
[State -3, VarSet]
type = VarSet
trigger1= (StateNo >= 200) && (MoveType != H)
var(0) = StateNo 

[State -3, Armor2]
type = HitOverride
trigger1= (StateNo >= 200) && (MoveType != H)
time = 1
slot = 2
attr = SCA, AA
stateno = 9000

4.) Lastly, the armor state! 
[Statedef 9000]
MoveType = H  

[State 9000, PosFreeze]
type = PosFreeze
trigger1 = 1
value = 1

[State 9000, NotHitBy]
type = NotHitBy 
trigger1 = 1
value = SCA, AA, AP
time = 1

[State 9000, LifeAdd]
type = LifeAdd
trigger1 = Time = 0
value = - floor(gethitvar(damage) / 2)

[State 9000, ChangeAnim]
type = ChangeAnim
trigger1 = Time < floor(gethitvar(hittime) * 0.8)
value = Anim
elem  = AnimElemNo(0)

[State 9000, End]
type = ChangeState
trigger1 = Time >= floor(gethitvar(hittime) * 0.8)
value = Var(0)
