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

fixes

parent 8f6d8ff0
No related branches found
No related tags found
1 merge request!7588Buy all hero slaves
......@@ -77,7 +77,12 @@ App.Markets.specialSlave = function() {
if (V.cheatMode) {
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);
if (V.cash > totalCost) {
......@@ -85,12 +90,12 @@ App.Markets.specialSlave = function() {
"div",
el,
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) {
cashX(forceNeg(hero.cost), "slaveTransfer", hero.slave);
newSlave(hero.slave);
V.heroSlavesPurchased.push(hero.slave.ID);
V.heroSlavesPurchased.push(hero.ID);
}
refresh();
}
......@@ -101,7 +106,7 @@ App.Markets.specialSlave = function() {
"div",
el,
App.UI.DOM.disabledLink(
`Buy all of them for ${App.UI.DOM.cashFormat(totalCost)}`,
`Buy all of them for ${cashFormat(totalCost)}`,
[`Cannot afford`]
)
);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment