()
| 65 | } |
| 66 | |
| 67 | public update(): void{ |
| 68 | if(this.getQuestEnded() == false){ |
| 69 | // Test if the player won the quest, if so, end the quest and return |
| 70 | if(this.thePlayerWon()){ |
| 71 | this.endQuest(true); |
| 72 | return; |
| 73 | } |
| 74 | |
| 75 | // Test if the player is dead, if so, end the quest and return |
| 76 | if(this.getGame().getPlayer().shouldDie()){ |
| 77 | this.endQuest(false); |
| 78 | return; |
| 79 | } |
| 80 | |
| 81 | // Monsters handling |
| 82 | this.monstersHandling(); |
| 83 | |
| 84 | // Update entities |
| 85 | this.updateEntities(); |
| 86 | } |
| 87 | |
| 88 | // Draw |
| 89 | this.preDraw(); |
| 90 | this.getRenderArea().drawArray(Database.getAscii("places/quests/forest/background"), this.getRealQuestPosition().x, this.getRealQuestPosition().y); |
| 91 | this.getRenderArea().drawArray(Database.getAscii("places/quests/forest/background"), this.getRealQuestPosition().x + 98, this.getRealQuestPosition().y); |
| 92 | this.getRenderArea().drawArray(Database.getAscii("places/quests/forest/background"), this.getRealQuestPosition().x + 98*2, this.getRealQuestPosition().y); |
| 93 | this.drawEntities(); |
| 94 | this.drawAroundQuest(); |
| 95 | if(this.getQuestEnded() == false) this.addExitQuestButton(new CallbackCollection(this.getGame().goToMainMap.bind(this.getGame())), "buttonExitQuestNoKeeping"); |
| 96 | else if(this.getQuestEndedAndWeWon() == false) this.addExitQuestButton(new CallbackCollection(this.getGame().goToMainMap.bind(this.getGame())), "buttonExitQuestNoKeepingBecauseLose"); |
| 97 | else this.addExitQuestButton(new CallbackCollection(this.getGame().goToMainMap.bind(this.getGame())), "buttonExitQuestKeeping"); |
| 98 | this.postDraw(); |
| 99 | } |
| 100 | |
| 101 | // Private methods |
| 102 | private addGround(): void{ |
nothing calls this directly
no test coverage detected