diff --git a/devTools/types/FC/facilities.d.ts b/devTools/types/FC/facilities.d.ts index 18e7f5857ab000dc1212938938625e7c8e22349c..9b5ac1fb6fdd2c5094c914563d731d4b4d740b67 100644 --- a/devTools/types/FC/facilities.d.ts +++ b/devTools/types/FC/facilities.d.ts @@ -209,6 +209,10 @@ declare namespace FC { * Which virginities will be respected */ virginities: "none" | "vaginal" | "anal" | "all" + /** + * Whether slaves fighting must be in somewhat fair health and generally able to do combat. + */ + minimumHealth: boolean } } } diff --git a/src/004-base/basePitFight.js b/src/004-base/basePitFight.js index 19c95439149b7ae1a4845d49f8609a1ea805716e..a7e805f306cfbf656100d0052f00802c594cabe7 100644 --- a/src/004-base/basePitFight.js +++ b/src/004-base/basePitFight.js @@ -166,13 +166,27 @@ App.Facilities.Pit.Fights.BaseFight = class BaseFight { * @private */ _selectActor(prereqs, ...ids) { - const qualified = ids.filter(si => !this.actors.includes(si) && prereqs.every(p => p(getSlave(si)))); + const qualified = ids + .filter(si => !this.actors.includes(si) && prereqs.every(p => p(getSlave(si))) && this._validActor(si)); if (qualified.length === 0) { return false; // a required actor was not found } this.actors.push(qualified.pluck()); return true; } + + /** + * @param {number} si - Slave ID + * @returns {boolean} True, if the slave is allowed to fight + * @private + */ + _validActor(si) { + if (!V.pit.minimumHealth) { + return true; + } + const slave = getSlave(si); + return canWalk(slave) && slave.health.condition >= -20; + } }; /** This is a trivial fight for use as an example. */ diff --git a/src/events/scheduled/pitFight.js b/src/events/scheduled/pitFight.js index 7f9241ebad781285b1d1e57458e9b0e49022bb98..483ef1086d3cd929b2a8aec7a4fa939cd6f9cbe4 100644 --- a/src/events/scheduled/pitFight.js +++ b/src/events/scheduled/pitFight.js @@ -16,6 +16,7 @@ App.Events.SEPitFight = class SEPitFight extends App.Events.BaseEvent { const maxFights = 3 + (V.pit.fightsBase * 2); let completedFights = 0; let totalSuccess = 0; + let lethalFights = 0; const fighterMap = new App.Facilities.Pit.Fights.FighterMap(); @@ -62,6 +63,9 @@ App.Events.SEPitFight = class SEPitFight extends App.Events.BaseEvent { } f.append(div); } + if (availableFights.length === 0) { + App.UI.DOM.appendNewElement("div", f, "No fights available"); + } App.UI.DOM.appendNewElement("div", f, App.UI.DOM.link("Select different fighters", () => refreshInteractionSpan(selectFight()))); App.UI.DOM.appendNewElement("div", f, App.UI.DOM.link("Head back to the penthouse and cancel all the remaining fights", () => refreshInteractionSpan(finishEvent()))); App.Events.addResponses(f, choices); @@ -109,7 +113,10 @@ App.Events.SEPitFight = class SEPitFight extends App.Events.BaseEvent { p.append(fightSuccess(success), " ", fightImpact(impact)); f.append(p); totalSuccess += impact; - completedFights += 1; + completedFights++; + if (fight.lethal) { + lethalFights++; + } if (completedFights < maxFights) { f.append(selectFight()); @@ -196,16 +203,20 @@ App.Events.SEPitFight = class SEPitFight extends App.Events.BaseEvent { } function intro() { - const f = new DocumentFragment(); let r = []; if (V.pit.audience === "none") { r.push(`You are alone above the pit, left to watch them square off in private.`); + return r[0]; } else if (V.pit.audience === "free") { r.push(`Your guests line the rim of the pit, joking and betting.`); } else { r.push(`The attendees line the rim of the pit, betting and arguing.`); } + if (V.pit.lethal === 1) { + r.push("They expect to see a mix of lethal and nonlethal fights."); + } + if (V.arcologies[0].FSRomanRevivalist !== "unset") { r.push(`They `, App.UI.DOM.makeElement("span", 'strongly approve', ["reputation", "inc"]), ` of your hosting combat between slaves; this advances ideas from antiquity about what public events should be.`); @@ -214,27 +225,70 @@ App.Events.SEPitFight = class SEPitFight extends App.Events.BaseEvent { V.arcologies[0].FSRomanRevivalist += (0.2 * V.FSSingleSlaveRep); } + if (V.pit.minimumHealth) { + if (V.arcologies[0].FSPaternalist !== "unset") { + r.push(`They `, App.UI.DOM.makeElement("span", 'strongly approve', ["reputation", + "inc"]), ` of restricting fights to healthy slaves; this advances ideas about slave well-being.`); + + repX(10 * V.FSSingleSlaveRep * (V.arcologies[0].FSPaternalist / V.FSLockinLevel), "pit"); + V.arcologies[0].FSPaternalist += (0.2 * V.FSSingleSlaveRep); + } else if (V.arcologies[0].FSDegradationist !== "unset") { + r.push(`They `, App.UI.DOM.makeElement("span", 'strongly disapprove', ["reputation", + "dec"]), ` of restricting fights to healthy slaves; this hampers ideas about slave degradation.`); + + repX(-10 * V.FSSingleSlaveRep * (V.arcologies[0].FSDegradationist / V.FSLockinLevel), "pit"); + V.arcologies[0].FSDegradationist -= (0.2 * V.FSSingleSlaveRep); + } + } else { + if (V.arcologies[0].FSPaternalist !== "unset") { + r.push(`They `, App.UI.DOM.makeElement("span", 'strongly disapprove', ["reputation", + "dec"]), ` of allowing ill slaves to fight; this hampers ideas about slave well-being.`); + + repX(-10 * V.FSSingleSlaveRep * (V.arcologies[0].FSPaternalist / V.FSLockinLevel), "pit"); + V.arcologies[0].FSPaternalist -= (0.2 * V.FSSingleSlaveRep); + } else if (V.arcologies[0].FSDegradationist !== "unset") { + r.push(`They `, App.UI.DOM.makeElement("span", 'strongly approve', ["reputation", + "inc"]), ` of allowing ill slaves to fight; this advances ideas about slave degradation.`); + + repX(10 * V.FSSingleSlaveRep * (V.arcologies[0].FSDegradationist / V.FSLockinLevel), "pit"); + V.arcologies[0].FSDegradationist += (0.2 * V.FSSingleSlaveRep); + } + } + + const f = new DocumentFragment(); App.Events.addParagraph(f, r); return f; } function finishEvent() { - const f = new DocumentFragment(); + const r = []; V.nextButton = "Continue"; if (completedFights === 0) { - f.append("Opening the arena without hosting fights hurt your reputation."); + r.push("Opening the arena without hosting fights hurt your reputation."); repX(-100 * maxFights, "pit"); + const f = new DocumentFragment(); + App.Events.addParagraph(f, r); return f; } if (completedFights < maxFights) { - f.append("The audience is disappointed in the few fights this week."); + r.push("The audience is disappointed in the few fights this week."); totalSuccess -= (maxFights - completedFights) * 0.2; } + if (V.pit.lethal === 1) { + if (lethalFights === 0) { + r.push("The audience expected to see blood and did not get any."); + totalSuccess *= 0.9; + } else if (lethalFights === completedFights) { + r.push("The audience only saw blood today and is missing some other outcomes."); + totalSuccess *= 0.9; + } + } + const averageSuccess = totalSuccess / maxFights; - f.append(eventSuccess(averageSuccess)); + r.push(eventSuccess(averageSuccess)); totalSuccess *= 1 + 0.5 * V.pit.seats; @@ -242,15 +296,17 @@ App.Events.SEPitFight = class SEPitFight extends App.Events.BaseEvent { const repGain = 100 * totalSuccess; repX(repGain, "pit"); if (V.cheatMode || V.debugMode) { - f.append(" rep: " + repGain); + r.push("rep:" + repGain); } } else if (V.pit.audience === "paid") { const cashGain = 2000 * totalSuccess; cashX(cashGain, "pit"); if (V.cheatMode || V.debugMode) { - f.append(" cash: " + cashGain); + r.push("cash:" + cashGain); } } + const f = new DocumentFragment(); + App.Events.addParagraph(f, r); return f; } } diff --git a/src/facilities/pit/fights/0_lethalRandom.js b/src/facilities/pit/fights/0_lethalRandom.js index 0b807b5b0db4ff43e50a7eccf3a3fa1c3164cc9b..39cc2acb73fc53227cbdad885cabd05a24f3a567 100644 --- a/src/facilities/pit/fights/0_lethalRandom.js +++ b/src/facilities/pit/fights/0_lethalRandom.js @@ -25,8 +25,8 @@ App.Facilities.Pit.Fights.LR1v1 = class extends App.Facilities.Pit.Fights.BaseFi actorPrerequisites() { return [ - [canWalk], - [canWalk] + [], + [] ]; } diff --git a/src/facilities/pit/fights/0_nonLethalRandom.js b/src/facilities/pit/fights/0_nonLethalRandom.js index 6d06f676d4643d75c61b60c1177d918deb4efb2e..0fbac628e6b76a0e97be31d0e2d91e2688842f5b 100644 --- a/src/facilities/pit/fights/0_nonLethalRandom.js +++ b/src/facilities/pit/fights/0_nonLethalRandom.js @@ -29,8 +29,8 @@ App.Facilities.Pit.Fights.NlR1v1 = class extends App.Facilities.Pit.Fights.BaseF actorPrerequisites() { return [ - [canWalk], - [canWalk] + [], + [] ]; } diff --git a/src/facilities/pit/pitUtils.js b/src/facilities/pit/pitUtils.js index ee0d9646ce015db550219ba70574d54581ccbf31..964c1ea06b2e35ea071a55835c3b24c390fae279 100644 --- a/src/facilities/pit/pitUtils.js +++ b/src/facilities/pit/pitUtils.js @@ -13,6 +13,7 @@ App.Facilities.Pit.init = function() { fightsBase: 0, seats: 0, lethal: 0, - virginities: "all" + virginities: "all", + minimumHealth: true, }; };