Code: Select all

`<!-- General Damage -->`

[h: Name = getProperty("Name")]

[h: Dead = getProperty("Dead")]

[h: HP = getProperty("HP")]

[h: TempHP = getProperty("TempHP")]

[h: Bloodied = getProperty("Bloodied")]

[h:Damage = DamageInflicted]

[H:TempHP = TempHP - Damage]

[h:HP = HP + min(0, TempHP)]

[h:TempHP = max(0,TempHP)]

[r: Name] takes [r:Damage] HP of damage<br>

[r, if(isPC()), code:

{

[h, if(HP <= Bloodied): setState("Bloodied",1);setState("Bloodied",0)]

[h, if(HP <= 0): setState("Dying",1);setState("Dying",0)]

[h, if(HP <= 0): setState("Prone",1);setState("Prone",0)]

[r: Name] has [r:HP] HP and [r:TempHP] temporary HP remaining.<br>

[r, if(HP<= Dead), code:

{

[h: setState("Dead",1)]

[h: setState("Dying",0)]

};]

};]

[h, if(isNPC()), code:

{

[h, if(HP <= Bloodied): setState("Bloodied",1);setState("Bloodied",0)]

[h, if(HP <= 0): setState("Dead",1);setState("Dead",0)]

[h, if(getState("Dead"), code:

{

[h: removeFromInitiative()]

[h: id = getSelected()]

[h: setLayer("Object",id)]

};]

};]

[H:bar.Damage = HP / MaxHP]

Another set of eyes would be greatly appreciated.

Thanks