bug fixes

This commit is contained in:
landgreen
2021-08-19 06:12:05 -07:00
parent 452b00273a
commit d8dd82c8a0
8 changed files with 35 additions and 40 deletions

View File

@@ -1587,7 +1587,7 @@ const b = {
ctx.globalAlpha = 1;
}
},
AoEStunEffect(where, range, cycles = 100 + 80 * Math.random()) {
AoEStunEffect(where, range, cycles = 150 + 120 * Math.random()) {
for (let i = 0, len = mob.length; i < len; ++i) {
if (mob[i].alive && !mob[i].isShielded && !mob[i].shield && !mob[i].isBadTarget) {
if (Vector.magnitude(Vector.sub(where, mob[i].position)) - mob[i].radius < range) mobs.statusStun(mob[i], cycles)
@@ -1643,9 +1643,9 @@ const b = {
Matter.Query.ray(map, this.position, mob[i].position).length === 0 &&
Matter.Query.ray(body, this.position, mob[i].position).length === 0
) {
b.AoEStunEffect(this.position, 1300);
if (tech.isMineStun) b.AoEStunEffect(this.position, 1300);
this.do = this.laserSpin
this.endCycle = simulation.cycle + 360
this.endCycle = simulation.cycle + 360 + 120
// if (this.angularSpeed < 0.01) this.torque += this.inertia * this.torqueMagnitude * 5 //spin
this.isArmed = true
break
@@ -1668,17 +1668,20 @@ const b = {
for (let i = 0; i < 3; i++) {
const where = this.vertices[i]
const endPoint = Vector.add(where, Vector.mult(Vector.normalise(Vector.sub(where, this.position)), 2500))
b.laser(where, endPoint, tech.laserDamage * 12, this.reflections, true)
b.laser(where, endPoint, tech.laserDamage * 14, this.reflections, true)
}
ctx.stroke();
// ctx.globalAlpha = 1;
}
}
if (this.endCycle - 60 < simulation.cycle) {
this.do = () => {} //no nothing, no laser, no spin
}
},
})
Matter.Body.setVelocity(bullet[me], velocity);
Composite.add(engine.world, bullet[me]); //add bullet to world
},
mine(where, velocity, angle = 0, isAmmoBack = false) {
mine(where, velocity, angle = 0) {
const bIndex = bullet.length;
bullet[bIndex] = Bodies.rectangle(where.x, where.y, 45, 16, {
angle: angle,
@@ -1744,9 +1747,7 @@ const b = {
}
}
} else {
if (this.speed < 1 && this.angularSpeed < 0.01 && !m.isBodiesAsleep) {
this.stillCount++
}
if (this.speed < 1 && this.angularSpeed < 0.01 && !m.isBodiesAsleep) this.stillCount++
}
if (this.stillCount > 25) this.arm();
},
@@ -1815,14 +1816,14 @@ const b = {
Matter.Query.ray(map, this.position, mob[i].position).length === 0 &&
Matter.Query.ray(body, this.position, mob[i].position).length === 0
) {
b.AoEStunEffect(this.position, 700 + mob[i].radius + random);
if (tech.isMineStun) b.AoEStunEffect(this.position, 700 + mob[i].radius + random);
if (tech.isMineSentry) {
this.lookFrequency = 8 + Math.floor(3 * Math.random())
this.endCycle = simulation.cycle + 900
this.endCycle = simulation.cycle + 960
this.do = function() { //overwrite the do method for this bullet
this.force.y += this.mass * 0.002; //extra gravity
if (!(simulation.cycle % this.lookFrequency) && !m.isBodiesAsleep) { //find mob targets
b.targetedNail(this.position, 1, 45 + 5 * Math.random(), 1100, false, 2) //targetedNail(position, num = 1, speed = 40 + 10 * Math.random(), range = 1200, isRandomAim = true, damage = 1.4) {
b.targetedNail(this.position, 1, 45 + 5 * Math.random(), 1100, false, 2.3) //targetedNail(position, num = 1, speed = 40 + 10 * Math.random(), range = 1200, isRandomAim = true, damage = 1.4) {
if (!(simulation.cycle % (this.lookFrequency * 6))) {
simulation.drawList.push({
x: this.position.x,
@@ -1851,7 +1852,7 @@ const b = {
},
onEnd() {
if (this.isArmed) {
b.targetedNail(this.position, tech.isMineSentry ? 7 : 22, 40 + 10 * Math.random(), 1200, true, 1.9) //targetedNail(position, num = 1, speed = 40 + 10 * Math.random(), range = 1200, isRandomAim = true, damage = 1.4) {
b.targetedNail(this.position, tech.isMineSentry ? 7 : 22, 40 + 10 * Math.random(), 1200, true, 2.2) //targetedNail(position, num = 1, speed = 40 + 10 * Math.random(), range = 1200, isRandomAim = true, damage = 1.4) {
}
if (tech.isMineAmmoBack && (!this.isArmed || Math.random() < 0.2)) { //get ammo back from tech.isMineAmmoBack
for (i = 0, len = b.guns.length; i < len; i++) { //find which gun
@@ -3854,8 +3855,9 @@ const b = {
}) //position, velocity, damage
if (tech.isIceCrystals) {
bullet[bullet.length - 1].beforeDmg = function(who) {
console.log(who)
mobs.statusSlow(who, 60)
if (tech.isNailRadiation) mobs.statusDoT(who, dmg * (tech.isFastRadiation ? 2.6 : 0.65), tech.isSlowRadiation ? 240 : (tech.isFastRadiation ? 30 : 120)) // one tick every 30 cycles
if (tech.isNailRadiation) mobs.statusDoT(who, 1 * (tech.isFastRadiation ? 2.6 : 0.65), tech.isSlowRadiation ? 240 : (tech.isFastRadiation ? 30 : 120)) // one tick every 30 cycles
if (tech.isNailCrit && !who.shield && Vector.dot(Vector.normalise(Vector.sub(who.position, this.position)), Vector.normalise(this.velocity)) > 0.94) {
b.explosion(this.position, 150 + 30 * Math.random()); //makes bullet do explosive damage at end
}

View File

@@ -14,12 +14,11 @@ const level = {
// localSettings.levelsClearedLastGame = 10
// level.difficultyIncrease(30) //30 is near max on hard //60 is near max on why
// simulation.isHorizontalFlipped = true
// tech.isFieldFree = true
// m.setField("time dilation")
// b.giveGuns("mine")
// tech.giveTech("laser-mines")
// b.giveGuns("nail gun")
// tech.giveTech("Lenz's law")
// m.setField("wormhole")
// tech.giveTech("ice crystal nucleation")
// tech.giveTech("irradiated nails")
// for (let i = 0; i < 9; i++) tech.giveTech("MIRV")
level.intro(); //starting level
@@ -2272,10 +2271,10 @@ const level = {
// spawn.laserBombingBoss(1900, -500)
// for (let i = 0; i < 5; i++) spawn.focuser(1900, -500)
// spawn.growBossCulture(1900, -500)
spawn.sneaker(1900, -500)
spawn.sneaker(1900, -500)
spawn.shield(mob[mob.length - 1], 1900, -500, 1);
spawn.sniper(1900, -500)
spawn.grenadier(1900, -500)
// spawn.sneaker(1900, -500)
// spawn.shield(mob[mob.length - 1], 1900, -500, 1);
// mob[mob.length - 1].isShielded = true
// spawn.historyBoss(1200, -500)
// spawn.laserTargetingBoss(1600, -400)

View File

@@ -693,7 +693,7 @@ const powerUps = {
powerUps.research.currentRerollCount = 0
if (tech.isTechDamage && who.name === "tech") m.damage(0.11)
if (tech.isMassEnergy) m.energy += 2;
if (tech.isMineDrop && b.length < 150) {
if (tech.isMineDrop && bullet.length < 150) {
if (tech.isLaserMine && m.crouch) {
b.laserMine(who.position)
} else {

View File

@@ -610,6 +610,8 @@ const simulation = {
document.getElementById("fade-out").style.opacity = 0;
document.title = "n-gon";
document.getElementById("health").style.display = "inline"
document.getElementById("health-bg").style.display = "inline"
m.alive = true;
m.setMaxHealth()
m.health = 0;

View File

@@ -91,6 +91,7 @@ const spawn = {
secondaryBossChance(x, y) {
if (tech.isDuplicateBoss && Math.random() < 2 * tech.duplicationChance()) {
spawn.randomLevelBoss(x, y);
return true
} else if (tech.isResearchBoss) {
if (powerUps.research.count > 3) {
powerUps.research.changeRerolls(-4)
@@ -98,9 +99,10 @@ const spawn = {
} else {
tech.addJunkTechToPool(49)
}
console.log('hi')
spawn.randomLevelBoss(x, y);
return true
}
return false
},
//mob templates *********************************************************************************************
//***********************************************************************************************************

View File

@@ -178,7 +178,7 @@
if (tech.isMaxEnergyTech) dmg *= 1.5
if (tech.isEnergyNoAmmo) dmg *= 1.6
if (tech.isDamageForGuns) dmg *= 1 + 0.14 * b.inventory.length
if (tech.isLowHealthDmg) dmg *= 1 + 0.5 * Math.max(0, 1 - m.health)
if (tech.isLowHealthDmg) dmg *= 1 + Math.max(0, 1 - m.health) * 0.5
if (tech.isHarmDamage && m.lastHarmCycle + 600 > m.cycle) dmg *= 3;
if (tech.isEnergyLoss) dmg *= 1.55;
if (tech.isAcidDmg && m.health > 1) dmg *= 1.35;
@@ -4455,7 +4455,7 @@
},
{
name: "sentry",
description: "instead of detonating, <strong>mines</strong> <strong>target</strong> mobs<br>with a stream of nails for about <strong>14</strong> seconds",
description: "instead of detonating, <strong>mines</strong> <strong>target</strong> mobs<br>with a stream of nails for about <strong>15</strong> seconds",
isGunTech: true,
maxCount: 1,
count: 0,
@@ -4474,7 +4474,7 @@
},
{
name: "blast mines",
description: "when a <strong>mine</strong> <strong>activates</strong><br>it <strong>stuns</strong> nearby mobs for up to <strong>3</strong> seconds",
description: "when a <strong>mine</strong> <strong>activates</strong><br>it <strong>stuns</strong> nearby mobs for <strong>2-4</strong> seconds",
isGunTech: true,
maxCount: 1,
count: 0,
@@ -4494,6 +4494,7 @@
{
name: "booby trap",
description: "drop a <strong>mine</strong> after picking up a <strong>power up</strong><br><strong>+30</strong> <strong class='color-j'>JUNK</strong> to the potential <strong class='color-m'>tech</strong> pool",
isGunTech: true,
maxCount: 1,
count: 0,
frequency: 2,