()
| 312 | } |
| 313 | |
| 314 | public reCalcMaxHp(): void{ |
| 315 | // Base maximum hp : 100 |
| 316 | var maxHp: number = 100; |
| 317 | |
| 318 | // We add to the base, depending on how much candies eaten, if we're not playing in hard mode |
| 319 | if(Saving.loadString("gameGameMode") != "hard"){ |
| 320 | maxHp += Math.ceil((1-Math.exp(-this.game.getCandiesEaten().getCurrent()/3000))*100) + Math.ceil((1-Math.exp(-this.game.getCandiesEaten().getCurrent()/400000))*800); |
| 321 | } |
| 322 | |
| 323 | // We add 300 if we have the heart pendant |
| 324 | if(Saving.loadBool("gridItemPossessedHeartPendant")) |
| 325 | maxHp += 300; |
| 326 | |
| 327 | // We add 20% if we have the heart plug |
| 328 | if(Saving.loadBool("gridItemPossessedHeartPlug")) |
| 329 | maxHp = Math.ceil(maxHp * 1.2); |
| 330 | |
| 331 | // Health gift |
| 332 | if(Saving.loadNumber("gameGiftHealth") > 0){ |
| 333 | maxHp = maxHp + maxHp * (Saving.loadNumber("gameGiftHealth")/5); |
| 334 | } |
| 335 | |
| 336 | // We finally set the value we calculated |
| 337 | this.setMaxHp(maxHp); |
| 338 | |
| 339 | // We update the status bar |
| 340 | this.game.updateStatusBar(); |
| 341 | } |
| 342 | |
| 343 | public save(): void{ |
| 344 | Saving.saveNumber("playerHp", this.getHp()); |
no test coverage detected