mod - microstates

mod - many worlds: 100% chance on choosing a power up to spawn a reroll if you have no rerolls
mod - microstates: +7% damage for every 10 active bullets
  (requires mod: Lorentzian topology)
mod - laser diode: laser, pulse, and laser-bots use 37% less energy
25% increase in difficulty scaling  (level 10 should now have the difficulty of level 12)
  effects: player damage, mod damage, mob acceleration, mob reaction time, mob cooldown time
This commit is contained in:
landgreen
2020-05-17 19:23:24 -07:00
parent 0ff8021ea8
commit 4a355caa60
10 changed files with 151 additions and 42 deletions

View File

@@ -519,6 +519,7 @@
<script src="js/mobs.js"></script> <script src="js/mobs.js"></script>
<script src="js/spawn.js"></script> <script src="js/spawn.js"></script>
<script src="js/level.js"></script> <script src="js/level.js"></script>
<script src="js/visibility.js"></script>
<script src="js/engine.js"></script> <script src="js/engine.js"></script>
<script src="js/index.js"></script> <script src="js/index.js"></script>
</body> </body>

View File

@@ -87,6 +87,8 @@ const b = {
isModSlowFPS: null, isModSlowFPS: null,
isModNeutronStun: null, isModNeutronStun: null,
manyWorlds: null, manyWorlds: null,
isModDamageFromBulletCount: null,
isModLaserDiode: null,
modOnHealthChange() { //used with acid mod modOnHealthChange() { //used with acid mod
if (b.isModAcidDmg && mech.health > 0.8) { if (b.isModAcidDmg && mech.health > 0.8) {
b.modAcidDmg = 0.5 b.modAcidDmg = 0.5
@@ -816,8 +818,8 @@ const b = {
} }
}, },
{ {
name: "many worlds", name: "many-worlds",
description: "after choosing a <strong>gun</strong>, <strong>field</strong>, or <strong class='color-m'>mod</strong><br><strong>66%</strong> chance to spawn a <strong class='color-r'>reroll</strong>", description: "if you have <strong>zero</strong> <strong class='color-r'>rerolls</strong>, spawn a <strong class='color-r'>reroll</strong><br>after choosing a <strong>gun</strong>, <strong>field</strong>, or <strong class='color-m'>mod</strong>",
maxCount: 1, maxCount: 1,
count: 0, count: 0,
allowed() { allowed() {
@@ -826,10 +828,6 @@ const b = {
requires: "", requires: "",
effect: () => { effect: () => {
b.manyWorlds = true; b.manyWorlds = true;
// for (let i = 0; i < 9; i++) {
// powerUps.spawn(mech.pos.x, mech.pos.y, "reroll");
// if (Math.random() < b.modBayesian) powerUps.spawn(mech.pos.x, mech.pos.y, "reroll");
// }
}, },
remove() { remove() {
b.manyWorlds = false; b.manyWorlds = false;
@@ -944,6 +942,22 @@ const b = {
b.isModBulletsLastLonger = 1; b.isModBulletsLastLonger = 1;
} }
}, },
{
name: "microstates",
description: "<strong>+7%</strong> <strong class='color-d'>damage</strong> for every <strong>10</strong> active <strong>bullets</strong>",
maxCount: 3,
count: 0,
allowed() {
return b.isModBulletsLastLonger > 1
},
requires: "Lorentzian topology",
effect() {
b.isModDamageFromBulletCount = true
},
remove() {
b.isModDamageFromBulletCount = false
}
},
{ {
name: "depleted uranium rounds", name: "depleted uranium rounds",
description: `your <strong>bullets</strong> are <strong>+16%</strong> larger<br>increased mass and physical <strong class='color-d'>damage</strong>`, description: `your <strong>bullets</strong> are <strong>+16%</strong> larger<br>increased mass and physical <strong class='color-d'>damage</strong>`,
@@ -1432,6 +1446,22 @@ const b = {
b.isModRailNails = false; b.isModRailNails = false;
} }
}, },
{
name: "laser diodes",
description: "<strong>lasers</strong> drain <strong>37%</strong> less <strong class='color-f'>energy</strong><br><em>effects laser gun, pulse gun, and laser-bot</em>",
maxCount: 1,
count: 0,
allowed() {
return b.haveGunCheck("pulse") || b.haveGunCheck("laser") || b.modLaserBotCount > 1
},
requires: "laser",
effect() {
b.isModLaserDiode = 0.63; //100%-37%
},
remove() {
b.isModLaserDiode = 1;
}
},
{ {
name: "specular reflection", name: "specular reflection",
description: "<strong>laser</strong> beams gain <strong>+1</strong> reflection<br><strong>+50%</strong> laser <strong class='color-d'>damage</strong> and <strong class='color-f'>energy</strong> drain", description: "<strong>laser</strong> beams gain <strong>+1</strong> reflection<br><strong>+50%</strong> laser <strong class='color-d'>damage</strong> and <strong class='color-f'>energy</strong> drain",
@@ -1604,7 +1634,7 @@ const b = {
maxCount: 1, maxCount: 1,
count: 0, count: 0,
allowed() { allowed() {
return mech.fieldUpgrades[mech.fieldMode].name === "nano-scale manufacturing" && !(b.isModMissileField || b.isModIceField) return mech.fieldUpgrades[mech.fieldMode].name === "nano-scale manufacturing" && !(b.isModMissileField || b.isModIceField || b.isModFastDrones)
}, },
requires: "nano-scale manufacturing", requires: "nano-scale manufacturing",
effect() { effect() {
@@ -1620,7 +1650,7 @@ const b = {
maxCount: 1, maxCount: 1,
count: 0, count: 0,
allowed() { allowed() {
return mech.fieldUpgrades[mech.fieldMode].name === "nano-scale manufacturing" && !(b.isModSporeField || b.isModIceField) return mech.fieldUpgrades[mech.fieldMode].name === "nano-scale manufacturing" && !(b.isModSporeField || b.isModIceField || b.isModFastDrones)
}, },
requires: "nano-scale manufacturing", requires: "nano-scale manufacturing",
effect() { effect() {
@@ -1636,7 +1666,7 @@ const b = {
maxCount: 1, maxCount: 1,
count: 0, count: 0,
allowed() { allowed() {
return mech.fieldUpgrades[mech.fieldMode].name === "nano-scale manufacturing" && !(b.isModSporeField || b.isModMissileField) return mech.fieldUpgrades[mech.fieldMode].name === "nano-scale manufacturing" && !(b.isModSporeField || b.isModMissileField || b.isModFastDrones)
}, },
requires: "nano-scale manufacturing", requires: "nano-scale manufacturing",
effect() { effect() {
@@ -1801,6 +1831,7 @@ const b = {
if (b.isModEnergyLoss) dmg *= 1.33; if (b.isModEnergyLoss) dmg *= 1.33;
if (b.isModRest && player.speed < 1) dmg *= 1.20; if (b.isModRest && player.speed < 1) dmg *= 1.20;
if (b.isModEnergyDamage) dmg *= 1 + mech.energy / 5.5; if (b.isModEnergyDamage) dmg *= 1 + mech.energy / 5.5;
if (b.isModDamageFromBulletCount) dmg *= 1 + bullet.length * 0.007
return dmg return dmg
}, },
bulletRemove() { //run in main loop bulletRemove() { //run in main loop
@@ -2834,7 +2865,7 @@ const b = {
//hit target with laser //hit target with laser
if (this.lockedOn && this.lockedOn.alive && mech.energy > 0.15) { if (this.lockedOn && this.lockedOn.alive && mech.energy > 0.15) {
mech.energy -= 0.0014 mech.energy -= 0.0014 * b.isModLaserDiode
//make sure you can still see vertex //make sure you can still see vertex
const DIST = Vector.magnitude(Vector.sub(this.vertices[0], this.lockedOn.position)); const DIST = Vector.magnitude(Vector.sub(this.vertices[0], this.lockedOn.position));
if (DIST - this.lockedOn.radius < this.range + 150 && if (DIST - this.lockedOn.radius < this.range + 150 &&
@@ -4117,7 +4148,7 @@ const b = {
if (mech.energy < b.modLaserFieldDrain) { if (mech.energy < b.modLaserFieldDrain) {
mech.fireCDcycle = mech.cycle + 100; // cool down if out of energy mech.fireCDcycle = mech.cycle + 100; // cool down if out of energy
} else { } else {
mech.energy -= mech.fieldRegen + b.modLaserFieldDrain mech.energy -= mech.fieldRegen + b.modLaserFieldDrain * b.isModLaserDiode
let best = { let best = {
x: null, x: null,
y: null, y: null,
@@ -4345,7 +4376,7 @@ const b = {
//use energy to explode //use energy to explode
const energy = 0.3 * Math.min(mech.energy, 1.75) const energy = 0.3 * Math.min(mech.energy, 1.75)
mech.energy -= energy mech.energy -= energy * b.isModLaserDiode
if (best.who) b.explosion(path[1], 1000 * energy, true) if (best.who) b.explosion(path[1], 1000 * energy, true)
mech.fireCDcycle = mech.cycle + Math.floor(60 * b.modFireRate); // cool down mech.fireCDcycle = mech.cycle + Math.floor(60 * b.modFireRate); // cool down

View File

@@ -49,6 +49,7 @@ const game = {
mobs.healthBar(); mobs.healthBar();
mech.draw(); mech.draw();
mech.hold(); mech.hold();
// v.draw(); //working on visibility work in progress
level.drawFills(); level.drawFills();
game.draw.drawMapPath(); game.draw.drawMapPath();
b.fire(); b.fire();
@@ -515,7 +516,8 @@ const game = {
game.difficultyMode = 1 game.difficultyMode = 1
level.difficultyDecrease(6); //if this stops being -6 change in build.calculateCustomDifficulty() level.difficultyDecrease(6); //if this stops being -6 change in build.calculateCustomDifficulty()
} }
if (game.difficultyMode === 4) level.difficultyIncrease(6) if (game.difficultyMode === 2) level.difficultyIncrease(1)
if (game.difficultyMode === 4) level.difficultyIncrease(4)
game.clearNow = true; game.clearNow = true;
document.getElementById("text-log").style.opacity = 0; document.getElementById("text-log").style.opacity = 0;
@@ -703,6 +705,9 @@ const game = {
}, },
checks() { checks() {
if (!(mech.cycle % 60)) { //once a second if (!(mech.cycle % 60)) { //once a second
console.log(bullet.length * 0.005)
if (mech.pos.y > game.fallHeight) { // if 4000px deep if (mech.pos.y > game.fallHeight) { // if 4000px deep
if (game.difficultyMode > 2) { if (game.difficultyMode > 2) {
mech.death(); mech.death();

View File

@@ -60,27 +60,52 @@ const level = {
// if (level.isBuildRun) num++ // if (level.isBuildRun) num++
for (let i = 0; i < num; i++) { for (let i = 0; i < num; i++) {
game.difficulty++ game.difficulty++
game.dmgScale += 0.17; //damage done by mobs increases each level game.dmgScale += 0.205; //damage done by mobs increases each level
b.dmgScale *= 0.91; //damage done by player decreases each level b.dmgScale *= 0.91; //damage done by player decreases each level
game.accelScale *= 1.02 //mob acceleration increases each level game.accelScale *= 1.024 //mob acceleration increases each level
game.lookFreqScale *= 0.98 //mob cycles between looks decreases each level game.lookFreqScale *= 0.976 //mob cycles between looks decreases each level
game.CDScale *= 0.97 //mob CD time decreases each level game.CDScale *= 0.964 //mob CD time decreases each level
} }
game.healScale = 1 / (1 + game.difficulty * 0.09) //a higher denominator makes for lower heals // mech.health += heal * game.healScale; game.healScale = 1 / (1 + game.difficulty * 0.09) //a higher denominator makes for lower heals // mech.health += heal * game.healScale;
}, },
difficultyDecrease(num = 1) { //used in easy mode for game.reset() difficultyDecrease(num = 1) { //used in easy mode for game.reset()
for (let i = 0; i < num; i++) { for (let i = 0; i < num; i++) {
game.difficulty-- game.difficulty--
game.dmgScale -= 0.17; //damage done by mobs increases each level game.dmgScale -= 0.205; //damage done by mobs increases each level
if (game.dmgScale < 0.1) game.dmgScale = 0.1; if (game.dmgScale < 0.1) game.dmgScale = 0.1;
b.dmgScale /= 0.91; //damage done by player decreases each level b.dmgScale /= 0.91; //damage done by player decreases each level
game.accelScale /= 1.02 //mob acceleration increases each level game.accelScale /= 1.024 //mob acceleration increases each level
game.lookFreqScale /= 0.98 //mob cycles between looks decreases each level game.lookFreqScale /= 0.976 //mob cycles between looks decreases each level
game.CDScale /= 0.97 //mob CD time decreases each level game.CDScale /= 0.964 //mob CD time decreases each level
} }
if (game.difficulty < 1) game.difficulty = 0; if (game.difficulty < 1) game.difficulty = 0;
game.healScale = 1 / (1 + game.difficulty * 0.09) game.healScale = 1 / (1 + game.difficulty * 0.09)
}, },
// difficultyIncrease(num = 1) {
// // if (level.isBuildRun) num++
// for (let i = 0; i < num; i++) {
// game.difficulty++
// game.dmgScale += 0.17; //damage done by mobs increases each level
// b.dmgScale *= 0.91; //damage done by player decreases each level
// game.accelScale *= 1.02 //mob acceleration increases each level
// game.lookFreqScale *= 0.98 //mob cycles between looks decreases each level
// game.CDScale *= 0.97 //mob CD time decreases each level
// }
// game.healScale = 1 / (1 + game.difficulty * 0.09) //a higher denominator makes for lower heals // mech.health += heal * game.healScale;
// },
// difficultyDecrease(num = 1) { //used in easy mode for game.reset()
// for (let i = 0; i < num; i++) {
// game.difficulty--
// game.dmgScale -= 0.17; //damage done by mobs increases each level
// if (game.dmgScale < 0.1) game.dmgScale = 0.1;
// b.dmgScale /= 0.91; //damage done by player decreases each level
// game.accelScale /= 1.02 //mob acceleration increases each level
// game.lookFreqScale /= 0.98 //mob cycles between looks decreases each level
// game.CDScale /= 0.97 //mob CD time decreases each level
// }
// if (game.difficulty < 1) game.difficulty = 0;
// game.healScale = 1 / (1 + game.difficulty * 0.09)
// },
difficultyText(mode = document.getElementById("difficulty-select").value) { difficultyText(mode = document.getElementById("difficulty-select").value) {
if (mode === "0") { if (mode === "0") {
return "easy" return "easy"

View File

@@ -1089,7 +1089,7 @@ const mobs = {
const len = body.length; const len = body.length;
const v = Matter.Vertices.hull(Matter.Vertices.clockwiseSort(this.vertices)) //might help with vertex collision issue, not sure const v = Matter.Vertices.hull(Matter.Vertices.clockwiseSort(this.vertices)) //might help with vertex collision issue, not sure
body[len] = Matter.Bodies.fromVertices(this.position.x, this.position.y, v); body[len] = Matter.Bodies.fromVertices(this.position.x, this.position.y, v);
Matter.Body.setVelocity(body[len], this.velocity); Matter.Body.setVelocity(body[len], Vector.mult(this.velocity, 0.5));
Matter.Body.setAngularVelocity(body[len], this.angularVelocity); Matter.Body.setAngularVelocity(body[len], this.angularVelocity);
body[len].collisionFilter.category = cat.body; body[len].collisionFilter.category = cat.body;
body[len].collisionFilter.mask = cat.player | cat.map | cat.body | cat.bullet | cat.mob | cat.mobBullet; body[len].collisionFilter.mask = cat.player | cat.map | cat.body | cat.bullet | cat.mob | cat.mobBullet;

View File

@@ -378,7 +378,7 @@ const mech = {
b.mods[i].name !== "Born rule" && b.mods[i].name !== "Born rule" &&
b.mods[i].name !== "determinism" && b.mods[i].name !== "determinism" &&
b.mods[i].name !== "reallocation" && b.mods[i].name !== "reallocation" &&
b.mods[i].name !== "many worlds" && b.mods[i].name !== "many-worlds" &&
b.mods[i].allowed() b.mods[i].allowed()
) options.push(i); ) options.push(i);
} }
@@ -551,7 +551,7 @@ const mech = {
mech.energy = mech.maxEnergy * 0.5 mech.energy = mech.maxEnergy * 0.5
// if (mech.energy < 0.05) mech.energy = 0.05 // if (mech.energy < 0.05) mech.energy = 0.05
mech.immuneCycle = mech.cycle + 120 //disable this.immuneCycle bonus seconds 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>", 300) 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 game.wipe = function () { //set wipe to have trails
ctx.fillStyle = "rgba(255,255,255,0.03)"; ctx.fillStyle = "rgba(255,255,255,0.03)";
@@ -579,7 +579,7 @@ const mech = {
mech.health = mech.maxHealth * 0.5 mech.health = mech.maxHealth * 0.5
// if (mech.health < 0.05) mech.health = 0.05 // if (mech.health < 0.05) mech.health = 0.05
mech.immuneCycle = mech.cycle + 120 //disable this.immuneCycle bonus seconds 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>", 300) 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 game.wipe = function () { //set wipe to have trails
ctx.fillStyle = "rgba(255,255,255,0.03)"; ctx.fillStyle = "rgba(255,255,255,0.03)";
@@ -1829,12 +1829,12 @@ const mech = {
mech.fieldPhase = 0; mech.fieldPhase = 0;
mech.hold = function () { mech.hold = function () {
function expandField() { // function expandField() {
if (this.fieldRange < 2000) { // if (this.fieldRange < 2000) {
this.fieldRange += 100 // this.fieldRange += 100
drawField(this.fieldRange) // drawField(this.fieldRange)
} // }
} // }
function drawField(radius) { function drawField(radius) {
radius *= 0.9 + 1 * mech.energy; radius *= 0.9 + 1 * mech.energy;

View File

@@ -21,7 +21,7 @@ const powerUps = {
powerUps.endDraft(); powerUps.endDraft();
}, },
endDraft() { endDraft() {
if (b.manyWorlds && Math.random() < 0.66) { if (b.manyWorlds && powerUps.reroll.rerolls < 1) {
powerUps.spawn(mech.pos.x, mech.pos.y, "reroll"); powerUps.spawn(mech.pos.x, mech.pos.y, "reroll");
if (Math.random() < b.modBayesian) powerUps.spawn(mech.pos.x, mech.pos.y, "reroll"); if (Math.random() < b.modBayesian) powerUps.spawn(mech.pos.x, mech.pos.y, "reroll");
} }

43
js/visibility.js Normal file
View File

@@ -0,0 +1,43 @@
// redblobgames.com/articles/visibility
// https://github.com/Silverwolf90/2d-visibility/tree/master/src
// could apply to explosions, neutron bomb, player LOS
const v = {
points: [],
populate() {
v.points = [{
x: -150,
y: -950
}, {
x: 710,
y: -950
}, {
x: 710,
y: -940
}, {
x: 710,
y: -710
}, {
x: 710,
y: -700
}, {
x: -150,
y: -700
}]
},
draw() {
ctx.beginPath();
ctx.moveTo(v.points[0].x, v.points[0].y)
for (let i = 0, len = v.points.length; i < len; i++) {
ctx.lineTo(v.points[i].x, v.points[i].y)
}
// ctx.fillStyle = "#333"
ctx.globalCompositeOperation = "destination-in";
ctx.fill();
ctx.globalCompositeOperation = "source-over";
ctx.clip();
}
}
v.populate();
// console.log(v.points)

View File

@@ -250,11 +250,11 @@ summary {
} }
.build-mod-selected { .build-mod-selected {
background-color: hsl(247, 100%, 84%); background-color: hsl(253, 100%, 84%);
} }
.build-mod-selected:hover { .build-mod-selected:hover {
background-color: hsl(247, 100%, 81%); background-color: hsl(253, 100%, 81%);
} }
.build-grid-disabled { .build-grid-disabled {
@@ -462,7 +462,7 @@ em {
} }
.color-m { .color-m {
color: hsl(246, 57%, 52%); color: hsl(253, 57%, 52%);
letter-spacing: 1px; letter-spacing: 1px;
} }
@@ -500,7 +500,7 @@ em {
.mod { .mod {
/* background: rgb(116, 102, 238); */ /* background: rgb(116, 102, 238); */
background: hsl(246, 80%, 67%); background: hsl(253, 80%, 67%);
} }
.grey { .grey {

View File

@@ -1,12 +1,16 @@
anthropic principle - now consumes 1 rerolls, and heals player to 50% health instead of letting them die mod - many worlds: 100% chance on choosing a power up to spawn a reroll if you have no rerolls
many worlds - 66% chance for rerolls mod - microstates: +7% damage for every 10 active bullets
quantum immortality - also gives 3 rerolls (requires mod: Lorentzian topology)
mod drones - Brushless Motor: drones move faster mod - laser diode: laser, pulse, and laser-bots use 37% less energy
mod drones - redundant systems: removed 25% increase in difficulty scaling (level 10 should now have the difficulty of level 12)
choices in power up selection should no longer repeat the previous choices when possible effects: player damage, mod damage, mob acceleration, mob reaction time, mob cooldown time
************** TODO - n-gon ************** ************** TODO - n-gon **************
rays can have width, how to use this?
Matter.Query.ray(bodies, startPoint, endPoint, [rayWidth])
wide lasers?
bug - mines spawn extra mines when fired at thin map wall while jumping bug - mines spawn extra mines when fired at thin map wall while jumping
mod - negative mass field move faster mod - negative mass field move faster