diff --git a/js/bullets.js b/js/bullets.js index f2a2d0c..7eecc22 100644 --- a/js/bullets.js +++ b/js/bullets.js @@ -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: "", + description: "increase damage based on stored energy
+1% damage for every 5% energy", + 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 33% more damage at a distance
increase maxes out at about 40 steps away", @@ -334,6 +353,22 @@ const b = { b.modNailBotCount = 0; } }, + { + name: "scrap bots", + description: "+16% chance to build a bot after killing a mob
the bot will follow you until you exit 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 mine
chance to occur after being harmed", @@ -514,7 +549,7 @@ const b = { }, { name: "Pauli exclusion", - description: `unable to collide with mobs for +1 second
activates after being harmed from a collision`, + description: `unable to collide with mobs for +2 seconds
activates after being harmed 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 touching mobs, they are annihilated", - 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 dying, continue in an alternate reality
guns, ammo, field, and mods are randomized", @@ -722,7 +741,7 @@ const b = { }, { name: "mass-energy equivalence", - description: "power ups overfill your energy
temporarily gain 50% above your max", + description: "power ups overfill your energy
temporarily gain twice your maximum", maxCount: 1, count: 0, allowed() { @@ -1242,6 +1261,22 @@ const b = { b.isModPlasmaRange = 1; } }, + { + name: "annihilation", + description: "after touching mobs, they are annihilated", + 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: "negative mass field leaks virtual particles
mobs inside the field take damage", @@ -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 diff --git a/js/engine.js b/js/engine.js index 845460f..38f9f5b 100644 --- a/js/engine.js +++ b/js/engine.js @@ -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 diff --git a/js/game.js b/js/game.js index 91b7a7c..39e6d8d 100644 --- a/js/game.js +++ b/js/game.js @@ -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 diff --git a/js/mobs.js b/js/mobs.js index 0123e3d..9672ed4 100644 --- a/js/mobs.js +++ b/js/mobs.js @@ -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)) } diff --git a/js/player.js b/js/player.js index 32f1068..d7a95c7 100644 --- a/js/player.js +++ b/js/player.js @@ -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 diff --git a/js/spawn.js b/js/spawn.js index 8288bfc..2051fad 100644 --- a/js/spawn.js +++ b/js/spawn.js @@ -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 diff --git a/todo.txt b/todo.txt index 3c4040d..6209e81 100644 --- a/todo.txt +++ b/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