patch notes in n-gon

you can view the patch notes for the last few commits from the game menu
  this uses the github API, so it might have some delay

overfill mods add energy instead of setting energy to a value

bug - blocks in vertical portals can get stuck inside the portals
  fixed, but only for one portal... oh well

mobs that make a scrap bot, don't leave a block body anymore
This commit is contained in:
landgreen
2020-11-11 07:45:04 -08:00
parent 30cace60fb
commit 72e61eab78
11 changed files with 475 additions and 385 deletions

View File

@@ -96,7 +96,7 @@
<div id="settings">
<details>
<summary>settings</summary>
<div style="line-height: 150%;" id="details-div">
<div style="line-height: 150%;" class="details-div">
<label for="difficulty-select" title="effects: number of mobs, damage done by mobs, damage done to mobs, mob speed, heal effects">combat difficulty:</label>
<select name="difficulty-select" id="difficulty-select">
<option value="1">easy</option>
@@ -135,7 +135,7 @@
<div>
<details id="control-details">
<summary>controls</summary>
<div id="details-div">
<div class="details-div">
To change controls click a box<br>
and press an unused key.
<br><br>
@@ -196,10 +196,18 @@
</div>
</details>
</div>
<div>
<details id="updates">
<summary>updates</summary>
<div id="updates-div" class="details-div" style="font-size: 70%;">
</div>
</details>
</div>
<div>
<details>
<summary>about</summary>
<div id="details-div">
<div class="details-div">
<!-- <p>
n-gon is a 2-D physics platformer / shooter
<br>it has

View File

