diff --git a/js/bullets.js b/js/bullets.js
index ef47558..c32e171 100644
--- a/js/bullets.js
+++ b/js/bullets.js
@@ -46,21 +46,6 @@ const b = {
isModEnergyRecovery: null,
isModHealthRecovery: null,
isModEnergyLoss: null,
- removeAllMods() {
- for (let i = 0, len = b.mods.length; i < len; i++) {
- b.mods[i].remove();
- b.mods[i].count = 0
- }
- b.modCount = 0;
-
- },
- setModDefaults() {
- for (let i = 0, len = b.mods.length; i < len; i++) {
- if (b.mods[i].count) b.mods[i].remove();
- b.mods[i].count = 0
- }
- b.modCount = 0;
- },
modOnHealthChange() { //used with acid mod
if (b.isModAcidDmg && mech.health > 0.8) {
game.playerDmgColor = "rgba(0,80,80,0.9)"
@@ -139,7 +124,7 @@ const b = {
maxCount: 1,
count: 0,
allowed() {
- return mech.health < 0.75
+ return mech.health < 0.75 || level.isBuildRun
},
effect() {
b.isModLowHealthDmg = true; //used in mob.damage()
@@ -215,7 +200,7 @@ const b = {
maxCount: 3,
count: 0,
allowed() {
- return b.haveGunCheck("spores") || b.haveGunCheck("drones") || b.haveGunCheck("super balls") || b.haveGunCheck("foam")
+ return mech.fieldUpgrades[mech.fieldMode].name === "nano-scale manufacturing" || b.haveGunCheck("spores") || b.haveGunCheck("drones") || b.haveGunCheck("super balls") || b.haveGunCheck("foam")
},
effect() {
b.isModBulletsLastLonger += 0.33
@@ -369,7 +354,7 @@ const b = {
},
{
name: "scrap recycling",
- description: "regen up to 1% of max health every second active for 5 seconds after a mob dies",
+ description: "heal up to 1% of max health every second active for 5 seconds after a mob dies",
maxCount: 1,
count: 0,
allowed() {
@@ -388,7 +373,7 @@ const b = {
maxCount: 1,
count: 0,
allowed() {
- return b.isModHealthRecovery
+ return b.isModEnergyRecovery
},
effect() {
b.isModEnergyLoss = true;
@@ -422,7 +407,7 @@ const b = {
maxCount: 1,
count: 0,
allowed() {
- return b.modSquirrelFx === 1.2
+ return b.modSquirrelFx > 1
},
effect() {
b.isModStomp = true
@@ -547,7 +532,7 @@ const b = {
maxCount: 9,
count: 0,
allowed() {
- return mech.health < 0.7
+ return mech.health < 0.7 || level.isBuildRun
},
effect() {
b.modRecursiveHealing += 1
@@ -661,7 +646,7 @@ const b = {
maxCount: 1,
count: 0,
allowed() {
- return (b.modCount > 6)
+ return (b.modCount > 6) && !level.isBuildRun
},
effect: () => {
let count = b.modCount
@@ -669,7 +654,7 @@ const b = {
for (let i = 0; i < count; i++) { // spawn new mods
powerUps.spawn(mech.pos.x, mech.pos.y, "mod");
}
- b.setModDefaults(); // remove all mods
+ b.setupAllMods(); // remove all mods
//have state is checked in mech.death()
},
remove() {
@@ -723,7 +708,7 @@ const b = {
},
{
name: "specular reflection",
- description: "your laser gains +1 reflection +20% laser damage and energy drain",
+ description: "your laser gains +1 reflection +30% laser damage and energy drain",
maxCount: 9,
count: 0,
allowed() {
@@ -731,8 +716,8 @@ const b = {
},
effect() {
b.modLaserReflections++;
- b.modLaserDamage += 0.010; //base is 0.05
- b.modLaserFieldDrain += 0.0004 //base is 0.002
+ b.modLaserDamage += 0.015; //base is 0.05
+ b.modLaserFieldDrain += 0.0006 //base is 0.002
},
remove() {
b.modLaserReflections = 2;
@@ -772,6 +757,27 @@ const b = {
// }
// },
],
+ removeMod(index) {
+ b.mods[index].remove();
+ b.mods[index].count = 0;
+ game.updateModHUD();
+ },
+ setupAllMods() {
+ for (let i = 0, len = b.mods.length; i < len; i++) {
+ b.mods[i].remove();
+ b.mods[i].count = 0
+ }
+ b.modCount = 0;
+ game.updateModHUD();
+ },
+ // setupAllMods() {
+ // for (let i = 0, len = b.mods.length; i < len; i++) {
+ // if (b.mods[i].count) b.mods[i].remove();
+ // b.mods[i].count = 0
+ // }
+ // b.modCount = 0;
+ // game.updateModHUD();
+ // },
giveMod(index = 'random') {
if (index === 'random') {
let options = [];
diff --git a/js/game.js b/js/game.js
index 9ee2aff..d4168a6 100644
--- a/js/game.js
+++ b/js/game.js
@@ -437,7 +437,7 @@ const game = {
}
b.activeGun = null;
- b.removeAllMods(); //sets mods to defauls values
+ b.setupAllMods(); //sets mods to default values
game.updateModHUD();
mech.maxHealth = 1
mech.fieldEnergyMax = 1
@@ -533,7 +533,7 @@ const game = {
if (game.firstRun) {
mech.spawn(); //spawns the player
- b.setModDefaults(); //doesn't run on reset so that gun mods carry over to new runs
+ b.setupAllMods(); //doesn't run on reset so that gun mods carry over to new runs
function shuffle(array) {
var currentIndex = array.length,
diff --git a/js/index.js b/js/index.js
index 3534708..6087db7 100644
--- a/js/index.js
+++ b/js/index.js
@@ -14,147 +14,6 @@ const cat = {
//build build grid display
const build = {
- choosePowerUp(who, index, type) {
-
- // mech.setField(build.list[i].index)
- // b.giveGuns(build.list[i].index)
- // b.giveMod(build.list[i].index)
-
-
- if (type === "field" || type === "gun") {
- let isDeselect = false
- //if already click, toggle off
- for (let i = 0; i < build.list.length; i++) {
- if (build.list[i].index === index && build.list[i].type === type) {
- build.list.splice(i, 1);
- who.style.backgroundColor = "#fff"
- isDeselect = true
- break
- }
- }
- //check if trying to get a second field
- if (type === "field") {
- mech.setField(index)
- for (let i = 0; i < build.list.length; i++) {
- if (build.list[i].type === "field") { //if already click, toggle off
- build.list[i].who.style.backgroundColor = "#fff"
- build.list.splice(i, 1);
- }
- }
- }
- if (!isDeselect) {
- who.style.backgroundColor = "#919ba8" //"#868f9a"
- build.list[build.list.length] = {
- who: who,
- index: index,
- type: type,
- }
- }
- } else if (type === "mod") {
- if (who.style.backgroundColor !== "#919ba8") who.style.backgroundColor = "#919ba8" //"#868f9a"
- //if already clicked graphically indicate recursive clicks
- let count = 0
- for (let i = 0; i < build.list.length; i++) {
- if (build.list[i].type === "mod" && build.list[i].index === index) {
- count++
- }
- }
- if (count < b.mods[index].maxCount) {
- //add mod to build list
- build.list[build.list.length] = {
- who: who,
- index: index,
- type: type,
- }
- count++
- //display mod count in grid box text
- if (count > 1) who.innerHTML = `
${b.mods[index].name} (${count}x)
${b.mods[index].description}`
- } else {
- //when above the mod limit remove all of that mod
- for (let i = build.list.length - 1; i > -1; i--) {
- if (build.list[i].index === index && build.list[i].type === type) {
- build.list.splice(i, 1);
- }
- }
- //and reset the text
- who.style.backgroundColor = "#fff"
- who.innerHTML = `