inductive coupling
your build url can now be copied in the pause screen mod: inductive coupling - 4 max health per power up, but limited to 44 max health per level (replaces crystalized armor) mod: transceiver chip - use all the power ups left over at the end of a level mod: catabolism - does a flat 5 damage to your health for 3 ammo (was 2% of max health for 1 ammo)
This commit is contained in:
30
js/bullet.js
30
js/bullet.js
@@ -22,9 +22,11 @@ const b = {
|
||||
}
|
||||
} else {
|
||||
if (mod.isAmmoFromHealth) {
|
||||
if (mech.health > 2 * mod.isAmmoFromHealth * mech.maxHealth) {
|
||||
mech.damage(mod.isAmmoFromHealth * mech.maxHealth / mech.harmReduction());
|
||||
if (!(mod.isRewindAvoidDeath && mech.energy > 0.66)) powerUps.spawn(mech.pos.x, mech.pos.y, "ammo"); //don't give ammo if CPT triggered
|
||||
if (mech.health > 0.05) {
|
||||
mech.damage(0.05 / mech.harmReduction()); // /mech.harmReduction() undoes damage increase from difficulty
|
||||
if (!(mod.isRewindAvoidDeath && mech.energy > 0.66)) { //don't give ammo if CPT triggered
|
||||
for (let i = 0; i < 3; i++) powerUps.spawn(mech.pos.x, mech.pos.y, "ammo");
|
||||
}
|
||||
} else {
|
||||
game.replaceTextLog = true;
|
||||
game.makeTextLog("not enough health for catabolism to produce ammo", 120);
|
||||
@@ -35,9 +37,7 @@ const b = {
|
||||
}
|
||||
mech.fireCDcycle = mech.cycle + 30; //fire cooldown
|
||||
}
|
||||
if (mech.holdingTarget) {
|
||||
mech.drop();
|
||||
}
|
||||
if (mech.holdingTarget) mech.drop();
|
||||
}
|
||||
},
|
||||
removeAllGuns() {
|
||||
@@ -307,7 +307,7 @@ const b = {
|
||||
const me = bullet.length;
|
||||
bullet[me] = Bodies.circle(where.x, where.y, 15, b.fireAttributes(angle, false));
|
||||
Matter.Body.setDensity(bullet[me], 0.0005);
|
||||
bullet[me].explodeRad = 275;
|
||||
bullet[me].explodeRad = 300;
|
||||
bullet[me].onEnd = function() {
|
||||
b.explosion(this.position, this.explodeRad); //makes bullet do explosive damage at end
|
||||
if (mod.fragments) b.targetedNail(this.position, mod.fragments * 5)
|
||||
@@ -316,7 +316,7 @@ const b = {
|
||||
bullet[me].beforeDmg = function() {
|
||||
this.endCycle = 0; //bullet ends cycle after doing damage //this also triggers explosion
|
||||
};
|
||||
speed = mech.crouch ? 43 : 32
|
||||
speed = mech.crouch ? 46 : 32
|
||||
Matter.Body.setVelocity(bullet[me], {
|
||||
x: mech.Vx / 2 + speed * Math.cos(angle),
|
||||
y: mech.Vy / 2 + speed * Math.sin(angle)
|
||||
@@ -681,19 +681,21 @@ const b = {
|
||||
lastAngle: 0,
|
||||
wasExtruderOn: false,
|
||||
isExtruderOn: false,
|
||||
didExtruderDrain: false,
|
||||
canExtruderFire: true,
|
||||
extruder() {
|
||||
const DRAIN = 0.0007 + mech.fieldRegen
|
||||
if (mech.energy > DRAIN) {
|
||||
if (mech.energy > DRAIN && b.canExtruderFire) {
|
||||
mech.energy -= DRAIN
|
||||
if (mech.energy < 0) {
|
||||
mech.fieldCDcycle = mech.cycle + 120;
|
||||
mech.energy = 0;
|
||||
}
|
||||
mech.isExtruderOn = true
|
||||
b.isExtruderOn = true
|
||||
const SPEED = 10
|
||||
const me = bullet.length;
|
||||
const where = Vector.add(mech.pos, player.velocity)
|
||||
bullet[me] = Bodies.polygon(where.x + 20 * Math.cos(mech.angle), where.y + 20 * Math.sin(mech.angle), 3, 0.01, {
|
||||
bullet[me] = Bodies.polygon(where.x + 20 * Math.cos(mech.angle), where.y + 20 * Math.sin(mech.angle), 4, 0.01, {
|
||||
cycle: -0.5,
|
||||
isWave: true,
|
||||
endCycle: game.cycle + 10 + 40 * mod.isPlasmaRange,
|
||||
@@ -755,7 +757,9 @@ const b = {
|
||||
const transverse = Vector.normalise(Vector.perp(bullet[me].velocity))
|
||||
if (180 - Math.abs(Math.abs(b.lastAngle - mech.angle) - 180) > 0.3) bullet[me].isBranch = true; //don't draw stroke for this bullet
|
||||
b.lastAngle = mech.angle //track last angle for the above angle difference calculation
|
||||
if (!mech.wasExtruderOn) bullet[me].isBranch = true;
|
||||
if (!b.wasExtruderOn) bullet[me].isBranch = true;
|
||||
} else {
|
||||
b.canExtruderFire = false;
|
||||
}
|
||||
},
|
||||
plasma() {
|
||||
@@ -1336,7 +1340,7 @@ const b = {
|
||||
const THRUST = 0.004
|
||||
const dir = mech.angle + spread * (Math.random() - 0.5);
|
||||
const RADIUS = 18
|
||||
bullet[me] = Bodies.polygon(mech.pos.x + 30 * Math.cos(mech.angle), mech.pos.y + 30 * Math.sin(mech.angle), 4, RADIUS, {
|
||||
bullet[me] = Bodies.polygon(mech.pos.x + 30 * Math.cos(mech.angle), mech.pos.y + 30 * Math.sin(mech.angle), 3, RADIUS, {
|
||||
angle: dir - Math.PI,
|
||||
inertia: Infinity,
|
||||
friction: 0,
|
||||
|
||||
28
js/game.js
28
js/game.js
@@ -595,6 +595,9 @@ const game = {
|
||||
}
|
||||
}
|
||||
|
||||
if (mod.isEndLevelPowerUp) {
|
||||
for (let i = 0; i < powerUp.length; i++) powerUp[i].effect();
|
||||
}
|
||||
powerUps.totalPowerUps = powerUp.length
|
||||
|
||||
let holdTarget; //if player is holding something this remembers it before it gets deleted
|
||||
@@ -752,8 +755,31 @@ const game = {
|
||||
//check for double crouch
|
||||
//crouch playerHead.position.y - player.position.y = 9.7 //positive
|
||||
//standing playerHead.position.y - player.position.y = -30 //negative
|
||||
// mech.undoCrouch()
|
||||
if (!mech.crouch && ((playerHead.position.y - player.position.y) > 0)) {
|
||||
// mech.undoCrouch()
|
||||
Matter.Body.translate(playerHead, {
|
||||
x: 0,
|
||||
y: 40
|
||||
});
|
||||
if ((playerHead.position.y - player.position.y) > 0) {
|
||||
Matter.Body.translate(playerHead, {
|
||||
x: 0,
|
||||
y: 40
|
||||
});
|
||||
if ((playerHead.position.y - player.position.y) > 0) {
|
||||
Matter.Body.translate(playerHead, {
|
||||
x: 0,
|
||||
y: 40
|
||||
});
|
||||
if ((playerHead.position.y - player.position.y) > 0) {
|
||||
Matter.Body.translate(playerHead, {
|
||||
x: 0,
|
||||
y: 40
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (mech.crouch && ((playerHead.position.y - player.position.y) > 10)) {
|
||||
Matter.Body.translate(playerHead, {
|
||||
x: 0,
|
||||
y: 40
|
||||
|
||||
118
js/index.js
118
js/index.js
@@ -196,6 +196,12 @@ const build = {
|
||||
<br>damage difficulty scale: ${(b.dmgScale*100).toFixed(2) }%
|
||||
<br>harm difficulty scale: ${(game.dmgScale*100).toFixed(0)}%
|
||||
<br>heal difficulty scale: ${(game.healScale*100).toFixed(1)}%
|
||||
<br><svg class="SVG-button" onclick="build.shareURL(false)" width="110" height="25" style="padding:2px; margin: 10px;">
|
||||
<g stroke='none' fill='#333' stroke-width="2" font-size="17px" font-family="Ariel, sans-serif">
|
||||
<text x="5" y="18">copy build url</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
</div>`;
|
||||
let countGuns = 0
|
||||
let countMods = 0
|
||||
@@ -217,15 +223,15 @@ const build = {
|
||||
if (mod.mods[i].isFieldMod) {
|
||||
text += `<div class="pause-grid-module"><div class="grid-title">
|
||||
<span style="position:relative;">
|
||||
<div class="circle-grid field" style="position:absolute; top:0; left:10px;opacity:1;"></div>
|
||||
<div class="circle-grid mod" style="position:absolute; top:0; left:0;opacity:0.75;"></div>
|
||||
<div class="circle-grid mod" style="position:absolute; top:0; left:0;opacity:0.8;"></div>
|
||||
<div class="circle-grid field" style="position:absolute; top:0; left:10px;opacity:0.65;"></div>
|
||||
</span>
|
||||
${mod.mods[i].name} ${isCount}</div>${mod.mods[i].description}</div></div>`
|
||||
} else if (mod.mods[i].isGunMod) {
|
||||
text += `<div class="pause-grid-module"><div class="grid-title">
|
||||
<span style="position:relative;">
|
||||
<div class="circle-grid gun" style="position:absolute; top:0; left:10px; opacity:0.75;"></div>
|
||||
<div class="circle-grid mod" style="position:absolute; top:0; left:0;opacity:0.75;"></div>
|
||||
<div class="circle-grid mod" style="position:absolute; top:0; left:0;opacity:0.8;"></div>
|
||||
<div class="circle-grid gun" style="position:absolute; top:0; left:10px; opacity:0.65;"></div>
|
||||
</span>
|
||||
${mod.mods[i].name} ${isCount}</div>${mod.mods[i].description}</div></div>`
|
||||
} else {
|
||||
@@ -299,15 +305,19 @@ const build = {
|
||||
if (mod.mods[i].isFieldMod) {
|
||||
modID.innerHTML = ` <div class="grid-title">
|
||||
<span style="position:relative;">
|
||||
<div class="circle-grid field" style="position:absolute; top:0; left:10px;opacity:1;"></div>
|
||||
<div class="circle-grid mod" style="position:absolute; top:0; left:0;opacity:0.75;"></div>
|
||||
<div class="circle-grid mod" style="position:absolute; top:0; left:0;opacity:0.8;"></div>
|
||||
<div class="circle-grid field" style="position:absolute; top:0; left:10px;opacity:0.65;"></div>
|
||||
</span>
|
||||
${mod.mods[i].name} ${isCount}</div>${mod.mods[i].description}</div>`
|
||||
|
||||
// <div class="circle-grid gun" style="position:absolute; top:-3px; left:-3px; opacity:1; height: 33px; width:33px;"></div>
|
||||
// <div class="circle-grid mod" style="position:absolute; top:5px; left:5px;opacity:1;height: 20px; width:20px;border: #fff solid 2px;"></div>
|
||||
// border: #fff solid 0px;
|
||||
} else if (mod.mods[i].isGunMod) {
|
||||
modID.innerHTML = ` <div class="grid-title">
|
||||
<span style="position:relative;">
|
||||
<div class="circle-grid gun" style="position:absolute; top:0; left:10px; opacity:0.75;"></div>
|
||||
<div class="circle-grid mod" style="position:absolute; top:0; left:0;opacity:0.75;"></div>
|
||||
<div class="circle-grid mod" style="position:absolute; top:0; left:0;opacity:0.8;"></div>
|
||||
<div class="circle-grid gun" style="position:absolute; top:0; left:10px; opacity:0.65;"></div>
|
||||
</span>
|
||||
${mod.mods[i].name} ${isCount}</div>${mod.mods[i].description}</div>`
|
||||
} else {
|
||||
@@ -319,7 +329,7 @@ const build = {
|
||||
modID.setAttribute("onClick", `javascript: build.choosePowerUp(this,${i},'mod')`);
|
||||
}
|
||||
} else {
|
||||
modID.innerHTML = `<div class="grid-title"><div class="circle-grid grey"></div> ${mod.mods[i].name}</div><span style="color:#666;">requires: ${mod.mods[i].requires}</span></div>`
|
||||
modID.innerHTML = `<div class="grid-title"> ${mod.mods[i].name}</div><span style="color:#666;">requires: ${mod.mods[i].requires}</span></div>`
|
||||
if (!modID.classList.contains("build-grid-disabled")) {
|
||||
modID.classList.add("build-grid-disabled");
|
||||
modID.onclick = null
|
||||
@@ -343,7 +353,7 @@ const build = {
|
||||
<text x="5" y="18">reset</text>
|
||||
</g>
|
||||
</svg>
|
||||
<svg class="SVG-button" onclick="build.shareURL()" width="52" height="25">
|
||||
<svg class="SVG-button" onclick="build.shareURL(true)" width="52" height="25">
|
||||
<g stroke='none' fill='#333' stroke-width="2" font-size="17px" font-family="Ariel, sans-serif">
|
||||
<text x="5" y="18">share</text>
|
||||
</g>
|
||||
@@ -371,12 +381,13 @@ const build = {
|
||||
for (let i = 0, len = b.guns.length; i < len; i++) {
|
||||
text += `<div id = "gun-${i}" class="build-grid-module" onclick="build.choosePowerUp(this,${i},'gun')"><div class="grid-title"><div class="circle-grid gun"></div> ${b.guns[i].name}</div> ${b.guns[i].description}</div>`
|
||||
}
|
||||
|
||||
for (let i = 0, len = mod.mods.length; i < len; i++) {
|
||||
if (!mod.mods[i].isCustomHide) {
|
||||
if (!mod.mods[i].allowed()) { // || mod.mods[i].name === "+1 cardinality") { //|| mod.mods[i].name === "leveraged investment"
|
||||
text += `<div id="mod-${i}" class="build-grid-module build-grid-disabled"><div class="grid-title"><div class="circle-grid grey"></div> ${mod.mods[i].name}</div><span style="color:#666;">requires: ${mod.mods[i].requires}</span></div>`
|
||||
} else if (mod.mods[i].count > 1) {
|
||||
text += `<div id="mod-${i}" class="build-grid-module" onclick="build.choosePowerUp(this,${i},'mod')"><div class="grid-title"><div class="circle-grid mod"></div> ${mod.mods[i].name} (${mod.mods[i].count}x)</div> ${mod.mods[i].description}</div>`
|
||||
text += `<div id="mod-${i}" class="build-grid-module build-grid-disabled"><div class="grid-title">${mod.mods[i].name}</div><span style="color:#666;">requires: ${mod.mods[i].requires}</span></div>`
|
||||
// } else if (mod.mods[i].count > 1) {
|
||||
// text += `<div id="mod-${i}" class="build-grid-module" onclick="build.choosePowerUp(this,${i},'mod')"><div class="grid-title"><div class="circle-grid mod"></div> ${mod.mods[i].name} (${mod.mods[i].count}x)</div> ${mod.mods[i].description}</div>`
|
||||
} else {
|
||||
text += `<div id="mod-${i}" class="build-grid-module" onclick="build.choosePowerUp(this,${i},'mod')"><div class="grid-title"><div class="circle-grid mod"></div> ${mod.mods[i].name}</div> ${mod.mods[i].description}</div>`
|
||||
}
|
||||
@@ -409,7 +420,7 @@ const build = {
|
||||
document.getElementById("field-0").classList.add("build-field-selected");
|
||||
document.getElementById("build-grid").style.display = "grid"
|
||||
},
|
||||
shareURL() {
|
||||
shareURL(isCustom = false) {
|
||||
let url = "https://landgreen.github.io/sidescroller/index.html?"
|
||||
let count = 0;
|
||||
|
||||
@@ -429,11 +440,16 @@ const build = {
|
||||
}
|
||||
url += `&field=${encodeURIComponent(mech.fieldUpgrades[mech.fieldMode].name.trim())}`
|
||||
url += `&difficulty=${game.difficultyMode}`
|
||||
url += `&level=${Math.abs(Number(document.getElementById("starting-level").value))}`
|
||||
url += `&noPower=${Number(document.getElementById("no-power-ups").checked)}`
|
||||
if (isCustom) {
|
||||
url += `&level=${Math.abs(Number(document.getElementById("starting-level").value))}`
|
||||
url += `&noPower=${Number(document.getElementById("no-power-ups").checked)}`
|
||||
alert('n-gon build URL copied to clipboard.\nPaste into browser address bar.')
|
||||
} else {
|
||||
game.makeTextLog("n-gon build URL copied to clipboard.<br>Paste into browser address bar.", 300)
|
||||
}
|
||||
console.log('n-gon build URL copied to clipboard.\nPaste into browser address bar.')
|
||||
console.log(url)
|
||||
game.copyToClipBoard(url)
|
||||
alert('n-gon build URL copied to clipboard.\nPaste into browser address bar.')
|
||||
},
|
||||
startBuildRun() {
|
||||
build.isCustomSelection = false;
|
||||
@@ -497,40 +513,40 @@ document.getElementById("build-button").addEventListener("click", () => { //setu
|
||||
}
|
||||
}
|
||||
openCustomBuildMenu();
|
||||
if (!game.firstRun) { //if player has already died once load that previous build
|
||||
build.choosePowerUp(document.getElementById(`field-${field}`), field, 'field')
|
||||
for (let i = 0; i < inventory.length; i++) {
|
||||
build.choosePowerUp(document.getElementById(`gun-${inventory[i]}`), inventory[i], 'gun')
|
||||
}
|
||||
for (let i = 0; i < modList.length; i++) {
|
||||
for (let j = 0; j < modList[i]; j++) {
|
||||
build.choosePowerUp(document.getElementById(`mod-${i}`), i, 'mod', true)
|
||||
}
|
||||
}
|
||||
//update mod text //disable not allowed mods
|
||||
for (let i = 0, len = mod.mods.length; i < len; i++) {
|
||||
const modID = document.getElementById("mod-" + i)
|
||||
if (!mod.mods[i].isCustomHide) {
|
||||
if (mod.mods[i].allowed() || mod.mods[i].count > 0) {
|
||||
if (mod.mods[i].count > 1) {
|
||||
modID.innerHTML = `<div class="grid-title"><div class="circle-grid mod"></div> ${mod.mods[i].name} (${mod.mods[i].count}x)</div>${mod.mods[i].description}</div>`
|
||||
} else {
|
||||
modID.innerHTML = `<div class="grid-title"><div class="circle-grid mod"></div> ${mod.mods[i].name}</div>${mod.mods[i].description}</div>`
|
||||
}
|
||||
if (modID.classList.contains("build-grid-disabled")) {
|
||||
modID.classList.remove("build-grid-disabled");
|
||||
modID.setAttribute("onClick", `javascript: build.choosePowerUp(this,${i},'mod')`);
|
||||
}
|
||||
} else {
|
||||
modID.innerHTML = `<div class="grid-title"><div class="circle-grid grey"></div> ${mod.mods[i].name}</div><span style="color:#666;">requires: ${mod.mods[i].requires}</span></div>`
|
||||
if (!modID.classList.contains("build-grid-disabled")) {
|
||||
modID.classList.add("build-grid-disabled");
|
||||
modID.onclick = null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// if (!game.firstRun) { //if player has already died once load that previous build
|
||||
// build.choosePowerUp(document.getElementById(`field-${field}`), field, 'field')
|
||||
// for (let i = 0; i < inventory.length; i++) {
|
||||
// build.choosePowerUp(document.getElementById(`gun-${inventory[i]}`), inventory[i], 'gun')
|
||||
// }
|
||||
// for (let i = 0; i < modList.length; i++) {
|
||||
// for (let j = 0; j < modList[i]; j++) {
|
||||
// build.choosePowerUp(document.getElementById(`mod-${i}`), i, 'mod', true)
|
||||
// }
|
||||
// }
|
||||
// //update mod text //disable not allowed mods
|
||||
// for (let i = 0, len = mod.mods.length; i < len; i++) {
|
||||
// const modID = document.getElementById("mod-" + i)
|
||||
// if (!mod.mods[i].isCustomHide) {
|
||||
// if (mod.mods[i].allowed() || mod.mods[i].count > 0) {
|
||||
// if (mod.mods[i].count > 1) {
|
||||
// modID.innerHTML = `<div class="grid-title"><div class="circle-grid mod"></div> ${mod.mods[i].name} (${mod.mods[i].count}x)</div>${mod.mods[i].description}</div>`
|
||||
// } else {
|
||||
// modID.innerHTML = `<div class="grid-title"><div class="circle-grid mod"></div> ${mod.mods[i].name}</div>${mod.mods[i].description}</div>`
|
||||
// }
|
||||
// if (modID.classList.contains("build-grid-disabled")) {
|
||||
// modID.classList.remove("build-grid-disabled");
|
||||
// modID.setAttribute("onClick", `javascript: build.choosePowerUp(this,${i},'mod')`);
|
||||
// }
|
||||
// } else {
|
||||
// modID.innerHTML = `<div class="grid-title">${mod.mods[i].name}</div><span style="color:#666;">requires: ${mod.mods[i].requires}</span></div>`
|
||||
// if (!modID.classList.contains("build-grid-disabled")) {
|
||||
// modID.classList.add("build-grid-disabled");
|
||||
// modID.onclick = null
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
});
|
||||
|
||||
// ************************************************************************************************
|
||||
|
||||
@@ -19,7 +19,8 @@ const level = {
|
||||
// mech.setField("plasma torch")
|
||||
// b.giveGuns("wave beam")
|
||||
// mod.giveMod("micro-extruder")
|
||||
// for (let i = 0; i < 15; i++) mod.giveMod("supply chain")
|
||||
// mod.giveMod("piezoelectricity")
|
||||
// for (let i = 0; i < 15; i++) mod.giveMod("plasma jet")
|
||||
|
||||
|
||||
|
||||
@@ -59,14 +60,16 @@ const level = {
|
||||
b.respawnBots();
|
||||
mech.resetHistory();
|
||||
if (mod.isArmorFromPowerUps) {
|
||||
mod.armorFromPowerUps += 0.05 * powerUps.totalPowerUps
|
||||
const gain = Math.min(0.04 * powerUps.totalPowerUps, 0.44)
|
||||
mod.armorFromPowerUps += gain
|
||||
mech.setMaxHealth();
|
||||
if (powerUps.totalPowerUps) game.makeTextLog("<span style='font-size:115%;'> max health increased by " + (0.05 * powerUps.totalPowerUps * 100).toFixed(0) + "%</span>", 300)
|
||||
if (powerUps.totalPowerUps) game.makeTextLog("<span style='font-size:115%;'> max health increased by " + (gain * 100).toFixed(0) + "%</span>", 300)
|
||||
}
|
||||
if (mod.isHealLowHealth) {
|
||||
const len = Math.floor((mech.maxHealth - mech.health) / 0.5)
|
||||
for (let i = 0; i < len; i++) {
|
||||
powerUps.spawn(mech.pos.x + 60 * (Math.random() - 0.5), mech.pos.y + 60 * (Math.random() - 0.5), "heal", false);
|
||||
// powerUps.heal.spawn(mech.pos.x + 60 * (Math.random() - 0.5), mech.pos.y + 60 * (Math.random() - 0.5), 50);
|
||||
}
|
||||
}
|
||||
if (mod.isPerpetualReroll) powerUps.spawn(mech.pos.x + 60 * (Math.random() - 0.5), mech.pos.y + 60 * (Math.random() - 0.5), "reroll", false);
|
||||
|
||||
59
js/mods.js
59
js/mods.js
@@ -110,8 +110,8 @@ const mod = {
|
||||
if (mod.isDamageFromBulletCount) dmg *= 1 + bullet.length * 0.0038
|
||||
if (mod.isRerollDamage) dmg *= 1 + 0.04 * powerUps.reroll.rerolls
|
||||
if (mod.isOneGun && b.inventory.length < 2) dmg *= 1.25
|
||||
if (mod.isNoFireDamage && mech.cycle > mech.fireCDcycle + 120) dmg *= 1.5
|
||||
if (mod.isSpeedDamage) dmg *= 1 + Math.min(0.33, player.speed * 0.011)
|
||||
if (mod.isNoFireDamage && mech.cycle > mech.fireCDcycle + 120) dmg *= 1.66
|
||||
if (mod.isSpeedDamage) dmg *= 1 + Math.min(0.4, player.speed * 0.013)
|
||||
if (mod.isBotDamage) dmg *= 1 + 0.02 * mod.totalBots()
|
||||
return dmg * mod.slowFire * mod.aimDamage
|
||||
},
|
||||
@@ -485,7 +485,7 @@ const mod = {
|
||||
},
|
||||
{
|
||||
name: "reaction inhibitor",
|
||||
description: "mobs spawn with <strong>12%</strong> less <strong>health</strong>",
|
||||
description: "mobs spawn with <strong>11%</strong> less <strong>health</strong>",
|
||||
maxCount: 3,
|
||||
count: 0,
|
||||
allowed() {
|
||||
@@ -493,7 +493,7 @@ const mod = {
|
||||
},
|
||||
requires: "any mob death mod",
|
||||
effect: () => {
|
||||
mod.mobSpawnWithHealth *= 0.88
|
||||
mod.mobSpawnWithHealth *= 0.89
|
||||
|
||||
//set all mobs at full health to 0.85
|
||||
for (let i = 0; i < mob.length; i++) {
|
||||
@@ -973,7 +973,7 @@ const mod = {
|
||||
},
|
||||
{
|
||||
name: "anticorrelation",
|
||||
description: "increase <strong class='color-d'>damage</strong> by <strong>50%</strong><br>after not using your <strong class='color-g'>gun</strong> or <strong class='color-f'>field</strong> for <strong>2</strong> seconds",
|
||||
description: "increase <strong class='color-d'>damage</strong> by <strong>66%</strong><br>after not using your <strong class='color-g'>gun</strong> or <strong class='color-f'>field</strong> for <strong>2</strong> seconds",
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
allowed() {
|
||||
@@ -989,7 +989,7 @@ const mod = {
|
||||
},
|
||||
{
|
||||
name: "non-Newtonian armor",
|
||||
description: "for <strong>10 seconds</strong> after receiving <strong class='color-harm'>harm</strong><br>reduce <strong class='color-harm'>harm</strong> by <strong>50%</strong>",
|
||||
description: "for <strong>10 seconds</strong> after receiving <strong class='color-harm'>harm</strong><br>reduce <strong class='color-harm'>harm</strong> by <strong>66%</strong>",
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
allowed() {
|
||||
@@ -1021,7 +1021,7 @@ const mod = {
|
||||
},
|
||||
{
|
||||
name: "liquid cooling",
|
||||
description: `<strong class='color-s'>freeze</strong> all mobs for <strong>4</strong> seconds<br>after receiving <strong class='color-harm'>harm</strong>`,
|
||||
description: `<strong class='color-s'>freeze</strong> all mobs for <strong>5</strong> seconds<br>after receiving <strong class='color-harm'>harm</strong>`,
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
allowed() {
|
||||
@@ -1118,7 +1118,7 @@ const mod = {
|
||||
},
|
||||
{
|
||||
name: "piezoelectricity",
|
||||
description: "<strong>colliding</strong> with mobs overfills <strong class='color-f'>energy</strong> by <strong>200</strong><br>reduce <strong class='color-harm'>harm</strong> by <strong>15%</strong>",
|
||||
description: "<strong>colliding</strong> with mobs gives you <strong>400</strong> <strong class='color-f'>energy</strong><br>reduce <strong class='color-harm'>harm</strong> by <strong>15%</strong>",
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
allowed() {
|
||||
@@ -1127,7 +1127,7 @@ const mod = {
|
||||
requires: "not mass-energy equivalence",
|
||||
effect() {
|
||||
mod.isPiezo = true;
|
||||
mech.energy += 2;
|
||||
mech.energy += 4;
|
||||
},
|
||||
remove() {
|
||||
mod.isPiezo = false;
|
||||
@@ -1135,7 +1135,7 @@ const mod = {
|
||||
},
|
||||
{
|
||||
name: "ground state",
|
||||
description: "reduce <strong class='color-harm'>harm</strong> by <strong>60%</strong><br>you <strong>no longer</strong> passively regenerate <strong class='color-f'>energy</strong>",
|
||||
description: "reduce <strong class='color-harm'>harm</strong> by <strong>66%</strong><br>you <strong>no longer</strong> passively regenerate <strong class='color-f'>energy</strong>",
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
allowed() {
|
||||
@@ -1159,7 +1159,7 @@ const mod = {
|
||||
allowed() {
|
||||
return !mod.isEnergyLoss && !mod.isPiezo && !mod.isRewindAvoidDeath && !mod.isSpeedHarm && mech.fieldUpgrades[mech.fieldMode].name !== "negative mass field"
|
||||
},
|
||||
requires: "not exothermic process, piezoelectricity, CPT, 1st law, negative mass field",
|
||||
requires: "not exothermic process, piezoelectricity, CPT, 1st law, negative mass",
|
||||
effect: () => {
|
||||
mech.health = 0
|
||||
// mech.displayHealth();
|
||||
@@ -1309,8 +1309,8 @@ const mod = {
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "crystallized armor",
|
||||
description: "increase <strong>maximum</strong> <strong class='color-h'>health</strong> by <strong>5</strong> for each<br>unused <strong>power up</strong> at the end of a <strong>level</strong>",
|
||||
name: "inductive coupling",
|
||||
description: "for each unused <strong>power up</strong> at the end of a <strong>level</strong><br>add 4 <strong>max</strong> <strong class='color-h'>health</strong> <em>(up to 44 health per level)</em>",
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
allowed() {
|
||||
@@ -1326,6 +1326,22 @@ const mod = {
|
||||
mech.setMaxHealth();
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "transceiver chip",
|
||||
description: "at the end of each <strong>level</strong><br>gain the full <strong>effect</strong> of unused <strong>power ups</strong>",
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
allowed() {
|
||||
return mod.isArmorFromPowerUps
|
||||
},
|
||||
requires: "crystallized armor",
|
||||
effect() {
|
||||
mod.isEndLevelPowerUp = true;
|
||||
},
|
||||
remove() {
|
||||
mod.isEndLevelPowerUp = false;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "negentropy",
|
||||
description: `at the start of each <strong>level</strong><br>spawn a <strong class='color-h'>heal</strong> for every <strong>50</strong> missing health`,
|
||||
@@ -1649,7 +1665,7 @@ const mod = {
|
||||
},
|
||||
{
|
||||
name: "catabolism",
|
||||
description: "gain <strong class='color-g'>ammo</strong> when you <strong>fire</strong> while <strong>out</strong> of <strong class='color-g'>ammo</strong><br>drains <strong>2%</strong> of <strong>max health</strong>",
|
||||
description: "when you <strong>fire</strong> while <strong>out</strong> of <strong class='color-g'>ammo</strong><br>gain <strong>3</strong> <strong class='color-g'>ammo</strong>, but lose <strong>5</strong> <strong>health</strong>",
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
allowed() {
|
||||
@@ -1657,10 +1673,10 @@ const mod = {
|
||||
},
|
||||
requires: "not mass-energy equivalence<br>not exciton-lattice",
|
||||
effect: () => {
|
||||
mod.isAmmoFromHealth = 0.02;
|
||||
mod.isAmmoFromHealth = true;
|
||||
},
|
||||
remove() {
|
||||
mod.isAmmoFromHealth = 0;
|
||||
mod.isAmmoFromHealth = false;
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -2733,7 +2749,7 @@ const mod = {
|
||||
},
|
||||
{
|
||||
name: "thermoelectric effect",
|
||||
description: "<strong>killing</strong> mobs with <strong>ice IX</strong> gives <strong>4</strong> <strong class='color-h'>health</strong><br>and overloads <strong class='color-f'>energy</strong> by <strong>100</strong>",
|
||||
description: "<strong>killing</strong> mobs with <strong>ice IX</strong> gives <strong>4</strong> <strong class='color-h'>health</strong><br>and <strong>100</strong> <strong class='color-f'>energy</strong>",
|
||||
isGunMod: true,
|
||||
maxCount: 9,
|
||||
count: 0,
|
||||
@@ -2818,7 +2834,7 @@ const mod = {
|
||||
// },
|
||||
{
|
||||
name: "half-wave rectifier",
|
||||
description: "charging the <strong>rail gun</strong> overfills your <strong class='color-f'>energy</strong><br><em>instead of draining it</em>",
|
||||
description: "charging the <strong>rail gun</strong> gives you <strong class='color-f'>energy</strong><br><em>instead of draining it</em>",
|
||||
isGunMod: true,
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
@@ -3155,7 +3171,7 @@ const mod = {
|
||||
},
|
||||
{
|
||||
name: "pair production",
|
||||
description: "<strong>power ups</strong> overfill your <strong class='color-f'>energy</strong> by <strong>300</strong>",
|
||||
description: "picking up a <strong>power up</strong> gives you <strong>250</strong> <strong class='color-f'>energy</strong>",
|
||||
isFieldMod: true,
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
@@ -3539,7 +3555,7 @@ const mod = {
|
||||
},
|
||||
{
|
||||
name: "Penrose process",
|
||||
description: "after a <strong>block</strong> falls into a <strong class='color-worm'>wormhole</strong><br>your <strong class='color-f'>energy</strong> overfills by <strong>50</strong>",
|
||||
description: "after a <strong>block</strong> falls into a <strong class='color-worm'>wormhole</strong><br>you gain <strong>50</strong> <strong class='color-f'>energy</strong>",
|
||||
isFieldMod: true,
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
@@ -3857,5 +3873,6 @@ const mod = {
|
||||
isLowEnergyDamage: null,
|
||||
isRewindBot: null,
|
||||
isRewindGrenade: null,
|
||||
isExtruder: null
|
||||
isExtruder: null,
|
||||
isEndLevelPowerUp: null
|
||||
}
|
||||
40
js/player.js
40
js/player.js
@@ -353,31 +353,9 @@ const mech = {
|
||||
game.makeGunHUD(); //update gun HUD
|
||||
}
|
||||
|
||||
|
||||
function pixelWindows() {
|
||||
|
||||
//pixel graphics
|
||||
let imgData = ctx.getImageData(0, 0, canvas.width, canvas.height); //copy current canvas pixel data
|
||||
let data = imgData.data;
|
||||
//change random pixels
|
||||
//strange draw offset
|
||||
// const off = canvas.height * canvas.width * 4 / 16
|
||||
for (let i = 0; i < data.length; i += 4) {
|
||||
index = i % canvas.width
|
||||
data[index + 0] = data[index + 0]; // red
|
||||
data[index + 1] = data[index + 1]; // red
|
||||
data[index + 2] = data[index + 2]; // red
|
||||
data[index + 3] = data[index + 3]; // red
|
||||
}
|
||||
ctx.putImageData(imgData, 0, 0); //draw new pixel data to canvas
|
||||
|
||||
}
|
||||
|
||||
|
||||
game.wipe = function() { //set wipe to have trails
|
||||
ctx.fillStyle = "rgba(255,255,255,0)";
|
||||
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||
// pixelWindows()
|
||||
}
|
||||
|
||||
function randomizeEverything() {
|
||||
@@ -423,6 +401,7 @@ const mech = {
|
||||
mech.displayHealth();
|
||||
document.getElementById("text-log").style.opacity = 0; //fade out any active text logs
|
||||
document.getElementById("fade-out").style.opacity = 1; //slowly fades out
|
||||
// build.shareURL(false)
|
||||
setTimeout(function() {
|
||||
World.clear(engine.world);
|
||||
Engine.clear(engine);
|
||||
@@ -475,14 +454,14 @@ const mech = {
|
||||
harmReduction() {
|
||||
let dmg = 1
|
||||
dmg *= mech.fieldHarmReduction
|
||||
if (mod.isSpeedHarm) dmg *= 1 - Math.min(player.speed * 0.018, 0.5)
|
||||
if (mod.isSpeedHarm) dmg *= 1 - Math.min(player.speed * 0.0185, 0.55)
|
||||
if (mod.isSlowFPS) dmg *= 0.85
|
||||
if (mod.isPiezo) dmg *= 0.85
|
||||
if (mod.isHarmReduce && mech.fieldUpgrades[mech.fieldMode].name === "negative mass field" && mech.isFieldActive) dmg *= 0.6
|
||||
if (mod.isBotArmor) dmg *= 0.97 ** mod.totalBots()
|
||||
if (mod.isHarmArmor && mech.lastHarmCycle + 600 > mech.cycle) dmg *= 0.5;
|
||||
if (mod.isHarmArmor && mech.lastHarmCycle + 600 > mech.cycle) dmg *= 0.33;
|
||||
if (mod.isNoFireDefense && mech.cycle > mech.fireCDcycle + 120) dmg *= 0.6
|
||||
if (mod.energyRegen === 0) dmg *= 0.4 //0.22 + 0.78 * mech.energy //77% damage reduction at zero energy
|
||||
if (mod.energyRegen === 0) dmg *= 0.33 //0.22 + 0.78 * mech.energy //77% damage reduction at zero energy
|
||||
if (mod.isTurret && mech.crouch) dmg *= 0.5;
|
||||
if (mod.isEntanglement && b.inventory[0] === b.activeGun) {
|
||||
for (let i = 0, len = b.inventory.length; i < len; i++) dmg *= 0.87 // 1 - 0.15
|
||||
@@ -675,7 +654,7 @@ const mech = {
|
||||
mech.defaultFPSCycle = mech.cycle + 20 + Math.min(90, Math.floor(200 * dmg))
|
||||
if (mod.isHarmFreeze) { //freeze all mobs
|
||||
for (let i = 0, len = mob.length; i < len; i++) {
|
||||
mobs.statusSlow(mob[i], 240)
|
||||
mobs.statusSlow(mob[i], 300)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -1641,7 +1620,7 @@ const mech = {
|
||||
effect() {
|
||||
mech.fieldMeterColor = "#f0f"
|
||||
mech.hold = function() {
|
||||
mech.isExtruderOn = false
|
||||
b.isExtruderOn = false
|
||||
if (mech.isHolding) {
|
||||
mech.drawHold(mech.holdingTarget);
|
||||
mech.holding();
|
||||
@@ -1663,9 +1642,10 @@ const mech = {
|
||||
|
||||
if (mod.isExtruder) {
|
||||
if (input.field) {
|
||||
mech.wasExtruderOn = true
|
||||
b.wasExtruderOn = true
|
||||
} else {
|
||||
mech.wasExtruderOn = false
|
||||
b.wasExtruderOn = false
|
||||
b.canExtruderFire = true
|
||||
}
|
||||
ctx.lineWidth = 5;
|
||||
ctx.strokeStyle = "#f07"
|
||||
@@ -1680,7 +1660,7 @@ const mech = {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mech.wasExtruderOn && mech.isExtruderOn) ctx.lineTo(mech.pos.x + 15 * Math.cos(mech.angle), mech.pos.y + 15 * Math.sin(mech.angle))
|
||||
if (b.wasExtruderOn && b.isExtruderOn) ctx.lineTo(mech.pos.x + 15 * Math.cos(mech.angle), mech.pos.y + 15 * Math.sin(mech.angle))
|
||||
ctx.stroke();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,8 +170,12 @@ const powerUps = {
|
||||
mech.setMaxEnergy();
|
||||
}
|
||||
},
|
||||
spawn() { //used to spawn a heal with a specific size / heal amount, not normally used
|
||||
|
||||
spawn(x, y, size) { //used to spawn a heal with a specific size / heal amount, not normally used
|
||||
powerUps.directSpawn(x, y, "heal", false, null, size)
|
||||
if (Math.random() < mod.duplicationChance()) {
|
||||
powerUps.directSpawn(x, y, "heal", false, null, size)
|
||||
powerUp[powerUp.length - 1].isBonus = true
|
||||
}
|
||||
}
|
||||
},
|
||||
ammo: {
|
||||
@@ -318,15 +322,15 @@ const powerUps = {
|
||||
if (mod.mods[choose].isFieldMod) {
|
||||
text += `<div class="choose-grid-module" onclick="powerUps.choose('mod',${choose})"><div class="grid-title">
|
||||
<span style="position:relative;">
|
||||
<div class="circle-grid field" style="position:absolute; top:0; left:10px;opacity:1;"></div>
|
||||
<div class="circle-grid mod" style="position:absolute; top:0; left:0;opacity:0.75;"></div>
|
||||
<div class="circle-grid mod" style="position:absolute; top:0; left:0;opacity:0.8;"></div>
|
||||
<div class="circle-grid field" style="position:absolute; top:0; left:10px;opacity:0.65;"></div>
|
||||
</span>
|
||||
${mod.mods[choose].name} ${isCount}</div>${mod.mods[choose].description}</div></div>`
|
||||
} else if (mod.mods[choose].isGunMod) {
|
||||
text += `<div class="choose-grid-module" onclick="powerUps.choose('mod',${choose})"><div class="grid-title">
|
||||
<span style="position:relative;">
|
||||
<div class="circle-grid gun" style="position:absolute; top:0; left:10px; opacity:0.75;"></div>
|
||||
<div class="circle-grid mod" style="position:absolute; top:0; left:0;opacity:0.75;"></div>
|
||||
<div class="circle-grid mod" style="position:absolute; top:0; left:0;opacity:0.8;"></div>
|
||||
<div class="circle-grid gun" style="position:absolute; top:0; left:10px; opacity:0.65;"></div>
|
||||
</span>
|
||||
${mod.mods[choose].name} ${isCount}</div>${mod.mods[choose].description}</div></div>`
|
||||
} else {
|
||||
@@ -455,7 +459,7 @@ const powerUps = {
|
||||
}
|
||||
},
|
||||
onPickUp(where) {
|
||||
if (mod.isMassEnergy && mech.energy < mech.maxEnergy * 2.5) mech.energy += 3;
|
||||
if (mod.isMassEnergy) mech.energy += 2.5;
|
||||
if (mod.isMineDrop) b.mine({
|
||||
x: where.x,
|
||||
y: where.y
|
||||
@@ -656,7 +660,7 @@ const powerUps = {
|
||||
) {
|
||||
powerUps.directSpawn(x, y, target, moving, mode, size)
|
||||
if (Math.random() < mod.duplicationChance()) {
|
||||
powerUps.directSpawn(x, y, target, moving, mode)
|
||||
powerUps.directSpawn(x, y, target, moving, mode, size)
|
||||
powerUp[powerUp.length - 1].isBonus = true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -930,6 +930,7 @@ const spawn = {
|
||||
let targets = [] //track who is in the node boss, for shields
|
||||
mobs.spawn(x, y, 6, radius, "#b386e8");
|
||||
let me = mob[mob.length - 1];
|
||||
Matter.Body.setDensity(me, 0.002); //extra dense //normal is 0.001 //makes effective life much larger
|
||||
me.isBoss = true;
|
||||
targets.push(me.id) //add to shield protection
|
||||
me.friction = 0;
|
||||
@@ -991,6 +992,7 @@ const spawn = {
|
||||
|
||||
for (let i = 0; i < nodes; ++i) {
|
||||
spawn.stabber(x + sideLength * Math.sin(i * angle), y + sideLength * Math.cos(i * angle), radius, 12);
|
||||
Matter.Body.setDensity(mob[mob.length - 1], 0.002); //extra dense //normal is 0.001 //makes effective life much larger
|
||||
targets.push(mob[mob.length - 1].id) //track who is in the node boss, for shields
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user