()
| 353 | } |
| 354 | |
| 355 | public squeeze(): void{ |
| 356 | // Do different things depending on the current character type |
| 357 | switch(this.characterType){ |
| 358 | case PlayerCharacterType.CANDYBOX: |
| 359 | // We squeeze |
| 360 | this.loadCandyBoxSqueezedCharacter(this.getQuest(), false); |
| 361 | this.move(new Pos(1, 0), true); |
| 362 | // We add a message to the log |
| 363 | this.game.getQuestLog().addMessage(new QuestLogMessage("You squeezed!")); |
| 364 | break; |
| 365 | case PlayerCharacterType.MEDIUM: |
| 366 | // We squeeze |
| 367 | this.loadMediumSqueezedCharacter(this.getQuest(), false); |
| 368 | this.move(new Pos(2, 1), true); |
| 369 | // We add a message to the log |
| 370 | this.game.getQuestLog().addMessage(new QuestLogMessage("You squeezed!")); |
| 371 | break; |
| 372 | case PlayerCharacterType.CANDYBOX_SQUEEZED: |
| 373 | // We unsqueeze |
| 374 | this.loadCandyBoxCharacter(this.getQuest(), false); |
| 375 | this.move(new Pos(-1, 0), true); |
| 376 | // If there's a collision |
| 377 | if(this.checkCollision()){ |
| 378 | // We squeeze again |
| 379 | this.loadCandyBoxSqueezedCharacter(this.getQuest(), false); |
| 380 | this.move(new Pos(1, 0), true); |
| 381 | // We add a message to the log |
| 382 | this.game.getQuestLog().addMessage(new QuestLogMessage("You can't unsqueeze because there isn't enough space.")); |
| 383 | } |
| 384 | else{ |
| 385 | // We add a message to the log |
| 386 | this.game.getQuestLog().addMessage(new QuestLogMessage("You unsqueezed!")); |
| 387 | } |
| 388 | break; |
| 389 | case PlayerCharacterType.MEDIUM_SQUEEZED: |
| 390 | // We unsqueeze |
| 391 | this.loadMediumCharacter(this.getQuest(), false); |
| 392 | this.move(new Pos(-2, -1), true); |
| 393 | // If there's a collision |
| 394 | if(this.checkCollision()){ |
| 395 | // We squeeze again |
| 396 | this.loadMediumSqueezedCharacter(this.getQuest(), false); |
| 397 | this.move(new Pos(2, 1), true); |
| 398 | // We add a message to the log |
| 399 | this.game.getQuestLog().addMessage(new QuestLogMessage("You can't unsqueeze because there isn't enough space.")); |
| 400 | } |
| 401 | else{ |
| 402 | // We add a message to the log |
| 403 | this.game.getQuestLog().addMessage(new QuestLogMessage("You unsqueezed!")); |
| 404 | } |
| 405 | break; |
| 406 | } |
| 407 | } |
| 408 | |
| 409 | public stopBerserk(): void{ |
| 410 | // Mother class method |
no test coverage detected