added basic field blocking mod
This commit is contained in:
@@ -86,7 +86,6 @@
|
||||
<div id="pause-grid-right" class="pause-grid"></div>
|
||||
</div>
|
||||
<svg class="SVG-button" id="build-button" width="110" height="40">
|
||||
<title>Select 5 power ups and see how far you can progress.</title>
|
||||
<g stroke='none' fill='#333' stroke-width="2" font-size="28px" font-family="Arial, sans-serif">
|
||||
<text x="10" y="30">custom</text>
|
||||
</g>
|
||||
|
||||
@@ -13,7 +13,7 @@ const b = {
|
||||
modNoAmmo: null,
|
||||
isModBulletsLastLonger: null,
|
||||
isModImmortal: null,
|
||||
modSpores: null,
|
||||
modSporesOnDeath: null,
|
||||
isModImmuneExplosion: null,
|
||||
isModExplodeMob: null,
|
||||
isModDroneOnDamage: null,
|
||||
@@ -52,6 +52,8 @@ const b = {
|
||||
isModDeathAvoidOnCD: null,
|
||||
modWaveSpeedMap: null,
|
||||
modWaveSpeedBody: null,
|
||||
modFieldEfficiency: null,
|
||||
isModSporeField: null,
|
||||
modOnHealthChange() { //used with acid mod
|
||||
if (b.isModAcidDmg && mech.health > 0.8) {
|
||||
game.playerDmgColor = "rgba(0,80,80,0.9)"
|
||||
@@ -268,13 +270,13 @@ const b = {
|
||||
},
|
||||
requires: "",
|
||||
effect() {
|
||||
b.modSpores += 0.11;
|
||||
b.modSporesOnDeath += 0.11;
|
||||
for (let i = 0; i < 10; i++) {
|
||||
b.spore(player)
|
||||
}
|
||||
},
|
||||
remove() {
|
||||
b.modSpores = 0;
|
||||
b.modSporesOnDeath = 0;
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -513,7 +515,7 @@ const b = {
|
||||
},
|
||||
{
|
||||
name: "weak anthropic principle",
|
||||
description: "<strong>avoid harm</strong> that should be <strong>fatal</strong><br>can occur once every <strong>3</strong> seconds",
|
||||
description: "<strong>fatal harm</strong> can't happen<br>saves you up to once every <strong>3</strong> seconds",
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
allowed() {
|
||||
@@ -746,7 +748,7 @@ const b = {
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
allowed() {
|
||||
return b.haveGunCheck("drones") || mech.fieldUpgrades[mech.fieldMode].name === "nano-scale manufacturing"
|
||||
return b.haveGunCheck("drones") || (mech.fieldUpgrades[mech.fieldMode].name === "nano-scale manufacturing" && !b.isModSporeField)
|
||||
},
|
||||
requires: "drones",
|
||||
effect() {
|
||||
@@ -762,7 +764,7 @@ const b = {
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
allowed() {
|
||||
return b.haveGunCheck("spores") || b.modSpores > 0 || b.isModStomp
|
||||
return b.haveGunCheck("spores") || b.modSporesOnDeath > 0 || b.isModStomp || b.isModSporeField
|
||||
},
|
||||
requires: "spores",
|
||||
effect() {
|
||||
@@ -773,8 +775,8 @@ const b = {
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "ice crystal nucleation",
|
||||
description: "fire <strong>ice crystals</strong> formed from water vapour<br>your <strong>minigun</strong> no longer requires <strong>ammo<strong>",
|
||||
name: "crystal nucleation",
|
||||
description: "fire <strong>crystals</strong> formed from the air<br>your <strong>minigun</strong> no longer requires <strong>ammo<strong>",
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
allowed() {
|
||||
@@ -894,6 +896,40 @@ const b = {
|
||||
b.modWaveSpeedBody = 0.25
|
||||
}
|
||||
},
|
||||
{
|
||||
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",
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
allowed() {
|
||||
return mech.fieldUpgrades[mech.fieldMode].name === "field emitter"
|
||||
},
|
||||
requires: "basic field emitter",
|
||||
effect() {
|
||||
b.modFieldEfficiency = -1
|
||||
mech.fieldShieldingScale = b.modFieldEfficiency;
|
||||
},
|
||||
remove() {
|
||||
b.modFieldEfficiency = 1;
|
||||
if (mech.fieldUpgrades[mech.fieldMode].name === "field emitter") mech.fieldShieldingScale = b.modFieldEfficiency;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "mycelium manufacturing",
|
||||
description: "<strong>nano-scale manufacturing</strong> is modified to<br>grow <strong style='letter-spacing: 2px;'>spores</strong> instead of drones",
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
allowed() {
|
||||
return mech.fieldUpgrades[mech.fieldMode].name === "nano-scale manufacturing"
|
||||
},
|
||||
requires: "nano-scale manufacturing",
|
||||
effect() {
|
||||
b.isModSporeField = true;
|
||||
},
|
||||
remove() {
|
||||
b.isModSporeField = false;
|
||||
}
|
||||
},
|
||||
|
||||
// {
|
||||
// name: "super mines",
|
||||
|
||||
12
js/level.js
12
js/level.js
@@ -13,21 +13,21 @@ const level = {
|
||||
levelsCleared: 0,
|
||||
start() {
|
||||
if (level.levelsCleared === 0) {
|
||||
level.difficultyIncrease(5)
|
||||
// level.difficultyIncrease(9)
|
||||
// b.giveGuns("wave beam")
|
||||
// mech.setField("negative mass field")
|
||||
// mech.setField("nano-scale manufacturing")
|
||||
// for (let i = 0; i < 9; i++) {
|
||||
// b.giveMod("wave phase velocity");
|
||||
// b.giveMod("mycelium manufacturing");
|
||||
// b.giveMod("anthropic principle");
|
||||
// b.giveMod("acute stress response");
|
||||
// }
|
||||
|
||||
// level.intro(); //starting level
|
||||
level.intro(); //starting level
|
||||
// level.testingMap();
|
||||
// level.bosses();
|
||||
// level.satellite();
|
||||
// level.skyscrapers();
|
||||
level.aerie();
|
||||
// level.aerie();
|
||||
// level.rooftops();
|
||||
// level.warehouse();
|
||||
// level.highrise();
|
||||
@@ -144,7 +144,7 @@ const level = {
|
||||
// powerUps.spawn(450, -400, "mod", false);
|
||||
// spawn.bodyRect(-45, -100, 40, 50);
|
||||
spawn.springer(800, -450);
|
||||
// spawn.cellBoss(400, -750);
|
||||
spawn.cellBoss(400, -750);
|
||||
|
||||
// spawn.randomLevelBoss(400, -750)
|
||||
|
||||
|
||||
@@ -967,7 +967,7 @@ const mobs = {
|
||||
if (this.dropPowerUp) {
|
||||
powerUps.spawnRandomPowerUp(this.position.x, this.position.y, this.mass, radius);
|
||||
mech.lastKillCycle = mech.cycle; //tracks the last time a kill was made, mostly used in game.checks()
|
||||
if (Math.random() < b.modSpores) {
|
||||
if (Math.random() < b.modSporesOnDeath) {
|
||||
const len = Math.min(30, Math.floor(4 + this.mass * Math.random()))
|
||||
for (let i = 0; i < len; i++) {
|
||||
b.spore(this) //spawn drone
|
||||
|
||||
19
js/player.js
19
js/player.js
@@ -663,6 +663,7 @@ const mech = {
|
||||
fieldMode: 0, //basic field mode before upgrades
|
||||
fieldEnergyMax: 1, //can be increased by a mod
|
||||
holdingTarget: null,
|
||||
fieldShieldingScale: 1,
|
||||
// these values are set on reset by setHoldDefaults()
|
||||
fieldMeter: 0,
|
||||
fieldRegen: 0,
|
||||
@@ -671,7 +672,6 @@ const mech = {
|
||||
holdingMassScale: 0,
|
||||
throwChargeRate: 0,
|
||||
throwChargeMax: 0,
|
||||
fieldShieldingScale: 0,
|
||||
fieldRange: 175,
|
||||
fieldArc: 0,
|
||||
fieldThreshold: 0,
|
||||
@@ -685,7 +685,7 @@ const mech = {
|
||||
mech.fieldCDcycle = 0;
|
||||
mech.isStealth = false;
|
||||
player.collisionFilter.mask = cat.body | cat.map | cat.mob | cat.mobBullet | cat.mobShield
|
||||
mech.fieldShieldingScale = 1; //scale energy loss after collision with mob
|
||||
// mech.fieldShieldingScale = 1; //scale energy loss after collision with mob
|
||||
mech.holdingMassScale = 0.5;
|
||||
mech.throwChargeRate = 2;
|
||||
mech.throwChargeMax = 50;
|
||||
@@ -932,6 +932,7 @@ const mech = {
|
||||
if (mech.fieldMeter > fieldBlockCost * 0.2) { //shield needs at least some of the cost to block
|
||||
mech.fieldMeter -= fieldBlockCost * mech.fieldShieldingScale;
|
||||
if (mech.fieldMeter < 0) mech.fieldMeter = 0;
|
||||
if (mech.fieldMeter > mech.fieldEnergyMax) mech.fieldMeter = mech.fieldEnergyMax;
|
||||
mech.drawHold(who);
|
||||
mech.fieldCDcycle = mech.cycle + 10;
|
||||
mech.holdingTarget = null
|
||||
@@ -1120,6 +1121,7 @@ const mech = {
|
||||
name: "field emitter",
|
||||
description: "use <strong class='color-f'>energy</strong> to <strong>shield</strong> yourself from <strong class='color-d'>damage</strong><br>lets you <strong>pick up</strong> and <strong>throw</strong> objects",
|
||||
effect: () => {
|
||||
mech.fieldShieldingScale = Number(b.modFieldEfficiency);
|
||||
game.replaceTextLog = true; //allow text over write
|
||||
mech.hold = function () {
|
||||
if (mech.isHolding) {
|
||||
@@ -1510,8 +1512,17 @@ const mech = {
|
||||
mech.hold = function () {
|
||||
if (mech.fieldMeter > mech.fieldEnergyMax - 0.02 && mech.fieldCDcycle < mech.cycle) {
|
||||
mech.fieldCDcycle = mech.cycle + 17; // set cool down to prevent +energy from making huge numbers of drones
|
||||
mech.fieldMeter -= 0.35;
|
||||
b.drone(1)
|
||||
if (b.isModSporeField) {
|
||||
const len = Math.floor(6 + 3 * Math.random())
|
||||
mech.fieldMeter -= len * 0.12;
|
||||
for (let i = 0; i < len; i++) {
|
||||
b.spore(player)
|
||||
}
|
||||
} else {
|
||||
mech.fieldMeter -= 0.33;
|
||||
b.drone(1)
|
||||
}
|
||||
|
||||
}
|
||||
if (mech.isHolding) {
|
||||
mech.drawHold(mech.holdingTarget);
|
||||
|
||||
@@ -25,12 +25,14 @@ const powerUps = {
|
||||
game.isChoosing = false; //stops p from un pausing on key down
|
||||
requestAnimationFrame(cycle);
|
||||
},
|
||||
cancel() {
|
||||
isCanceledField: false,
|
||||
cancel(what) {
|
||||
document.body.style.cursor = "none";
|
||||
document.getElementById("choose-grid").style.display = "none"
|
||||
document.getElementById("choose-background").style.display = "none"
|
||||
game.paused = false;
|
||||
game.isChoosing = false; //stops p from un pausing on key down
|
||||
if (what === "field") powerUps.isCanceledField = true;
|
||||
requestAnimationFrame(cycle);
|
||||
},
|
||||
showDraft() {
|
||||
@@ -109,7 +111,7 @@ const powerUps = {
|
||||
let choice2 = pick(mech.fieldUpgrades, choice1)
|
||||
let choice3 = -1
|
||||
if (choice1 > -1) {
|
||||
let text = `<div class='cancel' onclick='powerUps.cancel()'>✕</div><h3 style = 'color:#fff; text-align:left; margin: 0px;'>choose a field</h3>`
|
||||
let text = `<div class='cancel' onclick='powerUps.cancel("field")'>✕</div><h3 style = 'color:#fff; text-align:left; margin: 0px;'>choose a field</h3>`
|
||||
text += `<div class="choose-grid-module" onclick="powerUps.choose('field',${choice1})"><div class="grid-title"><div class="circle-grid field"></div> ${mech.fieldUpgrades[choice1].name}</div> ${mech.fieldUpgrades[choice1].description}</div>`
|
||||
if (choice2 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('field',${choice2})"><div class="grid-title"><div class="circle-grid field"></div> ${mech.fieldUpgrades[choice2].name}</div> ${mech.fieldUpgrades[choice2].description}</div>`
|
||||
if (!b.isModBayesian) {
|
||||
@@ -153,7 +155,7 @@ const powerUps = {
|
||||
let choice2 = pick(choice1)
|
||||
let choice3 = -1
|
||||
if (choice1 > -1) {
|
||||
let text = "<div class='cancel' onclick='powerUps.cancel()'>✕</div><h3 style = 'color:#fff; text-align:left; margin: 0px;'>choose a mod</h3>"
|
||||
let text = `<div class='cancel' onclick='powerUps.cancel("mod")'>✕</div><h3 style = 'color:#fff; text-align:left; margin: 0px;'>choose a mod</h3>`
|
||||
text += `<div class="choose-grid-module" onclick="powerUps.choose('mod',${choice1})"><div class="grid-title"><div class="circle-grid mod"></div> ${b.mods[choice1].name}</div> ${b.mods[choice1].description}</div>`
|
||||
if (choice2 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('mod',${choice2})"><div class="grid-title"><div class="circle-grid mod"></div> ${b.mods[choice2].name}</div> ${b.mods[choice2].description}</div>`
|
||||
if (!b.isModBayesian) {
|
||||
@@ -190,7 +192,7 @@ const powerUps = {
|
||||
let choice2 = pick(b.guns, choice1)
|
||||
let choice3 = -1
|
||||
if (choice1 > -1) {
|
||||
let text = "<div class='cancel' onclick='powerUps.cancel()'>✕</div><h3 style = 'color:#fff; text-align:left; margin: 0px;'>choose a gun</h3>"
|
||||
let text = `<div class='cancel' onclick='powerUps.cancel("gun")'>✕</div><h3 style = 'color:#fff; text-align:left; margin: 0px;'>choose a gun</h3>`
|
||||
text += `<div class="choose-grid-module" onclick="powerUps.choose('gun',${choice1})"><div class="grid-title"><div class="circle-grid gun"></div> ${b.guns[choice1].name}</div> ${b.guns[choice1].description}</div>`
|
||||
if (choice2 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('gun',${choice2})"><div class="grid-title"><div class="circle-grid gun"></div> ${b.guns[choice2].name}</div> ${b.guns[choice2].description}</div>`
|
||||
if (!b.isModBayesian) {
|
||||
@@ -248,7 +250,7 @@ const powerUps = {
|
||||
}
|
||||
},
|
||||
spawnBossPowerUp(x, y) { //boss spawns field and gun mod upgrades
|
||||
if (mech.fieldMode === 0) {
|
||||
if (mech.fieldMode === 0 && !powerUps.isCanceledField) {
|
||||
powerUps.spawn(x, y, "field")
|
||||
if (Math.random() < b.isModBayesian) powerUps.spawn(x, y, "field")
|
||||
} else if (Math.random() < 0.80) {
|
||||
|
||||
8
todo.txt
8
todo.txt
@@ -1,7 +1,11 @@
|
||||
************** TODO - n-gon **************
|
||||
|
||||
level - add wrecking ball boss to other levels
|
||||
it could work on rooftops and satellite
|
||||
mod - ice crystal nucleaution should slow down mobs
|
||||
add an on hit effect to *1.1 air friction?
|
||||
|
||||
mod - starter field can block attacks with out draining energy
|
||||
|
||||
mod - rail gun burst on impact into nails
|
||||
|
||||
mod - make bodies destroyable
|
||||
they drop ammo and heals
|
||||
|
||||
Reference in New Issue
Block a user