diff --git a/js/bullets.js b/js/bullets.js index 116d192..8ecf456 100644 --- a/js/bullets.js +++ b/js/bullets.js @@ -2707,8 +2707,8 @@ const b = { if (dist < 1000000 && Matter.Query.ray(map, this.position, mob[i].position).length === 0) { this.cd = game.cycle + this.delay; target = Vector.add(mob[i].position, Vector.mult(mob[i].velocity, Math.sqrt(dist) / 60)) - const radius = 6 + 6 * Math.random() - const SPEED = 27 - radius * 0.4; //(mech.crouch ? 32 : 20) - radius * 0.7; + const radius = 6 + 7 * Math.random() + const SPEED = 29 - radius * 0.5; //(mech.crouch ? 32 : 20) - radius * 0.7; const velocity = Vector.mult(Vector.normalise(Vector.sub(target, this.position)), SPEED) b.foam(this.position, velocity, radius) break; diff --git a/js/game.js b/js/game.js index 69729ad..608c0c1 100644 --- a/js/game.js +++ b/js/game.js @@ -338,7 +338,9 @@ const game = { } //in testing mode if (game.testing) { - if (keys[49]) { // give power ups with 1 + if (keys[192]) { // ` + powerUps.spawn(game.mouseInGame.x, game.mouseInGame.y, "reroll"); + } else if (keys[49]) { // give power ups with 1 powerUps.spawn(game.mouseInGame.x, game.mouseInGame.y, "heal"); } else if (keys[50]) { // 2 powerUps.spawn(game.mouseInGame.x, game.mouseInGame.y, "ammo"); diff --git a/js/index.js b/js/index.js index f31bc01..f64b893 100644 --- a/js/index.js +++ b/js/index.js @@ -81,7 +81,8 @@ const build = {
${mob.length} mobs,   ${body.length} blocks,   ${bullet.length} bullets,   ${powerUp.length} power ups
mouse: (${game.mouseInGame.x.toFixed(1)}, ${game.mouseInGame.y.toFixed(1)})   ${mech.cycle} cycles
-
health: ${(mech.health*100).toFixed(0)}%   energy: ${(mech.energy*100).toFixed(0)}%   mass: ${player.mass.toFixed(1)} +
health: ${(mech.health*100).toFixed(0)}%   energy: ${(mech.energy*100).toFixed(0)}%   +
mass: ${player.mass.toFixed(1)}   rerolls: ${powerUps.reroll.rerolls}
position: (${player.position.x.toFixed(1)}, ${player.position.y.toFixed(1)})   velocity: (${player.velocity.x.toFixed(1)}, ${player.velocity.y.toFixed(1)})
global damage increase: ${((b.damageFromMods()-1)*100).toFixed(0)}%
global harm reduction: ${((1-mech.harmReduction())*100).toFixed(0)}% diff --git a/js/level.js b/js/level.js index 40b29f9..d6e73a5 100644 --- a/js/level.js +++ b/js/level.js @@ -138,6 +138,7 @@ const level = { spawn.mapRect(-250, -700, 1000, 900); // shelf spawn.mapRect(-250, -1200, 1000, 250); // shelf roof powerUps.spawnStartingPowerUps(600, -800); + powerUps.spawn(550, -800, "reroll", false); //starting gun function blockDoor(x, y, blockSize = 58) { spawn.mapRect(x, y - 290, 40, 60); // door lip diff --git a/js/powerups.js b/js/powerups.js index 43fd55c..d7623c4 100644 --- a/js/powerups.js +++ b/js/powerups.js @@ -18,14 +18,9 @@ const powerUps = { // game.makeTextLog(`
  ${b.mods[index].name}

${b.mods[index].description}`, 500); // game.replaceTextLog = false; } - document.body.style.cursor = "none"; - document.getElementById("choose-grid").style.display = "none" - document.getElementById("choose-background").style.display = "none" - game.paused = false; - game.isChoosing = false; //stops p from un pausing on key down - requestAnimationFrame(cycle); + powerUps.endDraft(); }, - cancel() { + endDraft() { document.body.style.cursor = "none"; document.getElementById("choose-grid").style.display = "none" document.getElementById("choose-background").style.display = "none" @@ -40,6 +35,60 @@ const powerUps = { game.paused = true; game.isChoosing = true; //stops p from un pausing on key down }, + reroll: { + rerolls: 0, + name: "reroll", + color: "#f7b", + size() { + return 20; + }, + effect() { + powerUps.reroll.rerolls++ + game.makeTextLog("
  +1 reroll", 300) + }, + diceText() { + const r = powerUps.reroll.rerolls + const fullDice = Math.floor(r / 6) + const lastDice = r % 6 + let out = '' + for (let i = 0; i < fullDice; i++) { + out += '⚅' + } + if (lastDice === 1) { + out += '⚀' + } else if (lastDice === 2) { + out += '⚁' + } else if (lastDice === 3) { + out += '⚂' + } else if (lastDice === 4) { + out += '⚃' + } else if (lastDice === 5) { + out += '⚄' + } + return out + }, + // diceText() { + // if (powerUps.reroll.rerolls === 1) { + // return '⚀' + // } else if (powerUps.reroll.rerolls === 2) { + // return '⚁' + // } else if (powerUps.reroll.rerolls === 3) { + // return '⚂' + // } else if (powerUps.reroll.rerolls === 4) { + // return '⚃' + // } else if (powerUps.reroll.rerolls === 5) { + // return '⚄' + // } else if (powerUps.reroll.rerolls === 6) { + // return '⚅' + // } else if (powerUps.reroll.rerolls > 6) { + // return '⚅+' + // } + // }, + use(type) { + powerUps.reroll.rerolls--; + powerUps[type].effect(); + }, + }, heal: { name: "heal", color: "#0eb", @@ -113,7 +162,7 @@ const powerUps = { let choice2 = -1 let choice3 = -1 if (choice1 > -1) { - let text = `

choose a field

` + let text = `

choose a field

` text += `
  ${mech.fieldUpgrades[choice1].name}
${mech.fieldUpgrades[choice1].description}
` if (!b.isModDeterminism) { choice2 = pick(mech.fieldUpgrades, choice1) @@ -127,6 +176,8 @@ const powerUps = { let choice5 = pick(mech.fieldUpgrades, choice1, choice2, choice3, choice4) if (choice5 > -1) text += `
  ${mech.fieldUpgrades[choice5].name}
${mech.fieldUpgrades[choice5].description}
` } + if (powerUps.reroll.rerolls) text += `
  reroll ${powerUps.reroll.diceText()}
` + // text += `
${game.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(); @@ -156,7 +207,7 @@ const powerUps = { let choice2 = -1 let choice3 = -1 if (choice1 > -1) { - let text = `

choose a mod

` + let text = `

choose a mod

` text += `
  ${b.mods[choice1].name}
${b.mods[choice1].description}
` if (!b.isModDeterminism) { choice2 = pick(choice1) @@ -170,6 +221,8 @@ const powerUps = { let choice5 = pick(choice1, choice2, choice3, choice4) if (choice5 > -1) text += `
  ${b.mods[choice5].name}
${b.mods[choice5].description}
` } + if (powerUps.reroll.rerolls) text += `
  reroll ${powerUps.reroll.diceText()}
` + document.getElementById("choose-grid").innerHTML = text powerUps.showDraft(); } else { @@ -196,7 +249,7 @@ const powerUps = { let choice2 = -1 let choice3 = -1 if (choice1 > -1) { - let text = `

choose a gun

` + let text = `

choose a gun

` text += `
  ${b.guns[choice1].name}
${b.guns[choice1].description}
` if (!b.isModDeterminism) { choice2 = pick(b.guns, choice1) @@ -208,8 +261,12 @@ const powerUps = { let choice4 = pick(b.guns, choice1, choice2, choice3) if (choice4 > -1) text += `
  ${b.guns[choice4].name}
${b.guns[choice4].description}
` let choice5 = pick(b.guns, choice1, choice2, choice3, choice4) - if (choice5 > -1) text += `
  ${b.guns[choice5].name}
${b.guns[choice5].description}
` + if (choice5 > -1) text += `
+
  ${b.guns[choice5].name}
${b.guns[choice5].description}
` } + + if (powerUps.reroll.rerolls) text += `
  reroll ${powerUps.reroll.diceText()}
` + document.getElementById("choose-grid").innerHTML = text powerUps.showDraft(); } else { @@ -255,6 +312,11 @@ const powerUps = { if (Math.random() < b.modBayesian) powerUps.spawn(x, y, "field"); return; } + if (Math.random() < 0.01) { + powerUps.spawn(x, y, "reroll"); + if (Math.random() < b.modBayesian) powerUps.spawn(x, y, "reroll"); + return; + } }, spawnBossPowerUp(x, y) { //boss spawns field and gun mod upgrades if (mech.fieldMode === 0) { @@ -287,18 +349,15 @@ const powerUps = { powerUps.spawn(x, y, "ammo"); powerUps.spawn(x, y, "ammo"); powerUps.spawn(x, y, "ammo"); - if (Math.random() < b.modBayesian) { - powerUps.spawn(x, y, "ammo"); - powerUps.spawn(x, y, "ammo"); - powerUps.spawn(x, y, "ammo"); - } } }, chooseRandomPowerUp(x, y) { //100% chance to drop a random power up //used in spawn.debris - if (Math.random() < 0.5) { + if (Math.random() < 0.02) { + powerUps.spawn(x, y, "reroll"); + } else if (Math.random() < 0.5) { powerUps.spawn(x, y, "heal", false); - } else { - if (!b.modBayesian) powerUps.spawn(x, y, "ammo", false); + } else if (!b.modBayesian) { + powerUps.spawn(x, y, "ammo", false); } }, spawnStartingPowerUps(x, y) { //used for map specific power ups, mostly to give player a starting gun diff --git a/style.css b/style.css index 411cc95..a69d8d3 100644 --- a/style.css +++ b/style.css @@ -487,6 +487,8 @@ em { margin-bottom: -5px; } + + .field { background: #0cf; } @@ -508,6 +510,22 @@ em { background: #0d9; } +.reroll { + + /* #f84 #f99*/ + background: #f7b; +} + +.dice { + font-size: 45px; + vertical-align: -5px; + float: right; + /* position: absolute; + top: 15px; + right: 15px; */ + /* text-align: right; */ +} + .box { padding: 3px 8px 3px 8px; border: 2px solid #444; diff --git a/todo.txt b/todo.txt index 9304e40..6d1354b 100644 --- a/todo.txt +++ b/todo.txt @@ -4,6 +4,10 @@ mod: foam-bots ************** TODO - n-gon ************** +power up reroll + color yellow? + + sticking bullets don't always gain the correct speed from mobs after they die mod - frozen mobs take +33% damage