green health bar

community map clock by Cornbread 2100

health bar is now green
added a damage bar
  (I'll probably add a setting to disable this next patch)

wave gun has -15% ammo
tech phonon has +25% ammo, and +10% damage

JUNK tech stubs can now wall climb
This commit is contained in:
landgreen
2023-03-12 17:23:51 -07:00
parent eecf763d82
commit be109bbb91
9 changed files with 1525 additions and 126 deletions

View File

@@ -6366,8 +6366,8 @@ const b = {
name: "wave", //3
description: "emit a <strong>wave packet</strong> of oscillating particles<br>that propagates through <strong>solids</strong>",
ammo: 0,
ammoPack: 135,
defaultAmmoPack: 135,
ammoPack: 115,
defaultAmmoPack: 115,
have: false,
wavePacketCycle: 0,
delay: 40,
@@ -6396,7 +6396,7 @@ const b = {
ctx.lineWidth = 2 * tech.wavePacketDamage
ctx.beginPath();
const end = 700 * Math.sqrt(tech.isBulletsLastLonger) * Math.pow(0.93, tech.waveReflections) // / Math.sqrt(tech.waveReflections * 0.5) //should equal about 1060
const damage = 2.1 * m.dmgScale * tech.wavePacketDamage * tech.waveBeamDamage * (tech.isBulletTeleport ? 1.43 : 1) * (tech.isInfiniteWaveAmmo ? 0.75 : 1) //damage is lower for large radius mobs, since they feel the waves longer
const damage = 2.3 * m.dmgScale * tech.wavePacketDamage * tech.waveBeamDamage * (tech.isBulletTeleport ? 1.43 : 1) * (tech.isInfiniteWaveAmmo ? 0.75 : 1) //damage is lower for large radius mobs, since they feel the waves longer
for (let i = this.waves.length - 1; i > -1; i--) {
//draw wave
@@ -6507,7 +6507,7 @@ const b = {
ctx.beginPath();
// const end = 1100 * tech.isBulletsLastLonger / Math.sqrt(tech.waveReflections * 0.5) //should equal about 1767
const end = 1100 * tech.isBulletsLastLonger * Math.pow(0.93, tech.waveReflections) //should equal about 1767
const damage = 2.1 * m.dmgScale * tech.wavePacketDamage * tech.waveBeamDamage * (tech.isBulletTeleport ? 1.4 : 1) * (tech.isInfiniteWaveAmmo ? 0.75 : 1) //damage is lower for large radius mobs, since they feel the waves longer
const damage = 2.3 * m.dmgScale * tech.wavePacketDamage * tech.waveBeamDamage * (tech.isBulletTeleport ? 1.4 : 1) * (tech.isInfiniteWaveAmmo ? 0.75 : 1) //damage is lower for large radius mobs, since they feel the waves longer
for (let i = this.waves.length - 1; i > -1; i--) {
const v1 = Vector.add(this.waves[i].position, Vector.mult(this.waves[i].unit1, this.waves[i].radius))
const v2 = Vector.add(this.waves[i].position, Vector.mult(this.waves[i].unit2, this.waves[i].radius))
@@ -6690,7 +6690,7 @@ const b = {
if (this.dmgCoolDown < 1) {
q = Matter.Query.point(mob, this.position) // check if inside a mob
for (let i = 0; i < q.length; i++) {
this.dmgCoolDown = 5 + Math.floor(7 * Math.random() * b.fireCDscale);
this.dmgCoolDown = 5 + Math.floor(8 * Math.random() * b.fireCDscale);
let dmg = this.dmg
q[i].damage(dmg);
if (q[i].alive) {

View File

@@ -444,7 +444,9 @@ ${simulation.isCheating ? "<br><br><em>lore disabled</em>": ""}
document.getElementById("field").style.display = "none"
document.getElementById("health").style.display = "none"
document.getElementById("health-bg").style.display = "none"
document.getElementById("defense").style.display = "none"
document.getElementById("defense-bar").style.display = "none"
document.getElementById("damage-bar").style.display = "none"
//show in game console
// document.getElementById("text-log").style.display = "inline"
@@ -462,7 +464,8 @@ ${simulation.isCheating ? "<br><br><em>lore disabled</em>": ""}
document.getElementById("health").style.display = "inline"
document.getElementById("health-bg").style.display = "inline"
}
document.getElementById("defense").style.display = "inline"
document.getElementById("defense-bar").style.display = "inline"
document.getElementById("damage-bar").style.display = "inline"
// document.body.style.overflow = "hidden"
document.getElementById("pause-grid-left").style.display = "none"
document.getElementById("pause-grid-right").style.display = "none"

File diff suppressed because it is too large Load Diff

View File

@@ -455,7 +455,8 @@ const m = {
m.alive = false;
simulation.paused = true;
m.health = 0;
document.getElementById("defense").style.display = "none"; //hide defense
document.getElementById("defense-bar").style.display = "none"; //hide defense
document.getElementById("damage-bar").style.display = "none"
m.displayHealth();
document.getElementById("text-log").style.display = "none"
document.getElementById("fade-out").style.opacity = 0.9; //slowly fade to 90% white on top of canvas
@@ -511,11 +512,11 @@ const m = {
// health display is a x^1.5 rule to make it seem like the player has lower health, this makes the player feel more excitement
id.style.width = Math.floor(300 * m.maxHealth * Math.pow(m.health / m.maxHealth, 1.4)) + "px";
//css animation blink if health is low
if (m.health < 0.3) {
id.classList.add("low-health");
} else {
id.classList.remove("low-health");
}
// if (m.health < 0.3) {
// id.classList.add("low-health");
// } else {
// id.classList.remove("low-health");
// }
},
addHealth(heal) {
if (!tech.isEnergyHealth) {
@@ -535,6 +536,7 @@ const m = {
defaultFPSCycle: 0, //tracks when to return to normal fps
immuneCycle: 0, //used in engine
lastCalculatedDamage: 0, //used to decided if damage bar needs to be redrawn (in simulation.checks)
lastCalculatedDefense: 0, //used to decided if defense bar needs to be redrawn (in simulation.checks)
defense() {
let dmg = 1
@@ -3921,41 +3923,16 @@ const m = {
}
}
this.drawRegenEnergyCloaking()
//show sneak attack status
//show sneak attack status
// if (m.cycle > m.lastKillCycle + 240) {
// if (m.sneakAttackCharge > 0) {
if (m.sneakAttackCycle + Math.min(120, 0.7 * (m.cycle - m.enterCloakCycle)) > m.cycle) {
// ctx.strokeStyle = "rgba(0,0,0,0.2)"
// ctx.lineWidth = 1
// ctx.fillStyle = "rgba(0,0,0,0.02)"
// for (let i = 0; i < 4; i++) {
// ctx.beginPath();
// ctx.ellipse(m.pos.x, m.pos.y, 50, 30, 0.2 * m.cycle + i * Math.PI / 4, 0, 2 * Math.PI);
// ctx.stroke()
// // ctx.fill();
// }
ctx.strokeStyle = "rgba(0,0,0,0.5)" //m.fieldMeterColor; //"rgba(255,255,0,0.2)" //ctx.strokeStyle = `rgba(0,0,255,${0.5+0.5*Math.random()})`
ctx.beginPath();
ctx.arc(simulation.mouseInGame.x, simulation.mouseInGame.y, 16, 0, 2 * Math.PI);
// ctx.lineWidth = 3
ctx.fillStyle = "rgba(0,0,0,0.2)"
ctx.fill();
// const unit = Vector.add(m.pos, Vector.rotate({ x: 45, y: 0 }, 2 * Math.PI * Math.random()))
// simulation.drawList.push({ //add dmg to draw queue
// x: unit.x,
// y: unit.y,
// radius: 4 + 10 * Math.random(),
// color: 'rgba(0, 0, 0, 0.1)',
// time: 15
// });
}
// if (m.sneakAttackCycle + Math.min(120, 0.7 * (m.cycle - m.enterCloakCycle)) > m.cycle) {
// ctx.strokeStyle = "rgba(0,0,0,0.5)" //m.fieldMeterColor; //"rgba(255,255,0,0.2)" //ctx.strokeStyle = `rgba(0,0,255,${0.5+0.5*Math.random()})`
// ctx.beginPath();
// ctx.arc(simulation.mouseInGame.x, simulation.mouseInGame.y, 16, 0, 2 * Math.PI);
// ctx.fillStyle = "rgba(0,0,0,0.2)"
// ctx.fill();
// }
}
}
},

View File

@@ -679,7 +679,8 @@ const simulation = {
document.getElementById("splash").style.opacity = "0";
document.getElementById("dmg").style.display = "none";
document.getElementById("health-bg").style.display = "none";
document.getElementById("defense").style.display = "none"
document.getElementById("defense-bar").style.display = "none"
document.getElementById("damage-bar").style.display = "none"
document.body.style.cursor = "auto";
setTimeout(() => {
document.getElementById("experiment-button").style.opacity = "1";
@@ -716,7 +717,8 @@ const simulation = {
document.getElementById("dmg").style.display = "inline";
document.getElementById("health").style.display = "inline"
document.getElementById("health-bg").style.display = "inline";
document.getElementById("defense").style.display = "inline"
document.getElementById("defense-bar").style.display = "inline"
document.getElementById("damage-bar").style.display = "inline"
document.getElementById("tech").style.display = "inline"
document.getElementById("guns").style.display = "inline"
@@ -1138,28 +1140,28 @@ const simulation = {
//update defense bar
const defense = m.defense()
if (m.lastCalculatedDefense !== defense) {
document.getElementById("defense").style.width = Math.floor(300 * m.maxHealth * (1 - defense)) + "px";
document.getElementById("defense-bar").style.width = Math.floor(300 * m.maxHealth * (1 - defense)) + "px";
// if (m.lastCalculatedDefense === 1) document.getElementById("defense").style.display = "inline"
// if (defense === 1) document.getElementById("defense").style.display = "none"
// if (m.lastCalculatedDefense === 1) document.getElementById("defense-bar").style.display = "inline"
// if (defense === 1) document.getElementById("defense-bar").style.display = "none"
// Math.pow(m.defense(), 0.13)
m.lastCalculatedDefense = defense
// console.log(defense)
}
// const defense = m.defense()
// if (m.lastCalculatedDefense !== defense) {
// if (m.lastCalculatedDefense === 1) {
// document.getElementById("defense").style.display = "inline"
// requestAnimationFrame(() => { document.getElementById("defense").style.width = Math.floor(300 * m.maxHealth * (1 - defense)) + "px"; })
// } else if (defense === 1) {
// document.getElementById("defense").style.display = "none"
// document.getElementById("defense").style.width = "0px";
// } else {
// document.getElementById("defense").style.width = Math.floor(300 * m.maxHealth * (1 - defense)) + "px";
// }
// m.lastCalculatedDefense = defense
// console.log(defense)
// }
//update damage bar
const damage = tech.damageFromTech()
if (m.lastCalculatedDamage !== damage) {
canvas.width
// document.getElementById("damage-bar").style.width = Math.floor(Math.atan(damage - 1) / 6.28 * canvas.width) + "px";
document.getElementById("damage-bar").style.height = Math.floor(Math.atan(damage - 1) / 3.14 * canvas.height) + "px";
m.lastCalculatedDamage = damage
console.log(damage)
}
}
if (!(m.cycle % 60)) { //once a second
//energy overfill

View File

@@ -976,7 +976,8 @@ const spawn = {
// m.displayHealth();
document.getElementById("health").style.display = "none"
document.getElementById("health-bg").style.display = "none"
document.getElementById("defense").style.display = "none"
document.getElementById("defense-bar").style.display = "none"
document.getElementById("damage-bar").style.display = "none"
document.getElementById("text-log").style.display = "none"
document.getElementById("fade-out").style.opacity = 1; //slowly fades out
// build.shareURL(false)
@@ -5733,7 +5734,7 @@ const spawn = {
y: this.position.y,
radius: 3000,
color: `rgba(0, 0, 0,${1-0.1*i})`,
time: (i + 1) * 3
time: (i + 2) * 4
});
}
//teleport to near the end of player history

View File

@@ -945,7 +945,7 @@ const tech = {
},
{
name: "kinetic bombardment",
description: "<strong class='color-d'>damage</strong> is proportional to mob <strong>distance</strong><br>up to <strong>+33%</strong> <strong class='color-d'>damage</strong> at <strong>3000</strong> displacement",
description: "far away mobs take more <strong class='color-d'>damage</strong><br>up to <strong>+33%</strong> <strong class='color-d'>damage</strong> at <strong>3000</strong> displacement",
maxCount: 1,
count: 0,
frequency: 1,
@@ -4510,7 +4510,7 @@ const tech = {
{
name: "irradiated nails",
link: `<a target="_blank" href='https://en.wikipedia.org/wiki/Irradiation' class="link">irradiated nails</a>`,
description: "<strong>nails</strong>, <strong>needles</strong>, and <strong>rivets</strong> are <strong class='color-p'>radioactive</strong><br>about <strong>+90%</strong> <strong class='color-d'>damage</strong> over <strong>3</strong> seconds",
description: "<strong>nails</strong>, <strong>needles</strong>, and <strong>rivets</strong> are <strong class='color-p'>radioactive</strong><br><strong>+90%</strong> <strong class='color-p'>radioactive</strong> <strong class='color-d'>damage</strong> over <strong>3</strong> seconds",
isGunTech: true,
maxCount: 1,
count: 0,
@@ -5023,11 +5023,11 @@ const tech = {
requires: "wave",
effect() {
tech.waveBeamSpeed *= 0.75;
tech.waveBeamDamage += 0.36 * 0.41 //this sets base wave damage
tech.waveBeamDamage += 0.27 * 0.41 //this sets base wave damage
},
remove() {
tech.waveBeamSpeed = 11;
tech.waveBeamDamage = 0.36 //this sets base wave damage
tech.waveBeamDamage = 0.27 //this sets base wave damage
}
},
{
@@ -5087,7 +5087,7 @@ const tech = {
return tech.haveGunCheck("wave") && !tech.isPhaseVelocity
},
requires: "wave, not phase velocity",
ammoScale: 10,
ammoScale: 6,
effect() {
tech.isLongitudinal = true;
b.guns[3].chooseFireMethod()
@@ -5285,7 +5285,7 @@ const tech = {
},
{
name: "iridium-192",
description: "<strong class='color-e'>explosions</strong> release <strong class='color-p'>gamma radiation</strong><br><strong>+100%</strong> <strong class='color-d'>damage</strong> over <strong>4</strong> seconds",
description: "<strong class='color-e'>explosions</strong> release <strong class='color-p'>gamma radiation</strong><br><strong>+100%</strong> <strong class='color-e'>explosion</strong> <strong class='color-d'>damage</strong> over <strong>4</strong> seconds",
isGunTech: true,
maxCount: 1,
count: 0,
@@ -6071,7 +6071,7 @@ const tech = {
},
{
name: "K-selection",
description: "<strong>+37%</strong> size and <strong class='color-d'>damage</strong><br>for <strong class='color-p' style='letter-spacing: -0.8px;'>worms</strong> and <strong class='color-p' style='letter-spacing: -0.8px;'>fleas</strong>",
description: "<strong>+37%</strong> <strong class='color-p' style='letter-spacing: -0.8px;'>worm</strong> and <strong class='color-p' style='letter-spacing: -0.8px;'>flea</strong> <strong class='color-d'>damage</strong>",
isGunTech: true,
maxCount: 3,
count: 0,
@@ -9515,7 +9515,7 @@ const tech = {
effect() {
document.getElementById("health").style.display = "none"
document.getElementById("health-bg").style.display = "none"
document.getElementById("defense").style.display = "none"
document.getElementById("defense-bar").style.display = "none"
for (let i = 0; i < 20; i++) powerUps.spawn(m.pos.x + 160 * (Math.random() - 0.5), m.pos.y + 160 * (Math.random() - 0.5), "heal");
},
remove() {}
@@ -9876,7 +9876,8 @@ const tech = {
//move health to the right
document.getElementById("health").style.left = "86px"
document.getElementById("health-bg").style.left = "86px"
document.getElementById("defense").style.left = "86px"
document.getElementById("defense-bar").style.left = "86px"
document.getElementById("damage-bar").style.left = "86px"
},
remove() {}
},
@@ -10215,21 +10216,23 @@ const tech = {
},
{
name: "stubs",
description: "no knees or toes are drawn on the player",
description: "no knees or toes are drawn on the player<br>you can wall climb though",
maxCount: 1,
count: 0,
frequency: 0,
isSkin: true,
isJunk: true,
isNonRefundable: true,
allowed() {
return !m.isShipMode
},
requires: "",
effect() {
m.skin.stubs()
Matter.Body.scale(player.parts[3], 2, 2);
},
remove() {
if (this.count) m.resetSkin();
// if (this.count) m.resetSkin();
}
},
{