added localized invisibility field

This commit is contained in:
landgreen
2019-09-19 05:57:22 -07:00
parent 2168de12d5
commit cc34e23555
4 changed files with 53 additions and 25 deletions

View File

@@ -470,6 +470,7 @@ const mech = {
index: 0
},
isHolding: false,
isStealth: false,
throwCharge: 0,
fireCDcycle: 0,
fieldCDcycle: 0,
@@ -493,6 +494,7 @@ const mech = {
this.fieldMeter = 1;
this.fieldRegen = 0.0015;
this.fieldCDcycle = 0;
this.isStealth = false;
this.holdingMassScale = 0.5;
this.throwChargeRate = 2;
this.throwChargeMax = 50;
@@ -1035,6 +1037,49 @@ const mech = {
mech.drawFieldMeter()
}
},
() => {
mech.fieldMode = 6;
game.makeTextLog("<strong style='font-size:30px;'>Metamaterial Refractive Optics</strong><br> (left mouse or space bar) <p>localized invisibility field</p>", 1000);
mech.setHoldDefaults();
mech.fieldArc = 1; //field covers full 360 degrees
mech.calculateFieldThreshold();
mech.hold = function () {
mech.isStealth = false //isStealth is checked in mob foundPlayer()
if (mech.isHolding) {
mech.drawHold(mech.holdingTarget);
mech.holding();
mech.throw();
} else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < game.cycle) {
const DRAIN = 0.0015 //mech.fieldRegen = 0.0015
if (mech.fieldMeter > DRAIN) {
mech.fieldMeter -= DRAIN;
mech.isStealth = true //isStealth is checked in mob foundPlayer()
//draw stealth field
// ctx.fillStyle = "rgba(255,255,155,0.9)";
// ctx.fillStyle = "rgba(255,255,255,1)";
ctx.fill();
ctx.beginPath();
ctx.arc(mech.pos.x, mech.pos.y + 25, 110, 0, 2 * Math.PI);
ctx.globalCompositeOperation = "destination-in";
ctx.fill();
ctx.globalCompositeOperation = "source-over";
mech.grabPowerUp();
mech.lookForPickUp();
} else {
mech.fieldCDcycle = game.cycle + 120;
}
} else if (mech.holdingTarget && mech.fireCDcycle < game.cycle) { //holding, but field button is released
mech.pickUp();
} else {
mech.holdingTarget = null; //clears holding target (this is so you only pick up right after the field button is released and a hold target exists)
}
mech.drawFieldMeter()
}
},
// () => {
// mech.fieldMode = 1;
// game.makeTextLog("<h2>Time Dilation Field</h2><br><strong>active ability:</strong> hold left and right mouse to slow time<br><strong>passive bonus:</strong> +field regeneration", 1000); //<br><strong>passive bonus:</strong> can phase through blocks