diff --git a/devTools/types/FC/facilities.d.ts b/devTools/types/FC/facilities.d.ts index 6069050493c37057d74971125b0132dbcd267c4d..18e7f5857ab000dc1212938938625e7c8e22349c 100644 --- a/devTools/types/FC/facilities.d.ts +++ b/devTools/types/FC/facilities.d.ts @@ -191,14 +191,24 @@ declare namespace FC { /** Whether or not a fight has taken place during the week. */ fought: boolean; /** - * Active fights run every week. + * Base for the max number of fights that can be held each week. + * fightNum = 3 + 2 * fightsBase */ - activeFights: Array<ActiveFight>; - } - - interface ActiveFight { - key: string - options: Record<string, any> + fightsBase: 0 | 1 | 2 + /** + * How many can watch the fight. Influences rep/cash generation + */ + seats: 0 | 1 | 2 + /** + * * 0: no lethal fights allowed + * * 1: lethal and nonlethal fights allowed + * * 2: only lethal fights allowed + */ + lethal: 0 | 1 | 2 + /** + * Which virginities will be respected + */ + virginities: "none" | "vaginal" | "anal" | "all" } } } diff --git a/src/004-base/basePitFight.js b/src/004-base/basePitFight.js index 169cd9c6cd0e0be3d5d10a4485df7f54f67f875c..19c95439149b7ae1a4845d49f8609a1ea805716e 100644 --- a/src/004-base/basePitFight.js +++ b/src/004-base/basePitFight.js @@ -81,6 +81,14 @@ App.Facilities.Pit.Fights.BaseFight = class BaseFight { return []; } + /** Get a short description to show when selecting the fight during the event + * Assumes fight can be run and actors have been cast already + * @returns {DocumentFragment} + */ + fightDescription() { + return new DocumentFragment(); + } + /** Fight predicates determine whether the fight can be shown/executed * @callback pitFightPredicate * @returns {boolean} @@ -91,6 +99,19 @@ App.Facilities.Pit.Fights.BaseFight = class BaseFight { * @returns {Array<pitFightPredicate>} */ fightPrerequisites() { + return [ + () => + (V.pit.lethal === 0 && !this.lethal) || + (V.pit.lethal === 1) || + (V.pit.lethal === 2 && this.lethal) + ]; + } + + /** + * Actors that are forced to be a specific slave + * @returns {Array<number>} + */ + forcedActors() { return []; } @@ -105,12 +126,13 @@ App.Facilities.Pit.Fights.BaseFight = class BaseFight { /** run the fight and attach DOM output to the pit fight passage. * child classes must implement this. * @param {ParentNode} node - Document fragment which fight output should be attached to + * @param {App.Facilities.Pit.Fights.FighterMap} fighterMap * @returns {number} - How successful the fight was for prestige/cash. * The expected value should be between -1 and 1 inclusive. May go more extreme for unexpected outcomes. * At least one maximum/minimum value should be used, and then scaled to other events with the * {@link App.Facilities.Pit.Fights.BaseFight#impact impact property}. */ - execute(node) { + execute(node, fighterMap) { return 0; } @@ -121,7 +143,7 @@ App.Facilities.Pit.Fights.BaseFight = class BaseFight { castActors() { const prereqs = this.actorPrerequisites(); - this.actors = []; + this.actors = [...this.forcedActors()]; for (let i = 0; i < prereqs.length; ++i) { if (this.allowTrainees) { @@ -176,3 +198,27 @@ App.Facilities.Pit.Fights.TestFight = class extends App.Facilities.Pit.Fights.Ba return 0; } }; + +App.Facilities.Pit.Fights.FighterMap = class { + constructor() { + /** + * @type {Map<number, number>} + */ + this.map = new Map(); + } + + fightCount(slaveId) { + const count = this.map.get(slaveId); + if (count === undefined) { + return 0; + } else { + return count; + } + } + + addFight(slaveId) { + const oldCount = this.fightCount(slaveId); + this.map.set(slaveId, oldCount + 1); + } +}; + diff --git a/src/events/scheduled/pitFight.js b/src/events/scheduled/pitFight.js index afaae1b37134366abfbc7f531152fd79a2b6dbc4..7f9241ebad781285b1d1e57458e9b0e49022bb98 100644 --- a/src/events/scheduled/pitFight.js +++ b/src/events/scheduled/pitFight.js @@ -6,56 +6,121 @@ App.Events.SEPitFight = class SEPitFight extends App.Events.BaseEvent { ]; } - castActors() { - return true; - } - /** @param {DocumentFragment} node */ execute(node) { V.pit.fought = true; - let r = []; - if (V.pit.audience === "none") { - r.push(`You are alone above the pit, left to watch them square off in private.`); - } 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.`); - } + V.nextButton = " "; - 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.`); + node.append(intro()); - repX(10 * V.FSSingleSlaveRep * (V.arcologies[0].FSRomanRevivalist / V.FSLockinLevel), "pit"); - V.arcologies[0].FSRomanRevivalist += (0.2 * V.FSSingleSlaveRep); - } + const maxFights = 3 + (V.pit.fightsBase * 2); + let completedFights = 0; + let totalSuccess = 0; - App.Events.addParagraph(node, r); + const fighterMap = new App.Facilities.Pit.Fights.FighterMap(); - let totalSuccess = 0; + const interactionSpan = document.createElement("span"); + interactionSpan.append(selectFight()); + node.append(interactionSpan); + + function selectFight() { + const f = new DocumentFragment(); - const fights = App.Facilities.Pit.activeFights(); - for (let i = 0; i < fights.length; i++) { - if (fights[i].fightPrerequisites().every(p => p()) && fights[i].castActors()) { - App.UI.DOM.appendNewElement("span", node, `The ${ordinalSuffixWords(i + 1)} fight this day: ` + fights[i].uiDescription + ": ", "bold"); - const success = fights[i].execute(node); - const impact = success * fights[i].impact; - const p = document.createElement("p"); - p.append(fightSuccess(success), " ", eventImpact(impact)); - node.append(p); - totalSuccess += impact; - } else if (V.cheatMode || V.debugMode) { - node.append("Unable to run fight: ", fights[i].key); + App.Events.addParagraph(f, [`Select a fight. You have ${maxFights - completedFights} left.`]); + + const availableFights = App.Facilities.Pit.getFights() + .filter(f => f.fightPrerequisites().every(p => p()) && f.castActors()); + + const choices = []; + for (const fight of availableFights) { + App.UI.DOM.appendNewElement("div", f, fight.fightDescription()); + const div = document.createElement("div"); + div.classList.add("indent"); + div.append(App.UI.DOM.link("Fight!", () => runFight(fight))); + div.append(" Impact: ", expectedImpact(fight.impact), " "); + if (fight.lethal) { + App.UI.DOM.appendNewElement("span", div, "Lethal", "warning"); + } else { + App.UI.DOM.appendNewElement("span", div, "Safe", "green"); + } + for (const si of fight.actors) { + const count = fighterMap.fightCount(si); + if (count > 0) { + div.append(" "); + const span = document.createElement("span"); + span.classList.add("orange"); + + span.append(getSlave(si).slaveName, " already fought "); + if (count > 1) { + span.append(count + " times today."); + } else { + span.append("once today."); + } + + div.append(span); + } + } + f.append(div); } + 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); + + return f; } - const averageSuccess = totalSuccess / fights.length; - node.append(eventSuccess(averageSuccess)); + /** + * @param {DocumentFragment|HTMLElement} content + */ + function refreshInteractionSpan(content) { + $(interactionSpan).empty().append(content); + } + + /** + * @param {number} impact + * @returns {string} + */ + function expectedImpact(impact) { + if (impact === 0) { + return "None"; + } else if (impact < 0.8) { + return "Small"; + } else if (impact < 1.5) { + return "Average"; + } else if (impact < 8) { + return "High"; + } else { + return "Very High"; + } + } + + /** + * @param {App.Facilities.Pit.Fights.BaseFight} fight + */ + function runFight(fight) { + const f = new DocumentFragment(); + App.UI.DOM.appendNewElement("span", f, `The ${ordinalSuffixWords(completedFights + 1)} fight this day:`, "bold"); + const success = fight.execute(f, fighterMap); + for (const si of fight.actors) { + fighterMap.addFight(si); + } + const impact = success * fight.impact; + const p = document.createElement("p"); + p.append(fightSuccess(success), " ", fightImpact(impact)); + f.append(p); + totalSuccess += impact; + completedFights += 1; + + if (completedFights < maxFights) { + f.append(selectFight()); + } else { + f.append(finishEvent()); + } - if (V.pit.audience === "free") { - repX(200 * totalSuccess, "pit"); - } else if (V.pit.audience === "paid") { - cashX(4000 * totalSuccess, "pit"); + // automatically scroll to the top of the fight. + setTimeout(() => window.scrollTo(0, 0), 0); + + refreshInteractionSpan(f); } /** @@ -86,7 +151,7 @@ App.Events.SEPitFight = class SEPitFight extends App.Events.BaseEvent { * @param {number} impact * @returns {DocumentFragment} */ - function eventImpact(impact) { + function fightImpact(impact) { const f = new DocumentFragment(); impact = Math.abs(impact); @@ -129,5 +194,64 @@ App.Events.SEPitFight = class SEPitFight extends App.Events.BaseEvent { return p; } + + 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.`); + } 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.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.`); + + repX(10 * V.FSSingleSlaveRep * (V.arcologies[0].FSRomanRevivalist / V.FSLockinLevel), "pit"); + V.arcologies[0].FSRomanRevivalist += (0.2 * V.FSSingleSlaveRep); + } + + App.Events.addParagraph(f, r); + return f; + } + + function finishEvent() { + const f = new DocumentFragment(); + V.nextButton = "Continue"; + + if (completedFights === 0) { + f.append("Opening the arena without hosting fights hurt your reputation."); + repX(-100 * maxFights, "pit"); + return f; + } + + if (completedFights < maxFights) { + f.append("The audience is disappointed in the few fights this week."); + totalSuccess -= (maxFights - completedFights) * 0.2; + } + + const averageSuccess = totalSuccess / maxFights; + f.append(eventSuccess(averageSuccess)); + + totalSuccess *= 1 + 0.5 * V.pit.seats; + + if (V.pit.audience === "free") { + const repGain = 100 * totalSuccess; + repX(repGain, "pit"); + if (V.cheatMode || V.debugMode) { + f.append(" rep: " + repGain); + } + } else if (V.pit.audience === "paid") { + const cashGain = 2000 * totalSuccess; + cashX(cashGain, "pit"); + if (V.cheatMode || V.debugMode) { + f.append(" cash: " + cashGain); + } + } + return f; + } } }; diff --git a/src/facilities/pit/fights/0_lethalRandom.js b/src/facilities/pit/fights/0_lethalRandom.js index b36ebc218fbfe1518a1ff438a11ffb028a3b350d..0b807b5b0db4ff43e50a7eccf3a3fa1c3164cc9b 100644 --- a/src/facilities/pit/fights/0_lethalRandom.js +++ b/src/facilities/pit/fights/0_lethalRandom.js @@ -4,6 +4,13 @@ App.Facilities.Pit.Fights.LR1v1 = class extends App.Facilities.Pit.Fights.BaseFi return "1-vs-1 between two random slaves"; } + fightDescription() { + const f = new DocumentFragment(); + f.append("1-vs-1 fight between ", App.UI.DOM.slaveDescriptionDialog(getSlave(this.actors[0])), ` and `, + contextualIntro(getSlave(this.actors[0]), getSlave(this.actors[1]), true), "."); + return f; + } + get key() { return "l r 1v1"; } @@ -23,9 +30,8 @@ App.Facilities.Pit.Fights.LR1v1 = class extends App.Facilities.Pit.Fights.BaseFi ]; } - execute(node) { + execute(node, fighterMap) { const that = this; // Thanks, JS! - const [slave1, slave2] = this.actors.map(a => getSlave(a)); const winner = getWinner() ? slave1 : slave2; diff --git a/src/facilities/pit/fights/0_nonLethalRandom.js b/src/facilities/pit/fights/0_nonLethalRandom.js index ddf28976313bad2874d45e7aff1ac14ec6bee466..6d06f676d4643d75c61b60c1177d918deb4efb2e 100644 --- a/src/facilities/pit/fights/0_nonLethalRandom.js +++ b/src/facilities/pit/fights/0_nonLethalRandom.js @@ -4,22 +4,29 @@ App.Facilities.Pit.Fights.NlR1v1 = class extends App.Facilities.Pit.Fights.BaseF return "1-vs-1 between two random slaves"; } - get key() { - return "nl r 1v1"; - } - get options() { return [{ name: "Respect virginities", key: "virginities", values: [ - {name: "None", value: "neither"}, {name: "Vaginal", value: "vaginal"}, + {name: "None", value: "none"}, {name: "Vaginal", value: "vaginal"}, {name: "Anal", value: "anal"}, {name: "All", value: "all"} ], default: "all" }]; } + get key() { + return "nl r 1v1"; + } + + fightDescription() { + const f = new DocumentFragment(); + f.append("1-vs-1 fight between ", App.UI.DOM.slaveDescriptionDialog(getSlave(this.actors[0])), ` and `, + contextualIntro(getSlave(this.actors[0]), getSlave(this.actors[1]), true), "."); + return f; + } + actorPrerequisites() { return [ [canWalk], @@ -27,7 +34,7 @@ App.Facilities.Pit.Fights.NlR1v1 = class extends App.Facilities.Pit.Fights.BaseF ]; } - execute(node) { + execute(node, fighterMap) { const that = this; // Thanks, JS! const [slave1, slave2] = this.actors.map(a => getSlave(a)); @@ -57,7 +64,7 @@ App.Facilities.Pit.Fights.NlR1v1 = class extends App.Facilities.Pit.Fights.BaseF r.push(`You review the rules — the combatants are wearing light gloves, and the fight will be nonlethal, with you as the judge. The winner will have the right to do anything they wish to the loser,`); - switch (that.params.virginities) { + switch (V.pit.virginities) { case "all": r.push(`except take their virginity,`); break; @@ -67,7 +74,7 @@ App.Facilities.Pit.Fights.NlR1v1 = class extends App.Facilities.Pit.Fights.BaseF case "vaginal": r.push(`except take virginities,`); break; - case "neither": + case "none": r.push(`even take virginities,`); break; default: @@ -635,7 +642,7 @@ App.Facilities.Pit.Fights.NlR1v1 = class extends App.Facilities.Pit.Fights.BaseF r.push(`${He} needs it, since ${his} soft dick won't be raping anything.`); } - if (that.params.virginities === "all") { + if (V.pit.virginities === "all") { if (loser.vagina === 0 && canDoVaginal(loser) && loser.anus === 0 && canDoAnal(loser)) { r.push(`${He} respects ${loser.slaveName}'s virgin holes, and hauls the loser to ${his2} knees for a facefuck.`); @@ -697,7 +704,7 @@ App.Facilities.Pit.Fights.NlR1v1 = class extends App.Facilities.Pit.Fights.BaseF actX(loser, oral); } - } else if (that.params.virginities === "anal") { + } else if (V.pit.virginities === "anal") { if (loser.vagina === 0 && canDoVaginal(loser)) { r.push(`${He} pushes ${loser.slaveName}'s back down onto the mat, forces ${his2} ${hasBothLegs(loser) ? `legs apart` : !hasAnyLegs(loser) ? `hips steady` : `leg aside`},`); @@ -765,7 +772,7 @@ App.Facilities.Pit.Fights.NlR1v1 = class extends App.Facilities.Pit.Fights.BaseF actX(loser, oral); } - } else if (that.params.virginities === "vaginal") { + } else if (V.pit.virginities === "vaginal") { if (loser.vagina === 0 && canDoVaginal(loser)) { r.push(`${He} pushes ${loser.slaveName}'s back down onto the mat, forces ${his2} ${hasBothLegs(loser) ? `legs apart` : !hasAnyLegs(loser) ? `hips steady` : `leg aside`},`); diff --git a/src/facilities/pit/fights/1_lethalBodyguard.js b/src/facilities/pit/fights/1_lethalBodyguard.js index a57ce0f6f505449498ceded3ae646c605ed6d35a..91a4bfcbc2f9b0a69b719dcb84b30ecf644fe5c9 100644 --- a/src/facilities/pit/fights/1_lethalBodyguard.js +++ b/src/facilities/pit/fights/1_lethalBodyguard.js @@ -4,6 +4,13 @@ App.Facilities.Pit.Fights.LBg1v1 = class extends App.Facilities.Pit.Fights.LR1v1 return "1-vs-1 between your bodyguard and a random slave"; } + fightDescription() { + const f = new DocumentFragment(); + f.append("1-vs-1 fight between your bodyguard ", App.UI.DOM.slaveDescriptionDialog(getSlave(this.actors[0])), ` and `, + contextualIntro(getSlave(this.actors[0]), getSlave(this.actors[1]), true), "."); + return f; + } + get key() { return "l bg 1v1"; } @@ -13,7 +20,11 @@ App.Facilities.Pit.Fights.LBg1v1 = class extends App.Facilities.Pit.Fights.LR1v1 } fightPrerequisites() { - return [() => !!S.Bodyguard]; + return [...super.fightPrerequisites(), () => !!S.Bodyguard]; + } + + forcedActors() { + return [S.Bodyguard.ID]; } actorPrerequisites() { @@ -22,11 +33,6 @@ App.Facilities.Pit.Fights.LBg1v1 = class extends App.Facilities.Pit.Fights.LR1v1 ]; } - execute(node) { - this.actors = [S.Bodyguard.ID, ...this.actors]; - return super.execute(node); - } - introCombatants(slave1, slave2) { const {his1} = getPronouns(slave1).appendSuffix("1"); return [`In this fight your bodyguard`, App.UI.DOM.slaveDescriptionDialog(slave1), diff --git a/src/facilities/pit/fights/1_nonLethalBodyguard.js b/src/facilities/pit/fights/1_nonLethalBodyguard.js index 3666d3d080a5f59c2b7152346c551ddd83032770..aa66c9bb98d9f3c4826343dba728ce2de0bc0295 100644 --- a/src/facilities/pit/fights/1_nonLethalBodyguard.js +++ b/src/facilities/pit/fights/1_nonLethalBodyguard.js @@ -4,6 +4,13 @@ App.Facilities.Pit.Fights.NlBg1v1 = class extends App.Facilities.Pit.Fights.NlR1 return "1-vs-1 between your bodyguard and a random slave"; } + fightDescription() { + const f = new DocumentFragment(); + f.append("1-vs-1 fight between your bodyguard ", App.UI.DOM.slaveDescriptionDialog(getSlave(this.actors[0])), ` and `, + contextualIntro(getSlave(this.actors[0]), getSlave(this.actors[1]), true), "."); + return f; + } + get key() { return "nl bg 1v1"; } @@ -13,7 +20,11 @@ App.Facilities.Pit.Fights.NlBg1v1 = class extends App.Facilities.Pit.Fights.NlR1 } fightPrerequisites() { - return [() => !!S.Bodyguard]; + return [...super.fightPrerequisites(), () => !!S.Bodyguard]; + } + + forcedActors() { + return [S.Bodyguard.ID]; } actorPrerequisites() { @@ -22,11 +33,6 @@ App.Facilities.Pit.Fights.NlBg1v1 = class extends App.Facilities.Pit.Fights.NlR1 ]; } - execute(node) { - this.actors = [S.Bodyguard.ID, ...this.actors]; - return super.execute(node); - } - introCombatants(slave1, slave2) { const {his1} = getPronouns(slave1).appendSuffix("1"); return [`In this fight your bodyguard`, App.UI.DOM.slaveDescriptionDialog(slave1), diff --git a/src/facilities/pit/pit.js b/src/facilities/pit/pit.js index 77a3b9928ac631f1201b6d2d46fcb395bbb018e4..7aae172a796b495738e30828cc50d3836002c0ab 100644 --- a/src/facilities/pit/pit.js +++ b/src/facilities/pit/pit.js @@ -29,8 +29,8 @@ App.Facilities.Pit.pit = function() { tabs.addTab("Fighters", "fights", fightsFrag); const endWeekFrag = new DocumentFragment(); + App.UI.DOM.appendNewElement("div", endWeekFrag, arenaUpgrades(), ['margin-bottom']); App.UI.DOM.appendNewElement("div", endWeekFrag, arenaRules(), ['margin-bottom']); - App.UI.DOM.appendNewElement("div", endWeekFrag, arenaFights(), ['margin-bottom']); tabs.addTab("Fights", "ew_fights", endWeekFrag); frag.append(tabs.render()); @@ -200,88 +200,61 @@ App.Facilities.Pit.pit = function() { option.addComment(`Admission is charged to the fights here.`); } + options.addOption("Lethal fights", "lethal", V.pit) + .addValue("Forbidden", 0).addValue("Allowed", 1).addValue("Always", 2); + + options.addOption("Respect virginities", "virginities", V.pit) + .addValue("All", "all").addValue("Vaginal", "vaginal") + .addValue("Anal", "anal").addValue("None", "none"); + App.UI.DOM.appendNewElement("div", el, options.render(), ['margin-bottom']); return el; } - function arenaFights() { - const el = new DocumentFragment(); - const fights = App.Facilities.Pit.getFightsMap(); - for (const f of fights.values()) { - if (f.selectable || App.Facilities.Pit.fightIsQueued(f.key)) { - el.append(arenaFight(f)); + function arenaUpgrades() { + const f = new DocumentFragment(); + f.append((new App.Upgrade("seats", [ + { + value: 0, + upgraded: 1, + text: "Around the pit is an small space to watch the fights from.", + link: "Add some proper stands.", + cost: 5000 * V.upgradeMultiplierArcology + }, + { + value: 1, + upgraded: 2, + text: "Surrounding the pit are small stands to watch the fights from.", + link: "Replace the stands with big, permanent ones.", + cost: 20000 * V.upgradeMultiplierArcology + }, + { + value: 2, + text: "The pit is encased by large stands offering a large space to watch the fights from.", } - } - return el; - } - - /** - * @param {App.Facilities.Pit.Fights.BaseFight} fight - * @returns {HTMLParagraphElement} - */ - function arenaFight(fight) { - const p = document.createElement("p"); - p.append(fight.uiDescription); - - App.UI.DOM.appendNewElement("div", p, `Impact: ${fightImpact(fight.impact)}`); - if (fight.lethal) { - App.UI.DOM.appendNewElement("div", p, `Lethal`, ["warning"]); - } else { - App.UI.DOM.appendNewElement("div", p, `Nonlethal`, ["green"]); - } - - const group = new App.UI.OptionsGroup(); - const isActive = App.Facilities.Pit.fightIsQueued(fight.key); - - if (fight.selectable) { - group.addOption("Active", "isActive", {isActive}) - .addValue("Yes", true).on().addCallback(() => App.Facilities.Pit.queueFight(fight.key)) - .addValue("No", false).off().addCallback(() => App.Facilities.Pit.unqueueFight(fight.key)); - } else { - group.addOption("", "isActive", {isActive}) - .addValue("Cancel", false).addCallback(() => App.Facilities.Pit.unqueueFight(fight.key)); - } - - if (isActive) { - const options = fight.options; - if (options.length > 0) { - const params = App.Facilities.Pit.getFightOptions(fight.key); - for (const o of options) { - if (o.key === "slaveID") { - group.addComment("You assigned " + getSlave(params.slaveID).slaveName + " to this fight"); - } else { - const go = group.addOption(o.name, o.key, params); - for (const v of o.values) { - go.addValue(v.name, v.value); - } - go.addCallbackToEach(() => App.Facilities.Pit.setFightOptions(fight.key, params)); - } - } + ], V.pit)).render()); + f.append((new App.Upgrade("fightsBase", [ + { + value: 0, + upgraded: 1, + text: "Next to the pit is a small room for your slaves to store their equipment in.", + link: "Add a room for the slaves to wait in between fights.", + cost: 5000 * V.upgradeMultiplierArcology + }, + { + value: 1, + upgraded: 2, + text: "Around the arena are some rooms for your slaves to wait and store their equipment in between fights", + link: "Improve the equipment and add spaces for the slaves to prepare for their fights.", + cost: 20000 * V.upgradeMultiplierArcology + }, + { + value: 2, + text: "Around the pit are various facilities for your slaves to rest and prepare in between fights. High quality equipment is available in multiple store rooms", } - } - - p.append(group.render()); - - return p; - } - - /** - * @param {number} impact - * @returns {string} - */ - function fightImpact(impact) { - if (impact === 0) { - return "None"; - } else if (impact < 0.8) { - return "Small"; - } else if (impact < 1.5) { - return "Average"; - } else if (impact < 8) { - return "High"; - } else { - return "Very High"; - } + ], V.pit)).render()); + return f; } function arenaSlaves() { diff --git a/src/facilities/pit/pitFightList.js b/src/facilities/pit/pitFightList.js index a7bea02f03ace7c70eeb4af33490b7e253c90fcf..f12e5e5a50c19d8e1ec10f49c2cea85fc2b70e5a 100644 --- a/src/facilities/pit/pitFightList.js +++ b/src/facilities/pit/pitFightList.js @@ -4,15 +4,12 @@ */ App.Facilities.Pit.getFights = function() { return [ - // order is important, it will be played in the same order during end week! - // TODO make the above statement true - // new App.Facilities.Pit.Fights.TestFight(), new App.Facilities.Pit.Fights.NlR1v1(), new App.Facilities.Pit.Fights.NlBg1v1(), new App.Facilities.Pit.Fights.LR1v1(), new App.Facilities.Pit.Fights.LBg1v1(), - new App.Facilities.Pit.Fights.LSchBg1v1(), + // new App.Facilities.Pit.Fights.LSchBg1v1(), ]; }; /** @@ -26,79 +23,3 @@ App.Facilities.Pit.getFightsMap = function() { } return m; }; - -/** - * @returns {Array<App.Facilities.Pit.Fights.BaseFight>} - */ -App.Facilities.Pit.activeFights = function() { - const allFights = App.Facilities.Pit.getFightsMap(); - const fights = /** @type {Array<App.Facilities.Pit.Fights.BaseFight>} */ []; - for (const f of V.pit.activeFights) { - const fight = allFights.get(f.key); - deepAssign(fight.params, f.options); - fights.push(fight); - } - return fights; -}; - - -/** - * @param {string} key - */ -App.Facilities.Pit.queueFight = function(key) { - const fight = App.Facilities.Pit.getFightsMap().get(key); - if (!fight) { - throw new Error("Trying to queue fight which does not exist."); - } - const options = {}; - for (const o of fight.options) { - options[o.key] = o.default; - } - V.pit.activeFights.push({key: key, options: options}); -}; - -/** - * @param {string} key - */ -App.Facilities.Pit.unqueueFight = function(key) { - V.pit.activeFights.deleteWith(v => v.key === key); -}; - -/** - * @param {string} key - */ -App.Facilities.Pit.fightIsQueued = function(key) { - for (const f of V.pit.activeFights) { - if (f.key === key) { - return true; - } - } - return false; -}; - -/** - * @param {string} key - * @param {Object.<string, *>} options - */ -App.Facilities.Pit.setFightOptions = function(key, options) { - for (const f of V.pit.activeFights) { - if (f.key === key) { - f.options = options; - return; - } - } - throw new Error("Trying to set options for un-queued fight."); -}; - -/** - * @param {string} key - * @returns {Object.<string, *>} - */ -App.Facilities.Pit.getFightOptions = function(key) { - for (const f of V.pit.activeFights) { - if (f.key === key) { - return f.options; - } - } - throw new Error("Trying to get options for un-queued fight."); -}; diff --git a/src/facilities/pit/pitUtils.js b/src/facilities/pit/pitUtils.js index 3717b25910a1cbd46e166eb2ec9877dea11b657c..ee0d9646ce015db550219ba70574d54581ccbf31 100644 --- a/src/facilities/pit/pitUtils.js +++ b/src/facilities/pit/pitUtils.js @@ -10,6 +10,9 @@ App.Facilities.Pit.init = function() { decoration: "standard", fighterIDs: [], fought: false, - activeFights: [], + fightsBase: 0, + seats: 0, + lethal: 0, + virginities: "all" }; };