URL builds debugging

This commit is contained in:
landgreen
2020-04-02 15:16:34 -07:00
parent 26fbb7bad6
commit dc3785d4fd
4 changed files with 68 additions and 34 deletions

View File

@@ -746,7 +746,7 @@ const b = {
} }
}, },
{ {
name: "+1 cardinality", name: "cardinality",
description: "one extra <strong>choice</strong> when selecting <strong>power ups</strong>", description: "one extra <strong>choice</strong> when selecting <strong>power ups</strong>",
maxCount: 1, maxCount: 1,
count: 0, count: 0,
@@ -937,33 +937,33 @@ const b = {
} }
}, },
{ {
name: "fléchettes cartridges", name: "flechettes cartridges",
description: "<strong>fléchettes</strong> release <strong>three</strong> needles in each shot<br><strong>ammo</strong> cost are increases by <strong>3x</strong>", description: "<strong>flechettes</strong> release <strong>three</strong> needles in each shot<br><strong>ammo</strong> cost are increases by <strong>3x</strong>",
maxCount: 1, maxCount: 1,
count: 0, count: 0,
allowed() { allowed() {
return b.haveGunCheck("fléchettes") return b.haveGunCheck("flechettes")
}, },
requires: "fléchettes", requires: "flechettes",
effect() { effect() {
b.isModFlechetteMultiShot = true; b.isModFlechetteMultiShot = true;
//cut current ammo by 1/3 //cut current ammo by 1/3
for (i = 0, len = b.guns.length; i < len; i++) { //find which gun for (i = 0, len = b.guns.length; i < len; i++) { //find which gun
if (b.guns[i].name === "fléchettes") b.guns[i].ammo = Math.ceil(b.guns[i].ammo / 3); if (b.guns[i].name === "flechettes") b.guns[i].ammo = Math.ceil(b.guns[i].ammo / 3);
} }
//cut ammo packs by 1/3 //cut ammo packs by 1/3
for (i = 0, len = b.guns.length; i < len; i++) { //find which gun for (i = 0, len = b.guns.length; i < len; i++) { //find which gun
if (b.guns[i].name === "fléchettes") b.guns[i].ammoPack = Math.ceil(b.guns[i].defaultAmmoPack / 3); if (b.guns[i].name === "flechettes") b.guns[i].ammoPack = Math.ceil(b.guns[i].defaultAmmoPack / 3);
} }
game.updateGunHUD(); game.updateGunHUD();
}, },
remove() { remove() {
b.isModFlechetteMultiShot = false; b.isModFlechetteMultiShot = false;
for (i = 0, len = b.guns.length; i < len; i++) { //find which gun for (i = 0, len = b.guns.length; i < len; i++) { //find which gun
if (b.guns[i].name === "fléchettes") b.guns[i].ammo = Math.ceil(b.guns[i].ammo * 3); if (b.guns[i].name === "flechettes") b.guns[i].ammo = Math.ceil(b.guns[i].ammo * 3);
} }
for (i = 0, len = b.guns.length; i < len; i++) { //find which gun for (i = 0, len = b.guns.length; i < len; i++) { //find which gun
if (b.guns[i].name === "fléchettes") b.guns[i].ammoPack = b.guns[i].defaultAmmoPack; if (b.guns[i].name === "flechettes") b.guns[i].ammoPack = b.guns[i].defaultAmmoPack;
} }
game.updateGunHUD(); game.updateGunHUD();
} }
@@ -974,9 +974,9 @@ const b = {
maxCount: 1, maxCount: 1,
count: 0, count: 0,
allowed() { allowed() {
return b.haveGunCheck("fléchettes") return b.haveGunCheck("flechettes")
}, },
requires: "fléchettes", requires: "flechettes",
effect() { effect() {
b.isModDotFlechette = true; b.isModDotFlechette = true;
}, },
@@ -2470,7 +2470,7 @@ const b = {
} }
}, },
{ {
name: "fléchettes", //3 name: "flechettes", //3
description: "fire a <strong>precise</strong> volley of <strong>high velocity</strong> needles<br>that apply <strong class='color-p'>chemical</strong> <strong class='color-d'>damage</strong> over 3 seconds", description: "fire a <strong>precise</strong> volley of <strong>high velocity</strong> needles<br>that apply <strong class='color-p'>chemical</strong> <strong class='color-d'>damage</strong> over 3 seconds",
ammo: 0, ammo: 0,
ammoPack: 23, ammoPack: 23,

View File

@@ -527,6 +527,7 @@ const game = {
splashReturn() { splashReturn() {
game.onTitlePage = true; game.onTitlePage = true;
// document.getElementById('splash').onclick = 'run(this)'; // document.getElementById('splash').onclick = 'run(this)';
// build.isURLBuild = false;
document.getElementById("splash").onclick = function () { document.getElementById("splash").onclick = function () {
game.startGame(); game.startGame();
}; };

View File

@@ -22,15 +22,50 @@ const cat = {
// &difficulty=2 // &difficulty=2
//use %20 for spaces //use %20 for spaces
//difficulty is 0 easy, 1 normal, 2 hard, 4 why //difficulty is 0 easy, 1 normal, 2 hard, 4 why
function onLoadPowerUps() { function getUrlVars() {
function getUrlVars() {
let vars = {}; let vars = {};
window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function (m, k, v) { window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function (m, k, v) {
vars[k] = v; vars[k] = v;
}); });
return vars; return vars;
} }
// ?
// &gun0 = minigun & gun1 = shotgun & gun2 = super % 20 balls & gun3 = flechettes & gun4 = wave % 20 beam & gun5 = missiles & gun6 = flak & gun7 = grenades & gun8 = vacuum % 20 bomb &
// gun9 = mine & gun10 = spores & gun11 = drones & gun12 = ice % 20 IX & gun13 = foam & gun14 = rail % 20 gun & gun15 = laser & gun16 = pulse
// &
// mod0 = depleted % 20 uranium % 20 rounds & mod1 = kinetic % 20 bombardment & mod2 = fracture % 20 analysis & mod3 = fluoroantimonic % 20 acid &
// mod4 = negative % 20 feedback & mod5 = radiative % 20 equilibrium & mod6 = high % 20 explosives & mod7 = high % 20 explosives &
// mod8 = high % 20 explosives & mod9 = electric % 20 reactive % 20 armor & mod10 = thermal % 20 runaway & mod11 = auto - loading % 20 heuristics &
// mod12 = desublimated % 20 ammunition & mod13 = mass % 20 driver & mod14 = laser - bot & mod15 = nail - bot & mod16 = ablative % 20 drones &
// mod17 = ablative % 20 mines & mod18 = Lorentzian % 20 topology & mod19 = Lorentzian % 20 topology & mod20 = Lorentzian % 20 topology &
// mod21 = zoospore % 20 vector & mod22 = reaction % 20 inhibitor & mod23 = waste % 20 energy % 20 recovery & mod24 = scrap % 20 recycling &
// mod25 = acute % 20 stress % 20 response & mod26 = squirrel - cage % 20 rotor & mod27 = basidio - stomp & mod28 = Pauli % 20 exclusion &
// mod29 = annihilation & mod30 = quantum % 20 immortality & mod31 = weak % 20 anthropic % 20 principle & mod32 = entanglement & mod33 = piezoelectricity &
// mod34 = ground % 20 state & mod35 = energy % 20 conservation & mod36 = entropy % 20 exchange & mod37 = overcharge & mod38 = supersaturation &
// mod39 = recursive % 20 healing & mod40 = mass - energy % 20 equivalence & mod41 = Bayesian % 20 inference & mod42 = % 2 B1 % 20 cardinality &
// mod43 = catabolism & mod44 = leveraged % 20 investment & mod45 = ice % 20 crystal % 20n ucleation & mod46 = shotgun % 20 spin - statistics &
// mod47 = super % 20 duper & mod48 = super % 20 duper & mod49 = flechettes % 20 cartridges & mod50 = irradiated % 20n eedles & mod51 = wave % 20 phase % 20 velocity &
// mod52 = pocket % 20 universe & mod53 = self - replication & mod54 = optimized % 20 shell % 20 packing & mod55 = electromagnetic % 20 pulse &
// mod56 = mine % 20 reclamation & mod57 = tinsellated % 20 flagella & mod58 = redundant % 20 systems & mod59 = heavy % 20 water & mod60 = foam % 20 stabilization &
// mod61 = fragmenting % 20 projectiles & mod62 = specular % 20 reflection & mod63 = specular % 20 reflection & mod64 = specular % 20 reflection &
// mod65 = quantum % 20 dissipation & field = phase % 20 decoherence % 20 field & difficulty = 2
window.addEventListener('load', (event) => {
const set = getUrlVars() const set = getUrlVars()
if (Object.keys(set).length !== 0) {
build.isURLBuild = true;
game.startGame()
}
});
//build build grid display
const build = {
isURLBuild: false,
onLoadPowerUps() {
const set = getUrlVars()
if (Object.keys(set).length !== 0) {
for (const property in set) { for (const property in set) {
// console.log(`${property}: ${give[property]}`); // console.log(`${property}: ${give[property]}`);
set[property] = set[property].replace(/%20/g, " ") set[property] = set[property].replace(/%20/g, " ")
@@ -42,10 +77,8 @@ function onLoadPowerUps() {
document.getElementById("difficulty-select").value = Number(set[property]) document.getElementById("difficulty-select").value = Number(set[property])
} }
} }
} }
},
//build build grid display
const build = {
pauseGrid() { pauseGrid() {
// let text = `<div class="pause-grid-module" style="border:0px;background:none;"></div>` // let text = `<div class="pause-grid-module" style="border:0px;background:none;"></div>`
let text = ` let text = `
@@ -329,7 +362,7 @@ const build = {
} }
document.getElementById("build-button").addEventListener("click", () => { //setup build run document.getElementById("build-button").addEventListener("click", () => { //setup build run
console.log('hi') build.isURLBuild = false;
document.getElementById("build-button").style.display = "none"; document.getElementById("build-button").style.display = "none";
const el = document.getElementById("build-grid") const el = document.getElementById("build-grid")
el.style.display = "grid" el.style.display = "grid"

View File

@@ -13,13 +13,13 @@ const level = {
levelsCleared: 0, levelsCleared: 0,
start() { start() {
if (level.levelsCleared === 0) { if (level.levelsCleared === 0) {
if (build.isURLBuild) build.onLoadPowerUps();
// level.difficultyIncrease(9) // level.difficultyIncrease(9)
// b.giveGuns("vacuum bomb") // b.giveGuns("vacuum bomb")
// mech.setField("phase decoherence field") // mech.setField("phase decoherence field")
// mech.energy = 0.1; // mech.energy = 0.1;
// b.giveMod("negative feedback"); // b.giveMod("negative feedback");
// b.giveMod("photovoltaics"); // b.giveMod("photovoltaics");
onLoadPowerUps();
level.intro(); //starting level level.intro(); //starting level
// level.testing(); // level.testing();