mod - super ball

This commit is contained in:
landgreen
2020-03-09 19:59:47 -07:00
parent f67cb30318
commit 20bea938fc
3 changed files with 73 additions and 12 deletions

View File

@@ -38,6 +38,7 @@ const b = {
isModFastSpores: null, isModFastSpores: null,
isModStomp: null, isModStomp: null,
modSuperBallNumber: null, modSuperBallNumber: null,
modOneSuperBall: null,
modLaserReflections: null, modLaserReflections: null,
modLaserDamage: null, modLaserDamage: null,
modLaserFieldDrain: null, modLaserFieldDrain: null,
@@ -188,13 +189,13 @@ const b = {
}, },
{ {
name: "thermal runaway", name: "thermal runaway",
description: "mobs <strong class='color-e'>explode</strong> when they <strong>die</strong>", description: "mobs <strong class='color-e'>explode</strong> when they <strong>die</strong><br><em>be careful</em>",
maxCount: 1, maxCount: 1,
count: 0, count: 0,
allowed() { allowed() {
return b.isModImmuneExplosion return true
}, },
requires: "electric reactive armour", requires: "",
effect: () => { effect: () => {
b.isModExplodeMob = true; b.isModExplodeMob = true;
}, },
@@ -828,6 +829,38 @@ const b = {
b.modSuperBallNumber = 4; b.modSuperBallNumber = 4;
} }
}, },
{
name: "super ball",
description: "rapidly fire <strong>one</strong> <strong>ball</strong> at a time<br><strong>ammo</strong> costs are reduced by <strong>50%</strong>",
maxCount: 1,
count: 0,
allowed() {
return b.haveGunCheck("super balls")
},
requires: "super balls",
effect() {
b.modOneSuperBall = true;
// current ammo
for (i = 0, len = b.guns.length; i < len; i++) { //find which gun
if (b.guns[i].name === "super balls") b.guns[i].ammo = b.guns[i].ammo * 2;
}
//ammo power ups
for (i = 0, len = b.guns.length; i < len; i++) { //find which gun
if (b.guns[i].name === "super balls") b.guns[i].ammoPack = b.guns[i].defaultAmmoPack * 2;
}
},
remove() {
b.modOneSuperBall = false;
// current ammo
for (i = 0, len = b.guns.length; i < len; i++) { //find which gun
if (b.guns[i].name === "super balls") b.guns[i].ammo = Math.floor(b.guns[i].ammo / 2);
}
//ammo power ups
for (i = 0, len = b.guns.length; i < len; i++) { //find which gun
if (b.guns[i].name === "super balls") b.guns[i].ammoPack = b.guns[i].defaultAmmoPack;
}
}
},
{ {
name: "fléchettes cartridges", name: "fléchettes cartridges",
description: "<strong>fléchettes</strong> release <strong>three</strong> needles in each shot<br><strong>ammo</strong> cost are increases by <strong>3x</strong>", description: "<strong>fléchettes</strong> release <strong>three</strong> needles in each shot<br><strong>ammo</strong> cost are increases by <strong>3x</strong>",
@@ -2165,15 +2198,35 @@ const b = {
description: "fire <strong>four</strong> balls in a wide arc<br>balls <strong>bounce</strong> with no momentum loss", description: "fire <strong>four</strong> balls in a wide arc<br>balls <strong>bounce</strong> with no momentum loss",
ammo: 0, ammo: 0,
ammoPack: 12, ammoPack: 12,
defaultAmmoPack: 12, //use to revert ammoPack after mod changes drop rate
have: false, have: false,
num: 5, num: 5,
isStarterGun: true, isStarterGun: true,
isEasyToAim: true, isEasyToAim: true,
fire() { fire() {
mech.fireCDcycle = mech.cycle + Math.floor((mech.crouch ? 25 : 20) * b.modFireRate); // cool down
b.muzzleFlash(20); b.muzzleFlash(20);
// mobs.alert(450);
const SPEED = mech.crouch ? 40 : 30 const SPEED = mech.crouch ? 40 : 30
if (b.modOneSuperBall) {
mech.fireCDcycle = mech.cycle + Math.floor((mech.crouch ? 32 : 20) * b.modFireRate / (b.modSuperBallNumber)); // cool down
let dir = mech.angle
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, 7 * b.modBulletSize, b.fireAttributes(dir, false));
World.add(engine.world, bullet[me]); //add bullet to world
Matter.Body.setVelocity(bullet[me], {
x: SPEED * Math.cos(dir),
y: SPEED * Math.sin(dir)
});
// Matter.Body.setDensity(bullet[me], 0.0001);
bullet[me].endCycle = game.cycle + Math.floor((300 + 60 * Math.random()) * b.isModBulletsLastLonger);
bullet[me].dmg = 0;
bullet[me].minDmgSpeed = 0;
bullet[me].restitution = 0.99;
bullet[me].friction = 0;
bullet[me].do = function () {
this.force.y += this.mass * 0.001;
};
} else {
mech.fireCDcycle = mech.cycle + Math.floor((mech.crouch ? 25 : 20) * b.modFireRate); // cool down
const SPREAD = mech.crouch ? 0.08 : 0.15 const SPREAD = mech.crouch ? 0.08 : 0.15
let dir = mech.angle - SPREAD * (b.modSuperBallNumber - 1) / 2; let dir = mech.angle - SPREAD * (b.modSuperBallNumber - 1) / 2;
for (let i = 0; i < b.modSuperBallNumber; i++) { for (let i = 0; i < b.modSuperBallNumber; i++) {
@@ -2196,6 +2249,7 @@ const b = {
dir += SPREAD; dir += SPREAD;
} }
} }
}
}, },
{ {
name: "fléchettes", //3 name: "fléchettes", //3

View File

@@ -68,8 +68,8 @@ const mobs = {
ctx.lineTo(who.vertices[j].x, who.vertices[j].y); ctx.lineTo(who.vertices[j].x, who.vertices[j].y);
} }
ctx.lineTo(who.vertices[0].x, who.vertices[0].y); ctx.lineTo(who.vertices[0].x, who.vertices[0].y);
ctx.strokeStyle = "rgba(0,100,255,0.5)"; ctx.strokeStyle = "rgba(0,100,255,0.8)";
ctx.lineWidth = 30; ctx.lineWidth = 15;
ctx.stroke(); ctx.stroke();
ctx.fillStyle = who.fill ctx.fillStyle = who.fill
ctx.fill(); ctx.fill();
@@ -1015,7 +1015,7 @@ const mobs = {
b.spore(this) //spawn drone b.spore(this) //spawn drone
} }
} }
if (b.isModExplodeMob) b.explosion(this.position, Math.min(500, Math.sqrt(this.mass + 2) * 80)) if (b.isModExplodeMob) b.explosion(this.position, Math.min(450, Math.sqrt(this.mass + 3) * 80))
} }
}, },

View File

@@ -1,5 +1,12 @@
************** TODO - n-gon ************** ************** TODO - n-gon **************
mod - super balls fire one ball at a time
ammo and fire rate is improved by the number of balls fired
mod - robot that attack nearby mobs, and delivers a stun status effect
use laser bot code for the attack
large and 5 sided?
consider using the "e" key for picking up blocks and just q for gun swaps consider using the "e" key for picking up blocks and just q for gun swaps
good for: plasma torch, time dilation, negative mass good for: plasma torch, time dilation, negative mass
bad for: basic, nano-scale, harmonic bad for: basic, nano-scale, harmonic