mod - super ball
This commit is contained in:
@@ -38,6 +38,7 @@ const b = {
|
||||
isModFastSpores: null,
|
||||
isModStomp: null,
|
||||
modSuperBallNumber: null,
|
||||
modOneSuperBall: null,
|
||||
modLaserReflections: null,
|
||||
modLaserDamage: null,
|
||||
modLaserFieldDrain: null,
|
||||
@@ -188,13 +189,13 @@ const b = {
|
||||
},
|
||||
{
|
||||
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,
|
||||
count: 0,
|
||||
allowed() {
|
||||
return b.isModImmuneExplosion
|
||||
return true
|
||||
},
|
||||
requires: "electric reactive armour",
|
||||
requires: "",
|
||||
effect: () => {
|
||||
b.isModExplodeMob = true;
|
||||
},
|
||||
@@ -828,6 +829,38 @@ const b = {
|
||||
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",
|
||||
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,18 +2198,17 @@ const b = {
|
||||
description: "fire <strong>four</strong> balls in a wide arc<br>balls <strong>bounce</strong> with no momentum loss",
|
||||
ammo: 0,
|
||||
ammoPack: 12,
|
||||
defaultAmmoPack: 12, //use to revert ammoPack after mod changes drop rate
|
||||
have: false,
|
||||
num: 5,
|
||||
isStarterGun: true,
|
||||
isEasyToAim: true,
|
||||
fire() {
|
||||
mech.fireCDcycle = mech.cycle + Math.floor((mech.crouch ? 25 : 20) * b.modFireRate); // cool down
|
||||
b.muzzleFlash(20);
|
||||
// mobs.alert(450);
|
||||
const SPEED = mech.crouch ? 40 : 30
|
||||
const SPREAD = mech.crouch ? 0.08 : 0.15
|
||||
let dir = mech.angle - SPREAD * (b.modSuperBallNumber - 1) / 2;
|
||||
for (let i = 0; i < b.modSuperBallNumber; i++) {
|
||||
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
|
||||
@@ -2193,7 +2225,29 @@ const b = {
|
||||
bullet[me].do = function () {
|
||||
this.force.y += this.mass * 0.001;
|
||||
};
|
||||
dir += SPREAD;
|
||||
} else {
|
||||
mech.fireCDcycle = mech.cycle + Math.floor((mech.crouch ? 25 : 20) * b.modFireRate); // cool down
|
||||
const SPREAD = mech.crouch ? 0.08 : 0.15
|
||||
let dir = mech.angle - SPREAD * (b.modSuperBallNumber - 1) / 2;
|
||||
for (let i = 0; i < b.modSuperBallNumber; i++) {
|
||||
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;
|
||||
};
|
||||
dir += SPREAD;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -68,8 +68,8 @@ const mobs = {
|
||||
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.strokeStyle = "rgba(0,100,255,0.8)";
|
||||
ctx.lineWidth = 15;
|
||||
ctx.stroke();
|
||||
ctx.fillStyle = who.fill
|
||||
ctx.fill();
|
||||
@@ -1015,7 +1015,7 @@ const mobs = {
|
||||
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))
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
7
todo.txt
7
todo.txt
@@ -1,5 +1,12 @@
|
||||
************** 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
|
||||
good for: plasma torch, time dilation, negative mass
|
||||
bad for: basic, nano-scale, harmonic
|
||||
|
||||
Reference in New Issue
Block a user