bug fixes
This commit is contained in:
17
js/bullet.js
17
js/bullet.js
@@ -1143,18 +1143,19 @@ const b = {
|
||||
|
||||
//fire plasma at target
|
||||
|
||||
const DRAIN = 0.002
|
||||
if (this.lockedOn && this.lockedOn.alive && mech.energy > DRAIN && mech.fieldCDcycle < mech.cycle) {
|
||||
mech.energy -= DRAIN;
|
||||
if (mech.energy < 0) {
|
||||
mech.fieldCDcycle = mech.cycle + 120;
|
||||
mech.energy = 0;
|
||||
}
|
||||
|
||||
if (this.lockedOn && this.lockedOn.alive && mech.fieldCDcycle < mech.cycle) {
|
||||
const sub = Vector.sub(this.lockedOn.position, this.position)
|
||||
const DIST = Vector.magnitude(sub);
|
||||
const unit = Vector.normalise(sub)
|
||||
if (DIST < mod.isPlasmaRange * 600) {
|
||||
|
||||
const DRAIN = 0.0022
|
||||
if (DIST < mod.isPlasmaRange * 550 && mech.energy > DRAIN) {
|
||||
mech.energy -= DRAIN;
|
||||
if (mech.energy < 0) {
|
||||
mech.fieldCDcycle = mech.cycle + 120;
|
||||
mech.energy = 0;
|
||||
}
|
||||
//calculate laser collision
|
||||
let best;
|
||||
let range = mod.isPlasmaRange * (140 + 300 * Math.sqrt(Math.random()))
|
||||
|
||||
15
js/index.js
15
js/index.js
@@ -93,17 +93,20 @@ const build = {
|
||||
<span style="font-size:1.5em;font-weight: 600;">PAUSED</span> press P to resume
|
||||
</div>
|
||||
<div class="pause-grid-module" style = "font-size: 13px;line-height: 120%;padding: 5px;">
|
||||
level: ${level.levelsCleared} - ${level.levels[level.onLevel]} (${level.difficultyText()})
|
||||
<br>${mob.length} mobs, ${body.length} blocks, ${bullet.length} bullets, ${powerUp.length} power ups
|
||||
<br>mouse: (${game.mouseInGame.x.toFixed(1)}, ${game.mouseInGame.y.toFixed(1)}) ${mech.cycle} cycles
|
||||
<strong>damage increase: ${((mod.damageFromMods()-1)*100).toFixed(0)}%
|
||||
<br>harm reduction: ${((1-mech.harmReduction())*100).toFixed(0)}%
|
||||
<br>fire delay decrease: ${((1-b.fireCD)*100).toFixed(0)}%</strong>
|
||||
<br>
|
||||
<br>health: (${(mech.health*100).toFixed(0)} / ${(mech.maxHealth*100).toFixed(0)}) energy: (${(mech.energy*100).toFixed(0)} / ${(mech.maxEnergy*100).toFixed(0)})
|
||||
<br>mass: ${player.mass.toFixed(1)} rerolls: ${powerUps.reroll.rerolls}
|
||||
<br>position: (${player.position.x.toFixed(1)}, ${player.position.y.toFixed(1)}) velocity: (${player.velocity.x.toFixed(1)}, ${player.velocity.y.toFixed(1)})
|
||||
<br>
|
||||
<br>damage increase: ${((mod.damageFromMods()-1)*100).toFixed(0)}%
|
||||
<br>harm reduction: ${((1-mech.harmReduction())*100).toFixed(0)}%
|
||||
<br>fire delay decrease: ${((1-b.fireCD)*100).toFixed(0)}%
|
||||
<br>level: ${level.levelsCleared} - ${level.levels[level.onLevel]} (${level.difficultyText()})
|
||||
<br>${mob.length} mobs, ${body.length} blocks, ${bullet.length} bullets, ${powerUp.length} power ups
|
||||
<br>mouse: (${game.mouseInGame.x.toFixed(1)}, ${game.mouseInGame.y.toFixed(1)}) ${mech.cycle} cycles
|
||||
<br>harm difficulty scale: ${(game.dmgScale*100).toFixed(0)}%
|
||||
<br>damage difficulty scale: ${(b.dmgScale*100).toFixed(0) }%
|
||||
<br>heal difficulty scale: ${(game.healScale*100).toFixed(0)}%
|
||||
</div>`;
|
||||
let countGuns = 0
|
||||
let countMods = 0
|
||||
|
||||
35
js/level.js
35
js/level.js
@@ -14,7 +14,7 @@ const level = {
|
||||
// level.difficultyIncrease(4)
|
||||
// game.enableConstructMode() //used to build maps in testing mode
|
||||
// mech.isStealth = true;
|
||||
// mod.giveMod("superfluidity");
|
||||
// mod.giveMod("bot fabrication");
|
||||
// b.giveGuns("ice IX")
|
||||
// mech.setField("plasma torch")
|
||||
|
||||
@@ -64,8 +64,8 @@ const level = {
|
||||
mech.maxHealth += 0.05 * powerUps.totalPowerUps
|
||||
if (powerUps.totalPowerUps) game.makeTextLog("<span style='font-size:115%;'> max health increased by " + (0.05 * powerUps.totalPowerUps * 100).toFixed(0) + "%</span>", 300)
|
||||
}
|
||||
if (mod.isHealLowHealth && mech.health < mech.maxHealth * 0.5 * game.healScale) {
|
||||
mech.health = mech.maxHealth * 0.5 * game.healScale
|
||||
if (mod.isHealLowHealth && mech.health < mech.maxHealth * 0.66 * game.healScale) {
|
||||
mech.health = mech.maxHealth * 0.66 * game.healScale
|
||||
mech.displayHealth();
|
||||
}
|
||||
},
|
||||
@@ -133,20 +133,20 @@ const level = {
|
||||
composite[composite.length] = rotor
|
||||
return rotor
|
||||
},
|
||||
button(x, y, width = 70, height = 20) {
|
||||
spawn.mapVertex(x + 35, y + 27, "70 10 -70 10 -40 -10 40 -10");
|
||||
button(x, y, width = 70) {
|
||||
spawn.mapVertex(x + 35, y + 2, "70 10 -70 10 -40 -10 40 -10");
|
||||
return {
|
||||
isUp: false,
|
||||
min: {
|
||||
x: x,
|
||||
y: y
|
||||
y: y - 15
|
||||
},
|
||||
max: {
|
||||
x: x + width,
|
||||
y: y + height
|
||||
y: y - 5
|
||||
},
|
||||
width: width,
|
||||
height: height,
|
||||
height: 20,
|
||||
query() {
|
||||
if (Matter.Query.region(body, this).length === 0 && Matter.Query.region([player], this).length === 0) {
|
||||
this.isUp = true;
|
||||
@@ -156,11 +156,10 @@ const level = {
|
||||
},
|
||||
draw() {
|
||||
ctx.fillStyle = "hsl(0, 100%, 70%)"
|
||||
// ctx.fillStyle = "hsl(287, 30%, 65%)"
|
||||
if (this.isUp) {
|
||||
ctx.fillRect(this.min.x, this.min.y, this.width, 20)
|
||||
ctx.fillRect(this.min.x, this.min.y - 10, this.width, 20)
|
||||
} else {
|
||||
ctx.fillRect(this.min.x, this.min.y + 10, this.width, 25)
|
||||
ctx.fillRect(this.min.x, this.min.y, this.width, 25)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -207,7 +206,7 @@ const level = {
|
||||
},
|
||||
sewers() {
|
||||
const rotor = level.rotor(5100, 2425, -0.001)
|
||||
const button = level.button(6600, 2650)
|
||||
const button = level.button(6600, 2675)
|
||||
const hazard = level.hazard(4550, 2750, 4550, 150)
|
||||
|
||||
level.custom = () => {
|
||||
@@ -324,6 +323,7 @@ const level = {
|
||||
spawn.randomMob(2075, 2025, 0.8);
|
||||
spawn.randomMob(3475, 2175, 0.8);
|
||||
if (game.difficulty > 3) spawn.randomLevelBoss(6000, 2300, ["spiderBoss", "launcherBoss", "laserTargetingBoss"]);
|
||||
powerUps.addRerollToLevel() //needs to run after mobs are spawned
|
||||
},
|
||||
template() {
|
||||
level.custom = () => {
|
||||
@@ -360,6 +360,7 @@ const level = {
|
||||
// spawn.randomMob(2650, -975, 0.8);
|
||||
// spawn.randomBoss(1700, -900, 0.4);
|
||||
// if (game.difficulty > 3) spawn.randomLevelBoss(2200, -1300);
|
||||
powerUps.addRerollToLevel() //needs to run after mobs are spawned
|
||||
},
|
||||
testing() {
|
||||
level.custom = () => {
|
||||
@@ -495,6 +496,7 @@ const level = {
|
||||
spawn.randomBoss(5000 + 500 * (Math.random() - 0.5), -800 + 200 * (Math.random() - 0.5), Infinity);
|
||||
}
|
||||
}
|
||||
powerUps.addRerollToLevel() //needs to run after mobs are spawned
|
||||
},
|
||||
intro() {
|
||||
level.custom = () => {
|
||||
@@ -814,6 +816,7 @@ const level = {
|
||||
spawn.laserBoss(600 + 200 * Math.random(), -2150 + 250 * Math.random());
|
||||
}
|
||||
}
|
||||
powerUps.addRerollToLevel() //needs to run after mobs are spawned
|
||||
},
|
||||
rooftops() {
|
||||
level.custom = () => {
|
||||
@@ -1016,6 +1019,7 @@ const level = {
|
||||
spawn.randomBoss(2225, -1325, 0.4);
|
||||
spawn.randomBoss(4900, -1200, 0);
|
||||
if (game.difficulty > 3) spawn.randomLevelBoss(3200, -2050);
|
||||
powerUps.addRerollToLevel() //needs to run after mobs are spawned
|
||||
},
|
||||
aerie() {
|
||||
level.custom = () => {
|
||||
@@ -1208,7 +1212,7 @@ const level = {
|
||||
spawn.suckerBoss(4500, -400);
|
||||
}
|
||||
}
|
||||
//add mini boss, giant hopper? or a black hole that spawns hoppers?
|
||||
powerUps.addRerollToLevel() //needs to run after mobs are spawned
|
||||
},
|
||||
skyscrapers() {
|
||||
level.custom = () => {
|
||||
@@ -1367,6 +1371,7 @@ const level = {
|
||||
spawn.randomBoss(3700, -1500, 0.4);
|
||||
spawn.randomBoss(1700, -900, 0.4);
|
||||
if (game.difficulty > 3) spawn.randomLevelBoss(2200, -1300);
|
||||
powerUps.addRerollToLevel() //needs to run after mobs are spawned
|
||||
},
|
||||
highrise() {
|
||||
level.custom = () => {
|
||||
@@ -1529,6 +1534,7 @@ const level = {
|
||||
spawn.randomBoss(-3250, -2700, 0.2);
|
||||
spawn.randomBoss(-2450, -1100, 0);
|
||||
if (game.difficulty > 4) spawn.randomLevelBoss(-3400, -2800);
|
||||
powerUps.addRerollToLevel() //needs to run after mobs are spawned
|
||||
},
|
||||
warehouse() {
|
||||
level.custom = () => {
|
||||
@@ -1698,6 +1704,7 @@ const level = {
|
||||
spawn.snakeBoss(-1300 + Math.random() * 2000, -2200); //boss snake with head
|
||||
}
|
||||
}
|
||||
powerUps.addRerollToLevel() //needs to run after mobs are spawned
|
||||
},
|
||||
office() {
|
||||
level.custom = () => {
|
||||
@@ -1881,6 +1888,7 @@ const level = {
|
||||
spawn.shooterBoss(2200, -650);
|
||||
}
|
||||
}
|
||||
powerUps.addRerollToLevel() //needs to run after mobs are spawned
|
||||
},
|
||||
stronghold() { // player made level by Francois 👑 from discord
|
||||
level.custom = () => {
|
||||
@@ -2116,6 +2124,7 @@ const level = {
|
||||
spawn.randomBoss(100, -450, 0.9);
|
||||
|
||||
if (game.difficulty > 3) spawn.randomLevelBoss(1850, -1400);
|
||||
powerUps.addRerollToLevel() //needs to run after mobs are spawned
|
||||
},
|
||||
//******************************************************************************************************************
|
||||
//******************************************************************************************************************
|
||||
|
||||
@@ -973,19 +973,19 @@ const mobs = {
|
||||
if (!this.isShielded || isBypassShield) {
|
||||
dmg *= mod.damageFromMods()
|
||||
//mobs specific damage changes
|
||||
dmg /= Math.sqrt(this.mass)
|
||||
if (this.shield) dmg *= 0.05
|
||||
if (mod.isFarAwayDmg) dmg *= 1 + Math.sqrt(Math.max(500, Math.min(3000, this.distanceToPlayer())) - 500) * 0.0067 //up to 50% dmg at max range of 3500
|
||||
if (this.shield) dmg *= 0.05
|
||||
|
||||
//energy and heal drain should be calculated after damage boosts
|
||||
if (mod.energySiphon && dmg !== Infinity) {
|
||||
if (mod.energySiphon && dmg !== Infinity && this.dropPowerUp) {
|
||||
mech.energy += Math.min(this.health, dmg) * mod.energySiphon
|
||||
if (mech.energy > mech.maxEnergy) mech.energy = mech.maxEnergy
|
||||
}
|
||||
if (mod.healthDrain && dmg !== Infinity) {
|
||||
if (mod.healthDrain && dmg !== Infinity && this.dropPowerUp) {
|
||||
mech.addHealth(Math.min(this.health, dmg) * mod.healthDrain)
|
||||
if (mech.health > mech.maxHealth) mech.health = mech.maxHealth
|
||||
}
|
||||
dmg /= Math.sqrt(this.mass)
|
||||
this.health -= dmg
|
||||
//this.fill = this.color + this.health + ')';
|
||||
this.onDamage(dmg); //custom damage effects
|
||||
|
||||
16
js/mods.js
16
js/mods.js
@@ -468,10 +468,11 @@ const mod = {
|
||||
},
|
||||
requires: "at least 3 rerolls",
|
||||
effect() {
|
||||
mob.isRerollBots = true;
|
||||
mod.isRerollBots = true;
|
||||
powerUps.reroll.changeRerolls(0)
|
||||
},
|
||||
remove() {
|
||||
mob.isRerollBots = false;
|
||||
mod.isRerollBots = false;
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -523,6 +524,7 @@ const mod = {
|
||||
b.guns[i].ammo = Math.floor(b.guns[i].ammo * 0.1);
|
||||
}
|
||||
}
|
||||
game.updateGunHUD();
|
||||
//double bots
|
||||
for (let i = 0; i < mod.nailBotCount; i++) {
|
||||
b.nailBot();
|
||||
@@ -753,7 +755,7 @@ const mod = {
|
||||
},
|
||||
{
|
||||
name: "energy conservation",
|
||||
description: "<strong>13%</strong> of <strong class='color-d'>damage</strong> done recovered as <strong class='color-f'>energy</strong>",
|
||||
description: "<strong>10%</strong> of <strong class='color-d'>damage</strong> done recovered as <strong class='color-f'>energy</strong>",
|
||||
maxCount: 9,
|
||||
count: 0,
|
||||
allowed() {
|
||||
@@ -761,7 +763,7 @@ const mod = {
|
||||
},
|
||||
requires: "",
|
||||
effect() {
|
||||
mod.energySiphon += 0.13;
|
||||
mod.energySiphon += 0.1;
|
||||
},
|
||||
remove() {
|
||||
mod.energySiphon = 0;
|
||||
@@ -818,7 +820,7 @@ const mod = {
|
||||
},
|
||||
{
|
||||
name: "entropy exchange",
|
||||
description: "<strong class='color-h'>heal</strong> for <strong>1.5%</strong> of <strong class='color-d'>damage</strong> done",
|
||||
description: "<strong class='color-h'>heal</strong> for <strong>1%</strong> of <strong class='color-d'>damage</strong> done",
|
||||
maxCount: 9,
|
||||
count: 0,
|
||||
allowed() {
|
||||
@@ -826,7 +828,7 @@ const mod = {
|
||||
},
|
||||
requires: "not mass-energy equivalence",
|
||||
effect() {
|
||||
mod.healthDrain += 0.015;
|
||||
mod.healthDrain += 0.01;
|
||||
},
|
||||
remove() {
|
||||
mod.healthDrain = 0;
|
||||
@@ -852,7 +854,7 @@ const mod = {
|
||||
},
|
||||
{
|
||||
name: "negentropy",
|
||||
description: "at the start of each <strong>level</strong><br><strong class='color-h'>heal</strong> up to <strong>50%</strong> of <strong>maximum health</strong>",
|
||||
description: "at the start of each <strong>level</strong><br><strong class='color-h'>heal</strong> up to <strong>66%</strong> of <strong>maximum health</strong>",
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
allowed() {
|
||||
|
||||
@@ -472,7 +472,7 @@ const mech = {
|
||||
mech.energy = mech.maxEnergy
|
||||
// if (mech.energy < 0.05) mech.energy = 0.05
|
||||
mech.immuneCycle = mech.cycle + 120 //disable this.immuneCycle bonus seconds
|
||||
game.makeTextLog("<span style='font-size:115%;'> <strong>death</strong> avoided<br><strong>1</strong> <strong class='color-r'>reroll</strong> consumed</span>", 420)
|
||||
game.makeTextLog(`<span style='font-size:115%;'> <strong>death</strong> avoided<br><strong>1/${powerUps.reroll.rerolls}</strong> <strong class='color-r'>rerolls</strong> consumed</span>`, 420)
|
||||
|
||||
game.wipe = function () { //set wipe to have trails
|
||||
ctx.fillStyle = "rgba(255,255,255,0.03)";
|
||||
@@ -501,7 +501,8 @@ const mech = {
|
||||
mech.health = mech.maxHealth * game.healScale
|
||||
// if (mech.health < 0.05) mech.health = 0.05
|
||||
mech.immuneCycle = mech.cycle + 120 //disable this.immuneCycle bonus seconds
|
||||
game.makeTextLog("<span style='font-size:115%;'> <strong>death</strong> avoided<br><strong>1</strong> <strong class='color-r'>reroll</strong> consumed</span>", 420)
|
||||
game.makeTextLog(`<span style='font-size:115%;'> <strong>death</strong> avoided<br><strong>1/${powerUps.reroll.rerolls}</strong> <strong class='color-r'>rerolls</strong> consumed</span>`, 420)
|
||||
// game.makeTextLog("<span style='font-size:115%;'> <strong>death</strong> avoided<br><strong>1</strong> <strong class='color-r'>reroll</strong> consumed</span>", 420)
|
||||
|
||||
game.wipe = function () { //set wipe to have trails
|
||||
ctx.fillStyle = "rgba(255,255,255,0.03)";
|
||||
|
||||
@@ -55,14 +55,12 @@ const powerUps = {
|
||||
powerUps.reroll.rerolls += amount
|
||||
if (powerUps.reroll.rerolls < 0) powerUps.reroll.rerolls = 0
|
||||
|
||||
if (mob.isRerollBots) {
|
||||
if (mod.isRerollBots) {
|
||||
const limit = 3
|
||||
for (; powerUps.reroll.rerolls > limit - 1; powerUps.reroll.rerolls -= limit) {
|
||||
b.randomBot()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (mod.isDeathAvoid && document.getElementById("mod-anthropic")) {
|
||||
document.getElementById("mod-anthropic").innerHTML = `(${powerUps.reroll.rerolls})`
|
||||
}
|
||||
@@ -405,11 +403,11 @@ const powerUps = {
|
||||
if (Math.random() < mod.bayesian) powerUps.spawn(x, y, "field");
|
||||
return;
|
||||
}
|
||||
if (Math.random() < 0.01) {
|
||||
powerUps.spawn(x, y, "reroll");
|
||||
if (Math.random() < mod.bayesian) powerUps.spawn(x, y, "reroll");
|
||||
return;
|
||||
}
|
||||
// if (Math.random() < 0.01) {
|
||||
// powerUps.spawn(x, y, "reroll");
|
||||
// if (Math.random() < mod.bayesian) powerUps.spawn(x, y, "reroll");
|
||||
// return;
|
||||
// }
|
||||
},
|
||||
randomPowerUpCounter: 0,
|
||||
spawnBossPowerUp(x, y) { //boss spawns field and gun mod upgrades
|
||||
@@ -465,14 +463,23 @@ const powerUps = {
|
||||
|
||||
},
|
||||
chooseRandomPowerUp(x, y) { //100% chance to drop a random power up //used in spawn.debris
|
||||
if (Math.random() < 0.05) {
|
||||
if (Math.random() < 0.01) {
|
||||
powerUps.spawn(x, y, "reroll");
|
||||
if (Math.random() < mod.bayesian) powerUps.spawn(x, y, "reroll");
|
||||
} else if (Math.random() < 0.5) {
|
||||
powerUps.spawn(x, y, "heal", false);
|
||||
if (Math.random() < mod.bayesian) powerUps.spawn(x, y, "heal", false);
|
||||
} else if (!mod.bayesian) {
|
||||
powerUps.spawn(x, y, "ammo", false);
|
||||
}
|
||||
},
|
||||
addRerollToLevel() { //add a random power up to a location that has a mob, mostly used to give each level one randomly placed reroll
|
||||
if (mob.length) {
|
||||
const index = Math.floor(Math.random() * mob.length)
|
||||
powerUps.spawn(mob[index].position.x, mob[index].position.y, "reroll");
|
||||
if (Math.random() < mod.bayesian) powerUps.spawn(mob[index].position.x, mob[index].position.y, "reroll");
|
||||
}
|
||||
},
|
||||
spawnStartingPowerUps(x, y) { //used for map specific power ups, mostly to give player a starting gun
|
||||
if (level.levelsCleared < 5) {
|
||||
if (b.inventory.length === 0) {
|
||||
|
||||
Reference in New Issue
Block a user