new community map! - islands by Richard0820

new community map! - islands by Richard0820
  enable community maps in settings

plasma ball
  tech: corona discharge - increase frequency and range of electric discharges
  several bug fixes

bug fix for some people that can't store settings between reloads
This commit is contained in:
landgreen
2022-03-28 18:58:53 -07:00
parent 4765bda74d
commit d0ed1c6d03
5 changed files with 114 additions and 106 deletions

View File

@@ -1236,9 +1236,13 @@ if (localSettings.isAllowed && !localSettings.isEmpty) {
simulation.isCommunityMaps = localSettings.isCommunityMaps simulation.isCommunityMaps = localSettings.isCommunityMaps
document.getElementById("community-maps").checked = localSettings.isCommunityMaps document.getElementById("community-maps").checked = localSettings.isCommunityMaps
if (localSettings.difficultyMode === undefined) localSettings.difficultyMode = "2"
simulation.difficultyMode = localSettings.difficultyMode simulation.difficultyMode = localSettings.difficultyMode
lore.setTechGoal() lore.setTechGoal()
document.getElementById("difficulty-select").value = localSettings.difficultyMode document.getElementById("difficulty-select").value = localSettings.difficultyMode
if (localSettings.fpsCapDefault === undefined) localSettings.fpsCapDefault = 'max'
if (localSettings.fpsCapDefault === 'max') { if (localSettings.fpsCapDefault === 'max') {
simulation.fpsCapDefault = 999999999; simulation.fpsCapDefault = 999999999;
} else { } else {

View File

@@ -20,16 +20,17 @@ const level = {
// tech.giveTech("grappling hook") // tech.giveTech("grappling hook")
// tech.giveTech("capacitor bank") // tech.giveTech("capacitor bank")
// for (let i = 0; i < 2; i++) powerUps.directSpawn(0, 0, "tech"); // for (let i = 0; i < 2; i++) powerUps.directSpawn(0, 0, "tech");
// for (let i = 0; i < 9; i++) tech.giveTech("overcharge") // for (let i = 0; i < 2; i++) tech.giveTech("corona discharge")
// for (let i = 10; i < tech.tech.length; i++) { tech.tech[i].isBanished = true } // for (let i = 10; i < tech.tech.length; i++) { tech.tech[i].isBanished = true }
// powerUps.research.changeRerolls(100000) // powerUps.research.changeRerolls(100000)
// for (let i = 0; i < 2; i++) tech.giveTech("undefined") // for (let i = 0; i < 5; i++) tech.giveTech("corona discharge")
// tech.tech[297].frequency = 100 // tech.tech[297].frequency = 100
// m.setField("plasma torch") // m.setField("plasma torch")
// tech.giveTech("plasma ball") // tech.giveTech("plasma ball")
// tech.giveTech("extruder")
// m.immuneCycle = Infinity //you can't take damage // m.immuneCycle = Infinity //you can't take damage
// level.difficultyIncrease(30) //30 is near max on hard //60 is near max on why // level.difficultyIncrease(10) //30 is near max on hard //60 is near max on why
// simulation.enableConstructMode() //used to build maps in testing mode // simulation.enableConstructMode() //used to build maps in testing mode
// level.islands(); // level.islands();
// level.testing(); //not in rotation, used for testing // level.testing(); //not in rotation, used for testing
@@ -113,7 +114,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(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 // 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) this.reset() if (m.plasmaBall) m.plasmaBall.reset()
}, },
trainingText(say) { trainingText(say) {
simulation.lastLogTime = 0; //clear previous messages simulation.lastLogTime = 0; //clear previous messages
@@ -2544,8 +2545,8 @@ const level = {
level.difficultyIncrease(15) //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) m.addHealth(Infinity)
// spawn.starter(1900, -500, 200) //big boy spawn.starter(1900, -500, 200) //big boy
for (let i = 0; i < 10; ++i) spawn.launcher(1900, -500) // for (let i = 0; i < 10; ++i) spawn.launcher(1900, -500)
// spawn.slashBoss(1900, -500) // spawn.slashBoss(1900, -500)
// spawn.launcherBoss(3200, -500) // spawn.launcherBoss(3200, -500)
// spawn.laserTargetingBoss(1700, -500) // spawn.laserTargetingBoss(1700, -500)
@@ -8974,6 +8975,7 @@ const level = {
ctx.fillStyle = `rgba(68, 68, 68, ${Math.max(0.3,Math.min((-17650 - m.pos.y) / 100, 0.99))})`; ctx.fillStyle = `rgba(68, 68, 68, ${Math.max(0.3,Math.min((-17650 - m.pos.y) / 100, 0.99))})`;
ctx.fillRect(58390, -17655, 1490, 740); ctx.fillRect(58390, -17655, 1490, 740);
}; };
document.body.style.backgroundColor = "hsl(138, 3%, 74%)";
level.setPosToSpawn(57680, -18330); level.setPosToSpawn(57680, -18330);
level.exit.x = 76343; level.exit.x = 76343;
level.exit.y = -18020; level.exit.y = -18020;
@@ -8981,7 +8983,6 @@ const level = {
spawn.mapRect(level.exit.x, level.exit.y + 20, 100, 30); spawn.mapRect(level.exit.x, level.exit.y + 20, 100, 30);
level.defaultZoom = 2000; level.defaultZoom = 2000;
simulation.zoomTransition(level.defaultZoom); simulation.zoomTransition(level.defaultZoom);
document.body.style.backgroundColor = "#00000";
// spawn.setSpawnList = [ // spawn.setSpawnList = [
// "hopper", // "hopper",
// "slasher", // "slasher",
@@ -9224,7 +9225,6 @@ const level = {
spawn.randomMob(75825, -18150, Infinity); spawn.randomMob(75825, -18150, Infinity);
spawn.randomMob(75575, -18150, Infinity); spawn.randomMob(75575, -18150, Infinity);
spawn.randomGroup(75575, -18150, 0); spawn.randomGroup(75575, -18150, 0);
// powerUps.spawn(59352, -17115, "tech");
level.chain(67250, -19325, 0, true, 14, 20); level.chain(67250, -19325, 0, true, 14, 20);
spawn.mapRect(58725, -18300, 125, 100); spawn.mapRect(58725, -18300, 125, 100);
spawn.mapRect(61100, -18300, 175, 100); spawn.mapRect(61100, -18300, 175, 100);
@@ -9255,20 +9255,21 @@ const level = {
let i = 0, len = Math.min(simulation.difficulty / 20, 6); i < len; let i = 0, len = Math.min(simulation.difficulty / 20, 6); i < len;
++i ++i
) )
spawn.bounceBoss(59025, -17325, 50, true); spawn.bounceBoss(59025, -17325, 50, false);
} else if (Math.random() < 0.5) { } else if (Math.random() < 0.5) {
for ( for (
let i = 0, len = Math.min(simulation.difficulty / 9, 8); i < len; let i = 0, len = Math.min(simulation.difficulty / 9, 8); i < len;
++i ++i
) )
spawn.sprayBoss(59025, -17325, 50, true); spawn.sprayBoss(59025, -17325, 50, false);
} else { } else {
for ( for (
let i = 0, len = Math.min(simulation.difficulty / 6, 10); i < len; let i = 0, len = Math.min(simulation.difficulty / 6, 10); i < len;
++i ++i
) )
spawn.mineBoss(59025, -17325, 50, true); spawn.mineBoss(59025, -17325, 50, false);
} }
powerUps.spawn(59352, -17115, "tech");
// for (let i = 0, len = 3 + simulation.difficulty / 20; i < len; ++i) spawn.mantisBoss(1487 + 300 * i, -1525, 35, false) // for (let i = 0, len = 3 + simulation.difficulty / 20; i < len; ++i) spawn.mantisBoss(1487 + 300 * i, -1525, 35, false)
} }
simulation.fallHeight = -15000; simulation.fallHeight = -15000;

View File

@@ -2086,7 +2086,7 @@ const m = {
set() { set() {
b.isExtruderOn = false b.isExtruderOn = false
if (m.plasmaBall) { if (m.plasmaBall) {
m.plasmaBall.isOn = false m.plasmaBall.reset()
Matter.Composite.remove(engine.world, m.plasmaBall); Matter.Composite.remove(engine.world, m.plasmaBall);
} }
if (tech.isPlasmaBall) { if (tech.isPlasmaBall) {
@@ -2112,15 +2112,12 @@ const m = {
fire() { fire() {
this.isAttached = false; this.isAttached = false;
const speed = 6 //scale with mass? const speed = 6 //scale with mass?
// Matter.Body.setVelocity(this, {
// x: speed * Math.cos(m.angle),
// y: speed * Math.sin(m.angle)
// });
Matter.Body.setVelocity(this, { Matter.Body.setVelocity(this, {
x: player.velocity.x * 0.5 + speed * Math.cos(m.angle), x: player.velocity.x * 0.4 + speed * Math.cos(m.angle),
y: player.velocity.y * 0.1 + speed * Math.sin(m.angle) y: speed * Math.sin(m.angle)
}); });
m.plasmaBall.setPositionToNose() m.plasmaBall.setPositionToNose()
if (this.circleRadius < 10) this.isPopping = true
}, },
scale(scale) { scale(scale) {
Matter.Body.scale(m.plasmaBall, scale, scale); //shrink fast Matter.Body.scale(m.plasmaBall, scale, scale); //shrink fast
@@ -2188,11 +2185,11 @@ const m = {
//damage nearby mobs //damage nearby mobs
const dmg = this.damage * m.dmgScale const dmg = this.damage * m.dmgScale
const arcList = [] const arcList = []
const dischargeRange = 150 + 1600 * tech.plasmaDischarge + 1.3 * this.circleRadius
for (let i = 0, len = mob.length; i < len; i++) { for (let i = 0, len = mob.length; i < len; i++) {
if (!mob[i].isBadTarget && mob[i].alive) {
const sub = Vector.magnitude(Vector.sub(this.position, mob[i].position)) const sub = Vector.magnitude(Vector.sub(this.position, mob[i].position))
if (sub < this.circleRadius + mob[i].radius) { if (sub < this.circleRadius + mob[i].radius) {
if (mob[i].alive) {
if (!this.isAttached && !mob[i].isMobBullet) this.isPopping = true if (!this.isAttached && !mob[i].isMobBullet) this.isPopping = true
mob[i].damage(dmg); mob[i].damage(dmg);
if (mob[i].speed > 5) { if (mob[i].speed > 5) {
@@ -2206,20 +2203,16 @@ const m = {
y: mob[i].velocity.y * 0.93 y: mob[i].velocity.y * 0.93
}); });
} }
} else if (sub < dischargeRange + mob[i].radius && Matter.Query.ray(map, mob[i].position, this.position).length === 0) {
arcList.push(mob[i]) //populate electrical arc list
} }
} else if (sub < 150 + 1.3 * this.circleRadius + mob[i].radius && !(m.cycle % 20)) { //populate electrical arc list
arcList.push(mob[i])
// mob[i].damage(dmg * 0.1);
} }
} }
// for (let i = 0; i < arcList.length; i++) {
if (arcList.length) { if (tech.plasmaDischarge > Math.random()) {
const who = arcList[Math.floor(Math.random() * arcList.length)] const who = arcList[Math.floor(Math.random() * arcList.length)]
who.damage(dmg * 5); who.damage(dmg * 4);
//draw arcs //draw arcs
// const unit = Vector.rotate({ x: 1, y: 0 }, Math.random() * 6.28)
const sub = Vector.sub(who.position, this.position) const sub = Vector.sub(who.position, this.position)
const unit = Vector.normalise(sub) const unit = Vector.normalise(sub)
let len = 12 let len = 12
@@ -2229,17 +2222,25 @@ const m = {
ctx.beginPath(); ctx.beginPath();
ctx.moveTo(x, y); ctx.moveTo(x, y);
for (let i = 0; i < len; i++) { for (let i = 0; i < len; i++) {
x += step * (unit.x + 1 * (Math.random() - 0.5)) x += step * (unit.x + (Math.random() - 0.5))
y += step * (unit.y + 1 * (Math.random() - 0.5)) y += step * (unit.y + (Math.random() - 0.5))
ctx.lineTo(x, y); ctx.lineTo(x, y);
} }
ctx.lineTo(who.position.x, who.position.y); ctx.lineTo(who.position.x, who.position.y);
ctx.strokeStyle = "#88f"; ctx.strokeStyle = "#88f";
ctx.lineWidth = 4 + Math.random(); ctx.lineWidth = 4 + 3 * Math.random();
ctx.stroke(); ctx.stroke();
if (who.damageReduction) {
simulation.drawList.push({
x: who.position.x,
y: who.position.y,
radius: 15,
color: "rgba(150,150,255,0.4)",
time: 15
});
}
}
} }
//slowly slow down if too fast //slowly slow down if too fast
@@ -2254,7 +2255,7 @@ const m = {
//graphics //graphics
const radius = this.circleRadius * (0.99 + 0.02 * Math.random()) + 3 * Math.random() 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); const gradient = ctx.createRadialGradient(this.position.x, this.position.y, 0, this.position.x, this.position.y, radius);
const alpha = this.alpha + 0.15 * Math.random() const alpha = this.alpha + 0.1 * Math.random()
gradient.addColorStop(0, `rgba(255,255,255,${alpha})`); gradient.addColorStop(0, `rgba(255,255,255,${alpha})`);
gradient.addColorStop(0.35 + 0.1 * Math.random(), `rgba(255,150,255,${alpha})`); gradient.addColorStop(0.35 + 0.1 * Math.random(), `rgba(255,150,255,${alpha})`);
gradient.addColorStop(1, `rgba(255,0,255,${alpha})`); gradient.addColorStop(1, `rgba(255,0,255,${alpha})`);
@@ -2315,7 +2316,11 @@ const m = {
} else { } else {
m.plasmaBall.isAttached = true m.plasmaBall.isAttached = true
m.plasmaBall.isOn = true m.plasmaBall.isOn = true
m.plasmaBall.isPopping = false
m.plasmaBall.alpha = 0.7
m.plasmaBall.setPositionToNose() m.plasmaBall.setPositionToNose()
// m.plasmaBall.reset()
} }
// const scale = 0.7 // const scale = 0.7
// Matter.Body.scale(m.plasmaBall, scale, scale); //shrink fast // Matter.Body.scale(m.plasmaBall, scale, scale); //shrink fast

View File

@@ -6637,27 +6637,6 @@ const tech = {
if (this.count > 0) powerUps.research.changeRerolls(this.count * 2) if (this.count > 0) powerUps.research.changeRerolls(this.count * 2)
} }
}, },
{
name: "plasma ball",
description: "<strong>grow</strong> an expanding <strong>ball</strong> of <strong class='color-plasma'>plasma</strong><br>increases <strong class='color-d'>damage</strong> and <strong class='color-f'>energy</strong> drain",
isFieldTech: true,
maxCount: 1,
count: 0,
frequency: 2,
frequencyDefault: 2,
allowed() {
return m.fieldUpgrades[m.fieldMode].name === "plasma torch" && !tech.isExtruder && tech.isPlasmaRange === 1
},
requires: "plasma torch, not extruder, plasma jet",
effect() {
tech.isPlasmaBall = true;
m.fieldUpgrades[m.fieldMode].set()
},
remove() {
tech.isPlasmaBall = false;
if (this.count && m.fieldUpgrades[m.fieldMode].name === "plasma torch") m.fieldUpgrades[m.fieldMode].set()
}
},
{ {
name: "extruder", name: "extruder",
description: "<strong>extrude</strong> a thin hot wire of <strong class='color-plasma'>plasma</strong><br>increases <strong class='color-d'>damage</strong> and <strong class='color-f'>energy</strong> drain", description: "<strong>extrude</strong> a thin hot wire of <strong class='color-plasma'>plasma</strong><br>increases <strong class='color-d'>damage</strong> and <strong class='color-f'>energy</strong> drain",
@@ -6692,37 +6671,52 @@ const tech = {
}, },
requires: "extruder", requires: "extruder",
effect() { effect() {
tech.extruderRange += 50 tech.extruderRange += 60
}, },
remove() { remove() {
tech.extruderRange = 15 tech.extruderRange = 15
} }
}, },
// { {
// name: "CPT gun", name: "plasma ball",
// link: `<a target="_blank" href='https://en.wikipedia.org/wiki/CPT_symmetry' class="link">CPT gun</a>`, description: "<strong>grow</strong> an expanding <strong>ball</strong> of <strong class='color-plasma'>plasma</strong><br>increases <strong class='color-d'>damage</strong> and <strong class='color-f'>energy</strong> drain",
// description: `adds the <strong>CPT</strong> <strong class='color-g'>gun</strong> to your inventory<br>it <strong>rewinds</strong> your <strong class='color-h'>health</strong>, <strong>velocity</strong>, and <strong>position</strong>`, isFieldTech: true,
// isGunTech: true, maxCount: 1,
// maxCount: 1, count: 0,
// count: 0, frequency: 2,
// frequency: 2, frequencyDefault: 2,
// frequencyDefault: 2, allowed() {
// allowed() { return m.fieldUpgrades[m.fieldMode].name === "plasma torch" && !tech.isExtruder && tech.isPlasmaRange === 1
// return (b.totalBots() > 3 || m.fieldUpgrades[m.fieldMode].name === "molecular assembler" || m.fieldUpgrades[m.fieldMode].name === "plasma torch" || m.fieldUpgrades[m.fieldMode].name === "pilot wave") && !tech.isEnergyHealth && !tech.isRewindAvoidDeath //build.isExperimentSelection || },
// }, requires: "plasma torch, not extruder, plasma jet",
// requires: "bots > 3, plasma torch, assembler, pilot wave, not mass-energy equivalence, CPT", effect() {
// effect() { tech.isPlasmaBall = true;
// tech.isRewindGun = true m.fieldUpgrades[m.fieldMode].set()
// b.guns.push(b.gunRewind) },
// b.giveGuns("CPT gun"); remove() {
// }, tech.isPlasmaBall = false;
// remove() { if (this.count && m.fieldUpgrades[m.fieldMode].name === "plasma torch") m.fieldUpgrades[m.fieldMode].set()
// if (tech.isRewindGun) { }
// b.removeGun("CPT gun", true) },
// tech.isRewindGun = false {
// } name: "corona discharge",
// } description: "increase the <strong>range</strong> and <strong>frequency</strong><br>of <strong class='color-plasma'>plasma</strong> ball's <strong>electric arc</strong> ",
// }, isFieldTech: true,
maxCount: 9,
count: 0,
frequency: 2,
frequencyDefault: 2,
allowed() {
return m.fieldUpgrades[m.fieldMode].name === "plasma torch" && !tech.isExtruder && tech.isPlasmaRange === 1
},
requires: "plasma torch, not extruder, plasma jet",
effect() {
tech.plasmaDischarge += 0.03
},
remove() {
tech.plasmaDischarge = 0.01 //default chance per cycle of a discharge
}
},
{ {
name: "retrocausality", name: "retrocausality",
description: "<strong>time dilation</strong> uses <strong class='color-f'>energy</strong> to <strong>rewind</strong> your<br><strong class='color-h'>health</strong>, <strong>velocity</strong>, and <strong>position</strong> up to <strong>10 s</strong>", description: "<strong>time dilation</strong> uses <strong class='color-f'>energy</strong> to <strong>rewind</strong> your<br><strong class='color-h'>health</strong>, <strong>velocity</strong>, and <strong>position</strong> up to <strong>10 s</strong>",
@@ -9561,5 +9555,6 @@ const tech = {
isImmuneGrapple: null, isImmuneGrapple: null,
isDronesTravel: null, isDronesTravel: null,
isTechDebt: null, isTechDebt: null,
isPlasmaBall: null isPlasmaBall: null,
plasmaDischarge: null
} }

View File

@@ -1,16 +1,19 @@
******************************************************** NEXT PATCH ************************************************** ******************************************************** NEXT PATCH **************************************************
new community map! - islands by Richard0820
enable community maps in settings
plasma ball plasma ball
once released explodes on mobs or map tech: corona discharge - increase frequency and range of electric discharges
slows mobs several bug fixes
grows at 2x rate if you have energy above max
player is slowed when holding plasma ball bug fix for some people that can't store settings between reloads
every 20 cycles damage a nearby mob
next patch plasma ball tech
******************************************************** TODO ******************************************************** ******************************************************** TODO ********************************************************
plasma ball plasma ball
gently scale damage with circleRadius
balance corona discharge
delay on returning to player is annoying delay on returning to player is annoying
scale float effect with ball size scale float effect with ball size
tech upgrades tech upgrades