added option for community maps

This commit is contained in:
landgreen
2020-04-05 05:16:09 -07:00
parent 7dbb74a3ad
commit 8bcc038b81
6 changed files with 47 additions and 26 deletions

View File

@@ -71,6 +71,8 @@ const b = {
isModAlphaRadiation: null,
modEnergyRegen: null,
isModVacuumShield: null,
modRenormalization: null,
modGrenadeFragments: null,
modOnHealthChange() { //used with acid mod
if (b.isModAcidDmg && mech.health > 0.8) {
b.modAcidDmg = 0.7
@@ -1334,6 +1336,22 @@ const b = {
b.isModIceField = false;
}
},
{
name: "renormalization",
description: "<strong>phase decoherence field</strong> has <strong>3x visibility</strong><br>and <strong>1/3</strong> <strong class='color-f'>energy</strong> drain when <strong>firing</strong>",
maxCount: 1,
count: 0,
allowed() {
return mech.fieldUpgrades[mech.fieldMode].name === "phase decoherence field"
},
requires: "phase decoherence field",
effect() {
b.modRenormalization = 3;
},
remove() {
b.modRenormalization = 1;
}
},
{
name: "quantum dissipation",
description: "<strong>phase decoherence field</strong> uses <strong class='color-f'>energy</strong> to <br><strong class='color-d'>damage</strong> unshielded <strong>mobs</strong> that you <strong>overlap</strong>",

View File

@@ -96,6 +96,7 @@ const game = {
fpsCap: null, //limits frames per second to 144/2=72, on most monitors the fps is capped at 60fps by the hardware
fpsCapDefault: 72, //use to change fpsCap back to normal after a hit from a mob
isEasyToAimMode: true, //removes power ups that don't work well with a track pad
isCommunityMaps: false,
cyclePaused: 0,
fallHeight: 3000, //below this y position the player dies
lastTimeStamp: 0, //tracks time stamps for measuring delta
@@ -597,9 +598,10 @@ const game = {
}
return array;
}
if (game.isCommunityMaps) level.levels.push("stronghold");
level.levels = shuffle(level.levels); //shuffles order of maps
level.levels.unshift("bosses"); //add bosses level to the end of the randomized levels list
console.log(level.levels)
}
game.reset();
game.firstRun = false;

View File

@@ -380,6 +380,9 @@ if (localSettings) {
game.isEasyToAimMode = localSettings.isEasyToAimMode
document.getElementById("track-pad-mode").checked = localSettings.isEasyToAimMode
game.isCommunityMaps = localSettings.isCommunityMaps
document.getElementById("community-maps").checked = localSettings.isCommunityMaps
game.difficultyMode = localSettings.difficultyMode
document.getElementById("difficulty-select").value = localSettings.difficultyMode
@@ -393,6 +396,7 @@ if (localSettings) {
localSettings = {
isBodyDamage: true,
isEasyToAimMode: false,
isCommunityMaps: false,
difficultyMode: '1',
fpsCapDefault: 'max',
};
@@ -400,6 +404,8 @@ if (localSettings) {
document.getElementById("body-damage").checked = localSettings.isBodyDamage
document.getElementById("track-pad-mode").checked = localSettings.isEasyToAimMode
game.isEasyToAimMode = localSettings.isEasyToAimMode
document.getElementById("community-maps").checked = localSettings.isEasyToAimMode
game.isCommunityMaps = localSettings.isCommunityMaps
document.getElementById("difficulty-select").value = localSettings.difficultyMode
document.getElementById("fps-select").value = localSettings.fpsCapDefault
}
@@ -503,6 +509,12 @@ document.getElementById("track-pad-mode").addEventListener("input", () => {
localStorage.setItem("localSettings", JSON.stringify(localSettings)); //update local storage
});
document.getElementById("community-maps").addEventListener("input", () => {
game.isCommunityMaps = document.getElementById("community-maps").checked
localSettings.isCommunityMaps = game.isCommunityMaps
localStorage.setItem("localSettings", JSON.stringify(localSettings)); //update local storage
});
// difficulty-select-custom event listener is set in build.makeGrid
document.getElementById("difficulty-select").addEventListener("input", () => {
game.difficultyMode = Number(document.getElementById("difficulty-select").value)

View File

@@ -1751,17 +1751,16 @@ const mech = {
isEasyToAim: true,
effect: () => {
mech.fieldFire = true;
mech.fieldMeterColor = "#fff"
mech.fieldPhase = 0
mech.fieldMeterColor = "#fff";
mech.fieldPhase = 0;
mech.hold = function () {
function drawField(radius) {
radius *= 0.7 + 0.7 * mech.energy
const rotate = mech.cycle * 0.005
const amplitude = 0.06
mech.fieldPhase += 0.5 - 0.5 * Math.sqrt(Math.min(mech.energy, 1))
const off1 = 1 + amplitude * Math.sin(mech.fieldPhase) //+ 0.07 * Math.sin(mech.cycle * 0.05)
const off2 = 1 - amplitude * Math.sin(mech.fieldPhase) //+ 0.07 * Math.sin(mech.cycle * 0.05)
radius *= 0.6 + 0.7 * mech.energy * b.modRenormalization;
const rotate = mech.cycle * 0.005;
mech.fieldPhase += 0.5 - 0.5 * Math.sqrt(Math.min(mech.energy, 1));
const off1 = 1 + 0.06 * Math.sin(mech.fieldPhase);
const off2 = 1 - 0.06 * Math.sin(mech.fieldPhase);
ctx.beginPath();
ctx.ellipse(mech.pos.x, mech.pos.y, radius * off1, radius * off2, rotate, 0, 2 * Math.PI);
ctx.fillStyle = "#fff" //`rgba(0,0,0,${0.5+0.5*mech.energy})`;
@@ -1770,7 +1769,7 @@ const mech = {
ctx.globalCompositeOperation = "source-over";
ctx.clip();
if (mech.fireCDcycle > mech.cycle) {
if (mech.fireCDcycle > mech.cycle && (keys[32] || game.mouseDownRight)) {
ctx.lineWidth = 5;
ctx.strokeStyle = `rgba(0, 204, 255,1)`
ctx.stroke()
@@ -1788,7 +1787,7 @@ const mech = {
mech.grabPowerUp();
mech.lookForPickUp();
const DRAIN = (0.0005 + 0.0001 * player.speed) * (mech.fireCDcycle > mech.cycle ? 4 : 1) //game.mouseDown
const DRAIN = (0.0005 + 0.0001 * player.speed) * (mech.fireCDcycle > mech.cycle ? 10 / b.modRenormalization : 1) //game.mouseDown
if (mech.energy > DRAIN) {
mech.energy -= DRAIN;
if (mech.energy < 0.001) {
@@ -1842,7 +1841,7 @@ const mech = {
} else {
// this.fieldRange = 3000
if (this.fieldRange < 2000 && mech.holdingTarget === null) {
this.fieldRange += 200
this.fieldRange += 20
drawField(this.fieldRange)
}
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)