(pos: Pos, force: boolean = false)
| 325 | } |
| 326 | |
| 327 | public move(pos: Pos, force: boolean = false): boolean{ |
| 328 | // BUGS |
| 329 | if(Bugs.getQuestBugLevel() >= 3 || (Bugs.getQuestBugLevel() >= 2 && Random.oneChanceOutOf(3)) || (Bugs.getQuestBugLevel() >= 1 && Random.oneChanceOutOf(5))){ |
| 330 | pos.x += Random.between(1, 3) - 2; |
| 331 | pos.y += Random.between(1, 3) - 2; |
| 332 | } |
| 333 | |
| 334 | // If we're not a turtle or this isn't a pure horizontal movement (turtles only care about horizontal movement) |
| 335 | if(this.turtle == false || pos.y != 0) |
| 336 | return this.setGlobalPosition(this.globalPosition.plus(pos), force); |
| 337 | // Else, we're a turtle |
| 338 | else{ |
| 339 | // We check the duration |
| 340 | if(this.turtleDuration > 0){ |
| 341 | this.turtleDuration -= 1; |
| 342 | } |
| 343 | else this.stopTurtle(); |
| 344 | // If the movement is >= 2 |
| 345 | if(this.turtleLastMovement >= 2){ |
| 346 | this.turtleLastMovement = 0; // We reset the movement |
| 347 | return this.setGlobalPosition(this.globalPosition.plus(pos), force); // We move |
| 348 | } |
| 349 | // Else, we increase the movement |
| 350 | else{ |
| 351 | this.turtleLastMovement += 1; |
| 352 | return false; |
| 353 | } |
| 354 | } |
| 355 | } |
| 356 | |
| 357 | public moveWormsLike(pos: Pos): boolean{ |
| 358 | // If we can move normally |
no test coverage detected