From ef280294155048211c83dd4d2474deb793bfc6c1 Mon Sep 17 00:00:00 2001 From: landgreen Date: Mon, 6 Jul 2020 17:29:36 -0700 Subject: [PATCH] mod turret mode --- js/bullet.js | 14 +- js/engine.js | 2 +- js/game.js | 6 +- js/index.js | 3 - js/level.js | 7 +- js/mob.js | 4 +- js/mods.js | 481 +++++++++++++++++++++++++------------------------- js/player.js | 23 +-- js/powerup.js | 62 +++---- style.css | 19 ++ todo.txt | 26 +-- 11 files changed, 329 insertions(+), 318 deletions(-) diff --git a/js/bullet.js b/js/bullet.js index d66004e..fbac69d 100644 --- a/js/bullet.js +++ b/js/bullet.js @@ -10,12 +10,12 @@ const b = { if (game.mouseDown && mech.fireCDcycle < mech.cycle && (!(keys[32] || game.mouseDownRight) || mech.fieldFire) && b.inventory.length) { if (b.guns[b.activeGun].ammo > 0) { b.guns[b.activeGun].fire(); - if (mod.noAmmo && mech.crouch) { - if (mod.noAmmo % 2) { + if (mod.isCrouchAmmo && mech.crouch) { + if (mod.isCrouchAmmo % 2) { b.guns[b.activeGun].ammo--; game.updateGunHUD(); } - mod.noAmmo++ //makes the no ammo toggle off and on + mod.isCrouchAmmo++ //makes the no ammo toggle off and on } else { b.guns[b.activeGun].ammo--; game.updateGunHUD(); @@ -507,7 +507,6 @@ const b = { if (mod.isMutualism && this.isMutualismActive && !mod.isEnergyHealth) { mech.health += 0.01 if (mech.health > mech.maxHealth) mech.health = mech.maxHealth; - mod.onHealthChange(); mech.displayHealth(); } }, @@ -588,7 +587,6 @@ const b = { if (mod.isMutualism && mech.health > 0.02) { mech.health -= 0.01 - mod.onHealthChange(); mech.displayHealth(); bullet[bIndex].isMutualismActive = true } @@ -728,7 +726,7 @@ const b = { } } } - if (!this.lockedOn) { + if (!this.lockedOn && !mod.isAmmoFromHealth) { //grab a power up if it is (ammo) or (a heal when player is low) let closeDist = Infinity; for (let i = 0, len = powerUp.length; i < len; ++i) { @@ -1126,7 +1124,7 @@ const b = { //fire plasma at target - const DRAIN = 0.0017 + const DRAIN = 0.002 if (this.lockedOn && this.lockedOn.alive && mech.energy > DRAIN && mech.fieldCDcycle < mech.cycle) { mech.energy -= DRAIN; if (mech.energy < 0) { @@ -1537,7 +1535,7 @@ const b = { }, { name: "shotgun", - description: "fire a burst of short range bullets
crouch to reduce recoil", + description: "fire a burst of short range bullets
crouch to reduce recoil", ammo: 0, ammoPack: 9, have: false, diff --git a/js/engine.js b/js/engine.js index 599e6aa..6527b16 100644 --- a/js/engine.js +++ b/js/engine.js @@ -204,7 +204,7 @@ function collisionChecks(event) { //mob + bullet collisions if (obj.classType === "bullet" && obj.speed > obj.minDmgSpeed) { // const dmg = b.dmgScale * (obj.dmg + 0.15 * obj.mass * Vector.magnitude(Vector.sub(mob[k].velocity, obj.velocity))); - let dmg = b.dmgScale * (obj.dmg + mod.acidDmg + 0.15 * obj.mass * Vector.magnitude(Vector.sub(mob[k].velocity, obj.velocity))) + let dmg = b.dmgScale * (obj.dmg + 0.15 * obj.mass * Vector.magnitude(Vector.sub(mob[k].velocity, obj.velocity))) if (mod.isCrit && !mob[k].seePlayer.recall && !mob[k].shield) dmg *= 5 mob[k].foundPlayer(); mob[k].damage(dmg); diff --git a/js/game.js b/js/game.js index c6e513a..983b8fe 100644 --- a/js/game.js +++ b/js/game.js @@ -241,7 +241,6 @@ const game = { } } document.getElementById("mods").innerHTML = text - mod.onHealthChange() }, replaceTextLog: true, //