From 10a8f44424ae266a3037a77c31382de0c295ebfa Mon Sep 17 00:00:00 2001 From: landgreen Date: Tue, 2 Jun 2020 07:15:16 -0700 Subject: [PATCH] time dilation mods new mod - heal: gives heals new mod - ammo: gives ammo mod mass-energy equivalence no longer benefits from harm reduction effects, but it also takes 25% less damage than before mod - timelike world line gives 2x faster speed and harm immunity when time dilation is active mod - Lorentz transformation improves move jump and fire speed even when time dilation isn't active (the same as 1 rank of squirrel cage rotor and auto-loading heuristics) --- .DS_Store | Bin 0 -> 6148 bytes js/bullet.js | 57 +++++++++++++++++++--------------- js/game.js | 5 +-- js/index.js | 4 +-- js/level.js | 5 ++- js/mods.js | 86 ++++++++++++++++++++++++++++++++++++++++++++------- js/player.js | 16 +++++++--- todo.txt | 11 +++++-- 8 files changed, 132 insertions(+), 52 deletions(-) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..9d89e74411aa05148df70e28ec074fb2c765523c GIT binary patch literal 6148 zcmeHKF>ezw6#m?v)TCXyfy8obOhp|F61s*9qEcZXGZN&kq(zrpMUD!n1SeJ9*jN}C zSQr?Ym|^1|u<{#VV1w`3Cb92Y#tI=n$^LwP@7d4abL<#^>OIcafmHw<7Qtwl)d?bc zDJ@yBJr{^d#wbSXgRC6yw=6?PU?4E?FESv%-3V(KVGot}`~C9qnX4O@X*w**A^SQn zZeDz|(fhpV>+`?r_jl)KgNpPKvBY@~FhzzEId;6+p+0c*hJ_o$s~a!hEq(nYF|@4a zk(_Sj#$(Putl$CeGon2m(S*_I)>ctwcI9$RUS+xTOAA}TGOZ>OKc3KI7Zt`R8b0qE zJ_~q=sc)mson(_wvtn45g-oQKJd(PXpa1E1sX09Uv2pi`PLK8(mvcgzI**2KJ)7rX z@Muz$lMy?3v||wkmpN>Nd`yi?g|%{nwq0J>>gd~iNH_3nKW90$es1V(trxs{%R#vp zwy}ll=;Jm9=r;oXP762SF7D8B6De*H*ODZxt#;-;mA-Q%v zI<%MlUDCed9;y5pblzQiS;g6iB$m=yF&OH=Kwuy+Fk?W@hnPh$u~-|_M+YnY1RzH2 z*21=2lHwCvOf1$0si7$2N;Iy@J~5PWXMb$%5{tD#;|^sXAIi?G>6A8AbTj`kAS8jRDpprW#Bi%LGJ1R literal 0 HcmV?d00001 diff --git a/js/bullet.js b/js/bullet.js index cb4071f..9d7dc8f 100644 --- a/js/bullet.js +++ b/js/bullet.js @@ -85,7 +85,7 @@ const b = { }, fireCD: 1, setFireCD() { - b.fireCD = mod.fireRate * mod.slowFire * (mod.isTimeSkip ? 0.66 : 1) + b.fireCD = mod.fireRate * mod.slowFire / mod.fastTime }, fireAttributes(dir, rotate = true) { if (rotate) { @@ -1278,7 +1278,7 @@ const b = { name: "super balls", description: "fire four balls in a wide arc
balls bounce with no momentum loss", ammo: 0, - ammoPack: 14, + ammoPack: 15, have: false, num: 5, isStarterGun: true, @@ -1335,8 +1335,8 @@ const b = { name: "flechettes", description: "fire a volley of uranium-235 needles
does damage over 3 seconds", ammo: 0, - ammoPack: 30, - defaultAmmoPack: 30, + ammoPack: 36, + defaultAmmoPack: 36, have: false, isStarterGun: true, isEasyToAim: false, @@ -1355,24 +1355,7 @@ const b = { const whom = Matter.Query.collides(this, mob) if (whom.length && this.speed > 20) { //if touching a mob who = whom[0].bodyA - if (who) { - - function hit(that) { - who.foundPlayer(); - if (mod.isDotFlechette) { - mobs.statusDoT(who, 0.5, 360) - } else { - mobs.statusDoT(who, 0.5, 180) - } - game.drawList.push({ //add dmg to draw queue - x: that.position.x, - y: that.position.y, - radius: 40, - color: "rgba(0,80,80,0.3)", - time: game.drawTime - }); - } - + if (who && who.mob) { if (mod.pierce) { let immune = false for (let i = 0; i < this.immuneList.length; i++) { @@ -1380,11 +1363,35 @@ const b = { } if (!immune) { this.immuneList.push(who.id) - hit(this) + who.foundPlayer(); + if (mod.isDotFlechette) { + mobs.statusDoT(who, 0.5, 360) + } else { + mobs.statusDoT(who, 0.5, 180) + } + game.drawList.push({ //add dmg to draw queue + x: this.position.x, + y: this.position.y, + radius: 40, + color: "rgba(0,80,80,0.3)", + time: game.drawTime + }); } } else { this.endCycle = 0; - hit(this) + who.foundPlayer(); + if (mod.isDotFlechette) { + mobs.statusDoT(who, 0.5, 360) + } else { + mobs.statusDoT(who, 0.5, 180) + } + game.drawList.push({ //add dmg to draw queue + x: this.position.x, + y: this.position.y, + radius: 40, + color: "rgba(0,80,80,0.3)", + time: game.drawTime + }); } } } else if (Matter.Query.collides(this, map).length) { //stick in walls @@ -2184,7 +2191,7 @@ const b = { name: "ice IX", description: "synthesize short-lived ice crystals
crystals seek out and freeze mobs", ammo: 0, - ammoPack: 75, + ammoPack: 73, have: false, isStarterGun: true, isEasyToAim: true, diff --git a/js/game.js b/js/game.js index 0110313..f7e7321 100644 --- a/js/game.js +++ b/js/game.js @@ -768,10 +768,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.06 - if (mech.energy > mech.maxEnergy) mech.energy = mech.maxEnergy; - } + if (mod.isEnergyRecovery && mech.energy < mech.maxEnergy) mech.energy += mech.maxEnergy * 0.06 if (mod.isHealthRecovery) mech.addHealth(0.01) } diff --git a/js/index.js b/js/index.js index 94c0f8e..d5163e3 100644 --- a/js/index.js +++ b/js/index.js @@ -284,7 +284,7 @@ const build = { } url += `&field=${encodeURIComponent(mech.fieldUpgrades[mech.fieldMode].name.trim())}` url += `&difficulty=${game.difficultyMode}` - url += `&level=${Number(document.getElementById("starting-level").value)}` + url += `&level=${Math.abs(Number(document.getElementById("starting-level").value))}` console.log(url) game.copyToClipBoard(url) alert('n-gon build URL copied to clipboard.\nPaste into browser address bar.') @@ -303,7 +303,7 @@ const build = { for (let i = 0; i < bullet.length; ++i) Matter.World.remove(engine.world, bullet[i]); bullet = []; //remove any bullets that might have spawned from mods - const levelsCleared = Number(document.getElementById("starting-level").value) + const levelsCleared = Math.abs(Number(document.getElementById("starting-level").value)) level.difficultyIncrease(Math.min(99, levelsCleared * game.difficultyMode)) //increase difficulty based on modes level.levelsCleared += levelsCleared; diff --git a/js/level.js b/js/level.js index 1e15812..aaaf757 100644 --- a/js/level.js +++ b/js/level.js @@ -17,7 +17,10 @@ const level = { // game.enableConstructMode() //used to build maps in testing mode // level.difficultyIncrease(9) // mech.setField("time dilation field") - // mod.giveMod("mutualism"); + // mod.giveMod("timelike world line"); + // mod.giveMod("Lorentz transformation"); + + // b.giveGuns("drones") // b.giveGuns("spores") // mech.setField("pilot wave") diff --git a/js/mods.js b/js/mods.js index 6816e1e..f3ac3b6 100644 --- a/js/mods.js +++ b/js/mods.js @@ -111,6 +111,42 @@ const mod = { }, mods: [{ + name: "heal", + description: "spawn 6 heal power ups", + maxCount: 9, + count: 0, + isNonRefundable: true, + allowed() { + return true + }, + requires: "", + effect() { + for (let i = 0; i < 6; i++) { + powerUps.spawn(mech.pos.x, mech.pos.y, "heal"); + if (Math.random() < mod.bayesian) powerUps.spawn(mech.pos.x, mech.pos.y, "heal"); + } + }, + remove() {} + }, + { + name: "ammo", + description: "spawn 6 ammo power ups", + maxCount: 9, + count: 0, + isNonRefundable: true, + allowed() { + return true + }, + requires: "", + effect() { + for (let i = 0; i < 6; i++) { + powerUps.spawn(mech.pos.x, mech.pos.y, "ammo"); + if (Math.random() < mod.bayesian) powerUps.spawn(mech.pos.x, mech.pos.y, "ammo"); + } + }, + remove() {} + }, + { name: "capacitor", // nameInfo: "", description: "increase damage based on stored energy
+1% damage for every 5.5% energy", @@ -217,7 +253,7 @@ const mod = { allowed() { return !mod.isEnergyHealth }, - requires: "mass-energy equivalence", + requires: "not mass-energy equivalence", effect() { mod.isEnergyLoss = true; }, @@ -536,7 +572,7 @@ const mod = { }, { name: "squirrel-cage rotor", - description: "jump higher and move faster
reduced harm from falling ", + description: "jump higher and move faster", maxCount: 9, count: 0, allowed() { @@ -545,13 +581,13 @@ const mod = { requires: "", effect() { // good with melee builds, content skipping builds mod.squirrelFx += 0.2; - mech.Fx = 0.016 * mod.squirrelFx; - mech.jumpForce += 0.038; + mod.squirrelJump += 0.09; + mech.setMovement() }, remove() { mod.squirrelFx = 1; - mech.Fx = 0.016; //if this changes update the values in definePlayerMass - mech.jumpForce = 0.42; //was 0.38 at 0.0019 gravity + mod.squirrelJump = 1; + mech.setMovement() } }, { @@ -594,9 +630,9 @@ const mod = { maxCount: 1, count: 0, allowed() { - return true + return !mod.isEnergyHealth }, - requires: "", + requires: "not mass-energy equivalence", effect() { mod.isEntanglement = true setTimeout(function () { @@ -610,7 +646,8 @@ const mod = { }, { name: "mass-energy equivalence", - description: "you can't die if your energy is above zero
your health is permanently set to zero", + description: "energy protects you instead of health
harm reduction effects provide no benefit", + // description: "you can't die if your energy is above zero
your health is permanently set to zero", maxCount: 1, count: 0, allowed() { @@ -770,7 +807,7 @@ const mod = { }, { name: "Bayesian inference", - description: "37% chance for double power ups to drop
ammo will no longer spawn", + description: "37% chance for double power ups to drop
ammo will no longer spawn from mobs", maxCount: 1, count: 0, allowed() { @@ -1611,7 +1648,7 @@ const mod = { }, { name: "timelike world line", - description: "time dilation increases your time rate by 2x
33% decreased delay after firing", + description: "time dilation increases your time rate by 2x
and makes you immune to harm", maxCount: 1, count: 0, allowed() { @@ -1627,6 +1664,28 @@ const mod = { b.setFireCD(); } }, + { + name: "Lorentz transformation", + description: "time dilation field has an effect while inactive
move, jump, and shoot 33% faster", + maxCount: 1, + count: 0, + allowed() { + return mech.fieldUpgrades[mech.fieldMode].name === "time dilation field" + }, + requires: "time dilation field", + effect() { + mod.fastTime = 1.33; + mod.fastTimeJump = 1.09; + mech.setMovement(); + b.setFireCD(); + }, + remove() { + mod.fastTime = 1; + mod.fastTimeJump = 1; + mech.setMovement(); + b.setFireCD(); + } + }, { name: "plasma jet", description: "increase plasma torch's range by 33%", @@ -1911,5 +1970,8 @@ const mod = { isDamageFromBulletCount: null, isLaserDiode: null, isNailShot: null, - slowFire: null + slowFire: null, + fastTime: null, + squirrelJump: null, + fastTimeJump: null, } \ No newline at end of file diff --git a/js/player.js b/js/player.js index 238655a..ca2794b 100644 --- a/js/player.js +++ b/js/player.js @@ -68,7 +68,12 @@ const mech = { defaultMass: 5, mass: 5, FxNotHolding: 0.015, - Fx: 0.015, //run Force on ground // + Fx: 0.016, //run Force on ground // + jumpForce: 0.42, + setMovement() { + mech.Fx = 0.016 * mod.squirrelFx * mod.fastTime; + mech.jumpForce = 0.42 * mod.squirrelJump * mod.fastTimeJump; + }, FxAir: 0.016, // 0.4/5/5 run Force in Air yOff: 70, yOffGoal: 70, @@ -106,7 +111,6 @@ const mech = { Sy: 0, //adds a smoothing effect to vertical only Vx: 0, Vy: 0, - jumpForce: 0.38, //0.38 //this is reset in mod.setupAllMods() gravity: 0.0024, //0.0019 //game.g is 0.001 friction: { ground: 0.01, @@ -487,10 +491,10 @@ const mech = { // y: 0 // }) // } - dmg *= mech.harmReduction() + if (mod.isEnergyHealth) { - mech.energy -= dmg * 1.25; //energy takes an extra 25% damage for balancing purposes + mech.energy -= dmg; if (mech.energy < 0 || isNaN(mech.energy)) { if (mod.isDeathAvoid && powerUps.reroll.rerolls) { //&& Math.random() < 0.5 powerUps.reroll.changeRerolls(-1) @@ -519,6 +523,7 @@ const mech = { } } } else { + dmg *= mech.harmReduction() mech.health -= dmg; if (mech.health < 0 || isNaN(mech.health)) { if (mod.isDeathAvoid && powerUps.reroll.rerolls > 0) { //&& Math.random() < 0.5 @@ -1735,6 +1740,7 @@ const mech = { game.cycle--; //pause all functions that depend on game cycle increasing if (mod.isTimeSkip) { + mech.immuneCycle = mech.cycle + 10; game.isTimeSkipping = true; mech.cycle++; game.gravity(); @@ -1747,7 +1753,7 @@ const mech = { // mech.draw(); mech.walk_cycle += mech.flipLegs * mech.Vx; // mech.hold(); - mech.energy += DRAIN; // 1 to undo the energy drain from time speed up, 0.5 to cut energy drain in half + // mech.energy += DRAIN; // 1 to undo the energy drain from time speed up, 0.5 to cut energy drain in half b.fire(); // b.bulletRemove(); b.bulletDo(); diff --git a/todo.txt b/todo.txt index 82e9914..782c5fa 100644 --- a/todo.txt +++ b/todo.txt @@ -1,7 +1,12 @@ -mod - electrostatic shots: 33 increased damage and 33% increased delay after firing -mod - time-like world line now also gives 33% reduced delay after firing (even when the field isn't active) -mod auto-loading heuristics now gives 20% reduced delay after firing (up from 15%) +new mod - heal: gives heals +new mod - ammo: gives ammo +mod mass-energy equivalence no longer benefits from harm reduction effects, +but it also takes 25% less damage than before + +mod - timelike world line gives 2x faster speed and harm immunity when time dilation is active +mod - Lorentz transformation improves move jump and fire speed even when time dilation isn't active + (the same as 1 rank of squirrel cage rotor and auto-loading heuristics) ************** TODO - n-gon **************