mods
mod energy from damage, annaliation now requires negative mass field mod - spawn bots after killing mobs
This commit is contained in:
@@ -73,6 +73,8 @@ const b = {
|
||||
isModVacuumShield: null,
|
||||
modRenormalization: null,
|
||||
modGrenadeFragments: null,
|
||||
isModEnergyDamage: null,
|
||||
isModBotSpawner: null,
|
||||
modOnHealthChange() { //used with acid mod
|
||||
if (b.isModAcidDmg && mech.health > 0.8) {
|
||||
b.modAcidDmg = 0.7
|
||||
@@ -119,6 +121,23 @@ const b = {
|
||||
b.modBulletSize = 1;
|
||||
}
|
||||
},
|
||||
{
|
||||
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%</strong> <strong class='color-f'>energy</strong>",
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
allowed() {
|
||||
return true
|
||||
},
|
||||
requires: "",
|
||||
effect: () => {
|
||||
b.isModEnergyDamage = true // used in mech.grabPowerUp
|
||||
},
|
||||
remove() {
|
||||
b.isModEnergyDamage = false;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "kinetic bombardment",
|
||||
description: "do up to <strong>33%</strong> more <strong class='color-d'>damage</strong> at a distance<br><em>increase maxes out at about 40 steps away</em>",
|
||||
@@ -334,6 +353,22 @@ const b = {
|
||||
b.modNailBotCount = 0;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "scrap bots",
|
||||
description: "<strong>+16%</strong> chance to build a <strong>bot</strong> after killing a mob<br>the bot will follow you until you <strong>exit</strong> the map",
|
||||
maxCount: 6,
|
||||
count: 0,
|
||||
allowed() {
|
||||
return true
|
||||
},
|
||||
requires: "",
|
||||
effect() {
|
||||
b.isModBotSpawner += 0.16;
|
||||
},
|
||||
remove() {
|
||||
b.isModBotSpawner = 0;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "ablative mines",
|
||||
description: "rebuild your broken parts as a <strong>mine</strong><br>chance to occur after being <strong>harmed</strong>",
|
||||
@@ -514,7 +549,7 @@ const b = {
|
||||
},
|
||||
{
|
||||
name: "Pauli exclusion",
|
||||
description: `unable to <strong>collide</strong> with mobs for <strong>+1</strong> second<br>activates after being <strong>harmed</strong> from a collision`,
|
||||
description: `unable to <strong>collide</strong> with mobs for <strong>+2</strong> seconds<br>activates after being <strong>harmed</strong> from a collision`,
|
||||
maxCount: 9,
|
||||
count: 0,
|
||||
allowed() {
|
||||
@@ -522,29 +557,13 @@ const b = {
|
||||
},
|
||||
requires: "",
|
||||
effect() {
|
||||
b.modCollisionImmuneCycles += 60;
|
||||
b.modCollisionImmuneCycles += 120;
|
||||
mech.collisionImmuneCycle = mech.cycle + b.modCollisionImmuneCycles; //player is immune to collision damage for 30 cycles
|
||||
},
|
||||
remove() {
|
||||
b.modCollisionImmuneCycles = 30;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "annihilation",
|
||||
description: "after <strong>touching</strong> mobs, they are <strong>annihilated</strong>",
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
allowed() {
|
||||
return b.modCollisionImmuneCycles > 30
|
||||
},
|
||||
requires: "Pauli exclusion",
|
||||
effect() {
|
||||
b.isModAnnihilation = true
|
||||
},
|
||||
remove() {
|
||||
b.isModAnnihilation = false;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "quantum immortality",
|
||||
description: "after <strong>dying</strong>, continue in an <strong>alternate reality</strong><br><em>guns, ammo, field, and mods are randomized</em>",
|
||||
@@ -722,7 +741,7 @@ const b = {
|
||||
},
|
||||
{
|
||||
name: "mass-energy equivalence",
|
||||
description: "<strong>power ups</strong> overfill your <strong class='color-f'>energy</strong><br>temporarily gain <strong>50%</strong> above your max",
|
||||
description: "<strong>power ups</strong> overfill your <strong class='color-f'>energy</strong><br>temporarily gain <strong>twice</strong> your maximum",
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
allowed() {
|
||||
@@ -1242,6 +1261,22 @@ const b = {
|
||||
b.isModPlasmaRange = 1;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "annihilation",
|
||||
description: "after <strong>touching</strong> mobs, they are <strong>annihilated</strong>",
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
allowed() {
|
||||
return mech.fieldUpgrades[mech.fieldMode].name === "negative mass field"
|
||||
},
|
||||
requires: "negative mass field",
|
||||
effect() {
|
||||
b.isModAnnihilation = true
|
||||
},
|
||||
remove() {
|
||||
b.isModAnnihilation = false;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "Hawking radiation",
|
||||
description: "<strong>negative mass field</strong> leaks virtual particles<br>mobs inside the field take <strong class='color-d'>damage</strong>",
|
||||
@@ -3150,12 +3185,21 @@ const b = {
|
||||
minDmgSpeed: 5,
|
||||
onDmg(who) {
|
||||
if (who.shield) {
|
||||
for (let i = 0, len = mob.length; i < len; i++) {
|
||||
if (mob[i].id === who.shieldTargetID) { //apply some knock back to shield mob before shield breaks
|
||||
const force = Matter.Vector.mult(this.velocity, 15 / mob[i].mass)
|
||||
Matter.Body.setVelocity(mob[i], {
|
||||
x: mob[i].velocity.x + force.x,
|
||||
y: mob[i].velocity.y + force.y
|
||||
});
|
||||
break
|
||||
}
|
||||
}
|
||||
Matter.Body.setVelocity(this, {
|
||||
x: -0.1 * this.velocity.x,
|
||||
y: -0.1 * this.velocity.y
|
||||
});
|
||||
Matter.Body.setDensity(this, 0.001);
|
||||
// this.endCycle = 0;
|
||||
}
|
||||
if (b.isModRailNails && this.speed > 10) {
|
||||
const targets = [] //target nearby mobs
|
||||
@@ -3187,9 +3231,9 @@ const b = {
|
||||
})
|
||||
}
|
||||
}
|
||||
this.endCycle = 0 //triggers despawn
|
||||
}
|
||||
|
||||
}, //this.endCycle = 0 //triggers despawn
|
||||
},
|
||||
onEnd() {}
|
||||
});
|
||||
mech.fireCDcycle = Infinity; // cool down
|
||||
@@ -3200,7 +3244,7 @@ const b = {
|
||||
if ((!game.mouseDown && this.charge > 0.6)) { //fire on mouse release
|
||||
//normal bullet behavior occurs after firing, overwrite this function
|
||||
this.do = function () {
|
||||
this.force.y += this.mass * 0.00015 / this.charge; // low gravity that scales with charge
|
||||
this.force.y += this.mass * 0.0003 / this.charge; // low gravity that scales with charge
|
||||
}
|
||||
|
||||
mech.fireCDcycle = mech.cycle + 2; // set fire cool down
|
||||
|
||||
@@ -144,7 +144,7 @@ function collisionChecks(event) {
|
||||
}
|
||||
mech.damage(dmg);
|
||||
if (mob[k].onHit) mob[k].onHit(k);
|
||||
if (b.isModAnnihilation && mob[k].dropPowerUp && !mob[k].isShielded) {
|
||||
if (b.isModAnnihilation) {
|
||||
mob[k].death();
|
||||
game.drawList.push({
|
||||
//add dmg to draw queue
|
||||
|
||||
@@ -710,6 +710,10 @@ const game = {
|
||||
|
||||
if (!(mech.cycle % 60)) { //once a second
|
||||
|
||||
if (b.isModEnergyDamage) {
|
||||
document.getElementById("mod-capacitor").innerHTML = `(+${(mech.energy/0.05).toFixed(0)}%)`
|
||||
}
|
||||
|
||||
if (mech.lastKillCycle + 300 > mech.cycle) { //effects active for 5 seconds after killing a mob
|
||||
if (b.isModEnergyRecovery) {
|
||||
mech.energy += mech.fieldEnergyMax * 0.07
|
||||
|
||||
@@ -44,8 +44,6 @@ const mobs = {
|
||||
}
|
||||
},
|
||||
statusSlow(who, cycles = 60) {
|
||||
console.log('slow')
|
||||
|
||||
if (!who.shield && !who.isShielded) {
|
||||
//remove other "slow" effects on this mob
|
||||
let i = who.status.length
|
||||
@@ -966,6 +964,7 @@ const mobs = {
|
||||
if (b.isModLowHealthDmg) dmg *= (3 / (2 + Math.min(mech.health, 1))) //up to 50% dmg at zero player health //if this changes all update display in modOnHealthChange()
|
||||
if (b.isModHarmDamage && mech.lastHarmCycle + 300 > mech.cycle) dmg *= 2;
|
||||
if (b.isModEnergyLoss) dmg *= 1.33;
|
||||
if (b.isModEnergyDamage) dmg *= 1 + mech.energy / 5;
|
||||
if (b.isModFarAwayDmg) dmg *= 1 + Math.sqrt(Math.max(500, Math.min(3000, this.distanceToPlayer())) - 500) * 0.0067 //up to 50% dmg at max range of 3500
|
||||
if (b.modEnergySiphon && dmg !== Infinity) mech.energy += Math.min(this.health, dmg) * b.modEnergySiphon
|
||||
if (b.modHealthDrain && dmg !== Infinity) mech.addHealth(Math.min(this.health, dmg) * b.modHealthDrain)
|
||||
@@ -999,6 +998,9 @@ const mobs = {
|
||||
b.spore(this) //spawn drone
|
||||
}
|
||||
}
|
||||
if (Math.random() < b.isModBotSpawner) {
|
||||
(Math.random() < 0.5) ? b.nailBot(): b.laserBot()
|
||||
}
|
||||
if (b.isModExplodeMob) b.explosion(this.position, Math.min(450, Math.sqrt(this.mass + 3) * 80))
|
||||
}
|
||||
|
||||
|
||||
@@ -915,8 +915,8 @@ const mech = {
|
||||
//player recoil //stronger in x-dir to prevent jump hacking
|
||||
|
||||
Matter.Body.setVelocity(player, {
|
||||
x: player.velocity.x - Math.cos(mech.angle) * speed / (mech.crouch ? 30 : 5) * Math.sqrt(mech.holdingTarget.mass),
|
||||
y: player.velocity.y - Math.sin(mech.angle) * speed / 40 * Math.sqrt(mech.holdingTarget.mass)
|
||||
x: player.velocity.x - Math.cos(mech.angle) * speed / (mech.crouch ? 30 : 10) * Math.sqrt(mech.holdingTarget.mass),
|
||||
y: player.velocity.y - Math.sin(mech.angle) * speed / 30 * Math.sqrt(mech.holdingTarget.mass)
|
||||
});
|
||||
mech.definePlayerMass() //return to normal player mass
|
||||
}
|
||||
@@ -978,7 +978,7 @@ const mech = {
|
||||
y: powerUp[i].velocity.y * 0.11
|
||||
});
|
||||
if (dist2 < 5000) { //use power up if it is close enough
|
||||
if (b.isModMassEnergy) mech.energy = mech.fieldEnergyMax * 1.5;
|
||||
if (b.isModMassEnergy) mech.energy = mech.fieldEnergyMax * 2;
|
||||
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
|
||||
|
||||
@@ -639,7 +639,7 @@ const spawn = {
|
||||
}
|
||||
}
|
||||
},
|
||||
timeSkipBoss(x, y, radius = 60) {
|
||||
timeSkipBoss(x, y, radius = 70) {
|
||||
mobs.spawn(x, y, 6, radius, '#000');
|
||||
let me = mob[mob.length - 1];
|
||||
// me.stroke = "transparent"; //used for drawSneaker
|
||||
@@ -1108,7 +1108,7 @@ const spawn = {
|
||||
// }
|
||||
// };
|
||||
// },
|
||||
bomberBoss(x, y, radius = 90 + Math.ceil(Math.random() * 20)) {
|
||||
bomberBoss(x, y, radius = 85 + Math.ceil(Math.random() * 20)) {
|
||||
//boss that drops bombs from above and holds a set distance from player
|
||||
mobs.spawn(x, y, 3, radius, "transparent");
|
||||
let me = mob[mob.length - 1];
|
||||
@@ -1118,7 +1118,7 @@ const spawn = {
|
||||
me.seeAtDistance2 = 1500000;
|
||||
me.fireFreq = Math.ceil(30 + 2000 / radius);
|
||||
me.searchTarget = map[Math.floor(Math.random() * (map.length - 1))].position; //required for search
|
||||
me.hoverElevation = 400 + (Math.random() - 0.5) * 200; //squared
|
||||
me.hoverElevation = 460 + (Math.random() - 0.5) * 200; //squared
|
||||
me.hoverXOff = (Math.random() - 0.5) * 100;
|
||||
me.accelMag = Math.floor(10 * (Math.random() + 5)) * 0.00001 * game.accelScale;
|
||||
me.g = 0.0002; //required if using 'gravity' // gravity called in hoverOverPlayer
|
||||
|
||||
6
todo.txt
6
todo.txt
@@ -1,5 +1,11 @@
|
||||
mod - your damage scales with current energy
|
||||
mod - 10% chance after killing a mob to gain a bot
|
||||
that follows you until you exit the map
|
||||
|
||||
************** TODO - n-gon **************
|
||||
|
||||
mod - you can no longer see your current health
|
||||
|
||||
boss mob - just a faster and larger version of a springer mob
|
||||
could have a more frequent random walk
|
||||
always shielded
|
||||
|
||||
Reference in New Issue
Block a user