fix: healing

This commit is contained in:
cha0s 2019-04-22 21:02:07 -05:00
parent e03106319e
commit 38141cdf85

View File

@ -74,7 +74,12 @@ export class Alive extends decorate(Trait) {
return { return {
tookDamage: (damage, source) => { tookDamage: (damage, source) => {
if (damage.damageSpec.power > 0) {
this.entity.life -= damage.amount; this.entity.life -= damage.amount;
}
else {
this.entity.life += damage.amount;
}
// Clamp health between 0 and max. // Clamp health between 0 and max.
this.entity.life = Math.min( this.entity.life = Math.min(
Math.max(0, this.entity.life), Math.max(0, this.entity.life),