constraints and gel hair
difficulty
difficulty level 6 adds flat damage and damage taken
bonus tech no longer spawns on level 2 and 3 on difficulty level 6
at the end of subway you get 1 tech, but not on difficulty level 6
difficulty level 3 and 5 add a random constraint that changes each level
constraints are effects that only last until the level ends
50% JUNK chance
4x shielded mob chance
power ups are sent to next level
+33% chance for mobs to respawn
-1 choice
2x ammo costs
duplication is set to zero
50% max energy
50% max health
bots follow slow
full damage taken after boss dies
0.1x damage after a power up
mob death heals mobs
mobs heal for your lost health
periodically spawn WIMPs
exciton damage boost power up has a chance to spawn without the tech (~3%/mob)
damage boost has a unique gel/hair aura for each skin
damage boost timer no longer ticks with time dilation field
JUNK tech: stationary - thrown blocks can't move, but they still have momentum
added a classic n-gon link for the previous patch in settings
but images are disabled to save space
on levels where you can fall endlessly, power ups will also fall endlessly
they no longer teleport to the exit, sorry
Newton's 1st and 2nd laws are field tech, and they give twice the effect
abelian group 4->3x damage while invulnerable
bot fabrication price increases after 5->4 bots
wikipedia 4->3 research per correct quiz
upgraded sound bots fire fewer waves but do more damage per wave
not much changed except improved performance, I think
incendiary ammunition drones explode when they run out of durability not on the first hit
this allows better synergy with other drone tech
grappling hook retract momentum no longer scales with distance
this should give you more control
pressing the 3rd button in factory will remove blocks resting on the second block
preventing an endless toggle
bug fixes
fleas no longer die early after hitting a high health target only once
something with super ball density calculations for tech rebound
grabbing a big block can make grappling hook go flying
added 3 potential fixes, but the bug is too rare know if it's fixed
This commit is contained in:
188
js/powerup.js
188
js/powerup.js
@@ -373,7 +373,7 @@ const powerUps = {
|
||||
//build level info
|
||||
document.getElementById("choose-grid").classList.add('choose-grid-no-images');
|
||||
document.getElementById("choose-grid").classList.remove('choose-grid');
|
||||
document.getElementById("choose-grid").style.gridTemplateColumns = "405px" //adjust this to increase the width of the whole menu, but mostly the center column
|
||||
document.getElementById("choose-grid").style.gridTemplateColumns = "505px" //adjust this to increase the width of the whole menu, but mostly the center column
|
||||
|
||||
let text = `<div>
|
||||
<div class="grid-container">
|
||||
@@ -389,12 +389,12 @@ const powerUps = {
|
||||
</datalist>
|
||||
</div>
|
||||
<div class="right-column">
|
||||
<div class="row" id="constraint-1"><strong>0.87x</strong> <strong class='color-d'>damage</strong> done per level<br><strong>1.22x</strong> <strong class='color-defense'>damage taken</strong> per level</div>
|
||||
<div class="row" id="constraint-2"><strong>-5</strong> initial <strong>power ups</strong><br><strong>faster</strong> mobs and <strong>more</strong> mobs</div>
|
||||
<div class="row" id="constraint-3"><strong>0.87x</strong> <strong class='color-d'>damage</strong> done per level<br><strong>1.22x</strong> <strong class='color-defense'>damage taken</strong> per level</div>
|
||||
<div class="row" id="constraint-4"><strong>+1</strong> boss per level<br><strong>-1</strong> ${powerUps.orb.tech()} per boss</div>
|
||||
<div class="row" id="constraint-5"><strong>0.87x</strong> <strong class='color-d'>damage</strong> done per level<br><strong>1.22x</strong> <strong class='color-defense'>damage taken</strong> per level</div>
|
||||
<div class="row" id="constraint-6"><strong>3x</strong> chance for <strong>shielded</strong> mobs<br><strong>-3</strong> initial power ups</div>
|
||||
<div class="row" id="constraint-1"><strong>0.87x</strong> <strong class='color-d'>damage</strong>, <strong>1.22x</strong> <strong class='color-defense'>damage taken</strong> per level<br><strong>+1</strong> boss on each level</div>
|
||||
<div class="row" id="constraint-2"><strong>more</strong> mob per level<br><strong>faster</strong> mobs per level</div>
|
||||
<div class="row" id="constraint-3"><strong>0.87x</strong> <strong class='color-d'>damage</strong>, <strong>1.22x</strong> <strong class='color-defense'>damage taken</strong> per level<br><strong>+1</strong> random <strong class="constraint">constraint</strong> on each level</div>
|
||||
<div class="row" id="constraint-4"><strong>+1</strong> boss on each level<br>bosses spawn <strong>1</strong> fewer ${powerUps.orb.tech()}</div>
|
||||
<div class="row" id="constraint-5"><strong>0.87x</strong> <strong class='color-d'>damage</strong>, <strong>1.22x</strong> <strong class='color-defense'>damage taken</strong> per level<br><strong>+1</strong> random <strong class="constraint">constraint</strong> on each level</div>
|
||||
<div class="row" id="constraint-6"><strong>0.5x</strong> initial <strong class='color-d'>damage</strong><br><strong>2x</strong> initial <strong class='color-defense'>damage taken</strong></div>
|
||||
</div>
|
||||
<div class="far-right-column">
|
||||
<div id = "constraint-1-record">${localSettings.difficultyCompleted[1] ? "⚆" : " "}</div>
|
||||
@@ -434,7 +434,7 @@ const powerUps = {
|
||||
}
|
||||
});
|
||||
|
||||
let setConstraintText = function (isReset = true) {
|
||||
let setDifficultyText = function (isReset = true) {
|
||||
for (let i = 1; i < 7; i++) {
|
||||
const id = document.getElementById("constraint-" + i)
|
||||
if (simulation.difficultyMode < i) {
|
||||
@@ -451,17 +451,19 @@ const powerUps = {
|
||||
if (localSettings.isAllowed) localStorage.setItem("localSettings", JSON.stringify(localSettings)); //update local storage
|
||||
}
|
||||
}
|
||||
setConstraintText(false)
|
||||
setDifficultyText(false)
|
||||
document.getElementById("difficulty-slider").value = simulation.difficultyMode
|
||||
document.getElementById("difficulty-slider").addEventListener("input", () => {
|
||||
simulation.difficultyMode = document.getElementById("difficulty-slider").value
|
||||
setConstraintText()
|
||||
setDifficultyText()
|
||||
level.setConstraints()
|
||||
});
|
||||
for (let i = 1; i < 7; i++) {
|
||||
document.getElementById("constraint-" + i).addEventListener("click", () => {
|
||||
simulation.difficultyMode = i
|
||||
document.getElementById("difficulty-slider").value = simulation.difficultyMode
|
||||
setConstraintText()
|
||||
setDifficultyText()
|
||||
level.setConstraints()
|
||||
});
|
||||
}
|
||||
},
|
||||
@@ -503,17 +505,38 @@ const powerUps = {
|
||||
damage: null, //set by "tech: band gap"
|
||||
effect() {
|
||||
powerUps.animatePowerUpGrab('rgba(255, 0, 0, 0.5)')
|
||||
powerUps.boost.endCycle = m.cycle + Math.floor(Math.max(0, powerUps.boost.endCycle - m.cycle) * 0.6) + powerUps.boost.duration //duration+seconds plus 2/3 of current time left
|
||||
powerUps.boost.endCycle = simulation.cycle + Math.floor(Math.max(0, powerUps.boost.endCycle - simulation.cycle) * 0.6) + powerUps.boost.duration //duration+seconds plus 2/3 of current time left
|
||||
},
|
||||
draw() {
|
||||
// console.log(this.endCycle)
|
||||
if (powerUps.boost.endCycle > m.cycle) {
|
||||
ctx.strokeStyle = "rgba(255,0,0,0.8)" //m.fieldMeterColor; //"rgba(255,255,0,0.2)" //ctx.strokeStyle = `rgba(0,0,255,${0.5+0.5*Math.random()})`
|
||||
// if (powerUps.boost.endCycle > m.cycle) {
|
||||
// ctx.strokeStyle = "rgba(255,0,0,0.8)" //m.fieldMeterColor; //"rgba(255,255,0,0.2)" //ctx.strokeStyle = `rgba(0,0,255,${0.5+0.5*Math.random()})`
|
||||
// ctx.beginPath();
|
||||
// const arc = (powerUps.boost.endCycle - m.cycle) / powerUps.boost.duration
|
||||
// ctx.arc(m.pos.x, m.pos.y, 28, m.angle - Math.PI * arc, m.angle + Math.PI * arc); //- Math.PI / 2
|
||||
// ctx.lineWidth = 4
|
||||
// ctx.stroke();
|
||||
// }
|
||||
|
||||
if (powerUps.boost.endCycle > simulation.cycle) {
|
||||
//gel that acts as if the wind is blowing it when player moves
|
||||
ctx.save();
|
||||
ctx.translate(m.pos.x, m.pos.y);
|
||||
m.velocitySmooth = Vector.add(Vector.mult(m.velocitySmooth, 0.8), Vector.mult(player.velocity, 0.2))
|
||||
ctx.rotate(Math.atan2(m.velocitySmooth.y, m.velocitySmooth.x))
|
||||
ctx.beginPath();
|
||||
const arc = (powerUps.boost.endCycle - m.cycle) / powerUps.boost.duration
|
||||
ctx.arc(m.pos.x, m.pos.y, 28, m.angle - Math.PI * arc, m.angle + Math.PI * arc); //- Math.PI / 2
|
||||
ctx.lineWidth = 4
|
||||
const radius = 40
|
||||
const mag = 8 * Vector.magnitude(m.velocitySmooth) + radius
|
||||
ctx.arc(0, 0, radius, -Math.PI / 2, Math.PI / 2);
|
||||
ctx.bezierCurveTo(-radius, radius, -radius, 0, -mag, 0); // bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y)
|
||||
ctx.bezierCurveTo(-radius, 0, -radius, -radius, 0, -radius);
|
||||
const time = Math.min(0.5, (powerUps.boost.endCycle - simulation.cycle) / powerUps.boost.duration)
|
||||
ctx.fillStyle = `rgba(255,0,200,${time})`
|
||||
ctx.fill()
|
||||
ctx.strokeStyle = "#f09"
|
||||
ctx.lineWidth = 0.3 + 4 * time
|
||||
ctx.stroke();
|
||||
ctx.restore();
|
||||
}
|
||||
},
|
||||
},
|
||||
@@ -533,7 +556,7 @@ const powerUps = {
|
||||
if (amount !== 0) powerUps.research.count += amount
|
||||
if (tech.isRerollBots && !this.isMakingBots) {
|
||||
let cycle = () => {
|
||||
const cost = 2 + Math.floor(0.2 * b.totalBots())
|
||||
const cost = 2 + Math.floor(0.25 * b.totalBots())
|
||||
if (m.alive && powerUps.research.count >= cost) {
|
||||
requestAnimationFrame(cycle);
|
||||
this.isMakingBots = true
|
||||
@@ -647,7 +670,7 @@ const powerUps = {
|
||||
// });
|
||||
} else if (overHeal > 0.13) { //if leftover heals spawn a new spammer heal power up
|
||||
requestAnimationFrame(() => {
|
||||
powerUps.directSpawn(this.position.x, this.position.y, "heal", true, null, Math.min(1, overHeal) * 40 * (simulation.healScale ** 0.25))// directSpawn(x, y, target, moving = true, mode = null, size = powerUps[target].size()) {
|
||||
powerUps.directSpawn(this.position.x, this.position.y, "heal", true, Math.min(1, overHeal) * 40 * (simulation.healScale ** 0.25))// directSpawn(x, y, name, moving = true, mode = null, size = powerUps[name].size()) {
|
||||
});
|
||||
}
|
||||
if (tech.isHealBrake) {
|
||||
@@ -699,9 +722,9 @@ const powerUps = {
|
||||
}
|
||||
},
|
||||
spawn(x, y, size) { //used to spawn a heal with a specific size / heal amount, not normally used
|
||||
powerUps.directSpawn(x, y, "heal", false, null, size)
|
||||
if (Math.random() < tech.duplicationChance()) {
|
||||
powerUps.directSpawn(x, y, "heal", false, null, size)
|
||||
powerUps.directSpawn(x, y, "heal", false, size)
|
||||
if (!level.isNextLevelPowerUps && Math.random() < tech.duplicationChance()) {
|
||||
powerUps.directSpawn(x, y, "heal", false, size)
|
||||
powerUp[powerUp.length - 1].isDuplicated = true
|
||||
}
|
||||
}
|
||||
@@ -717,22 +740,22 @@ const powerUps = {
|
||||
if (b.inventory.length > 0) {
|
||||
powerUps.animatePowerUpGrab('rgba(68, 102, 119,0.25)')
|
||||
if (tech.isAmmoForGun && b.activeGun !== null) { //give extra ammo to one gun only with tech logistics
|
||||
const target = b.guns[b.activeGun]
|
||||
if (target.ammo !== Infinity) {
|
||||
const name = b.guns[b.activeGun]
|
||||
if (name.ammo !== Infinity) {
|
||||
if (tech.ammoCap) {
|
||||
target.ammo = Math.ceil(2 * target.ammoPack * tech.ammoCap * couplingExtraAmmo)
|
||||
name.ammo = Math.ceil(2 * name.ammoPack * tech.ammoCap * couplingExtraAmmo)
|
||||
} else {
|
||||
target.ammo += Math.ceil(2 * (Math.random() + Math.random()) * target.ammoPack * couplingExtraAmmo)
|
||||
name.ammo += Math.ceil(2 * (Math.random() + Math.random()) * name.ammoPack * couplingExtraAmmo)
|
||||
}
|
||||
}
|
||||
} else { //give ammo to all guns in inventory
|
||||
for (let i = 0, len = b.inventory.length; i < len; i++) {
|
||||
const target = b.guns[b.inventory[i]]
|
||||
if (target.ammo !== Infinity) {
|
||||
const name = b.guns[b.inventory[i]]
|
||||
if (name.ammo !== Infinity) {
|
||||
if (tech.ammoCap) {
|
||||
target.ammo = Math.ceil(target.ammoPack * tech.ammoCap * couplingExtraAmmo)
|
||||
name.ammo = Math.ceil(name.ammoPack * tech.ammoCap * couplingExtraAmmo)
|
||||
} else { //default ammo behavior
|
||||
target.ammo += Math.ceil((Math.random() + Math.random()) * target.ammoPack * couplingExtraAmmo)
|
||||
name.ammo += Math.ceil((Math.random() + Math.random()) * name.ammoPack * couplingExtraAmmo)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -844,9 +867,9 @@ const powerUps = {
|
||||
gunText(choose, click) {
|
||||
const style = localSettings.isHideImages ? powerUps.hideStyle : `style="background-image: url('img/gun/${b.guns[choose].name}.webp');"`
|
||||
return `<div class="choose-grid-module card-background" onclick="${click}" onauxclick="${click}" ${style}>
|
||||
<div class="card-text">
|
||||
<div class="grid-title"><div class="circle-grid gun"></div> ${b.guns[choose].name}</div>
|
||||
${b.guns[choose].descriptionFunction()}</div></div>`
|
||||
<div class="card-text">
|
||||
<div class="grid-title"><div class="circle-grid gun"></div> ${b.guns[choose].name}</div>
|
||||
${b.guns[choose].descriptionFunction()}</div></div>`
|
||||
},
|
||||
fieldText(choose, click) {
|
||||
const style = localSettings.isHideImages ? powerUps.hideStyle : `style="background-image: url('img/field/${m.fieldUpgrades[choose].name}${choose === 0 ? Math.floor(Math.random() * 10) : ""}.webp');"`
|
||||
@@ -1034,13 +1057,13 @@ const powerUps = {
|
||||
}
|
||||
// console.log(options.length)
|
||||
if (options.length > 0 || !tech.isSuperDeterminism) {
|
||||
let totalChoices = 2 + tech.extraChoices + 3 * (m.fieldMode === 8)
|
||||
let totalChoices = 2 + tech.extraChoices + 3 * (m.fieldMode === 8) - level.fewerChoices
|
||||
if (tech.isCancelTech && tech.cancelTechCount === 1) {
|
||||
totalChoices *= 3
|
||||
tech.cancelTechCount++
|
||||
}
|
||||
if (tech.isDeterminism) totalChoices = 1
|
||||
totalChoices = Math.min(options.length, totalChoices)
|
||||
totalChoices = Math.min(totalChoices, options.length)
|
||||
function removeOption(index) {
|
||||
for (let i = 0; i < options.length; i++) {
|
||||
if (options[i] === index) {
|
||||
@@ -1101,13 +1124,13 @@ const powerUps = {
|
||||
for (let i = 1; i < m.fieldUpgrades.length; i++) { //skip field emitter
|
||||
if (i !== m.fieldMode) options.push(i);
|
||||
}
|
||||
let totalChoices = 2 + tech.extraChoices + 3 * (m.fieldMode === 8)
|
||||
let totalChoices = 2 + tech.extraChoices + 3 * (m.fieldMode === 8) - level.fewerChoices
|
||||
if (tech.isCancelTech && tech.cancelTechCount === 1) {
|
||||
totalChoices *= 3
|
||||
tech.cancelTechCount++
|
||||
}
|
||||
if (tech.isDeterminism) totalChoices = 1
|
||||
totalChoices = Math.min(options.length, totalChoices)
|
||||
totalChoices = Math.max(1, Math.min(totalChoices, options.length))
|
||||
function removeOption(index) {
|
||||
for (let i = 0; i < options.length; i++) {
|
||||
if (options[i] === index) {
|
||||
@@ -1181,13 +1204,13 @@ const powerUps = {
|
||||
}
|
||||
}
|
||||
//set total choices
|
||||
let totalChoices = 3 + tech.extraChoices + 3 * (m.fieldMode === 8)
|
||||
let totalChoices = 3 + tech.extraChoices + 3 * (m.fieldMode === 8) - level.fewerChoices
|
||||
if (tech.isCancelTech && tech.cancelTechCount === 1) {
|
||||
totalChoices *= 3
|
||||
tech.cancelTechCount++
|
||||
}
|
||||
if (tech.isDeterminism) totalChoices = 1
|
||||
totalChoices = Math.min(options.length, totalChoices)
|
||||
totalChoices = Math.max(1, Math.min(totalChoices, options.length))
|
||||
|
||||
if (optionLengthNoDuplicates < totalChoices + 1) { //if not enough options for all the choices
|
||||
totalChoices = optionLengthNoDuplicates
|
||||
@@ -1220,11 +1243,11 @@ const powerUps = {
|
||||
const choose = options[Math.floor(Math.seededRandom(0, options.length))] //pick an element from the array of options
|
||||
if (tech.isBanish) {
|
||||
tech.tech[choose].isBanished = true
|
||||
if (i === 0) simulation.inGameConsole(`options.length = ${optionLengthNoDuplicates} <em class='color-text'>//tech removed from pool by decoherence</em>`)
|
||||
if (i === 0) simulation.inGameConsole(`options.length = ${optionLengthNoDuplicates} <em class='color-text'>//removed from pool by decoherence</em>`)
|
||||
}
|
||||
removeOption(choose) //move from future options pool to avoid repeats on this selection
|
||||
tech.tech[choose].isRecentlyShown = true //this flag prevents this option from being shown the next time you pick up a tech power up
|
||||
if (Math.random() < tech.junkChance) { // choose is set to a random JUNK tech
|
||||
if (Math.random() < tech.junkChance + level.junkAdded) { // choose is set to a random JUNK tech
|
||||
const list = []
|
||||
for (let i = 0; i < tech.tech.length; i++) {
|
||||
if (tech.tech[i].isJunk) list.push(i)
|
||||
@@ -1433,6 +1456,7 @@ const powerUps = {
|
||||
b.mine(who.position, { x: 0, y: 0 }, 0)
|
||||
}
|
||||
}
|
||||
if (level.isNoDamage) level.noDamageCycle = m.cycle
|
||||
},
|
||||
spawnRandomPowerUp(x, y) { //mostly used after mob dies, doesn't always return a power up
|
||||
if (!tech.isEnergyHealth && (Math.random() * Math.random() - 0.3 > Math.sqrt(m.health)) || Math.random() < 0.04) { //spawn heal chance is higher at low health
|
||||
@@ -1447,10 +1471,6 @@ const powerUps = {
|
||||
powerUps.spawn(x, y, "gun");
|
||||
return;
|
||||
}
|
||||
// if (Math.random() < 0.005 * (10 - level.levelsCleared)) { //a new tech has a low chance that decreases in later levels
|
||||
// powerUps.spawn(x, y, "tech");
|
||||
// return;
|
||||
// }
|
||||
if (Math.random() < 0.0016) {
|
||||
powerUps.spawn(x, y, "field");
|
||||
return;
|
||||
@@ -1459,35 +1479,28 @@ const powerUps = {
|
||||
powerUps.spawn(x, y, "coupling");
|
||||
return;
|
||||
}
|
||||
if (tech.isBoostPowerUps && Math.random() < 0.14) {
|
||||
if (Math.random() < 0.02 || (tech.isBoostPowerUps && Math.random() < 0.14)) {
|
||||
powerUps.spawn(x, y, "boost");
|
||||
return;
|
||||
}
|
||||
// if (Math.random() < 0.01) {
|
||||
// powerUps.spawn(x, y, "research");
|
||||
// return;
|
||||
// }
|
||||
},
|
||||
randomPowerUpCounter: 0,
|
||||
isFieldSpawned: false, //makes it so a field spawns once but not more times
|
||||
spawnBossPowerUp(x, y) { //boss spawns field and gun tech upgrades
|
||||
if (level.levels[level.onLevel] !== "final") {
|
||||
// if (level.levelsCleared === 1) powerUps.spawn(x, y, "field")
|
||||
// if (m.fieldMode === 0 && !m.coupling) {
|
||||
if (!powerUps.isFieldSpawned) {
|
||||
powerUps.isFieldSpawned = true
|
||||
powerUps.spawn(x, y, "field")
|
||||
} else {
|
||||
powerUps.randomPowerUpCounter++;
|
||||
powerUpChance(Math.max(level.levelsCleared, 10) * 0.1)
|
||||
powerUpChance()
|
||||
}
|
||||
if (!(simulation.difficultyMode > 2 && level.levelsCleared > 1)) {
|
||||
powerUps.randomPowerUpCounter += 0.6;
|
||||
powerUpChance(Math.max(level.levelsCleared, 6) * 0.1)
|
||||
if (simulation.difficultyMode < 4) {//don't spawn second power up on difficulties with a second boss
|
||||
powerUpChance()
|
||||
}
|
||||
function powerUpChance(chanceToFail) {
|
||||
if (Math.random() * chanceToFail < powerUps.randomPowerUpCounter) {
|
||||
powerUps.randomPowerUpCounter = 0;
|
||||
function powerUpChance() {
|
||||
powerUps.randomPowerUpCounter++
|
||||
if (powerUps.randomPowerUpCounter > Math.max(level.levelsCleared, 9) * 0.1 * Math.random()) {
|
||||
powerUps.randomPowerUpCounter = 0; //reset odds
|
||||
if (Math.random() < 0.97) {
|
||||
powerUps.spawn(x, y, "tech")
|
||||
} else {
|
||||
@@ -1528,14 +1541,14 @@ const powerUps = {
|
||||
},
|
||||
addResearchToLevel() { //add a random power up to a location that has a mob, mostly used to give each level a research
|
||||
// if (simulation.difficultyMode < 4 && mob.length) { //don't spawn on higher difficulty settings
|
||||
if (level.levelsCleared < 13 - simulation.difficultyMode * 2 && mob.length) { //don't spawn late game
|
||||
if ((level.levelsCleared < 17 - simulation.difficultyMode * 3) && mob.length) { //don't spawn late game
|
||||
const index = Math.floor(Math.random() * mob.length)
|
||||
powerUps.spawn(mob[index].position.x, mob[index].position.y, "research");
|
||||
}
|
||||
},
|
||||
spawnStartingPowerUps(x, y) { //used for map specific power ups, mostly to give player a starting gun
|
||||
if (level.levelsCleared < 4) { //runs on first 4 levels on all difficulties
|
||||
if (level.levelsCleared > 1) powerUps.spawn(x, y, "tech")
|
||||
if (level.levelsCleared > 1 && simulation.difficultyMode < 6) powerUps.spawn(x, y, "tech")
|
||||
if (b.inventory.length === 0) {
|
||||
powerUps.spawn(x, y, "gun", false); //first gun
|
||||
} else if (tech.totalCount === 0) { //first tech
|
||||
@@ -1574,7 +1587,6 @@ const powerUps = {
|
||||
|
||||
for (let i = 0; i < tech.tech[choose].count; i++) {
|
||||
powerUps.directSpawn(m.pos.x, m.pos.y, "tech");
|
||||
// powerUp[powerUp.length - 1].isDuplicated = true
|
||||
}
|
||||
// remove a random tech from the list of tech you have
|
||||
tech.removeCount += tech.tech[choose].count
|
||||
@@ -1593,7 +1605,6 @@ const powerUps = {
|
||||
|
||||
for (let i = 0; i < tech.tech[choose].count; i++) {
|
||||
powerUps.directSpawn(m.pos.x, m.pos.y, "tech");
|
||||
// powerUp[powerUp.length - 1].isDuplicated = true
|
||||
}
|
||||
// remove a random tech from the list of tech you have
|
||||
tech.tech[choose].remove();
|
||||
@@ -1675,7 +1686,28 @@ const powerUps = {
|
||||
powerUp.splice(index, 1);
|
||||
}
|
||||
},
|
||||
directSpawn(x, y, target, moving = true, mode = null, size = powerUps[target].size(), isDuplicated = false) {
|
||||
spawn(x, y, name, moving = true, size = powerUps[name].size()) {
|
||||
if (
|
||||
(!tech.isSuperDeterminism || (name !== 'research')) &&
|
||||
!(tech.isEnergyNoAmmo && name === 'ammo')
|
||||
) {
|
||||
if (tech.isBoostReplaceAmmo && name === 'ammo') {
|
||||
name = 'boost'
|
||||
size = powerUps[name].size()
|
||||
}
|
||||
powerUps.directSpawn(x, y, name, moving, size)
|
||||
if (!level.isNextLevelPowerUps && Math.random() < tech.duplicationChance()) {
|
||||
powerUps.directSpawn(x, y, name, moving, size, true)
|
||||
powerUp[powerUp.length - 1].isDuplicated = true
|
||||
if (tech.isDupEnergy) m.energy *= 2
|
||||
}
|
||||
}
|
||||
},
|
||||
directSpawn(x, y, name, moving = true, size = powerUps[name].size(), isDuplicated = false) {
|
||||
if (level.isNextLevelPowerUps) {
|
||||
powerUps.powerUpStorage.push({ name: name, size: size })
|
||||
return
|
||||
}
|
||||
let index = powerUp.length;
|
||||
let properties = {
|
||||
density: 0.001,
|
||||
@@ -1686,9 +1718,9 @@ const powerUps = {
|
||||
category: cat.powerUp,
|
||||
mask: cat.map | cat.powerUp
|
||||
},
|
||||
color: powerUps[target].color,
|
||||
effect: powerUps[target].effect,
|
||||
name: powerUps[target].name,
|
||||
color: powerUps[name].color,
|
||||
effect: powerUps[name].effect,
|
||||
name: powerUps[name].name,
|
||||
size: size
|
||||
}
|
||||
let polygonSides
|
||||
@@ -1700,26 +1732,8 @@ const powerUps = {
|
||||
polygonSides = 12
|
||||
}
|
||||
powerUp[index] = Matter.Bodies.polygon(x, y, polygonSides, size, properties);
|
||||
if (mode) powerUp[index].mode = mode
|
||||
if (moving) Matter.Body.setVelocity(powerUp[index], { x: (Math.random() - 0.5) * 15, y: Math.random() * -9 - 3 });
|
||||
Composite.add(engine.world, powerUp[index]);
|
||||
},
|
||||
spawn(x, y, target, moving = true, mode = null, size = powerUps[target].size()) {
|
||||
if (
|
||||
(!tech.isSuperDeterminism || (target !== 'research')) &&
|
||||
!(tech.isEnergyNoAmmo && target === 'ammo')
|
||||
) {
|
||||
if (tech.isBoostReplaceAmmo && target === 'ammo') {
|
||||
target = 'boost'
|
||||
size = powerUps[target].size()
|
||||
}
|
||||
powerUps.directSpawn(x, y, target, moving, mode, size)
|
||||
if (Math.random() < tech.duplicationChance()) {
|
||||
powerUps.directSpawn(x, y, target, moving, mode, size, true)
|
||||
powerUp[powerUp.length - 1].isDuplicated = true
|
||||
// if (tech.isPowerUpsVanish) powerUp[powerUp.length - 1].endCycle = simulation.cycle + 300
|
||||
if (tech.isDupEnergy) m.energy *= 2
|
||||
}
|
||||
}
|
||||
},
|
||||
powerUpStorage: [],//used when power ups are sent to the next level (for the constraint, level.isNextLevelPowerUps)
|
||||
};
|
||||
Reference in New Issue
Block a user