(hp: number)
| 171 | } |
| 172 | |
| 173 | public setHp(hp: number): void{ |
| 174 | this.hp = hp; |
| 175 | |
| 176 | // If we have more hp than the maximum, we correct that |
| 177 | if(this.hp > this.maxHp) |
| 178 | this.hp = this.maxHp; |
| 179 | |
| 180 | // If we have 0 or less hp, we lose!! |
| 181 | if(this.hp <= 0) |
| 182 | this.goToLose(); |
| 183 | } |
| 184 | |
| 185 | public setMaxHp(maxHp: number): void{ |
| 186 | this.maxHp = maxHp; |