renormalization

This commit is contained in:
landgreen
2020-08-13 05:33:49 -07:00
parent e09a661953
commit 6bfc53d3be
7 changed files with 99 additions and 72 deletions

View File

@@ -751,7 +751,7 @@ const b = {
}
}
if (Vector.magnitudeSquared(Vector.sub(this.position, powerUp[i].position)) < 60000 && !game.isChoosing) {
powerUps.onPickUp();
powerUps.onPickUp(this.position);
powerUp[i].effect();
Matter.World.remove(engine.world, powerUp[i]);
powerUp.splice(i, 1);
@@ -898,7 +898,7 @@ const b = {
if (this.target.isShielded) {
this.target.damage(b.dmgScale * 0.005, true); //shield damage bypass
//shrink if mob is shielded
const SCALE = 1 - 0.016 / mod.isBulletsLastLonger
const SCALE = 1 - 0.018 / mod.isBulletsLastLonger
Matter.Body.scale(this, SCALE, SCALE);
this.radius *= SCALE;
} else {
@@ -977,9 +977,7 @@ const b = {
bullet[me].endCycle = game.cycle + 60 + 18 * Math.random();
bullet[me].dmg = dmg
bullet[me].onDmg = function (who) {
if (mod.isNailPoison) {
mobs.statusDoT(who, dmg * 0.055, 300) //66% / (360 / 30) one tick every 30 cycles in 360 cycles total
}
if (mod.isNailPoison) mobs.statusDoT(who, dmg * 0.15, 180) // one tick every 30 cycles
};
bullet[me].do = function () {};
},
@@ -1137,7 +1135,7 @@ const b = {
minDmgSpeed: 2,
lookFrequency: 40 + Math.floor(7 * Math.random()),
acceleration: 0.0015 * (1 + 0.3 * Math.random()),
range: 600 * (1 + 0.2 * Math.random()) + 200 * mod.isLaserBotUpgrade,
range: 500 * (1 + 0.2 * Math.random()) + 150 * mod.isLaserBotUpgrade,
followRange: 150 + Math.floor(30 * Math.random()),
offPlayer: {
x: 0,
@@ -1206,7 +1204,7 @@ const b = {
bestVertexDistance = dist
}
}
const dmg = b.dmgScale * (0.04 + 0.04 * this.isUpgraded);
const dmg = b.dmgScale * (0.06 + 0.06 * this.isUpgraded);
this.lockedOn.damage(dmg);
this.lockedOn.locatePlayer();
@@ -1577,7 +1575,8 @@ const b = {
name: "shotgun",
description: "fire a <strong>burst</strong> of short range <strong> bullets</strong> <br><em>crouch to reduce recoil</em>",
ammo: 0,
ammoPack: 6,
ammoPack: 7,
defaultAmmoPack: 7,
have: false,
fire() {
let knock, spread
@@ -1619,7 +1618,7 @@ const b = {
}
} else {
const side = 21 * mod.bulletSize
for (let i = 0; i < 15; i++) {
for (let i = 0; i < 17; i++) {
const me = bullet.length;
const dir = mech.angle + (Math.random() - 0.5) * spread
bullet[me] = Bodies.rectangle(mech.pos.x + 35 * Math.cos(mech.angle) + 15 * (Math.random() - 0.5), mech.pos.y + 35 * Math.sin(mech.angle) + 15 * (Math.random() - 0.5), side, side, b.fireAttributes(dir));
@@ -1631,7 +1630,7 @@ const b = {
});
bullet[me].endCycle = game.cycle + 40
bullet[me].minDmgSpeed = 15
// bullet[me].dmg = 0.1
// bullet[me].restitution = 0.4
bullet[me].frictionAir = 0.034;
bullet[me].do = function () {
if (!mech.isBodiesAsleep) {
@@ -1702,8 +1701,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: 35,
defaultAmmoPack: 35,
ammoPack: 40,
defaultAmmoPack: 40,
have: false,
count: 0, //used to track how many shots are in a volley before a big CD
lastFireCycle: 0, //use to remember how longs its been since last fire, used to reset count
@@ -1731,9 +1730,9 @@ const b = {
who.foundPlayer();
if (mod.isFastDot) {
mobs.statusDoT(who, 3.6, 30)
mobs.statusDoT(who, 3.9, 30)
} else {
mobs.statusDoT(who, 0.6, mod.isSlowDot ? 360 : 180)
mobs.statusDoT(who, 0.65, mod.isSlowDot ? 360 : 180)
}
game.drawList.push({ //add dmg to draw queue
@@ -1774,7 +1773,6 @@ const b = {
}
};
const SPEED = 50
Matter.Body.setVelocity(bullet[me], {
x: mech.Vx / 2 + SPEED * Math.cos(angle),
@@ -1806,7 +1804,7 @@ const b = {
name: "wave beam",
description: "emit a <strong>sine wave</strong> of oscillating particles<br>particles <strong>slowly</strong> propagate through <strong>solids</strong>",
ammo: 0,
ammoPack: 90,
ammoPack: 80,
have: false,
fire() {
mech.fireCDcycle = mech.cycle + Math.floor(3 * b.fireCD); // cool down
@@ -2311,13 +2309,6 @@ const b = {
} else {
if (Matter.Query.collides(this, map).length) {
onCollide(this)
// this.stuck = function () {
// Matter.Body.setVelocity(this, {
// x: 0,
// y: 0
// });
// }
} else { //if colliding with nothing just fall
this.force.y += this.mass * 0.001;
}
@@ -2527,7 +2518,7 @@ const b = {
fire() {
if (mech.crouch) {
b.iceIX(10, 0.3)
mech.fireCDcycle = mech.cycle + Math.floor(10 * b.fireCD); // cool down
mech.fireCDcycle = mech.cycle + Math.floor(8 * b.fireCD); // cool down
} else {
b.iceIX(2)
mech.fireCDcycle = mech.cycle + Math.floor(3 * b.fireCD); // cool down
@@ -2606,13 +2597,12 @@ const b = {
bullet[me].charge = 0;
bullet[me].do = function () {
if ((!game.mouseDown && this.charge > 0.6) || mech.energy < 0.005) { //fire on mouse release
if (mech.energy < 0.005) {
this.charge = 0.1;
if (mech.energy < 0.005 && !mod.isRailTimeSlow) {
// this.charge = 0;
mech.energy += this.charge * 0.4
mech.fireCDcycle = mech.cycle + 120; // cool down if out of energy
//normal bullet behavior occurs after firing, overwrite this function
this.do = function () {
this.force.y += this.mass * 0.001; //normal gravity
}
this.endCycle = 0;
return
} else {
mech.fireCDcycle = mech.cycle + 2; // set fire cool down
//normal bullet behavior occurs after firing, overwrite this function
@@ -3024,7 +3014,7 @@ const b = {
if (mod.isPulseAim) { //find mobs in line of sight
let dist = 2200
energy = 0.25 * Math.min(mech.energy, 1.75)
explosionRange = 1000 * energy
explosionRange = 1100 * energy
for (let i = 0, len = mob.length; i < len; i++) {
const newDist = Vector.magnitude(Vector.sub(path[0], mob[i].position))
if (explosionRange < newDist &&
@@ -3036,8 +3026,6 @@ const b = {
path[path.length - 1] = mob[i].position
}
}
}
if (!best.who) {
vertexCollision(path[0], path[1], mob);
@@ -3058,7 +3046,7 @@ const b = {
} else {
energy = 0.3 * Math.min(mech.energy, 1.75)
mech.energy -= energy * mod.isLaserDiode
explosionRange = 1000 * energy
explosionRange = 1100 * energy
if (best.who) b.explosion(path[1], explosionRange, true)
mech.fireCDcycle = mech.cycle + Math.floor(50 * b.fireCD); // cool down
}

View File

@@ -18,7 +18,7 @@ const level = {
// mech.isStealth = true;
// mod.giveMod("bot replication");
// mod.nailBotCount += 10
// b.giveGuns("neutron bomb")
// b.giveGuns("rail gun")
// mech.setField("plasma torch")
level.intro(); //starting level
@@ -418,8 +418,8 @@ const level = {
const button = level.button(6600, 2675)
const hazard = level.hazard(4550, 2750, 4550, 150)
const balance1 = level.spinner(300, -395, 25, 390, 0.001) //entrance
const balance2 = level.spinner(2605, 500, 390, 25, 0.005) //falling
const balance3 = level.spinner(2608, 1900, 584, 25, 0.005) //falling
const balance2 = level.spinner(2605, 500, 390, 25, 0.001) //falling
const balance3 = level.spinner(2608, 1900, 584, 25, 0.001) //falling
const balance4 = level.spinner(9300, 2205, 25, 380, 0.001) //exit
level.custom = () => {
@@ -526,7 +526,7 @@ const level = {
spawn.bodyRect(6800, 2490, 50, 50);
spawn.bodyRect(6800, 2540, 50, 50);
spawn.bodyRect(6800, 2590, 50, 50);
spawn.bodyRect(8225, 2200, 100, 400);
spawn.bodyRect(8225, 2225, 50, 375);
spawn.mapRect(6250, 1875, 700, 150);
spawn.mapRect(8000, 1875, 600, 150);
@@ -745,6 +745,8 @@ const level = {
spawn.wireHead();
},
satellite() {
// level.chain(4025, -1175, 15, 20)
const elevator = level.platform(4210, -1325, 380, 30, -10)
level.custom = () => {
level.playerExitCheck();
@@ -3315,4 +3317,28 @@ const level = {
}
}
},
chain(x, y, len = 15, radius = 20) {
for (let i = 0; i < len; i++) {
body[body.length] = Bodies.polygon(x, y + 2 * radius * i, 12, radius, {
inertia: Infinity
});
}
for (let i = 1; i < len; i++) {
consBB[consBB.length] = Constraint.create({
bodyA: body[body.length - i],
bodyB: body[body.length - i - 1],
stiffness: 0.4,
damping: 0.01
});
}
cons[cons.length] = Constraint.create({ //pin first block to a point in space
pointA: {
x: x,
y: y - radius
},
bodyB: body[body.length - len],
stiffness: 0.4,
damping: 0.01
});
},
};

View File

@@ -70,7 +70,7 @@ const mod = {
},
damageFromMods() {
let dmg = 1
if (mod.isLowHealthDmg) dmg *= 1 + 0.4 * Math.max(0, 1 - mech.health)
if (mod.isLowHealthDmg) dmg *= 1 + 0.5 * Math.max(0, 1 - mech.health)
if (mod.isHarmDamage && mech.lastHarmCycle + 600 > mech.cycle) dmg *= 2;
if (mod.isEnergyLoss) dmg *= 1.33;
if (mod.isAcidDmg && mech.health > 1) dmg *= 1.4;
@@ -199,7 +199,7 @@ const mod = {
},
{
name: "negative feedback",
description: "increase <strong class='color-d'>damage</strong> by <strong>4%</strong><br>for each <strong>10%</strong> missing <strong>health</strong>",
description: "increase <strong class='color-d'>damage</strong> by <strong>5%</strong><br>for every <strong>10%</strong> missing base <strong>health</strong>",
maxCount: 1,
count: 0,
allowed() {
@@ -1058,7 +1058,7 @@ const mod = {
},
{
name: "logistics",
description: "<strong class='color-g'>ammo</strong> power ups give <strong>100%</strong> more <strong class='color-g'>ammo</strong><br>but <strong class='color-g'>ammo</strong> is only added to your <strong>current gun</strong>",
description: "<strong class='color-g'>ammo</strong> power ups give <strong>200%</strong> <strong class='color-g'>ammo</strong><br>but <strong class='color-g'>ammo</strong> is only added to your <strong>current gun</strong>",
maxCount: 1,
count: 0,
allowed() {
@@ -1391,7 +1391,7 @@ const mod = {
},
{
name: "shotgun spin-statistics",
description: "firing the <strong>shotgun</strong> makes you <br><strong>immune</strong> to <strong class='color-harm'>harm</strong> while on cooldown",
description: "<strong>immune</strong> to <strong class='color-harm'>harm</strong> while firing the <strong>shotgun</strong><br>receive <strong>33%</strong> less <strong>shotgun</strong> <strong class='color-g'>ammo</strong>",
maxCount: 1,
count: 0,
allowed() {
@@ -1400,9 +1400,21 @@ const mod = {
requires: "shotgun",
effect() {
mod.isShotgunImmune = true;
for (i = 0, len = b.guns.length; i < len; i++) { //find which gun
if (b.guns[i].name === "shotgun") {
b.guns[i].ammoPack = b.guns[i].defaultAmmoPack * 0.66
break;
}
}
},
remove() {
mod.isShotgunImmune = false;
for (i = 0, len = b.guns.length; i < len; i++) { //find which gun
if (b.guns[i].name === "shotgun") {
b.guns[i].ammoPack = b.guns[i].defaultAmmoPack;
break;
}
}
}
},
{
@@ -1785,7 +1797,7 @@ const mod = {
maxCount: 1,
count: 0,
allowed() {
return mod.nailBotCount + mod.grenadeFragments + mod.nailsDeathMob / 2 + mod.haveGunCheck("mine") + mod.isRailNails + mod.isNailShot > 1
return mod.nailBotCount + mod.grenadeFragments + mod.nailsDeathMob / 2 + (mod.haveGunCheck("mine") + mod.isRailNails + mod.isNailShot) * 2 > 1
},
requires: "nails",
effect() {
@@ -1999,12 +2011,12 @@ const mod = {
requires: "laser",
effect() {
mod.laserReflections++;
mod.laserDamage += 0.045; //base is 0.08
mod.laserDamage += 0.05; //base is 0.1
mod.laserFieldDrain += 0.001 //base is 0.002
},
remove() {
mod.laserReflections = 2;
mod.laserDamage = 0.09;
mod.laserDamage = 0.1;
mod.laserFieldDrain = 0.002;
}
},
@@ -2097,7 +2109,7 @@ const mod = {
},
{
name: "Lorentz transformation",
description: "<strong>move</strong>, <strong>jump</strong>, and <strong>shoot</strong> <strong>33%</strong> faster<br>while <strong>time dilation</strong> is active or inactive ",
description: "<strong>move</strong>, <strong>jump</strong>, and <strong>shoot</strong> <strong>33%</strong> faster",
maxCount: 1,
count: 0,
allowed() {
@@ -2300,7 +2312,7 @@ const mod = {
},
{
name: "renormalization",
description: "<strong>phase decoherence</strong> adds <strong>visibility</strong> to bullets<br><strong>80%</strong> less <strong class='color-f'>energy</strong> drain when <strong>firing</strong>",
description: "using a <strong class='color-r'>reroll</strong> to change selection options<br>has a <strong>60%</strong> chance to spawn a <strong class='color-r'>reroll</strong>",
maxCount: 1,
count: 0,
allowed() {

View File

@@ -942,7 +942,7 @@ const mech = {
y: powerUp[i].velocity.y * 0.11
});
if (dist2 < 5000 && !game.isChoosing) { //use power up if it is close enough
powerUps.onPickUp();
powerUps.onPickUp(mech.pos);
Matter.Body.setVelocity(player, { //player knock back, after grabbing power up
x: player.velocity.x + ((powerUp[i].velocity.x * powerUp[i].mass) / player.mass) * 0.3,
y: player.velocity.y + ((powerUp[i].velocity.y * powerUp[i].mass) / player.mass) * 0.3
@@ -1733,24 +1733,17 @@ const mech = {
// }
function drawField(radius) {
radius *= 0.9 + 1.5 * mech.energy * mech.energy;
radius *= 0.9 + 2 * mech.energy * mech.energy;
const rotate = mech.cycle * 0.005;
mech.fieldPhase += 0.5 - 0.5 * Math.sqrt(Math.max(0.01, Math.min(mech.energy, 1)));
const off1 = 1 + 0.06 * Math.sin(mech.fieldPhase);
const off2 = 1 - 0.06 * Math.sin(mech.fieldPhase);
ctx.beginPath();
ctx.ellipse(mech.pos.x, mech.pos.y, radius * off1, radius * off2, rotate, 0, 2 * Math.PI);
if (mod.renormalization) {
for (let i = 0; i < bullet.length; i++) {
ctx.moveTo(bullet[i].position.x, bullet[i].position.y)
ctx.arc(bullet[i].position.x, bullet[i].position.y, radius, 0, 2 * Math.PI);
}
} else {
if (mech.fireCDcycle > mech.cycle && (keys[32] || game.mouseDownRight)) {
ctx.lineWidth = 5;
ctx.strokeStyle = `rgba(0, 204, 255,1)`
ctx.stroke()
}
if (mech.fireCDcycle > mech.cycle && (keys[32] || game.mouseDownRight)) {
ctx.lineWidth = 5;
ctx.strokeStyle = `rgba(0, 204, 255,1)`
ctx.stroke()
}
ctx.fillStyle = "#fff" //`rgba(0,0,0,${0.5+0.5*mech.energy})`;
ctx.globalCompositeOperation = "destination-in"; //in or atop
@@ -1777,7 +1770,7 @@ const mech = {
// game.draw.bodyFill = "transparent"
// game.draw.bodyStroke = "transparent"
const DRAIN = 0.00014 + ((!mod.renormalization && mech.fireCDcycle > mech.cycle) ? 0.007 : 0.001)
const DRAIN = 0.00014 + (mech.fireCDcycle > mech.cycle ? 0.007 : 0.001)
if (mech.energy > DRAIN) {
mech.energy -= DRAIN;
// if (mech.energy < 0.001) {

View File

@@ -100,6 +100,10 @@ const powerUps = {
use(type) { //runs when you actually reroll a list of selections, type can be field, gun, or mod
powerUps.reroll.changeRerolls(-1)
powerUps[type].effect();
if (mod.renormalization && Math.random() < 0.6) {
powerUps.spawn(mech.pos.x, mech.pos.y, "reroll");
if (Math.random() < mod.bayesian) powerUps.spawn(mech.pos.x, mech.pos.y, "reroll");
}
},
},
heal: {
@@ -388,11 +392,11 @@ const powerUps = {
}
}
},
onPickUp() {
onPickUp(where) {
if (mod.isMassEnergy) mech.energy = mech.maxEnergy * 3;
if (mod.isMineDrop) b.mine({
x: mech.pos.x,
y: mech.pos.y
x: where.x,
y: where.y
}, {
x: 0,
y: 0

View File

@@ -228,7 +228,7 @@ const spawn = {
}
}
},
powerUpBoss(x, y, vertices = 9, radius = 150) {
powerUpBoss(x, y, vertices = 9, radius = 130) {
mobs.spawn(x, y, vertices, radius, "transparent");
let me = mob[mob.length - 1];
me.isBoss = true;
@@ -1124,7 +1124,7 @@ const spawn = {
me.onDeath = function () {
powerUps.spawnBossPowerUp(this.position.x, this.position.y)
};
me.rotateVelocity = Math.min(0.005, 0.002 * game.accelScale * game.accelScale) * (level.levelsCleared > 8 ? 1 : -1)
me.rotateVelocity = Math.min(0.0045, 0.0015 * game.accelScale * game.accelScale) * (level.levelsCleared > 8 ? 1 : -1)
me.do = function () {
this.fill = '#' + Math.random().toString(16).substr(-6); //flash colors
if (!mech.isBodiesAsleep) {