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)
This commit is contained in:
landgreen
2020-06-02 07:15:16 -07:00
parent a18126492f
commit 10a8f44424
8 changed files with 132 additions and 52 deletions

View File

@@ -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 <strong>four</strong> balls in a wide arc<br>balls <strong>bounce</strong> 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 <strong class='color-p'>uranium-235</strong> <strong>needles</strong><br>does <strong class='color-d'>damage</strong> over <strong>3</strong> 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 <strong>short-lived</strong> ice crystals<br>crystals <strong>seek</strong> out and <strong class='color-s'>freeze</strong> mobs",
ammo: 0,
ammoPack: 75,
ammoPack: 73,
have: false,
isStarterGun: true,
isEasyToAim: true,

View File

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

View File

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

View File

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

View File

@@ -111,6 +111,42 @@ const mod = {
},
mods: [{
name: "heal",
description: "spawn <strong>6</strong> <strong class='color-h'>heal</strong> 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 <strong>6 ammo</strong> 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: "<span id='mod-capacitor'></span>",
description: "increase <strong class='color-d'>damage</strong> based on stored <strong class='color-f'>energy</strong><br><strong>+1%</strong> <strong class='color-d'>damage</strong> for every <strong>5.5%</strong> <strong class='color-f'>energy</strong>",
@@ -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: "<strong>jump</strong> higher and <strong>move</strong> faster<br>reduced <strong>harm</strong> from <strong>falling</strong> ",
description: "<strong>jump</strong> higher and <strong>move</strong> 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 <strong>die</strong> if your <strong class='color-f'>energy</strong> is above <strong>zero</strong><br>your <strong>health</strong> is permanently set to <strong>zero</strong>",
description: "<strong class='color-f'>energy</strong> protects you instead of <strong>health</strong><br><strong>harm reduction</strong> effects provide <strong>no</strong> benefit",
// description: "you can't <strong>die</strong> if your <strong class='color-f'>energy</strong> is above <strong>zero</strong><br>your <strong>health</strong> is permanently set to <strong>zero</strong>",
maxCount: 1,
count: 0,
allowed() {
@@ -770,7 +807,7 @@ const mod = {
},
{
name: "Bayesian inference",
description: "<strong>37%</strong> chance for double <strong>power ups</strong> to drop<br><strong>ammo</strong> will no longer <strong>spawn</strong>",
description: "<strong>37%</strong> chance for double <strong>power ups</strong> to drop<br><strong>ammo</strong> will no longer <strong>spawn</strong> from mobs",
maxCount: 1,
count: 0,
allowed() {
@@ -1611,7 +1648,7 @@ const mod = {
},
{
name: "timelike world line",
description: "<strong>time dilation</strong> increases your time <strong>rate</strong> by <strong>2x</strong><br><strong>33%</strong> decreased <strong>delay</strong> after firing",
description: "<strong>time dilation</strong> increases your time <strong>rate</strong> by <strong>2x</strong><br> and makes you <strong>immune</strong> to <strong>harm</strong>",
maxCount: 1,
count: 0,
allowed() {
@@ -1627,6 +1664,28 @@ const mod = {
b.setFireCD();
}
},
{
name: "Lorentz transformation",
description: "<strong>time dilation field</strong> has an effect while inactive<br><strong>move</strong>, <strong>jump</strong>, and <strong>shoot</strong> <strong>33%</strong> 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 <strong>plasma torch's</strong> range by <strong>33%</strong>",
@@ -1911,5 +1970,8 @@ const mod = {
isDamageFromBulletCount: null,
isLaserDiode: null,
isNailShot: null,
slowFire: null
slowFire: null,
fastTime: null,
squirrelJump: null,
fastTimeJump: null,
}

View File

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