winter vacation update
mob health tech
tech: cascading failure - +222% damage to mobs below 25% health
tech: yield stress - +55% damage to mobs at maximum health
cloaking tech: topological defect - +88% damage to mobs at maximum health
harpoon tech: brittle - +88% harpoon/grapple damage to mobs at maximum health
cloaking buffs
50->66% defense while cloaked
recloak 0.25s faster
simplified cloaking field graphics
boson composite drains much less energy while moving through mobs and shields
fixed bug where mines and egg mobs were colliding with player while intangible
patch no longer drains energy when you heal on cloaking
metamaterial absorber gets 17->22% chance to spawn a power up for each mob alive
no-cloning theorem changes to 45->40% duplication and 2->1% duplication loss on killing a mob
finalBoss phases:
new: slow zone, antigravity pulse
nerfed: laser, black hole, orbitals
buffed: oscillation, mobs
improved graphics: boulder
Hilbert space has a skin. 99->142% damage increase, but randomize tech after taking damage
Higgs mechanism has a skin. +45->77% fire rate, player can't move while firing
induction furnace gives +77% harpoon/grapple damage for 8 seconds after picking up a power up
collider 50->100% chance to combine and randomize power ups
quenching gives more bonus max health at high difficulty level (maybe around 30% more health)
accretion gives 5->7 heal power ups
dynamo bots follow player much closer when you have many of them
scrap-bots don't follow the player as accurately or as quickly
scrap bot duration 13->15 seconds
JUNK tech: planned obsolescence - make 100 scrap bots that last for about 30 seconds
community map dojo by werid_pusheen
fixed by Cornbread 2100
hard mode gets 1 less heal at the start
hard and why difficulty don't begin with starter mobs
hopBullet mobs last 2 seconds less time
adjusted button heights on train station level to be consistently the same height
This commit is contained in:
526
js/level.js
526
js/level.js
@@ -11,7 +11,7 @@ const level = {
|
||||
// playableLevels: ["pavilion", "pavilion", "pavilion", "pavilion", "pavilion", "pavilion", "pavilion", "pavilion", "pavilion", "pavilion", "pavilion"],
|
||||
//see level.populateLevels: (intro, ... , reservoir or factory, reactor, ... , subway, final) added later
|
||||
playableLevels: ["labs", "rooftops", "skyscrapers", "warehouse", "highrise", "office", "aerie", "satellite", "sewers", "testChamber", "pavilion", "lock"],
|
||||
communityLevels: ["gauntlet", "stronghold", "basement", "crossfire", "vats", "run", "ngon", "house", "perplex", "coliseum", "tunnel", "islands", "temple", "dripp", "biohazard", "stereoMadness", "yingYang", "staircase", "fortress", "commandeer", "clock", "buttonbutton", "downpour", "superNgonBros", "underpass", "cantilever", "tlinat", "ruins", "ace", "crimsonTowers", "LaunchSite", "shipwreck", "unchartedCave"],
|
||||
communityLevels: ["gauntlet", "stronghold", "basement", "crossfire", "vats", "run", "ngon", "house", "perplex", "coliseum", "tunnel", "islands", "temple", "dripp", "biohazard", "stereoMadness", "yingYang", "staircase", "fortress", "commandeer", "clock", "buttonbutton", "downpour", "superNgonBros", "underpass", "cantilever", "tlinat", "ruins", "ace", "crimsonTowers", "LaunchSite", "shipwreck", "unchartedCave", "dojo"],
|
||||
trainingLevels: ["walk", "crouch", "jump", "hold", "throw", "throwAt", "deflect", "heal", "fire", "nailGun", "shotGun", "superBall", "matterWave", "missile", "stack", "mine", "grenades", "harpoon", "diamagnetism"],
|
||||
levels: [],
|
||||
start() {
|
||||
@@ -19,17 +19,15 @@ const level = {
|
||||
// simulation.enableConstructMode() //tech.giveTech('motion sickness') //used to build maps in testing mode
|
||||
// simulation.isHorizontalFlipped = true
|
||||
// tech.giveTech("performance")
|
||||
// level.difficultyIncrease(5 * 4) //30 is near max on hard //60 is near max on why
|
||||
// spawn.setSpawnList();
|
||||
// spawn.setSpawnList();
|
||||
// m.maxHealth = m.health = 100
|
||||
// level.difficultyIncrease(8 * 2) //30 is near max on hard //60 is near max on why
|
||||
// m.maxHealth = m.health = 1
|
||||
// m.maxEnergy = m.energy = 10000000
|
||||
// tech.isRerollDamage = true
|
||||
// powerUps.research.changeRerolls(99999)
|
||||
// m.immuneCycle = Infinity //you can't take damage
|
||||
// tech.tech[297].frequency = 100
|
||||
// m.couplingChange(10)
|
||||
// m.setField("grappling hook") //1 standing wave 2 perfect diamagnetism 3 negative mass 4 molecular assembler 5 plasma torch 6 time dilation 7 metamaterial cloaking 8 pilot wave 9 wormhole 10 grappling hook
|
||||
// m.setField("metamaterial cloaking") //1 standing wave 2 perfect diamagnetism 3 negative mass 4 molecular assembler 5 plasma torch 6 time dilation 7 metamaterial cloaking 8 pilot wave 9 wormhole 10 grappling hook
|
||||
// tech.isHookWire = true
|
||||
// m.energy = 0
|
||||
// simulation.molecularMode = 2
|
||||
@@ -37,22 +35,23 @@ const level = {
|
||||
// b.giveGuns("super balls") //0 nail gun 1 shotgun 2 super balls 3 wave 4 missiles 5 grenades 6 spores 7 drones 8 foam 9 harpoon 10 mine 11 laser
|
||||
// b.giveGuns("harpoon") //0 nail gun 1 shotgun 2 super balls 3 wave 4 missiles 5 grenades 6 spores 7 drones 8 foam 9 harpoon 10 mine 11 laser
|
||||
// b.guns[8].ammo = 100000000
|
||||
// requestAnimationFrame(() => { tech.giveTech("MACHO") });
|
||||
// for (let i = 0; i < 1; ++i) tech.giveTech("degenerate matter")
|
||||
// for (let i = 0; i < 1; ++i) tech.giveTech("reel")
|
||||
// for (let i = 0; i < 1; ++i) tech.giveTech("tokamak")
|
||||
// requestAnimationFrame(() => { for (let i = 0; i < 30; i++) tech.giveTech("laser-bot") });
|
||||
// for (let i = 0; i < 1; i++) tech.giveTech("laser-bot upgrade")
|
||||
// for (let i = 0; i < 1; ++i) tech.giveTech("rupture")
|
||||
// requestAnimationFrame(() => { tech.giveTech("Higgs mechanism") });
|
||||
// for (let i = 0; i < 1; ++i) tech.giveTech("Higgs mechanism")
|
||||
// for (let i = 0; i < 1; ++i) tech.giveTech("topological defect")
|
||||
// for (let i = 0; i < 1; ++i) tech.giveTech("Hilbert space")
|
||||
// requestAnimationFrame(() => { for (let i = 0; i < 10; i++) tech.giveTech("orbital-bot") });
|
||||
// requestAnimationFrame(() => { for (let i = 0; i < 10; i++) b.orbitBot(m.pos, false) });
|
||||
|
||||
// for (let i = 0; i < 1; i++) tech.giveTech("cascading failure")
|
||||
// for (let i = 0; i < 1; ++i) tech.giveTech("induction furnace")
|
||||
// for (let i = 0; i < 1; ++i) tech.giveTech("autonomous defense")
|
||||
// for (let i = 0; i < 3; i++) powerUps.directSpawn(450, -50, "tech");
|
||||
// for (let i = 0; i < 10; i++) powerUps.directSpawn(1750, -500, "research");
|
||||
// for (let i = 0; i < 100; i++) powerUps.directSpawn(1750, -500, "coupling");
|
||||
|
||||
// level.unchartedCave();
|
||||
// level.skyscrapers();
|
||||
|
||||
// for (let i = 0; i < 4; ++i) spawn.hopMother(1900, -500)
|
||||
// for (let i = 0; i < 5; ++i) spawn.starter(1900, -500)
|
||||
// for (let i = 0; i < 10; ++i) spawn.starter(1900, -500, 50)
|
||||
// for (let i = 0; i < 1; ++i) spawn.timeSkipBoss(1900, -2500)
|
||||
// spawn.beetleBoss(1900, -500, 25)
|
||||
// spawn.slasher2(2000, -1150)
|
||||
@@ -64,13 +63,14 @@ const level = {
|
||||
// for (let i = 0; i < 40; ++i) tech.giveTech()
|
||||
|
||||
level[simulation.isTraining ? "walk" : "intro"]() //normal starting level **************************************************
|
||||
|
||||
// spawn.bodyRect(2425, -120, 200, 200);
|
||||
// console.log(body[body.length - 1].mass)
|
||||
// simulation.isAutoZoom = false; //look in close
|
||||
// simulation.zoomScale *= 0.5;
|
||||
// simulation.setZoom();
|
||||
// for (let i = 0; i < 2; ++i) powerUps.directSpawn(m.pos.x + 50 * Math.random(), m.pos.y + 50 * Math.random(), "tech");
|
||||
// for (let i = 0; i < 2; ++i) powerUps.directSpawn(m.pos.x + 50 * Math.random(), m.pos.y + 50 * Math.random(), "boost");
|
||||
// for (let i = 0; i < 2; ++i) powerUps.directSpawn(m.pos.x + 450, m.pos.y + 50 * Math.random(), "boost");
|
||||
// for (let i = 0; i < 20; ++i) powerUps.directSpawn(m.pos.x + 50 * Math.random(), m.pos.y + 50 * Math.random(), "ammo");
|
||||
// for (let i = 0; i < 2; i++) powerUps.spawn(player.position.x + Math.random() * 50, player.position.y - Math.random() * 50, "field", false);
|
||||
//lore testing
|
||||
@@ -2159,8 +2159,9 @@ const level = {
|
||||
spawn.mapRect(475, -25, 25, 50); //edge shelf
|
||||
},
|
||||
intro() {
|
||||
// console.log(level.levelsCleared)
|
||||
if (level.levelsCleared === 0) { //if this is the 1st level of the game
|
||||
if (simulation.difficultyMode > 2) spawn.setSpawnList() // hard and why difficulty don't begin with starter mobs
|
||||
|
||||
//wait to spawn power ups until unpaused
|
||||
//power ups don't spawn in experiment mode, so they don't get removed at the start of experiment mode
|
||||
const goal = simulation.cycle + 10
|
||||
@@ -2172,10 +2173,17 @@ const level = {
|
||||
} else {
|
||||
powerUps.spawnStartingPowerUps(2095 + 15 * (Math.random() - 0.5), -2070 - 125);
|
||||
}
|
||||
if (simulation.difficultyMode < 5) {
|
||||
if (simulation.difficultyMode < 5) { //hard, normal and easy
|
||||
powerUps.spawn(2095 + 15 * (Math.random() - 0.5), -2070 - 25, "heal", false);
|
||||
powerUps.spawn(2095 + 15 * (Math.random() - 0.5), -2070, "research", false);
|
||||
}
|
||||
if (simulation.difficultyMode < 3) { //normal and easy
|
||||
powerUps.spawn(2095 + 15 * (Math.random() - 0.5), -2070 - 75, "heal", false);
|
||||
powerUps.spawn(2095 + 15 * (Math.random() - 0.5), -2070, "research", false); //not on why difficulty
|
||||
}
|
||||
if (simulation.difficultyMode < 2) { //easy
|
||||
powerUps.spawn(2095 + 15 * (Math.random() - 0.5), -2070 - 75, "heal", false);
|
||||
powerUps.spawn(2095 + 15 * (Math.random() - 0.5), -2070, "research", false);
|
||||
powerUps.spawn(2095 + 15 * (Math.random() - 0.5), -2070, "research", false);
|
||||
}
|
||||
} else {
|
||||
requestAnimationFrame(cycle);
|
||||
@@ -2548,7 +2556,6 @@ const level = {
|
||||
|
||||
|
||||
if (mobs.mobDeaths < level.levelsCleared && !simulation.isCheating) { //pacifist run
|
||||
// spawn.setSpawnList();
|
||||
spawn.pickList.splice(0, 1);
|
||||
spawn.pickList.push('starter');
|
||||
spawn.pickList.splice(0, 1);
|
||||
@@ -2662,6 +2669,7 @@ const level = {
|
||||
if (gateButton.isUp) {
|
||||
gateButton.query();
|
||||
if (!gateButton.isUp) {
|
||||
simulation.makeTextLog(`station gate opened`, 360);
|
||||
if (stationNumber > 0) {
|
||||
if (!isExitOpen && gatesOpenRight < stationNumber) level.newLevelOrPhase() //run some new level tech effects
|
||||
gatesOpenRight = stationNumber
|
||||
@@ -2673,7 +2681,7 @@ const level = {
|
||||
gatesOpenRight = stationNumber
|
||||
}
|
||||
if (Math.abs(stationNumber) > 0 && ((Math.abs(stationNumber) + 1) % stationList.length) === 0) {
|
||||
simulation.makeTextLog(`exit opened`);
|
||||
simulation.makeTextLog(`level exit opened`, 360);
|
||||
isExitOpen = true;
|
||||
}
|
||||
}
|
||||
@@ -2725,13 +2733,12 @@ const level = {
|
||||
var gate = level.doorMap(x - 1375, -525, 50, 375, 300, 20, false) //x, y, width, height, distance, speed = 20
|
||||
}
|
||||
}
|
||||
|
||||
spawn.mapRect(x + -1500, -210, 3000, 400);//station floor
|
||||
spawn.mapRect(x + -1775, -1600, 3400, 1100); //center pillar
|
||||
spawn.mapRect(x + -1775, -1600, 3400, 1000); //center pillar
|
||||
spawn.mapRect(x + -4100, -3325, 8000, 700); //roof
|
||||
spawn.mapRect(x + -4100, -3325, 325, 1500);
|
||||
spawn.mapRect(x + 3500, -3325, 400, 1500);
|
||||
spawn.mapRect(x + -225, -575, 450, 425); //lower portal blocks
|
||||
spawn.mapRect(x + -225, -700, 450, 600); //lower portal blocks
|
||||
|
||||
//upper parts
|
||||
spawn.mapRect(x + -1425, -2400, 1900, 50);
|
||||
@@ -3025,7 +3032,7 @@ const level = {
|
||||
}
|
||||
},
|
||||
() => { //portal fling
|
||||
const buttonsCoords = [{ x: x + 775, y: -1695 }, { x: x - 775, y: -800 }, { x: x - 375, y: -2083 },]
|
||||
const buttonsCoords = [{ x: x + 775, y: -1695 }, { x: x - 775, y: -800 }, { x: x - 375, y: -2080 },]
|
||||
const buttonsCoordsIndex = Math.floor(Math.random() * buttonsCoords.length) //pick a random element from the array
|
||||
if (isExitOpen) {
|
||||
level.exit.x = buttonsCoords[buttonsCoordsIndex].x;
|
||||
@@ -3219,7 +3226,7 @@ const level = {
|
||||
}
|
||||
},
|
||||
() => { //jump pads and 6 sided platforms
|
||||
const buttonsCoords = [{ x: x + 275, y: -1817 }, { x: x + 2025, y: -1995 }, { x: x - 2025, y: -2420 }, { x: x - 2100, y: -1995 }]
|
||||
const buttonsCoords = [{ x: x + 278, y: -1814 }, { x: x + 778, y: -1814 }, { x: x + 2025, y: -1995 }, { x: x - 2025, y: -2425 }, { x: x - 2100, y: -1995 }]
|
||||
const buttonsCoordsIndex = Math.floor(Math.random() * buttonsCoords.length) //pick a random element from the array
|
||||
if (isExitOpen) {
|
||||
level.exit.x = buttonsCoords[buttonsCoordsIndex].x;
|
||||
@@ -3375,7 +3382,7 @@ const level = {
|
||||
}
|
||||
},
|
||||
]
|
||||
// stations[1]() //for testing a specific station
|
||||
// stations[4]() //for testing a specific station
|
||||
stations[stationList[Math.abs(stationNumber % stationList.length)]]() //*************** run this one when uploading
|
||||
//add in standard station map infrastructure
|
||||
spawn.mapRect(x + -8000, 0, 16000, 800);//tunnel floor
|
||||
@@ -5034,10 +5041,12 @@ const level = {
|
||||
powerUps.directSpawn(x + 1950, y - 1525, "ammo");
|
||||
powerUps.directSpawn(x + 1900, y - 1525, "ammo");
|
||||
spawn.hopMotherBoss(x + 800, y + -2200)
|
||||
for (let i = 0; i < 6; ++i) spawn.hopBullet(x + 150 + 750 * Math.random(), y + -1600)
|
||||
for (let i = 0; i < 6; ++i) spawn.hopBullet(x + 1100 + 750 * Math.random(), y + -1600)
|
||||
for (let i = 0; i < 4; ++i) spawn.hopBullet(x + 150 + 750 * Math.random(), y + -1600)
|
||||
for (let i = 0; i < 4; ++i) spawn.hopBullet(x + 1100 + 750 * Math.random(), y + -1600)
|
||||
spawn.hopper(x + 1550, y + -775);
|
||||
spawn.hopper(x + 500, y + -775);
|
||||
spawn.hopper(x + 500, y + -2200);
|
||||
spawn.hopper(x + 1100, y + -2200);
|
||||
spawn.hopMother(x + 1400, y + -775);
|
||||
spawn.hopMother(x + 550, y + -775);
|
||||
spawn.hopMother(x + 525, y + -1475);
|
||||
@@ -30084,9 +30093,6 @@ const level = {
|
||||
},
|
||||
unchartedCave() {
|
||||
simulation.makeTextLog(`<strong>unchartedCave</strong> by <span class='color-var'>3xionDev</span>`);
|
||||
//lore.unlockTesting();
|
||||
//simulation.enableConstructMode();
|
||||
level.difficultyIncrease(15);
|
||||
level.setPosToSpawn(0, -50); //normal spawn
|
||||
level.exit.x = 20985;
|
||||
level.exit.y = 2816;
|
||||
@@ -30095,7 +30101,6 @@ const level = {
|
||||
level.defaultZoom = 1900
|
||||
simulation.zoomTransition(level.defaultZoom)
|
||||
document.body.style.backgroundColor = "#979797";
|
||||
// color.map = "#444" //custom map color
|
||||
|
||||
spawn.randomMob(1000, -975, 0);
|
||||
spawn.randomMob(2550, -575, 0);
|
||||
@@ -30490,15 +30495,462 @@ const level = {
|
||||
spawn.randomGroup(5835, -532, 0.4);
|
||||
if (simulation.difficulty > 1) spawn.randomLevelBoss(18823, 2191);
|
||||
spawn.secondaryBossChance(20217, 1913)
|
||||
|
||||
|
||||
|
||||
level.custom = () => {
|
||||
level.exit.drawAndCheck();
|
||||
|
||||
level.enter.draw();
|
||||
};
|
||||
},
|
||||
dojo() { // By weird_pusheen
|
||||
simulation.makeTextLog(`<strong>dojo</strong> by <span class='color-var'>werid_pusheen</span>, fixed by <span class='color-var'>Cornbread 2100</span>`)
|
||||
const vanishes = [];
|
||||
const smoofes = [];
|
||||
const leftRotor = level.rotor(-550, 900, 950, 25);
|
||||
leftRotor.frictionAir = 0.01;
|
||||
var leftSchwoof = level.boost(-20, -60, -2000);
|
||||
var rightSchwoof = level.button(2550, -50);
|
||||
var rightSchwoofState = false;
|
||||
var rightSchwoofLive = true;
|
||||
spawn.mapRect(2513, -39, 200, 100);
|
||||
var pathPoints = [
|
||||
[0, 0], // Index 0 is owned by M and is set to M's position during play
|
||||
// this means that occasionally the boss will bonk M on the way to somewhere else, which gives it a chance to hurt M and gives the player a chance to hurt it
|
||||
[250, -750], /* Left bases */
|
||||
[250, -2500],
|
||||
[350, -1500], // Left doorway
|
||||
[1150, -1500], // Home base
|
||||
[1150, -2750], // Upper base
|
||||
[1950, -1500], // Right doorway
|
||||
[2050, -750], /* Right bases */
|
||||
[2050, -2500],
|
||||
[-150, -250], // Left porthole
|
||||
];
|
||||
function isntIn(point, array) {
|
||||
for (var x = 0; x < array.length; x++) {
|
||||
if (point[0] == array[x][0] && point[1] == array[x][1]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function isObstructed(v1, v2) {
|
||||
var ret = Matter.Query.ray(map,
|
||||
{
|
||||
x: v1[0],
|
||||
y: v1[1],
|
||||
},
|
||||
{
|
||||
x: v2[0],
|
||||
y: v2[1]
|
||||
}).length != 0;
|
||||
return ret; // Kinda-ish stolen from mob.js
|
||||
}
|
||||
function pythag(p1, p2) {
|
||||
var dx = p1[0] - p2[0];
|
||||
var dy = p1[1] - p2[1];
|
||||
return Math.sqrt(dx * dx + dy * dy);
|
||||
}
|
||||
var path = undefined; // This is a stupid way to go about pathfinding code. I might even clean it up!
|
||||
function pathFind(goalPoint, startPoint, curPath = []) {
|
||||
var myPoint = startPoint;
|
||||
if (curPath.length) {
|
||||
myPoint = curPath[curPath.length - 1];
|
||||
}
|
||||
if (path && (curPath.length >= path.length)) { // If we've already found a shorter or equal path, no reason to continue and waste CPU time
|
||||
return; // Minimizes for HOP COUNT, not PATH LENGTH - path length was buggy
|
||||
}
|
||||
if (!isObstructed(myPoint, goalPoint)) { // If the line to the goal point ain't blocked by a map object, we've arrived!
|
||||
path = [...curPath];
|
||||
path.push(goalPoint);
|
||||
return;
|
||||
}
|
||||
pathPoints.forEach(testPoint => {
|
||||
if (isntIn(testPoint, curPath)) { // If it's reusing points, there's clearly something wrong
|
||||
if (!isObstructed(myPoint, testPoint)) { // If the line to the test point ain't blocked by a map object
|
||||
var thing = [...curPath];
|
||||
thing.push(testPoint);
|
||||
pathFind(goalPoint, startPoint, thing); // Branch to a valid test point
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
level.setPosToSpawn(1200, 500);
|
||||
level.exit.x = 51500;
|
||||
level.exit.y = -1875;
|
||||
spawn.mapRect(level.enter.x, level.enter.y + 20, 100, 20);
|
||||
level.defaultZoom = 1500;
|
||||
simulation.zoomTransition(level.defaultZoom)
|
||||
document.body.style.backgroundColor = "#d8dadf";
|
||||
|
||||
spawn.mapRect(-500, 0, 3300, 300); // Floor
|
||||
spawn.mapRect(-100, -3000, 2500, 100); // Ceiling
|
||||
spawn.mapRect(-200, -3000, 100, 2600); // Left wall
|
||||
spawn.mapRect(2400, -3000, 100, 3000); // Right wall
|
||||
|
||||
spawn.mapRect(500, -1000, 100, 500); /* obstruction blocks */
|
||||
smoofes.push(map[map.length - 1]);
|
||||
spawn.mapRect(500, -2500, 100, 500);
|
||||
smoofes.push(map[map.length - 1]);
|
||||
spawn.mapRect(1700, -1000, 100, 500);
|
||||
smoofes.push(map[map.length - 1]);
|
||||
spawn.mapRect(1700, -2500, 100, 500);
|
||||
smoofes.push(map[map.length - 1]);
|
||||
|
||||
spawn.mapRect(-1000, 550, 200, 50); // Left chonky stepppp low
|
||||
spawn.mapRect(-800, 300, 200, 50); // Left chonky stepppp high
|
||||
spawn.mapVertex(-1000, 1200, "0 0 100 0 700 500 700 700 0 700"); // Left chonky
|
||||
spawn.mapRect(3100, 550, 200, 50); // Right chonky stepppp low
|
||||
spawn.mapRect(2900, 300, 200, 50); // Right chonky stepppp high
|
||||
spawn.mapVertex(3300, 1200, "0 0 -100 0 -700 500 -700 700 0 700"); // Right chonky
|
||||
const leftElevator = level.elevator(-1400 - 300, 1450, 300, 100, 500);
|
||||
const rightElevator = level.elevator(-1400 + 5100, 1450, 300, 100, 500);
|
||||
|
||||
spawn.mapRect(-150, -1700, 200, 50);
|
||||
spawn.mapRect(400, -2050, 200, 50);
|
||||
spawn.mapRect(1600, -1000, 200, 50);
|
||||
|
||||
spawn.randomMob(1200, 700);
|
||||
spawn.randomMob(600, 1000);
|
||||
spawn.randomMob(1800, 1000);
|
||||
spawn.randomMob(3200, 400);
|
||||
spawn.randomMob(3000, 200);
|
||||
spawn.randomMob(-900, 400);
|
||||
spawn.randomMob(-700, 200);
|
||||
spawn.randomMob(1200, 1000);
|
||||
for (var i = 0; i < 4; i++) {
|
||||
spawn.randomSmallMob(Math.random() * 600 - 600, Math.random() * 3000 - 400);
|
||||
}
|
||||
spawn.grenadier(-300, -1000);
|
||||
spawn.grenadier(2600, -1000);
|
||||
|
||||
spawn.mapRect(-1400, 1450, 5100, 100); // The True Floor
|
||||
|
||||
const slime = level.hazard(-1250, 1400, 4800, 50);
|
||||
slime.maxHeight = 600;
|
||||
simulation.draw.body = function () {
|
||||
ctx.beginPath();
|
||||
for (let i = 0, len = body.length; i < len; ++i) {
|
||||
if (!body[i].hidden) {
|
||||
let vertices = body[i].vertices;
|
||||
ctx.moveTo(vertices[0].x, vertices[0].y);
|
||||
for (let j = 1; j < vertices.length; j++) {
|
||||
ctx.lineTo(vertices[j].x, vertices[j].y);
|
||||
}
|
||||
ctx.lineTo(vertices[0].x, vertices[0].y);
|
||||
}
|
||||
}
|
||||
ctx.lineWidth = 2;
|
||||
ctx.fillStyle = color.block;
|
||||
ctx.fill();
|
||||
ctx.strokeStyle = color.blockS;
|
||||
ctx.stroke();
|
||||
} // Override the old draw code to allow intelligent hiding of blocks - preferably this becomes official code because it's just a single added if statement and makes a lot of things cleaner and more intelligent
|
||||
|
||||
const vanish = function (x, y, width, height) { // normal vanishes don't work well on my map for some reason, so I rewrote
|
||||
x += width / 2;
|
||||
y += height / 2;
|
||||
const getVertices = function (bX, bY, bW, bH) { return [{ x: bX, y: bY, index: 0, isInternal: false }, { x: bX + bW, y: bY, index: 1, isInternal: false }, { x: bX + bW, y: bY + bH, index: 4, isInternal: false }, { x: bX, y: bY + bH, index: 3, isInternal: false }] };
|
||||
const cMask = cat.player | cat.body | cat.bullet | cat.powerUp | cat.mob | cat.mobBullet;
|
||||
const vertices = getVertices(x, y, width, height);
|
||||
const block = body[body.length] = Bodies.fromVertices(x, y, vertices, {
|
||||
collisionFilter: {
|
||||
category: cat.map,
|
||||
mask: cMask
|
||||
},
|
||||
isNoSetCollision: true,
|
||||
inertia: Infinity, //prevents rotation
|
||||
isNotHoldable: true,
|
||||
isNonStick: true, //this keep sporangium from sticking
|
||||
isTouched: false,
|
||||
cWidth: width,
|
||||
hiddenCycle: 0,
|
||||
isStatic: true,
|
||||
query() {
|
||||
if (this.cWidth <= 0) {
|
||||
if (this.cWidth > -100) {
|
||||
this.cWidth = -100;
|
||||
Matter.Body.setVertices(this, vertices);
|
||||
}
|
||||
this.isTouched = false;
|
||||
this.collisionFilter.mask = undefined;
|
||||
this.hidden = true;
|
||||
this.hiddenCycle++;
|
||||
if (this.hiddenCycle > 100) {
|
||||
if (Matter.Query.collides(this, [player]).length) {
|
||||
this.hiddenCycle = 50;
|
||||
}
|
||||
else {
|
||||
this.hiddenCycle = 0;
|
||||
this.cWidth = width;
|
||||
this.collisionFilter.mask = cMask;
|
||||
this.hidden = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (this.isTouched) {
|
||||
Matter.Body.setVertices(this, getVertices(x, y, this.cWidth, height * (this.cWidth / width)));
|
||||
this.cWidth -= 3;
|
||||
}
|
||||
else if (Matter.Query.collides(this, [player]).length) { // Elseif short circuit avoids expensive collision detection
|
||||
this.isTouched = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
return block;
|
||||
};
|
||||
|
||||
vanishes.push(vanish(800, 800, 800, 50));
|
||||
vanishes.push(vanish(400, 1100, 400, 50));
|
||||
vanishes.push(vanish(1600, 1100, 400, 50));
|
||||
for (const vanishBlock of vanishes) Composite.add(engine.world, vanishBlock);
|
||||
spawn.bodyRect(1700, 812, 300, 25, 1, {
|
||||
collisionFilter: {
|
||||
category: cat.body,
|
||||
mask: cat.player | cat.body | cat.bullet | cat.powerUp | cat.mob | cat.mobBullet | cat.map
|
||||
},
|
||||
isNoSetCollision: true,
|
||||
isNotHoldable: true,
|
||||
isNonStick: true, //this keep sporangium from sticking
|
||||
restitution: 1,
|
||||
friction: 0,
|
||||
frictionAir: 0,
|
||||
frictionStatic: 0,
|
||||
query() {
|
||||
Matter.Body.setAngularVelocity(this, 0);
|
||||
Matter.Body.applyForce(this, this.position, {
|
||||
x: 0,
|
||||
y: -(this.position.y - 812) * 0.002
|
||||
});
|
||||
}
|
||||
});
|
||||
const zigzag = body[body.length - 1];
|
||||
Matter.Body.applyForce(zigzag, zigzag.position, {
|
||||
x: 0.1,
|
||||
y: 0
|
||||
});
|
||||
var buttonWasDown = false;
|
||||
level.customTopLayer = () => {
|
||||
|
||||
}
|
||||
level.custom = () => {
|
||||
rightSchwoof.isUp = false;
|
||||
level.exit.drawAndCheck();
|
||||
leftSchwoof.query();
|
||||
level.enter.draw();
|
||||
pathPoints[0][0] = m.pos.x;
|
||||
pathPoints[0][1] = m.pos.y;
|
||||
leftElevator.move();
|
||||
rightElevator.move();
|
||||
slime.query();
|
||||
zigzag.query();
|
||||
slime.levelRise(0.2);
|
||||
for (var i = 0; i < vanishes.length; i++) {
|
||||
vanishes[i].query();
|
||||
}
|
||||
if (!rightSchwoofState) {
|
||||
var math = m.pos.y < leftRotor.position.y;
|
||||
Matter.Body.setAngularVelocity(leftRotor, (math ? 1 : -1) * Math.PI / 45);
|
||||
}
|
||||
if (rightSchwoofLive) {
|
||||
rightSchwoof.query();
|
||||
rightSchwoof.draw();
|
||||
if (rightSchwoofState) {
|
||||
ctx.fillStyle = "lightgreen";
|
||||
}
|
||||
else {
|
||||
ctx.fillStyle = "red";
|
||||
}
|
||||
ctx.beginPath();
|
||||
ctx.arc(2615, -220, 40, 0, Math.PI * 2);
|
||||
ctx.fill();
|
||||
}
|
||||
if (rightSchwoof.isUp) {
|
||||
buttonWasDown = true;
|
||||
}
|
||||
else if (buttonWasDown) {
|
||||
buttonWasDown = false;
|
||||
rightSchwoofState = !rightSchwoofState;
|
||||
}
|
||||
if (Matter.Query.collides(player, smoofes).length) {
|
||||
Matter.Body.applyForce(player, player.position, {
|
||||
x: 0,
|
||||
y: -0.015
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
mobs.spawn(500, -500, 10, 100, "yellow"); /* TacticalBoss
|
||||
Modes:
|
||||
Spawn:
|
||||
Pathfinds to a point above M and starts dropping mobs. Learns which mobs to drop to cause the most damage, of course.
|
||||
Occasionally strikes at M.
|
||||
Hide:
|
||||
Pathfinds to the point furthest from M
|
||||
Strike:
|
||||
Pathfind really, really fast to M
|
||||
Recharge:
|
||||
Stop moving for a bit to "recharge" (this is so the player has a chance to hit it)
|
||||
|
||||
It must always Hide or Recharge after Spawning or Striking. Which one it does is based on some factor I'll figure out.
|
||||
Pathfinding is a hypersimplified algorithm with hard-coded "points" that it can travel between. M is one of these.
|
||||
*/
|
||||
var boss = mob[mob.length - 1];
|
||||
boss.isBoss = true;
|
||||
boss.damageReduction = 0.2 / (tech.isScaleMobsWithDuplication ? 1 + tech.duplicationChance() : 1)
|
||||
boss.onDeath = function () {
|
||||
powerUps.spawnBossPowerUp(this.position.x, this.position.y);
|
||||
level.exit.x = 2560;
|
||||
level.exit.y = -90;
|
||||
rightSchwoofLive = false;
|
||||
};
|
||||
var spawnables = {};
|
||||
["hopper", "stabber", "springer", "striker", "sneaker", "grower"].forEach((m) => { /* Used to be spawn.fullPickList, but some of those mobs don't do collision-only damage and would thus never be properly selected for */
|
||||
if (spawn[m]) {
|
||||
spawnables[m] = {
|
||||
fun: spawn[m],
|
||||
name: m,
|
||||
weight: 1
|
||||
}
|
||||
}
|
||||
});
|
||||
boss.stabCycle = 0;
|
||||
boss.spawnCycle = 0;
|
||||
function spawny() {
|
||||
var totalWeight = 0;
|
||||
Object.keys(spawnables).forEach(key => {
|
||||
totalWeight += spawnables[key].weight;
|
||||
});
|
||||
var cursorWeight = 0;
|
||||
var choice = Math.random();
|
||||
var mC = undefined;
|
||||
Object.values(spawnables).forEach((thing) => {
|
||||
var lower = cursorWeight / totalWeight;
|
||||
cursorWeight += thing.weight;
|
||||
var upper = cursorWeight / totalWeight;
|
||||
if ((choice > lower && choice <= upper) || !mC) {
|
||||
mC = thing;
|
||||
}
|
||||
});
|
||||
mC.fun(boss.position.x, boss.position.y);
|
||||
var sp = mob[mob.length - 1];
|
||||
sp.typeName = mC.name;
|
||||
sp.onHit = () => {
|
||||
spawnables[sp.typeName].weight += 1;
|
||||
};
|
||||
var oldFun = sp.onDeath;
|
||||
sp.onDeath = () => { /* Mobs that die are worth less */
|
||||
oldFun.call(sp);
|
||||
spawnables[sp.typeName].weight -= 0.3; /* But not too much less */
|
||||
};
|
||||
}
|
||||
boss.spawnDelay = 40;
|
||||
boss.mode = "hide";
|
||||
boss.modeSwitch = -1; // Randomize mode immediately
|
||||
boss.damageReduction = 0.1;
|
||||
var oldOnHit = boss.onHit;
|
||||
boss.onHit = () => {
|
||||
boss.modeSwitch = -1; // After striking the player, always switch modes
|
||||
oldOnHit.call(boss); //this is the line that is bugging <-----
|
||||
};
|
||||
boss.do = () => {
|
||||
path = undefined;
|
||||
var pfGoal = [0, 0];
|
||||
boss.modeSwitch--;
|
||||
if (boss.modeSwitch < 0) {
|
||||
if (!boss.isShielded) {
|
||||
spawn.shield(boss, boss.position.x, boss.position.y, 0.75); // Every time the mode switches, have a 75% chance to gain a new shield
|
||||
}
|
||||
if (boss.mode == "hide" || boss.mode == "recharge") {
|
||||
if (Math.random() > 0.5) {
|
||||
boss.mode = "spawn";
|
||||
}
|
||||
else {
|
||||
boss.mode = "strike";
|
||||
}
|
||||
boss.modeSwitch = 600;
|
||||
}
|
||||
else {
|
||||
if (boss.mode == "strike") {
|
||||
boss.mode = "hide"; // Always hides after striking
|
||||
}
|
||||
else {
|
||||
if (Math.random() > 0.5) {
|
||||
boss.mode = "hide";
|
||||
}
|
||||
else {
|
||||
boss.mode = "recharge"; // same when it goes into recharge mode
|
||||
spawn.shield(boss, boss.position.x, boss.position.y, 1);
|
||||
}
|
||||
}
|
||||
boss.modeSwitch = 200;
|
||||
}
|
||||
}
|
||||
if (boss.mode == "hide") { /* Find the furthest point from M and get to it */
|
||||
var longest = 0;
|
||||
pathPoints.forEach(item => {
|
||||
if (item[0] == 1150) {
|
||||
return;
|
||||
}
|
||||
var iL = pythag(item, [m.pos.x, m.pos.y]);
|
||||
if (iL > longest) {
|
||||
longest = iL;
|
||||
pfGoal = item;
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (boss.mode == "strike") {
|
||||
pfGoal = pathPoints[0]; // Target M
|
||||
}
|
||||
else if (boss.mode == "spawn") {
|
||||
pfGoal = pathPoints[4]; // Go to Home Base to spawn
|
||||
}
|
||||
if (boss.mode != "recharge") {
|
||||
if (m.pos.x > 2350 || m.pos.x < -150 || m.pos.y > 50) {
|
||||
boss.mode = "hide";
|
||||
}
|
||||
pathFind(pfGoal, [boss.position.x, boss.position.y]);
|
||||
if (!path) {
|
||||
return; // If it couldn't pathfind, just drift
|
||||
}
|
||||
var goalX = path[0][0];
|
||||
var goalY = path[0][1];
|
||||
|
||||
var dX = goalX - boss.position.x;
|
||||
var dY = goalY - boss.position.y;
|
||||
var hyp = Math.sqrt(dX * dX + dY * dY);
|
||||
Matter.Body.applyForce(boss, {
|
||||
x: goalX,
|
||||
y: goalY
|
||||
}, {
|
||||
x: dX / hyp * 0.04 * (boss.mode == "strike" ? 2 : 1),
|
||||
y: dY / hyp * 0.04 * (boss.mode == "strike" ? 2 : 1)// - 0.005
|
||||
});
|
||||
}
|
||||
if (boss.mode == "spawn") {
|
||||
boss.stabCycle++;
|
||||
if (boss.stabCycle > 25) {
|
||||
if (Math.abs(dX) < 200 && dY > 0) {
|
||||
Matter.Body.applyForce(boss, {
|
||||
x: player.position.x,
|
||||
y: player.position.y
|
||||
}, {
|
||||
x: 0,
|
||||
y: 5
|
||||
});
|
||||
}
|
||||
boss.stabCycle = 0;
|
||||
}
|
||||
boss.spawnCycle++;
|
||||
if (boss.spawnCycle > boss.spawnDelay) {
|
||||
spawny();
|
||||
boss.spawnDelay += 4;
|
||||
boss.spawnCycle = 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
boss.showHealthBar = true;
|
||||
powerUps.addResearchToLevel() //needs to run after mobs are spawned
|
||||
},
|
||||
// ********************************************************************************************************
|
||||
// ********************************************************************************************************
|
||||
// ***************************************** training levels **********************************************
|
||||
|
||||
Reference in New Issue
Block a user