nonRefundable

some bot related tech is no longer nonRefundable
nonRefundable tech is now hidden in experiment mode
This commit is contained in:
landgreen
2021-04-29 06:07:29 -07:00
parent e619a2d57b
commit bfa1fe808c
8 changed files with 144 additions and 106 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@@ -35,7 +35,7 @@ const b = {
},
fireNotMove() { //added && player.speed < 0.5 && m.onGround
if (b.inventory.length) {
if (input.fire && m.fireCDcycle < m.cycle && (!input.field || m.fieldFire) && player.speed < 0.5 && m.onGround && Math.abs(m.yOff - m.yOffGoal) < 1) {
if (input.fire && m.fireCDcycle < m.cycle && (!input.field || m.fieldFire) && player.speed < 2.5 && m.onGround && Math.abs(m.yOff - m.yOffGoal) < 1) {
if (b.guns[b.activeGun].ammo > 0) {
b.fireWithAmmo()
} else {
@@ -2369,8 +2369,7 @@ const b = {
return tech.isNailBotUpgrade + tech.isFoamBotUpgrade + tech.isBoomBotUpgrade + tech.isLaserBotUpgrade + tech.isOrbitBotUpgrade + tech.isDynamoBotUpgrade
},
convertBotsTo(type) { //type can be a string like "dynamoBotCount"
//count all bots
const totalBots = b.totalBots()
const totalPermanentBots = b.totalBots()
//remove all bots techs and convert them to the new type so that tech refunds work correctly
let totalTechToConvert = 0 //count how many tech need to be converted
for (let i = 0; i < tech.tech.length; i++) {
@@ -2379,28 +2378,24 @@ const b = {
tech.removeTech(i)
}
}
let name = ""
if (type === "nailBotCount") name = "nail-bot"
if (type === "orbitBotCount") name = "orbital-bot"
if (type === "boomBotCount") name = "boom-bot"
if (type === "laserBotCount") name = "laser-bot"
if (type === "foamBotCount") name = "foam-bot"
if (type === "dynamoBotCount") name = "dynamo-bot"
if (type === "plasmaBotCount") name = "plasma-bot"
if (type === "missileBotCount") name = "missile-bot"
//spawn tech for the correct bot type
for (let i = 0; i < totalTechToConvert; i++) tech.giveTech(name)
//remove all bots
b.zeroBotCount()
for (let i = 0; i < bullet.length; i++) {
if (bullet[i].botType && bullet[i].endCycle === Infinity) bullet[i].endCycle = 0 //don't remove temp bots
b.clearPermanentBots()
for (let i = 0; i < totalTechToConvert; i++) tech.giveTech(type) //spawn tech for the correct bot type
//find index of new bot type tech effect
let index = null
for (let i = 0; i < tech.tech.length; i++) {
if (tech.tech[i].name === type) {
index = i
break
}
}
for (let i = 0, len = totalPermanentBots - totalTechToConvert; i < len; i++) tech.tech[index].effect(); //also convert any permanent bots that didn't come from a tech
},
clearPermanentBots() {
for (let i = 0; i < bullet.length; i++) {
if (bullet[i].botType && bullet[i].endCycle === Infinity) bullet[i].endCycle = 0 //remove active bots, but don't remove temp bots
}
//set all bots to type
tech[type] = totalBots
//respawn all bots
b.respawnBots();
},
zeroBotCount() { //remove all bots
tech.dynamoBotCount = 0

View File

@@ -317,7 +317,7 @@ const build = {
//update tech text //disable not allowed tech
for (let i = 0, len = tech.tech.length; i < len; i++) {
const techID = document.getElementById("tech-" + i)
if (!tech.tech[i].isExperimentHide) {
if (!tech.tech[i].isExperimentHide && (!tech.tech[i].isNonRefundable || tech.tech[i].isExperimentalMode)) {
if (tech.tech[i].allowed() || isAllowed || tech.tech[i].count > 0) {
const isCount = tech.tech[i].count > 1 ? `(${tech.tech[i].count}x)` : "";
@@ -410,7 +410,7 @@ const build = {
}
for (let i = 0, len = tech.tech.length; i < len; i++) {
if (!tech.tech[i].isExperimentHide) {
if (!tech.tech[i].isExperimentHide && (!tech.tech[i].isNonRefundable || tech.tech[i].isExperimentalMode)) {
if (tech.tech[i].allowed()) { // || tech.tech[i].name === "+1 cardinality") { //|| tech.tech[i].name === "leveraged investment"
if (tech.tech[i].isExperimentalMode) {
text += `<div id="tech-${i}" class="experiment-grid-module" onclick="build.choosePowerUp(this,${i},'tech')"><div class="grid-title">${tech.tech[i].name}</div> ${tech.tech[i].description}</div>`

View File

@@ -16,7 +16,7 @@ const level = {
// simulation.zoomScale = 1000;
// simulation.setZoom();
// m.setField("nano-scale manufacturing")
// b.giveGuns("foam")
// b.giveGuns("wave beam")
// b.giveGuns("laser")
// tech.isExplodeRadio = true
// for (let i = 0; i < 9; i++) tech.giveTech("auto-loading heuristics")
@@ -1110,7 +1110,7 @@ const level = {
spawn.mapRect(6700, -1800, 800, 2600); //right wall
spawn.mapRect(level.exit.x, level.exit.y + 20, 100, 100); //exit bump
spawn.starter(1900, -500, 200) //big boy
// spawn.starter(1900, -500, 200) //big boy
// spawn.grower(1900, -500)
// spawn.pulsarBoss(1900, -500)
// spawn.shooterBoss(1900, -500)
@@ -1119,7 +1119,7 @@ const level = {
// spawn.striker(1600, -500)
// spawn.laserTargetingBoss(1700, -120)
// spawn.bomberBoss(1400, -500)
// spawn.sniper(1800, -120)
spawn.ghoster(1800, -120)
// spawn.streamBoss(1600, -500)
// spawn.orbitalBoss(1600, -500)
// spawn.cellBossCulture(1600, -500)
@@ -1129,7 +1129,7 @@ const level = {
// spawn.nodeGroup(1200, -500, "pulsar")
// spawn.snakeBoss(1200, -500)
// spawn.powerUpBoss(2900, -500)
// spawn.suckerBoss(2900, -500)
// spawn.randomMob(1600, -500)
},
template() {

View File

@@ -1145,7 +1145,7 @@ const m = {
m.fieldCDcycle = m.cycle + 15;
m.isHolding = false;
//bullet-like collisions
// m.holdingTarget.collisionFilter.category = cat.bullet; //cat.body;
m.holdingTarget.collisionFilter.category = cat.body;
m.holdingTarget.collisionFilter.mask = cat.map | cat.body | cat.bullet | cat.mob | cat.mobBullet | cat.mobShield;
//check every second to see if player is away from thrown body, and make solid
const solid = function(that) {
@@ -1911,6 +1911,8 @@ const m = {
// simulation.timeSkip(1)
// m.energy += 1.5 * DRAIN; //x1 to undo the energy drain from time speed up, x1.5 to cut energy drain in half
// }
} else { //holding, but field button is released
m.wakeCheck();
}
} else if (m.holdingTarget && m.fieldCDcycle < m.cycle) { //holding, but field button is released
m.wakeCheck();

View File

@@ -2162,10 +2162,12 @@ const spawn = {
this.attraction();
this.search();
//draw
if (this.distanceToPlayer2() - this.seeAtDistance2 < 0) {
if (this.alpha < 1) this.alpha += 0.004;
} else {
if (this.alpha > 0) this.alpha -= 0.03;
if (!m.isBodiesAsleep) {
if (this.distanceToPlayer2() - this.seeAtDistance2 < 0) {
if (this.alpha < 1) this.alpha += 0.002 * simulation.CDScale;
} else {
if (this.alpha > 0) this.alpha -= 0.03;
}
}
if (this.alpha > 0) {
if (this.alpha > 0.9 && this.seePlayer.recall) {

View File

@@ -22,6 +22,17 @@
simulation.updateTechHUD();
},
removeTech(index) {
if (isNaN(index)) { //find index by name
let found = false;
for (let i = 0; i < tech.tech.length; i++) {
if (index === tech.tech[i].name) {
index = i;
found = true;
break;
}
}
if (!found) return //if name not found don't remove any tech
}
tech.tech[index].remove();
tech.tech[index].count = 0;
simulation.updateTechHUD();
@@ -1011,7 +1022,6 @@
maxCount: 9,
count: 0,
frequency: 1,
isNonRefundable: true,
isBot: true,
isBotTech: true,
allowed() {
@@ -1023,7 +1033,11 @@
b.nailBot();
},
remove() {
// tech.nailBotCount -= this.count;
if (this.count) {
tech.nailBotCount -= this.count;
b.clearPermanentBots();
b.respawnBots();
}
}
},
{
@@ -1039,7 +1053,7 @@
requires: "2 or more nail bots and only 1 bot upgrade",
effect() {
tech.isNailBotUpgrade = true
b.convertBotsTo("nailBotCount")
b.convertBotsTo("nail-bot")
for (let i = 0; i < bullet.length; i++) {
if (bullet[i].botType === 'nail') bullet[i].isUpgraded = true
}
@@ -1057,7 +1071,6 @@
maxCount: 9,
count: 0,
frequency: 1,
isNonRefundable: true,
isBot: true,
isBotTech: true,
allowed() {
@@ -1069,7 +1082,11 @@
b.foamBot();
},
remove() {
// tech.foamBotCount -= this.count;
if (this.count) {
tech.foamBotCount -= this.count;
b.clearPermanentBots();
b.respawnBots();
}
}
},
{
@@ -1085,7 +1102,7 @@
requires: "2 or more foam bots and only 1 bot upgrade",
effect() {
tech.isFoamBotUpgrade = true
b.convertBotsTo("foamBotCount")
b.convertBotsTo("foam-bot")
for (let i = 0; i < bullet.length; i++) {
if (bullet[i].botType === 'foam') bullet[i].isUpgraded = true
}
@@ -1103,7 +1120,6 @@
maxCount: 9,
count: 0,
frequency: 1,
isNonRefundable: true,
isBot: true,
isBotTech: true,
allowed() {
@@ -1115,7 +1131,11 @@
b.boomBot();
},
remove() {
// tech.boomBotCount -= this.count;
if (this.count) {
tech.boomBotCount -= this.count;
b.clearPermanentBots();
b.respawnBots();
}
}
},
{
@@ -1131,7 +1151,7 @@
requires: "2 or more boom bots and only 1 bot upgrade",
effect() {
tech.isBoomBotUpgrade = true
b.convertBotsTo("boomBotCount")
b.convertBotsTo("boom-bot")
for (let i = 0; i < bullet.length; i++) {
if (bullet[i].botType === 'boom') bullet[i].isUpgraded = true
}
@@ -1149,7 +1169,6 @@
maxCount: 9,
count: 0,
frequency: 1,
isNonRefundable: true,
isBot: true,
isBotTech: true,
allowed() {
@@ -1161,7 +1180,11 @@
b.laserBot();
},
remove() {
// tech.laserBotCount -= this.count;
if (this.count) {
tech.laserBotCount -= this.count;
b.clearPermanentBots();
b.respawnBots();
}
}
},
{
@@ -1177,7 +1200,7 @@
requires: "2 or more laser bots and only 1 bot upgrade",
effect() {
tech.isLaserBotUpgrade = true
b.convertBotsTo("laserBotCount")
b.convertBotsTo("laser-bot")
for (let i = 0; i < bullet.length; i++) {
if (bullet[i].botType === 'laser') bullet[i].isUpgraded = true
}
@@ -1195,7 +1218,7 @@
maxCount: 9,
count: 0,
frequency: 1,
isNonRefundable: true,
isBot: true,
isBotTech: true,
allowed() {
@@ -1207,7 +1230,11 @@
tech.orbitBotCount++;
},
remove() {
// tech.orbitBotCount -= this.count;
if (this.count) {
tech.orbitBotCount -= this.count;
b.clearPermanentBots();
b.respawnBots();
}
}
},
{
@@ -1223,7 +1250,7 @@
requires: "2 or more orbital bots and only 1 bot upgrade",
effect() {
tech.isOrbitBotUpgrade = true
b.convertBotsTo("orbitBotCount")
b.convertBotsTo("orbital-bot")
const range = 190 + 60 * tech.isOrbitBotUpgrade
for (let i = 0; i < bullet.length; i++) {
if (bullet[i].botType === 'orbit') {
@@ -1251,7 +1278,6 @@
maxCount: 9,
count: 0,
frequency: 1,
isNonRefundable: true,
isBot: true,
isBotTech: true,
allowed() {
@@ -1263,7 +1289,11 @@
b.dynamoBot();
},
remove() {
// tech.dynamoBotCount -= this.count;
if (this.count) {
tech.dynamoBotCount -= this.count;
b.clearPermanentBots();
b.respawnBots();
}
}
},
{
@@ -1279,7 +1309,7 @@
requires: "2 or more dynamo bots and only 1 bot upgrade",
effect() {
tech.isDynamoBotUpgrade = true
b.convertBotsTo("dynamoBotCount")
b.convertBotsTo("dynamo-bot")
for (let i = 0; i < bullet.length; i++) {
if (bullet[i].botType === 'dynamo') bullet[i].isUpgraded = true
}
@@ -1382,13 +1412,15 @@
count: 0,
frequency: 2,
isBotTech: true,
isNonRefundable: true,
// isNonRefundable: true,
isBadRandomOption: true,
numberOfGunsLost: 0,
allowed() {
return b.totalBots() > 3
},
requires: "at least 4 bots",
effect() {
this.numberOfGunsLost = b.inventory.length
b.removeAllGuns();
simulation.makeGunHUD();
//double bots
@@ -1409,7 +1441,25 @@
for (let i = 0; i < tech.missileBotCount; i++) b.missileBot();
tech.missileBotCount *= 2
},
remove() {}
remove() {
if (this.count) {
//return guns
for (let i = 0; i < this.numberOfGunsLost; i++) powerUps.spawn(m.pos.x + 60 * (Math.random() - 0.5), m.pos.y + 60 * (Math.random() - 0.5), "gun");
this.numberOfGunsLost = 0;
//half all current guns
tech.nailBotCount = Math.round(tech.nailBotCount / 2)
tech.laserBotCount = Math.round(tech.laserBotCount / 2)
tech.foamBotCount = Math.round(tech.foamBotCount / 2)
tech.boomBotCount = Math.round(tech.boomBotCount / 2)
tech.orbitBotCount = Math.round(tech.orbitBotCount / 2)
tech.dynamoBotCount = Math.round(tech.dynamoBotCount / 2)
tech.plasmaBotCount = Math.round(tech.plasmaBotCount / 2)
tech.missileBotCount = Math.round(tech.missileBotCount / 2)
b.clearPermanentBots();
b.respawnBots();
}
}
},
{
name: "mass driver",
@@ -2391,7 +2441,7 @@
powerUps.research.changeRerolls(0)
}, 1000);
},
description: "once per level use <strong>1</strong> <strong class='color-r'>research</strong><br>to prevent <strong>dying</strong> and spawn <strong>6</strong> <strong class='color-h'>heals</strong>",
description: "once per level, instead of <strong>dying</strong><br>consume <strong>1</strong> <strong class='color-r'>research</strong> and spawn <strong>6</strong> <strong class='color-h'>heals</strong>",
maxCount: 1,
count: 0,
frequency: 2,
@@ -2662,7 +2712,7 @@
},
{
name: "replication",
description: "<strong>7%</strong> chance to <strong class='color-dup'>duplicate</strong> spawned <strong>power ups</strong><br>add <strong>12</strong> <strong class='color-j'>JUNK</strong> <strong class='color-m'>tech</strong> to the potential pool",
description: "<strong>7.5%</strong> chance to <strong class='color-dup'>duplicate</strong> spawned <strong>power ups</strong><br>add <strong>12</strong> <strong class='color-j'>JUNK</strong> <strong class='color-m'>tech</strong> to the potential pool",
maxCount: 9,
count: 0,
frequency: 1,
@@ -2797,7 +2847,7 @@
},
{
name: "exchange symmetry",
description: "convert <strong>1</strong> a random <strong class='color-m'>tech</strong> into <strong>3</strong> new <strong class='color-g'>guns</strong><br><em>recursive tech lose all stacks</em>",
description: "convert <strong>1</strong> random <strong class='color-m'>tech</strong> into <strong>3</strong> new <strong class='color-g'>guns</strong><br><em>recursive tech lose all stacks</em>",
maxCount: 1,
count: 0,
frequency: 1,
@@ -3661,7 +3711,6 @@
maxCount: 1,
count: 0,
frequency: 2,
isNonRefundable: true,
isBot: true,
isBotTech: true,
allowed() {
@@ -3673,7 +3722,9 @@
b.missileBot();
},
remove() {
// tech.missileBotCount = 0;
tech.missileBotCount = 0;
b.clearPermanentBots();
b.respawnBots();
}
},
{
@@ -4491,7 +4542,7 @@
},
{
name: "bot manufacturing",
description: "use <strong>nano-scale manufacturing</strong><br>to build <strong>3</strong> random <strong class='color-bot'>bots</strong>",
description: "use <strong>nano-scale manufacturing</strong><br>to build <strong>2</strong> random <strong class='color-bot'>bots</strong>",
isFieldTech: true,
maxCount: 1,
count: 0,
@@ -4508,13 +4559,13 @@
m.energy = 0.01;
b.randomBot()
b.randomBot()
b.randomBot()
// b.randomBot()
},
remove() {}
},
{
name: "bot prototypes",
description: "use <strong>nano-scale manufacturing</strong> to <strong>upgrade</strong><br>all <strong class='color-bot'>bots</strong> to a random type and <strong>build</strong> <strong>2</strong> <strong class='color-bot'>bots</strong>",
name: "bot prototype",
description: "use <strong>nano-scale manufacturing</strong> to build<br>a random <strong class='color-bot'>bot</strong> and <strong>upgrade</strong> all <strong class='color-bot'>bots</strong> to that type",
isFieldTech: true,
maxCount: 1,
count: 0,
@@ -4531,72 +4582,59 @@
m.energy = 0.01;
//fill array of available bots
const notUpgradedBots = []
if (!tech.isNailBotUpgrade) notUpgradedBots.push(() => {
const num = 1
notUpgradedBots.push(() => {
tech.giveTech("nail-bot upgrade")
tech.setTechoNonRefundable("nail-bot upgrade")
for (let i = 0; i < 2; i++) {
for (let i = 0; i < num; i++) {
b.nailBot()
tech.nailBotCount++;
}
simulation.makeTextLog(`tech.isNailBotUpgrade = true`)
})
if (!tech.isFoamBotUpgrade) notUpgradedBots.push(() => {
notUpgradedBots.push(() => {
tech.giveTech("foam-bot upgrade")
tech.setTechoNonRefundable("foam-bot upgrade")
for (let i = 0; i < 2; i++) {
for (let i = 0; i < num; i++) {
b.foamBot()
tech.foamBotCount++;
}
simulation.makeTextLog(`tech.isFoamBotUpgrade = true`)
})
if (!tech.isBoomBotUpgrade) notUpgradedBots.push(() => {
notUpgradedBots.push(() => {
tech.giveTech("boom-bot upgrade")
tech.setTechoNonRefundable("boom-bot upgrade")
for (let i = 0; i < 2; i++) {
for (let i = 0; i < num; i++) {
b.boomBot()
tech.boomBotCount++;
}
simulation.makeTextLog(`tech.isBoomBotUpgrade = true`)
})
if (!tech.isLaserBotUpgrade) notUpgradedBots.push(() => {
notUpgradedBots.push(() => {
tech.giveTech("laser-bot upgrade")
tech.setTechoNonRefundable("laser-bot upgrade")
for (let i = 0; i < 2; i++) {
for (let i = 0; i < num; i++) {
b.laserBot()
tech.laserBotCount++;
}
simulation.makeTextLog(`tech.isLaserBotUpgrade = true`)
})
if (!tech.isOrbitBotUpgrade) notUpgradedBots.push(() => {
notUpgradedBots.push(() => {
tech.giveTech("orbital-bot upgrade")
tech.setTechoNonRefundable("orbital-bot upgrade")
for (let i = 0; i < 2; i++) {
for (let i = 0; i < num; i++) {
b.orbitBot()
tech.orbitBotCount++;
}
simulation.makeTextLog(`tech.isOrbitalBotUpgrade = true`)
})
if (!tech.isDynamoBotUpgrade) notUpgradedBots.push(() => {
tech.giveTech("dynamo-bot upgrade")
tech.setTechoNonRefundable("dynamo-bot upgrade")
for (let i = 0; i < 2; i++) {
b.dynamoBot()
tech.dynamoBotCount++;
}
simulation.makeTextLog(`tech.isDynamoBotUpgrade = true`)
})
//double chance for dynamo-bot, since it's very good for nano-scale
if (!tech.isDynamoBotUpgrade) notUpgradedBots.push(() => {
tech.giveTech("dynamo-bot upgrade")
tech.setTechoNonRefundable("dynamo-bot upgrade")
for (let i = 0; i < 2; i++) {
b.dynamoBot()
tech.dynamoBotCount++;
}
simulation.makeTextLog(`tech.isDynamoBotUpgrade = true`)
})
//choose random function from the array and run it
notUpgradedBots[Math.floor(Math.random() * notUpgradedBots.length)]()
for (let i = 0; i < 2; i++) { //double chance for dynamo-bot, since it's very good for nano-scale
notUpgradedBots.push(() => {
tech.giveTech("dynamo-bot upgrade")
for (let i = 0; i < num; i++) {
b.dynamoBot()
tech.dynamoBotCount++;
}
simulation.makeTextLog(`tech.isDynamoBotUpgrade = true`)
})
}
notUpgradedBots[Math.floor(Math.random() * notUpgradedBots.length)]() //choose random function from the array and run it
},
remove() {}
},
@@ -4770,7 +4808,6 @@
maxCount: 1,
count: 0,
frequency: 2,
isNonRefundable: true,
isBot: true,
isBotTech: true,
allowed() {
@@ -4782,7 +4819,9 @@
b.plasmaBot();
},
remove() {
// tech.plasmaBotCount = 0;
tech.plasmaBotCount = 0;
b.clearPermanentBots();
b.respawnBots();
}
},
{

View File

@@ -1,11 +1,7 @@
******************************************************** NEXT PATCH ********************************************************
pulse laser now charges up with energy before you fire, but it fires 3 overlapping explosions
please give feedback on balance (too strong, too weak?)
tech shockwave: now applies to all explosions
foam gun now gets 20% less ammo
some bot related tech is no longer nonRefundable
nonRefundable tech is now hidden in experiment mode
******************************************************** BUGS ********************************************************
@@ -41,6 +37,7 @@ is there a way to check if the player is stuck inside the map or block
avoid taking collision damage by teleporting to a random power up
removes the power up
what if you get stuck?
make a tech that improves all charge guns
for: pulse, foam, rail gun
@@ -52,6 +49,9 @@ make a tech that improves all charge guns
apply the new gun.do functions to other guns
rail gun
crouching missile?
works similar to foam
tech plasma field - plasma field becomes an aoe damage field with the same radius
200% more energy drain, 100% more damage