diff --git a/src/markets/specialSlave.js b/src/markets/specialSlave.js index 4583ed5e86fe6693531dfde588ada724a2e37d9f..1db6c8bf33c6d595b3f12a950c1f80168d291c92 100644 --- a/src/markets/specialSlave.js +++ b/src/markets/specialSlave.js @@ -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`] ) );