From 257a9db297c73f29ce6964d8d174708324b9e543 Mon Sep 17 00:00:00 2001 From: landgreen Date: Wed, 2 Dec 2020 18:54:50 -0800 Subject: [PATCH] bug fixes --- .DS_Store | Bin 6148 -> 6148 bytes js/engine.js | 2 +- js/game.js | 3 --- js/index.js | 6 +++--- js/level.js | 8 ++++---- js/mods.js | 19 ++++++++---------- js/powerup.js | 53 +++++++++++++++++++++++++++++--------------------- todo.txt | 12 +++++------- 8 files changed, 52 insertions(+), 51 deletions(-) diff --git a/.DS_Store b/.DS_Store index e56e2de166798eafa46a158122daf125f2331867..8a002ec5d9ac859e104baad53f32cd9ca842d8da 100644 GIT binary patch literal 6148 zcmeHKy-EW?5S~c_i3*z1@?Jn8Wh~?jr!SCNkV_;g2^Wak*c^zJcKQG|_F8MBPa)Xo zJ6Kp)_|5KecbhYoA~FNJ-(`OG+x_lxdrL&zIqJ8Fnnct<6Rgak`^F?Ltz;GFkz$rH zhJ#kOmyE`xOm+NK1?1kvyr7aXRMlESbMXm4;9|_L%te4NNXlMQlKqmcf?>@4u9bCLWikETTX14F^*$qcS2#q4u4?Mi9?Ips{*QkuRzuQ zY|8$>Is5$Y7wIomKo$5`3UDpzMjb54?X9K7$zB_v?VyQCUTQHb!G+n1ktCJ*F;Q%yo}wrV0|Nsi1A_oVa(-?Bkj=or^)6{*qPhe~f{7uEp*Sbq zFc?X4vNp3H6L-SqkIZ5$n^^uaZD!}-=Kz`q6!^|OnP0?^kzuk8kM!mkkrm7UNj4g1 diff --git a/js/engine.js b/js/engine.js index b6d8c65..f49a7a4 100644 --- a/js/engine.js +++ b/js/engine.js @@ -101,13 +101,13 @@ function collisionChecks(event) { (obj === playerBody || obj === playerHead) && !(mod.isFreezeHarmImmune && (mob[k].isSlowed || mob[k].isStunned)) ) { - mech.immuneCycle = mech.cycle + mod.collisionImmuneCycles; //player is immune to collision damage for 30 cycles mob[k].foundPlayer(); let dmg = Math.min(Math.max(0.025 * Math.sqrt(mob[k].mass), 0.05), 0.3) * game.dmgScale; //player damage is capped at 0.3*dmgScale of 1.0 mech.damage(dmg); if (mod.isPiezo) mech.energy += mech.maxEnergy * 2; if (mod.isBayesian) powerUps.ejectMod() if (mob[k].onHit) mob[k].onHit(k); + mech.immuneCycle = mech.cycle + mod.collisionImmuneCycles; //player is immune to collision damage for 30 cycles //extra kick between player and mob //this section would be better with forces but they don't work... let angle = Math.atan2(player.position.y - mob[k].position.y, player.position.x - mob[k].position.x); Matter.Body.setVelocity(player, { diff --git a/js/game.js b/js/game.js index 8223c00..bcf5c10 100644 --- a/js/game.js +++ b/js/game.js @@ -510,9 +510,6 @@ const game = { input.endKeySensing(); b.removeAllGuns(); game.isNoPowerUps = false; - for (let i = 0; i < mod.mods.length; i++) { - if (mod.mods[i].isLost) mod.mods[i].isLost = false; - } mod.setupAllMods(); //sets mods to default values b.setFireCD(); game.updateModHUD(); diff --git a/js/index.js b/js/index.js index fbdae21..e609531 100644 --- a/js/index.js +++ b/js/index.js @@ -287,7 +287,7 @@ const build = { modID.setAttribute("onClick", `javascript: build.choosePowerUp(this,${i},'mod')`); } } else { - modID.innerHTML = `
  ${mod.mods[i].name}
requires: ${mod.mods[i].requires}` + modID.innerHTML = `
  ${mod.mods[i].name}
requires: ${mod.mods[i].requires}` if (!modID.classList.contains("build-grid-disabled")) { modID.classList.add("build-grid-disabled"); modID.onclick = null @@ -343,7 +343,7 @@ const build = { for (let i = 0, len = mod.mods.length; i < len; i++) { if (!mod.mods[i].isCustomHide) { if (!mod.mods[i].allowed()) { // || mod.mods[i].name === "+1 cardinality") { //|| mod.mods[i].name === "leveraged investment" - text += `
  ${mod.mods[i].name}
requires: ${mod.mods[i].requires}
` + text += `
  ${mod.mods[i].name}
requires: ${mod.mods[i].requires}
` } else if (mod.mods[i].count > 1) { text += `
  ${mod.mods[i].name} (${mod.mods[i].count}x)
${mod.mods[i].description}
` } else { @@ -491,7 +491,7 @@ document.getElementById("build-button").addEventListener("click", () => { //setu modID.setAttribute("onClick", `javascript: build.choosePowerUp(this,${i},'mod')`); } } else { - modID.innerHTML = `
  ${mod.mods[i].name}
requires: ${mod.mods[i].requires}` + modID.innerHTML = `
  ${mod.mods[i].name}
requires: ${mod.mods[i].requires}` if (!modID.classList.contains("build-grid-disabled")) { modID.classList.add("build-grid-disabled"); modID.onclick = null diff --git a/js/level.js b/js/level.js index a9f091c..169cef8 100644 --- a/js/level.js +++ b/js/level.js @@ -13,7 +13,7 @@ const level = { start() { if (level.levelsCleared === 0) { //this code only runs on the first level // game.enableConstructMode() //used to build maps in testing mode - // level.difficultyIncrease(29) + // level.difficultyIncrease(9) // game.zoomScale = 1000; // game.setZoom(); // mech.setField("wormhole") @@ -155,8 +155,8 @@ const level = { spawn.mapRect(level.exit.x, level.exit.y + 20, 100, 100); //exit bump // spawn.boost(1500, 0, 900); - spawn.starter(1900, -500, 320) - // spawn.sucker(2900, -500) + // spawn.starter(1900, -500, 320) + spawn.exploder(2900, -500) // spawn.launcherBoss(1200, -500) // spawn.laserTargetingBoss(1600, -400) // spawn.striker(1600, -500) @@ -165,7 +165,7 @@ const level = { // spawn.sniper(1800, -120) // spawn.cellBossCulture(1600, -500) // spawn.spiderBoss(1600, -500) - // spawn.launcher(1200, -500) + // spawn.laser(1200, -500) // spawn.shield(mob[mob.length - 1], 1800, -120, 1); // spawn.nodeBoss(1200, -500, "launcher") diff --git a/js/mods.js b/js/mods.js index 28b3247..8bdb434 100644 --- a/js/mods.js +++ b/js/mods.js @@ -1,13 +1,9 @@ const mod = { totalCount: null, - setupAllMods(isLost = false) { + setupAllMods() { for (let i = 0, len = mod.mods.length; i < len; i++) { mod.mods[i].remove(); - if (isLost) { - mod.mods[i].isLost = false; - } else if (mod.mods[i].count > 0) { - mod.mods[i].isLost = true - } + mod.mods[i].isLost = false mod.mods[i].count = 0 } mod.armorFromPowerUps = 0; @@ -1688,7 +1684,7 @@ const mod = { }, { name: "erase", - description: "permanently remove rerolled mods
spawn 4 rerolls", + description: "rerolled or canceled mods will not reoccur
spawn 4 rerolls", maxCount: 1, count: 0, allowed() { @@ -1703,6 +1699,7 @@ const mod = { }, remove() { mod.isBanish = false + powerUps.mod.banishLog = [] //reset banish log } }, { @@ -1747,7 +1744,7 @@ const mod = { if (mod.isDeterminism) count -= 3 //remove the bonus mods if (mod.isSuperDeterminism) count -= 2 //remove the bonus mods - mod.setupAllMods(false); // remove all mods + mod.setupAllMods(); // remove all mods for (let i = 0; i < count; i++) { // spawn new mods power ups powerUps.spawn(mech.pos.x, mech.pos.y, "mod"); } @@ -2789,12 +2786,12 @@ const mod = { effect() { mod.laserReflections++; mod.laserDamage += 0.08; //base is 0.12 - mod.laserFieldDrain += 0.0007 //base is 0.002 + mod.laserFieldDrain += 0.0008 //base is 0.002 }, remove() { mod.laserReflections = 2; mod.laserDamage = 0.16; - mod.laserFieldDrain = 0.0014; + mod.laserFieldDrain = 0.0016; } }, { @@ -3634,5 +3631,5 @@ const mod = { cancelCount: null, isCancelRerolls: null, isBotDamage: null, - isBanish: null + isBanish: null, } \ No newline at end of file diff --git a/js/powerup.js b/js/powerup.js index 3d442b9..c813586 100644 --- a/js/powerup.js +++ b/js/powerup.js @@ -19,7 +19,7 @@ const powerUps = { // game.makeTextLog(`
  ${mod.mods[index].name}

${mod.mods[index].description}`, 500); // game.replaceTextLog = false; } - powerUps.endDraft(); + powerUps.endDraft(type); }, showDraft() { // document.getElementById("choose-grid").style.gridTemplateColumns = "repeat(2, minmax(370px, 1fr))" @@ -35,17 +35,33 @@ const powerUps = { game.isChoosing = true; //stops p from un pausing on key down build.pauseGrid(true) }, - endDraft(isCanceled = false) { + endDraft(type, isCanceled = false) { if (isCanceled) { if (mod.isCancelDuplication) mod.cancelCount++ if (mod.isCancelRerolls) { - let type = (mech.health < 0.25 || mod.isEnergyNoAmmo) ? "heal" : "ammo" + let spawnType = (mech.health < 0.25 || mod.isEnergyNoAmmo) ? "heal" : "ammo" if (Math.random() < 0.33) { - type = "heal" + spawnType = "heal" } else if (Math.random() < 0.5 && !mod.isSuperDeterminism) { - type = "reroll" + 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 + for (let i = 0; i < banishLength; i++) { + powerUps.mod.banishLog.push(powerUps.mod.choiceLog[powerUps.mod.choiceLog.length - 1 - i]) + } + } + if (powerUps.mod.lastTotalChoices - powerUps.mod.banishLog.length < 1) { //check for out of mods to banish + for (let i = 0, len = mod.mods.length; i < len; i++) { + if (mod.mods[i].name === "erase") powerUps.ejectMod(i) + } + game.makeTextLog(`No mods left
erased mods have been recovered`, 300) + } else { + game.makeTextLog(`about ${powerUps.mod.lastTotalChoices - powerUps.mod.banishLog.length} estimated mods left`, 300) } - 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), type, false); } } if (mod.manyWorlds && powerUps.reroll.rerolls < 1) { @@ -130,32 +146,25 @@ const powerUps = { use(type) { //runs when you actually reroll a list of selections, type can be field, gun, or mod powerUps.reroll.changeRerolls(-1) - - // banish rerolled mods - if (mod.isBanish && type === 'mod') { + 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 for (let i = 0; i < banishLength; i++) { powerUps.mod.banishLog.push(powerUps.mod.choiceLog[powerUps.mod.choiceLog.length - 1 - i]) } } - if (powerUps.mod.lastTotalChoices - powerUps.mod.banishLog.length < 1) { for (let i = 0, len = mod.mods.length; i < len; i++) { if (mod.mods[i].name === "erase") { powerUps.ejectMod(i) } } - game.makeTextLog(`No mods left
erase has been ejected
erased mods have been recovered`, 300) + game.makeTextLog(`No mods left
erased mods have been recovered`, 300) + } else { game.makeTextLog(`about ${powerUps.mod.lastTotalChoices - powerUps.mod.banishLog.length} estimated mods left`, 300) } - - - // console.log(powerUps.mod.banishLog) } - - powerUps[type].effect(); }, }, @@ -192,9 +201,9 @@ const powerUps = { //give ammo to all guns in inventory if (mod.isAmmoForGun && b.inventory.length > 0) { const target = b.guns[b.activeGun] - target.ammo += Math.ceil(Math.random() * target.ammoPack) + Math.ceil(Math.random() * target.ammoPack) - game.makeTextLog("
  added " + (Math.min(mech.maxHealth - mech.health, heal) * game.healScale * 100).toFixed(0) + "%", 300) - + const ammoAdded = Math.ceil(Math.random() * target.ammoPack) + Math.ceil(Math.random() * target.ammoPack) + target.ammo += ammoAdded + // game.makeTextLog(`
  ${ammoAdded} ammo added`, 300) } else { for (let i = 0, len = b.inventory.length; i < len; i++) { const target = b.guns[b.inventory[i]] @@ -243,7 +252,7 @@ const powerUps = { let choice3 = -1 if (choice1 > -1) { let text = "" - if (!mod.isDeterminism) text += `
` + if (!mod.isDeterminism) text += `
` text += `

choose a field

` text += `
  ${mech.fieldUpgrades[choice1].name}
${mech.fieldUpgrades[choice1].description}
` if (!mod.isDeterminism) { @@ -328,7 +337,7 @@ const powerUps = { } let text = "" - if (!mod.isDeterminism) text += `
` + if (!mod.isDeterminism) text += `
` text += `

choose a mod

` let choice1 = pick() let choice2 = -1 @@ -401,7 +410,7 @@ const powerUps = { let choice3 = -1 if (choice1 > -1) { let text = "" - if (!mod.isDeterminism) text += `
` + if (!mod.isDeterminism) text += `
` text += `

choose a gun

` text += `
  ${b.guns[choice1].name}
${b.guns[choice1].description}
` if (!mod.isDeterminism) { diff --git a/todo.txt b/todo.txt index a49968b..859b169 100644 --- a/todo.txt +++ b/todo.txt @@ -1,14 +1,11 @@ *********** NEXT PATCH *********** -field - wormhole now has a 10% chance to duplicate power ups -mod: erase - remove rerolled mods from the selection pool - -custom now lets you reproduce builds that only occur in game when a mod/gun/field is removed is ejected - example: in custom you can get time dilation only mods, then jump over to nano scale field and keep the crazy time dilation regen - this might cause some problems, let me know if anything gets weird ************** BUGS ************** +(fixed) red square mobs no longer die on contact + might be side effects (we put the player invincibility after mob on damage code) + (always) make it so that when you are immune to harm you can either jump on mobs or you pass through them (4+ reports before potential fix) bug - crouch and worm hole? -> crouch locked in @@ -26,9 +23,10 @@ custom now lets you reproduce builds that only occur in game when a mod/gun/fiel (repeatable almost every time) bug - mines spawn extra mines when fired at thin map wall while jumping - ************** TODO ************** +extend erase to cancel + mod pilot wave: mini black hole - pull mobs and blocks in with more force also from farther away also do damage?