mod - super ball stun, ice crystal mod uses energy

This commit is contained in:
landgreen
2020-03-10 19:54:43 -07:00
parent 13a1c7d9eb
commit 922f7defd6
3 changed files with 66 additions and 60 deletions

View File

@@ -766,7 +766,7 @@ const b = {
{ {
name: "ice crystal nucleation", name: "ice crystal nucleation",
description: "your <strong>minigun</strong> condenses <strong>unlimited ammo</strong><br>ice bullets made from water vapor <strong>slow</strong> mobs", description: "your <strong>minigun</strong> uses <strong class='color-f'>energy</strong> to condense<br><strong>bullets</strong> from water vapor that <strong>slow</strong> mobs",
maxCount: 1, maxCount: 1,
count: 0, count: 0,
allowed() { allowed() {
@@ -815,7 +815,7 @@ const b = {
}, },
{ {
name: "super duper", name: "super duper",
description: "fire <strong>+2</strong> additional <strong>super ball</strong>", description: "fire <strong>+2</strong> additional <strong>super balls</strong>",
maxCount: 9, maxCount: 9,
count: 0, count: 0,
allowed() { allowed() {
@@ -831,7 +831,7 @@ const b = {
}, },
{ {
name: "super ball", name: "super ball",
description: "fire a single <strong>huge</strong> super <strong>ball</strong>", description: "fire one <strong>large</strong> super <strong>ball</strong><br>that <strong>stuns</strong> mobs for <strong>2</strong> second",
maxCount: 1, maxCount: 1,
count: 0, count: 0,
allowed() { allowed() {
@@ -1251,8 +1251,8 @@ const b = {
game.updateGunHUD(); game.updateGunHUD();
} }
} else { } else {
if (b.isModAmmoFromHealth && mech.health > b.isModAmmoFromHealth) { if (b.isModAmmoFromHealth && mech.health > 0.05) {
mech.damage(b.isModAmmoFromHealth * mech.health); mech.damage(Math.max(0.01, b.isModAmmoFromHealth * mech.health));
powerUps.spawn(mech.pos.x, mech.pos.y, "ammo"); powerUps.spawn(mech.pos.x, mech.pos.y, "ammo");
if (Math.random() < b.isModBayesian) powerUps.spawn(mech.pos.x, mech.pos.y, "ammo"); if (Math.random() < b.isModBayesian) powerUps.spawn(mech.pos.x, mech.pos.y, "ammo");
} }
@@ -2123,12 +2123,14 @@ const b = {
bullet[me].endCycle = game.cycle + 70; bullet[me].endCycle = game.cycle + 70;
bullet[me].dmg = 0.07; bullet[me].dmg = 0.07;
bullet[me].frictionAir = mech.crouch ? 0.007 : 0.01; bullet[me].frictionAir = mech.crouch ? 0.007 : 0.01;
if (b.isModIceCrystals) { if (b.isModIceCrystals && mech.energy > 0.01) {
mech.energy -= mech.fieldRegen + 0.007
bullet[me].onDmg = function (who) { bullet[me].onDmg = function (who) {
mobs.statusSlow(who, 60) mobs.statusSlow(who, 60)
}; };
//ice muzzleFlash //ice muzzleFlash
ctx.fillStyle = "rgb(0,100,255)"; ctx.fillStyle = "rgb(0,100,255)";
ctx.beginPath(); 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.arc(mech.pos.x + 35 * Math.cos(mech.angle), mech.pos.y + 35 * Math.sin(mech.angle), 15, 0, 2 * Math.PI);
ctx.fill(); ctx.fill();
@@ -2192,7 +2194,7 @@ const b = {
if (b.modOneSuperBall) { if (b.modOneSuperBall) {
let dir = mech.angle let dir = mech.angle
const me = bullet.length; const me = bullet.length;
bullet[me] = Bodies.polygon(mech.pos.x + 30 * Math.cos(mech.angle), mech.pos.y + 30 * Math.sin(mech.angle), 12, 22 * b.modBulletSize, b.fireAttributes(dir, false)); bullet[me] = Bodies.polygon(mech.pos.x + 30 * Math.cos(mech.angle), mech.pos.y + 30 * Math.sin(mech.angle), 12, 20 * b.modBulletSize, b.fireAttributes(dir, false));
World.add(engine.world, bullet[me]); //add bullet to world World.add(engine.world, bullet[me]); //add bullet to world
Matter.Body.setVelocity(bullet[me], { Matter.Body.setVelocity(bullet[me], {
x: SPEED * Math.cos(dir), x: SPEED * Math.cos(dir),
@@ -2206,6 +2208,9 @@ const b = {
bullet[me].do = function () { bullet[me].do = function () {
this.force.y += this.mass * 0.001; this.force.y += this.mass * 0.001;
}; };
bullet[me].onDmg = function (who) {
mobs.statusStun(who, 120) // (2.3) * 2 / 14 ticks (2x damage over 7 seconds)
};
} else { } else {
b.muzzleFlash(20); b.muzzleFlash(20);
const SPREAD = mech.crouch ? 0.08 : 0.15 const SPREAD = mech.crouch ? 0.08 : 0.15
@@ -2261,12 +2266,10 @@ const b = {
bullet[me].endCycle = game.cycle + 180; bullet[me].endCycle = game.cycle + 180;
bullet[me].dmg = 0; bullet[me].dmg = 0;
bullet[me].onDmg = function (who) { bullet[me].onDmg = function (who) {
if (!who.isShielded) { if (b.isModDotFlechette) {
if (b.isModDotFlechette) { mobs.statusPoison(who, 0.33, 360) // (2.3) * 2 / 14 ticks (2x damage over 7 seconds)
mobs.statusPoison(who, 0.33, 360) // (2.3) * 2 / 14 ticks (2x damage over 7 seconds) } else {
} else { mobs.statusPoison(who, 0.33, 180) // (2.3) / 6 ticks (3 seconds)
mobs.statusPoison(who, 0.33, 180) // (2.3) / 6 ticks (3 seconds)
}
} }
}; };

View File

@@ -79,13 +79,13 @@ const mobs = {
}) })
} }
}, },
statusStun(who, cycles = 60) { statusStun(who, cycles = 120) {
if (!who.shield && !who.isShielded) { if (!who.shield && !who.isShielded) {
Matter.Body.setVelocity(who, { Matter.Body.setVelocity(who, {
x: 0, x: who.velocity.x * 0.8,
y: 0 y: who.velocity.y * 0.8
}); });
Matter.Body.setAngularVelocity(who, 0); Matter.Body.setAngularVelocity(who, who.angularVelocity * 0.8);
//remove other "stun" effects on this mob //remove other "stun" effects on this mob
let i = who.status.length let i = who.status.length
while (i--) { while (i--) {
@@ -98,7 +98,7 @@ const mobs = {
x: who.position.x + 100 * (Math.random() - 0.5), x: who.position.x + 100 * (Math.random() - 0.5),
y: who.position.y + 100 * (Math.random() - 0.5) y: who.position.y + 100 * (Math.random() - 0.5)
} }
who.force.y += who.mass * 0.002 //extra gravity who.force.y += who.mass * 0.001 //extra gravity
ctx.beginPath(); ctx.beginPath();
ctx.moveTo(who.vertices[0].x, who.vertices[0].y); ctx.moveTo(who.vertices[0].x, who.vertices[0].y);
@@ -117,49 +117,53 @@ const mobs = {
} }
}, },
statusPoison(who, tickDamage, cycles = 180) { statusPoison(who, tickDamage, cycles = 180) {
who.status.push({ if (!who.isShielded) {
effect() { who.status.push({
if ((game.cycle - this.startCycle) % 30 === 0) { effect() {
let dmg = b.dmgScale * tickDamage if ((game.cycle - this.startCycle) % 30 === 0) {
who.damage(dmg); let dmg = b.dmgScale * tickDamage
game.drawList.push({ //add dmg to draw queue who.damage(dmg);
x: who.position.x, game.drawList.push({ //add dmg to draw queue
y: who.position.y, x: who.position.x,
radius: Math.log(2 * dmg + 1.1) * 40, y: who.position.y,
color: "rgba(0,80,80,0.9)", radius: Math.log(2 * dmg + 1.1) * 40,
time: game.drawTime color: "rgba(0,80,80,0.9)",
}); time: game.drawTime
} });
}, }
type: "poison", },
endCycle: game.cycle + cycles, type: "poison",
startCycle: game.cycle endCycle: game.cycle + cycles,
}) startCycle: game.cycle
})
}
}, },
statusBurn(who, tickDamage, cycles = 90 + Math.floor(90 * Math.random())) { statusBurn(who, tickDamage, cycles = 90 + Math.floor(90 * Math.random())) {
//remove other "burn" effects on this mob if (!who.isShielded) {
let i = who.status.length //remove other "burn" effects on this mob
while (i--) { let i = who.status.length
if (who.status[i].type === "burn") who.status.splice(i, 1); while (i--) {
if (who.status[i].type === "burn") who.status.splice(i, 1);
}
who.status.push({
effect() {
if ((game.cycle - this.startCycle) % 15 === 0) {
let dmg = b.dmgScale * tickDamage * 0.5 * (1 + Math.random())
who.damage(dmg);
game.drawList.push({ //add dmg to draw queue
x: who.position.x,
y: who.position.y,
radius: Math.log(2 * dmg + 1.1) * 40,
color: `rgba(255,${Math.floor(255*Math.random())},0,0.9)`,
time: game.drawTime
});
}
},
type: "burn",
endCycle: game.cycle + cycles,
startCycle: game.cycle
})
} }
who.status.push({
effect() {
if ((game.cycle - this.startCycle) % 15 === 0) {
let dmg = b.dmgScale * tickDamage * 0.5 * (1 + Math.random())
who.damage(dmg);
game.drawList.push({ //add dmg to draw queue
x: who.position.x,
y: who.position.y,
radius: Math.log(2 * dmg + 1.1) * 40,
color: `rgba(255,${Math.floor(255*Math.random())},0,0.9)`,
time: game.drawTime
});
}
},
type: "burn",
endCycle: game.cycle + cycles,
startCycle: game.cycle
})
}, },
//********************************************************************************************** //**********************************************************************************************

View File

@@ -1,7 +1,6 @@
************** TODO - n-gon ************** ************** TODO - n-gon **************
mod - super balls fire one ball at a time mod or field - turn blocks into spores or drones
ammo and fire rate is improved by the number of balls fired
mod - robot that attack nearby mobs, and delivers a stun status effect mod - robot that attack nearby mobs, and delivers a stun status effect
use laser bot code for the attack use laser bot code for the attack