wormhole mods

some wormhole bug fixes
wormhole mod: cosmic string - damage mobs when you teleport through them
wormhole mod: Penrose process - overfill energy to 300% of max, with a block gets sucked into a hole
This commit is contained in:
landgreen
2020-10-18 06:53:53 -07:00
parent 4187645757
commit fb13945879
7 changed files with 98 additions and 54 deletions

View File

@@ -152,8 +152,7 @@ function collisionChecks(event) {
mech.energy -= 0.33 * mech.maxEnergy
mech.immuneCycle = 0; //player doesn't go immune to collision damage
mob[k].death();
game.drawList.push({
//add dmg to draw queue
game.drawList.push({ //add dmg to draw queue
x: pairs[i].activeContacts[0].vertex.x,
y: pairs[i].activeContacts[0].vertex.y,
radius: dmg * 2000,
@@ -161,8 +160,7 @@ function collisionChecks(event) {
time: game.drawTime
});
} else {
game.drawList.push({
//add dmg to draw queue
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,

View File

@@ -20,7 +20,7 @@ const level = {
// for (let i = 0; i < 10; i++) {
// mod.giveMod("laser-bot");
// }
// mod.giveMod("bot fabrication")
mod.giveMod("cosmic string")
level.intro(); //starting level
@@ -1416,7 +1416,7 @@ const level = {
}
// starting room
spawn.mapRect(-300, -1000, 600, 50);
spawn.mapRect(-300, -1000, 600, 100);
spawn.mapRect(-300, -1300, 450, 50);
spawn.mapRect(-300, -1300, 50, 350);
if (!backwards && game.difficulty > 1) spawn.bodyRect(100, -1250, 200, 240); //remove on backwards
@@ -1424,8 +1424,8 @@ const level = {
spawn.mapRect(-100, -975, 100, 975);
spawn.mapRect(-500, 100, 1950, 400);
spawn.boost(-425, 100, 1400);
spawn.mapRect(600, -1000, 750, 50);
spawn.mapRect(900, -500, 550, 50);
spawn.mapRect(600, -1000, 750, 100);
spawn.mapRect(900, -500, 550, 100);
spawn.mapRect(1250, -975, 100, 375);
spawn.bodyRect(1250, -600, 100, 100, 0.7);
spawn.mapRect(1250, -450, 100, 450);

View File

@@ -1208,7 +1208,7 @@ const mod = {
},
{
name: "Bayesian statistics",
description: "<strong>20%</strong> chance to <strong>duplicate</strong> spawned <strong>power ups</strong><br>after a <strong>collision</strong>, <strong>eject</strong> one of your <strong class='color-m'>mods</strong>",
description: "<strong>18%</strong> chance to <strong>duplicate</strong> spawned <strong>power ups</strong><br>after a <strong>collision</strong>, <strong>eject</strong> one of your <strong class='color-m'>mods</strong>",
maxCount: 1,
count: 0,
allowed() {
@@ -1217,13 +1217,13 @@ const mod = {
requires: "",
effect: () => {
mod.isBayesian = true
mod.duplicateChance += 0.2
mod.duplicateChance += 0.18
game.draw.powerUp = game.draw.powerUpBonus //change power up draw
},
remove() {
if (mod.isBayesian) {
mod.duplicateChance -= 0.2
mod.duplicateChance -= 0.18
if (mod.duplicateChance < 0) mod.duplicateChance = 0
}
mod.isBayesian = false
@@ -1232,7 +1232,7 @@ const mod = {
},
{
name: "stimulated emission",
description: "<strong>8%</strong> chance to <strong>duplicate</strong> spawned <strong>power ups</strong>",
description: "<strong>7%</strong> chance to <strong>duplicate</strong> spawned <strong>power ups</strong>",
maxCount: 9,
count: 0,
allowed() {
@@ -1240,7 +1240,7 @@ const mod = {
},
requires: "",
effect() {
mod.duplicateChance += 0.08
mod.duplicateChance += 0.07
game.draw.powerUp = game.draw.powerUpBonus //change power up draw
// this.description = `<strong>8%</strong> chance to <strong>duplicate</strong> spawned <strong>power ups</strong><br><em>chance to duplicate = ${mod.duplicateChance}</em>`
},
@@ -2676,7 +2676,7 @@ const mod = {
},
{
name: "pair production",
description: "<strong>power ups</strong> overload your <strong class='color-f'>energy</strong><br>by <strong>250%</strong> of your maximum <strong class='color-f'>energy</strong>",
description: "<strong>power ups</strong> overload your <strong class='color-f'>energy</strong><br>to <strong>250%</strong> of your maximum <strong class='color-f'>energy</strong>",
maxCount: 1,
count: 0,
allowed() {
@@ -2685,7 +2685,7 @@ const mod = {
requires: "nano-scale manufacturing",
effect: () => {
mod.isMassEnergy = true // used in mech.grabPowerUp
mech.energy = mech.maxEnergy * 2.5
if (mech.energy < mech.maxEnergy * 2.5) mech.energy = mech.maxEnergy * 2.5
},
remove() {
mod.isMassEnergy = false;
@@ -2805,6 +2805,38 @@ const mod = {
mod.isPilotFreeze = false
}
},
{
name: "cosmic string",
description: "when you <strong> tunnel</strong> through a <strong class='color-worm'>wormhole</strong><br><strong class='color-d'>damage</strong> mobs between the <strong>endpoints</strong>",
maxCount: 1,
count: 0,
allowed() {
return mech.fieldUpgrades[mech.fieldMode].name === "wormhole"
},
requires: "wormhole",
effect() {
mod.isWormholeDamage = true
},
remove() {
mod.isWormholeDamage = false
}
},
{
name: "Penrose process",
description: "after a <strong>block</strong> falls into a <strong class='color-worm'>wormhole</strong><br>overfill your <strong class='color-f'>energy</strong> to <strong>300%</strong> of your maximum<br> ",
maxCount: 1,
count: 0,
allowed() {
return mech.fieldUpgrades[mech.fieldMode].name === "wormhole"
},
requires: "wormhole",
effect() {
mod.isWormholeEnergy = true
},
remove() {
mod.isWormholeEnergy = false
}
},
{
name: "heals",
description: "spawn <strong>6</strong> <strong class='color-h'>heal</strong> power ups",
@@ -3040,5 +3072,7 @@ const mod = {
beamSplitter: null,
iceEnergy: null,
isPerfectBrake: null,
explosiveRadius: null
explosiveRadius: null,
isWormholeEnergy: null,
isWormholeDamage: null
}

View File

@@ -1713,7 +1713,7 @@ const mech = {
},
{
name: "time dilation field",
description: "use <strong class='color-f'>energy</strong> to <strong style='letter-spacing: 1px;'>stop time</strong><br><strong>move</strong> and <strong>fire</strong> while time is stopped<br><strong>touching</strong> mobs still does <strong class='color-harm'>harm</strong>",
description: "use <strong class='color-f'>energy</strong> to <strong style='letter-spacing: 1px;'>stop time</strong><br><strong>move</strong> and <strong>fire</strong> while time is stopped",
effect: () => {
// mech.fieldMeterColor = "#000"
mech.fieldFire = true;
@@ -2240,7 +2240,7 @@ const mech = {
},
{
name: "wormhole",
description: "use <strong class='color-f'>energy</strong> to <strong>tunnel</strong> through a <strong class='color-worm'>wormhole</strong><br>bullets may also traverse the <strong class='color-worm'>wormholes</strong><br>blocks and power ups can't exit it",
description: "use <strong class='color-f'>energy</strong> to <strong>tunnel</strong> through a <strong class='color-worm'>wormhole</strong><br>bullets may also traverse <strong class='color-worm'>wormholes</strong><br>blocks and power ups can't <strong>exit</strong>",
effect: () => {
game.replaceTextLog = true; //allow text over write
mech.drop();
@@ -2270,7 +2270,7 @@ const mech = {
const edge1b = Vector.add(Vector.mult(unit, -semiMajorAxis), mech.hole.pos1)
const edge2a = Vector.add(Vector.mult(unit, semiMajorAxis), mech.hole.pos2)
const edge2b = Vector.add(Vector.mult(unit, -semiMajorAxis), mech.hole.pos2)
const opacity = 200 / mech.fieldRange / mech.fieldRange
// const opacity = 200 / mech.fieldRange / mech.fieldRange
ctx.beginPath();
ctx.moveTo(edge1a.x, edge1a.y)
ctx.bezierCurveTo(mech.hole.pos1.x, mech.hole.pos1.y, mech.hole.pos2.x, mech.hole.pos2.y, edge2a.x, edge2a.y);
@@ -2353,6 +2353,7 @@ const mech = {
Matter.World.remove(engine.world, body[i]);
body.splice(i, 1);
mech.fieldRange *= 0.8
if (mod.isWormholeEnergy && mech.energy < mech.maxEnergy * 3) mech.energy = mech.maxEnergy * 3
break
}
}
@@ -2368,26 +2369,25 @@ const mech = {
Matter.World.remove(engine.world, body[i]);
body.splice(i, 1);
mech.fieldRange *= 0.8
if (mod.isWormholeEnergy && mech.energy < mech.maxEnergy * 3) mech.energy = mech.maxEnergy * 3
break
}
}
}
}
}
//mobs get sucked in
//mobs get pushed away
for (let i = 0, len = mob.length; i < len; i++) {
if (!mob[i].shield && !mob[i].isShielded) {
if (Vector.magnitude(Vector.sub(mech.hole.pos1, mob[i].position)) < suckRange) {
const pull = Vector.mult(Vector.normalise(Vector.sub(mech.hole.pos1, mob[i].position)), 0.05)
const slow = Vector.mult(mob[i].velocity, 0.99)
Matter.Body.setVelocity(mob[i], Vector.add(slow, pull));
}
if (Vector.magnitude(Vector.sub(mech.hole.pos2, mob[i].position)) < suckRange) {
const pull = Vector.mult(Vector.normalise(Vector.sub(mech.hole.pos2, mob[i].position)), 0.05)
const slow = Vector.mult(mob[i].velocity, 0.99)
Matter.Body.setVelocity(mob[i], Vector.add(slow, pull));
// if (!mob[i].shield && !mob[i].isShielded) {
if (Vector.magnitude(Vector.sub(mech.hole.pos1, mob[i].position)) < 200) {
const pull = Vector.mult(Vector.normalise(Vector.sub(mech.hole.pos1, mob[i].position)), -0.07)
Matter.Body.setVelocity(mob[i], Vector.add(mob[i].velocity, pull));
}
if (Vector.magnitude(Vector.sub(mech.hole.pos2, mob[i].position)) < 200) {
const pull = Vector.mult(Vector.normalise(Vector.sub(mech.hole.pos2, mob[i].position)), -0.07)
Matter.Body.setVelocity(mob[i], Vector.add(mob[i].velocity, pull));
}
// }
}
}
@@ -2399,11 +2399,15 @@ const mech = {
// Matter.Query.ray(map, jumpSensor.position, game.mouseInGame).length === 0 ||
if (
mech.hole.isReady && !mech.holdingTarget &&
(Matter.Query.ray(map, player.position, game.mouseInGame).length === 0 && Matter.Query.ray(map, mech.pos, game.mouseInGame).length === 0)
(
// Matter.Query.ray(map, player.position, game.mouseInGame).length === 0 &&
Matter.Query.ray(map, mech.pos, game.mouseInGame).length === 0 &&
Matter.Query.ray(map, mech.pos, Vector.add(Vector.mult(Vector.normalise(Vector.sub(game.mouseInGame, mech.pos)), 50), game.mouseInGame)).length === 0
)
) {
const sub = Vector.sub(game.mouseInGame, mech.pos)
const mag = Vector.magnitude(sub)
const drain = 0.005 * Math.sqrt(mag)
const drain = 0.06 + 0.007 * Math.sqrt(mag)
if (mech.energy > drain && mag > 150) {
mech.energy -= drain
mech.hole.isReady = false;
@@ -2435,6 +2439,24 @@ const mech = {
mech.hole.pos1.y = mech.pos.y
mech.hole.pos2.x = player.position.x
mech.hole.pos2.y = player.position.y
if (mod.isWormholeDamage) {
who = Matter.Query.ray(mob, mech.pos, game.mouseInGame, 60)
for (let i = 0; i < who.length; i++) {
if (who[i].body.alive) {
const dmg = b.dmgScale * 6
who[i].body.damage(dmg);
who[i].body.locatePlayer();
game.drawList.push({ //add dmg to draw queue
x: who[i].body.position.x,
y: who[i].body.position.y,
radius: Math.log(2 * dmg + 1.1) * 40,
color: game.playerDmgColor,
time: game.drawTime
});
}
}
}
}
}
// mech.grabPowerUp();

View File

@@ -412,7 +412,7 @@ const powerUps = {
}
},
onPickUp(where) {
if (mod.isMassEnergy) mech.energy = mech.maxEnergy * 2.5;
if (mod.isMassEnergy && mech.energy < mech.maxEnergy * 2.5) mech.energy = mech.maxEnergy * 2.5;
if (mod.isMineDrop) b.mine({
x: where.x,
y: where.y
@@ -549,7 +549,7 @@ const powerUps = {
}
if (have.length) {
const choose = have[Math.floor(Math.random() * have.length)]
game.makeTextLog(`<div class='circle mod'></div> &nbsp; <strong>${mod.mods[choose].name}</strong> ejected by Bayesian statistics`, 600) //message about what mod was lost
game.makeTextLog(`<div class='circle mod'></div> &nbsp; <strong>${mod.mods[choose].name}</strong> was ejected`, 600) //message about what mod was lost
for (let i = 0; i < mod.mods[choose].count; i++) {
powerUps.directSpawn(mech.pos.x, mech.pos.y, "mod");
powerUp[powerUp.length - 1].isBonus = true

View File

@@ -490,16 +490,16 @@ em {
.color-plasma {
color: #c0e;
letter-spacing: 1px;
background-color: rgba(132, 0, 255, 0.04);
background-color: rgba(132, 0, 255, 0.06);
padding: 2px;
border-radius: 4px;
border-radius: 9px;
letter-spacing: 1px;
}
.color-worm {
color: #fff;
text-shadow: 0px 0px 3px #357;
letter-spacing: 1px;
text-shadow: 1px 0px 2px #234;
/* letter-spacing: 2px; */
}
.color-harm {

View File

@@ -1,18 +1,12 @@
some wormhole bug fixes
wormhole mod: cosmic string - damage mobs when you teleport through them
wormhole mod: Penrose process - overfill energy to 300% of max, with a block gets sucked into a hole
mods ejected from Bayesian statistics can't duplicate
the power up boss moves faster, has less health,
it will eject one of your mods after a collision
and two health power ups
mod ammonium nitrate: increase explosion damage and area by 25%
also other explosion mods have been rebalanced (damage buffed, but self damage is also higher)
field: wormhole - teleport around, bullets teleport too, blocks and power ups get sucked in
mobs don't do much in worm hole yet, but that is coming with future mods
************** TODO - n-gon **************
set mouse 4 and 5 for gun switch
add an ending to the game
revamp the boss level, or add a new final level
final level requires you to kill something, not skip content
@@ -20,8 +14,6 @@ add an ending to the game
game never ends if you have used cheats
field wormhole
mobs are protected from bullets when stuck in a hole
mobs should destabilize holes, or take damage
store constant info about the holes: unit, angle to save processing
maybe bullets should be able to enter and exit multiple times
or bullets shouldn't get stuck at all?
@@ -29,9 +21,7 @@ field wormhole
player: drain energy when near a hole, does damage if no energy
mod: Hawking radiation: do damage, to mobs that get near the end points
this is good because it explains why mobs don't teleport
mod: cosmic string: do damage, like a laser for any mob that passes between the two portals, near the bezier curves
mod: extend immunity cycle after a teleport //mech.immuneCycle = mech.cycle + 15;
mod: reduce energy cost of teleportation
look for mods that could update description text with count and mod.is information
can only use variables that change in effect() and remove()