@@ -633,14 +633,15 @@ const b = {
},
sentry() {
this.lookFrequency = game.cycle + 60
this.endCycle = game.cycle + 720
this.endCycle = game.cycle + 1080
this.do = function() { //overwrite the do method for this bullet
this.force.y += this.mass * 0.002; //extra gravity
if (game.cycle > this.lookFrequency) {
this.lookFrequency = 14 + Math.floor(5 * Math.random())
this.lookFrequency = 10 + Math.floor(3 * Math.random())
this.do = function() { //overwrite the do method for this bullet
this.force.y += this.mass * 0.002; //extra gravity
if (!(game.cycle % this.lookFrequency) && !mech.isBodiesAsleep) { //find mob targets
this.endCycle -= 10
b.targetedNail(this.position, 1, 45 + 5 * Math.random(), 1100, false)
if (!(game.cycle % (this.lookFrequency * 6))) {
game.drawList.push({
@@ -1917,8 +1918,12 @@ const b = {
if (mod.isNailPoison) mobs.statusDoT(who, dmg * 0.22, 120) // one tick every 30 cycles
if (mod.isNailCrit && !who.shield && Vector.dot(Vector.normalise(Vector.sub(who.position, this.position)), Vector.normalise(this.velocity)) > 0.99) this.dmg *= 5 //crit if hit near center
};
mech.energy -= mech.fieldRegen + 0.008
if (mech.energy < 0.02) mech.fireCDcycle = mech.cycle + 60; // cool down
if (mech.energy < 0.01) {
mech.fireCDcycle = mech.cycle + 60; // cool down
} else {
mech.energy -= mech.fieldRegen + 0.009
}
}
}
},
@@ -2508,7 +2513,7 @@ const b = {
const me = bullet.length;
const dir = mech.angle;
bullet[me] = Bodies.polygon(mech.pos.x + 30 * Math.cos(mech.angle), mech.pos.y + 30 * Math.sin(mech.angle), 10, 4, b.fireAttributes(dir, false));
b.fireProps(mech.crouch ? 30 : 15, mech.crouch ? 28 : 18, dir, me); //cd , speed
b.fireProps(mech.crouch ? 45 : 25, mech.crouch ? 30 : 20, dir, me); //cd , speed
Matter.Body.setDensity(bullet[me], 0.000001);
bullet[me].endCycle = Infinity;
bullet[me].frictionAir = 0;
@@ -2630,7 +2635,7 @@ const b = {
//aoe damage to mobs
for (let i = 0, len = mob.length; i < len; i++) {
if (Vector.magnitude(Vector.sub(mob[i].position, this.position)) < this.damageRadius) {
let dmg = b.dmgScale * 0.035
let dmg = b.dmgScale * 0.05
if (Matter.Query.ray(map, mob[i].position, this.position).length > 0) dmg *= 0.3 //reduce damage if a wall is in the way
if (mob[i].shield) dmg *= 4 //x5 to make up for the /5 that shields normally take
mob[i].damage(dmg);
@@ -2864,7 +2869,7 @@ const b = {
fire() {
if (mod.isCapacitor) {
if (mech.energy > 0.16 || mod.isRailEnergyGain) {
mech.energy += 0.16 * (mod.isRailEnergyGain ? 1 : -1)
mech.energy += 0.16 * (mod.isRailEnergyGain ? 6 : -1)
mech.fireCDcycle = mech.cycle + Math.floor(30 * b.fireCD);
const me = bullet.length;
bullet[me] = Bodies.rectangle(mech.pos.x + 50 * Math.cos(mech.angle), mech.pos.y + 50 * Math.sin(mech.angle), 60, 14, {
@@ -3250,7 +3255,7 @@ const b = {
ctx.globalAlpha = 1;
} else if (mod.beamSplitter) {
const divergence = mech.crouch ? 0.15 : 0.2
let dmg = mod.laserDamage * 0.9
let dmg = 0.1 + mod.laserDamage * Math.pow(0.9, mod.laserDamage)
const where = {
x: mech.pos.x + 20 * Math.cos(mech.angle),
y: mech.pos.y + 20 * Math.sin(mech.angle)
@@ -3268,7 +3273,7 @@ const b = {
x: where.x + 3000 * Math.cos(mech.angle - i * divergence),
y: where.y + 3000 * Math.sin(mech.angle - i * divergence)
}, dmg)
dmg *= 0.9
// dmg *= 0.9
}
} else {
b.laser()

View File

@@ -133,7 +133,7 @@ function collisionChecks(event) {
mech.immuneCycle = mech.cycle + mod.collisionImmuneCycles; //player is immune to collision damage for 30 cycles
mob[k].foundPlayer();
let dmg = Math.min(Math.max(0.025 * Math.sqrt(mob[k].mass), 0.05), 0.3) * game.dmgScale; //player damage is capped at 0.3*dmgScale of 1.0
if (mod.isPiezo && mech.energy < mech.maxEnergy * 3) mech.energy = mech.maxEnergy * 3
if (mod.isPiezo) mech.energy += mech.maxEnergy * 2;
mech.damage(dmg);
if (mod.isBayesian) powerUps.ejectMod()
if (mob[k].onHit) mob[k].onHit(k);

View File

@@ -959,6 +959,48 @@ document.getElementById("difficulty-select").addEventListener("input", () => {
localStorage.setItem("localSettings", JSON.stringify(localSettings)); //update local storage
});
document.getElementById("updates").addEventListener("toggle", function() {
function loadJSON(path, success, error) { //generic function to get JSON
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState === XMLHttpRequest.DONE) {
if (xhr.status === 200) {
if (success)
success(JSON.parse(xhr.responseText));
} else {
if (error)
error(xhr);
}
}
};
xhr.open("GET", path, true);
xhr.send();
}
let text = `<strong>n-gon</strong>: <a href="https://github.com/landgreen/n-gon/blob/master/todo.txt">todo list</a> and complete <a href="https://github.com/landgreen/n-gon/commits/master">change-log</a><hr>`
document.getElementById("updates-div").innerHTML = text
/// https://api.github.com/repos/landgreen/n-gon/stats/commit_activity
loadJSON('https://api.github.com/repos/landgreen/n-gon/commits',
function(data) {
// console.log(data)
for (let i = 0, len = 4; i < len; i++) {
text += data[i].commit.author.date.substr(0, 10) + ": "; //+ "<br>"
text += data[i].commit.message
if (i < len - 1) text += "<hr>"
}
document.getElementById("updates-div").innerHTML = text.replace(/\n/g, "<br />")
console.log(text)
},
function(xhr) {
console.error(xhr);
}
);
})
//**********************************************************************
// main loop
//**********************************************************************

View File

@@ -1720,7 +1720,7 @@ const level = {
spawn.randomMob(-100, -900, -0.2);
spawn.randomBoss(3700, -1500, 0.4);
spawn.randomBoss(1700, -900, 0.4);
if (game.difficulty > 3) spawn.randomLevelBoss(2200, -1300);
if (game.difficulty > 3) spawn.randomLevelBoss(2600, -2300);
powerUps.addRerollToLevel() //needs to run after mobs are spawned
},
highrise() {
@@ -4283,7 +4283,7 @@ const level = {
// body[i].bounds.max.x - body[i].bounds.min.x < 100 && body[i].bounds.max.y - body[i].bounds.min.y < 100
if (Matter.Query.collides(this, [body[i]]).length === 0) {
if (body[i].isInPortal === this) body[i].isInPortal = null
} else if (body[i].isInPortal !== this) {
} else if (body[i].isInPortal !== this) { //touching this portal, but for the first time
body[i].isInPortal = this.portalPair
//teleport
if (this.portalPair.angle % (Math.PI / 2)) { //if left, right up or down
@@ -4300,6 +4300,10 @@ const level = {
}
let v = Vector.mult(this.portalPair.unit, mag)
Matter.Body.setVelocity(body[i], v);
} else if (body[i].speed < 0.1) { //touching this portal and very slow
Matter.World.remove(engine.world, body[i]);
body.splice(i, 1);
break
}
}
}

View File

@@ -140,8 +140,6 @@ const mobs = {
ctx.lineTo(who.vertices[0].x, who.vertices[0].y);
ctx.stroke();
ctx.fill();
},
endEffect() {
who.isStunned = false
@@ -1047,6 +1045,7 @@ const mobs = {
if (Math.random() < mod.isBotSpawner) {
b.randomBot(this.position, false)
bullet[bullet.length - 1].endCycle = game.cycle + 1000 + Math.floor(400 * Math.random())
this.leaveBody = false; // no body since it turned into the bot
}
if (mod.isExplodeMob) b.explosion(this.position, Math.min(550, Math.sqrt(this.mass + 2.5) * 50))
if (mod.nailsDeathMob) b.targetedNail(this.position, mod.nailsDeathMob, 40 + 7 * Math.random())

View File

@@ -922,7 +922,7 @@ const mod = {
maxCount: 1,
count: 0,
allowed() {
return mod.isStunField || mod.isPulseStun || mod.isNeutronStun || mod.oneSuperBall || mod.isHarmFreeze || mod.isIceField || mod.isIceCrystals || mod.isSporeFreeze || mod.isAoESlow || mod.isFreezeMobs || mod.isPilotFreeze || mod.haveGunCheck("ice IX") || mod.isCloakStun || mod.orbitBotCount > 1
return mod.isStunField || mod.isPulseStun || mod.isNeutronStun || mod.oneSuperBall || mod.isHarmFreeze || mod.isIceField || mod.isIceCrystals || mod.isSporeFreeze || mod.isAoESlow || mod.isFreezeMobs || mod.isPilotFreeze || mod.haveGunCheck("ice IX") || mod.isCloakStun || mod.orbitBotCount > 1 || mod.isWormholeDamage
},
requires: "a freezing or stunning effect",
effect() {
@@ -934,7 +934,7 @@ const mod = {
},
{
name: "piezoelectricity",
description: "<strong>colliding</strong> with mobs overfills <strong class='color-f'>energy</strong> by <strong>300%</strong><br>reduce <strong class='color-harm'>harm</strong> by <strong>15%</strong>",
description: "<strong>colliding</strong> with mobs overfills <strong class='color-f'>energy</strong> by <strong>200%</strong><br>reduce <strong class='color-harm'>harm</strong> by <strong>15%</strong>",
maxCount: 1,
count: 0,
allowed() {
@@ -943,7 +943,7 @@ const mod = {
requires: "not mass-energy equivalence",
effect() {
mod.isPiezo = true;
if (mech.energy < mech.maxEnergy * 3) mech.energy = mech.maxEnergy * 3;
mech.energy += mech.maxEnergy * 2;
},
remove() {
mod.isPiezo = false;
@@ -2001,7 +2001,7 @@ const mod = {
},
{
name: "optimized shell packing",
description: "<strong>flak</strong> <strong class='color-g'>ammo</strong> drops contain <strong>3x</strong> more shells",
description: "<strong>flak</strong> <strong class='color-g'>ammo</strong> drops contain <strong>2x</strong> more shells",
maxCount: 3,
count: 0,
allowed() {
@@ -2010,7 +2010,7 @@ const mod = {
requires: "flak",
effect() {
for (i = 0, len = b.guns.length; i < len; i++) { //find which gun
if (b.guns[i].name === "flak") b.guns[i].ammoPack = b.guns[i].defaultAmmoPack * (3 * (1 + this.count));
if (b.guns[i].name === "flak") b.guns[i].ammoPack = b.guns[i].defaultAmmoPack * (2 * (1 + this.count));
}
},
remove() {
@@ -2472,12 +2472,12 @@ const mod = {
effect() {
mod.laserReflections++;
mod.laserDamage += 0.08; //base is 0.12
mod.laserFieldDrain += 0.0006 //base is 0.002
mod.laserFieldDrain += 0.0007 //base is 0.002
},
remove() {
mod.laserReflections = 2;
mod.laserDamage = 0.16;
mod.laserFieldDrain = 0.0012;
mod.laserFieldDrain = 0.0014;
}
},
{
@@ -2610,7 +2610,7 @@ const mod = {
},
{
name: "eddy current brake",
description: "you are <strong>surrounded</strong> by a field that<br>limits the <strong>top speed</strong> of mobs",
description: "your stored <strong class='color-f'>energy</strong> projects a field that<br>limits the <strong>top speed</strong> of mobs",
maxCount: 1,
count: 0,
allowed() {
@@ -2963,7 +2963,7 @@ const mod = {
},
{
name: "Penrose process",
description: "after a <strong>block</strong> falls into a <strong class='color-worm'>wormhole</strong><br>your <strong class='color-f'>energy</strong> overfills to <strong>200%</strong> of the maximum",
description: "after a <strong>block</strong> falls into a <strong class='color-worm'>wormhole</strong><br>your <strong class='color-f'>energy</strong> overfills by <strong>50%</strong>",
maxCount: 1,
count: 0,
allowed() {

View File

@@ -1350,7 +1350,7 @@ const mech = {
mech.drawFieldMeter()
if (mod.isPerfectBrake) { //cap mob speed around player
const range = 350 + 140 * wave
const range = 160 + 140 * wave + 150 * mech.energy
for (let i = 0; i < mob.length; i++) {
const distance = Vector.magnitude(Vector.sub(mech.pos, mob[i].position))
if (distance < range) {
@@ -2312,7 +2312,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 * 2) mech.energy = mech.maxEnergy * 2
if (mod.isWormholeEnergy) mech.energy += 0.5
if (mod.isWormSpores) { //pandimensionalspermia
b.spore(Vector.add(mech.hole.pos2, Vector.rotate({
x: mech.fieldRange,
@@ -2335,7 +2335,8 @@ const mech = {
Matter.World.remove(engine.world, body[i]);
body.splice(i, 1);
mech.fieldRange *= 0.8
if (mod.isWormholeEnergy && mech.energy < mech.maxEnergy * 2) mech.energy = mech.maxEnergy * 2
// if (mod.isWormholeEnergy && mech.energy < mech.maxEnergy * 2) mech.energy = mech.maxEnergy * 2
if (mod.isWormholeEnergy) mech.energy += 0.5
if (mod.isWormSpores) { //pandimensionalspermia
b.spore(Vector.add(mech.hole.pos1, Vector.rotate({
x: mech.fieldRange,

View File

@@ -94,7 +94,7 @@ const spawn = {
me.frictionAir = 0.01;
me.memory = Infinity;
me.locatePlayer();
const density = 1.1
const density = 1
Matter.Body.setDensity(me, density); //extra dense //normal is 0.001 //makes effective life much larger
// spawn.shield(me, x, y, 1);
me.onDeath = function() {
@@ -107,8 +107,7 @@ const spawn = {
me.endCycle = 720;
me.mode = 0;
me.do = function() {
//hold position
Matter.Body.setPosition(this, {
Matter.Body.setPosition(this, { //hold position
x: x,
y: y
});
@@ -177,7 +176,7 @@ const spawn = {
me.spawnInterval = 302
me.modeSpawns = function() {
if (!(this.cycle % this.spawnInterval) && !mech.isBodiesAsleep && mob.length < 40) {
Matter.Body.setAngularVelocity(this, 0.1)
if (this.mode !== 3) Matter.Body.setAngularVelocity(this, 0.1)
//fire a bullet from each vertex
let whoSpawn = spawn.fullPickList[Math.floor(Math.random() * spawn.fullPickList.length)];
for (let i = 0, len = this.vertices.length; i < len; i++) {
@@ -265,7 +264,7 @@ const spawn = {
}
}
if (this.cycle < 240) { //damage scales up over 2 seconds to give player time to move
const scale = this.cycle / 180
const scale = this.cycle / 240
const dmg = 0.14 * game.dmgScale * scale
ctx.beginPath();
this.laser(this.vertices[0], this.angle + Math.PI / 6, dmg);

View File

@@ -296,7 +296,7 @@ summary {
font-size: 1.5em;
}
#details-div {
.details-div {
padding: 10px;
border-radius: 8px;
border: 2px #333 solid;

View File

@@ -1,6 +1,13 @@
*********** NEXT PATCH ***********
you can view the patch notes for the last few commits from the game menu
this uses the github API, so it might have some delay
overfill mods add energy instead of setting energy to a value
bug - blocks in vertical portals can get stuck inside the portals
fixed, but only for one portal... oh well
mobs that make a scrap bot, don't leave a block body anymore
************** BUGS **************
@@ -16,6 +23,23 @@ bug - mines spawn extra mines when fired at thin map wall while jumping
************** MODS **************
mod - neutron bomb needs a method to "catch" mobs in it's field
apply stun status effect
too similar to the stun effect?
mod - nano scale field could be a mod
excess energy is converted to bullets
run this code in the energy overfill code check
possible issues
worm hole, Penrose process - nerf a bit
pair production - nerf and give it to anyone
cloaking field - maybe just don't spawn bullets when cloaked
mod - sentry fires other bullet types
laser or missile
flak could be a mod for shotgun?
mod - self destruct - drones explode when they die
drones lose extra time on collisions, so they often explode after a collision
@@ -63,6 +87,14 @@ mod - foam is attracted to mobs
************** TODO **************
wormholes need to give feedback on where a portal can go
or automatically put portals in safe places
field - You have a permanent neutron bomb oscillating on you. Energy regeneration and heal powerup effectiveness is halved.
neutron field could be a passive outwards push, replacing the defined, oscillating border of SWH with a less powerful, larger border
find a way to automatically show patch information from github on n-gon main page
repeat map in vertical and horizontal space
or at least vertical space
camera looks strange when you teleport player with a high velocity