added rewards for level completion
This commit is contained in:
@@ -499,6 +499,15 @@ const powerUps = {
|
||||
},
|
||||
spawnStartingPowerUps(x, y) { //used for map specific power ups, mostly to give player a starting gun
|
||||
if (level.levelsCleared < 4) { //runs 4 times on all difficulty levels
|
||||
|
||||
//bonus power ups for clearing runs in the last game
|
||||
if (level.levelsCleared === 0 && !game.isCheating) {
|
||||
for (let i = 0; i < localSettings.levelsClearedLastGame / 5 - 1; i++) {
|
||||
powerUps.spawn(x, y, "mod", false); //spawn a mod for every 5 levels cleared in last game
|
||||
}
|
||||
localSettings.levelsClearedLastGame = 0 //after getting bonus power ups reset run history
|
||||
localStorage.setItem("localSettings", JSON.stringify(localSettings)); //update local storage
|
||||
}
|
||||
if (b.inventory.length === 0) {
|
||||
powerUps.spawn(x, y, "gun", false); //first gun
|
||||
} else if (mod.totalCount === 0) { //first mod
|
||||
@@ -560,7 +569,7 @@ const powerUps = {
|
||||
!(mod.isEnergyNoAmmo && target === 'ammo')
|
||||
) {
|
||||
powerUps.directSpawn(x, y, target, moving, mode)
|
||||
if (mod.isBayesian && Math.random() < 0.3) powerUps.directSpawn(x, y, target, moving, mode)
|
||||
if (mod.isBayesian && Math.random() < 0.2) powerUps.directSpawn(x, y, target, moving, mode)
|
||||
}
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user