diff --git a/js/bullet.js b/js/bullet.js index 0eaf526..887c5d2 100644 --- a/js/bullet.js +++ b/js/bullet.js @@ -6,7 +6,15 @@ const b = { activeGun: null, //current gun in use by player inventoryGun: 0, inventory: [], //list of what guns player has // 0 starts with basic gun - fire() { + setFireMethod() { + if (tech.isFireNotMove) { + b.fire = b.fireNotMove + } else { + b.fire = b.fireNormal + } + }, + fire() {}, + fireNormal() { if (input.fire && mech.fireCDcycle < mech.cycle && (!input.field || mech.fieldFire) && b.inventory.length) { if (b.guns[b.activeGun].ammo > 0) { b.guns[b.activeGun].fire(); @@ -36,6 +44,37 @@ const b = { if (mech.holdingTarget) mech.drop(); } }, + fireNotMove() { + //added && player.speed < 0.5 && mech.onGround ************************* + if (input.fire && mech.fireCDcycle < mech.cycle && (!input.field || mech.fieldFire) && b.inventory.length && player.speed < 0.5 && mech.onGround && Math.abs(mech.yOff - mech.yOffGoal) < 1) { + if (b.guns[b.activeGun].ammo > 0) { + b.guns[b.activeGun].fire(); + if (tech.isCrouchAmmo && mech.crouch) { + if (tech.isCrouchAmmo % 2) { + b.guns[b.activeGun].ammo--; + simulation.updateGunHUD(); + } + tech.isCrouchAmmo++ //makes the no ammo toggle off and on + } else { + b.guns[b.activeGun].ammo--; + simulation.updateGunHUD(); + } + } else { + if (tech.isAmmoFromHealth) { + if (mech.health > 0.05) { + mech.damage(0.05 / mech.harmReduction()); // /mech.harmReduction() undoes damage increase from difficulty + if (!(tech.isRewindAvoidDeath && mech.energy > 0.66)) { //don't give ammo if CPT triggered + for (let i = 0; i < 3; i++) powerUps.spawn(mech.pos.x, mech.pos.y, "ammo"); + } + } + } else { + simulation.makeTextLog(`${b.guns[b.activeGun].name}.ammo: 0`); + } + mech.fireCDcycle = mech.cycle + 30; //fire cooldown + } + if (mech.holdingTarget) mech.drop(); + } + }, giveGuns(gun = "random", ammoPacks = 10) { if (tech.isOneGun) b.removeAllGuns(); if (gun === "random") { @@ -152,6 +191,7 @@ const b = { setFireCD() { b.fireCD = tech.fireRate * tech.slowFire * tech.researchHaste * tech.aimDamage / tech.fastTime if (tech.isFireRateForGuns) b.fireCD *= Math.pow(0.85, b.inventory.length) + if (tech.isFireNotMove) b.fireCD *= 0.33 }, fireAttributes(dir, rotate = true) { if (rotate) { diff --git a/js/index.js b/js/index.js index 0683237..8df2cd6 100644 --- a/js/index.js +++ b/js/index.js @@ -186,7 +186,7 @@ const build = {
fire delay decrease: ${((1-b.fireCD)*100).toFixed(0)}%
duplication chance: ${(Math.min(1,tech.duplicationChance())*100).toFixed(0)}%
-
research: ${powerUps.research.research} +
research: ${powerUps.research.count}
health: (${(mech.health*100).toFixed(0)} / ${(mech.maxHealth*100).toFixed(0)})   energy: (${(mech.energy*100).toFixed(0)} / ${(mech.maxEnergy*100).toFixed(0)})
position: (${player.position.x.toFixed(1)}, ${player.position.y.toFixed(1)})   velocity: (${player.velocity.x.toFixed(1)}, ${player.velocity.y.toFixed(1)})
mouse: (${simulation.mouseInGame.x.toFixed(1)}, ${simulation.mouseInGame.y.toFixed(1)})   mass: ${player.mass.toFixed(1)} diff --git a/js/level.js b/js/level.js index 0e8212d..28f1ace 100644 --- a/js/level.js +++ b/js/level.js @@ -82,7 +82,7 @@ const level = { powerUps.spawn(mech.pos.x + 60 * (Math.random() - 0.5), mech.pos.y + 60 * (Math.random() - 0.5), "heal", false); } if (tech.isPerpetualStun) { - for (let i = 0; i < mob.length; i++) mobs.statusStun(mob[i], 60 * 8) + for (let i = 0; i < mob.length; i++) mobs.statusStun(mob[i], 600) } if (tech.isGunCycle) { b.inventoryGun++; diff --git a/js/player.js b/js/player.js index 6dc5531..527bc80 100644 --- a/js/player.js +++ b/js/player.js @@ -464,7 +464,7 @@ const mech = { displayHealth() { id = document.getElementById("health"); // health display follows a x^1.5 rule to make it seem like the player has lower health, this makes the player feel more excitement - id.style.width = Math.floor(300 * Math.pow(mech.health, 1.5)) + "px"; + id.style.width = Math.floor(300 * mech.maxHealth * Math.pow(mech.health / mech.maxHealth, 1.4)) + "px"; //css animation blink if health is low if (mech.health < 0.3) { id.classList.add("low-health"); @@ -482,6 +482,7 @@ const mech = { baseHealth: 1, setMaxHealth() { mech.maxHealth = mech.baseHealth + tech.bonusHealth + tech.armorFromPowerUps + document.getElementById("health-bg").style.width = `${Math.floor(300*mech.maxHealth)}px` simulation.makeTextLog(`mech.maxHealth = ${mech.maxHealth.toFixed(2)}`) if (mech.health > mech.maxHealth) mech.health = mech.maxHealth; mech.displayHealth(); @@ -501,6 +502,7 @@ const mech = { if (tech.isNoFireDefense && mech.cycle > mech.fireCDcycle + 120) dmg *= 0.6 if (tech.energyRegen === 0) dmg *= 0.4 if (tech.isTurret && mech.crouch) dmg *= 0.5; + if (tech.isRestHarm && player.speed < 1) dmg *= 0.5; if (tech.isEntanglement && b.inventory[0] === b.activeGun) { for (let i = 0, len = b.inventory.length; i < len; i++) dmg *= 0.87 // 1 - 0.15 } @@ -620,10 +622,10 @@ const mech = { if (tech.isEnergyHealth) { mech.energy -= dmg; if (mech.energy < 0 || isNaN(mech.energy)) { //taking deadly damage - if (tech.isDeathAvoid && powerUps.research.research && !tech.isDeathAvoidedThisLevel) { + if (tech.isDeathAvoid && powerUps.research.count && !tech.isDeathAvoidedThisLevel) { tech.isDeathAvoidedThisLevel = true powerUps.research.changeRerolls(-1) - simulation.makeTextLog(`mech.research--
${powerUps.research.research}`) + simulation.makeTextLog(`mech.research--
${powerUps.research.count}`) for (let i = 0; i < 6; i++) { powerUps.spawn(mech.pos.x, mech.pos.y, "heal", false); } @@ -650,12 +652,12 @@ const mech = { dmg *= mech.harmReduction() mech.health -= dmg; if (mech.health < 0 || isNaN(mech.health)) { - if (tech.isDeathAvoid && powerUps.research.research > 0 && !tech.isDeathAvoidedThisLevel) { //&& Math.random() < 0.5 + if (tech.isDeathAvoid && powerUps.research.count > 0 && !tech.isDeathAvoidedThisLevel) { //&& Math.random() < 0.5 tech.isDeathAvoidedThisLevel = true mech.health = 0.05 powerUps.research.changeRerolls(-1) simulation.makeTextLog(`mech.research-- -
${powerUps.research.research}`) +
${powerUps.research.count}`) for (let i = 0; i < 6; i++) powerUps.spawn(mech.pos.x + 10 * Math.random(), mech.pos.y + 10 * Math.random(), "heal", false); mech.immuneCycle = mech.cycle + 360 //disable this.immuneCycle bonus seconds simulation.wipe = function() { //set wipe to have trails diff --git a/js/powerup.js b/js/powerup.js index a9bd482..e903eec 100644 --- a/js/powerup.js +++ b/js/powerup.js @@ -56,7 +56,7 @@ const powerUps = { simulation.makeTextLog(`powerUps.tech.length: ${Math.max(0,powerUps.tech.lastTotalChoices - powerUps.tech.banishLog.length)}`) } } - if (tech.manyWorlds && powerUps.research.research === 0) { + if (tech.manyWorlds && powerUps.research.count === 0) { for (let i = 0; i < 2; i++) powerUps.spawn(mech.pos.x + 40 * (Math.random() - 0.5), mech.pos.y + 40 * (Math.random() - 0.5), "research", false); } document.getElementById("choose-grid").style.display = "none" @@ -70,7 +70,7 @@ const powerUps = { requestAnimationFrame(cycle); }, research: { - research: 0, + count: 0, name: "research", color: "#f7b", size() { @@ -80,17 +80,17 @@ const powerUps = { powerUps.research.changeRerolls(1) }, changeRerolls(amount) { - powerUps.research.research += amount - if (powerUps.research.research < 0) { - powerUps.research.research = 0 - } else { - simulation.makeTextLog(`powerUps.research.research += ${amount}`) //
${powerUps.research.research} + if (amount !== 0) { + powerUps.research.count += amount + if (powerUps.research.count < 0) { + powerUps.research.count = 0 + } else { + simulation.makeTextLog(`powerUps.research.count += ${amount}`) //
${powerUps.research.count} + } } - - if (tech.isRerollBots) { const limit = 5 - for (; powerUps.research.research > limit - 1; powerUps.research.research -= limit) { + for (; powerUps.research.count > limit - 1; powerUps.research.count -= limit) { b.randomBot() if (tech.renormalization) { for (let i = 0; i < limit; i++) { @@ -103,11 +103,11 @@ const powerUps = { } } if (tech.isDeathAvoid && document.getElementById("tech-anthropic")) { - document.getElementById("tech-anthropic").innerHTML = `-${powerUps.research.research}` + document.getElementById("tech-anthropic").innerHTML = `-${powerUps.research.count}` } if (tech.renormalization && Math.random() < 0.37 && amount < 0) powerUps.spawn(mech.pos.x, mech.pos.y, "research"); if (tech.isRerollHaste) { - if (powerUps.research.research === 0) { + if (powerUps.research.count === 0) { tech.researchHaste = 0.66; b.setFireCD(); } else { @@ -119,7 +119,7 @@ const powerUps = { use(type) { //runs when you actually research a list of selections, type can be field, gun, or tech powerUps.research.changeRerolls(-1) // simulation.makeTextLog(`mech.research-- - //
${powerUps.research.research}`) + //
${powerUps.research.count}`) if (tech.isBanish && type === 'tech') { // banish researched tech const banishLength = tech.isDeterminism ? 1 : 3 + tech.isExtraChoice * 2 if (powerUps.tech.choiceLog.length > banishLength || powerUps.tech.choiceLog.length === banishLength) { //I'm not sure this check is needed @@ -248,12 +248,12 @@ const powerUps = { powerUps.field.choiceLog.push(choice2) powerUps.field.choiceLog.push(choice3) - if (powerUps.research.research) { + if (powerUps.research.count) { text += `
` - for (let i = 0, len = Math.min(powerUps.research.research, 30); i < len; i++) text += `
` + for (let i = 0, len = Math.min(powerUps.research.count, 30); i < len; i++) text += `
` text += `
research
` } - //(${powerUps.research.research}) + //(${powerUps.research.count}) // text += `
${simulation.SVGrightMouse} activate the shield with the right mouse
fields shield you from damage
and let you pick up and throw blocks
` document.getElementById("choose-grid").innerHTML = text powerUps.showDraft(); @@ -358,11 +358,11 @@ const powerUps = { powerUps.tech.choiceLog.push(choice1) powerUps.tech.choiceLog.push(choice2) powerUps.tech.choiceLog.push(choice3) - // if (powerUps.research.research) text += `
  research ${powerUps.research.research}
` + // if (powerUps.research.count) text += `
  research ${powerUps.research.count}
` - if (powerUps.research.research) { + if (powerUps.research.count) { text += `
` - for (let i = 0, len = Math.min(powerUps.research.research, 30); i < len; i++) text += `
` + for (let i = 0, len = Math.min(powerUps.research.count, 30); i < len; i++) text += `
` text += `
research
` } @@ -445,10 +445,10 @@ const powerUps = { powerUps.gun.choiceLog.push(choice1) powerUps.gun.choiceLog.push(choice2) powerUps.gun.choiceLog.push(choice3) - // if (powerUps.research.research) text += `
  research ${powerUps.research.research}
` - if (powerUps.research.research) { + // if (powerUps.research.count) text += `
  research ${powerUps.research.count}
` + if (powerUps.research.count) { text += `
` - for (let i = 0, len = Math.min(powerUps.research.research, 30); i < len; i++) text += `
` + for (let i = 0, len = Math.min(powerUps.research.count, 30); i < len; i++) text += `
` text += `
research
` } // console.log(powerUps.gun.choiceLog) diff --git a/js/simulation.js b/js/simulation.js index d7e7c4e..ca02be8 100644 --- a/js/simulation.js +++ b/js/simulation.js @@ -523,10 +523,11 @@ const simulation = { tech.plasmaBotCount = 0; tech.missileBotCount = 0; + b.setFireMethod() b.setFireCD(); simulation.updateTechHUD(); powerUps.totalPowerUps = 0; - powerUps.research.research = 0; + powerUps.research.count = 0; mech.setFillColors(); // mech.maxHealth = 1 // mech.maxEnergy = 1 @@ -539,10 +540,6 @@ const simulation = { simulation.makeGunHUD(); simulation.lastLogTime = 0; - - - - level.onLevel = 0; level.levelsCleared = 0; //resetting difficulty diff --git a/js/tech.js b/js/tech.js index 40813b8..924014c 100644 --- a/js/tech.js +++ b/js/tech.js @@ -90,7 +90,7 @@ const tech = { if (tech.restDamage > 1 && player.speed < 1) dmg *= tech.restDamage if (tech.isEnergyDamage) dmg *= 1 + mech.energy / 9; if (tech.isDamageFromBulletCount) dmg *= 1 + bullet.length * 0.0038 - if (tech.isRerollDamage) dmg *= 1 + 0.035 * powerUps.research.research + if (tech.isRerollDamage) dmg *= 1 + 0.035 * powerUps.research.count if (tech.isOneGun && b.inventory.length < 2) dmg *= 1.25 if (tech.isNoFireDamage && mech.cycle > mech.fireCDcycle + 120) dmg *= 1.66 if (tech.isSpeedDamage) dmg *= 1 + Math.min(0.4, player.speed * 0.013) @@ -324,6 +324,76 @@ const tech = { tech.isTurret = false; } }, + { + name: "inertial frame", + description: "66% decreased delay after firing
you can only fire when at rest", + maxCount: 1, + count: 0, + allowed() { + return true + }, + requires: "", + effect: () => { + tech.isFireNotMove = true; + b.setFireCD(); + b.setFireMethod(); + }, + remove() { + if (tech.isFireNotMove) { + tech.isFireNotMove = false + b.setFireCD(); + b.setFireMethod(); + } + } + }, + { + name: "dead reckoning", + description: "increase damage by 33% when at rest", + maxCount: 9, + count: 0, + allowed() { + return tech.isFireNotMove + }, + requires: "inertial frame", + effect: () => { + tech.restDamage += 0.33 + }, + remove() { + tech.restDamage = 1; + } + }, + { + name: "Galilean group", + description: "reduce harm by 50% when at rest", + maxCount: 1, + count: 0, + allowed() { + return tech.isFireNotMove + }, + requires: "inertial frame", + effect() { + tech.isRestHarm = true + }, + remove() { + tech.isRestHarm = false; + } + }, + { + name: "kinetic bombardment", + description: "increase damage by up to 33%
at a distance of 40 steps from the target", + maxCount: 1, + count: 0, + allowed() { + return true + }, + requires: "", + effect() { + tech.isFarAwayDmg = true; //used in mob.damage() + }, + remove() { + tech.isFarAwayDmg = false; + } + }, { name: "electrostatic discharge", description: "increase damage by 20%
20% increased delay after firing", @@ -755,7 +825,7 @@ const tech = { maxCount: 1, count: 0, allowed() { - return powerUps.research.research > 5 || build.isCustomSelection + return powerUps.research.count > 5 || build.isCustomSelection }, requires: "at least 6 research", effect() { @@ -844,38 +914,6 @@ const tech = { }, remove() {} }, - { - name: "rest frame", - description: "increase damage by 25%
when not moving", - maxCount: 6, - count: 0, - allowed() { - return mech.Fx === 0.016 - }, - requires: "base movement speed", - effect: () => { - tech.restDamage += 0.25 - }, - remove() { - tech.restDamage = 1; - } - }, - { - name: "kinetic bombardment", - description: "increase damage by up to 33%
at a distance of 40 steps from the target", - maxCount: 1, - count: 0, - allowed() { - return true - }, - requires: "", - effect() { - tech.isFarAwayDmg = true; //used in mob.damage() - }, - remove() { - tech.isFarAwayDmg = false; - } - }, { name: "squirrel-cage rotor", description: "move and jump about 25% faster", @@ -946,7 +984,7 @@ const tech = { }, { name: "perpetual stun", - description: "stun all mobs for up to 8 seconds
at the start of each level", + description: "stun all mobs for up to 10 seconds
at the start of each level", maxCount: 1, count: 0, allowed() { @@ -960,22 +998,6 @@ const tech = { tech.isPerpetualStun = false } }, - { - name: "osmoprotectant", - description: `collisions with stunned or frozen mobs
cause you no harm`, - maxCount: 1, - count: 0, - allowed() { - return tech.isStunField || tech.isPulseStun || tech.oneSuperBall || tech.isHarmFreeze || tech.isIceField || tech.isIceCrystals || tech.isSporeFreeze || tech.isAoESlow || tech.isFreezeMobs || tech.isCloakStun || tech.orbitBotCount > 1 || tech.isWormholeDamage - }, - requires: "a freezing or stunning effect", - effect() { - tech.isFreezeHarmImmune = true; - }, - remove() { - tech.isFreezeHarmImmune = false; - } - }, { name: "Pauli exclusion", description: `after receiving harm from a collision become
immune to harm for an extra 0.75 seconds`, @@ -1076,7 +1098,22 @@ const tech = { tech.isHarmFreeze = false; } }, - + { + name: "osmoprotectant", + description: `collisions with stunned or frozen mobs
cause you no harm`, + maxCount: 1, + count: 0, + allowed() { + return tech.isStunField || tech.isPulseStun || tech.oneSuperBall || tech.isHarmFreeze || tech.isIceField || tech.isIceCrystals || tech.isSporeFreeze || tech.isAoESlow || tech.isFreezeMobs || tech.isCloakStun || tech.orbitBotCount > 1 || tech.isWormholeDamage + }, + requires: "a freezing or stunning effect", + effect() { + tech.isFreezeHarmImmune = true; + }, + remove() { + tech.isFreezeHarmImmune = false; + } + }, { name: "clock gating", description: `slow time by 50% after receiving harm
reduce harm by 15%`, @@ -1572,7 +1609,7 @@ const tech = { maxCount: 1, count: 0, allowed() { - return powerUps.research.research > 0 || build.isCustomSelection + return powerUps.research.count > 0 || build.isCustomSelection }, requires: "at least 1 research", effect() { @@ -1592,7 +1629,7 @@ const tech = { maxCount: 1, count: 0, allowed() { - return powerUps.research.research > 1 || build.isCustomSelection + return powerUps.research.count > 1 || build.isCustomSelection }, requires: "at least 2 research", effect() { @@ -1774,13 +1811,13 @@ const tech = { isNonRefundable: true, isCustomHide: true, allowed() { - return !tech.isSuperDeterminism && tech.duplicationChance() > 0 && powerUps.research.research > 1 + return !tech.isSuperDeterminism && tech.duplicationChance() > 0 && powerUps.research.count > 1 }, requires: "at least 1 tech and 1 research, a chance to duplicate power ups", effect: () => { powerUps.research.changeRerolls(-2) simulation.makeTextLog(`mech.research -= 2 -
${powerUps.research.research}`) +
${powerUps.research.count}`) const chanceStore = tech.duplicateChance tech.duplicateChance = (tech.isBayesian ? 0.2 : 0) + tech.cancelCount * 0.04 + mech.duplicateChance + tech.duplicateChance * 2 //increase duplication chance to simulate doubling all 3 sources of duplication chance powerUps.spawn(mech.pos.x, mech.pos.y, "tech"); @@ -1867,7 +1904,7 @@ const tech = { maxCount: 1, count: 0, allowed() { - return powerUps.research.research === 0 && !tech.manyWorlds + return powerUps.research.count === 0 && !tech.manyWorlds }, requires: "no research", effect() { @@ -1887,7 +1924,7 @@ const tech = { maxCount: 1, count: 0, allowed() { - return powerUps.research.research === 0 && !tech.isSuperDeterminism && !tech.isRerollHaste + return powerUps.research.count === 0 && !tech.isSuperDeterminism && !tech.isRerollHaste }, requires: "not superdeterminism or Ψ(t) collapse
no research", effect: () => { @@ -1903,7 +1940,7 @@ const tech = { maxCount: 1, count: 0, allowed() { - return (powerUps.research.research > 1 || build.isCustomSelection) && !tech.isSuperDeterminism && !tech.isRerollHaste + return (powerUps.research.count > 1 || build.isCustomSelection) && !tech.isSuperDeterminism && !tech.isRerollHaste }, requires: "not superdeterminism or Ψ(t) collapse
at least 2 research", effect() { @@ -1919,7 +1956,7 @@ const tech = { maxCount: 1, count: 0, allowed() { - return (powerUps.research.research > 2 || build.isCustomSelection) && !tech.isDeterminism + return (powerUps.research.count > 2 || build.isCustomSelection) && !tech.isDeterminism }, requires: "not determinism, at least 3 research", effect() { @@ -1939,7 +1976,7 @@ const tech = { maxCount: 1, count: 0, allowed() { - return powerUps.research.research > 4 || build.isCustomSelection + return powerUps.research.count > 4 || build.isCustomSelection }, requires: "at least 5 research", effect() { @@ -4074,5 +4111,7 @@ const tech = { isDupDamage: null, isFireRateForGuns: null, cyclicImmunity: null, - isTechDamage: null + isTechDamage: null, + isFireNotMove: null, + isRestHarm: null } \ No newline at end of file diff --git a/style.css b/style.css index 3a1a290..27efcf6 100644 --- a/style.css +++ b/style.css @@ -328,7 +328,8 @@ summary { top: 15px; left: 15px; height: 20px; - width: 300px; + width: 0px; + transition: width 1s ease-out; background-color: #000; opacity: 0.1; z-index: 1; diff --git a/todo.txt b/todo.txt index 1664c62..8c6f6e5 100644 --- a/todo.txt +++ b/todo.txt @@ -1,9 +1,13 @@ ******************************************************** NEXT PATCH ******************************************************** -tech: antiscience - 100% damage, but lose 11 health when you pick up a tech -tech: laser widebeam + output coupler can now stack up to 9x (was 1x) - but it not longer works with tech: slow light propagation +health background finally updates to show max health changes +tech: rest frame is removed +tech: inertial frame - gain 66% fire rate, but you can't fire when moving +tech: dead reckoning - when at rest do 33% more damage + requires inertial frame +tech: Galilean group - when at rest take 50% less harm + requires inertial frame ******************************************************** BUGS ******************************************************** CPT check for crouch after rewind @@ -34,7 +38,7 @@ bot that follows the players history give player energy overfill AOE damage to mobs push away mobs - wen close to player: damage bonus damage reduction + when close to player: damage bonus damage reduction tech: dodge chance for cloaking, harmonic fields, also pilot wave 20% chance up to 3 stacks, not additive