working on mod display

This commit is contained in:
landgreen
2019-10-26 17:15:08 -07:00
parent 6c54ed8918
commit e3e92c8d69
8 changed files with 212 additions and 108 deletions

View File

@@ -53,9 +53,9 @@ const powerUps = {
while (mode === b.mod) {
mode = Math.floor(Math.random() * b.mods.length)
}
b.mods[mode](); //choose random upgrade that you don't already have
b.mods[mode].effect(); //choose random upgrade that you don't already have
} else {
b.mods[this.mode](); //set a predetermined power up
b.mods[this.mode].effect(); //set a predetermined power up
}
if (previousMode != null) { //pop the old field out in case player wants to swap back
mech.fieldCDcycle = mech.cycle + 40; //trigger fieldCD to stop power up grab automatic pick up of spawn
@@ -109,8 +109,12 @@ const powerUps = {
effect() {
//find what guns I don't have
let options = [];
for (let i = 0; i < b.guns.length; ++i) {
if (!b.guns[i].have) options.push(i);
if (b.activeGun === null) { //the first gun is good for the early game
options = [0, 1, 2, 3, 4, 5, 6, 8, 9, 12]
} else {
for (let i = 0; i < b.guns.length; ++i) {
if (!b.guns[i].have) options.push(i);
}
}
//give player a gun they don't already have if possible
if (options.length > 0) {
@@ -125,9 +129,9 @@ const powerUps = {
);
}
if (b.inventory.length === 1) { //on the second gun pick up tell player how to change guns
game.makeTextLog(`<strong style='font-size:30px;'>${b.guns[newGun].name}</strong><br>(left click)<br>(<strong>Q</strong>, <strong>E</strong>, and <strong>mouse wheel</strong> change weapons)<p>${b.guns[newGun].description}</p>`, 1000);
game.makeTextLog(`(<strong>Q</strong>, <strong>E</strong>, and <strong>mouse wheel</strong> change weapons)<br><br><strong style='font-size:30px;'>${b.guns[newGun].name}</strong><br><span class='faded'>(left click)</span><p>${b.guns[newGun].description}</p>`, 1000);
} else {
game.makeTextLog(`<strong style='font-size:30px;'>${b.guns[newGun].name}</strong><br> (left click)<p>${b.guns[newGun].description}</p>`, 1000);
game.makeTextLog(`<strong style='font-size:30px;'>${b.guns[newGun].name}</strong><br><span class='faded'>(left click)</span><p>${b.guns[newGun].description}</p>`, 1000);
}
b.guns[newGun].have = true;
b.inventory.push(newGun);