stun and burn balance

This commit is contained in:
landgreen
2020-03-09 06:05:41 -07:00
parent 99f36288a9
commit 014ffdab8f
6 changed files with 97 additions and 65 deletions

View File

@@ -89,7 +89,7 @@ const b = {
},
{
name: "fluoroantimonic acid",
description: "each <strong>bullet</strong> does instant <strong class='color-d'>damage</strong><br><strong>active</strong> when you are above <strong>80%</strong> base health",
description: "each <strong>bullet</strong> does instant <strong class='color-p'>acid</strong> <strong class='color-d'>damage</strong><br><strong>active</strong> when you are above <strong>80%</strong> 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 <strong>four</strong> balls in a wide arc<br>balls <strong>bounce</strong> 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 <strong>precise</strong> volley of <strong>high velocity</strong> needles<br>needles deliver <strong class='color-p'>chemical</strong> damage over 3 seconds",
description: "fire a <strong>precise</strong> volley of <strong>high velocity</strong> needles<br>needles deliver <strong class='color-p'>chemical</strong> <strong class='color-d'>damage</strong> 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 <strong>sporangiums</strong> that discharge <strong class='color-p' style='letter-spacing: 2px;'>spores</strong><br><strong class='color-p' style='letter-spacing: 2px;'>spores</strong> do <strong class='color-d'>damage</strong> over <strong>3</strong> seconds",
description: "fire a <strong>sporangium</strong> that discharges <strong class='color-p' style='letter-spacing: 2px;'>spores</strong>",
ammo: 0,
ammoPack: (game.difficultyMode > 3) ? 3 : 4,
have: false,

View File

@@ -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

View File

@@ -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();

View File

@@ -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({

View File

@@ -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()