fix: healing
This commit is contained in:
parent
e03106319e
commit
38141cdf85
|
@ -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),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user