mod drop balance
This commit is contained in:
@@ -4,6 +4,7 @@ const b = {
|
|||||||
dmgScale: null, //scales all gun damage from momentum, but not raw .dmg //this is reset in game.reset
|
dmgScale: null, //scales all gun damage from momentum, but not raw .dmg //this is reset in game.reset
|
||||||
gravity: 0.0006, //most other bodies have gravity = 0.001
|
gravity: 0.0006, //most other bodies have gravity = 0.001
|
||||||
//variables use for gun mod upgrades
|
//variables use for gun mod upgrades
|
||||||
|
modCount: null,
|
||||||
modFireRate: null,
|
modFireRate: null,
|
||||||
modExplosionRadius: null,
|
modExplosionRadius: null,
|
||||||
modBulletSize: null,
|
modBulletSize: null,
|
||||||
@@ -14,6 +15,7 @@ const b = {
|
|||||||
modIsImmortal: null,
|
modIsImmortal: null,
|
||||||
modSpores: null,
|
modSpores: null,
|
||||||
setModDefaults() {
|
setModDefaults() {
|
||||||
|
b.modCount = 0;
|
||||||
b.modFireRate = 1;
|
b.modFireRate = 1;
|
||||||
b.modExplosionRadius = 1;
|
b.modExplosionRadius = 1;
|
||||||
b.modBulletSize = 1;
|
b.modBulletSize = 1;
|
||||||
@@ -119,6 +121,7 @@ const b = {
|
|||||||
],
|
],
|
||||||
giveMod(i) {
|
giveMod(i) {
|
||||||
b.mods[i].effect(); //give specific mod
|
b.mods[i].effect(); //give specific mod
|
||||||
|
b.modCount++
|
||||||
b.mods[i].have = true
|
b.mods[i].have = true
|
||||||
game.updateModHUD();
|
game.updateModHUD();
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -308,7 +308,7 @@ const game = {
|
|||||||
powerUps.spawn(game.mouseInGame.x, game.mouseInGame.y, "field");
|
powerUps.spawn(game.mouseInGame.x, game.mouseInGame.y, "field");
|
||||||
powerUps.spawn(game.mouseInGame.x, game.mouseInGame.y, "heal");
|
powerUps.spawn(game.mouseInGame.x, game.mouseInGame.y, "heal");
|
||||||
powerUps.spawn(game.mouseInGame.x, game.mouseInGame.y, "heal");
|
powerUps.spawn(game.mouseInGame.x, game.mouseInGame.y, "heal");
|
||||||
if (!powerUps.haveAllMods) powerUps.spawn(game.mouseInGame.x, game.mouseInGame.y, "mod");
|
powerUps.spawn(game.mouseInGame.x, game.mouseInGame.y, "mod");
|
||||||
}
|
}
|
||||||
if (keys[89]) { //add all mods with y
|
if (keys[89]) { //add all mods with y
|
||||||
for (let i = 0; i < b.mods.length; i++) {
|
for (let i = 0; i < b.mods.length; i++) {
|
||||||
|
|||||||
@@ -76,7 +76,6 @@ const powerUps = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
haveAllMods: false,
|
|
||||||
mod: {
|
mod: {
|
||||||
name: "mod",
|
name: "mod",
|
||||||
color: "#a8f",
|
color: "#a8f",
|
||||||
@@ -91,7 +90,6 @@ const powerUps = {
|
|||||||
}
|
}
|
||||||
//give a random mod from the mods I don't have
|
//give a random mod from the mods I don't have
|
||||||
if (options.length > 0) {
|
if (options.length > 0) {
|
||||||
if (options.length === 1) powerUps.haveAllMods = true
|
|
||||||
let newMod = options[Math.floor(Math.random() * options.length)]
|
let newMod = options[Math.floor(Math.random() * options.length)]
|
||||||
b.giveMod(newMod)
|
b.giveMod(newMod)
|
||||||
game.makeTextLog(`<div class="circle mod"></div> <strong style='font-size:30px;'>${b.mods[newMod].name}</strong><br><br> ${b.mods[newMod].description}`, 1000);
|
game.makeTextLog(`<div class="circle mod"></div> <strong style='font-size:30px;'>${b.mods[newMod].name}</strong><br><br> ${b.mods[newMod].description}`, 1000);
|
||||||
@@ -146,7 +144,7 @@ const powerUps = {
|
|||||||
powerUps.spawn(x, y, "gun");
|
powerUps.spawn(x, y, "gun");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Math.random() < 0.007 && !powerUps.haveAllMods) {
|
if (Math.random() < 0.0015 * (b.mods.length - b.modCount)) {
|
||||||
powerUps.spawn(x, y, "mod");
|
powerUps.spawn(x, y, "mod");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -158,7 +156,7 @@ const powerUps = {
|
|||||||
spawnBossPowerUp(x, y) { //boss spawns field and gun mod upgrades
|
spawnBossPowerUp(x, y) { //boss spawns field and gun mod upgrades
|
||||||
if (mech.fieldMode === 0) {
|
if (mech.fieldMode === 0) {
|
||||||
powerUps.spawn(x, y, "field")
|
powerUps.spawn(x, y, "field")
|
||||||
} else if (Math.random() < 0.35 && !powerUps.haveAllMods) {
|
} else if (Math.random() < 0.047 * (b.mods.length - b.modCount)) {
|
||||||
powerUps.spawn(x, y, "mod")
|
powerUps.spawn(x, y, "mod")
|
||||||
} else if (Math.random() < 0.25) {
|
} else if (Math.random() < 0.25) {
|
||||||
powerUps.spawn(x, y, "field");
|
powerUps.spawn(x, y, "field");
|
||||||
|
|||||||
Reference in New Issue
Block a user