console style
updated in game console style and all messages to match real game commands new names inline with lore, mod -> tech, game -> simulation this is probably going to cause many minor bugs, so let me know what you find new reroll display in power up selection tech: rocket-propelled now works with all grenade tech
This commit is contained in:
377
js/powerup.js
377
js/powerup.js
@@ -1,23 +1,22 @@
|
||||
let powerUp = [];
|
||||
|
||||
const powerUps = {
|
||||
totalPowerUps: 0, //used for mods that count power ups at the end of a level
|
||||
totalPowerUps: 0, //used for tech that count power ups at the end of a level
|
||||
choose(type, index) {
|
||||
if (type === "gun") {
|
||||
b.giveGuns(index)
|
||||
// game.replaceTextLog = true;
|
||||
// game.makeTextLog(`${game.SVGleftMouse} <strong style='font-size:30px;'>${b.guns[index].name}</strong><br><br>${b.guns[index].description}`, 500);
|
||||
// game.replaceTextLog = false;
|
||||
let text = `b.giveGuns("<span class='color-text'>${b.guns[index].name}</span>")`
|
||||
if (b.inventory.length === 1) text += `<br>input.key.gun <span class='color-symbol'>=</span> ["<span class='color-text'>MouseLeft</span>"]`
|
||||
if (b.inventory.length === 2) text += `
|
||||
<br>input.key.nextGun <span class='color-symbol'>=</span> ["<span class='color-text'>${input.key.nextGun}</span>","<span class='color-text'>MouseWheel</span>"]
|
||||
<br>input.key.previousGun <span class='color-symbol'>=</span> ["<span class='color-text'>${input.key.previousGun}</span>","<span class='color-text'>MouseWheel</span>"]`
|
||||
simulation.makeTextLog(text);
|
||||
} else if (type === "field") {
|
||||
mech.setField(index)
|
||||
// game.replaceTextLog = true;
|
||||
// game.makeTextLog(`${game.SVGrightMouse}<strong style='font-size:30px;'> ${mech.fieldUpgrades[mech.fieldMode].name}</strong><br><span class='faded'></span><br>${mech.fieldUpgrades[mech.fieldMode].description}`, 600);
|
||||
// game.replaceTextLog = false;
|
||||
} else if (type === "mod") {
|
||||
mod.giveMod(index)
|
||||
// game.replaceTextLog = true;
|
||||
// game.makeTextLog(`<div class="circle mod"></div> <strong style='font-size:30px;'>${mod.mods[index].name}</strong><br><br> ${mod.mods[index].description}`, 500);
|
||||
// game.replaceTextLog = false;
|
||||
simulation.makeTextLog(`<span class='color-var'>mech</span>.setField("<span class='color-text'>${mech.fieldUpgrades[mech.fieldMode].name}</span>")`);
|
||||
} else if (type === "tech") {
|
||||
tech.giveMod(index)
|
||||
simulation.makeTextLog(`<span class='color-var'>tech</span>.giveMod("<span class='color-text'>${tech.tech[index].name}</span>")`);
|
||||
}
|
||||
powerUps.endDraft(type);
|
||||
},
|
||||
@@ -27,45 +26,45 @@ const powerUps = {
|
||||
document.getElementById("choose-background").style.display = "inline"
|
||||
|
||||
document.body.style.cursor = "auto";
|
||||
if (mod.isExtraChoice) {
|
||||
if (tech.isExtraChoice) {
|
||||
document.body.style.overflowY = "scroll";
|
||||
document.body.style.overflowX = "hidden";
|
||||
}
|
||||
game.paused = true;
|
||||
game.isChoosing = true; //stops p from un pausing on key down
|
||||
simulation.paused = true;
|
||||
simulation.isChoosing = true; //stops p from un pausing on key down
|
||||
build.pauseGrid(true)
|
||||
},
|
||||
endDraft(type, isCanceled = false) {
|
||||
if (isCanceled) {
|
||||
if (mod.isCancelDuplication) mod.cancelCount++
|
||||
if (mod.isCancelRerolls) {
|
||||
let spawnType = (mech.health < 0.25 || mod.isEnergyNoAmmo) ? "heal" : "ammo"
|
||||
if (tech.isCancelDuplication) tech.cancelCount++
|
||||
if (tech.isCancelRerolls) {
|
||||
let spawnType = (mech.health < 0.25 || tech.isEnergyNoAmmo) ? "heal" : "ammo"
|
||||
if (Math.random() < 0.33) {
|
||||
spawnType = "heal"
|
||||
} else if (Math.random() < 0.5 && !mod.isSuperDeterminism) {
|
||||
} else if (Math.random() < 0.5 && !tech.isSuperDeterminism) {
|
||||
spawnType = "reroll"
|
||||
}
|
||||
for (let i = 0; i < 6; i++) powerUps.spawn(mech.pos.x + 40 * (Math.random() - 0.5), mech.pos.y + 40 * (Math.random() - 0.5), spawnType, false);
|
||||
}
|
||||
if (mod.isBanish && type === 'mod') { // banish rerolled mods by adding them to the list of banished mods
|
||||
const banishLength = mod.isDeterminism ? 1 : 3 + mod.isExtraChoice * 2
|
||||
if (powerUps.mod.choiceLog.length > banishLength || powerUps.mod.choiceLog.length === banishLength) { //I'm not sure this check is needed
|
||||
if (tech.isBanish && type === 'tech') { // banish rerolled tech by adding them to the list of banished tech
|
||||
const banishLength = tech.isDeterminism ? 1 : 3 + tech.isExtraChoice * 2
|
||||
if (powerUps.tech.choiceLog.length > banishLength || powerUps.tech.choiceLog.length === banishLength) { //I'm not sure this check is needed
|
||||
for (let i = 0; i < banishLength; i++) {
|
||||
powerUps.mod.banishLog.push(powerUps.mod.choiceLog[powerUps.mod.choiceLog.length - 1 - i])
|
||||
powerUps.tech.banishLog.push(powerUps.tech.choiceLog[powerUps.tech.choiceLog.length - 1 - i])
|
||||
}
|
||||
}
|
||||
game.makeTextLog(`about ${Math.max(0,powerUps.mod.lastTotalChoices - powerUps.mod.banishLog.length)} estimated <strong class='color-m'>mods</strong> left`, 300)
|
||||
simulation.makeTextLog(`${Math.max(0,powerUps.tech.lastTotalChoices - powerUps.tech.banishLog.length)} estimated <strong class='color-m'>tech</strong> choices remaining`)
|
||||
}
|
||||
}
|
||||
if (mod.manyWorlds && powerUps.reroll.rerolls === 0) {
|
||||
if (tech.manyWorlds && powerUps.reroll.rerolls === 0) {
|
||||
for (let i = 0; i < 2; i++) powerUps.spawn(mech.pos.x + 40 * (Math.random() - 0.5), mech.pos.y + 40 * (Math.random() - 0.5), "reroll", false);
|
||||
}
|
||||
document.getElementById("choose-grid").style.display = "none"
|
||||
document.getElementById("choose-background").style.display = "none"
|
||||
document.body.style.cursor = "none";
|
||||
document.body.style.overflow = "hidden"
|
||||
game.paused = false;
|
||||
game.isChoosing = false; //stops p from un pausing on key down
|
||||
simulation.paused = false;
|
||||
simulation.isChoosing = false; //stops p from un pausing on key down
|
||||
mech.immuneCycle = mech.cycle + 60; //player is immune to collision damage for 30 cycles
|
||||
build.unPauseGrid()
|
||||
requestAnimationFrame(cycle);
|
||||
@@ -79,17 +78,21 @@ const powerUps = {
|
||||
},
|
||||
effect() {
|
||||
powerUps.reroll.changeRerolls(1)
|
||||
game.makeTextLog(`<div class='circle reroll'></div> <span style='font-size:115%;'><strong>rerolls:</strong> ${powerUps.reroll.rerolls}</span>`, 300)
|
||||
},
|
||||
changeRerolls(amount) {
|
||||
powerUps.reroll.rerolls += amount
|
||||
if (powerUps.reroll.rerolls < 0) powerUps.reroll.rerolls = 0
|
||||
if (powerUps.reroll.rerolls < 0) {
|
||||
powerUps.reroll.rerolls = 0
|
||||
} else {
|
||||
simulation.makeTextLog(`powerUps.reroll.rerolls <span class='color-symbol'>+=</span> ${amount}`) // <br>${powerUps.reroll.rerolls}
|
||||
}
|
||||
|
||||
if (mod.isRerollBots) {
|
||||
|
||||
if (tech.isRerollBots) {
|
||||
const limit = 5
|
||||
for (; powerUps.reroll.rerolls > limit - 1; powerUps.reroll.rerolls -= limit) {
|
||||
b.randomBot()
|
||||
if (mod.renormalization) {
|
||||
if (tech.renormalization) {
|
||||
for (let i = 0; i < limit; i++) {
|
||||
if (Math.random() < 0.37) {
|
||||
mech.fieldCDcycle = mech.cycle + 30;
|
||||
@@ -99,54 +102,32 @@ const powerUps = {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mod.isDeathAvoid && document.getElementById("mod-anthropic")) {
|
||||
document.getElementById("mod-anthropic").innerHTML = `-${powerUps.reroll.rerolls}`
|
||||
if (tech.isDeathAvoid && document.getElementById("tech-anthropic")) {
|
||||
document.getElementById("tech-anthropic").innerHTML = `-${powerUps.reroll.rerolls}`
|
||||
}
|
||||
if (mod.renormalization && Math.random() < 0.37 && amount < 0) powerUps.spawn(mech.pos.x, mech.pos.y, "reroll");
|
||||
if (mod.isRerollHaste) {
|
||||
if (tech.renormalization && Math.random() < 0.37 && amount < 0) powerUps.spawn(mech.pos.x, mech.pos.y, "reroll");
|
||||
if (tech.isRerollHaste) {
|
||||
if (powerUps.reroll.rerolls === 0) {
|
||||
mod.rerollHaste = 0.66;
|
||||
tech.rerollHaste = 0.66;
|
||||
b.setFireCD();
|
||||
} else {
|
||||
mod.rerollHaste = 1;
|
||||
tech.rerollHaste = 1;
|
||||
b.setFireCD();
|
||||
}
|
||||
}
|
||||
},
|
||||
diceText() {
|
||||
const diceLimit = 5
|
||||
const r = powerUps.reroll.rerolls
|
||||
const fullDice = Math.min(Math.floor(r / 6), diceLimit)
|
||||
const lastDice = r % 6
|
||||
let out = ''
|
||||
if (Math.floor(r / 6) > diceLimit) out += "+"
|
||||
for (let i = 0; i < fullDice; i++) {
|
||||
out += '⚅'
|
||||
}
|
||||
if (lastDice === 1) {
|
||||
out += '⚀'
|
||||
} else if (lastDice === 2) {
|
||||
out += '⚁'
|
||||
} else if (lastDice === 3) {
|
||||
out += '⚂'
|
||||
} else if (lastDice === 4) {
|
||||
out += '⚃'
|
||||
} else if (lastDice === 5) {
|
||||
out += '⚄'
|
||||
}
|
||||
return out
|
||||
},
|
||||
use(type) { //runs when you actually reroll a list of selections, type can be field, gun, or mod
|
||||
use(type) { //runs when you actually reroll a list of selections, type can be field, gun, or tech
|
||||
powerUps.reroll.changeRerolls(-1)
|
||||
|
||||
if (mod.isBanish && type === 'mod') { // banish rerolled mods
|
||||
const banishLength = mod.isDeterminism ? 1 : 3 + mod.isExtraChoice * 2
|
||||
if (powerUps.mod.choiceLog.length > banishLength || powerUps.mod.choiceLog.length === banishLength) { //I'm not sure this check is needed
|
||||
// simulation.makeTextLog(`<span class='color-var'>mech</span>.<span class='color-r'>rerolls</span><span class='color-symbol'>--</span>
|
||||
// <br>${powerUps.reroll.rerolls}`)
|
||||
if (tech.isBanish && type === 'tech') { // banish rerolled tech
|
||||
const banishLength = tech.isDeterminism ? 1 : 3 + tech.isExtraChoice * 2
|
||||
if (powerUps.tech.choiceLog.length > banishLength || powerUps.tech.choiceLog.length === banishLength) { //I'm not sure this check is needed
|
||||
for (let i = 0; i < banishLength; i++) {
|
||||
powerUps.mod.banishLog.push(powerUps.mod.choiceLog[powerUps.mod.choiceLog.length - 1 - i])
|
||||
powerUps.tech.banishLog.push(powerUps.tech.choiceLog[powerUps.tech.choiceLog.length - 1 - i])
|
||||
}
|
||||
}
|
||||
game.makeTextLog(`about ${Math.max(0,powerUps.mod.lastTotalChoices - powerUps.mod.banishLog.length)} estimated <strong class='color-m'>mods</strong> left`, 300)
|
||||
simulation.makeTextLog(`${Math.max(0,powerUps.tech.lastTotalChoices - powerUps.tech.banishLog.length)} estimated <strong class='color-m'>tech</strong> choices remaining`)
|
||||
}
|
||||
powerUps[type].effect();
|
||||
},
|
||||
@@ -155,24 +136,26 @@ const powerUps = {
|
||||
name: "heal",
|
||||
color: "#0eb",
|
||||
size() {
|
||||
return 40 * (game.healScale ** 0.25) * Math.sqrt(mod.largerHeals) * Math.sqrt(0.1 + Math.random() * 0.5); //(game.healScale ** 0.25) gives a smaller radius as heal scale goes down
|
||||
return 40 * (simulation.healScale ** 0.25) * Math.sqrt(tech.largerHeals) * Math.sqrt(0.1 + Math.random() * 0.5); //(simulation.healScale ** 0.25) gives a smaller radius as heal scale goes down
|
||||
},
|
||||
effect() {
|
||||
if (!mod.isEnergyHealth && mech.alive) {
|
||||
const heal = mod.largerHeals * (this.size / 40 / Math.sqrt(mod.largerHeals) / (game.healScale ** 0.25)) ** 2 //heal scale is undone here because heal scale is properly affected on mech.addHealth()
|
||||
if (!tech.isEnergyHealth && mech.alive) {
|
||||
const heal = tech.largerHeals * (this.size / 40 / Math.sqrt(tech.largerHeals) / (simulation.healScale ** 0.25)) ** 2 //heal scale is undone here because heal scale is properly affected on mech.addHealth()
|
||||
if (heal > 0) {
|
||||
game.makeTextLog("<div class='circle heal'></div> <span style='font-size:115%;'> <strong style = 'letter-spacing: 2px;'>heal</strong> " + (Math.min(mech.maxHealth - mech.health, heal) * game.healScale * 100).toFixed(0) + "%</span>", 300)
|
||||
const healOutput = Math.min(mech.maxHealth - mech.health, heal) * simulation.healScale
|
||||
mech.addHealth(heal);
|
||||
simulation.makeTextLog(`<span class='color-var'>mech</span>.health <span class='color-symbol'>+=</span> ${(healOutput).toFixed(3)}`) // <br>${mech.health.toFixed(3)}
|
||||
// simulation.makeTextLog("<div class='circle heal'></div> <span style='font-size:115%;'> <strong style = 'letter-spacing: 2px;'>heal</strong> " + (Math.min(mech.maxHealth - mech.health, heal) * simulation.healScale * 100).toFixed(0) + "%</span>", 300)
|
||||
}
|
||||
}
|
||||
if (mod.healGiveMaxEnergy) {
|
||||
mod.healMaxEnergyBonus += 0.04
|
||||
if (tech.healGiveMaxEnergy) {
|
||||
tech.healMaxEnergyBonus += 0.04
|
||||
mech.setMaxEnergy();
|
||||
}
|
||||
},
|
||||
spawn(x, y, size) { //used to spawn a heal with a specific size / heal amount, not normally used
|
||||
powerUps.directSpawn(x, y, "heal", false, null, size)
|
||||
if (Math.random() < mod.duplicationChance()) {
|
||||
if (Math.random() < tech.duplicationChance()) {
|
||||
powerUps.directSpawn(x, y, "heal", false, null, size)
|
||||
powerUp[powerUp.length - 1].isBonus = true
|
||||
}
|
||||
@@ -186,20 +169,27 @@ const powerUps = {
|
||||
},
|
||||
effect() {
|
||||
//give ammo to all guns in inventory
|
||||
if (mod.isAmmoForGun && b.inventory.length > 0) {
|
||||
if (tech.isAmmoForGun && b.inventory.length > 0) {
|
||||
const target = b.guns[b.activeGun]
|
||||
const ammoAdded = Math.ceil(Math.random() * target.ammoPack) + Math.ceil(Math.random() * target.ammoPack)
|
||||
target.ammo += ammoAdded
|
||||
// game.makeTextLog(`<div class='circle gun'></div> ${ammoAdded} ammo added`, 300)
|
||||
// simulation.makeTextLog(`<div class='circle gun'></div> ${ammoAdded} ammo added`, 300)
|
||||
simulation.makeTextLog(`${target.name}.<span class='color-gun'>ammo</span> <span class='color-symbol'>+=</span> ${ammoAdded}
|
||||
<br>${target.ammo}`)
|
||||
} else {
|
||||
let text = '';
|
||||
for (let i = 0, len = b.inventory.length; i < len; i++) {
|
||||
const target = b.guns[b.inventory[i]]
|
||||
if (target.ammo !== Infinity) {
|
||||
target.ammo += Math.ceil(Math.random() * target.ammoPack)
|
||||
const ammoAdded = Math.ceil(Math.random() * target.ammoPack)
|
||||
target.ammo += ammoAdded
|
||||
if (i !== 0) text += "<br>"
|
||||
text += `${target.name}.<span class='color-gun'>ammo</span> <span class='color-symbol'>+=</span> ${ammoAdded}`
|
||||
}
|
||||
}
|
||||
simulation.makeTextLog(text)
|
||||
}
|
||||
game.updateGunHUD();
|
||||
simulation.updateGunHUD();
|
||||
}
|
||||
},
|
||||
field: {
|
||||
@@ -216,7 +206,7 @@ const powerUps = {
|
||||
if (i !== mech.fieldMode && i !== skip1 && i !== skip2 && i !== skip3 && i !== skip4) options.push(i);
|
||||
}
|
||||
//remove repeats from last selection
|
||||
const totalChoices = mod.isDeterminism ? 1 : 3 + mod.isExtraChoice * 2
|
||||
const totalChoices = tech.isDeterminism ? 1 : 3 + tech.isExtraChoice * 2
|
||||
if (powerUps.field.choiceLog.length > totalChoices || powerUps.field.choiceLog.length === totalChoices) { //make sure this isn't the first time getting a power up and there are previous choices to remove
|
||||
for (let i = 0; i < totalChoices; i++) { //repeat for each choice from the last selection
|
||||
if (options.length > totalChoices) {
|
||||
@@ -239,16 +229,16 @@ const powerUps = {
|
||||
let choice3 = -1
|
||||
if (choice1 > -1) {
|
||||
let text = ""
|
||||
if (!mod.isDeterminism) text += `<div class='cancel' onclick='powerUps.endDraft("field",true)'>✕</div>`
|
||||
text += `<h3 style = 'color:#fff; text-align:left; margin: 0px;'>choose a field</h3>`
|
||||
if (!tech.isDeterminism) text += `<div class='cancel' onclick='powerUps.endDraft("field",true)'>✕</div>`
|
||||
text += `<h3 style = 'color:#fff; text-align:left; margin: 0px;'>field</h3>`
|
||||
text += `<div class="choose-grid-module" onclick="powerUps.choose('field',${choice1})"><div class="grid-title"><div class="circle-grid field"></div> ${mech.fieldUpgrades[choice1].name}</div> ${mech.fieldUpgrades[choice1].description}</div>`
|
||||
if (!mod.isDeterminism) {
|
||||
if (!tech.isDeterminism) {
|
||||
choice2 = pick(mech.fieldUpgrades, choice1)
|
||||
if (choice2 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('field',${choice2})"><div class="grid-title"><div class="circle-grid field"></div> ${mech.fieldUpgrades[choice2].name}</div> ${mech.fieldUpgrades[choice2].description}</div>`
|
||||
choice3 = pick(mech.fieldUpgrades, choice1, choice2)
|
||||
if (choice3 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('field',${choice3})"><div class="grid-title"><div class="circle-grid field"></div> ${mech.fieldUpgrades[choice3].name}</div> ${mech.fieldUpgrades[choice3].description}</div>`
|
||||
}
|
||||
if (mod.isExtraChoice) {
|
||||
if (tech.isExtraChoice) {
|
||||
let choice4 = pick(mech.fieldUpgrades, choice1, choice2, choice3)
|
||||
if (choice4 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('field',${choice4})"><div class="grid-title"><div class="circle-grid field"></div> ${mech.fieldUpgrades[choice4].name}</div> ${mech.fieldUpgrades[choice4].description}</div>`
|
||||
let choice5 = pick(mech.fieldUpgrades, choice1, choice2, choice3, choice4)
|
||||
@@ -260,9 +250,13 @@ const powerUps = {
|
||||
powerUps.field.choiceLog.push(choice2)
|
||||
powerUps.field.choiceLog.push(choice3)
|
||||
|
||||
if (powerUps.reroll.rerolls) text += `<div class="choose-grid-module" onclick="powerUps.reroll.use('field')"><div class="grid-title"><div class="circle-grid reroll"></div> reroll <span class='dice'>${powerUps.reroll.diceText()}</span></div></div>`
|
||||
|
||||
// text += `<div style = 'color:#fff'>${game.SVGrightMouse} activate the shield with the right mouse<br>fields shield you from damage <br>and let you pick up and throw blocks</div>`
|
||||
if (powerUps.reroll.rerolls) {
|
||||
text += `<div class="choose-grid-module" onclick="powerUps.reroll.use('field')"><div class="grid-title"> <span style="position:relative;">`
|
||||
for (let i = 0, len = Math.min(powerUps.reroll.rerolls, 30); i < len; i++) text += `<div class="circle-grid reroll" style="position:absolute; top:0; left:${(18 - len*0.3)*i}px ;opacity:0.8; border: 1px #fff solid;"></div>`
|
||||
text += `</span><span class='reroll-select'>reroll</span></div></div>`
|
||||
}
|
||||
//(${powerUps.reroll.rerolls})
|
||||
// text += `<div style = 'color:#fff'>${simulation.SVGrightMouse} activate the shield with the right mouse<br>fields shield you from damage <br>and let you pick up and throw blocks</div>`
|
||||
document.getElementById("choose-grid").innerHTML = text
|
||||
powerUps.showDraft();
|
||||
} else {
|
||||
@@ -270,42 +264,42 @@ const powerUps = {
|
||||
}
|
||||
}
|
||||
},
|
||||
mod: {
|
||||
name: "mod",
|
||||
tech: {
|
||||
name: "tech",
|
||||
color: "hsl(246,100%,77%)", //"#a8f",
|
||||
size() {
|
||||
return 42;
|
||||
},
|
||||
choiceLog: [], //records all previous choice options
|
||||
lastTotalChoices: 0, //tracks how many mods were available for random selection last time a mod was picked up
|
||||
banishLog: [], //records all mods permanently removed from the selection pool
|
||||
lastTotalChoices: 0, //tracks how many tech were available for random selection last time a tech was picked up
|
||||
banishLog: [], //records all tech permanently removed from the selection pool
|
||||
effect() {
|
||||
if (mech.alive) {
|
||||
function pick(skip1 = -1, skip2 = -1, skip3 = -1, skip4 = -1) {
|
||||
let options = [];
|
||||
for (let i = 0; i < mod.mods.length; i++) {
|
||||
if (mod.mods[i].count < mod.mods[i].maxCount && i !== skip1 && i !== skip2 && i !== skip3 && i !== skip4 && mod.mods[i].allowed()) {
|
||||
for (let i = 0; i < tech.tech.length; i++) {
|
||||
if (tech.tech[i].count < tech.tech[i].maxCount && i !== skip1 && i !== skip2 && i !== skip3 && i !== skip4 && tech.tech[i].allowed()) {
|
||||
options.push(i);
|
||||
}
|
||||
}
|
||||
powerUps.mod.lastTotalChoices = options.length //this is recorded so that banish can know how many mods were available
|
||||
powerUps.tech.lastTotalChoices = options.length //this is recorded so that banish can know how many tech were available
|
||||
|
||||
if (mod.isBanish) { //remove banished mods from last selection
|
||||
for (let i = 0; i < powerUps.mod.banishLog.length; i++) {
|
||||
if (tech.isBanish) { //remove banished tech from last selection
|
||||
for (let i = 0; i < powerUps.tech.banishLog.length; i++) {
|
||||
for (let j = 0; j < options.length; j++) {
|
||||
if (powerUps.mod.banishLog[i] === options[j]) {
|
||||
if (powerUps.tech.banishLog[i] === options[j]) {
|
||||
options.splice(j, 1)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
} else { //remove repeats from last selection
|
||||
const totalChoices = mod.isDeterminism ? 1 : 3 + mod.isExtraChoice * 2
|
||||
if (powerUps.mod.choiceLog.length > totalChoices || powerUps.mod.choiceLog.length === totalChoices) { //make sure this isn't the first time getting a power up and there are previous choices to remove
|
||||
const totalChoices = tech.isDeterminism ? 1 : 3 + tech.isExtraChoice * 2
|
||||
if (powerUps.tech.choiceLog.length > totalChoices || powerUps.tech.choiceLog.length === totalChoices) { //make sure this isn't the first time getting a power up and there are previous choices to remove
|
||||
for (let i = 0; i < totalChoices; i++) { //repeat for each choice from the last selection
|
||||
if (options.length > totalChoices) {
|
||||
for (let j = 0, len = options.length; j < len; j++) {
|
||||
if (powerUps.mod.choiceLog[powerUps.mod.choiceLog.length - 1 - i] === options[j]) {
|
||||
if (powerUps.tech.choiceLog[powerUps.tech.choiceLog.length - 1 - i] === options[j]) {
|
||||
options.splice(j, 1) //remove previous choice from option pool
|
||||
break
|
||||
}
|
||||
@@ -317,67 +311,73 @@ const powerUps = {
|
||||
|
||||
if (options.length > 0) {
|
||||
const choose = options[Math.floor(Math.random() * options.length)]
|
||||
const isCount = mod.mods[choose].count > 0 ? `(${mod.mods[choose].count+1}x)` : "";
|
||||
const isCount = tech.tech[choose].count > 0 ? `(${tech.tech[choose].count+1}x)` : "";
|
||||
|
||||
if (mod.mods[choose].isFieldMod) {
|
||||
text += `<div class="choose-grid-module" onclick="powerUps.choose('mod',${choose})"><div class="grid-title">
|
||||
if (tech.tech[choose].isFieldMod) {
|
||||
text += `<div class="choose-grid-module" onclick="powerUps.choose('tech',${choose})"><div class="grid-title">
|
||||
<span style="position:relative;">
|
||||
<div class="circle-grid mod" style="position:absolute; top:0; left:0;opacity:0.8;"></div>
|
||||
<div class="circle-grid tech" style="position:absolute; top:0; left:0;opacity:0.8;"></div>
|
||||
<div class="circle-grid field" style="position:absolute; top:0; left:10px;opacity:0.65;"></div>
|
||||
</span>
|
||||
${mod.mods[choose].name} ${isCount}</div>${mod.mods[choose].description}</div></div>`
|
||||
} else if (mod.mods[choose].isGunMod) {
|
||||
text += `<div class="choose-grid-module" onclick="powerUps.choose('mod',${choose})"><div class="grid-title">
|
||||
${tech.tech[choose].name} ${isCount}</div>${tech.tech[choose].description}</div></div>`
|
||||
} else if (tech.tech[choose].isGunMod) {
|
||||
text += `<div class="choose-grid-module" onclick="powerUps.choose('tech',${choose})"><div class="grid-title">
|
||||
<span style="position:relative;">
|
||||
<div class="circle-grid mod" style="position:absolute; top:0; left:0;opacity:0.8;"></div>
|
||||
<div class="circle-grid tech" style="position:absolute; top:0; left:0;opacity:0.8;"></div>
|
||||
<div class="circle-grid gun" style="position:absolute; top:0; left:10px; opacity:0.65;"></div>
|
||||
</span>
|
||||
${mod.mods[choose].name} ${isCount}</div>${mod.mods[choose].description}</div></div>`
|
||||
${tech.tech[choose].name} ${isCount}</div>${tech.tech[choose].description}</div></div>`
|
||||
} else {
|
||||
text += `<div class="choose-grid-module" onclick="powerUps.choose('mod',${choose})"><div class="grid-title"><div class="circle-grid mod"></div> ${mod.mods[choose].name} ${isCount}</div>${mod.mods[choose].description}</div>`
|
||||
text += `<div class="choose-grid-module" onclick="powerUps.choose('tech',${choose})"><div class="grid-title"><div class="circle-grid tech"></div> ${tech.tech[choose].name} ${isCount}</div>${tech.tech[choose].description}</div>`
|
||||
}
|
||||
|
||||
// text += `<div class="choose-grid-module" onclick="powerUps.choose('mod',${choose})"><div class="grid-title"><div class="circle-grid mod"></div> ${mod.mods[choose].name}</div> ${mod.mods[choose].description}</div>`
|
||||
// text += `<div class="choose-grid-module" onclick="powerUps.choose('tech',${choose})"><div class="grid-title"><div class="circle-grid tech"></div> ${tech.tech[choose].name}</div> ${tech.tech[choose].description}</div>`
|
||||
return choose
|
||||
}
|
||||
|
||||
}
|
||||
let text = ""
|
||||
if (!mod.isDeterminism) text += `<div class='cancel' onclick='powerUps.endDraft("mod",true)'>✕</div>`
|
||||
text += `<h3 style = 'color:#fff; text-align:left; margin: 0px;'>choose a mod</h3>`
|
||||
if (!tech.isDeterminism) text += `<div class='cancel' onclick='powerUps.endDraft("tech",true)'>✕</div>`
|
||||
text += `<h3 style = 'color:#fff; text-align:left; margin: 0px;'>tech</h3>`
|
||||
let choice1 = pick()
|
||||
let choice2 = -1
|
||||
let choice3 = -1
|
||||
if (choice1 > -1) {
|
||||
if (!mod.isDeterminism) {
|
||||
if (!tech.isDeterminism) {
|
||||
choice2 = pick(choice1)
|
||||
// if (choice2 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('mod',${choice2})"><div class="grid-title"><div class="circle-grid mod"></div> ${mod.mods[choice2].name}</div> ${mod.mods[choice2].description}</div>`
|
||||
// if (choice2 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('tech',${choice2})"><div class="grid-title"><div class="circle-grid tech"></div> ${tech.tech[choice2].name}</div> ${tech.tech[choice2].description}</div>`
|
||||
choice3 = pick(choice1, choice2)
|
||||
// if (choice3 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('mod',${choice3})"><div class="grid-title"><div class="circle-grid mod"></div> ${mod.mods[choice3].name}</div> ${mod.mods[choice3].description}</div>`
|
||||
// if (choice3 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('tech',${choice3})"><div class="grid-title"><div class="circle-grid tech"></div> ${tech.tech[choice3].name}</div> ${tech.tech[choice3].description}</div>`
|
||||
}
|
||||
if (mod.isExtraChoice) {
|
||||
if (tech.isExtraChoice) {
|
||||
let choice4 = pick(choice1, choice2, choice3)
|
||||
// if (choice4 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('mod',${choice4})"><div class="grid-title"><div class="circle-grid mod"></div> ${mod.mods[choice4].name}</div> ${mod.mods[choice4].description}</div>`
|
||||
// if (choice4 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('tech',${choice4})"><div class="grid-title"><div class="circle-grid tech"></div> ${tech.tech[choice4].name}</div> ${tech.tech[choice4].description}</div>`
|
||||
let choice5 = pick(choice1, choice2, choice3, choice4)
|
||||
// if (choice5 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('mod',${choice5})"><div class="grid-title"><div class="circle-grid mod"></div> ${mod.mods[choice5].name}</div> ${mod.mods[choice5].description}</div>`
|
||||
powerUps.mod.choiceLog.push(choice4)
|
||||
powerUps.mod.choiceLog.push(choice5)
|
||||
// if (choice5 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('tech',${choice5})"><div class="grid-title"><div class="circle-grid tech"></div> ${tech.tech[choice5].name}</div> ${tech.tech[choice5].description}</div>`
|
||||
powerUps.tech.choiceLog.push(choice4)
|
||||
powerUps.tech.choiceLog.push(choice5)
|
||||
}
|
||||
powerUps.tech.choiceLog.push(choice1)
|
||||
powerUps.tech.choiceLog.push(choice2)
|
||||
powerUps.tech.choiceLog.push(choice3)
|
||||
// if (powerUps.reroll.rerolls) text += `<div class="choose-grid-module" onclick="powerUps.reroll.use('tech')"><div class="grid-title"><div class="circle-grid reroll"></div> reroll <span class="reroll-select">${powerUps.reroll.rerolls}</span></div></div>`
|
||||
|
||||
if (powerUps.reroll.rerolls) {
|
||||
text += `<div class="choose-grid-module" onclick="powerUps.reroll.use('tech')"><div class="grid-title"> <span style="position:relative;">`
|
||||
for (let i = 0, len = Math.min(powerUps.reroll.rerolls, 30); i < len; i++) text += `<div class="circle-grid reroll" style="position:absolute; top:0; left:${(18 - len*0.3)*i}px ;opacity:0.8; border: 1px #fff solid;"></div>`
|
||||
text += `</span><span class='reroll-select'>reroll</span></div></div>`
|
||||
}
|
||||
powerUps.mod.choiceLog.push(choice1)
|
||||
powerUps.mod.choiceLog.push(choice2)
|
||||
powerUps.mod.choiceLog.push(choice3)
|
||||
if (powerUps.reroll.rerolls) text += `<div class="choose-grid-module" onclick="powerUps.reroll.use('mod')"><div class="grid-title"><div class="circle-grid reroll"></div> reroll <span class='dice'>${powerUps.reroll.diceText()}</span></div></div>`
|
||||
|
||||
document.getElementById("choose-grid").innerHTML = text
|
||||
powerUps.showDraft();
|
||||
} else {
|
||||
if (mod.isBanish) {
|
||||
for (let i = 0, len = mod.mods.length; i < len; i++) {
|
||||
if (mod.mods[i].name === "erase") powerUps.ejectMod(i)
|
||||
if (tech.isBanish) {
|
||||
for (let i = 0, len = tech.tech.length; i < len; i++) {
|
||||
if (tech.tech[i].name === "erase") powerUps.ejectMod(i)
|
||||
}
|
||||
game.makeTextLog(`No <strong class='color-m'>mods</strong> left<br>erased <strong class='color-m'>mods</strong> have been recovered`, 300)
|
||||
powerUps.spawn(mech.pos.x, mech.pos.y, "mod");
|
||||
powerUps.endDraft("mod");
|
||||
simulation.makeTextLog(`No <strong class='color-m'>tech</strong> left<br>erased <strong class='color-m'>tech</strong> have been recovered`)
|
||||
powerUps.spawn(mech.pos.x, mech.pos.y, "tech");
|
||||
powerUps.endDraft("tech");
|
||||
} else {
|
||||
powerUps.giveRandomAmmo()
|
||||
}
|
||||
@@ -402,7 +402,7 @@ const powerUps = {
|
||||
}
|
||||
|
||||
//remove repeats from last selection
|
||||
const totalChoices = mod.isDeterminism ? 1 : 3 + mod.isExtraChoice * 2
|
||||
const totalChoices = tech.isDeterminism ? 1 : 3 + tech.isExtraChoice * 2
|
||||
if (powerUps.gun.choiceLog.length > totalChoices || powerUps.gun.choiceLog.length === totalChoices) { //make sure this isn't the first time getting a power up and there are previous choices to remove
|
||||
for (let i = 0; i < totalChoices; i++) { //repeat for each choice from the last selection
|
||||
if (options.length > totalChoices) {
|
||||
@@ -425,16 +425,16 @@ const powerUps = {
|
||||
let choice3 = -1
|
||||
if (choice1 > -1) {
|
||||
let text = ""
|
||||
if (!mod.isDeterminism) text += `<div class='cancel' onclick='powerUps.endDraft("gun",true)'>✕</div>`
|
||||
text += `<h3 style = 'color:#fff; text-align:left; margin: 0px;'>choose a gun</h3>`
|
||||
if (!tech.isDeterminism) text += `<div class='cancel' onclick='powerUps.endDraft("gun",true)'>✕</div>`
|
||||
text += `<h3 style = 'color:#fff; text-align:left; margin: 0px;'>gun</h3>`
|
||||
text += `<div class="choose-grid-module" onclick="powerUps.choose('gun',${choice1})"><div class="grid-title"><div class="circle-grid gun"></div> ${b.guns[choice1].name}</div> ${b.guns[choice1].description}</div>`
|
||||
if (!mod.isDeterminism) {
|
||||
if (!tech.isDeterminism) {
|
||||
choice2 = pick(b.guns, choice1)
|
||||
if (choice2 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('gun',${choice2})"><div class="grid-title"><div class="circle-grid gun"></div> ${b.guns[choice2].name}</div> ${b.guns[choice2].description}</div>`
|
||||
choice3 = pick(b.guns, choice1, choice2)
|
||||
if (choice3 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('gun',${choice3})"><div class="grid-title"><div class="circle-grid gun"></div> ${b.guns[choice3].name}</div> ${b.guns[choice3].description}</div>`
|
||||
}
|
||||
if (mod.isExtraChoice) {
|
||||
if (tech.isExtraChoice) {
|
||||
let choice4 = pick(b.guns, choice1, choice2, choice3)
|
||||
if (choice4 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('gun',${choice4})"><div class="grid-title"><div class="circle-grid gun"></div> ${b.guns[choice4].name}</div> ${b.guns[choice4].description}</div>`
|
||||
let choice5 = pick(b.guns, choice1, choice2, choice3, choice4)
|
||||
@@ -446,11 +446,15 @@ const powerUps = {
|
||||
powerUps.gun.choiceLog.push(choice1)
|
||||
powerUps.gun.choiceLog.push(choice2)
|
||||
powerUps.gun.choiceLog.push(choice3)
|
||||
if (powerUps.reroll.rerolls) text += `<div class="choose-grid-module" onclick="powerUps.reroll.use('gun')"><div class="grid-title"><div class="circle-grid reroll"></div> reroll <span class='dice'>${powerUps.reroll.diceText()}</span></div></div>`
|
||||
|
||||
// if (powerUps.reroll.rerolls) text += `<div class="choose-grid-module" onclick="powerUps.reroll.use('gun')"><div class="grid-title"><div class="circle-grid reroll"></div> reroll <span class="reroll-select">${powerUps.reroll.rerolls}</span></div></div>`
|
||||
if (powerUps.reroll.rerolls) {
|
||||
text += `<div class="choose-grid-module" onclick="powerUps.reroll.use('gun')"><div class="grid-title"> <span style="position:relative;">`
|
||||
for (let i = 0, len = Math.min(powerUps.reroll.rerolls, 30); i < len; i++) text += `<div class="circle-grid reroll" style="position:absolute; top:0; left:${(18 - len*0.3)*i}px ;opacity:0.8; border: 1px #fff solid;"></div>`
|
||||
text += `</span><span class='reroll-select'>reroll</span></div></div>`
|
||||
}
|
||||
// console.log(powerUps.gun.choiceLog)
|
||||
// console.log(choice1, choice2, choice3)
|
||||
if (mod.isOneGun) text += `<div style = "color: #f24">replaces your current gun</div>`
|
||||
if (tech.isOneGun) text += `<div style = "color: #f24">replaces your current gun</div>`
|
||||
document.getElementById("choose-grid").innerHTML = text
|
||||
powerUps.showDraft();
|
||||
} else {
|
||||
@@ -459,29 +463,26 @@ const powerUps = {
|
||||
}
|
||||
},
|
||||
onPickUp(where) {
|
||||
if (mod.isMassEnergy) mech.energy += 2.5;
|
||||
if (mod.isMineDrop) b.mine({
|
||||
if (tech.isMassEnergy) mech.energy += 2.5;
|
||||
if (tech.isMineDrop) b.mine({
|
||||
x: where.x,
|
||||
y: where.y
|
||||
}, {
|
||||
x: 0,
|
||||
y: 0
|
||||
}, 0, mod.isMineAmmoBack)
|
||||
}, 0, tech.isMineAmmoBack)
|
||||
},
|
||||
giveRandomAmmo() {
|
||||
const ammoTarget = Math.floor(Math.random() * (b.guns.length));
|
||||
const ammo = Math.ceil(b.guns[ammoTarget].ammoPack * 6);
|
||||
if (ammo === Infinity) {
|
||||
if (ammo !== Infinity) {
|
||||
b.guns[ammoTarget].ammo += ammo;
|
||||
game.makeTextLog("<span style='font-size:115%;'><span class='color-f'>+energy</span></span>", 300);
|
||||
} else {
|
||||
b.guns[ammoTarget].ammo += ammo;
|
||||
game.updateGunHUD();
|
||||
game.makeTextLog("<span style='font-size:110%;'>+" + ammo + " ammo for " + b.guns[ammoTarget].name + "</span>", 300);
|
||||
simulation.updateGunHUD();
|
||||
simulation.makeTextLog(`${b.guns[ammoTarget].name}.<span class='color-gun'>ammo</span> <span class='color-symbol'>+=</span> ${ammo}`);
|
||||
}
|
||||
},
|
||||
spawnRandomPowerUp(x, y) { //mostly used after mob dies, doesn't always return a power up
|
||||
if ((Math.random() * Math.random() - 0.3 > Math.sqrt(mech.health) && !mod.isEnergyHealth) || Math.random() < 0.04) { //spawn heal chance is higher at low health
|
||||
if ((Math.random() * Math.random() - 0.3 > Math.sqrt(mech.health) && !tech.isEnergyHealth) || Math.random() < 0.04) { //spawn heal chance is higher at low health
|
||||
powerUps.spawn(x, y, "heal");
|
||||
return;
|
||||
}
|
||||
@@ -493,8 +494,8 @@ const powerUps = {
|
||||
powerUps.spawn(x, y, "gun");
|
||||
return;
|
||||
}
|
||||
if (Math.random() < 0.0027 * (25 - mod.totalCount)) { //a new mod has a low chance for each not acquired mod up to 15
|
||||
powerUps.spawn(x, y, "mod");
|
||||
if (Math.random() < 0.0027 * (25 - tech.totalCount)) { //a new tech has a low chance for each not acquired tech up to 15
|
||||
powerUps.spawn(x, y, "tech");
|
||||
return;
|
||||
}
|
||||
if (Math.random() < 0.006) {
|
||||
@@ -507,7 +508,7 @@ const powerUps = {
|
||||
// }
|
||||
},
|
||||
randomPowerUpCounter: 0,
|
||||
spawnBossPowerUp(x, y) { //boss spawns field and gun mod upgrades
|
||||
spawnBossPowerUp(x, y) { //boss spawns field and gun tech upgrades
|
||||
level.bossKilled = true;
|
||||
|
||||
if (mech.fieldMode === 0) {
|
||||
@@ -523,12 +524,12 @@ const powerUps = {
|
||||
if (Math.random() * chanceToFail < powerUps.randomPowerUpCounter) {
|
||||
powerUps.randomPowerUpCounter = 0;
|
||||
if (Math.random() < 0.95) {
|
||||
powerUps.spawn(x, y, "mod")
|
||||
powerUps.spawn(x, y, "tech")
|
||||
} else {
|
||||
powerUps.spawn(x, y, "gun")
|
||||
}
|
||||
} else {
|
||||
if (mech.health < 0.65 && !mod.isEnergyHealth) {
|
||||
if (mech.health < 0.65 && !tech.isEnergyHealth) {
|
||||
powerUps.spawn(x, y, "heal");
|
||||
powerUps.spawn(x, y, "heal");
|
||||
} else {
|
||||
@@ -553,20 +554,20 @@ 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
|
||||
if (level.levelsCleared > 1) powerUps.spawn(x, y, "mod")
|
||||
if (level.levelsCleared > 1) powerUps.spawn(x, y, "tech")
|
||||
|
||||
//bonus power ups for clearing runs in the last game
|
||||
if (level.levelsCleared === 0 && !game.isCheating) {
|
||||
if (level.levelsCleared === 0 && !simulation.isCheating) {
|
||||
for (let i = 0; i < localSettings.levelsClearedLastGame / 4 - 1; i++) {
|
||||
powerUps.spawn(mech.pos.x, mech.pos.y, "mod", false); //spawn a mod for levels cleared in last game
|
||||
powerUps.spawn(mech.pos.x, mech.pos.y, "tech", false); //spawn a tech for 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
|
||||
powerUps.spawn(x, y, "mod", false);
|
||||
} else if (tech.totalCount === 0) { //first tech
|
||||
powerUps.spawn(x, y, "tech", false);
|
||||
} else if (b.inventory.length < 2) { //second gun or extra ammo
|
||||
if (Math.random() < 0.5) {
|
||||
powerUps.spawn(x, y, "gun", false);
|
||||
@@ -589,38 +590,48 @@ const powerUps = {
|
||||
}
|
||||
},
|
||||
ejectMod(choose = 'random') {
|
||||
//find which mods you have
|
||||
//find which tech you have
|
||||
if (choose === 'random') {
|
||||
const have = []
|
||||
for (let i = 0; i < mod.mods.length; i++) {
|
||||
if (mod.mods[i].count > 0) have.push(i)
|
||||
for (let i = 0; i < tech.tech.length; i++) {
|
||||
if (tech.tech[i].count > 0 && !tech.tech[i].isNonRefundable) have.push(i)
|
||||
}
|
||||
if (have.length === 0) {
|
||||
for (let i = 0; i < tech.tech.length; i++) {
|
||||
if (tech.tech[i].count > 0) have.push(i)
|
||||
}
|
||||
}
|
||||
|
||||
if (have.length) {
|
||||
choose = have[Math.floor(Math.random() * have.length)]
|
||||
game.makeTextLog(`<div class='circle mod'></div> <strong>${mod.mods[choose].name}</strong> was ejected`, 600) //message about what mod was lost
|
||||
for (let i = 0; i < mod.mods[choose].count; i++) {
|
||||
powerUps.directSpawn(mech.pos.x, mech.pos.y, "mod");
|
||||
// simulation.makeTextLog(`<div class='circle tech'></div> <strong>${tech.tech[choose].name}</strong> was ejected`, 600) //message about what tech was lost
|
||||
simulation.makeTextLog(`<span class='color-var'>tech</span>.remove("<span class='color-text'>${tech.tech[choose].name}</span>")`)
|
||||
|
||||
for (let i = 0; i < tech.tech[choose].count; i++) {
|
||||
powerUps.directSpawn(mech.pos.x, mech.pos.y, "tech");
|
||||
powerUp[powerUp.length - 1].isBonus = true
|
||||
}
|
||||
// remove a random mod from the list of mods you have
|
||||
mod.mods[choose].remove();
|
||||
mod.mods[choose].count = 0;
|
||||
mod.mods[choose].isLost = true;
|
||||
game.updateModHUD();
|
||||
mech.fieldCDcycle = mech.cycle + 30; //disable field so you can't pick up the ejected mod
|
||||
// remove a random tech from the list of tech you have
|
||||
tech.tech[choose].remove();
|
||||
tech.tech[choose].count = 0;
|
||||
tech.tech[choose].isLost = true;
|
||||
simulation.updateModHUD();
|
||||
mech.fieldCDcycle = mech.cycle + 30; //disable field so you can't pick up the ejected tech
|
||||
}
|
||||
} else {
|
||||
game.makeTextLog(`<div class='circle mod'></div> <strong>${mod.mods[choose].name}</strong> was ejected`, 600) //message about what mod was lost
|
||||
for (let i = 0; i < mod.mods[choose].count; i++) {
|
||||
powerUps.directSpawn(mech.pos.x, mech.pos.y, "mod");
|
||||
// simulation.makeTextLog(`<div class='circle tech'></div> <strong>${tech.tech[choose].name}</strong> was ejected`, 600) //message about what tech was lost
|
||||
simulation.makeTextLog(`<span class='color-var'>tech</span>.remove("<span class='color-text'>${tech.tech[choose].name}</span>")`)
|
||||
|
||||
for (let i = 0; i < tech.tech[choose].count; i++) {
|
||||
powerUps.directSpawn(mech.pos.x, mech.pos.y, "tech");
|
||||
powerUp[powerUp.length - 1].isBonus = true
|
||||
}
|
||||
// remove a random mod from the list of mods you have
|
||||
mod.mods[choose].remove();
|
||||
mod.mods[choose].count = 0;
|
||||
mod.mods[choose].isLost = true;
|
||||
game.updateModHUD();
|
||||
mech.fieldCDcycle = mech.cycle + 30; //disable field so you can't pick up the ejected mod
|
||||
// remove a random tech from the list of tech you have
|
||||
tech.tech[choose].remove();
|
||||
tech.tech[choose].count = 0;
|
||||
tech.tech[choose].isLost = true;
|
||||
simulation.updateModHUD();
|
||||
mech.fieldCDcycle = mech.cycle + 30; //disable field so you can't pick up the ejected tech
|
||||
}
|
||||
},
|
||||
directSpawn(x, y, target, moving = true, mode = null, size = powerUps[target].size()) {
|
||||
@@ -654,12 +665,12 @@ const powerUps = {
|
||||
},
|
||||
spawn(x, y, target, moving = true, mode = null, size = powerUps[target].size()) {
|
||||
if (
|
||||
(!mod.isSuperDeterminism || (target === 'mod' || target === 'heal' || target === 'ammo')) &&
|
||||
!(mod.isEnergyNoAmmo && target === 'ammo') &&
|
||||
(!game.isNoPowerUps || (target === 'reroll' || target === 'heal' || target === 'ammo'))
|
||||
(!tech.isSuperDeterminism || (target === 'tech' || target === 'heal' || target === 'ammo')) &&
|
||||
!(tech.isEnergyNoAmmo && target === 'ammo') &&
|
||||
(!simulation.isNoPowerUps || (target === 'reroll' || target === 'heal' || target === 'ammo'))
|
||||
) {
|
||||
powerUps.directSpawn(x, y, target, moving, mode, size)
|
||||
if (Math.random() < mod.duplicationChance()) {
|
||||
if (Math.random() < tech.duplicationChance()) {
|
||||
powerUps.directSpawn(x, y, target, moving, mode, size)
|
||||
powerUp[powerUp.length - 1].isBonus = true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user