shotgun slug
custom and pause menu style update (mostly just thinner lines between blocks) mod: shotgun slug - fire a big bullet
This commit is contained in:
76
js/bullet.js
76
js/bullet.js
@@ -559,7 +559,7 @@ const b = {
|
||||
bulletType: "mine",
|
||||
collisionFilter: {
|
||||
category: cat.bullet,
|
||||
mask: cat.map | cat.body | cat.mob | cat.mobBullet | cat.mobShield | cat.bullet
|
||||
mask: cat.map | cat.body | cat.mob | cat.mobBullet | cat.mobShield // | cat.bullet //doesn't collide with other bullets until it lands (was crashing into bots)
|
||||
},
|
||||
minDmgSpeed: 5,
|
||||
stillCount: 0,
|
||||
@@ -629,6 +629,7 @@ const b = {
|
||||
}
|
||||
},
|
||||
sentry() {
|
||||
this.collisionFilter.mask = cat.map | cat.body | cat.mob | cat.mobBullet | cat.mobShield | cat.bullet //can now collide with other bullets
|
||||
this.lookFrequency = game.cycle + 60
|
||||
this.endCycle = game.cycle + 1080
|
||||
this.do = function() { //overwrite the do method for this bullet
|
||||
@@ -655,6 +656,7 @@ const b = {
|
||||
}
|
||||
},
|
||||
arm() {
|
||||
this.collisionFilter.mask = cat.map | cat.body | cat.mob | cat.mobBullet | cat.mobShield | cat.bullet //can now collide with other bullets
|
||||
this.lookFrequency = game.cycle + 60
|
||||
this.do = function() { //overwrite the do method for this bullet
|
||||
this.force.y += this.mass * 0.002; //extra gravity
|
||||
@@ -1954,11 +1956,54 @@ const b = {
|
||||
}
|
||||
|
||||
b.muzzleFlash(35);
|
||||
if (mod.isIncendiary) {
|
||||
|
||||
if (mod.isSlugShot) {
|
||||
const me = bullet.length;
|
||||
const dir = mech.angle + 0.02 * (Math.random() - 0.5)
|
||||
bullet[me] = Bodies.rectangle(mech.pos.x + 35 * Math.cos(mech.angle), mech.pos.y + 35 * Math.sin(mech.angle), 45, 20, b.fireAttributes(dir));
|
||||
Matter.Body.setDensity(bullet[me], 0.0022);
|
||||
World.add(engine.world, bullet[me]); //add bullet to world
|
||||
const SPEED = (mech.crouch ? 52 : 43) + Math.random() * 7
|
||||
Matter.Body.setVelocity(bullet[me], {
|
||||
x: SPEED * Math.cos(dir),
|
||||
y: SPEED * Math.sin(dir)
|
||||
});
|
||||
if (mod.isIncendiary) {
|
||||
bullet[me].endCycle = game.cycle + 60
|
||||
bullet[me].onEnd = function() {
|
||||
b.explosion(this.position, 250 + (Math.random() - 0.5) * 60); //makes bullet do explosive damage at end
|
||||
}
|
||||
bullet[me].beforeDmg = function() {
|
||||
this.endCycle = 0; //bullet ends cycle after hitting a mob and triggers explosion
|
||||
};
|
||||
} else {
|
||||
bullet[me].endCycle = game.cycle + 180
|
||||
}
|
||||
bullet[me].minDmgSpeed = 15
|
||||
// bullet[me].restitution = 0.4
|
||||
bullet[me].frictionAir = 0.006;
|
||||
bullet[me].do = function() {
|
||||
this.force.y += this.mass * 0.002
|
||||
|
||||
//rotates bullet to face current velocity?
|
||||
if (this.speed > 6) {
|
||||
const facing = {
|
||||
x: Math.cos(this.angle),
|
||||
y: Math.sin(this.angle)
|
||||
}
|
||||
const mag = 0.0033
|
||||
if (Vector.cross(Vector.normalise(this.velocity), facing) < 0) {
|
||||
this.torque += mag
|
||||
} else {
|
||||
this.torque -= mag
|
||||
}
|
||||
}
|
||||
};
|
||||
} else if (mod.isIncendiary) {
|
||||
const SPEED = mech.crouch ? 35 : 25
|
||||
const END = Math.floor(mech.crouch ? 9 : 6);
|
||||
const totalBullets = 8
|
||||
const angleStep = (mech.crouch ? 0.1 : 0.33) / totalBullets
|
||||
const angleStep = (mech.crouch ? 0.15 : 0.4) / totalBullets
|
||||
let dir = mech.angle - angleStep * totalBullets / 2;
|
||||
for (let i = 0; i < totalBullets; i++) { //5 -> 7
|
||||
dir += angleStep
|
||||
@@ -1973,7 +2018,7 @@ const b = {
|
||||
y: speed * Math.sin(dirOff)
|
||||
});
|
||||
bullet[me].onEnd = function() {
|
||||
b.explosion(this.position, 60 + (Math.random() - 0.5) * 40); //makes bullet do explosive damage at end
|
||||
b.explosion(this.position, 80 + (Math.random() - 0.5) * 30); //makes bullet do explosive damage at end
|
||||
}
|
||||
bullet[me].beforeDmg = function() {
|
||||
this.endCycle = 0; //bullet ends cycle after hitting a mob and triggers explosion
|
||||
@@ -1981,29 +2026,6 @@ const b = {
|
||||
bullet[me].do = function() {}
|
||||
World.add(engine.world, bullet[me]); //add bullet to world
|
||||
}
|
||||
// for (let i = 0; i < totalBullets; i++) { //5 -> 7
|
||||
// dir += angleStep
|
||||
// const me = bullet.length;
|
||||
// bullet[me] = Bodies.rectangle(mech.pos.x + 50 * Math.cos(mech.angle), mech.pos.y + 50 * Math.sin(mech.angle), 17, 4, b.fireAttributes(dir));
|
||||
// World.add(engine.world, bullet[me]); //add bullet to world
|
||||
// Matter.Body.setVelocity(bullet[me], {
|
||||
// x: (SPEED + 15 * Math.random() - 2 * i) * Math.cos(dir),
|
||||
// y: (SPEED + 15 * Math.random() - 2 * i) * Math.sin(dir)
|
||||
// });
|
||||
// bullet[me].endCycle = 2 * i + END
|
||||
// bullet[me].restitution = 0;
|
||||
// bullet[me].friction = 1;
|
||||
// bullet[me].onEnd = function() {
|
||||
// b.explosion(this.position, (mech.crouch ? 95 : 75) + (Math.random() - 0.5) * 50); //makes bullet do explosive damage at end
|
||||
// }
|
||||
// bullet[me].beforeDmg = function() {
|
||||
// this.endCycle = 0; //bullet ends cycle after hitting a mob and triggers explosion
|
||||
// };
|
||||
// bullet[me].do = function() {
|
||||
// // this.force.y += this.mass * 0.0004;
|
||||
// }
|
||||
// }
|
||||
|
||||
} else if (mod.isNailShot) {
|
||||
for (let i = 0; i < 14; i++) {
|
||||
const dir = mech.angle + (Math.random() - 0.5) * spread * 0.2
|
||||
|
||||
@@ -183,8 +183,8 @@ const build = {
|
||||
text += `<div class="pause-grid-module" style = "font-size: 13px;line-height: 120%;padding: 5px;">
|
||||
<strong class='color-d'>damage</strong> increase: ${((mod.damageFromMods()-1)*100).toFixed(0)}%
|
||||
<br><strong class='color-harm'>harm</strong> reduction: ${((1-mech.harmReduction())*100).toFixed(0)}%
|
||||
<br><strong>fire delay</strong> decrease: ${((1-b.fireCD)*100).toFixed(0)}%
|
||||
<br><strong>duplication</strong> chance: ${(Math.min(1,mod.duplicationChance())*100).toFixed(0)}%
|
||||
<br><strong><em>fire delay</em></strong> decrease: ${((1-b.fireCD)*100).toFixed(0)}%
|
||||
<br><strong class='color-dup'>duplication</strong> chance: ${(Math.min(1,mod.duplicationChance())*100).toFixed(0)}%
|
||||
<br>
|
||||
<br><strong class='color-r'>rerolls</strong>: ${powerUps.reroll.rerolls}
|
||||
<br><strong class='color-h'>health</strong>: (${(mech.health*100).toFixed(0)} / ${(mech.maxHealth*100).toFixed(0)}) <strong class='color-f'>energy</strong>: (${(mech.energy*100).toFixed(0)} / ${(mech.maxEnergy*100).toFixed(0)})
|
||||
|
||||
@@ -13,13 +13,14 @@ const level = {
|
||||
start() {
|
||||
if (level.levelsCleared === 0) { //this code only runs on the first level
|
||||
// game.enableConstructMode() //used to build maps in testing mode
|
||||
// level.difficultyIncrease(89)
|
||||
// level.difficultyIncrease(29)
|
||||
// game.zoomScale = 1000;
|
||||
// game.setZoom();
|
||||
// mech.setField("wormhole")
|
||||
// b.giveGuns("laser")
|
||||
// b.giveGuns("shotgun")
|
||||
// mod.isIncendiary = true
|
||||
// mod.is3Missiles = true
|
||||
// mod.giveMod("reallocation")
|
||||
// mod.giveMod("shotgun slug")
|
||||
// mod.giveMod("diffuse beam")
|
||||
|
||||
level.intro(); //starting level
|
||||
@@ -154,7 +155,7 @@ const level = {
|
||||
spawn.mapRect(level.exit.x, level.exit.y + 20, 100, 100); //exit bump
|
||||
// spawn.boost(1500, 0, 900);
|
||||
|
||||
spawn.starter(1900, -500, 20)
|
||||
spawn.starter(1900, -500, 320)
|
||||
// spawn.sucker(2900, -500)
|
||||
// spawn.launcherBoss(1200, -500)
|
||||
// spawn.laserTargetingBoss(1600, -400)
|
||||
|
||||
56
js/mods.js
56
js/mods.js
@@ -270,7 +270,7 @@ const mod = {
|
||||
},
|
||||
{
|
||||
name: "electrostatic discharge",
|
||||
description: "increase <strong class='color-d'>damage</strong> by <strong>20%</strong><br><strong>20%</strong> increased <strong>delay</strong> after firing",
|
||||
description: "increase <strong class='color-d'>damage</strong> by <strong>20%</strong><br><strong>20%</strong> increased <strong><em>delay</em></strong> after firing",
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
allowed() {
|
||||
@@ -287,7 +287,7 @@ const mod = {
|
||||
},
|
||||
{
|
||||
name: "Ψ(t) collapse",
|
||||
description: "<strong>66%</strong> decreased <strong>delay</strong> after firing<br>if you have no <strong class='color-r'>rerolls</strong>",
|
||||
description: "<strong>66%</strong> decreased <strong><em>delay</em></strong> after firing<br>if you have no <strong class='color-r'>rerolls</strong>",
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
allowed() {
|
||||
@@ -307,7 +307,7 @@ const mod = {
|
||||
},
|
||||
{
|
||||
name: "auto-loading heuristics",
|
||||
description: "<strong>30%</strong> decreased <strong>delay</strong> after firing",
|
||||
description: "<strong>30%</strong> decreased <strong><em>delay</em></strong> after firing",
|
||||
maxCount: 9,
|
||||
count: 0,
|
||||
allowed() {
|
||||
@@ -747,7 +747,7 @@ const mod = {
|
||||
},
|
||||
{
|
||||
name: "bot replication",
|
||||
description: "<strong>duplicate</strong> your permanent <strong>bots</strong><br>remove <strong>all</strong> of your <strong class='color-g'>guns</strong>",
|
||||
description: "<strong class='color-dup'>duplicate</strong> your permanent <strong>bots</strong><br>remove <strong>all</strong> of your <strong class='color-g'>guns</strong>",
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
// isNonRefundable: true,
|
||||
@@ -848,9 +848,9 @@ const mod = {
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
allowed() {
|
||||
return mech.Fx > 0.016
|
||||
return mech.Fx > 0.016 && !mod.isEnergyHealth
|
||||
},
|
||||
requires: "speed increase",
|
||||
requires: "speed increase, not mass-energy equivalence",
|
||||
effect() {
|
||||
mod.isSpeedHarm = true
|
||||
},
|
||||
@@ -1061,9 +1061,9 @@ const mod = {
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
allowed() {
|
||||
return !mod.isPiezo && !mod.isTimeAvoidDeath
|
||||
return !mod.isPiezo && !mod.isTimeAvoidDeath && !mod.isSpeedHarm && mech.fieldUpgrades[mech.fieldMode].name !== "negative mass field"
|
||||
},
|
||||
requires: "not piezoelectricity<br>or acute stress response",
|
||||
requires: "not piezoelectricity, acute stress response, 1st law, negative mass field",
|
||||
effect: () => {
|
||||
mech.health = 0
|
||||
// mech.displayHealth();
|
||||
@@ -1306,7 +1306,7 @@ const mod = {
|
||||
},
|
||||
{
|
||||
name: "Bayesian statistics",
|
||||
description: "<strong>16%</strong> chance to <strong>duplicate</strong> spawned <strong>power ups</strong><br>after a <strong>collision</strong>, <strong>eject</strong> one of your <strong class='color-m'>mods</strong>",
|
||||
description: "<strong>16%</strong> chance to <strong class='color-dup'>duplicate</strong> spawned <strong>power ups</strong><br>after a <strong>collision</strong>, <strong>eject</strong> one of your <strong class='color-m'>mods</strong>",
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
allowed() {
|
||||
@@ -1324,7 +1324,7 @@ const mod = {
|
||||
},
|
||||
{
|
||||
name: "stimulated emission",
|
||||
description: "<strong>7%</strong> chance to <strong>duplicate</strong> spawned <strong>power ups</strong>",
|
||||
description: "<strong>7%</strong> chance to <strong class='color-dup'>duplicate</strong> spawned <strong>power ups</strong>",
|
||||
maxCount: 9,
|
||||
count: 0,
|
||||
allowed() {
|
||||
@@ -1342,7 +1342,7 @@ const mod = {
|
||||
},
|
||||
{
|
||||
name: "futures exchange",
|
||||
description: "clicking <strong>X</strong> to cancel a <strong class='color-m'>mod</strong>, <strong class='color-f'>field</strong>, or <strong class='color-g'>gun</strong><br>increases power up <strong>duplication</strong> chance by <strong>4%</strong>",
|
||||
description: "clicking <strong style = 'font-size:150%;'>×</strong> to cancel a <strong class='color-m'>mod</strong>, <strong class='color-f'>field</strong>, or <strong class='color-g'>gun</strong><br>increases power up <strong class='color-dup'>duplication</strong> chance by <strong>4%</strong>",
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
allowed() {
|
||||
@@ -1362,7 +1362,7 @@ const mod = {
|
||||
},
|
||||
{
|
||||
name: "commodities exchange",
|
||||
description: "clicking <strong>X</strong> to cancel a <strong class='color-m'>mod</strong>, <strong class='color-f'>field</strong>, or <strong class='color-g'>gun</strong><br>spawns <strong>6</strong> <strong class='color-h'>heals</strong>, <strong class='color-g'>ammo</strong>, or <strong class='color-r'>rerolls</strong>",
|
||||
description: "clicking <strong style = 'font-size:150%;'>×</strong> to cancel a <strong class='color-m'>mod</strong>, <strong class='color-f'>field</strong>, or <strong class='color-g'>gun</strong><br>spawns <strong>6</strong> <strong class='color-h'>heals</strong>, <strong class='color-g'>ammo</strong>, or <strong class='color-r'>rerolls</strong>",
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
allowed() {
|
||||
@@ -1437,7 +1437,7 @@ const mod = {
|
||||
},
|
||||
{
|
||||
name: "exchange symmetry",
|
||||
description: `spawn <strong>1</strong> <strong class='color-m'>mod</strong><br>with <strong>double</strong> your normal chance for power up <strong>duplication</strong>`,
|
||||
description: `spawn <strong>1</strong> <strong class='color-m'>mod</strong><br>with <strong>double</strong> your normal chance for power up <strong class='color-dup'>duplication</strong>`,
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
isNonRefundable: true,
|
||||
@@ -1905,7 +1905,7 @@ const mod = {
|
||||
},
|
||||
{
|
||||
name: "pneumatic actuator",
|
||||
description: "<strong>nail gun</strong> takes <strong>45%</strong> less time to ramp up<br>to it's shortest <strong>delay</strong> after firing",
|
||||
description: "<strong>nail gun</strong> takes <strong>45%</strong> less time to ramp up<br>to it's shortest <strong><em>delay</em></strong> after firing",
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
allowed() {
|
||||
@@ -1975,11 +1975,11 @@ const mod = {
|
||||
},
|
||||
{
|
||||
name: "nailshot",
|
||||
description: "the <strong>shotgun</strong> fires <strong>nails</strong><br><em>effective at a distance</em>",
|
||||
description: "the <strong>shotgun</strong> fires a burst of <strong>nails</strong>",
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
allowed() {
|
||||
return mod.haveGunCheck("shotgun") && !mod.isIncendiary
|
||||
return mod.haveGunCheck("shotgun") && !mod.isIncendiary && !mod.isSlugShot
|
||||
},
|
||||
requires: "shotgun",
|
||||
effect() {
|
||||
@@ -1989,9 +1989,25 @@ const mod = {
|
||||
mod.isNailShot = false;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "shotgun slug",
|
||||
description: "the <strong>shotgun</strong> fires 1 large <strong>bullet</strong>",
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
allowed() {
|
||||
return mod.haveGunCheck("shotgun") && !mod.isNailShot
|
||||
},
|
||||
requires: "shotgun",
|
||||
effect() {
|
||||
mod.isSlugShot = true;
|
||||
},
|
||||
remove() {
|
||||
mod.isSlugShot = false;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "Newton's 3rd law",
|
||||
description: "the <strong>shotgun</strong> fires <strong>66%</strong> faster<br><strong>recoil</strong> is greatly increased",
|
||||
description: "the <strong>shotgun</strong> fire <strong><em>delay</em></strong> is <strong>66%</strong> faster<br><strong>recoil</strong> is greatly increased",
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
allowed() {
|
||||
@@ -2247,7 +2263,7 @@ const mod = {
|
||||
},
|
||||
{
|
||||
name: "MIRV",
|
||||
description: "launch <strong>3</strong> small <strong>missiles</strong> instead of <strong>1</strong> <br><strong>1.5x</strong> increase in <strong>delay</strong> after firing",
|
||||
description: "launch <strong>3</strong> small <strong>missiles</strong> instead of <strong>1</strong> <br><strong>1.5x</strong> increase in <strong><em>delay</em></strong> after firing",
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
allowed() {
|
||||
@@ -2898,7 +2914,7 @@ const mod = {
|
||||
},
|
||||
{
|
||||
name: "neocognitron",
|
||||
description: "<strong>pulse</strong> automatically <strong>aims</strong> at a nearby mob<br><strong>50%</strong> decreased <strong>delay</strong> after firing",
|
||||
description: "<strong>pulse</strong> automatically <strong>aims</strong> at a nearby mob<br><strong>50%</strong> decreased <strong><em>delay</em></strong> after firing",
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
allowed() {
|
||||
@@ -3237,7 +3253,7 @@ const mod = {
|
||||
},
|
||||
{
|
||||
name: "discrete optimization",
|
||||
description: "increase <strong class='color-d'>damage</strong> by <strong>50%</strong><br><strong>50%</strong> increased <strong>delay</strong> after firing",
|
||||
description: "increase <strong class='color-d'>damage</strong> by <strong>50%</strong><br><strong>50%</strong> increased <strong><em>delay</em></strong> after firing",
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
allowed() {
|
||||
|
||||
@@ -93,9 +93,7 @@ const powerUps = {
|
||||
if (mod.isDeathAvoid && document.getElementById("mod-anthropic")) {
|
||||
document.getElementById("mod-anthropic").innerHTML = `-${powerUps.reroll.rerolls}`
|
||||
}
|
||||
if (mod.renormalization && Math.random() < 0.37 && amount < 0) {
|
||||
powerUps.spawn(mech.pos.x, mech.pos.y, "reroll");
|
||||
}
|
||||
if (mod.renormalization && Math.random() < 0.37 && amount < 0) powerUps.spawn(mech.pos.x, mech.pos.y, "reroll");
|
||||
if (mod.isRerollHaste) {
|
||||
if (powerUps.reroll.rerolls === 0) {
|
||||
mod.rerollHaste = 0.66;
|
||||
|
||||
@@ -94,7 +94,7 @@ const spawn = {
|
||||
me.frictionAir = 0.01;
|
||||
me.memory = Infinity;
|
||||
me.locatePlayer();
|
||||
const density = 0.95
|
||||
const density = 0.9
|
||||
Matter.Body.setDensity(me, density); //extra dense //normal is 0.001 //makes effective life much larger
|
||||
// spawn.shield(me, x, y, 1);
|
||||
me.onDeath = function() {
|
||||
|
||||
Reference in New Issue
Block a user