Skip to content
Snippets Groups Projects
Commit b7dc1609 authored by lowercasedonkey's avatar lowercasedonkey
Browse files

fixes

parent 8f6d8ff0
Branches
Tags
1 merge request!7588Buy all hero slaves
...@@ -77,7 +77,12 @@ App.Markets.specialSlave = function() { ...@@ -77,7 +77,12 @@ App.Markets.specialSlave = function() {
if (V.cheatMode) { if (V.cheatMode) {
let oneSlaveCost = (s) => { let cost = slaveCost(s); return cost + (10 * Math.trunc((cost / 10) * 2)); }; let oneSlaveCost = (s) => { let cost = slaveCost(s); return cost + (10 * Math.trunc((cost / 10) * 2)); };
let allHeroSlaves = App.Utils.buildHeroArray().map((s) => { return {slave: App.Utils.getHeroSlave(s), cost: oneSlaveCost(s)}; }); let allHeroSlaves = App.Utils.buildHeroArray().map(
(hs) => {
const slave = App.Utils.getHeroSlave(hs);
return {slave: slave, cost: oneSlaveCost(slave), ID: hs.ID};
}
);
let totalCost = allHeroSlaves.reduce((acc, s) => acc += s.cost, 0); let totalCost = allHeroSlaves.reduce((acc, s) => acc += s.cost, 0);
if (V.cash > totalCost) { if (V.cash > totalCost) {
...@@ -85,12 +90,12 @@ App.Markets.specialSlave = function() { ...@@ -85,12 +90,12 @@ App.Markets.specialSlave = function() {
"div", "div",
el, el,
App.UI.DOM.link( App.UI.DOM.link(
`Buy all of them for ${App.UI.DOM.cashFormat(totalCost)}`, `Buy all of them for ${cashFormat(totalCost)}`,
() => { () => {
for (const hero of allHeroSlaves) { for (const hero of allHeroSlaves) {
cashX(forceNeg(hero.cost), "slaveTransfer", hero.slave); cashX(forceNeg(hero.cost), "slaveTransfer", hero.slave);
newSlave(hero.slave); newSlave(hero.slave);
V.heroSlavesPurchased.push(hero.slave.ID); V.heroSlavesPurchased.push(hero.ID);
} }
refresh(); refresh();
} }
...@@ -101,7 +106,7 @@ App.Markets.specialSlave = function() { ...@@ -101,7 +106,7 @@ App.Markets.specialSlave = function() {
"div", "div",
el, el,
App.UI.DOM.disabledLink( App.UI.DOM.disabledLink(
`Buy all of them for ${App.UI.DOM.cashFormat(totalCost)}`, `Buy all of them for ${cashFormat(totalCost)}`,
[`Cannot afford`] [`Cannot afford`]
) )
); );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment