(x1: number, x2: number)
| 367 | } |
| 368 | |
| 369 | private generateShellPowder(x1: number, x2: number): void{ |
| 370 | // If we don't already have shell powder and no shell powder have been generated in this quest so far and the distance is at least 500 |
| 371 | if(Saving.loadBool("gridItemPossessedShellPowder") == false && this.shellPowderGenerated == false && this.distance >= 500){ |
| 372 | // Iterate over newly generated floors, searching for one which could receive the powder |
| 373 | for(var i = x1; i <= x2; i++){ |
| 374 | if(i >= 6 && // We're not too much on the left |
| 375 | this.floors[i].getType() == TheSeaFloorType.NORMAL && // This floor has the normal type |
| 376 | this.floors[i].getHowManyFloorsOfTheSameTypeBefore() >= 6 // And there's at least 6 floors of the same type before |
| 377 | ){ |
| 378 | // Check if there is already a plant, if so return |
| 379 | for(var j = i-6; j <= i; j++){ |
| 380 | // If this floor already has a plant on it, return |
| 381 | if(this.floors[j].getHasAPlant() == true) return; |
| 382 | } |
| 383 | |
| 384 | // Add the powder and change the shellPowderGenerated bool |
| 385 | this.shellPowderGenerated = true; |
| 386 | this.addEntity(new ShellPowder(this, new Pos(i-6, this.getRealQuestSize().y - this.floors[i].getHeight()))); |
| 387 | this.getLastEntity().setHealthBar(new QuestEntityHealthBar(this.getLastEntity(), new Pos(6, 1))); |
| 388 | |
| 389 | // Inform the floors that they now have a plant on them |
| 390 | for(var j = i-6; j <= i; j++){ |
| 391 | this.floors[j].setHasAPlant(true); |
| 392 | } |
| 393 | } |
| 394 | } |
| 395 | } |
| 396 | } |
| 397 | |
| 398 | private generateSponge(x1: number, x2: number): void{ |
| 399 | // If we don't already have a sponge and no sponge have been generated in this quest so far and the distance is at least 793 |
no test coverage detected