diff --git a/js/bullets.js b/js/bullets.js index ef12c8f..5d33540 100644 --- a/js/bullets.js +++ b/js/bullets.js @@ -89,7 +89,7 @@ const b = { }, { name: "fluoroantimonic acid", - description: "each bullet does instant damage
active when you are above 80% base health", + description: "each bullet does instant acid damage
active when you are above 80% base health", maxCount: 1, count: 0, allowed() { @@ -1459,7 +1459,7 @@ const b = { mob[i].force.y += knock.y; radius *= 0.93 //reduced range for each additional explosion target damageScale *= 0.8 //reduced damage for each additional explosion target - // mobs.statusBlind(mob[i]) + mobs.statusStun(mob[i]) // if (isBurn) mobs.statusBurn(mob[i], 0.4) // (2.2) * 1.3 * 30/180 // 6 ticks (3 seconds) } else if (!mob[i].seePlayer.recall && dist < alertRange) { mob[i].locatePlayer(); @@ -1720,7 +1720,7 @@ const b = { friction: 0, frictionAir: 0.025, thrust: b.isModFastSpores ? 0.0008 : 0.0004, - dmg: 0, //2.2, //damage done in addition to the damage from momentum + dmg: 2.2, //damage done in addition to the damage from momentum classType: "bullet", collisionFilter: { category: cat.bullet, @@ -1728,8 +1728,8 @@ const b = { }, endCycle: game.cycle + Math.floor((660 + Math.floor(Math.random() * 240)) * b.isModBulletsLastLonger), minDmgSpeed: 0, - onDmg(who) { - mobs.statusPoison(who, 0.5, 180) // (2.2) * 1.3 * 30/180 // 6 ticks (3 seconds) + onDmg() { + // mobs.statusPoison(who, 0.5, 180) // (2.2) * 1.3 * 30/180 // 6 ticks (3 seconds) this.endCycle = 0; //bullet ends cycle after doing damage }, onEnd() {}, @@ -2104,8 +2104,6 @@ const b = { isEasyToAim: false, fire() { const me = bullet.length; - b.muzzleFlash(15); - // if (Math.random() > 0.2) mobs.alert(500); const dir = mech.angle + (Math.random() - 0.5) * ((mech.crouch) ? 0.03 : 0.1); bullet[me] = Bodies.rectangle(mech.pos.x + 30 * Math.cos(mech.angle), mech.pos.y + 30 * Math.sin(mech.angle), 20 * b.modBulletSize, 6 * b.modBulletSize, b.fireAttributes(dir)); b.fireProps(mech.crouch ? 8 : 4, mech.crouch ? 52 : 38, dir, me); //cd , speed @@ -2114,8 +2112,15 @@ const b = { bullet[me].frictionAir = mech.crouch ? 0.007 : 0.01; if (b.isModIceCrystals) { bullet[me].onDmg = function (who) { - if (!who.shield) mobs.statusSlow(who, 60) + mobs.statusSlow(who, 60) }; + //ice muzzleFlash + ctx.fillStyle = "rgb(0,100,255)"; + ctx.beginPath(); + ctx.arc(mech.pos.x + 35 * Math.cos(mech.angle), mech.pos.y + 35 * Math.sin(mech.angle), 15, 0, 2 * Math.PI); + ctx.fill(); + } else { + b.muzzleFlash(15); } bullet[me].do = function () { this.force.y += this.mass * 0.0005; @@ -2163,7 +2168,7 @@ const b = { name: "super balls", //2 description: "fire four balls in a wide arc
balls bounce with no momentum loss", ammo: 0, - ammoPack: 10, + ammoPack: 12, have: false, num: 5, isStarterGun: true, @@ -2198,10 +2203,10 @@ const b = { }, { name: "fléchettes", //3 - description: "fire a precise volley of high velocity needles
needles deliver chemical damage over 3 seconds", + description: "fire a precise volley of high velocity needles
needles deliver chemical damage over 3 seconds", ammo: 0, - ammoPack: 22, - defaultAmmoPack: 22, + ammoPack: 23, + defaultAmmoPack: 23, have: false, isStarterGun: true, isEasyToAim: false, @@ -2222,14 +2227,16 @@ const b = { function makeFlechette(angle = mech.angle) { const me = bullet.length; bullet[me] = Bodies.rectangle(mech.pos.x + 40 * Math.cos(mech.angle), mech.pos.y + 40 * Math.sin(mech.angle), 45 * b.modBulletSize, 1.4 * b.modBulletSize, b.fireAttributes(angle)); - Matter.Body.setDensity(bullet[me], 0.0001); //0.001 is normal + // Matter.Body.setDensity(bullet[me], 0.0001); //0.001 is normal bullet[me].endCycle = game.cycle + 180; bullet[me].dmg = 0; bullet[me].onDmg = function (who) { - if (b.isModDotFlechette) { - mobs.statusPoison(who, 0.38, 360) // (2.3) * 2 / 14 ticks (2x damage over 7 seconds) - } else { - mobs.statusPoison(who, 0.38, 180) // (2.3) / 6 ticks (3 seconds) + if (!who.isShielded) { + if (b.isModDotFlechette) { + mobs.statusPoison(who, 0.33, 360) // (2.3) * 2 / 14 ticks (2x damage over 7 seconds) + } else { + mobs.statusPoison(who, 0.33, 180) // (2.3) / 6 ticks (3 seconds) + } } }; @@ -2590,7 +2597,7 @@ const b = { }, { name: "spores", //10 - description: "fire sporangiums that discharge spores
spores do damage over 3 seconds", + description: "fire a sporangium that discharges spores", ammo: 0, ammoPack: (game.difficultyMode > 3) ? 3 : 4, have: false, diff --git a/js/engine.js b/js/engine.js index 514dcb0..37fb3c5 100644 --- a/js/engine.js +++ b/js/engine.js @@ -184,6 +184,7 @@ function collisionChecks(event) { // console.log(obj.dmg / (0.15 * obj.mass * Vector.magnitude(Vector.sub(mob[k].velocity, obj.velocity)))) if (b.isModCrit && !mob[k].seePlayer.recall && !mob[k].shield) dmg *= 5 mob[k].foundPlayer(); + // console.log(dmg) mob[k].damage(dmg); obj.onDmg(mob[k]); //some bullets do actions when they hits things, like despawn game.drawList.push({ //add dmg to draw queue diff --git a/js/level.js b/js/level.js index f4aac78..4f9c42e 100644 --- a/js/level.js +++ b/js/level.js @@ -13,14 +13,14 @@ const level = { levelsCleared: 0, start() { if (level.levelsCleared === 0) { - // level.difficultyIncrease(9) - // b.giveGuns("fléchettes") + level.difficultyIncrease(9) + b.giveGuns("flak") // mech.setField("phase decoherence field") // b.giveMod("irradiated needles"); // b.giveMod("reflective cavity"); - level.intro(); //starting level - // level.testingMap(); + // level.intro(); //starting level + level.testingMap(); // level.bosses(); // level.satellite(); // level.skyscrapers(); diff --git a/js/mobs.js b/js/mobs.js index 82c46d3..0f55ef5 100644 --- a/js/mobs.js +++ b/js/mobs.js @@ -49,51 +49,72 @@ const mobs = { } }, statusSlow(who, cycles = 60) { - //remove other "slow" effects on this mob - let i = who.status.length - while (i--) { - if (who.status[i].type === "slow") who.status.splice(i, 1); + if (!who.shield && !who.isShielded) { + //remove other "slow" effects on this mob + let i = who.status.length + while (i--) { + if (who.status[i].type === "slow") who.status.splice(i, 1); + } + who.status.push({ + effect() { + Matter.Body.setVelocity(who, { + x: 0, + y: 0 + }); + Matter.Body.setAngularVelocity(who, 0); + ctx.beginPath(); + ctx.moveTo(who.vertices[0].x, who.vertices[0].y); + for (let j = 1, len = who.vertices.length; j < len; ++j) { + ctx.lineTo(who.vertices[j].x, who.vertices[j].y); + } + ctx.lineTo(who.vertices[0].x, who.vertices[0].y); + ctx.strokeStyle = "rgba(0,100,255,0.5)"; + ctx.lineWidth = 30; + ctx.stroke(); + ctx.fillStyle = who.fill + ctx.fill(); + }, + type: "slow", + endCycle: game.cycle + cycles, + }) } - who.status.push({ - effect() { - Matter.Body.setVelocity(who, { - x: 0, - y: 0 - }); - Matter.Body.setAngularVelocity(who, 0); - ctx.beginPath(); - ctx.moveTo(who.vertices[0].x, who.vertices[0].y); - for (let j = 1, len = who.vertices.length; j < len; ++j) { - ctx.lineTo(who.vertices[j].x, who.vertices[j].y); - } - ctx.lineTo(who.vertices[0].x, who.vertices[0].y); - ctx.strokeStyle = "rgba(0,100,255,0.5)"; - ctx.lineWidth = 30; - ctx.stroke(); - ctx.fillStyle = who.fill - ctx.fill(); - }, - type: "slow", - endCycle: game.cycle + cycles, - }) }, - statusBlind(who, cycles = 60) { - //remove other "stun" effects on this mob - let i = who.status.length - while (i--) { - if (who.status[i].type === "blind") who.status.splice(i, 1); + statusStun(who, cycles = 60) { + if (!who.shield && !who.isShielded) { + Matter.Body.setVelocity(who, { + x: 0, + y: 0 + }); + Matter.Body.setAngularVelocity(who, 0); + //remove other "stun" effects on this mob + let i = who.status.length + while (i--) { + if (who.status[i].type === "stun") who.status.splice(i, 1); + } + who.status.push({ + effect() { + who.seePlayer.yes = false; + who.seePlayer.position = { + x: who.position.x + 100 * (Math.random() - 0.5), + y: who.position.y + 100 * (Math.random() - 0.5) + } + who.force.y += who.mass * 0.002 //extra gravity + + ctx.beginPath(); + ctx.moveTo(who.vertices[0].x, who.vertices[0].y); + for (let j = 1, len = who.vertices.length; j < len; ++j) { + ctx.lineTo(who.vertices[j].x, who.vertices[j].y); + } + ctx.lineTo(who.vertices[0].x, who.vertices[0].y); + ctx.stroke(); + ctx.fillStyle = `rgba(${Math.floor(255*Math.random())},${Math.floor(255*Math.random())},${Math.floor(255*Math.random())},0.5)` + // ctx.fillStyle = `rgba(255,255,255,${Math.random()})` + ctx.fill(); + }, + type: "stun", + endCycle: game.cycle + cycles, + }) } - who.status.push({ - effect() { - // Matter.Body.setVelocity(who, { - // x: 0, - // y: 0 - // }); - // Matter.Body.setAngularVelocity(who, 0); - }, - type: "blind", - endCycle: game.cycle + cycles, - }) }, statusPoison(who, tickDamage, cycles = 180) { who.status.push({ diff --git a/js/player.js b/js/player.js index 6c46bf6..7ce8e08 100644 --- a/js/player.js +++ b/js/player.js @@ -1613,7 +1613,7 @@ const mech = { if (inPlayer.length > 0) { for (let i = 0; i < inPlayer.length; i++) { if (inPlayer[i].shield) { - mech.energy -= 0.01; //shields drain player energy + mech.energy -= 0.005; //shields drain player energy //draw outline of shield ctx.fillStyle = `rgba(0, 204, 255,0.6)` ctx.fill() diff --git a/todo.txt b/todo.txt index 21230f7..f317321 100644 --- a/todo.txt +++ b/todo.txt @@ -24,8 +24,11 @@ mobs - add in a function to the main loops that does injected code for each mob stun - combine blind, slow with increased gravity effects, but how burn effect doesn't look right, too similar to poison + burn status could spread to player mod - grenade explosions stun enemies mod - vacuum bomb does DoT damage after exploding + mod - super balls become fire balls? + mod - laser mod has a chance to set things on fire settings - auto aim at nearest mob settings - custom keys binding