mod- shotgun immuity

This commit is contained in:
landgreen
2020-02-25 05:57:29 -08:00
parent c6c447ec47
commit 0148b1d272
6 changed files with 48 additions and 23 deletions

View File

@@ -475,7 +475,7 @@ const b = {
requires: "",
effect() {
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() {
b.modCollisionImmuneCycles = 30;
@@ -896,6 +896,23 @@ const b = {
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",
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,
fire() {
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);
// mobs.alert(650);
const side = 13 * b.modBulletSize

View File

@@ -19,11 +19,7 @@ engine.world.gravity.scale = 0; //turn off gravity (it's added back in later)
// engine.positionIterations = 100
// engine.enableSleeping = true
// matter events *********************************************************
//************************************************************************
//************************************************************************
//************************************************************************
// matter events
function playerOnGroundCheck(event) {
//runs on collisions events
function enter() {
@@ -104,8 +100,8 @@ function collisionChecks(event) {
if (obj.classType === "body" && obj.speed > speedThreshold && obj.mass > massThreshold &&
(obj.velocity.y > 0 || player.velocity.y > 0)) {
const v = Vector.magnitude(Vector.sub(player.velocity, obj.velocity));
if (v > speedThreshold && mech.collisionImmune < mech.cycle) {
mech.collisionImmune = mech.cycle + b.modCollisionImmuneCycles; //player is immune to collision damage for 30 cycles
if (v > speedThreshold && mech.collisionImmuneCycle < mech.cycle) {
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;
dmg = Math.min(Math.max(dmg, 0.02), 0.15);
mech.damage(dmg);
@@ -134,8 +130,8 @@ function collisionChecks(event) {
function collideMob(obj) {
//player + mob collision
if (mech.collisionImmune < mech.cycle && (obj === playerBody || obj === playerHead)) {
mech.collisionImmune = mech.cycle + b.modCollisionImmuneCycles; //player is immune to collision damage for 30 cycles
if (mech.collisionImmuneCycle < mech.cycle && (obj === playerBody || obj === playerHead)) {
mech.collisionImmuneCycle = mech.cycle + b.modCollisionImmuneCycles; //player is immune to collision damage for 30 cycles
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
mech.damage(dmg);

View File

@@ -14,11 +14,11 @@ const level = {
start() {
if (level.levelsCleared === 0) {
// level.difficultyIncrease(9)
// b.giveGuns("wave beam")
b.giveGuns("shotgun")
// mech.setField("nano-scale manufacturing")
// for (let i = 0; i < 9; i++) {
// b.giveMod("mycelium manufacturing");
// b.giveMod("anthropic principle");
b.giveMod("shotgun spin-statistics");
// b.giveMod("acute stress response");
// }
@@ -753,7 +753,7 @@ const level = {
spawn.mapRect(3450, -725, 1500, 50);
spawn.mapRect(5100, -725, 400, 50);
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.spawnStairs(3800, 0, 3, 150, 206); //stairs top exit
spawn.mapRect(3400, -275, 450, 275); //exit platform

View File

@@ -208,7 +208,7 @@ const mech = {
mech.hardLandCD = mech.cycle + Math.min(momentum / 6.5 - 6, 40)
// 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) {
const len = Math.min(25, (momentum - 120) * 0.1)
@@ -456,7 +456,7 @@ const mech = {
mech.displayHealth();
},
defaultFPSCycle: 0, //tracks when to return to normal fps
collisionImmune: 0, //used in engine
collisionImmuneCycle: 0, //used in engine
damage(dmg) {
if (b.isModEntanglement && b.inventory[0] === b.activeGun) {
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
b.isModDeathAvoidOnCD = true;
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
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;
},
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;
mech.walk_cycle += mech.flipLegs * mech.Vx;
//draw body
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);
mech.calcLeg(Math.PI, -3);
mech.drawLeg("#4a4a4a");

View File

@@ -831,8 +831,8 @@ const spawn = {
// });
// }
// hitting player
if (best.who === player && mech.collisionImmune < mech.cycle) {
mech.collisionImmune = mech.cycle + b.modCollisionImmuneCycles; //player is immune to collision damage for 30 cycles
if (best.who === player && mech.collisionImmuneCycle < mech.cycle) {
mech.collisionImmuneCycle = mech.cycle + b.modCollisionImmuneCycles; //player is immune to collision damage for 30 cycles
mech.damage(this.dmg);
//draw damage
game.drawList.push({ //add dmg to draw queue

View File

@@ -1,9 +1,20 @@
************** TODO - n-gon **************
mod - ice crystal nucleaution should slow down mobs
add an on hit effect to *1.1 air friction?
mod - mines return ammo if they don't fire
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