plasma ball

plasma ball
  much more damage
  new graphics
  fast decay in mob shields
  works with capacitor
  some bug fixes

paradigm shift: 4->10% chance to give research instead of tech
harpoon density: 0.006->0.005  (lower damage and knock back to mobs)
wormhole: 7->5% duplication chance
pilot wave uses less energy
This commit is contained in:
landgreen
2022-03-23 19:17:56 -07:00
parent dde4432279
commit 6b2b59a115
7 changed files with 156 additions and 81 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@@ -1365,7 +1365,7 @@ const b = {
},
minDmgSpeed: 4,
lookFrequency: Math.floor(7 + Math.random() * 3),
density: tech.harpoonDensity, //0.001 is normal for blocks, 0.006 is normal for harpoon, 0.006*6 when buffed
density: tech.harpoonDensity, //0.001 is normal for blocks, 0.005 is normal for harpoon, 0.005*6 when buffed
drain: 0.004,
beforeDmg(who) {
if (tech.isShieldPierce && who.isShielded) { //disable shields
@@ -1398,7 +1398,7 @@ const b = {
this.caughtPowerUp.effect();
Matter.Composite.remove(engine.world, this.caughtPowerUp);
powerUp.splice(index, 1);
if (tech.isHarpoonPowerUp) tech.harpoonDensity = 0.006 * 6 //0.006 is normal
if (tech.isHarpoonPowerUp) tech.harpoonDensity = 0.005 * 6 //0.005 is normal
} else {
this.dropCaughtPowerUp()
}
@@ -1629,7 +1629,7 @@ const b = {
},
minDmgSpeed: 4,
lookFrequency: Math.floor(7 + Math.random() * 3),
density: tech.harpoonDensity, //0.001 is normal for blocks, 0.006 is normal for harpoon, 0.006*6 when buffed
density: tech.harpoonDensity, //0.001 is normal for blocks, 0.005 is normal for harpoon, 0.005*6 when buffed
beforeDmg(who) {
if (tech.isShieldPierce && who.isShielded) { //disable shields
who.isShielded = false
@@ -1671,7 +1671,7 @@ const b = {
this.caughtPowerUp.effect();
Matter.Composite.remove(engine.world, this.caughtPowerUp);
powerUp.splice(index, 1);
if (tech.isHarpoonPowerUp) tech.harpoonDensity = 0.006 * 6 //0.006 is normal
if (tech.isHarpoonPowerUp) tech.harpoonDensity = 0.005 * 6 //0.006 is normal
} else {
this.dropCaughtPowerUp()
}
@@ -6153,7 +6153,7 @@ const b = {
}
//fire
if ((!input.fire && this.charge > 0.6)) {
tech.harpoonDensity = 0.009 //0.001 is normal for blocks, 0.006 is normal for harpoon, 0.006*6 when buffed
tech.harpoonDensity = 0.008 //0.001 is normal for blocks, 0.005 is normal for harpoon, 0.005*6 when buffed
const where = {
x: m.pos.x + 30 * Math.cos(m.angle),
y: m.pos.y + 30 * Math.sin(m.angle)
@@ -6208,7 +6208,8 @@ const b = {
const recoil = Vector.mult(Vector.normalise(Vector.sub(where, m.pos)), input.down ? 0.03 : 0.06)
player.force.x -= recoil.x
player.force.y -= recoil.y
tech.harpoonDensity = 0.01 //0.001 is normal for blocks, 0.006 is normal for harpoon, 0.006*6 when buffed
tech.harpoonDensity = 0.008 //0.001 is normal for blocks, 0.005 is normal for harpoon, 0.005*6 when buffed
const harpoonSize = tech.isLargeHarpoon ? 1 + 0.1 * Math.sqrt(this.ammo) : 1
if (tech.extraHarpoons) {
let targetCount = 0
@@ -6412,7 +6413,7 @@ const b = {
const recoil = Vector.mult(Vector.normalise(Vector.sub(where, m.pos)), input.down ? 0.015 : 0.035)
player.force.x -= recoil.x
player.force.y -= recoil.y
tech.harpoonDensity = 0.006 //0.001 is normal for blocks, 0.006 is normal for harpoon, 0.006*6 when buffed
tech.harpoonDensity = 0.005 //0.001 is normal for blocks, 0.005 is normal for harpoon, 0.005*6 when buffed
},
// railGun2() {
// const where = {

View File

@@ -18,7 +18,7 @@ const level = {
// m.setField("metamaterial cloaking")
// b.giveGuns("harpoon")
// tech.giveTech("grappling hook")
// tech.giveTech("bulk modulus")
// tech.giveTech("capacitor bank")
// for (let i = 0; i < 2; i++) powerUps.directSpawn(0, 0, "tech");
// for (let i = 0; i < 9; i++) tech.giveTech("dynamo-bot")
// for (let i = 10; i < tech.tech.length; i++) { tech.tech[i].isBanished = true }
@@ -32,7 +32,7 @@ const level = {
// level.difficultyIncrease(30) //30 is near max on hard //60 is near max on why
// simulation.enableConstructMode() //used to build maps in testing mode
// level.reactor();
// level.pavilion(); //not in rotation, used for testing
// level.testing(); //not in rotation, used for testing
if (simulation.isTraining) { level.walk(); } else { level.intro(); } //normal starting level ************************************************
// powerUps.research.changeRerolls(3000)
// for (let i = 0; i < 30; i++) powerUps.spawn(player.position.x + Math.random() * 50, player.position.y - Math.random() * 50, "tech", false);
@@ -113,9 +113,7 @@ const level = {
for (let i = 0; i < 2; i++) powerUps.spawn(level.exit.x + 10 * (Math.random() - 0.5), level.exit.y - 100 + 10 * (Math.random() - 0.5), "tech", false) //exit
// for (let i = 0; i < 2; i++) powerUps.spawn(player.position.x + 90 * (Math.random() - 0.5), player.position.y + 90 * (Math.random() - 0.5), "tech", false); //start
}
if (m.plasmaBall) {
m.plasmaBall.isOn = false
}
if (m.plasmaBall) m.plasmaBall.isOn = false
},
trainingText(say) {
simulation.lastLogTime = 0; //clear previous messages
@@ -2543,11 +2541,11 @@ const level = {
spawn.mapRect(4850, -275, 50, 175);
//???
level.difficultyIncrease(5) //30 is near max on hard //60 is near max on why
level.difficultyIncrease(15) //30 is near max on hard //60 is near max on why
m.addHealth(Infinity)
// spawn.starter(1900, -500, 200) //big boy
for (let i = 0; i < 10; ++i) spawn.launcher(1900, -500)
spawn.starter(1900, -500, 200) //big boy
// for (let i = 0; i < 10; ++i) spawn.launcher(1900, -500)
// spawn.slashBoss(1900, -500)
// spawn.launcherBoss(3200, -500)
// spawn.laserTargetingBoss(1700, -500)

View File

@@ -2103,16 +2103,12 @@ const m = {
mask: 0 //cat.body | cat.map | cat.mob | cat.mobBullet | cat.mobShield
},
frictionAir: 0,
// radius: 1,
// friction: 0,
// frictionStatic: 0,
// restitution: 0,
alpha: 0.6,
isAttached: false,
isOn: false,
drain: 0.0012,
drain: 0.0015,
radiusLimit: 10,
damage: 0.18,
damage: 0.4,
setPositionToNose() {
const nose = { x: m.pos.x + 10 * Math.cos(m.angle), y: m.pos.y + 10 * Math.sin(m.angle) }
Matter.Body.setPosition(this, Vector.add(nose, Vector.mult(Vector.normalise(Vector.sub(nose, m.pos)), this.circleRadius)));
@@ -2120,38 +2116,94 @@ const m = {
fire() {
this.isAttached = false;
const speed = 4 //scale with mass?
// Matter.Body.setVelocity(this, {
// x: speed * Math.cos(m.angle),
// y: speed * Math.sin(m.angle)
// });
Matter.Body.setVelocity(this, {
x: 0.4 * player.velocity.x + speed * Math.cos(m.angle),
y: 0.2 * player.velocity.y + speed * Math.sin(m.angle)
x: player.velocity.x * 0.5 + speed * Math.cos(m.angle),
y: player.velocity.y * 0.2 + speed * Math.sin(m.angle)
});
m.plasmaBall.setPositionToNose()
},
scale(scale) {
Matter.Body.scale(m.plasmaBall, scale, scale); //shrink fast
if (this.circleRadius < this.radiusLimit) this.isOn = false
},
do() {
if (this.isOn) {
//collisions with map
if (Matter.Query.collides(this, map).length > 0) {
const scale = Math.max(0.7, 0.99 - 1 / m.plasmaBall.circleRadius)
Matter.Body.scale(m.plasmaBall, scale, scale); //shrink fast
if (m.plasmaBall.circleRadius < m.plasmaBall.radiusLimit) this.isOn = false
this.scale(Math.max(0.9, 0.98 - 0.05 / m.plasmaBall.circleRadius))
if (this.speed > 2.5) {
const scale = 0.96
Matter.Body.setVelocity(this, {
x: scale * this.velocity.x,
y: scale * this.velocity.y
});
}
}
//collisions with mobs
const whom = Matter.Query.collides(this, mob)
const dmg = this.damage * m.dmgScale
for (let i = 0, len = whom.length; i < len; i++) {
if (whom[i].bodyA.alive) whom[i].bodyA.damage(dmg);
if (whom[i].bodyB.alive) whom[i].bodyB.damage(dmg);
if (whom[i].bodyA.alive) {
whom[i].bodyA.damage(dmg);
if (whom[i].bodyA.shield) this.scale(Math.max(0.9, 0.99 - 0.5 / m.plasmaBall.circleRadius))
}
if (whom[i].bodyB.alive) {
whom[i].bodyB.damage(dmg);
if (whom[i].bodyB.shield) this.scale(Math.max(0.9, 0.99 - 0.5 / m.plasmaBall.circleRadius))
}
}
//slowly slow down if too fast
if (this.speed > 6) {
const scale = 0.997
Matter.Body.setVelocity(this, {
x: scale * this.velocity.x,
y: scale * this.velocity.y
});
}
//graphics
var gradient = ctx.createRadialGradient(this.position.x, this.position.y, 0, this.position.x, this.position.y, this.circleRadius);
const radius = this.circleRadius * (0.99 + 0.02 * Math.random()) + 3 * Math.random()
const gradient = ctx.createRadialGradient(this.position.x, this.position.y, 0, this.position.x, this.position.y, radius);
this.alpha = 0.5 + 0.1 * Math.random()
gradient.addColorStop(0, `rgba(255,255,255,${this.alpha})`);
gradient.addColorStop(0.2, `rgba(255,200,255,${this.alpha})`);
gradient.addColorStop(1, `rgba(255,0,255,${this.alpha})`);
gradient.addColorStop(0.18 + 0.1 * Math.random(), `rgba(255,150,255,${this.alpha})`);
gradient.addColorStop(0.95, `rgba(255,0,255,${this.alpha})`);
// gradient.addColorStop(1, `rgba(255,150,255,${this.alpha})`);
ctx.fillStyle = gradient
ctx.beginPath();
ctx.arc(this.position.x, this.position.y, this.circleRadius, 0, 2 * Math.PI);
ctx.arc(this.position.x, this.position.y, radius, 0, 2 * Math.PI);
ctx.fill();
//draw arcs
const unit = Vector.rotate({ x: 1, y: 0 }, Math.random() * 6.28)
let len = 8
const step = this.circleRadius / len
let x = this.position.x
let y = this.position.y
ctx.beginPath();
if (Math.random() < 0.5) {
x += step * (unit.x + 6 * (Math.random() - 0.5))
y += step * (unit.y + 6 * (Math.random() - 0.5))
len -= 2
}
if (Math.random() < 0.5) {
x += step * (unit.x + 6 * (Math.random() - 0.5))
y += step * (unit.y + 6 * (Math.random() - 0.5))
len -= 2
}
ctx.moveTo(x, y);
for (let i = 0; i < len; i++) {
x += step * (unit.x + 1.9 * (Math.random() - 0.5))
y += step * (unit.y + 1.9 * (Math.random() - 0.5))
ctx.lineTo(x, y);
}
ctx.strokeStyle = "#88f";
ctx.lineWidth = 2 * Math.random();
ctx.stroke();
}
},
});
@@ -2176,20 +2228,32 @@ const m = {
m.plasmaBall.setPositionToNose()
}
} else if (m.energy > m.plasmaBall.drain) { //charge up when attached
m.energy -= m.plasmaBall.drain;
const scale = 1 + 5 * Math.pow(Math.max(1, m.plasmaBall.circleRadius), -1.5)
Matter.Body.scale(m.plasmaBall, scale, scale); //grow
if (tech.isCapacitor) {
m.energy -= m.plasmaBall.drain * 4;
const scale = 1 + 5 * 16 * Math.pow(Math.max(1, m.plasmaBall.circleRadius), -1.8)
Matter.Body.scale(m.plasmaBall, scale, scale); //grow
} else {
m.energy -= m.plasmaBall.drain;
const scale = 1 + 16 * Math.pow(Math.max(1, m.plasmaBall.circleRadius), -1.8)
Matter.Body.scale(m.plasmaBall, scale, scale); //grow
}
m.plasmaBall.setPositionToNose()
//add friction for player when holding ball, maybe more friction in vertical
} else {
m.fieldCDcycle = m.cycle + 90;
m.plasmaBall.fire()
}
} else if (m.holdingTarget && m.fieldCDcycle < m.cycle) { //holding, but field button is released
m.pickUp();
if (m.plasmaBall.isAttached) {
m.fieldCDcycle = m.cycle + 30;
m.plasmaBall.fire()
}
} else {
m.holdingTarget = null; //clears holding target (this is so you only pick up right after the field button is released and a hold target exists)
if (m.plasmaBall.isAttached) {
@@ -2200,6 +2264,7 @@ const m = {
m.drawFieldMeter("rgba(0, 0, 0, 0.2)")
m.plasmaBall.do()
console.log(m.plasmaBall.isAttached)
}
@@ -2903,7 +2968,7 @@ const m = {
for (let i = 0, len = body.length; i < len; ++i) {
if (Vector.magnitude(Vector.sub(body[i].position, m.fieldPosition)) < m.fieldRadius && !body[i].isNotHoldable) {
const DRAIN = speed * body[i].mass * 0.000005 // * (1 + m.energy * m.energy) //drain more energy when you have more energy
const DRAIN = speed * body[i].mass * 0.0000035 // * (1 + m.energy * m.energy) //drain more energy when you have more energy
if (m.energy > DRAIN) {
m.energy -= DRAIN;
Matter.Body.setVelocity(body[i], velocity); //give block mouse velocity
@@ -2988,10 +3053,10 @@ const m = {
},
{
name: "wormhole",
description: "use <strong class='color-f'>energy</strong> to <strong>tunnel</strong> through a <strong class='color-worm'>wormhole</strong><br><strong class='color-worm'>wormholes</strong> attract <strong class='color-block'>blocks</strong> and power ups<br><strong>7%</strong> chance to <strong class='color-dup'>duplicate</strong> spawned <strong>power ups</strong>", //<br>bullets may also traverse <strong class='color-worm'>wormholes</strong>
description: "use <strong class='color-f'>energy</strong> to <strong>tunnel</strong> through a <strong class='color-worm'>wormhole</strong><br><strong class='color-worm'>wormholes</strong> attract <strong class='color-block'>blocks</strong> and power ups<br><strong>5%</strong> chance to <strong class='color-dup'>duplicate</strong> spawned <strong>power ups</strong>", //<br>bullets may also traverse <strong class='color-worm'>wormholes</strong>
drain: 0,
effect: function() {
m.duplicateChance = 0.07
m.duplicateChance = 0.05
m.fieldRange = 0
powerUps.setDupChance(); //needed after adjusting duplication chance

View File

@@ -1045,7 +1045,7 @@ const powerUps = {
},
pauseEjectTech(index) {
if (tech.isPauseEjectTech || simulation.testing) {
if (Math.random() < 0.04 || tech.tech[index].isFromAppliedScience) {
if (Math.random() < 0.1 || tech.tech[index].isFromAppliedScience) {
tech.removeTech(index)
powerUps.spawn(m.pos.x + 40 * (Math.random() - 0.5), m.pos.y + 40 * (Math.random() - 0.5), "research", false);
} else {

View File

@@ -3070,7 +3070,7 @@ const tech = {
},
{
name: "paradigm shift",
description: `<strong>clicking</strong> <strong class='color-m'>tech</strong> while paused <strong>ejects</strong> them<br><strong>4%</strong> chance to convert that tech into ${powerUps.orb.research(1)}`,
description: `<strong>clicking</strong> <strong class='color-m'>tech</strong> while paused <strong>ejects</strong> them<br><strong>10%</strong> chance to convert that tech into ${powerUps.orb.research(1)}`,
maxCount: 1,
count: 0,
frequency: 1,
@@ -3859,7 +3859,7 @@ const tech = {
},
{
name: "pneumatic actuator",
description: "<strong>nail gun</strong> takes <strong>no</strong> time to ramp up<br>to it's shortest <strong><em>delay</em></strong> after firing",
description: "<strong>nail gun</strong> takes <strong>no</strong> time to ramp up<br>to its shortest <strong><em>delay</em></strong> after firing",
isGunTech: true,
maxCount: 1,
count: 0,
@@ -5430,16 +5430,16 @@ const tech = {
{
name: "capacitor bank",
// description: "<strong>charge</strong> effects build up almost <strong>instantly</strong><br><em style = 'font-size:97%;'>throwing <strong class='color-block'>blocks</strong>, foam, railgun, pulse, tokamak</em>",
descriptionFunction() { return `<strong>charge</strong> effects build up almost <strong>instantly</strong><br><em style = 'font-size:97%;'>throwing <strong class='color-block'>blocks</strong>, ${tech.haveGunCheck("foam", false) ? "<strong>foam</strong>" : "foam"}, ${tech.isRailGun ? "<strong>railgun</strong>" : "railgun"}, ${tech.isPulseLaser ? "<strong>pulse</strong>" : "pulse"}, ${tech.isTokamak ? "<strong>tokamak</strong>" : "tokamak"}</em>` },
descriptionFunction() { return `<strong>charge</strong> effects build up almost <strong>instantly</strong><br><em style = 'font-size:93%;'>throwing, ${tech.haveGunCheck("foam", false) ? "<strong>foam</strong>" : "foam"}, ${tech.isPlasmaBall ? "<strong>plasma ball</strong>" : "plasma ball"}, ${tech.isRailGun ? "<strong>railgun</strong>" : "railgun"}, ${tech.isPulseLaser ? "<strong>pulse</strong>" : "pulse"}, ${tech.isTokamak ? "<strong>tokamak</strong>" : "tokamak"}</em>` },
isGunTech: true,
maxCount: 1,
count: 0,
frequency: 2,
frequencyDefault: 2,
allowed() {
return tech.blockDamage > 0.075 || tech.isRailGun || tech.haveGunCheck("foam") || tech.isTokamak || tech.isPulseLaser
return tech.blockDamage > 0.075 || tech.isRailGun || tech.haveGunCheck("foam") || tech.isTokamak || tech.isPulseLaser || tech.isPlasmaBall
},
requires: "throwing blocks, railgun, foam, pulse, tokamak",
requires: "throwing blocks, railgun, foam, pulse, tokamak, plasma ball",
effect() {
tech.isCapacitor = true;
for (i = 0, len = b.guns.length; i < len; i++) { //find which gun
@@ -5717,7 +5717,7 @@ const tech = {
},
remove() {
tech.isHarpoonPowerUp = false
tech.harpoonDensity = 0.006
tech.harpoonDensity = 0.005
}
},
{
@@ -6654,7 +6654,7 @@ const tech = {
},
remove() {
tech.isPlasmaBall = false;
if (this.count) m.fieldUpgrades[m.fieldMode].set()
if (this.count && m.fieldUpgrades[m.fieldMode].name === "plasma torch") m.fieldUpgrades[m.fieldMode].set()
}
},
{
@@ -6675,7 +6675,7 @@ const tech = {
},
remove() {
tech.isExtruder = false;
if (this.count) m.fieldUpgrades[m.fieldMode].set()
if (this.count && m.fieldUpgrades[m.fieldMode].name === "plasma torch") m.fieldUpgrades[m.fieldMode].set()
}
},
{

View File

@@ -1,25 +1,46 @@
******************************************************** NEXT PATCH **************************************************
plasma ball
much more damage
new graphics
fast decay in mob shields
works with capacitor
some bug fixes
plasma ball is now live, but it's still in beta
still needs
new graphics
damage balancing
fast decay in mob shields
player angle rotation speed while firing adds to fire speed
tech upgrade to get electrical arcs that randomly damage nearby mobs
current tech synergy
capacitor bank,plasma jet(range?)
reservoir level is less crowded, so you can dodge mobs easier
horizontal flipped version is so reenabled
pure science renamed paradigm shift
difficulty scaling for heal and mob damage reduced 2%
some possible bug fixes, I don't know...
paradigm shift: 4->10% chance to give research instead of tech
harpoon density: 0.006->0.005 (lower damage and knock back to mobs)
wormhole: 7->5% duplication chance
pilot wave uses less energy
******************************************************** TODO ********************************************************
plasma ball
maybe grow faster when you have more energy
or excess energy
change size/alpha when touching mobs
explode when touching mobs like spirit bomb?
player angle rotation speed while firing adds to fire speed
tech upgrade to get electrical arcs that randomly damage nearby mobs
use plasma jet tech?
tech: black hole: gives the plasma ball gravity
plasma orb increases in size and power as it eats enemies
maybe does damage to player to grow faster?
tech that makes it explode when it expires
bug: often game puts player position at NaN
try:
cloaking/harpoon grapple on normal, continue past beating the final boss
clues:
maybe with vanish or other special blocks and grapple hook
very high level for tech, duplication
maybe not about JUNK though
maybe on tons of bullets
maybe grappling hook, Bulk modulus
solution: just kill the player if they go NaN
vanish elements shouldn't collide with mobs
maybe they don't return if mobs are in the way?
maybe they kill mobs in the way
maybe they should go non-collide with mobs
bug: harpoon attack gave a mob really high levels of health
recent events:
had 3 harpoons at a time
@@ -34,17 +55,6 @@ bug: maybe I can put in an event listener to reset inputs to false when you tab
enemies stuck with foam receive upward force over time
only form aerogel tech?
bug: often game puts player position at NaN
try:
cloaking/harpoon grapple on normal, continue past beating the final boss
clues:
maybe with vanish or other special blocks and grapple hook
very high level for tech, duplication
maybe not about JUNK though
maybe on tons of bullets
maybe grappling hook, Bulk modulus
solution: just kill the player if they go NaN
Tech: superglue
Requires: foam + another gun or plasma torch or molecular assembler
Foam bubbles decay 50% slower
@@ -53,9 +63,10 @@ Requires: foam + another gun or plasma torch or molecular assembler
Enemies stuck with foam take 25% more damage
should foam bots gets this also or is that too strong
buff pilot wave damage or lower energy drain
lower base harpoon density
tech: harpoons stick into enemies
detonate after a short delay
attaches mob to wall if possible
firing while harpoon is stuck into an enemy rips it out of them, inflicting damage and stun and pulling them towards you
const ctx = canvas.getContext('2d', {willReadFrequently': true});