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

Method endQuest

code/main/TheSea.ts:144–169  ·  view source on GitHub ↗
(win: boolean)

Source from the content-addressed store, hash-verified

142 }
143
144 public endQuest(win: boolean): void{
145 // Variable used to generate the winning message
146 var comment: string;
147
148 // We add some messages
149 if(win){
150 switch(Random.between(0, 8)){
151 case 0: comment = "by jumping on a jellyfish"; break;
152 case 1: comment = "by hanging onto a sea turtle"; break;
153 case 2: comment = "by following a dolphin"; break;
154 case 3: comment = "(you don't know how)"; break;
155 case 4: comment = "by hanging onto a shark's fin"; break;
156 case 5: comment = "by following a whale"; break;
157 case 6: comment = "by following a squid"; break;
158 case 7: comment = "by asking your way to a shrimp"; break;
159 case 8: comment = "thanks to some updrafts"; break;
160 }
161 this.getGame().getQuestLog().addMessage(new QuestLogMessage("You almost died in the sea but managed to get to the surface in time " + comment + "."));
162 }
163 else{
164 this.getGame().getQuestLog().addMessage(new QuestLogMessage("You died in the sea."));
165 }
166
167 // We call the endQuest method of our mother class
168 super.endQuest(win);
169 }
170
171 // getLeftLimit()
172 public getLeftLimit(): number{

Callers 1

updateMethod · 0.95

Calls 3

addMessageMethod · 0.80
getQuestLogMethod · 0.80
getGameMethod · 0.45

Tested by

no test coverage detected