From 7a8905138431394d4a7e9148749a3784c1d813ff Mon Sep 17 00:00:00 2001 From: landgreen Date: Thu, 28 May 2020 16:07:09 -0700 Subject: [PATCH] negative mass field flying buff harmonic field now has no cooldown after blocking negative mass field accelerates slower, but with a higher top speed negative mass field harm reduction is now 60% and always on mod degenerate matter increases the damage reduction from 60% to 80% falling damage and damage from blocks have been removed (I'm trying it out, let me know if you want it back) --- js/bullet.js | 14 +-- js/engine.js | 64 ++++++------ js/game.js | 20 +++- js/level.js | 6 +- js/mods.js | 29 +++--- js/player.js | 272 +++++++++++++++++++++----------------------------- js/powerup.js | 6 +- js/spawn.js | 3 +- todo.txt | 31 +++--- 9 files changed, 208 insertions(+), 237 deletions(-) diff --git a/js/bullet.js b/js/bullet.js index 188b99d..4de5348 100644 --- a/js/bullet.js +++ b/js/bullet.js @@ -241,8 +241,8 @@ const b = { knock = Vector.mult(Vector.normalise(sub), (-Math.sqrt(dmg * damageScale) * mob[i].mass) / 50); mob[i].force.x += knock.x; mob[i].force.y += knock.y; - radius *= 0.93 //reduced range for each additional explosion target - damageScale *= 0.8 //reduced damage for each additional explosion target + radius *= 0.95 //reduced range for each additional explosion target + damageScale *= 0.85 //reduced damage for each additional explosion target } else if (!mob[i].seePlayer.recall && dist < alertRange) { mob[i].locatePlayer(); knock = Vector.mult(Vector.normalise(sub), (-Math.sqrt(dmg * damageScale) * mob[i].mass) / 80); @@ -618,9 +618,9 @@ const b = { friction: 0.05, frictionAir: FRICTION, restitution: 1, - dmg: 0.23, //damage done in addition to the damage from momentum + dmg: 0.28, //damage done in addition to the damage from momentum lookFrequency: 100 + Math.floor(23 * Math.random()), - endCycle: game.cycle + Math.floor((1200 + 420 * Math.random()) * mod.isBulletsLastLonger), + endCycle: game.cycle + Math.floor((1100 + 420 * Math.random()) * mod.isBulletsLastLonger), classType: "bullet", collisionFilter: { category: cat.bullet, @@ -1192,16 +1192,18 @@ const b = { let knock, spread if (mech.crouch) { mech.fireCDcycle = mech.cycle + Math.floor(55 * mod.fireRate); // cool down + if (mod.isShotgunImmune) mech.immuneCycle = mech.cycle + Math.floor(55 * mod.fireRate); //player is immune to collision damage for 30 cycles spread = 0.75 knock = 0.01 * mod.bulletSize * mod.bulletSize } else { mech.fireCDcycle = mech.cycle + Math.floor(45 * mod.fireRate); // cool down + if (mod.isShotgunImmune) mech.immuneCycle = mech.cycle + Math.floor(45 * mod.fireRate); //player is immune to collision damage for 30 cycles spread = 1.3 knock = 0.08 * mod.bulletSize * mod.bulletSize } player.force.x -= knock * Math.cos(mech.angle) player.force.y -= knock * Math.sin(mech.angle) * 0.3 //reduce knock back in vertical direction to stop super jumps - if (mod.isShotgunImmune) mech.immuneCycle = mech.cycle + 60; //player is immune to collision damage for 30 cycles + b.muzzleFlash(35); if (mod.isNailShot) { for (let i = 0; i < 15; i++) { @@ -2074,7 +2076,7 @@ const b = { name: "drones", description: "deploy drones that crash into mobs
collisions reduce their lifespan by 1 second", ammo: 0, - ammoPack: 15, + ammoPack: 14, have: false, isStarterGun: true, isEasyToAim: true, diff --git a/js/engine.js b/js/engine.js index c5f48a8..2f344cd 100644 --- a/js/engine.js +++ b/js/engine.js @@ -87,40 +87,40 @@ function collisionChecks(event) { //body + player collision - if (game.isBodyDamage) { - if (pairs[i].bodyA === playerBody || pairs[i].bodyA === playerHead) { - collidePlayer(pairs[i].bodyB) - } else if (pairs[i].bodyB === playerBody || pairs[i].bodyB === playerHead) { - collidePlayer(pairs[i].bodyA) - } - } + // if (game.isBodyDamage) { + // if (pairs[i].bodyA === playerBody || pairs[i].bodyA === playerHead) { + // collidePlayer(pairs[i].bodyB) + // } else if (pairs[i].bodyB === playerBody || pairs[i].bodyB === playerHead) { + // collidePlayer(pairs[i].bodyA) + // } + // } - function collidePlayer(obj) { - //player dmg from hitting a body - if (obj.classType === "body" && obj.speed > 10 && mech.immuneCycle < mech.cycle) { - const velocityThreshold = 30 //keep this lines up with player.enterLand numbers (130/5 = 26) - if (player.position.y > obj.position.y) { //block is above the player look at total momentum difference - const velocityDiffMag = Vector.magnitude(Vector.sub(player.velocity, obj.velocity)) - if (velocityDiffMag > velocityThreshold) hit(velocityDiffMag - velocityThreshold) - } else { //block is below player only look at horizontal momentum difference - const velocityDiffMagX = Math.abs(obj.velocity.x - player.velocity.x) - if (velocityDiffMagX > velocityThreshold) hit(velocityDiffMagX - velocityThreshold) - } + // function collidePlayer(obj) { + // //player dmg from hitting a body + // if (obj.classType === "body" && obj.speed > 10 && mech.immuneCycle < mech.cycle) { + // const velocityThreshold = 30 //keep this lines up with player.enterLand numbers (130/5 = 26) + // if (player.position.y > obj.position.y) { //block is above the player look at total momentum difference + // const velocityDiffMag = Vector.magnitude(Vector.sub(player.velocity, obj.velocity)) + // if (velocityDiffMag > velocityThreshold) hit(velocityDiffMag - velocityThreshold) + // } else { //block is below player only look at horizontal momentum difference + // const velocityDiffMagX = Math.abs(obj.velocity.x - player.velocity.x) + // if (velocityDiffMagX > velocityThreshold) hit(velocityDiffMagX - velocityThreshold) + // } - function hit(dmg) { - mech.immuneCycle = mech.cycle + mod.collisionImmuneCycles; //player is immune to collision damage for 30 cycles - dmg = Math.min(Math.max(Math.sqrt(dmg) * obj.mass * 0.01, 0.02), 0.15); - mech.damage(dmg); - game.drawList.push({ //add dmg to draw queue - x: pairs[i].activeContacts[0].vertex.x, - y: pairs[i].activeContacts[0].vertex.y, - radius: dmg * 500, - color: game.mobDmgColor, - time: game.drawTime - }); - } - } - } + // function hit(dmg) { + // mech.immuneCycle = mech.cycle + mod.collisionImmuneCycles; //player is immune to collision damage for 30 cycles + // dmg = Math.min(Math.max(Math.sqrt(dmg) * obj.mass * 0.01, 0.02), 0.15); + // mech.damage(dmg); + // game.drawList.push({ //add dmg to draw queue + // x: pairs[i].activeContacts[0].vertex.x, + // y: pairs[i].activeContacts[0].vertex.y, + // radius: dmg * 500, + // color: game.mobDmgColor, + // time: game.drawTime + // }); + // } + // } + // } //mob + (player,bullet,body) collisions for (let k = 0; k < mob.length; k++) { diff --git a/js/game.js b/js/game.js index 0f10920..9394731 100644 --- a/js/game.js +++ b/js/game.js @@ -7,7 +7,11 @@ const game = { Engine.update(engine, game.delta); game.wipe(); game.textLog(); - mech.keyMove(); + if (mech.onGround) { + mech.groundControl() + } else { + mech.airControl() + } level.checkZones(); level.checkQuery(); mech.move(); @@ -30,7 +34,11 @@ const game = { Engine.update(engine, game.delta); game.wipe(); game.textLog(); - mech.keyMove(); + if (mech.onGround) { + mech.groundControl() + } else { + mech.airControl() + } level.checkZones(); level.checkQuery(); mech.move(); @@ -69,7 +77,11 @@ const game = { mech.cycle++; game.gravity(); Engine.update(engine, game.delta); - mech.keyMove(); + if (mech.onGround) { + mech.groundControl() + } else { + mech.airControl() + } level.checkZones(); level.checkQuery(); @@ -741,7 +753,7 @@ const game = { if (mech.lastKillCycle + 300 > mech.cycle) { //effects active for 5 seconds after killing a mob if (mod.isEnergyRecovery) { - mech.energy += mech.maxEnergy * 0.07 + mech.energy += mech.maxEnergy * 0.06 if (mech.energy > mech.maxEnergy) mech.energy = mech.maxEnergy; } if (mod.isHealthRecovery) mech.addHealth(0.01) diff --git a/js/level.js b/js/level.js index d770020..dff58af 100644 --- a/js/level.js +++ b/js/level.js @@ -184,9 +184,9 @@ const level = { // spawn.bomberBoss(2900, -500) // spawn.launcherBoss(1200, -500) - spawn.laserTargetingBoss(1600, -400) - // spawn.sneaker(1600, -500) - // spawn.sniper(1700, -120) + // spawn.laserTargetingBoss(1600, -400) + // spawn.spawner(1600, -500) + spawn.sniper(1700, -120) // spawn.cellBossCulture(1600, -500) // spawn.shooter(1600, -500) // spawn.striker(1600, -500) diff --git a/js/mods.js b/js/mods.js index 8111fbb..74ea71e 100644 --- a/js/mods.js +++ b/js/mods.js @@ -342,18 +342,20 @@ const mod = { }, { name: "self-replication", - description: "duplicate your permanent bots
remove all your ammo", + description: "duplicate your permanent bots
remove 80% of your ammo", maxCount: 1, count: 0, isNonRefundable: true, allowed() { - return mod.foamBotCount + mod.nailBotCount + mod.laserBotCount > 1 + return mod.foamBotCount + mod.nailBotCount + mod.laserBotCount > 2 }, - requires: "2 or more bots", + requires: "3 or more bots", effect() { //remove ammo for (let i = 0, len = b.guns.length; i < len; ++i) { - if (b.guns[i].ammo != Infinity) b.guns[i].ammo = 0; + if (b.guns[i].ammo != Infinity) { + b.guns[i].ammo = Math.floor(b.guns[i].ammo * 0.2); + } } //double bots @@ -499,7 +501,7 @@ const mod = { }, { name: "waste energy recovery", - description: "regen 7% of max energy every second
active for 5 seconds after a mob dies", + description: "regen 6% of max energy every second
active for 5 seconds after a mob dies", maxCount: 1, count: 0, allowed() { @@ -648,7 +650,7 @@ const mod = { }, { name: "energy conservation", - description: "+15% of damage done recovered as energy", + description: "+13% of damage done recovered as energy", maxCount: 9, count: 0, allowed() { @@ -656,8 +658,7 @@ const mod = { }, requires: "", effect() { - mod.energySiphon += 0.15; - mech.energy = mech.maxEnergy + mod.energySiphon += 0.13; }, remove() { mod.energySiphon = 0; @@ -1032,7 +1033,7 @@ const mod = { }, { name: "shotgun spin-statistics", - description: "firing the shotgun makes you
immune to harm for 1 second", + description: "firing the shotgun makes you
immune to harm while on cooldown", maxCount: 1, count: 0, allowed() { @@ -1591,7 +1592,7 @@ const mod = { }, { name: "degenerate matter", - description: "2x energy drain for negative mass field
increase harm reduction to 90%", + description: "negative mass field
harm reduction is increased to 80%", maxCount: 1, count: 0, allowed() { @@ -1600,9 +1601,11 @@ const mod = { requires: "negative mass field", effect() { mod.isHarmReduce = true + mech.fieldHarmReduction = 0.2; }, remove() { mod.isHarmReduce = false; + if (mech.fieldUpgrades[mech.fieldMode].name === "negative mass field") mech.setField("negative mass field") //reset harm reduction } }, { @@ -1655,7 +1658,7 @@ const mod = { }, { name: "frequency resonance", - description: "standing wave harmonics shield is retuned
increase size and blocking efficiency by 30%", + description: "standing wave harmonics shield is retuned
increase size and blocking efficiency by 40%", maxCount: 9, count: 0, allowed() { @@ -1663,8 +1666,8 @@ const mod = { }, requires: "standing wave harmonics", effect() { - mech.fieldRange += 175 * 0.2 - mech.fieldShieldingScale *= 0.7 + mech.fieldRange += 175 * 0.21 + mech.fieldShieldingScale *= 0.6 }, remove() { mech.fieldRange = 175; diff --git a/js/player.js b/js/player.js index 8cb63c7..89b3ffb 100644 --- a/js/player.js +++ b/js/player.js @@ -69,7 +69,7 @@ const mech = { mass: 5, FxNotHolding: 0.015, Fx: 0.015, //run Force on ground // - FxAir: 0.016, //run Force in Air + FxAir: 0.016, // 0.4/5/5 run Force in Air yOff: 70, yOffGoal: 70, onGround: false, //checks if on ground or in air @@ -112,6 +112,7 @@ const mech = { ground: 0.01, air: 0.0025 }, + airSpeedLimit: 125, // 125/mass/mass = 5 angle: 0, walk_cycle: 0, stepSize: 0, @@ -208,152 +209,101 @@ const mech = { } } else { //sets a hard land where player stays in a crouch for a bit and can't jump - //crouch is forced in keyMove() on ground section below + //crouch is forced in groundControl below const momentum = player.velocity.y * player.mass //player mass is 5 so this triggers at 26 down velocity, unless the player is holding something if (momentum > 130) { mech.doCrouch(); mech.yOff = mech.yOffWhen.jump; mech.hardLandCD = mech.cycle + Math.min(momentum / 6.5 - 6, 40) - if (mod.isStomp) { - const len = Math.min(25, (momentum - 120) * 0.1) - for (let i = 0; i < len; i++) { - b.spore(player) //spawn drone - } - } else if (player.velocity.y > 27 && momentum > 180 * mod.squirrelFx) { //falling damage - let dmg = Math.sqrt(momentum - 180) * 0.01 - dmg = Math.min(Math.max(dmg, 0.02), 0.20); - mech.damage(dmg); - } + // if (mod.isStomp) { + // const len = Math.min(25, (momentum - 120) * 0.1) + // for (let i = 0; i < len; i++) { + // b.spore(player) //spawn drone + // } + // } else if (player.velocity.y > 27 && momentum > 180 * mod.squirrelFx) { //falling damage + // let dmg = Math.sqrt(momentum - 180) * 0.01 + // dmg = Math.min(Math.max(dmg, 0.02), 0.20); + // mech.damage(dmg); + // } } else { mech.yOffGoal = mech.yOffWhen.stand; } } }, buttonCD_jump: 0, //cool down for player buttons - keyMove() { - if (mech.onGround) { //on ground ********************** - if (mech.crouch) { - if (!(keys[83] || keys[40]) && mech.checkHeadClear() && mech.hardLandCD < mech.cycle) mech.undoCrouch(); - } else if (keys[83] || keys[40] || mech.hardLandCD > mech.cycle) { - mech.doCrouch(); //on ground && not crouched and pressing s or down - } else if ((keys[87] || keys[38]) && mech.buttonCD_jump + 20 < mech.cycle && mech.yOffWhen.stand > 23) { - mech.buttonCD_jump = mech.cycle; //can't jump again until 20 cycles pass + groundControl() { + if (mech.crouch) { + if (!(keys[83] || keys[40]) && mech.checkHeadClear() && mech.hardLandCD < mech.cycle) mech.undoCrouch(); + } else if (keys[83] || keys[40] || mech.hardLandCD > mech.cycle) { + mech.doCrouch(); //on ground && not crouched and pressing s or down + } else if ((keys[87] || keys[38]) && mech.buttonCD_jump + 20 < mech.cycle && mech.yOffWhen.stand > 23) { + mech.buttonCD_jump = mech.cycle; //can't jump again until 20 cycles pass - //apply a fraction of the jump force to the body the player is jumping off of - Matter.Body.applyForce(mech.standingOn, mech.pos, { - x: 0, - y: mech.jumpForce * 0.12 * Math.min(mech.standingOn.mass, 5) - }); + //apply a fraction of the jump force to the body the player is jumping off of + Matter.Body.applyForce(mech.standingOn, mech.pos, { + x: 0, + y: mech.jumpForce * 0.12 * Math.min(mech.standingOn.mass, 5) + }); - player.force.y = -mech.jumpForce; //player jump force - Matter.Body.setVelocity(player, { //zero player y-velocity for consistent jumps - x: player.velocity.x, - y: 0 - }); - } - - //horizontal move on ground - - - - // function blink(dir) { - // dir *= 6 - // mech.fieldCDcycle = mech.cycle + 15; - // for (let i = 0; i < 100; i++) { - // Matter.Body.setPosition(player, { - // x: player.position.x + dir, - // y: player.position.y - // }); - // const bounds = { - // min: { - // x: player.bounds.min.x, - // y: player.bounds.min.y - // }, - // max: { - // x: player.bounds.max.x, - // y: player.bounds.max.y - 30 - // } - // } - - // if (Matter.Query.region(map, bounds).length !== 0 || Matter.Query.region(body, bounds).length !== 0) { - // Matter.Body.setPosition(player, { - // x: player.position.x - dir, - // y: player.position.y - // }); - // break; - // } - // } - // } - - //apply a force to move - if (keys[65] || keys[37]) { //left / a - // if (game.mouseDownRight && mech.fieldCDcycle < mech.cycle && !mech.crouch) { - // blink(-1) - // } else { - if (player.velocity.x > -2) { - player.force.x -= mech.Fx * 1.5 - } else { - player.force.x -= mech.Fx - } - // } - } else if (keys[68] || keys[39]) { //right / d - // if (game.mouseDownRight && mech.fieldCDcycle < mech.cycle && !mech.crouch) { - // blink(1) - // } else { - if (player.velocity.x < 2) { - player.force.x += mech.Fx * 1.5 - } else { - player.force.x += mech.Fx - } - // } - } else { - const stoppingFriction = 0.92; - Matter.Body.setVelocity(player, { - x: player.velocity.x * stoppingFriction, - y: player.velocity.y * stoppingFriction - }); - } - //come to a stop if fast or if no move key is pressed - if (player.speed > 4) { - const stoppingFriction = (mech.crouch) ? 0.65 : 0.89; // this controls speed when crouched - Matter.Body.setVelocity(player, { - x: player.velocity.x * stoppingFriction, - y: player.velocity.y * stoppingFriction - }); - } - } else { // in air ********************************** - //check for short jumps - if ( - mech.buttonCD_jump + 60 > mech.cycle && //just pressed jump - !(keys[87] || keys[38]) && //but not pressing jump key - mech.Vy < 0 //moving up - ) { - Matter.Body.setVelocity(player, { - //reduce player y-velocity every cycle - x: player.velocity.x, - y: player.velocity.y * 0.94 - }); - } - const limit = 125 / player.mass / player.mass - if (keys[65] || keys[37]) { - if (player.velocity.x > -limit) player.force.x -= mech.FxAir; // move player left / a - } else if (keys[68] || keys[39]) { - if (player.velocity.x < limit) player.force.x += mech.FxAir; //move player right / d - } - // if ((keys[83] || keys[40])) { //ground stomp when pressing down - // player.force.y += 0.1; - // if (player.velocity.y > 50) { - // Matter.Body.setVelocity(player, { - // x: 0, - // y: 50 - // }); - // } - // } + player.force.y = -mech.jumpForce; //player jump force + Matter.Body.setVelocity(player, { //zero player y-velocity for consistent jumps + x: player.velocity.x, + y: 0 + }); } - //smoothly move leg height towards height goal - mech.yOff = mech.yOff * 0.85 + mech.yOffGoal * 0.15; + if (keys[65] || keys[37]) { //left / a + // if (game.mouseDownRight && mech.fieldCDcycle < mech.cycle && !mech.crouch) { + // blink(-1) + // } else { + if (player.velocity.x > -2) { + player.force.x -= mech.Fx * 1.5 + } else { + player.force.x -= mech.Fx + } + // } + } else if (keys[68] || keys[39]) { //right / d + // if (game.mouseDownRight && mech.fieldCDcycle < mech.cycle && !mech.crouch) { + // blink(1) + // } else { + if (player.velocity.x < 2) { + player.force.x += mech.Fx * 1.5 + } else { + player.force.x += mech.Fx + } + // } + } else { + const stoppingFriction = 0.92; + Matter.Body.setVelocity(player, { + x: player.velocity.x * stoppingFriction, + y: player.velocity.y * stoppingFriction + }); + } + //come to a stop if fast or if no move key is pressed + if (player.speed > 4) { + const stoppingFriction = (mech.crouch) ? 0.65 : 0.89; // this controls speed when crouched + Matter.Body.setVelocity(player, { + x: player.velocity.x * stoppingFriction, + y: player.velocity.y * stoppingFriction + }); + } + }, + airControl() { + //check for short jumps //moving up //recently pressed jump //but not pressing jump key now + if (mech.buttonCD_jump + 60 > mech.cycle && !(keys[87] || keys[38]) && mech.Vy < 0) { + Matter.Body.setVelocity(player, { + //reduce player y-velocity every cycle + x: player.velocity.x, + y: player.velocity.y * 0.94 + }); + } + + if (keys[65] || keys[37]) { + if (player.velocity.x > -mech.airSpeedLimit / player.mass / player.mass) player.force.x -= mech.FxAir; // move player left / a + } else if (keys[68] || keys[39]) { + if (player.velocity.x < mech.airSpeedLimit / player.mass / player.mass) player.force.x += mech.FxAir; //move player right / d + } }, alive: false, death() { @@ -374,6 +324,7 @@ const mech = { if (mod.mods[i].count < mod.mods[i].maxCount && !mod.mods[i].isNonRefundable && mod.mods[i].name !== "quantum immortality" && + mod.mods[i].name !== "determinism" && mod.mods[i].allowed() ) options.push(i); } @@ -507,7 +458,7 @@ const mech = { immuneCycle: 0, //used in engine harmReduction() { let dmg = 1 - dmg *= mech.fieldDamageResistance + dmg *= mech.fieldHarmReduction dmg *= mod.isSlowFPS ? 0.85 : 1 if (mod.energyRegen === 0) dmg *= 0.5 //0.22 + 0.78 * mech.energy //77% damage reduction at zero energy if (mod.isEntanglement && b.inventory[0] === b.activeGun) { @@ -539,7 +490,7 @@ const mech = { dmg *= mech.harmReduction() if (mod.isEnergyHealth) { - mech.energy -= dmg; + mech.energy -= dmg * 1.25; //energy takes an extra 25% damage for balancing purposes if (mech.energy < 0 || isNaN(mech.energy)) { if (mod.isDeathAvoid && powerUps.reroll.rerolls) { //&& Math.random() < 0.5 powerUps.reroll.changeRerolls(-1) @@ -730,6 +681,7 @@ const mech = { // ctx.fillStyle = '#9cf' //'#0cf'; // ctx.fill() ctx.restore(); + mech.yOff = mech.yOff * 0.85 + mech.yOffGoal * 0.15; //smoothly move leg height towards height goal }, // ********************************************* // **************** fields ********************* @@ -754,7 +706,7 @@ const mech = { fieldRegen: 0, fieldMode: 0, fieldFire: false, - fieldDamageResistance: 1, + fieldHarmReduction: 1, holdingMassScale: 0, fieldArc: 0, fieldThreshold: 0, @@ -766,14 +718,18 @@ const mech = { mech.fieldRegen = mod.energyRegen; //0.001 mech.fieldMeterColor = "#0cf" mech.fieldShieldingScale = 1; + mech.fieldBlockCD = 10; game.isBodyDamage = true; - mech.fieldDamageResistance = 1; + mech.fieldHarmReduction = 1; mech.fieldRange = 155; mech.fieldFire = false; mech.fieldCDcycle = 0; mech.isStealth = false; player.collisionFilter.mask = cat.body | cat.map | cat.mob | cat.mobBullet | cat.mobShield + mech.airSpeedLimit = 125 + mech.drop(); mech.holdingMassScale = 0.5; + mech.fieldArc = 0.2; //run calculateFieldThreshold after setting fieldArc, used for powerUp grab and mobPush with lookingAt(mob) mech.calculateFieldThreshold(); //run calculateFieldThreshold after setting fieldArc, used for powerUp grab and mobPush with lookingAt(mob) mech.isBodiesAsleep = true; @@ -1059,7 +1015,7 @@ const mech = { x: player.velocity.x - (15 * unit.x) / massRoot, y: player.velocity.y - (15 * unit.y) / massRoot }); - mech.fieldCDcycle = mech.cycle + 10; + mech.fieldCDcycle = mech.cycle + mech.fieldBlockCD; if (mech.crouch) { Matter.Body.setVelocity(player, { x: player.velocity.x + 0.4 * unit.x * massRoot, @@ -1267,6 +1223,7 @@ const mech = { description: "three oscillating shields are permanently active
energy regenerates while field is active", isEasyToAim: true, effect: () => { + mech.fieldBlockCD = 0; mech.hold = function () { if (mech.isHolding) { mech.drawHold(mech.holdingTarget); @@ -1281,9 +1238,9 @@ const mech = { mech.holdingTarget = null; //clears holding target (this is so you only pick up right after the field button is released and a hold target exists) } if (mech.energy > 0.1 && mech.fieldCDcycle < mech.cycle) { - const fieldRange1 = (0.6 + 0.35 * Math.sin(mech.cycle / 23)) * mech.fieldRange - const fieldRange2 = (0.55 + 0.4 * Math.sin(mech.cycle / 37)) * mech.fieldRange - const fieldRange3 = (0.5 + 0.45 * Math.sin(mech.cycle / 47)) * mech.fieldRange + const fieldRange1 = (0.7 + 0.3 * Math.sin(mech.cycle / 23)) * mech.fieldRange + const fieldRange2 = (0.6 + 0.4 * Math.sin(mech.cycle / 37)) * mech.fieldRange + const fieldRange3 = (0.55 + 0.45 * Math.sin(mech.cycle / 47)) * mech.fieldRange const netfieldRange = Math.max(fieldRange1, fieldRange2, fieldRange3) ctx.fillStyle = "rgba(110,170,200," + (0.04 + mech.energy * (0.12 + 0.13 * Math.random())) + ")"; ctx.beginPath(); @@ -1419,16 +1376,21 @@ const mech = { }, { name: "negative mass field", - description: "use energy to nullify   gravity
reduce harm by 80% while field is active", + description: "use energy to nullify   gravity
reduce harm by 60%", fieldDrawRadius: 0, isEasyToAim: true, effect: () => { mech.fieldFire = true; mech.holdingMassScale = 0.03; //can hold heavier blocks with lower cost to jumping mech.fieldMeterColor = "#000" - + if (mod.isHarmReduce) { + mech.fieldHarmReduction = 0.2; + } else { + mech.fieldHarmReduction = 0.4; + } mech.hold = function () { - mech.fieldDamageResistance = 1; + mech.airSpeedLimit = 125 //5 * player.mass * player.mass + mech.FxAir = 0.016 if (mech.isHolding) { mech.drawHold(mech.holdingTarget); mech.holding(); @@ -1436,16 +1398,10 @@ const mech = { } else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < mech.cycle) { //push away mech.grabPowerUp(); mech.lookForPickUp(); - let DRAIN = 0.00105; + const DRAIN = 0.00035 if (mech.energy > DRAIN) { - if (mod.isHarmReduce) { - mech.fieldDamageResistance = 0.1; // 1 - 0.9 - DRAIN = 0.0007 //2x energy drain - } else { - mech.fieldDamageResistance = 0.2; // 1 - 0.8 - DRAIN = 0.00035 - } - + mech.airSpeedLimit = 400 // 7* player.mass * player.mass + mech.FxAir = 0.005 // mech.pushMobs360(); //repulse mobs @@ -1499,12 +1455,12 @@ const mech = { if (keys[65] || keys[68] || keys[37] || keys[39]) { Matter.Body.setVelocity(player, { x: player.velocity.x * 0.99, - y: player.velocity.y * 0.97 + y: player.velocity.y * 0.98 }); } else { //slow rise and fall Matter.Body.setVelocity(player, { - x: player.velocity.x, - y: player.velocity.y * 0.97 + x: player.velocity.x * 0.99, + y: player.velocity.y * 0.98 }); } @@ -1554,11 +1510,11 @@ const mech = { }, { name: "plasma torch", - description: "use energy to emit damaging plasma
reduce harm by 33%", + description: "use energy to emit damaging plasma
reduce harm by 20%", isEasyToAim: false, effect: () => { mech.fieldMeterColor = "#f0f" - mech.fieldDamageResistance = 0.67; //reduce harm by 33% + mech.fieldHarmReduction = 0.80; mech.hold = function () { if (mech.isHolding) { @@ -1568,7 +1524,7 @@ const mech = { } else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < mech.cycle) { //not hold but field button is pressed mech.grabPowerUp(); mech.lookForPickUp(); - const DRAIN = 0.001 + const DRAIN = 0.0013 if (mech.energy > DRAIN) { mech.energy -= DRAIN; if (mech.energy < 0) { @@ -2065,7 +2021,7 @@ const mech = { for (let i = 0, len = body.length; i < len; ++i) { if (Vector.magnitude(Vector.sub(body[i].position, mech.fieldPosition)) < mech.fieldRadius) { - const DRAIN = speed * body[i].mass * 0.000022 + const DRAIN = speed * body[i].mass * 0.000018 if (mech.energy > DRAIN) { mech.energy -= DRAIN; Matter.Body.setVelocity(body[i], velocity); //give block mouse velocity diff --git a/js/powerup.js b/js/powerup.js index ef11596..2295d71 100644 --- a/js/powerup.js +++ b/js/powerup.js @@ -391,7 +391,7 @@ const powerUps = { spawnBossPowerUp(x, y) { //boss spawns field and gun mod upgrades if (game.difficultyMode > 1 || Math.random() < 0.66) { //easy and normal have only a 66% chance for a power up spawnPowerUps() - if (game.difficultyMode > 2 && Math.random() < 0.33) spawnPowerUps() //why? has a 33% chance for an extra power up + if (game.difficultyMode > 2 && level.levelsCleared % 2 == 0) spawnPowerUps() //why? has an extra power up on even numbered levels } else { if (mech.health < 0.65 && !mod.isEnergyHealth) { powerUps.spawn(x, y, "heal"); @@ -416,7 +416,7 @@ const powerUps = { } else if (Math.random() < 0.5) { powerUps.spawn(x, y, "gun") if (Math.random() < mod.bayesian) powerUps.spawn(x, y, "gun") - } else if (mech.health < 0.65 && !mod.isEnergyHealth) { + } else if (mech.health < 0.65 && !mod.isEnergyHealth || mod.bayesian) { powerUps.spawn(x, y, "heal"); powerUps.spawn(x, y, "heal"); powerUps.spawn(x, y, "heal"); @@ -427,7 +427,7 @@ const powerUps = { powerUps.spawn(x, y, "heal"); powerUps.spawn(x, y, "heal"); } - } else if (!mod.bayesian) { + } else { powerUps.spawn(x, y, "ammo"); powerUps.spawn(x, y, "ammo"); powerUps.spawn(x, y, "ammo"); diff --git a/js/spawn.js b/js/spawn.js index 84b85f6..f01158f 100644 --- a/js/spawn.js +++ b/js/spawn.js @@ -83,7 +83,8 @@ const spawn = { }, randomLevelBoss(x, y) { // other bosses: suckerBoss, laserBoss, tetherBoss, snakeBoss //all need a particular level to work so they are not included - const options = ["shooterBoss", "cellBossCulture", "bomberBoss", "spiderBoss", "launcherBoss", "laserTargetingBoss"] // , "timeSkipBoss" + // "shooterBoss", "cellBossCulture", "bomberBoss", "spiderBoss", "launcherBoss", + const options = ["laserTargetingBoss"] // , "timeSkipBoss" spawn[options[Math.floor(Math.random() * options.length)]](x, y) }, //mob templates ********************************************************************************************* diff --git a/todo.txt b/todo.txt index 33fcfc3..2e7d2cb 100644 --- a/todo.txt +++ b/todo.txt @@ -1,25 +1,25 @@ -mod: doubles current bots -mod: shotgun fires nails -difficulty mode why? now has 33% chance for a second boss power up -difficulty mode normal and easy now have a 33% lower chance for a boss power up -mob: sniper -mob boss: Laser Targeting (might need balancing) +harmonic field now has no cooldown after blocking +negative mass field accelerates slower, but with a higher top speed +negative mass field harm reduction is now 60% and always on +mod degenerate matter increases the damage reduction from 60% to 80% +falling damage and damage from blocks have been removed +(I'm trying it out, let me know if you want it back) ************** TODO - n-gon ************** -maybe increase chance of boss power ups on why difficulty - hard as well? +add air control check box + set mech.airSpeedLimit to 0? to disable -mod - shotgun: fire nails instead of bullets - gain range? +on damage mines mod needs a nerf + spawns 2 mines every time... (from on dmg effects) + +give rail gun projectile a trail + only draw above speed 5 + track previous positions? shielded mobs don't knock back the same as unshielded mobs -buff harmonic field - cover legs? - no flicker after blocking? - movement fluidity let legs jump on mobs, but player will still take damage like: ori and the blind forest, celeste @@ -41,9 +41,6 @@ new type of mob vision that uses ray query with thickness bug - mines spawn extra mines when fired at thin map wall while jumping -mod - negative mass field move faster - less friction, more like flying? - what about a neutron bomb mod, that causes the bomb to activate right after you fire and slowly move forward with no gravity redblobgames.com/articles/visibility