mod- shotgun immuity
This commit is contained in:
@@ -475,7 +475,7 @@ const b = {
|
|||||||
requires: "",
|
requires: "",
|
||||||
effect() {
|
effect() {
|
||||||
b.modCollisionImmuneCycles += 60;
|
b.modCollisionImmuneCycles += 60;
|
||||||
mech.collisionImmune = mech.cycle + b.modCollisionImmuneCycles; //player is immune to collision damage for 30 cycles
|
mech.collisionImmuneCycle = mech.cycle + b.modCollisionImmuneCycles; //player is immune to collision damage for 30 cycles
|
||||||
},
|
},
|
||||||
remove() {
|
remove() {
|
||||||
b.modCollisionImmuneCycles = 30;
|
b.modCollisionImmuneCycles = 30;
|
||||||
@@ -896,6 +896,23 @@ const b = {
|
|||||||
b.modWaveSpeedBody = 0.25
|
b.modWaveSpeedBody = 0.25
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "shotgun spin-statistics",
|
||||||
|
description: "firing your <strong>shotgun</strong> makes you <br><strong>immune</strong> to collisions for <strong>1/2</strong> a second",
|
||||||
|
maxCount: 1,
|
||||||
|
count: 0,
|
||||||
|
allowed() {
|
||||||
|
return b.haveGunCheck("shotgun")
|
||||||
|
},
|
||||||
|
requires: "shotgun",
|
||||||
|
effect() {
|
||||||
|
b.isModShotgunImmune = true;
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
b.isModShotgunImmune = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
name: "perfect diamagnetism",
|
name: "perfect diamagnetism",
|
||||||
description: "when <strong>blocking</strong> with the basic <strong>field emitter</strong><br>gain <strong class='color-f'>energy</strong> instead losing it",
|
description: "when <strong>blocking</strong> with the basic <strong>field emitter</strong><br>gain <strong class='color-f'>energy</strong> instead losing it",
|
||||||
@@ -1798,6 +1815,7 @@ const b = {
|
|||||||
isStarterGun: true,
|
isStarterGun: true,
|
||||||
fire() {
|
fire() {
|
||||||
mech.fireCDcycle = mech.cycle + Math.floor((mech.crouch ? 55 : 30) * b.modFireRate); // cool down
|
mech.fireCDcycle = mech.cycle + Math.floor((mech.crouch ? 55 : 30) * b.modFireRate); // cool down
|
||||||
|
if (b.isModShotgunImmune) mech.collisionImmuneCycle = mech.cycle + 30; //player is immune to collision damage for 30 cycles
|
||||||
b.muzzleFlash(35);
|
b.muzzleFlash(35);
|
||||||
// mobs.alert(650);
|
// mobs.alert(650);
|
||||||
const side = 13 * b.modBulletSize
|
const side = 13 * b.modBulletSize
|
||||||
|
|||||||
14
js/engine.js
14
js/engine.js
@@ -19,11 +19,7 @@ engine.world.gravity.scale = 0; //turn off gravity (it's added back in later)
|
|||||||
// engine.positionIterations = 100
|
// engine.positionIterations = 100
|
||||||
// engine.enableSleeping = true
|
// engine.enableSleeping = true
|
||||||
|
|
||||||
// matter events *********************************************************
|
// matter events
|
||||||
//************************************************************************
|
|
||||||
//************************************************************************
|
|
||||||
//************************************************************************
|
|
||||||
|
|
||||||
function playerOnGroundCheck(event) {
|
function playerOnGroundCheck(event) {
|
||||||
//runs on collisions events
|
//runs on collisions events
|
||||||
function enter() {
|
function enter() {
|
||||||
@@ -104,8 +100,8 @@ function collisionChecks(event) {
|
|||||||
if (obj.classType === "body" && obj.speed > speedThreshold && obj.mass > massThreshold &&
|
if (obj.classType === "body" && obj.speed > speedThreshold && obj.mass > massThreshold &&
|
||||||
(obj.velocity.y > 0 || player.velocity.y > 0)) {
|
(obj.velocity.y > 0 || player.velocity.y > 0)) {
|
||||||
const v = Vector.magnitude(Vector.sub(player.velocity, obj.velocity));
|
const v = Vector.magnitude(Vector.sub(player.velocity, obj.velocity));
|
||||||
if (v > speedThreshold && mech.collisionImmune < mech.cycle) {
|
if (v > speedThreshold && mech.collisionImmuneCycle < mech.cycle) {
|
||||||
mech.collisionImmune = mech.cycle + b.modCollisionImmuneCycles; //player is immune to collision damage for 30 cycles
|
mech.collisionImmuneCycle = mech.cycle + b.modCollisionImmuneCycles; //player is immune to collision damage for 30 cycles
|
||||||
let dmg = Math.sqrt((v - speedThreshold + 0.1) * (obj.mass - massThreshold)) * 0.01;
|
let dmg = Math.sqrt((v - speedThreshold + 0.1) * (obj.mass - massThreshold)) * 0.01;
|
||||||
dmg = Math.min(Math.max(dmg, 0.02), 0.15);
|
dmg = Math.min(Math.max(dmg, 0.02), 0.15);
|
||||||
mech.damage(dmg);
|
mech.damage(dmg);
|
||||||
@@ -134,8 +130,8 @@ function collisionChecks(event) {
|
|||||||
|
|
||||||
function collideMob(obj) {
|
function collideMob(obj) {
|
||||||
//player + mob collision
|
//player + mob collision
|
||||||
if (mech.collisionImmune < mech.cycle && (obj === playerBody || obj === playerHead)) {
|
if (mech.collisionImmuneCycle < mech.cycle && (obj === playerBody || obj === playerHead)) {
|
||||||
mech.collisionImmune = mech.cycle + b.modCollisionImmuneCycles; //player is immune to collision damage for 30 cycles
|
mech.collisionImmuneCycle = mech.cycle + b.modCollisionImmuneCycles; //player is immune to collision damage for 30 cycles
|
||||||
mob[k].foundPlayer();
|
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
|
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
|
||||||
mech.damage(dmg);
|
mech.damage(dmg);
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ const level = {
|
|||||||
start() {
|
start() {
|
||||||
if (level.levelsCleared === 0) {
|
if (level.levelsCleared === 0) {
|
||||||
// level.difficultyIncrease(9)
|
// level.difficultyIncrease(9)
|
||||||
// b.giveGuns("wave beam")
|
b.giveGuns("shotgun")
|
||||||
// mech.setField("nano-scale manufacturing")
|
// mech.setField("nano-scale manufacturing")
|
||||||
// for (let i = 0; i < 9; i++) {
|
// for (let i = 0; i < 9; i++) {
|
||||||
// b.giveMod("mycelium manufacturing");
|
// b.giveMod("mycelium manufacturing");
|
||||||
// b.giveMod("anthropic principle");
|
b.giveMod("shotgun spin-statistics");
|
||||||
// b.giveMod("acute stress response");
|
// b.giveMod("acute stress response");
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@@ -753,7 +753,7 @@ const level = {
|
|||||||
spawn.mapRect(3450, -725, 1500, 50);
|
spawn.mapRect(3450, -725, 1500, 50);
|
||||||
spawn.mapRect(5100, -725, 400, 50);
|
spawn.mapRect(5100, -725, 400, 50);
|
||||||
spawn.mapRect(4500, -735, 50, 635);
|
spawn.mapRect(4500, -735, 50, 635);
|
||||||
spawn.bodyRect(4510, -100, 30, 100, 0.8);
|
spawn.bodyRect(4500, -100, 50, 100);
|
||||||
spawn.mapRect(4500, -885, 100, 50);
|
spawn.mapRect(4500, -885, 100, 50);
|
||||||
spawn.spawnStairs(3800, 0, 3, 150, 206); //stairs top exit
|
spawn.spawnStairs(3800, 0, 3, 150, 206); //stairs top exit
|
||||||
spawn.mapRect(3400, -275, 450, 275); //exit platform
|
spawn.mapRect(3400, -275, 450, 275); //exit platform
|
||||||
|
|||||||
10
js/player.js
10
js/player.js
@@ -208,7 +208,7 @@ const mech = {
|
|||||||
mech.hardLandCD = mech.cycle + Math.min(momentum / 6.5 - 6, 40)
|
mech.hardLandCD = mech.cycle + Math.min(momentum / 6.5 - 6, 40)
|
||||||
|
|
||||||
// if (b.isModStompPauli) {
|
// if (b.isModStompPauli) {
|
||||||
// mech.collisionImmune = mech.cycle + b.modCollisionImmuneCycles; //player is immune to collision damage for 30 cycles
|
// mech.collisionImmuneCycle = mech.cycle + b.modCollisionImmuneCycles; //player is immune to collision damage for 30 cycles
|
||||||
// }
|
// }
|
||||||
if (b.isModStomp) {
|
if (b.isModStomp) {
|
||||||
const len = Math.min(25, (momentum - 120) * 0.1)
|
const len = Math.min(25, (momentum - 120) * 0.1)
|
||||||
@@ -456,7 +456,7 @@ const mech = {
|
|||||||
mech.displayHealth();
|
mech.displayHealth();
|
||||||
},
|
},
|
||||||
defaultFPSCycle: 0, //tracks when to return to normal fps
|
defaultFPSCycle: 0, //tracks when to return to normal fps
|
||||||
collisionImmune: 0, //used in engine
|
collisionImmuneCycle: 0, //used in engine
|
||||||
damage(dmg) {
|
damage(dmg) {
|
||||||
if (b.isModEntanglement && b.inventory[0] === b.activeGun) {
|
if (b.isModEntanglement && b.inventory[0] === b.activeGun) {
|
||||||
for (let i = 0, len = b.inventory.length; i < len; i++) {
|
for (let i = 0, len = b.inventory.length; i < len; i++) {
|
||||||
@@ -468,7 +468,7 @@ const mech = {
|
|||||||
if (b.isModDeathAvoid && !b.isModDeathAvoidOnCD) { //&& Math.random() < 0.5
|
if (b.isModDeathAvoid && !b.isModDeathAvoidOnCD) { //&& Math.random() < 0.5
|
||||||
b.isModDeathAvoidOnCD = true;
|
b.isModDeathAvoidOnCD = true;
|
||||||
mech.health += dmg //undo the damage
|
mech.health += dmg //undo the damage
|
||||||
mech.collisionImmune = mech.cycle + 30 //disable this.collisionImmune bonus seconds
|
mech.collisionImmuneCycle = mech.cycle + 30 //disable this.collisionImmuneCycle bonus seconds
|
||||||
|
|
||||||
game.wipe = function () { //set wipe to have trails
|
game.wipe = function () { //set wipe to have trails
|
||||||
ctx.fillStyle = "rgba(255,255,255,0.02)";
|
ctx.fillStyle = "rgba(255,255,255,0.02)";
|
||||||
@@ -617,13 +617,13 @@ const mech = {
|
|||||||
mech.knee.y = (l / d) * (mech.foot.y - mech.hip.y) + (h / d) * (mech.foot.x - mech.hip.x) + mech.hip.y;
|
mech.knee.y = (l / d) * (mech.foot.y - mech.hip.y) + (h / d) * (mech.foot.x - mech.hip.x) + mech.hip.y;
|
||||||
},
|
},
|
||||||
draw() {
|
draw() {
|
||||||
// mech.fillColor = (mech.collisionImmune < mech.cycle) ? "#fff" : "rgba(255,255,255,0.1)" //"#cff"
|
// mech.fillColor = (mech.collisionImmuneCycle < mech.cycle) ? "#fff" : "rgba(255,255,255,0.1)" //"#cff"
|
||||||
ctx.fillStyle = mech.fillColor;
|
ctx.fillStyle = mech.fillColor;
|
||||||
mech.walk_cycle += mech.flipLegs * mech.Vx;
|
mech.walk_cycle += mech.flipLegs * mech.Vx;
|
||||||
|
|
||||||
//draw body
|
//draw body
|
||||||
ctx.save();
|
ctx.save();
|
||||||
ctx.globalAlpha = (mech.collisionImmune < mech.cycle) ? 1 : 0.7
|
ctx.globalAlpha = (mech.collisionImmuneCycle < mech.cycle) ? 1 : 0.7
|
||||||
ctx.translate(mech.pos.x, mech.pos.y);
|
ctx.translate(mech.pos.x, mech.pos.y);
|
||||||
mech.calcLeg(Math.PI, -3);
|
mech.calcLeg(Math.PI, -3);
|
||||||
mech.drawLeg("#4a4a4a");
|
mech.drawLeg("#4a4a4a");
|
||||||
|
|||||||
@@ -831,8 +831,8 @@ const spawn = {
|
|||||||
// });
|
// });
|
||||||
// }
|
// }
|
||||||
// hitting player
|
// hitting player
|
||||||
if (best.who === player && mech.collisionImmune < mech.cycle) {
|
if (best.who === player && mech.collisionImmuneCycle < mech.cycle) {
|
||||||
mech.collisionImmune = mech.cycle + b.modCollisionImmuneCycles; //player is immune to collision damage for 30 cycles
|
mech.collisionImmuneCycle = mech.cycle + b.modCollisionImmuneCycles; //player is immune to collision damage for 30 cycles
|
||||||
mech.damage(this.dmg);
|
mech.damage(this.dmg);
|
||||||
//draw damage
|
//draw damage
|
||||||
game.drawList.push({ //add dmg to draw queue
|
game.drawList.push({ //add dmg to draw queue
|
||||||
|
|||||||
17
todo.txt
17
todo.txt
@@ -1,9 +1,20 @@
|
|||||||
************** TODO - n-gon **************
|
************** TODO - n-gon **************
|
||||||
|
|
||||||
mod - ice crystal nucleaution should slow down mobs
|
mod - mines return ammo if they don't fire
|
||||||
add an on hit effect to *1.1 air friction?
|
|
||||||
|
|
||||||
mod - starter field can block attacks with out draining energy
|
mod - firing shotgun makes player collision immune for one second.
|
||||||
|
|
||||||
|
gun - buff vacuum bomb
|
||||||
|
its weak late game
|
||||||
|
can't spam it faster
|
||||||
|
bad vs. shields
|
||||||
|
doesn't scale up to huge groups
|
||||||
|
buff collision damage?
|
||||||
|
mod - double explosions?
|
||||||
|
mod - doesn't suck player in?
|
||||||
|
|
||||||
|
|
||||||
|
mod - negative mass field does damage to mobs in zone
|
||||||
|
|
||||||
mod - rail gun burst on impact into nails
|
mod - rail gun burst on impact into nails
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user