arsenal, generalist mod

This commit is contained in:
landgreen
2020-08-14 07:04:30 -07:00
parent 6bfc53d3be
commit 9ecbe9c479
6 changed files with 72 additions and 19 deletions

View File

@@ -264,14 +264,14 @@ const game = {
}
},
nextGun() {
if (b.inventory.length > 0) {
if (b.inventory.length > 0 && !mod.isGunCycle) {
b.inventoryGun++;
if (b.inventoryGun > b.inventory.length - 1) b.inventoryGun = 0;
game.switchGun();
}
},
previousGun() {
if (b.inventory.length > 0) {
if (b.inventory.length > 0 && !mod.isGunCycle) {
b.inventoryGun--;
if (b.inventoryGun < 0) b.inventoryGun = b.inventory.length - 1;
game.switchGun();
@@ -315,14 +315,11 @@ const game = {
// }
if (keys[69]) {
// e swap to next active gun
if (keys[69]) { // e swap to next active gun
game.nextGun();
} else if (keys[81]) {
//q swap to previous active gun
} else if (keys[81]) { //q swap to previous active gun
game.previousGun();
}
if (keys[80] && !game.isChoosing) { //p for pause
if (game.paused) {
build.unPauseGrid()

View File

@@ -57,6 +57,11 @@ const level = {
powerUps.spawn(mech.pos.x, mech.pos.y, "heal", false);
}
}
if (mod.isGunCycle) {
b.inventoryGun++;
if (b.inventoryGun > b.inventory.length - 1) b.inventoryGun = 0;
game.switchGun();
}
},
custom() {},
customTopLayer() {},

View File

@@ -70,6 +70,7 @@ const mod = {
},
damageFromMods() {
let dmg = 1
if (mod.isDamageForGuns) dmg *= 1 + 0.07 * b.inventory.length
if (mod.isLowHealthDmg) dmg *= 1 + 0.5 * Math.max(0, 1 - mech.health)
if (mod.isHarmDamage && mech.lastHarmCycle + 600 > mech.cycle) dmg *= 2;
if (mod.isEnergyLoss) dmg *= 1.33;
@@ -1056,6 +1057,43 @@ const mod = {
mod.bayesian = 0;
}
},
{
name: "arsenal",
description: "increase <strong class='color-d'>damage</strong> by <strong>7%</strong><br>for each <strong class='color-g'>gun</strong> in your inventory",
maxCount: 1,
count: 0,
allowed() {
return b.inventory.length > 1
},
requires: "at least 2 guns",
effect() {
mod.isDamageForGuns = true;
},
remove() {
mod.isDamageForGuns = false;
}
},
{
name: "generalist",
description: "<strong>spawn</strong> 3 <strong class='color-g'>gun</strong>, but you can't <strong>switch</strong> <strong class='color-g'>guns</strong><br>automatically cycle <strong class='color-g'>guns</strong> with each new level",
maxCount: 1,
count: 0,
isNonRefundable: true,
allowed() {
return mod.isDamageForGuns
},
requires: "arsenal",
effect() {
mod.isGunCycle = true;
for (let i = 0; i < 3; i++) {
powerUps.spawn(mech.pos.x, mech.pos.y, "gun");
if (Math.random() < mod.bayesian) powerUps.spawn(mech.pos.x, mech.pos.y, "gun");
}
},
remove() {
mod.isGunCycle = false;
}
},
{
name: "logistics",
description: "<strong class='color-g'>ammo</strong> power ups give <strong>200%</strong> <strong class='color-g'>ammo</strong><br>but <strong class='color-g'>ammo</strong> is only added to your <strong>current gun</strong>",
@@ -2561,5 +2599,7 @@ const mod = {
isLaserBotUpgrade: null,
isBoomBotUpgrade: null,
isDroneGrab: null,
isOneGun: null
isOneGun: null,
isDamageForGuns: null,
isGunCycle: null
}

View File

@@ -1733,7 +1733,7 @@ const mech = {
// }
function drawField(radius) {
radius *= 0.9 + 2 * mech.energy * mech.energy;
radius *= 0.9 + 2.2 * mech.energy * mech.energy;
const rotate = mech.cycle * 0.005;
mech.fieldPhase += 0.5 - 0.5 * Math.sqrt(Math.max(0.01, Math.min(mech.energy, 1)));
const off1 = 1 + 0.06 * Math.sin(mech.fieldPhase);
@@ -1770,7 +1770,7 @@ const mech = {
// game.draw.bodyFill = "transparent"
// game.draw.bodyStroke = "transparent"
const DRAIN = 0.00014 + (mech.fireCDcycle > mech.cycle ? 0.007 : 0.001)
const DRAIN = 0.00013 + (mech.fireCDcycle > mech.cycle ? 0.005 : 0)
if (mech.energy > DRAIN) {
mech.energy -= DRAIN;
// if (mech.energy < 0.001) {

View File

@@ -425,7 +425,7 @@ const powerUps = {
if (Math.random() < mod.bayesian) powerUps.spawn(x, y, "ammo");
return;
}
if (Math.random() < 0.001 * (3 - b.inventory.length)) { //a new gun has a low chance for each not acquired gun up to 3
if (Math.random() < 0.0015 * (3 - b.inventory.length)) { //a new gun has a low chance for each not acquired gun up to 3
powerUps.spawn(x, y, "gun");
if (Math.random() < mod.bayesian) powerUps.spawn(x, y, "gun");
return;
@@ -515,13 +515,18 @@ const powerUps = {
}
},
spawnStartingPowerUps(x, y) { //used for map specific power ups, mostly to give player a starting gun
if (level.levelsCleared < 6) {
if (level.levelsCleared < 4) { //runs 4 times on all difficulty levels
if (b.inventory.length === 0) {
powerUps.spawn(x, y, "gun", false);
} else if (mod.totalCount === 0) {
powerUps.spawn(x, y, "mod", false); //starting gun
// } else if (b.inventory.length < 2 && Math.random() < 0.2) {
// powerUps.spawn(x, y, "gun", false);
powerUps.spawn(x, y, "gun", false); //first gun
} else if (mod.totalCount === 0) { //first mod
powerUps.spawn(x, y, "mod", false);
} else if (b.inventory.length < 2) { //second gun or extra ammo
if (Math.random() < 0.5) {
powerUps.spawn(x, y, "gun", false);
} else {
powerUps.spawn(x, y, "ammo", false);
powerUps.spawn(x, y, "ammo", false);
}
} else {
powerUps.spawnRandomPowerUp(x, y);
powerUps.spawnRandomPowerUp(x, y);

View File

@@ -1,5 +1,11 @@
mod: renormalization now gives a 60% chance to return a reroll after using a reroll
(the old renormalization was causing too much lag)
In the first 4 levels: added a much higher chance of getting a second gun
or extra ammo if you don't get a second gun
mod - arsenal: +7% damage for each gun in your inventory
mod- generalist: spawn 2 guns, but you can't switch guns
at the start of each level switch guns
requires arsenal
************** TODO - n-gon **************