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
document.getElementById("community-maps").checked = localSettings.isCommunityMaps
if (localSettings.difficultyMode === undefined) localSettings.difficultyMode = "2"
simulation.difficultyMode = localSettings.difficultyMode
lore.setTechGoal()
document.getElementById("difficulty-select").value = localSettings.difficultyMode
if (localSettings.fpsCapDefault === undefined) localSettings.fpsCapDefault = 'max'
if (localSettings.fpsCapDefault === 'max') {
simulation.fpsCapDefault = 999999999;
} else {

View File

@@ -20,16 +20,17 @@ const level = {
// tech.giveTech("grappling hook")
// 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("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 }
// 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
// m.setField("plasma torch")
// tech.giveTech("plasma ball")
// tech.giveTech("extruder")
// 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
// level.islands();
// 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(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) {
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
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)
@@ -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.fillRect(58390, -17655, 1490, 740);
};
document.body.style.backgroundColor = "hsl(138, 3%, 74%)";
level.setPosToSpawn(57680, -18330);
level.exit.x = 76343;
level.exit.y = -18020;
@@ -8981,7 +8983,6 @@ const level = {
spawn.mapRect(level.exit.x, level.exit.y + 20, 100, 30);
level.defaultZoom = 2000;
simulation.zoomTransition(level.defaultZoom);
document.body.style.backgroundColor = "#00000";
// spawn.setSpawnList = [
// "hopper",
// "slasher",
@@ -9224,7 +9225,6 @@ const level = {
spawn.randomMob(75825, -18150, Infinity);
spawn.randomMob(75575, -18150, Infinity);
spawn.randomGroup(75575, -18150, 0);
// powerUps.spawn(59352, -17115, "tech");
level.chain(67250, -19325, 0, true, 14, 20);
spawn.mapRect(58725, -18300, 125, 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;
++i
)
spawn.bounceBoss(59025, -17325, 50, true);
spawn.bounceBoss(59025, -17325, 50, false);
} else if (Math.random() < 0.5) {
for (
let i = 0, len = Math.min(simulation.difficulty / 9, 8); i < len;
++i
)
spawn.sprayBoss(59025, -17325, 50, true);
spawn.sprayBoss(59025, -17325, 50, false);
} else {
for (
let i = 0, len = Math.min(simulation.difficulty / 6, 10); i < len;
++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)
}
simulation.fallHeight = -15000;

View File

@@ -2086,7 +2086,7 @@ const m = {
set() {
b.isExtruderOn = false
if (m.plasmaBall) {
m.plasmaBall.isOn = false
m.plasmaBall.reset()
Matter.Composite.remove(engine.world, m.plasmaBall);
}
if (tech.isPlasmaBall) {
@@ -2112,15 +2112,12 @@ const m = {
fire() {
this.isAttached = false;
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, {
x: player.velocity.x * 0.5 + speed * Math.cos(m.angle),
y: player.velocity.y * 0.1 + speed * Math.sin(m.angle)
x: player.velocity.x * 0.4 + speed * Math.cos(m.angle),
y: speed * Math.sin(m.angle)
});
m.plasmaBall.setPositionToNose()
if (this.circleRadius < 10) this.isPopping = true
},
scale(scale) {
Matter.Body.scale(m.plasmaBall, scale, scale); //shrink fast
@@ -2188,11 +2185,11 @@ const m = {
//damage nearby mobs
const dmg = this.damage * m.dmgScale
const arcList = []
const dischargeRange = 150 + 1600 * tech.plasmaDischarge + 1.3 * this.circleRadius
for (let i = 0, len = mob.length; i < len; i++) {
const sub = Vector.magnitude(Vector.sub(this.position, mob[i].position))
if (sub < this.circleRadius + mob[i].radius) {
if (mob[i].alive) {
if (!mob[i].isBadTarget && mob[i].alive) {
const sub = Vector.magnitude(Vector.sub(this.position, mob[i].position))
if (sub < this.circleRadius + mob[i].radius) {
if (!this.isAttached && !mob[i].isMobBullet) this.isPopping = true
mob[i].damage(dmg);
if (mob[i].speed > 5) {
@@ -2206,42 +2203,46 @@ const m = {
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);
}
}
//
if (arcList.length) {
const who = arcList[Math.floor(Math.random() * arcList.length)]
who.damage(dmg * 5);
//draw arcs
// const unit = Vector.rotate({ x: 1, y: 0 }, Math.random() * 6.28)
const sub = Vector.sub(who.position, this.position)
const unit = Vector.normalise(sub)
let len = 12
const step = Vector.magnitude(sub) / (len + 2)
let x = this.position.x
let y = this.position.y
ctx.beginPath();
ctx.moveTo(x, y);
for (let i = 0; i < len; i++) {
x += step * (unit.x + 1 * (Math.random() - 0.5))
y += step * (unit.y + 1 * (Math.random() - 0.5))
ctx.lineTo(x, y);
for (let i = 0; i < arcList.length; i++) {
if (tech.plasmaDischarge > Math.random()) {
const who = arcList[Math.floor(Math.random() * arcList.length)]
who.damage(dmg * 4);
//draw arcs
const sub = Vector.sub(who.position, this.position)
const unit = Vector.normalise(sub)
let len = 12
const step = Vector.magnitude(sub) / (len + 2)
let x = this.position.x
let y = this.position.y
ctx.beginPath();
ctx.moveTo(x, y);
for (let i = 0; i < len; i++) {
x += step * (unit.x + (Math.random() - 0.5))
y += step * (unit.y + (Math.random() - 0.5))
ctx.lineTo(x, y);
}
ctx.lineTo(who.position.x, who.position.y);
ctx.strokeStyle = "#88f";
ctx.lineWidth = 4 + 3 * Math.random();
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
});
}
}
ctx.lineTo(who.position.x, who.position.y);
ctx.strokeStyle = "#88f";
ctx.lineWidth = 4 + Math.random();
ctx.stroke();
}
//slowly slow down if too fast
if (this.speed > 8) {
const scale = 0.997
@@ -2254,7 +2255,7 @@ const m = {
//graphics
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 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.35 + 0.1 * Math.random(), `rgba(255,150,255,${alpha})`);
gradient.addColorStop(1, `rgba(255,0,255,${alpha})`);
@@ -2315,7 +2316,11 @@ const m = {
} else {
m.plasmaBall.isAttached = true
m.plasmaBall.isOn = true
m.plasmaBall.isPopping = false
m.plasmaBall.alpha = 0.7
m.plasmaBall.setPositionToNose()
// m.plasmaBall.reset()
}
// const scale = 0.7
// 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)
}
},
{
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",
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",
effect() {
tech.extruderRange += 50
tech.extruderRange += 60
},
remove() {
tech.extruderRange = 15
}
},
// {
// name: "CPT gun",
// link: `<a target="_blank" href='https://en.wikipedia.org/wiki/CPT_symmetry' class="link">CPT gun</a>`,
// 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>`,
// isGunTech: true,
// maxCount: 1,
// count: 0,
// frequency: 2,
// frequencyDefault: 2,
// allowed() {
// 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: "bots > 3, plasma torch, assembler, pilot wave, not mass-energy equivalence, CPT",
// effect() {
// tech.isRewindGun = true
// b.guns.push(b.gunRewind)
// b.giveGuns("CPT gun");
// },
// remove() {
// if (tech.isRewindGun) {
// b.removeGun("CPT gun", true)
// tech.isRewindGun = false
// }
// }
// },
{
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: "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",
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,
isDronesTravel: null,
isTechDebt: null,
isPlasmaBall: null
isPlasmaBall: null,
plasmaDischarge: null
}