()
| 56 | } |
| 57 | |
| 58 | public update(): void{ |
| 59 | if(this.getQuestEnded() == false){ |
| 60 | // Test if the player won the quest, if so, end the quest and return |
| 61 | if(this.thePlayerWon()){ |
| 62 | this.endQuest(true); |
| 63 | return; |
| 64 | } |
| 65 | |
| 66 | // Test if the player is dead, if so, end the quest and return |
| 67 | if(this.getGame().getPlayer().shouldDie()){ |
| 68 | this.endQuest(false); |
| 69 | return; |
| 70 | } |
| 71 | |
| 72 | // Handle monsters |
| 73 | this.handleKnights(); |
| 74 | |
| 75 | // Update entities |
| 76 | this.updateEntities(); |
| 77 | } |
| 78 | |
| 79 | // Draw |
| 80 | this.preDraw(); |
| 81 | this.getRenderArea().drawArray(Database.getAscii("places/quests/castleEntrance/background"), this.getRealQuestPosition().x, this.getRealQuestPosition().y); |
| 82 | this.drawEntities(); |
| 83 | this.getRenderArea().drawArray(Database.getAscii("places/quests/castleEntrance/front"), this.getRealQuestPosition().x + 104, this.getRealQuestPosition().y); |
| 84 | this.drawAroundQuest(); |
| 85 | if(this.getQuestEnded() == false) this.addExitQuestButton(new CallbackCollection(this.getGame().goToMainMap.bind(this.getGame())), "buttonExitQuestNoKeeping"); |
| 86 | else if(this.getQuestEndedAndWeWon() == false) this.addExitQuestButton(new CallbackCollection(this.getGame().goToMainMap.bind(this.getGame())), "buttonExitQuestNoKeepingBecauseLose"); |
| 87 | else this.addExitQuestButton(new CallbackCollection(this.getGame().goToMainMap.bind(this.getGame())), "buttonExitQuestKeeping"); |
| 88 | this.postDraw(); |
| 89 | } |
| 90 | |
| 91 | // Private methods |
| 92 | private addKnight(x: number = 149): void{ |
nothing calls this directly
no test coverage detected