From 1c38906751cd3a076ff50a09a819199a6964267c Mon Sep 17 00:00:00 2001 From: DCoded <dcoded@live.com> Date: Mon, 21 Sep 2020 22:36:49 -0400 Subject: [PATCH] Minor fixes --- devTools/types/FC.d.ts | 15 ++++-- src/arcologyBuilding/markets.js | 5 +- src/facilities/pit/killSlave.js | 2 +- src/uncategorized/sePitFight.js | 88 +++++++++++++++------------------ 4 files changed, 54 insertions(+), 56 deletions(-) diff --git a/devTools/types/FC.d.ts b/devTools/types/FC.d.ts index f404b124e27..753c31e5f19 100644 --- a/devTools/types/FC.d.ts +++ b/devTools/types/FC.d.ts @@ -608,15 +608,20 @@ declare global { interface Pit { name: string; - animalFights: boolean; - animalType: string; - audience: string; + animal: Animal; + audience: "none" | "free" | "paid"; bodyguardFights: boolean; fighterIDs: number[]; fought: boolean; lethal: boolean; - slaveFightingBodyguard: number | null - virginities: "neither" | "vaginal" | "anal"; + slaveFightingBodyguard: number; + virginities: "neither" | "vaginal" | "anal" | "all" + } + + class Animal { + name: string; + species: string; + type: string; } } } diff --git a/src/arcologyBuilding/markets.js b/src/arcologyBuilding/markets.js index 375c0e772b3..fd150b7d9a9 100644 --- a/src/arcologyBuilding/markets.js +++ b/src/arcologyBuilding/markets.js @@ -110,9 +110,8 @@ App.Arcology.Cell.Market = class extends App.Arcology.Cell.BaseCell { V.pit = { name: "the Pit", - animalFights: false, - animalType: null, - audience: "none", + animal: null, + audience: "free", bodyguardFights: false, fighterIDs: [], fought: false, diff --git a/src/facilities/pit/killSlave.js b/src/facilities/pit/killSlave.js index 20634eda322..a775bb978de 100644 --- a/src/facilities/pit/killSlave.js +++ b/src/facilities/pit/killSlave.js @@ -243,7 +243,7 @@ App.Facilities.Pit.killSlave = function(slave) { } V.pit.slaveFightingBodyguard = slave.ID; - V.pit.animalFights = false; + V.pit.animal = null; return mainDiv; } diff --git a/src/uncategorized/sePitFight.js b/src/uncategorized/sePitFight.js index a487528c3f3..09ee5aa6019 100644 --- a/src/uncategorized/sePitFight.js +++ b/src/uncategorized/sePitFight.js @@ -18,48 +18,44 @@ App.Facilities.Pit.fight = function(lethal) { V.pit.fought = true; - if (lethal) { - if (V.pit.slaveFightingBodyguard) { // slave is fighting bodyguard for their life - fighters.push(S.Bodyguard.ID, V.pit.slaveFightingBodyguard); + if (V.pit.slaveFightingBodyguard) { // slave is fighting bodyguard for their life + fighters.push(S.Bodyguard.ID, V.pit.slaveFightingBodyguard); + } else { + if (V.pit.bodyguardFights) { + fighters.push(S.Bodyguard.ID, V.pit.fighterIDs.pluck()); } else { - if (V.pit.bodyguardFights) { - fighters.push(S.Bodyguard.ID, V.pit.fighterIDs.pluck()); - } else { - V.pit.fighterIDs.includes(S.Bodyguard.ID) ? - V.pit.fighterIDs.splice(V.pit.fighterIDs.indexOf(S.Bodyguard.ID), 1) : - null; // make sure bodyguard isn't still in the fighters list - - if (V.pit.animalFights) { - switch (V.pit.animalType) { - case "canine": - animal = V.activeCanine; - break; - case "hooved": - animal = V.activeHooved; - break; - case "feline": - animal = V.activeFeline; - break; - default: - throw new Error(`Unexpected animalType '${V.pit.animalType}' in App.Facilities.Pit.fight()`); - } - - fighters.push(V.pit.fighterIDs.pluck()); - } else { - fighters.push(V.pit.fighterIDs.pluck(), V.pit.fighterIDs.pluck()); + V.pit.fighterIDs.includes(S.Bodyguard.ID) ? + V.pit.fighterIDs.splice(V.pit.fighterIDs.indexOf(S.Bodyguard.ID), 1) : + null; // make sure bodyguard isn't still in the fighters list + + if (V.pit.animal) { + switch (V.pit.animal.type) { + case "canine": + animal = V.activeCanine; + break; + case "hooved": + animal = V.activeHooved; + break; + case "feline": + animal = V.activeFeline; + break; + default: + throw new Error(`Unexpected animalType '${V.pit.animal}' in App.Facilities.Pit.fight()`); } + + fighters.push(V.pit.fighterIDs.pluck()); + } else { + fighters.push(V.pit.fighterIDs.pluck(), V.pit.fighterIDs.pluck()); } } - - App.UI.DOM.appendNewElement("div", frag, intro()); - App.UI.DOM.appendNewElement("div", frag, deadliness(getSlave(fighters[0]))); - App.UI.DOM.appendNewElement("div", frag, deadliness(getSlave(fighters[1]))); - App.UI.DOM.appendNewElement("div", frag, fight()); - App.UI.DOM.appendNewElement("div", frag, postFight()); - } else { - App.UI.DOM.appendNewElement("div", frag, intro()); } + App.UI.DOM.appendNewElement("div", frag, intro()); + App.UI.DOM.appendNewElement("div", frag, deadliness(getSlave(fighters[0]))); + App.UI.DOM.appendNewElement("div", frag, deadliness(getSlave(fighters[1]))); + App.UI.DOM.appendNewElement("div", frag, fight()); + App.UI.DOM.appendNewElement("div", frag, postFight()); + return frag; @@ -68,13 +64,11 @@ App.Facilities.Pit.fight = function(lethal) { function intro() { const + mainDiv = document.createElement("div"), + fighterOne = getSlave(fighters[0]), fighterTwo = getSlave(fighters[1]) || animal, - - {he, him, girl} = getPronouns(fighterOne), - // {girl: girl2} = getPronouns(fighterTwo), - - mainDiv = document.createElement("div"); + {he, him, girl} = getPronouns(fighterOne); // FIXME: images don't work // fighterOneImageDiv = App.UI.DOM.makeElement("div", SlaveArt(fighterOne, 2, 0), ["imageRef", "medImg"]), @@ -85,7 +79,7 @@ App.Facilities.Pit.fight = function(lethal) { // animal ? mainDiv.appendChild(fighterTwoImageDiv) : null; // } - mainDiv.append(`This week's fight is between ${fighterOne.slaveName} and ${V.pit.animalFights ? `a ${animal}` : `${fighterTwo.slaveName}`}. `); + mainDiv.append(`This week's fight is between ${fighterOne.slaveName} and ${V.pit.animal ? `a ${animal}` : `${fighterTwo.slaveName}`}. `); if (lethal) { if (V.pit.audience === Audience.NONE) { @@ -110,7 +104,7 @@ App.Facilities.Pit.fight = function(lethal) { V.arcologies[0].FSAztecRevivalist += (0.2 * V.FSSingleSlaveRep); } - mainDiv.append(`You review the rules — the ${V.pit.animalFights ? `slave` : `combatants`} will use their choice of swords, and the fight will be to the death${!V.pit.animalFights ? `, with both fighters executed if no decision is reached` : ``}. ${V.pit.animalFights ? `If ${he} wins, ${he}` : `The winner`} will earn two complete days of rest, not to mention continued life. You take a moment to look over your ${V.pit.animalFights ? `slave` : `fighters`} one more time before giving the word. After all, it might be the last time you'll see ${V.pit.animalFights ? `${him}` : `one of them`} alive.`); + mainDiv.append(`You review the rules — the ${V.pit.animal ? `slave` : `combatants`} will use their choice of swords, and the fight will be to the death${!V.pit.animal ? `, with both fighters executed if no decision is reached` : ``}. ${V.pit.animal ? `If ${he} wins, ${he}` : `The winner`} will earn two complete days of rest, not to mention continued life. You take a moment to look over your ${V.pit.animal ? `slave` : `fighters`} one more time before giving the word. After all, it might be the last time you'll see ${V.pit.animal ? `${him}` : `one of them`} alive.`); } return mainDiv; @@ -350,9 +344,9 @@ App.Facilities.Pit.fight = function(lethal) { {he: he2, his: his2, him: him2, girl: girl2} = getPronouns(loser); if (lethal) { - mainDiv.append(`In any case, ${V.pit.animalFights ? `the slave and the ${animal} have both` : `both of the slaves`} been dosed with aggression enhancers and inhibition blockers; they'll fight to kill. `); + mainDiv.append(`In any case, ${V.pit.animal ? `the slave and the ${animal} have both` : `both of the slaves`} been dosed with aggression enhancers and inhibition blockers; they'll fight to kill. `); - if (!V.pit.animalFights) { + if (!V.pit.animal) { if (!canSee(winner) && !canSee(loser)) { mainDiv.append(`${winner.slaveName} and ${loser.slaveName} are both blind, making the fight a staredown. Neither slave wants to make the first move, especially with the drowning cacophony coming from the jeering crowd. Slowly, ${winner.slaveName} moves forward, waving ${his} sword side to side in the hopes of finding ${his} opponent before ${he} ${himself} gets found. ${loser.slaveName}'s sword clips the tip of ${winner.slaveName}'s setting off a surprisingly brutal series of slashes. The two slaves violently lay into each other, suffering more and more strikes as the struggle goes on. Less than a minute from first contact, both slaves are lying in their combined blood. As you begin to call it a draw, you notice ${winner.slaveName} start to stir. ${He} staggers to ${his} feet, coated in ${his} and ${loser.slaveName}'s blood, before dropping back to ${his} knees. It seems ${he} lived through this fight; odds aren't likely ${he}'ll do it again.`); @@ -788,7 +782,7 @@ App.Facilities.Pit.fight = function(lethal) { * @returns {App.Entity.SlaveState} */ function getWinner() { - if (!V.pit.animalFights) { + if (!V.pit.animal) { if (Deadliness(getSlave(fighters[0])) > Deadliness(getSlave(fighters[1]))) { return getSlave(fighters[0]); } else if (Deadliness(getSlave(fighters[0])) < Deadliness(getSlave(fighters[1]))) { @@ -805,7 +799,7 @@ App.Facilities.Pit.fight = function(lethal) { * @returns {App.Entity.SlaveState} */ function getLoser() { - if (!V.pit.animalFights) { + if (!V.pit.animal) { if (Deadliness(getSlave(fighters[0])) > Deadliness(getSlave(fighters[1]))) { return getSlave(fighters[1]); } else if (Deadliness(getSlave(fighters[0])) < Deadliness(getSlave(fighters[1]))) { -- GitLab