power up boss adjustments

This commit is contained in:
landgreen
2020-08-04 15:27:32 -07:00
parent 07f77e41a5
commit d13b1fb16d
8 changed files with 56 additions and 79 deletions

View File

@@ -1495,7 +1495,7 @@ const b = {
// ******************************** Guns ********************************************* // ******************************** Guns *********************************************
// ************************************************************************************************** // **************************************************************************************************
// ************************************************************************************************** // **************************************************************************************************
giveGuns(gun = "random", ammoPacks = 6) { giveGuns(gun = "random", ammoPacks = 10) {
if (mod.isOneGun) b.removeAllGuns(); if (mod.isOneGun) b.removeAllGuns();
if (gun === "random") { if (gun === "random") {
//find what guns player doesn't have //find what guns player doesn't have
@@ -1538,8 +1538,8 @@ const b = {
name: "minigun", name: "minigun",
description: "<strong>rapidly</strong> fire a stream of small <strong>bullets</strong><br>fire <strong>delay</strong> decreases as you shoot", description: "<strong>rapidly</strong> fire a stream of small <strong>bullets</strong><br>fire <strong>delay</strong> decreases as you shoot",
ammo: 0, ammo: 0,
ammoPack: 75, ammoPack: 70,
defaultAmmoPack: 75, defaultAmmoPack: 70,
recordedAmmo: 0, recordedAmmo: 0,
have: false, have: false,
nextFireCycle: 0, //use to remember how longs its been since last fire, used to reset count nextFireCycle: 0, //use to remember how longs its been since last fire, used to reset count
@@ -1577,7 +1577,7 @@ const b = {
name: "shotgun", name: "shotgun",
description: "fire a <strong>burst</strong> of short range <strong> bullets</strong> <br><em>crouch to reduce recoil</em>", description: "fire a <strong>burst</strong> of short range <strong> bullets</strong> <br><em>crouch to reduce recoil</em>",
ammo: 0, ammo: 0,
ammoPack: 9, ammoPack: 8,
have: false, have: false,
fire() { fire() {
let knock, spread let knock, spread
@@ -1647,7 +1647,7 @@ const b = {
name: "super balls", name: "super balls",
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: 15, ammoPack: 13,
have: false, have: false,
num: 5, num: 5,
fire() { fire() {
@@ -1702,8 +1702,8 @@ const b = {
name: "flechettes", name: "flechettes",
description: "fire a volley of <strong class='color-p'>uranium-235</strong> <strong>needles</strong><br>does <strong class='color-d'>damage</strong> over <strong>3</strong> seconds", description: "fire a volley of <strong class='color-p'>uranium-235</strong> <strong>needles</strong><br>does <strong class='color-d'>damage</strong> over <strong>3</strong> seconds",
ammo: 0, ammo: 0,
ammoPack: 42, ammoPack: 38,
defaultAmmoPack: 42, defaultAmmoPack: 38,
have: false, have: false,
count: 0, //used to track how many shots are in a volley before a big CD count: 0, //used to track how many shots are in a volley before a big CD
lastFireCycle: 0, //use to remember how longs its been since last fire, used to reset count lastFireCycle: 0, //use to remember how longs its been since last fire, used to reset count
@@ -1806,7 +1806,7 @@ const b = {
name: "wave beam", name: "wave beam",
description: "emit a <strong>sine wave</strong> of oscillating particles<br>particles <strong>slowly</strong> propagate through <strong>solids</strong>", description: "emit a <strong>sine wave</strong> of oscillating particles<br>particles <strong>slowly</strong> propagate through <strong>solids</strong>",
ammo: 0, ammo: 0,
ammoPack: 110, ammoPack: 100,
have: false, have: false,
fire() { fire() {
mech.fireCDcycle = mech.cycle + Math.floor(3 * b.fireCD); // cool down mech.fireCDcycle = mech.cycle + Math.floor(3 * b.fireCD); // cool down
@@ -1941,7 +1941,7 @@ const b = {
name: "missiles", name: "missiles",
description: "launch missiles that <strong>accelerate</strong> towards <strong>mobs</strong><br><strong class='color-e'>explodes</strong> when near target", description: "launch missiles that <strong>accelerate</strong> towards <strong>mobs</strong><br><strong class='color-e'>explodes</strong> when near target",
ammo: 0, ammo: 0,
ammoPack: 5, ammoPack: 4,
have: false, have: false,
fireCycle: 0, fireCycle: 0,
ammoLoaded: 0, ammoLoaded: 0,
@@ -1997,8 +1997,8 @@ const b = {
name: "flak", name: "flak",
description: "fire a <strong>cluster</strong> of short range <strong>projectiles</strong><br><strong class='color-e'>explodes</strong> on <strong>contact</strong> or after half a second", description: "fire a <strong>cluster</strong> of short range <strong>projectiles</strong><br><strong class='color-e'>explodes</strong> on <strong>contact</strong> or after half a second",
ammo: 0, ammo: 0,
ammoPack: 6, ammoPack: 5,
defaultAmmoPack: 6, //use to revert ammoPack after mod changes drop rate defaultAmmoPack: 5, //use to revert ammoPack after mod changes drop rate
have: false, have: false,
fire() { fire() {
mech.fireCDcycle = mech.cycle + Math.floor((mech.crouch ? 25 : 10) * b.fireCD); // cool down mech.fireCDcycle = mech.cycle + Math.floor((mech.crouch ? 25 : 10) * b.fireCD); // cool down
@@ -2041,7 +2041,7 @@ const b = {
name: "grenades", name: "grenades",
description: "lob a single <strong>bouncy</strong> projectile<br><strong class='color-e'>explodes</strong> on <strong>contact</strong> or after one second", description: "lob a single <strong>bouncy</strong> projectile<br><strong class='color-e'>explodes</strong> on <strong>contact</strong> or after one second",
ammo: 0, ammo: 0,
ammoPack: 7, ammoPack: 6,
have: false, have: false,
fire() { fire() {
const me = bullet.length; const me = bullet.length;
@@ -2211,7 +2211,7 @@ const b = {
name: "neutron bomb", name: "neutron bomb",
description: "toss a chunk of <strong class='color-p'>Cf-252</strong> that emits <strong class='color-p'>neutrons</strong><br><strong class='color-d'>damages</strong> and drains <strong class='color-f'>energy</strong> in area of effect", description: "toss a chunk of <strong class='color-p'>Cf-252</strong> that emits <strong class='color-p'>neutrons</strong><br><strong class='color-d'>damages</strong> and drains <strong class='color-f'>energy</strong> in area of effect",
ammo: 0, ammo: 0,
ammoPack: 7, ammoPack: 6,
have: false, have: false,
fire() { fire() {
const me = bullet.length; const me = bullet.length;
@@ -2391,7 +2391,7 @@ const b = {
name: "spores", name: "spores",
description: "fire a <strong>sporangium</strong> that discharges <strong class='color-p' style='letter-spacing: 2px;'>spores</strong><br><strong class='color-p' style='letter-spacing: 2px;'>spores</strong> seek out nearby mobs", description: "fire a <strong>sporangium</strong> that discharges <strong class='color-p' style='letter-spacing: 2px;'>spores</strong><br><strong class='color-p' style='letter-spacing: 2px;'>spores</strong> seek out nearby mobs",
ammo: 0, ammo: 0,
ammoPack: 5, ammoPack: 4,
have: false, have: false,
fire() { fire() {
const me = bullet.length; const me = bullet.length;
@@ -2511,7 +2511,7 @@ const b = {
name: "drones", name: "drones",
description: "deploy drones that <strong>crash</strong> into mobs<br>crashes reduce their <strong>lifespan</strong> by 1 second", description: "deploy drones that <strong>crash</strong> into mobs<br>crashes reduce their <strong>lifespan</strong> by 1 second",
ammo: 0, ammo: 0,
ammoPack: 15, ammoPack: 13,
have: false, have: false,
fire() { fire() {
b.drone(mech.crouch ? 45 : 1) b.drone(mech.crouch ? 45 : 1)
@@ -2522,7 +2522,7 @@ const b = {
name: "ice IX", name: "ice IX",
description: "synthesize <strong>short-lived</strong> ice crystals<br>crystals <strong>seek</strong> out and <strong class='color-s'>freeze</strong> mobs", description: "synthesize <strong>short-lived</strong> ice crystals<br>crystals <strong>seek</strong> out and <strong class='color-s'>freeze</strong> mobs",
ammo: 0, ammo: 0,
ammoPack: 73, ammoPack: 69,
have: false, have: false,
fire() { fire() {
if (mech.crouch) { if (mech.crouch) {
@@ -2539,7 +2539,7 @@ const b = {
name: "foam", name: "foam",
description: "spray bubbly foam that <strong>sticks</strong> to mobs<br><strong class='color-s'>slows</strong> mobs and does <strong class='color-d'>damage</strong> over time", description: "spray bubbly foam that <strong>sticks</strong> to mobs<br><strong class='color-s'>slows</strong> mobs and does <strong class='color-d'>damage</strong> over time",
ammo: 0, ammo: 0,
ammoPack: 50, ammoPack: 45,
have: false, have: false,
fire() { fire() {
mech.fireCDcycle = mech.cycle + Math.floor((mech.crouch ? 20 : 6) * b.fireCD); // cool down mech.fireCDcycle = mech.cycle + Math.floor((mech.crouch ? 20 : 6) * b.fireCD); // cool down

View File

@@ -175,8 +175,8 @@ function collisionChecks(event) {
y: mob[k].velocity.y - 8 * Math.sin(angle) y: mob[k].velocity.y - 8 * Math.sin(angle)
}); });
if (mod.isAnnihilation && !mob[k].shield && !mob[k].isShielded && mech.energy > 0.2) { if (mod.isAnnihilation && !mob[k].shield && !mob[k].isShielded && mech.energy > 0.33) {
mech.energy -= 0.2 mech.energy -= 0.33
mech.immuneCycle = 0; //player doesn't go immune to collision damage mech.immuneCycle = 0; //player doesn't go immune to collision damage
mob[k].death(); mob[k].death();
game.drawList.push({ game.drawList.push({
@@ -224,7 +224,7 @@ function collisionChecks(event) {
if (v > 9) { if (v > 9) {
let dmg = 0.06 * b.dmgScale * v * obj.mass * mod.throwChargeRate; let dmg = 0.06 * b.dmgScale * v * obj.mass * mod.throwChargeRate;
if (mod.isCrit && !mob[k].seePlayer.recall && !mob[k].shield) dmg *= 5 if (mod.isCrit && !mob[k].seePlayer.recall && !mob[k].shield) dmg *= 5
if (mob[k].isShielded) dmg *= 0.4 if (mob[k].isShielded) dmg *= 0.35
mob[k].damage(dmg, true); mob[k].damage(dmg, true);
if (mob[k].distanceToPlayer2() < 1000000) mob[k].foundPlayer(); if (mob[k].distanceToPlayer2() < 1000000) mob[k].foundPlayer();
game.drawList.push({ game.drawList.push({

View File

@@ -306,20 +306,6 @@ const mobs = {
} }
} }
}, },
seePlayerByDistAndLOS() {
if (!(game.cycle % this.seePlayerFreq)) {
if (
this.distanceToPlayer2() < this.seeAtDistance2 &&
Matter.Query.ray(map, this.position, this.mechPosRange()).length === 0 &&
Matter.Query.ray(body, this.position, this.mechPosRange()).length === 0 &&
!mech.isStealth
) {
this.foundPlayer();
} else if (this.seePlayer.recall) {
this.lostPlayer();
}
}
},
isLookingAtPlayer(threshold) { isLookingAtPlayer(threshold) {
const diff = Vector.normalise(Vector.sub(player.position, this.position)); const diff = Vector.normalise(Vector.sub(player.position, this.position));
//make a vector for the mob's direction of length 1 //make a vector for the mob's direction of length 1

View File

@@ -268,14 +268,14 @@ const mod = {
}, },
{ {
name: "electrostatic discharge", name: "electrostatic discharge",
description: "increase <strong class='color-d'>damage</strong> by <strong>25%</strong><br><strong>25%</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>delay</strong> after firing",
maxCount: 1, maxCount: 1,
count: 0, count: 0,
allowed() { allowed() {
return true return true
}, },
effect() { effect() {
mod.slowFire = 1.25 mod.slowFire = 1.2
b.setFireCD(); b.setFireCD();
}, },
remove() { remove() {
@@ -2124,7 +2124,7 @@ const mod = {
}, },
{ {
name: "plasma jet", name: "plasma jet",
description: "increase <strong>plasma torch's</strong> range by <strong>33%</strong>", description: "increase <strong>plasma torch's</strong> range by <strong>27%</strong>",
maxCount: 9, maxCount: 9,
count: 0, count: 0,
allowed() { allowed() {
@@ -2132,7 +2132,7 @@ const mod = {
}, },
requires: "plasma torch", requires: "plasma torch",
effect() { effect() {
mod.isPlasmaRange += 0.33; mod.isPlasmaRange += 0.27;
}, },
remove() { remove() {
mod.isPlasmaRange = 1; mod.isPlasmaRange = 1;
@@ -2174,7 +2174,7 @@ const mod = {
}, },
{ {
name: "annihilation", name: "annihilation",
description: "after <strong>touching</strong> mobs, they are <strong>annihilated</strong><br>drains <strong>20%</strong> of base <strong class='color-f'>energy</strong>", description: "after <strong>touching</strong> mobs, they are <strong>annihilated</strong><br>drains <strong>33%</strong> of base <strong class='color-f'>energy</strong>",
maxCount: 1, maxCount: 1,
count: 0, count: 0,
allowed() { allowed() {
@@ -2214,7 +2214,7 @@ const mod = {
}, },
requires: "standing wave harmonics", requires: "standing wave harmonics",
effect() { effect() {
mod.blockDmg += 0.5 //if you change this value also update the for loop in the electricity graphics in mech.pushMass mod.blockDmg += 0.35 //if you change this value also update the for loop in the electricity graphics in mech.pushMass
}, },
remove() { remove() {
mod.blockDmg = 0; mod.blockDmg = 0;

View File

@@ -972,7 +972,7 @@ const mech = {
//draw electricity //draw electricity
const step = 40 const step = 40
ctx.beginPath(); ctx.beginPath();
for (let i = 0, len = 2 * mod.blockDmg; i < len; i++) { for (let i = 0, len = 2.5 * mod.blockDmg; i < len; i++) {
let x = mech.pos.x - 20 * unit.x; let x = mech.pos.x - 20 * unit.x;
let y = mech.pos.y - 20 * unit.y; let y = mech.pos.y - 20 * unit.y;
ctx.moveTo(x, y); ctx.moveTo(x, y);
@@ -1298,9 +1298,8 @@ const mech = {
}, },
{ {
name: "nano-scale manufacturing", name: "nano-scale manufacturing",
description: "excess <strong class='color-f'>energy</strong> used to build <strong>drones</strong><br><strong class='color-f'>energy</strong> regeneration is <strong>doubled</strong>", description: "excess <strong class='color-f'>energy</strong> used to build <strong>drones</strong><br>increase <strong class='color-f'>energy</strong> regeneration by <strong>100%</strong>",
effect: () => { effect: () => {
// mech.fieldRegen *= 2;
mech.hold = function () { mech.hold = function () {
if (mech.energy > mech.maxEnergy - 0.02 && mech.fieldCDcycle < mech.cycle) { if (mech.energy > mech.maxEnergy - 0.02 && mech.fieldCDcycle < mech.cycle) {
if (mod.isSporeField) { if (mod.isSporeField) {
@@ -1483,7 +1482,7 @@ const mech = {
} else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < mech.cycle) { //not hold but field button is pressed } else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < mech.cycle) { //not hold but field button is pressed
mech.grabPowerUp(); mech.grabPowerUp();
mech.lookForPickUp(); mech.lookForPickUp();
const DRAIN = 0.0017 const DRAIN = 0.002
if (mech.energy > DRAIN) { if (mech.energy > DRAIN) {
mech.energy -= DRAIN; mech.energy -= DRAIN;
if (mech.energy < 0) { if (mech.energy < 0) {
@@ -1492,7 +1491,7 @@ const mech = {
} }
//calculate laser collision //calculate laser collision
let best; let best;
let range = mod.isPlasmaRange * (140 + (mech.crouch ? 400 : 300) * Math.sqrt(Math.random())) //+ 100 * Math.sin(mech.cycle * 0.3); let range = mod.isPlasmaRange * (120 + (mech.crouch ? 400 : 300) * Math.sqrt(Math.random())) //+ 100 * Math.sin(mech.cycle * 0.3);
// const dir = mech.angle // + 0.04 * (Math.random() - 0.5) // const dir = mech.angle // + 0.04 * (Math.random() - 0.5)
const path = [{ const path = [{
x: mech.pos.x + 20 * Math.cos(mech.angle), x: mech.pos.x + 20 * Math.cos(mech.angle),

View File

@@ -488,7 +488,7 @@ const powerUps = {
} }
}, },
addRerollToLevel() { //add a random power up to a location that has a mob, mostly used to give each level one randomly placed reroll addRerollToLevel() { //add a random power up to a location that has a mob, mostly used to give each level one randomly placed reroll
if (mob.length && Math.random() < 0.9) { // 80% chance if (mob.length && Math.random() < 0.8) { // 80% chance
const index = Math.floor(Math.random() * mob.length) const index = Math.floor(Math.random() * mob.length)
powerUps.spawn(mob[index].position.x, mob[index].position.y, "reroll"); powerUps.spawn(mob[index].position.x, mob[index].position.y, "reroll");
if (Math.random() < mod.bayesian) powerUps.spawn(mob[index].position.x, mob[index].position.y, "reroll"); if (Math.random() < mod.bayesian) powerUps.spawn(mob[index].position.x, mob[index].position.y, "reroll");

View File

@@ -81,7 +81,8 @@ const spawn = {
} }
} }
}, },
randomLevelBoss(x, y, options = ["shooterBoss", "cellBossCulture", "bomberBoss", "spiderBoss", "launcherBoss", "laserTargetingBoss", "powerUpBoss"]) { //"shooterBoss", "cellBossCulture", "bomberBoss", "spiderBoss", "launcherBoss", "laserTargetingBoss",
randomLevelBoss(x, y, options = ["powerUpBoss"]) {
// other bosses: suckerBoss, laserBoss, tetherBoss, snakeBoss //all need a particular level to work so they are not included // other bosses: suckerBoss, laserBoss, tetherBoss, snakeBoss //all need a particular level to work so they are not included
spawn[options[Math.floor(Math.random() * options.length)]](x, y) spawn[options[Math.floor(Math.random() * options.length)]](x, y)
}, },
@@ -108,7 +109,7 @@ const spawn = {
this.gravity(); this.gravity();
this.checkStatus(); this.checkStatus();
if (this.seePlayer.recall) { if (this.seePlayer.recall) {
this.seePlayerByDistAndLOS(); this.seePlayerCheck();
this.attraction(); this.attraction();
//tether to other blocks //tether to other blocks
ctx.beginPath(); ctx.beginPath();
@@ -116,7 +117,7 @@ const spawn = {
if (mob[i].isGrouper && mob[i] != this && mob[i].dropPowerUp) { //don't tether to self, bullets, shields, ... if (mob[i].isGrouper && mob[i] != this && mob[i].dropPowerUp) { //don't tether to self, bullets, shields, ...
const distance2 = Vector.magnitudeSquared(Vector.sub(this.position, mob[i].position)) const distance2 = Vector.magnitudeSquared(Vector.sub(this.position, mob[i].position))
if (distance2 < this.groupingRangeMax) { if (distance2 < this.groupingRangeMax) {
if (!mob[i].seePlayer.recall) mob[i].seePlayerByDistAndLOS(); //wake up sleepy mobs if (!mob[i].seePlayer.recall) mob[i].seePlayerCheck(); //wake up sleepy mobs
if (distance2 > this.groupingRangeMin) { if (distance2 > this.groupingRangeMin) {
const angle = Math.atan2(mob[i].position.y - this.position.y, mob[i].position.x - this.position.x); const angle = Math.atan2(mob[i].position.y - this.position.y, mob[i].position.x - this.position.x);
const forceMag = this.groupingStrength * mob[i].mass; const forceMag = this.groupingStrength * mob[i].mass;
@@ -231,23 +232,28 @@ const spawn = {
mobs.spawn(x, y, vertices, radius, "transparent"); mobs.spawn(x, y, vertices, radius, "transparent");
let me = mob[mob.length - 1]; let me = mob[mob.length - 1];
me.isBoss = true; me.isBoss = true;
me.frictionAir = 0.05 me.frictionAir = 0.025
me.seeAtDistance2 = 600000; me.seeAtDistance2 = 9000000;
me.accelMag = 0.0005 * game.accelScale; me.accelMag = 0.0006 * game.accelScale;
if (map.length) me.searchTarget = map[Math.floor(Math.random() * (map.length - 1))].position; //required for search Matter.Body.setDensity(me, 0.002); //normal is 0.001
Matter.Body.setDensity(me, 0.001); //normal is 0.001
me.collisionFilter.mask = cat.bullet | cat.player me.collisionFilter.mask = cat.bullet | cat.player
// me.memory = 480; me.memory = Infinity;
// me.seePlayerFreq = 40 + Math.floor(10 * Math.random()) me.seePlayerFreq = 85 + Math.floor(10 * Math.random())
me.lockedOn = null; me.lockedOn = null;
if (vertices === 9) { if (vertices === 9) {
//on primary spawn
powerUps.spawnBossPowerUp(me.position.x, me.position.y) powerUps.spawnBossPowerUp(me.position.x, me.position.y)
powerUp[powerUp.length - 1].collisionFilter.mask = 0 powerUps.spawn(me.position.x, me.position.y, "heal");
me.powerUpInventory = [powerUp[powerUp.length - 1]]; powerUps.spawn(me.position.x, me.position.y, "ammo");
} else {
me.foundPlayer();
} }
me.onDeath = function () { me.onDeath = function () {
this.leaveBody = false;
this.dropPowerUp = false;
if (vertices > 3) spawn.powerUpBoss(this.position.x, this.position.y, vertices - 1) if (vertices > 3) spawn.powerUpBoss(this.position.x, this.position.y, vertices - 1)
for (let i = 0; i < powerUp.length; i++) { for (let i = 0; i < powerUp.length; i++) {
powerUp[i].collisionFilter.mask = cat.map | cat.powerUp powerUp[i].collisionFilter.mask = cat.map | cat.powerUp
@@ -266,7 +272,7 @@ const spawn = {
}) })
} }
this.seePlayerByLookingAt(); this.seePlayerCheckByDistance();
this.attraction(); this.attraction();
this.checkStatus(); this.checkStatus();
}; };

View File

@@ -1,27 +1,13 @@
removed eay to aim setting power up level boss: adjustments
the addition of gun selection make this setting less important
mod: bot upgrades - forked into 4 different mods for each bot
effect is increased to 100% improvement (up from 40%)
drones are more likely to pick up power ups
mod harvester: now also gives the drone immortality
new level boss: after it dies it returns with one less vertex
also it steals all your power ups (what!)
************** TODO - n-gon ************** ************** TODO - n-gon **************
ghosters are always visible level concept: several stationary platforms that are free to rotate, but with some air friction
ghoster mobs eat power ups and drop them on death
draw ghoster if it has a power up
or just always draw ghoster?
if no power ups on map go for player
give mobs more animal-like behaviors foam isFoamGrowOnDeath causes performance issues when too many mobs die fast
like rain world
give mobs something to do when they don't see player give mobs more animal-like behaviors like rain world
explore map mobs play, look for food, explore
mobs some times aren't aggressive mobs some times aren't aggressive
when low on life or after taking a large hit when low on life or after taking a large hit
mobs can fight each other mobs can fight each other