MCPcopy Create free account
hub / github.com/candybox2/candybox2.github.io / setHp

Method setHp

code/main/SuperRPG.ts:173–183  ·  view source on GitHub ↗
(hp: number)

Source from the content-addressed store, hash-verified

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;

Callers

nothing calls this directly

Calls 1

goToLoseMethod · 0.95

Tested by

no test coverage detected