bug fixes

This commit is contained in:
landgreen
2020-12-02 18:54:50 -08:00
parent c855508dda
commit 257a9db297
8 changed files with 52 additions and 51 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@@ -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, {

View File

@@ -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();

View File

@@ -287,7 +287,7 @@ const build = {
modID.setAttribute("onClick", `javascript: build.choosePowerUp(this,${i},'mod')`);
}
} else {
modID.innerHTML = `<div class="grid-title"><div class="circle-grid grey"></div> &nbsp; ${mod.mods[i].name}</div><span style="color:#666;"><strong>requires:</strong> ${mod.mods[i].requires}</span></div>`
modID.innerHTML = `<div class="grid-title"><div class="circle-grid grey"></div> &nbsp; ${mod.mods[i].name}</div><span style="color:#666;">requires: ${mod.mods[i].requires}</span></div>`
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 += `<div id="mod-${i}" class="build-grid-module build-grid-disabled"><div class="grid-title"><div class="circle-grid grey"></div> &nbsp; ${mod.mods[i].name}</div><span style="color:#666;"><strong>requires:</strong> ${mod.mods[i].requires}</span></div>`
text += `<div id="mod-${i}" class="build-grid-module build-grid-disabled"><div class="grid-title"><div class="circle-grid grey"></div> &nbsp; ${mod.mods[i].name}</div><span style="color:#666;">requires: ${mod.mods[i].requires}</span></div>`
} else if (mod.mods[i].count > 1) {
text += `<div id="mod-${i}" class="build-grid-module" onclick="build.choosePowerUp(this,${i},'mod')"><div class="grid-title"><div class="circle-grid mod"></div> &nbsp; ${mod.mods[i].name} (${mod.mods[i].count}x)</div> ${mod.mods[i].description}</div>`
} else {
@@ -491,7 +491,7 @@ document.getElementById("build-button").addEventListener("click", () => { //setu
modID.setAttribute("onClick", `javascript: build.choosePowerUp(this,${i},'mod')`);
}
} else {
modID.innerHTML = `<div class="grid-title"><div class="circle-grid grey"></div> &nbsp; ${mod.mods[i].name}</div><span style="color:#666;"><strong>requires:</strong> ${mod.mods[i].requires}</span></div>`
modID.innerHTML = `<div class="grid-title"><div class="circle-grid grey"></div> &nbsp; ${mod.mods[i].name}</div><span style="color:#666;">requires: ${mod.mods[i].requires}</span></div>`
if (!modID.classList.contains("build-grid-disabled")) {
modID.classList.add("build-grid-disabled");
modID.onclick = null

View File

@@ -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")

View File

@@ -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 <strong class='color-r'>rerolled</strong> <strong class='color-m'>mods</strong><br>spawn <strong>4</strong> <strong class='color-r'>rerolls</strong>",
description: "<strong class='color-r'>rerolled</strong> or <strong>canceled</strong> <strong class='color-m'>mods</strong> will not <strong>reoccur</strong> <br>spawn <strong>4</strong> <strong class='color-r'>rerolls</strong>",
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,
}

View File

@@ -19,7 +19,7 @@ const powerUps = {
// game.makeTextLog(`<div class="circle mod"></div> &nbsp; <strong style='font-size:30px;'>${mod.mods[index].name}</strong><br><br> ${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 <strong class='color-m'>mods</strong> left<br>erased <strong class='color-m'>mods</strong> have been recovered`, 300)
} else {
game.makeTextLog(`about ${powerUps.mod.lastTotalChoices - powerUps.mod.banishLog.length} estimated <strong class='color-m'>mods</strong> 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 <strong class='color-m'>mods</strong> left<br><strong>erase</strong> has been ejected<br>erased <strong class='color-m'>mods</strong> have been recovered`, 300)
game.makeTextLog(`No <strong class='color-m'>mods</strong> left<br>erased <strong class='color-m'>mods</strong> have been recovered`, 300)
} else {
game.makeTextLog(`about ${powerUps.mod.lastTotalChoices - powerUps.mod.banishLog.length} estimated <strong class='color-m'>mods</strong> 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("<div class='circle ammo'></div> &nbsp; added " + (Math.min(mech.maxHealth - mech.health, heal) * game.healScale * 100).toFixed(0) + "%</span>", 300)
const ammoAdded = Math.ceil(Math.random() * target.ammoPack) + Math.ceil(Math.random() * target.ammoPack)
target.ammo += ammoAdded
// game.makeTextLog(`<div class='circle gun'></div> &nbsp; ${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 += `<div class='cancel' onclick='powerUps.endDraft(true)'>✕</div>`
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>`
text += `<div class="choose-grid-module" onclick="powerUps.choose('field',${choice1})"><div class="grid-title"><div class="circle-grid field"></div> &nbsp; ${mech.fieldUpgrades[choice1].name}</div> ${mech.fieldUpgrades[choice1].description}</div>`
if (!mod.isDeterminism) {
@@ -328,7 +337,7 @@ const powerUps = {
}
let text = ""
if (!mod.isDeterminism) text += `<div class='cancel' onclick='powerUps.endDraft(true)'>✕</div>`
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>`
let choice1 = pick()
let choice2 = -1
@@ -401,7 +410,7 @@ const powerUps = {
let choice3 = -1
if (choice1 > -1) {
let text = ""
if (!mod.isDeterminism) text += `<div class='cancel' onclick='powerUps.endDraft(true)'>✕</div>`
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>`
text += `<div class="choose-grid-module" onclick="powerUps.choose('gun',${choice1})"><div class="grid-title"><div class="circle-grid gun"></div> &nbsp; ${b.guns[choice1].name}</div> ${b.guns[choice1].description}</div>`
if (!mod.isDeterminism) {

View File

@@ -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?