rerolls
This commit is contained in:
@@ -2707,8 +2707,8 @@ const b = {
|
|||||||
if (dist < 1000000 && Matter.Query.ray(map, this.position, mob[i].position).length === 0) {
|
if (dist < 1000000 && Matter.Query.ray(map, this.position, mob[i].position).length === 0) {
|
||||||
this.cd = game.cycle + this.delay;
|
this.cd = game.cycle + this.delay;
|
||||||
target = Vector.add(mob[i].position, Vector.mult(mob[i].velocity, Math.sqrt(dist) / 60))
|
target = Vector.add(mob[i].position, Vector.mult(mob[i].velocity, Math.sqrt(dist) / 60))
|
||||||
const radius = 6 + 6 * Math.random()
|
const radius = 6 + 7 * Math.random()
|
||||||
const SPEED = 27 - radius * 0.4; //(mech.crouch ? 32 : 20) - radius * 0.7;
|
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)
|
const velocity = Vector.mult(Vector.normalise(Vector.sub(target, this.position)), SPEED)
|
||||||
b.foam(this.position, velocity, radius)
|
b.foam(this.position, velocity, radius)
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -338,7 +338,9 @@ const game = {
|
|||||||
}
|
}
|
||||||
//in testing mode
|
//in testing mode
|
||||||
if (game.testing) {
|
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");
|
powerUps.spawn(game.mouseInGame.x, game.mouseInGame.y, "heal");
|
||||||
} else if (keys[50]) { // 2
|
} else if (keys[50]) { // 2
|
||||||
powerUps.spawn(game.mouseInGame.x, game.mouseInGame.y, "ammo");
|
powerUps.spawn(game.mouseInGame.x, game.mouseInGame.y, "ammo");
|
||||||
|
|||||||
@@ -81,7 +81,8 @@ const build = {
|
|||||||
<br>${mob.length} mobs, ${body.length} blocks, ${bullet.length} bullets, ${powerUp.length} power ups
|
<br>${mob.length} mobs, ${body.length} blocks, ${bullet.length} bullets, ${powerUp.length} power ups
|
||||||
<br>mouse: (${game.mouseInGame.x.toFixed(1)}, ${game.mouseInGame.y.toFixed(1)}) ${mech.cycle} cycles
|
<br>mouse: (${game.mouseInGame.x.toFixed(1)}, ${game.mouseInGame.y.toFixed(1)}) ${mech.cycle} cycles
|
||||||
<br>
|
<br>
|
||||||
<br>health: ${(mech.health*100).toFixed(0)}% energy: ${(mech.energy*100).toFixed(0)}% mass: ${player.mass.toFixed(1)}
|
<br>health: ${(mech.health*100).toFixed(0)}% energy: ${(mech.energy*100).toFixed(0)}%
|
||||||
|
<br>mass: ${player.mass.toFixed(1)} rerolls: ${powerUps.reroll.rerolls}
|
||||||
<br>position: (${player.position.x.toFixed(1)}, ${player.position.y.toFixed(1)}) velocity: (${player.velocity.x.toFixed(1)}, ${player.velocity.y.toFixed(1)})
|
<br>position: (${player.position.x.toFixed(1)}, ${player.position.y.toFixed(1)}) velocity: (${player.velocity.x.toFixed(1)}, ${player.velocity.y.toFixed(1)})
|
||||||
<br>global damage increase: ${((b.damageFromMods()-1)*100).toFixed(0)}%
|
<br>global damage increase: ${((b.damageFromMods()-1)*100).toFixed(0)}%
|
||||||
<br>global harm reduction: ${((1-mech.harmReduction())*100).toFixed(0)}%
|
<br>global harm reduction: ${((1-mech.harmReduction())*100).toFixed(0)}%
|
||||||
|
|||||||
@@ -138,6 +138,7 @@ const level = {
|
|||||||
spawn.mapRect(-250, -700, 1000, 900); // shelf
|
spawn.mapRect(-250, -700, 1000, 900); // shelf
|
||||||
spawn.mapRect(-250, -1200, 1000, 250); // shelf roof
|
spawn.mapRect(-250, -1200, 1000, 250); // shelf roof
|
||||||
powerUps.spawnStartingPowerUps(600, -800);
|
powerUps.spawnStartingPowerUps(600, -800);
|
||||||
|
powerUps.spawn(550, -800, "reroll", false); //starting gun
|
||||||
|
|
||||||
function blockDoor(x, y, blockSize = 58) {
|
function blockDoor(x, y, blockSize = 58) {
|
||||||
spawn.mapRect(x, y - 290, 40, 60); // door lip
|
spawn.mapRect(x, y - 290, 40, 60); // door lip
|
||||||
|
|||||||
@@ -18,14 +18,9 @@ const powerUps = {
|
|||||||
// game.makeTextLog(`<div class="circle mod"></div> <strong style='font-size:30px;'>${b.mods[index].name}</strong><br><br> ${b.mods[index].description}`, 500);
|
// game.makeTextLog(`<div class="circle mod"></div> <strong style='font-size:30px;'>${b.mods[index].name}</strong><br><br> ${b.mods[index].description}`, 500);
|
||||||
// game.replaceTextLog = false;
|
// game.replaceTextLog = false;
|
||||||
}
|
}
|
||||||
document.body.style.cursor = "none";
|
powerUps.endDraft();
|
||||||
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);
|
|
||||||
},
|
},
|
||||||
cancel() {
|
endDraft() {
|
||||||
document.body.style.cursor = "none";
|
document.body.style.cursor = "none";
|
||||||
document.getElementById("choose-grid").style.display = "none"
|
document.getElementById("choose-grid").style.display = "none"
|
||||||
document.getElementById("choose-background").style.display = "none"
|
document.getElementById("choose-background").style.display = "none"
|
||||||
@@ -40,6 +35,60 @@ const powerUps = {
|
|||||||
game.paused = true;
|
game.paused = true;
|
||||||
game.isChoosing = true; //stops p from un pausing on key down
|
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("<div class='circle reroll'></div> <span style='font-size:115%;'> <strong>+1 reroll</strong></span>", 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: {
|
heal: {
|
||||||
name: "heal",
|
name: "heal",
|
||||||
color: "#0eb",
|
color: "#0eb",
|
||||||
@@ -113,7 +162,7 @@ const powerUps = {
|
|||||||
let choice2 = -1
|
let choice2 = -1
|
||||||
let choice3 = -1
|
let choice3 = -1
|
||||||
if (choice1 > -1) {
|
if (choice1 > -1) {
|
||||||
let text = `<div class='cancel' onclick='powerUps.cancel("field")'>✕</div><h3 style = 'color:#fff; text-align:left; margin: 0px;'>choose a field</h3>`
|
let text = `<div class='cancel' onclick='powerUps.endDraft("field")'>✕</div><h3 style = 'color:#fff; text-align:left; margin: 0px;'>choose a field</h3>`
|
||||||
text += `<div class="choose-grid-module" onclick="powerUps.choose('field',${choice1})"><div class="grid-title"><div class="circle-grid field"></div> ${mech.fieldUpgrades[choice1].name}</div> ${mech.fieldUpgrades[choice1].description}</div>`
|
text += `<div class="choose-grid-module" onclick="powerUps.choose('field',${choice1})"><div class="grid-title"><div class="circle-grid field"></div> ${mech.fieldUpgrades[choice1].name}</div> ${mech.fieldUpgrades[choice1].description}</div>`
|
||||||
if (!b.isModDeterminism) {
|
if (!b.isModDeterminism) {
|
||||||
choice2 = pick(mech.fieldUpgrades, choice1)
|
choice2 = pick(mech.fieldUpgrades, choice1)
|
||||||
@@ -127,6 +176,8 @@ const powerUps = {
|
|||||||
let choice5 = pick(mech.fieldUpgrades, choice1, choice2, choice3, choice4)
|
let choice5 = pick(mech.fieldUpgrades, choice1, choice2, choice3, choice4)
|
||||||
if (choice5 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('field',${choice5})"><div class="grid-title"><div class="circle-grid field"></div> ${mech.fieldUpgrades[choice5].name}</div> ${mech.fieldUpgrades[choice5].description}</div>`
|
if (choice5 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('field',${choice5})"><div class="grid-title"><div class="circle-grid field"></div> ${mech.fieldUpgrades[choice5].name}</div> ${mech.fieldUpgrades[choice5].description}</div>`
|
||||||
}
|
}
|
||||||
|
if (powerUps.reroll.rerolls) text += `<div class="choose-grid-module" onclick="powerUps.reroll.use('field')"><div class="grid-title"><div class="circle-grid reroll"></div> reroll <span class='dice'>${powerUps.reroll.diceText()}</span></div></div>`
|
||||||
|
|
||||||
// text += `<div style = 'color:#fff'>${game.SVGrightMouse} activate the shield with the right mouse<br>fields shield you from damage <br>and let you pick up and throw blocks</div>`
|
// text += `<div style = 'color:#fff'>${game.SVGrightMouse} activate the shield with the right mouse<br>fields shield you from damage <br>and let you pick up and throw blocks</div>`
|
||||||
document.getElementById("choose-grid").innerHTML = text
|
document.getElementById("choose-grid").innerHTML = text
|
||||||
powerUps.showDraft();
|
powerUps.showDraft();
|
||||||
@@ -156,7 +207,7 @@ const powerUps = {
|
|||||||
let choice2 = -1
|
let choice2 = -1
|
||||||
let choice3 = -1
|
let choice3 = -1
|
||||||
if (choice1 > -1) {
|
if (choice1 > -1) {
|
||||||
let text = `<div class='cancel' onclick='powerUps.cancel("mod")'>✕</div><h3 style = 'color:#fff; text-align:left; margin: 0px;'>choose a mod</h3>`
|
let text = `<div class='cancel' onclick='powerUps.endDraft("mod")'>✕</div><h3 style = 'color:#fff; text-align:left; margin: 0px;'>choose a mod</h3>`
|
||||||
text += `<div class="choose-grid-module" onclick="powerUps.choose('mod',${choice1})"><div class="grid-title"><div class="circle-grid mod"></div> ${b.mods[choice1].name}</div> ${b.mods[choice1].description}</div>`
|
text += `<div class="choose-grid-module" onclick="powerUps.choose('mod',${choice1})"><div class="grid-title"><div class="circle-grid mod"></div> ${b.mods[choice1].name}</div> ${b.mods[choice1].description}</div>`
|
||||||
if (!b.isModDeterminism) {
|
if (!b.isModDeterminism) {
|
||||||
choice2 = pick(choice1)
|
choice2 = pick(choice1)
|
||||||
@@ -170,6 +221,8 @@ const powerUps = {
|
|||||||
let choice5 = pick(choice1, choice2, choice3, choice4)
|
let choice5 = pick(choice1, choice2, choice3, choice4)
|
||||||
if (choice5 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('mod',${choice5})"><div class="grid-title"><div class="circle-grid mod"></div> ${b.mods[choice5].name}</div> ${b.mods[choice5].description}</div>`
|
if (choice5 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('mod',${choice5})"><div class="grid-title"><div class="circle-grid mod"></div> ${b.mods[choice5].name}</div> ${b.mods[choice5].description}</div>`
|
||||||
}
|
}
|
||||||
|
if (powerUps.reroll.rerolls) text += `<div class="choose-grid-module" onclick="powerUps.reroll.use('mod')"><div class="grid-title"><div class="circle-grid reroll"></div> reroll <span class='dice'>${powerUps.reroll.diceText()}</span></div></div>`
|
||||||
|
|
||||||
document.getElementById("choose-grid").innerHTML = text
|
document.getElementById("choose-grid").innerHTML = text
|
||||||
powerUps.showDraft();
|
powerUps.showDraft();
|
||||||
} else {
|
} else {
|
||||||
@@ -196,7 +249,7 @@ const powerUps = {
|
|||||||
let choice2 = -1
|
let choice2 = -1
|
||||||
let choice3 = -1
|
let choice3 = -1
|
||||||
if (choice1 > -1) {
|
if (choice1 > -1) {
|
||||||
let text = `<div class='cancel' onclick='powerUps.cancel("gun")'>✕</div><h3 style = 'color:#fff; text-align:left; margin: 0px;'>choose a gun</h3>`
|
let text = `<div class='cancel' onclick='powerUps.endDraft("gun")'>✕</div><h3 style = 'color:#fff; text-align:left; margin: 0px;'>choose a gun</h3>`
|
||||||
text += `<div class="choose-grid-module" onclick="powerUps.choose('gun',${choice1})"><div class="grid-title"><div class="circle-grid gun"></div> ${b.guns[choice1].name}</div> ${b.guns[choice1].description}</div>`
|
text += `<div class="choose-grid-module" onclick="powerUps.choose('gun',${choice1})"><div class="grid-title"><div class="circle-grid gun"></div> ${b.guns[choice1].name}</div> ${b.guns[choice1].description}</div>`
|
||||||
if (!b.isModDeterminism) {
|
if (!b.isModDeterminism) {
|
||||||
choice2 = pick(b.guns, choice1)
|
choice2 = pick(b.guns, choice1)
|
||||||
@@ -208,8 +261,12 @@ const powerUps = {
|
|||||||
let choice4 = pick(b.guns, choice1, choice2, choice3)
|
let choice4 = pick(b.guns, choice1, choice2, choice3)
|
||||||
if (choice4 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('gun',${choice4})"><div class="grid-title"><div class="circle-grid gun"></div> ${b.guns[choice4].name}</div> ${b.guns[choice4].description}</div>`
|
if (choice4 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('gun',${choice4})"><div class="grid-title"><div class="circle-grid gun"></div> ${b.guns[choice4].name}</div> ${b.guns[choice4].description}</div>`
|
||||||
let choice5 = pick(b.guns, choice1, choice2, choice3, choice4)
|
let choice5 = pick(b.guns, choice1, choice2, choice3, choice4)
|
||||||
if (choice5 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('gun',${choice5})"><div class="grid-title"><div class="circle-grid gun"></div> ${b.guns[choice5].name}</div> ${b.guns[choice5].description}</div>`
|
if (choice5 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('gun',${choice5})">
|
||||||
|
<div class="grid-title"><div class="circle-grid gun"></div> ${b.guns[choice5].name}</div> ${b.guns[choice5].description}</div>`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (powerUps.reroll.rerolls) text += `<div class="choose-grid-module" onclick="powerUps.reroll.use('gun')"><div class="grid-title"><div class="circle-grid reroll"></div> reroll <span class='dice'>${powerUps.reroll.diceText()}</span></div></div>`
|
||||||
|
|
||||||
document.getElementById("choose-grid").innerHTML = text
|
document.getElementById("choose-grid").innerHTML = text
|
||||||
powerUps.showDraft();
|
powerUps.showDraft();
|
||||||
} else {
|
} else {
|
||||||
@@ -255,6 +312,11 @@ const powerUps = {
|
|||||||
if (Math.random() < b.modBayesian) powerUps.spawn(x, y, "field");
|
if (Math.random() < b.modBayesian) powerUps.spawn(x, y, "field");
|
||||||
return;
|
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
|
spawnBossPowerUp(x, y) { //boss spawns field and gun mod upgrades
|
||||||
if (mech.fieldMode === 0) {
|
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");
|
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
|
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);
|
powerUps.spawn(x, y, "heal", false);
|
||||||
} else {
|
} else if (!b.modBayesian) {
|
||||||
if (!b.modBayesian) powerUps.spawn(x, y, "ammo", false);
|
powerUps.spawn(x, y, "ammo", false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
spawnStartingPowerUps(x, y) { //used for map specific power ups, mostly to give player a starting gun
|
spawnStartingPowerUps(x, y) { //used for map specific power ups, mostly to give player a starting gun
|
||||||
|
|||||||
18
style.css
18
style.css
@@ -487,6 +487,8 @@ em {
|
|||||||
margin-bottom: -5px;
|
margin-bottom: -5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.field {
|
.field {
|
||||||
background: #0cf;
|
background: #0cf;
|
||||||
}
|
}
|
||||||
@@ -508,6 +510,22 @@ em {
|
|||||||
background: #0d9;
|
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 {
|
.box {
|
||||||
padding: 3px 8px 3px 8px;
|
padding: 3px 8px 3px 8px;
|
||||||
border: 2px solid #444;
|
border: 2px solid #444;
|
||||||
|
|||||||
4
todo.txt
4
todo.txt
@@ -4,6 +4,10 @@ mod: foam-bots
|
|||||||
|
|
||||||
************** TODO - n-gon **************
|
************** TODO - n-gon **************
|
||||||
|
|
||||||
|
power up reroll
|
||||||
|
color yellow?
|
||||||
|
|
||||||
|
|
||||||
sticking bullets don't always gain the correct speed from mobs after they die
|
sticking bullets don't always gain the correct speed from mobs after they die
|
||||||
|
|
||||||
mod - frozen mobs take +33% damage
|
mod - frozen mobs take +33% damage
|
||||||
|
|||||||
Reference in New Issue
Block a user