Browse Source

Prevent vigors from going over their max values

master
Fen Dweller 5 years ago
parent
commit
f88a76113e
1 changed files with 7 additions and 0 deletions
  1. +7
    -0
      src/game/entity.ts

+ 7
- 0
src/game/entity.ts View File

@@ -111,6 +111,13 @@ export abstract class Mortal extends Entity {
}
})

Object.keys(Vigor).forEach(vigorStr => {
const vigor = vigorStr as Vigor
if (this.vigors[vigor] > this.maxVigors[vigor]) {
this.vigors[vigor] = this.maxVigors[vigor]
}
})

if (this.vigors.Health <= -this.maxVigors.Health) {
this.destroyed = true
}


Loading…
Cancel
Save