diff --git a/src/data/backwardsCompatibility/pitBC.js b/src/data/backwardsCompatibility/pitBC.js index c6303e044a4b96987a78935695d36c7a2079e7c9..1bd08cc35916812c8dd3b7a172fee8762cffc225 100644 --- a/src/data/backwardsCompatibility/pitBC.js +++ b/src/data/backwardsCompatibility/pitBC.js @@ -60,8 +60,13 @@ App.Facilities.Pit.BC = function() { if (V.pit.minimumHealth !== true && V.pit.minimumHealth !== false) { V.pit.minimumHealth = true; } - if (V.pit.slavesFighting !== null && V.pit.slavesFighting.length !== 2) { - V.pit.slavesFighting = null; + if (V.pit.slavesFighting !== null) { + if (V.pit.slavesFighting.length !== 2) { + V.pit.slavesFighting = null; + } else if (!V.pit.slavesFighting.reduce((acc, id) => acc && !!getSlave(id), true)) { + // a slave scheduled to fight isn't owned anymore + V.pit.slavesFighting = null; + } } } diff --git a/src/facilities/pit/pit.js b/src/facilities/pit/pit.js index 4b377f034145e3b5eb4e5029b2d91d2c384f21e1..15f070c61c0f214e7e1c207a08b847bd1a4c3c14 100644 --- a/src/facilities/pit/pit.js +++ b/src/facilities/pit/pit.js @@ -69,8 +69,8 @@ App.Facilities.Pit.pit = function() { if (V.pit.slavesFighting !== null) { const [slave1, slave2] = V.pit.slavesFighting; - el.append(`You have scheduled `, App.UI.DOM.slaveDescriptionDialog(getSlave(slave1)), ` and `, - contextualIntro(getSlave(slave1), getSlave(slave2), true), " to fight this week."); + el.append(`You have scheduled `, App.UI.DOM.referenceSlaveWithPreview(getSlave(slave1), SlaveFullName(getSlave(slave1))), ` and `, + App.UI.DOM.referenceSlaveWithPreview(getSlave(slave2), SlaveFullName(getSlave(slave2))), " to fight this week."); App.UI.DOM.appendNewElement("div", el, App.UI.DOM.link(`Cancel it`, () => { V.pit.slavesFighting = null; diff --git a/src/facilities/pit/pitWorkaround.js b/src/facilities/pit/pitWorkaround.js index f0a40dcb0a08232190beb1e9967bc8f2239dbecd..b4f8fe0bcdc7401360f7a5de5f00c28ed95e488c 100644 --- a/src/facilities/pit/pitWorkaround.js +++ b/src/facilities/pit/pitWorkaround.js @@ -24,21 +24,23 @@ App.Facilities.Pit.workaround = function() { ); for (const slave of V.slaves) { + const div = document.createElement("div"); if (V.pit.slavesFighting.includes(slave.ID)) { - App.UI.DOM.appendNewElement("div", f, SlaveFullName(slave), ['indent']); + div.append("Assign"); } else { - App.UI.DOM.appendNewElement("div", f, App.UI.DOM.link(SlaveFullName(slave), () => { + div.append(App.UI.DOM.link("Assign", () => { if (V.pit.slavesFighting.length > 1) { V.pit.slavesFighting.shift(); } - V.pit.slavesFighting.push(slave.ID); - V.passageSwitchHandler = () => { }; + V.passageSwitchHandler = () => { + }; App.UI.reload(); - V.passageSwitchHandler = passageHandler; - }), ['indent']); + })); } + div.append(" ", App.UI.DOM.referenceSlaveWithPreview(slave, SlaveFullName(slave))); + f.append(div); } function passageHandler() { diff --git a/src/js/removeSlave.js b/src/js/removeSlave.js index 6cdb3c72a919c34b9ddb1d82a0573180afd3764c..eefd9a8a4180914330403bd31714e638e7040b6a 100644 --- a/src/js/removeSlave.js +++ b/src/js/removeSlave.js @@ -124,6 +124,10 @@ globalThis.removeSlave = function(slave) { if (V.pit && V.pit.fighterIDs) { V.pit.fighterIDs.delete(AS_ID); } + // scheduled pit fight + if (V.pit && V.pit.slavesFighting.includes(AS_ID)) { + V.pit.slavesFighting = null; + } /* remove from Coursing Association, if needed */ if (V.LurcherID === AS_ID) {