diff --git a/js/003-data/gameVariableData.js b/js/003-data/gameVariableData.js index ce97e37f3e67a773b31d9905e1e10191a265f0cd..675d40ee6ed33e458a7c20644ff311b255169806 100644 --- a/js/003-data/gameVariableData.js +++ b/js/003-data/gameVariableData.js @@ -403,15 +403,12 @@ App.Data.resetOnNGPlus = { FSNonconformist: "", econAdvantage: 0, - foughtThisWeek: 0, /* rebellions */ slaveRebellion: 0, citizenRebellion: 0, repairTime: 3, arcRepairTime: 0, garrison: {}, - /* battle relevant vars */ - majorBattle: 0, SecExp: {}, reminderEntry: "", diff --git a/src/Mods/SecExp/events/attackHandler.tw b/src/Mods/SecExp/events/attackHandler.tw index ec51f1ef8efb88e32de36169794d270b2f7a042b..26b59ef7fc201964f6d343a21fba5ceb75c647dd 100644 --- a/src/Mods/SecExp/events/attackHandler.tw +++ b/src/Mods/SecExp/events/attackHandler.tw @@ -1,6 +1,7 @@ :: attackHandler [nobr] <<set $nextButton = " ", $nextLink = "attackReport", $encyclopedia = "Battles">> +<<set _isMajorBattle = $SecExp.war.type.includes("Major")>> <<if $SecExp.war.result == 1 || $SecExp.war.result == -1>> /* bribery/surrender check */ <<if $SecExp.settings.showStats == 1>> @@ -48,7 +49,7 @@ <<set _armyMod = 0>> /* major battle */ - <<if $majorBattle == 1>> + <<if _isMajorBattle>> <<set _militiaMod = 1.5>> <<set _slaveMod = 1.5>> <<set _mercMod = 1.5>> @@ -666,7 +667,7 @@ <<set _armyMod = $SecExp.war.attacker.troops / 60>> <</if>> <<set _armyMod = Math.trunc(_armyMod)>> - <<if $majorBattle == 1>> + <<if _isMajorBattle>> <<set _armyMod *= 2>> <</if>> <<if _armyMod <= 0>> @@ -840,13 +841,13 @@ <</if>> <<if $SecExp.settings.showStats == 1>> - <<if $majorBattle == 1 && $SecExp.settings.battle.major.gameOver == 1 && $SecExp.war.result == -3>> + <<if _isMajorBattle && $SecExp.settings.battle.major.gameOver == 1 && $SecExp.war.result == -3>> <br><br>[[Proceed|Gameover][$gameover = "major battle defeat"]] <<else>> <br><br>[[Proceed|attackReport]] <</if>> <<else>> - <<if $majorBattle == 1 && $SecExp.settings.battle.major.gameOver == 1 && $SecExp.war.result == -3>> + <<if _isMajorBattle && $SecExp.settings.battle.major.gameOver == 1 && $SecExp.war.result == -3>> <<set $gameover = "major battle defeat">> <<goto "Gameover">> <<else>> <<goto "attackReport">> diff --git a/src/Mods/SecExp/events/attackOptions.js b/src/Mods/SecExp/events/attackOptions.js index 23e1d843361e37a2cce19eeec775386bcd4c351d..c37eea41a67394f3354777ffd6392bb66ac926c2 100644 --- a/src/Mods/SecExp/events/attackOptions.js +++ b/src/Mods/SecExp/events/attackOptions.js @@ -2,8 +2,8 @@ App.Events.attackOptions = class attackOptions extends App.Events.BaseEvent { eventPrerequisites() { return [ () => V.secExpEnabled > 0, - () => V.foughtThisWeek === 0, - () => !!(V.SecExp.war) + () => V.SecExp.war.foughtThisWeek === 0, + () => V.SecExp.war.type.includes("Attack") ]; } @@ -18,8 +18,8 @@ App.Events.attackOptions = class attackOptions extends App.Events.BaseEvent { let options; let option; - App.UI.DOM.appendNewElement("h1", node, `${(V.majorBattle === 1) ? `Major ` : ``}Attack Imminent`, ["monospace", "red"]); - if (V.majorBattle === 0) { + App.UI.DOM.appendNewElement("h1", node, `${V.SecExp.war.type} Imminent`, ["monospace", "red"]); + if (!V.SecExp.war.type.includes("Major")) { if (V.SecExp.battles.victories + V.SecExp.battles.losses > 0) { r.push(`The ominous message dominates the screens of your office, and ${V.assistant.name} quickly gathers all information available to prepare for battle.`); if (V.SecExp.war.attacker.type === "raiders") { @@ -116,6 +116,7 @@ App.Events.attackOptions = class attackOptions extends App.Events.BaseEvent { App.UI.DOM.appendNewElement("h3", node, `Recon: (AO: ${V.terrain})`); const _estimatedMen = V.SecExp.war.estimatedMen; const _expectedEquip = V.SecExp.war.expectedEquip; + const isOceanic = V.terrain === "oceanic"; r.push(`It seems your troops and your adversary will fight`); if (V.SecExp.war.terrain === "rural") { r.push(`in`, App.UI.DOM.makeElement("span", `the rural land`, "strong"), `surrounding the free city.`); @@ -133,7 +134,7 @@ App.Events.attackOptions = class attackOptions extends App.Events.BaseEvent { r.push(`in`, App.UI.DOM.makeElement("span", `the wastelands`, "strong"), `outside the free city territory.`); } else if (V.SecExp.war.terrain === "international waters") { r.push(`in`, App.UI.DOM.makeElement("span", `the water surrounding`, "strong"), `the free city.`); - } else if (["an underwater cave", "a sunken ship", "an island"].includes(V.SecExp.war.terrain)) { + } else if (["an underwater cave", "a sunken ship"].includes(V.SecExp.war.terrain)) { r.push(`in`, App.UI.DOM.makeElement("span", `${V.SecExp.war.terrain}`, "strong"), `near the free city.`); } else if (V.SecExp.war.terrain === "error") { r.push(App.UI.DOM.makeElement("span", `Error: failed to assign terrain.`, "red"), `${V.SecExp.war.terrain} reads: ${V.SecExp.war.terrain}.`); @@ -154,19 +155,19 @@ App.Events.attackOptions = class attackOptions extends App.Events.BaseEvent { r.push(`are coming, they seem to be`); if (_expectedEquip <= 0) { r.push(App.UI.DOM.makeElement("span", `poorly armed.`, "strong")); - r.push(`Old rusty small arms are the norm with just a few barely working civilian vehicles.`); + r.push(`Old rusty small arms are the norm with just a few barely working civilian ${isOceanic ? 'boats' : 'vehicles'}.`); } else if (_expectedEquip === 1) { r.push(App.UI.DOM.makeElement("span", `lightly armed,`, "strong")); - r.push(`mostly with small arms and some repurposed civilian vehicles with scattered machine gun support. There's no sign of heavy vehicles, artillery or aircraft.`); + r.push(`mostly with small arms and some repurposed civilian ${isOceanic ? 'boats' : 'vehicles'} with scattered machine gun support. There's no sign of heavy ${isOceanic ? 'boats' : 'vehicles'}, ${isOceanic ? 'submarines' : 'artillery'} or aircraft.`); } else if (_expectedEquip === 2) { r.push(App.UI.DOM.makeElement("span", `decently armed`, "strong")); - r.push(`with good quality small arms, machine guns and a few mortars. There appear to be some heavy military vehicles coming as well.`); + r.push(`with good quality small arms, machine guns and a few mortars. There appear to be some heavy military ${isOceanic ? 'boats' : 'vehicles'} coming as well.`); } else if (_expectedEquip === 3) { r.push(App.UI.DOM.makeElement("span", `well armed`, "strong")); - r.push(`with high quality small arms, snipers, demolitions teams, heavy duty machine guns and mortars. Heavy military vehicles are numerous and a few artillery pieces are accompanying the detachment.`); + r.push(`with high quality small arms, ${isOceanic ? 'spear men' : 'snipers'}, demolitions teams, heavy duty machine guns and mortars. Heavy military ${isOceanic ? 'boats' : 'vehicles'} are numerous and a few ${isOceanic ? 'submarines' : 'artillery pieces'} are accompanying the detachment.`); } else if (_expectedEquip >= 4) { r.push(App.UI.DOM.makeElement("span", `extremely well armed`, "strong")); - r.push(`with excellent small arms and specialized teams with heavy duty infantry support weapons. Heavy presence of armored military vehicles, artillery pieces and even some attack helicopters.`); + r.push(`with excellent small arms and specialized teams with heavy duty infantry support weapons. Heavy presence of armored military ${isOceanic ? 'boats' : 'vehicles'}, ${isOceanic ? 'submarines' : 'artillery pieces'} and even some attack helicopters.`); } App.Events.addParagraph(node, r); r = []; @@ -230,7 +231,7 @@ App.Events.attackOptions = class attackOptions extends App.Events.BaseEvent { node.append(options.render()); App.UI.DOM.appendNewElement("h3", node, `Troops`); - if (V.SF.Toggle && V.SF.Active >= 1 && V.majorBattle) { + if (V.SF.Toggle && V.SF.Active >= 1 && V.SecExp.war.type.includes("Major")) { options = new App.UI.OptionsGroup(); options.addOption("The incoming attack's scale warrants deploying the special force.", "deploySF", V.SecExp.war) .addValue("Green light", 1).on().addValue("Red light", 0).off() @@ -360,7 +361,7 @@ App.Events.attackOptions = class attackOptions extends App.Events.BaseEvent { if (App.SecExp.battle.deployedUnits() > 0) { option.addButton(`Send your orders`, () => { V.SecExp.war.result = 4; - V.foughtThisWeek = 1; + V.SecExp.war.foughtThisWeek = 1; /* sets V.SecExp.war.result value outside accepted range (-3, 3) to avoid evaluation problems */ }, `attackHandler`); } else { @@ -368,11 +369,11 @@ App.Events.attackOptions = class attackOptions extends App.Events.BaseEvent { } option.addButton(`Surrender`, () => { V.SecExp.war.result = -1; - V.foughtThisWeek = 1; + V.SecExp.war.foughtThisWeek = 1; }, "attackReport"); option.addButton(`Attempt to bribe`, () => { V.SecExp.war.result = 1; - V.foughtThisWeek = 1; + V.SecExp.war.foughtThisWeek = 1; }, `attackHandler`); option.addComment(`Will cost around ${cashFormat(Math.round(App.SecExp.battle.bribeCost() * (1 + either(-1, 1) * random(2) * 0.1)))} (estimate).`); node.append(options.render()); diff --git a/src/Mods/SecExp/events/attackReport.js b/src/Mods/SecExp/events/attackReport.js index c93b29fefbc491d5723231802623b767d282babb..04b854456f4ac0420736454f24dcd5cc6ba85077 100644 --- a/src/Mods/SecExp/events/attackReport.js +++ b/src/Mods/SecExp/events/attackReport.js @@ -20,13 +20,13 @@ App.Events.attackReport = function() { V.SecExp.core.totalKills += V.SecExp.war.attacker.losses; V.SecExp.war.losses = Math.trunc(V.SecExp.war.losses); let loot = 0; - let lostSlaves; let captives; const lossesList = []; /* result */ - const majorBattleMod = (V.majorBattle === 0) ? 1 : 2; - if (V.majorBattle !== 0) { + const majorBattle = V.SecExp.war.type.includes("Major"); + const majorBattleMod = !majorBattle ? 1 : 2; + if (majorBattle) { V.SecExp.battles.major++; } if (V.SecExp.war.result === 3) { @@ -56,337 +56,176 @@ App.Events.attackReport = function() { V.SecExp.battles.victories++; } let end = (V.SecExp.battles.victoryStreak >= 2 || V.SecExp.battles.lossStreak >= 2) ? `,` : `.`; + + r.push(`Today, ${asDateString(V.week, random(0, 7))}, our arcology was attacked by`); if (V.SecExp.war.attacker.type === "raiders") { - r.push(`Today, ${asDateString(V.week, random(0, 7))}, our arcology was attacked by a band of wild raiders, ${num(Math.trunc(V.SecExp.war.attacker.troops))} men strong.`); - if (V.SecExp.war.result !== 1 && V.SecExp.war.result !== 0 && V.SecExp.war.result !== -1) { - r.push(`Our defense forces, ${num(Math.trunc(App.SecExp.battle.troopCount()))} strong, clashed with them`); + r.push(`a band of wild raiders`); + } else if (V.SecExp.war.attacker.type === "free city") { + r.push(`a contingent of mercenaries hired by a competing free city`); + } else if (V.SecExp.war.attacker.type === "freedom fighters") { + r.push(`a group of freedom fighters bent on the destruction of the institution of slavery`); + } else if (V.SecExp.war.attacker.type === "old world") { + r.push(`an old world nation boasting a misplaced sense of superiority`); + } + + r.push(`, ${num(Math.trunc(V.SecExp.war.attacker.troops))} men strong.`); + if (V.SecExp.war.result !== 1 && V.SecExp.war.result !== 0 && V.SecExp.war.result !== -1) { + r.push(`Our defense forces, ${num(Math.trunc(App.SecExp.battle.troopCount()))} strong, clashed with them`); + if (V.SecExp.war.terrain === "urban") { + r.push(`in the streets of`); if (V.SecExp.war.terrain === "urban") { - r.push(`in the streets of`); - if (V.SecExp.war.terrain === "urban") { - r.push(`the old world city surrounding the arcology,`); - } else { - r.push(`of the free city,`); - } - } else if (V.SecExp.war.terrain === "rural") { - r.push(`in the rural land surrounding the free city,`); - } else if (V.SecExp.war.terrain === "hills") { - r.push(`on the hills around the free city,`); - } else if (V.SecExp.war.terrain === "coast") { - r.push(`along the coast just outside the free city,`); - } else if (V.SecExp.war.terrain === "outskirts") { - r.push(`just against the walls of the arcology,`); - } else if (V.SecExp.war.terrain === "mountains") { - r.push(`in the mountains overlooking the arcology,`); - } else if (V.SecExp.war.terrain === "wasteland") { - r.push(`in the wastelands outside the free city territory,`); - } - if (V.SecExp.war.attacker.losses !== V.SecExp.war.attacker.troops) { - r.push(`inflicting`); - num(Math.trunc(V.SecExp.war.attacker.losses)); - r.push(`casualties, while sustaining`); - if (V.SecExp.war.losses > 1) { - r.push(`${num(Math.trunc(V.SecExp.war.losses))} casualties`); - } else if (V.SecExp.war.losses > 0) { - r.push(`a casualty`); - } else { - r.push(`zero`); - } - r.push(`themselves.`); + r.push(`the old world city surrounding the arcology,`); } else { - r.push(`completely annihilating their troops, while sustaining`); - if (V.SecExp.war.losses > 1) { - r.push(`${num(Math.trunc(V.SecExp.war.losses))} casualties.`); - } else if (V.SecExp.war.losses > 0) { - r.push(`a casualty.`); - } else { - r.push(`zero casualties.`); - } + r.push(`of the free city,`); } + } else if (V.SecExp.war.terrain === "rural") { + r.push(`in the rural land surrounding the free city,`); + } else if (V.SecExp.war.terrain === "hills") { + r.push(`on the hills around the free city,`); + } else if (V.SecExp.war.terrain === "coast") { + r.push(`along the coast just outside the free city,`); + } else if (V.SecExp.war.terrain === "outskirts") { + r.push(`just against the walls of the arcology,`); + } else if (V.SecExp.war.terrain === "mountains") { + r.push(`in the mountains overlooking the arcology,`); + } else if (V.SecExp.war.terrain === "wasteland") { + r.push(`in the wastelands outside the free city territory,`); + } else if (V.SecExp.war.terrain === "international waters") { + r.push(`in the water surrounding the free city,`); + } else if (["an underwater cave", "a sunken ship"].includes(V.SecExp.war.terrain)) { + r.push(`in <strong>${V.SecExp.war.terrain}</strong> near the free city`); } - if (V.SecExp.war.result === 3) { - if (V.SecExp.war.turns <= 5) { - r.push(`The fight was quick and one sided, our men easily stopped the disorganized horde's futile attempt at raiding your arcology${end}`); - } else if (V.SecExp.war.turns <= 7) { - r.push(`The fight was hard, but in the end our men stopped the disorganized horde attempt at raiding your arcology${end}`); + if (V.SecExp.war.attacker.losses !== V.SecExp.war.attacker.troops) { + r.push(`inflicting ${V.SecExp.war.attacker.losses} casualties, while sustaining`); + if (V.SecExp.war.losses > 1) { + r.push(`${num(Math.trunc(V.SecExp.war.losses))} casualties`); + } else if (V.SecExp.war.losses > 0) { + r.push(`a casualty`); } else { - r.push(`The fight was long and hard, but our men managed to stop the horde raiding party${end}`); - } - if (V.SecExp.battles.victoryStreak >= 2) { - r.push(`adding another victory to the growing list of our military's successes.`); - } else if (V.SecExp.battles.lossStreak >= 2) { - r.push(`finally putting an end to a series of unfortunate defeats.`); - } - } else if (V.SecExp.war.result === -3) { - if (V.SecExp.war.turns <= 5) { - r.push(`The fight was quick and one sided, our men were easily crushed by the barbaric horde of raiders${end}`); - } else if (V.SecExp.war.turns <= 7) { - r.push(`The fight was hard and in the end the bandits proved too much to handle for our men${end}`); + r.push(`zero`); + } + r.push(`themselves.`); + } else { + r.push(`completely annihilating their troops, while sustaining`); + if (V.SecExp.war.losses > 1) { + r.push(`${num(Math.trunc(V.SecExp.war.losses))} casualties.`); + } else if (V.SecExp.war.losses > 0) { + r.push(`a casualty.`); } else { - r.push(`The fight was long and hard, but despite their bravery the horde proved too much for our men${end}`); - } - if (V.SecExp.battles.victoryStreak >= 2) { - r.push(`so interrupting a long series of military successes.`); - } else if (V.SecExp.battles.lossStreak >= 2) { - r.push(`confirming the long list of recent failures our armed forces collected.`); - } - } else if (V.SecExp.war.result === 2) { - r.push(`The fight was long and hard, but in the end our men managed to repel the raiders, though not without difficulty.`); - } else if (V.SecExp.war.result === -2) { - r.push(`The fight was long and hard. Our men in the end had to yield to the horde raiders, which was fortunately unable to capitalized on their victory.`); - } else if (V.SecExp.war.result === -1) { - r.push(`You gave your troops the order to surrender, obediently they stand down.`); - } else if (V.SecExp.war.result === 0) { - r.push(`You decided in favor of a financial approach rather than open hostilities. Your troops remain inside the arcology's walls.`); - } else if (V.SecExp.war.result === 1) { - r.push(`You decided in favor of a financial approach rather than open hostilities. Your troops remain inside the arcology's walls.`); + r.push(`zero casualties.`); + } } - } else if (V.SecExp.war.attacker.type === "free city") { - r.push(`Today, ${asDateString(V.week, random(0, 7))}, our arcology was attacked by a contingent of mercenaries hired by a competing free city, ${num(Math.trunc(V.SecExp.war.attacker.troops))} men strong.`); - if (V.SecExp.war.result !== 1 && V.SecExp.war.result !== 0 && V.SecExp.war.result !== -1) { - r.push(`Our defense forces, ${num(Math.trunc(App.SecExp.battle.troopCount()))} strong, clashed with them`); - if (V.SecExp.war.terrain === "urban") { - r.push(`in the streets of`); - if (V.SecExp.war.terrain === "urban") { - r.push(`the old world city surrounding the arcology,`); - } else { - r.push(`of the free city,`); - } - } else if (V.SecExp.war.terrain === "rural") { - r.push(`in the rural land surrounding the free city,`); - } else if (V.SecExp.war.terrain === "hills") { - r.push(`on the hills around the free city,`); - } else if (V.SecExp.war.terrain === "coast") { - r.push(`along the coast just outside the free city,`); - } else if (V.SecExp.war.terrain === "outskirts") { - r.push(`just against the walls of the arcology,`); - } else if (V.SecExp.war.terrain === "mountains") { - r.push(`in the mountains overlooking the arcology,`); - } else if (V.SecExp.war.terrain === "wasteland") { - r.push(`in the wastelands outside the free city territory,`); - } - if (V.SecExp.war.attacker.losses !== V.SecExp.war.attacker.troops) { - r.push(`inflicting ${V.SecExp.war.attacker.losses} casualties, while sustaining`); - if (V.SecExp.war.losses > 1) { - r.push(`${num(Math.trunc(V.SecExp.war.losses))} casualties`); - } else if (V.SecExp.war.losses > 0) { - r.push(`a casualty`); - } else { - r.push(`zero`); - } - r.push(`themselves.`); - } else { - r.push(`completely annihilating their troops, while sustaining`); - if (V.SecExp.war.losses > 1) { - r.push(`${num(Math.trunc(V.SecExp.war.losses))} casualties.`); - } else if (V.SecExp.war.losses > 0) { - r.push(`a casualty.`); - } else { - r.push(`zero casualties.`); - } + } + if (V.SecExp.war.result === 3) { + if (V.SecExp.war.turns <= 5) { + r.push(`The fight was quick and one sided, our men easily stopped the`); + if (V.SecExp.war.attacker.type === "raiders") { + r.push(`disorganized horde's futile attempt at raiding your arcology${end}`); + } else if (V.SecExp.war.attacker.type === "free city") { + r.push(`mercenaries dead in their tracks${end}`); + } else if (V.SecExp.war.attacker.type === "freedom fighters") { + r.push(`freedom fighters dead in their tracks${end}`); + } else if (V.SecExp.war.attacker.type === "old world") { + r.push(`old world soldiers dead in their tracks${end}`); + } + } else if (V.SecExp.war.turns <= 7) { + r.push(`The fight was hard, but in the end our men stopped the`); + if (V.SecExp.war.attacker.type === "raiders") { + r.push(`disorganized horde attempt at raiding your arcology${end}`); + } else if (V.SecExp.war.attacker.type === "free city") { + r.push(`slavers attempt at weakening your arcology${end}`); + } else if (V.SecExp.war.attacker.type === "freedom fighters") { + r.push(`fighters attack${end}`); + } else if (V.SecExp.war.attacker.type === "old world") { + r.push(`soldiers of the old world${end}`); + } + } else { + r.push(`The fight was long and hard, but our men managed to stop the`); + if (V.SecExp.war.attacker.type === "raiders") { + r.push(`horde raiding party${end}`); + } else if (V.SecExp.war.attacker.type === "free city") { + r.push(`free city mercenaries${end}`); + } else if (V.SecExp.war.attacker.type === "freedom fighters") { + r.push(`freedom fighters${end}`); + } else if (V.SecExp.war.attacker.type === "old world") { + r.push(`old world soldiers${end}`); } } - if (V.SecExp.war.result === 3) { - if (V.SecExp.war.turns <= 5) { - r.push(`The fight was quick and one sided, our men easily stopped the mercenaries dead in their tracks${end}`); - } else if (V.SecExp.war.turns <= 7) { - r.push(`The fight was hard, but in the end our men stopped the slavers attempt at weakening your arcology${end}`); - } else { - r.push(`The fight was long and hard, but our men managed to stop the free city mercenaries${end}`); - } - if (V.SecExp.battles.victoryStreak >= 2) { - r.push(`adding another victory to the growing list of our military's successes.`); - } else if (V.SecExp.battles.lossStreak >= 2) { - r.push(`finally putting an end to a series of unfortunate defeats.`); - } - } else if (V.SecExp.war.result === -3) { - if (V.SecExp.war.turns <= 5) { - r.push(`The fight was quick and one sided, our men were easily crushed by the consumed mercenary veterans sent against us${end}`); - } else if (V.SecExp.war.turns <= 7) { - r.push(`The fight was hard and in the end the slavers proved too much to handle for our men${end}`); - } else { - r.push(`The fight was long and hard, but despite their bravery the mercenary slavers proved too much for our men${end}`); - } - if (V.SecExp.battles.victoryStreak >= 2) { - r.push(`so interrupting a long series of military successes.`); - } else if (V.SecExp.battles.lossStreak >= 2) { - r.push(`confirming the long list of recent failures our armed forces collected.`); - } - } else if (V.SecExp.war.result === 2) { - r.push(`The fight was long and hard, but in the end our men managed to repel the mercenaries, though not without difficulty.`); - } else if (V.SecExp.war.result === -2) { - r.push(`The fight was long and hard. Our men in the end had to yield to the slavers, which were fortunately unable to capitalized on their victory.`); - } else if (V.SecExp.war.result === -1) { - r.push(`You gave your troops the order to surrender, obediently they stand down.`); - } else if (V.SecExp.war.result === 0) { - r.push(`You decided in favor of a financial approach rather than open hostilities. Your troops remain inside the arcology's walls.`); - } else if (V.SecExp.war.result === 1) { - r.push(`You decided in favor of a financial approach rather than open hostilities. Your troops remain inside the arcology's walls.`); + if (V.SecExp.battles.victoryStreak >= 2) { + r.push(`adding another victory to the growing list of our military's successes.`); + } else if (V.SecExp.battles.lossStreak >= 2) { + r.push(`finally putting an end to a series of unfortunate defeats.`); } - } else if (V.SecExp.war.attacker.type === "freedom fighters") { - r.push(`Today, ${asDateString(V.week, random(0, 7))}, our arcology was attacked by a group of freedom fighters bent on the destruction of the institution of slavery, ${num(Math.trunc(V.SecExp.war.attacker.troops))} men strong.`); - if (V.SecExp.war.result !== 1 && V.SecExp.war.result !== 0 && V.SecExp.war.result !== -1) { - r.push(`Our defense forces, ${num(Math.trunc(App.SecExp.battle.troopCount()))} strong, clashed with them`); - if (V.SecExp.war.terrain === "urban") { - r.push(`in the streets of`); - if (V.SecExp.war.terrain === "urban") { - r.push(`the old world city surrounding the arcology,`); - } else { - r.push(`of the free city,`); - } - } else if (V.SecExp.war.terrain === "rural") { - r.push(`in the rural land surrounding the free city,`); - } else if (V.SecExp.war.terrain === "hills") { - r.push(`on the hills around the free city,`); - } else if (V.SecExp.war.terrain === "coast") { - r.push(`along the coast just outside the free city,`); - } else if (V.SecExp.war.terrain === "outskirts") { - r.push(`just against the walls of the arcology,`); - } else if (V.SecExp.war.terrain === "mountains") { - r.push(`in the mountains overlooking the arcology,`); - } else if (V.SecExp.war.terrain === "wasteland") { - r.push(`in the wastelands outside the free city territory,`); - } - if (V.SecExp.war.attacker.losses !== V.SecExp.war.attacker.troops) { - r.push(`inflicting ${V.SecExp.war.attacker.losses} casualties, while sustaining`); - if (V.SecExp.war.losses > 1) { - r.push(`${num(Math.trunc(V.SecExp.war.losses))} casualties`); - } else if (V.SecExp.war.losses > 0) { - r.push(`a casualty`); - } else { - r.push(`zero`); - } - r.push(`themselves.`); - } else { - r.push(`completely annihilating their troops, while sustaining`); - if (V.SecExp.war.losses > 1) { - r.push(`${num(Math.trunc(V.SecExp.war.losses))} casualties.`); - } else if (V.SecExp.war.losses > 0) { - r.push(`a casualty.`); - } else { - r.push(`zero casualties.`); - } + } else if (V.SecExp.war.result === -3) { + if (V.SecExp.war.turns <= 5) { + r.push(`The fight was quick and one sided, our men were easily crushed by the`); + if (V.SecExp.war.attacker.type === "raiders") { + r.push(`barbaric horde of raiders${end}`); + } else if (V.SecExp.war.attacker.type === "free city") { + r.push(`consumed mercenary veterans sent against us${end}`); + } else if (V.SecExp.war.attacker.type === "freedom fighters") { + r.push(`fanatical fury of the freedom fighters${end}`); + } else if (V.SecExp.war.attacker.type === "old world") { + r.push(`discipline of the old world armies${end}`); + } + } else if (V.SecExp.war.turns <= 7) { + r.push(`The fight was hard and in the end the`); + if (V.SecExp.war.attacker.type === "raiders") { + r.push(`bandits proved too much to handle for our men${end}`); + } else if (V.SecExp.war.attacker.type === "free city") { + r.push(`slavers proved too much to handle for our men${end}`); + } else if (V.SecExp.war.attacker.type === "freedom fighters") { + r.push(`freedom fighters proved too much to handle for our men${end}`); + } else if (V.SecExp.war.attacker.type === "old world") { + r.push(`old world proved too much to handle for our men${end}`); + } + } else { + r.push(`The fight was long and hard, but despite their bravery the`); + if (V.SecExp.war.attacker.type === "raiders") { + r.push(`horde proved too much for our men${end}`); + } else if (V.SecExp.war.attacker.type === "free city") { + r.push(`mercenary slavers proved too much for our men${end}`); + } else if (V.SecExp.war.attacker.type === "freedom fighters") { + r.push(`freedom fighters fury proved too much for our men${end}`); + } else if (V.SecExp.war.attacker.type === "old world") { + r.push(`old world troops proved too much for our men${end}`); } } - if (V.SecExp.war.result === 3) { - if (V.SecExp.war.turns <= 5) { - r.push(`The fight was quick and one sided, our men easily stopped the freedom fighters dead in their tracks${end}`); - } else if (V.SecExp.war.turns <= 7) { - r.push(`The fight was hard, but in the end our men stopped the fighters attack${end}`); - } else { - r.push(`The fight was long and hard, but our men managed to stop the freedom fighters${end}`); - } - if (V.SecExp.battles.victoryStreak >= 2) { - r.push(`adding another victory to the growing list of our military's successes.`); - } else if (V.SecExp.battles.lossStreak >= 2) { - r.push(`finally putting an end to a series of unfortunate defeats.`); - } - } else if (V.SecExp.war.result === -3) { - if (V.SecExp.war.turns <= 5) { - r.push(`The fight was quick and one sided, our men were easily crushed by the fanatical fury of the freedom fighters${end}`); - } else if (V.SecExp.war.turns <= 7) { - r.push(`The fight was hard and in the end the freedom fighters proved too much to handle for our men${end}`); - } else { - r.push(`The fight was long and hard, but despite their bravery the freedom fighters fury proved too much for our men${end}`); - } - if (V.SecExp.battles.victoryStreak >= 2) { - r.push(`so interrupting a long series of military successes.`); - } else if (V.SecExp.battles.lossStreak >= 2) { - r.push(`confirming the long list of recent failures our armed forces collected.`); - } - } else if (V.SecExp.war.result === 2) { - r.push(`The fight was long and hard, but in the end our men managed to repel the freedom fighters, though not without difficulty.`); - } else if (V.SecExp.war.result === -2) { - r.push(`The fight was long and hard. Our men in the end had to yield to the freedom fighters, which were fortunately unable to capitalized on their victory.`); - } else if (V.SecExp.war.result === -1) { - r.push(`You gave your troops the order to surrender, obediently they stand down.`); - } else if (V.SecExp.war.result === 0) { - r.push(`You decided in favor of a financial approach rather than open hostilities. Your troops remain inside the arcology's walls.`); - } else if (V.SecExp.war.result === 1) { - r.push(`You decided in favor of a financial approach rather than open hostilities. Your troops remain inside the arcology's walls.`); + if (V.SecExp.battles.victoryStreak >= 2) { + r.push(`so interrupting a long series of military successes.`); + } else if (V.SecExp.battles.lossStreak >= 2) { + r.push(`confirming the long list of recent failures our armed forces collected.`); } - } else if (V.SecExp.war.attacker.type === "old world") { - r.push(`Today, ${asDateString(V.week, random(0, 7))}, our arcology was attacked by an old world nation boasting a misplaced sense of superiority, ${num(Math.trunc(V.SecExp.war.attacker.troops))} men strong.`); - if (V.SecExp.war.result !== 1 && V.SecExp.war.result !== 0 && V.SecExp.war.result !== -1) { - r.push(`Our defense forces, ${num(Math.trunc(App.SecExp.battle.troopCount()))} strong, clashed with them`); - if (V.SecExp.war.terrain === "urban") { - r.push(`in the streets of`); - if (V.SecExp.war.terrain === "urban") { - r.push(`the old world city surrounding the arcology,`); - } else { - r.push(`of the free city,`); - } - } else if (V.SecExp.war.terrain === "rural") { - r.push(`in the rural land surrounding the free city,`); - } else if (V.SecExp.war.terrain === "hills") { - r.push(`on the hills around the free city,`); - } else if (V.SecExp.war.terrain === "coast") { - r.push(`along the coast just outside the free city,`); - } else if (V.SecExp.war.terrain === "outskirts") { - r.push(`just against the walls of the arcology,`); - } else if (V.SecExp.war.terrain === "mountains") { - r.push(`in the mountains overlooking the arcology,`); - } else if (V.SecExp.war.terrain === "wasteland") { - r.push(`in the wastelands outside the free city territory,`); - } - if (V.SecExp.war.attacker.losses !== V.SecExp.war.attacker.troops) { - r.push(`inflicting ${V.SecExp.war.attacker.losses} casualties, while sustaining`); - if (V.SecExp.war.losses > 1) { - r.push(`${num(Math.trunc(V.SecExp.war.losses))} casualties`); - } else if (V.SecExp.war.losses > 0) { - r.push(`a casualty`); - } else { - r.push(`zero`); - } - r.push(`themselves.`); - } else { - r.push(`completely annihilating their troops, while sustaining`); - if (V.SecExp.war.losses > 1) { - r.push(`${num(Math.trunc(V.SecExp.war.losses))} casualties.`); - } else if (V.SecExp.war.losses > 0) { - r.push(`a casualty.`); - } else { - r.push(`zero casualties.`); - } - } + } else if (V.SecExp.war.result === 2) { + r.push(`The fight was long and hard, but in the end our men managed to repel the`); + if (V.SecExp.war.attacker.type === "raiders") { + r.push(`raiders, though not without difficulty.`); + } else if (V.SecExp.war.attacker.type === "free city") { + r.push(`mercenaries, though not without difficulty.`); + } else if (V.SecExp.war.attacker.type === "freedom fighters") { + r.push(`freedom fighters, though not without difficulty.`); + } else if (V.SecExp.war.attacker.type === "old world") { + r.push(`old world soldiers, though not without difficulty.`); } - if (V.SecExp.war.result === 3) { - if (V.SecExp.war.turns <= 5) { - r.push(`The fight was quick and one sided, our men easily stopped the old world soldiers dead in their tracks${end}`); - } else if (V.SecExp.war.turns <= 7) { - r.push(`The fight was hard, but in the end our men stopped the soldiers of the old world${end}`); - } else { - r.push(`The fight was long and hard, but our men managed to stop the old world soldiers${end}`); - } - if (V.SecExp.battles.victoryStreak >= 2) { - r.push(`adding another victory to the growing list of our military's successes.`); - } else if (V.SecExp.battles.lossStreak >= 2) { - r.push(`finally putting an end to a series of unfortunate defeats.`); - } - } else if (V.SecExp.war.result === -3) { - if (V.SecExp.war.turns <= 5) { - r.push(`The fight was quick and one sided, our men were easily crushed by the discipline of the old world armies${end}`); - } else if (V.SecExp.war.turns <= 7) { - r.push(`The fight was hard and in the end the old world proved too much to handle for our men${end}`); - } else { - r.push(`The fight was long and hard, but despite their bravery the determination of the old world troops proved too much for our men${end}`); - } - if (V.SecExp.battles.victoryStreak >= 2) { - r.push(`so interrupting a long series of military successes.`); - } else if (V.SecExp.battles.lossStreak >= 2) { - r.push(`confirming the long list of recent failures our armed forces collected.`); - } - } else if (V.SecExp.war.result === 2) { - r.push(`The fight was long and hard, but in the end our men managed to repel the old world soldiers, though not without difficulty.`); - } else if (V.SecExp.war.result === -2) { - r.push(`The fight was long and hard. Our men in the end had to yield to the old world soldiers, which were fortunately unable to capitalized on their victory.`); - } else if (V.SecExp.war.result === -1) { - r.push(`You gave your troops the order to surrender, obediently they stand down.`); - } else if (V.SecExp.war.result === 0) { - r.push(`You decided in favor of a financial approach rather than open hostilities. Your troops remain inside the arcology's walls.`); - } else if (V.SecExp.war.result === 1) { - r.push(`You decided in favor of a financial approach rather than open hostilities. Your troops remain inside the arcology's walls.`); + } else if (V.SecExp.war.result === -2) { + r.push(`The fight was long and hard. Our men in the end had to yield to the`); + if (V.SecExp.war.attacker.type === "raiders") { + r.push(`horde raiders, which was fortunately unable to capitalize on their victory.`); + } else if (V.SecExp.war.attacker.type === "free city") { + r.push(`slavers, which were fortunately unable to capitalize on their victory.`); + } else if (V.SecExp.war.attacker.type === "freedom fighters") { + r.push(`freedom fighters, which were fortunately unable to capitalize on their victory.`); + } else if (V.SecExp.war.attacker.type === "old world") { + r.push(`old world soldiers, which were fortunately unable to capitalize on their victory.`); } + } else if (V.SecExp.war.result === -1) { + r.push(`You gave your troops the order to surrender, obediently they stand down.`); + } else if (V.SecExp.war.result === 0) { + r.push(`You decided in favor of a financial approach rather than open hostilities. Your troops remain inside the arcology's walls.`); + } else if (V.SecExp.war.result === 1) { + r.push(`You decided in favor of a financial approach rather than open hostilities. Your troops remain inside the arcology's walls.`); } + App.Events.addParagraph(node, r); r = []; /* calculates effects on the city */ @@ -402,8 +241,8 @@ App.Events.attackReport = function() { repX(7500 * majorBattleMod, "war"); V.SecExp.core.authority += 1500 * majorBattleMod; } else if (V.SecExp.war.attacker.type === "old world") { - repX(6000 * majorBattleMod, "war"); - V.SecExp.core.authority += 1200 * majorBattleMod; + repX(8000 * majorBattleMod, "war"); + V.SecExp.core.authority += 1600 * majorBattleMod; } if (V.SecExp.war.attacker.troops - V.SecExp.war.attacker.losses <= 50) { r.push(`a small amount of attackers,`); @@ -465,8 +304,8 @@ App.Events.attackReport = function() { repX(forceNeg(750 * majorBattleMod), "war"); V.SecExp.core.authority -= 750 * majorBattleMod; } else if (V.SecExp.war.attacker.type === "old world") { - repX(forceNeg(600 * majorBattleMod), "war"); - V.SecExp.core.authority -= 600 * majorBattleMod; + repX(forceNeg(800 * majorBattleMod), "war"); + V.SecExp.core.authority -= 800 * majorBattleMod; } App.Events.addParagraph(node, r); r = []; @@ -475,43 +314,23 @@ App.Events.attackReport = function() { cashX(forceNeg(5000 * majorBattleMod), "war"); if (V.week <= 30) { V.lowerClass -= random(100) * majorBattleMod; - lostSlaves = random(150) * majorBattleMod; - V.NPCSlaves -= Math.trunc((V.NPCSlaves / V.ASlaves) * lostSlaves); - V.menials -= Math.trunc((V.menials / V.ASlaves) * lostSlaves); - V.fuckdolls -= Math.trunc((V.fuckdolls / V.ASlaves) * lostSlaves); - V.menialBioreactors -= Math.trunc((V.menialBioreactors / V.ASlaves) * lostSlaves); + App.SecExp.slavesDamaged(random(150) * majorBattleMod); V.arcologies[0].prosperity -= random(5) * majorBattleMod; } else if (V.week <= 60) { V.lowerClass -= random(120) * majorBattleMod; - lostSlaves = random(170) * majorBattleMod; - V.NPCSlaves -= Math.trunc((V.NPCSlaves / V.ASlaves) * lostSlaves); - V.menials -= Math.trunc((V.menials / V.ASlaves) * lostSlaves); - V.fuckdolls -= Math.trunc((V.fuckdolls / V.ASlaves) * lostSlaves); - V.menialBioreactors -= Math.trunc((V.menialBioreactors / V.ASlaves) * lostSlaves); + App.SecExp.slavesDamaged(random(170) * majorBattleMod); V.arcologies[0].prosperity -= random(10) * majorBattleMod; } else if (V.week <= 90) { V.lowerClass -= random(140) * majorBattleMod; - lostSlaves = random(190) * majorBattleMod; - V.NPCSlaves -= Math.trunc((V.NPCSlaves / V.ASlaves) * lostSlaves); - V.menials -= Math.trunc((V.menials / V.ASlaves) * lostSlaves); - V.fuckdolls -= Math.trunc((V.fuckdolls / V.ASlaves) * lostSlaves); - V.menialBioreactors -= Math.trunc((V.menialBioreactors / V.ASlaves) * lostSlaves); + App.SecExp.slavesDamaged(random(190) * majorBattleMod); V.arcologies[0].prosperity -= random(15) * majorBattleMod; } else if (V.week <= 120) { V.lowerClass -= random(160) * majorBattleMod; - lostSlaves = random(210) * majorBattleMod; - V.NPCSlaves -= Math.trunc((V.NPCSlaves / V.ASlaves) * lostSlaves); - V.menials -= Math.trunc((V.menials / V.ASlaves) * lostSlaves); - V.fuckdolls -= Math.trunc((V.fuckdolls / V.ASlaves) * lostSlaves); - V.menialBioreactors -= Math.trunc((V.menialBioreactors / V.ASlaves) * lostSlaves); + App.SecExp.slavesDamaged(random(210) * majorBattleMod); V.arcologies[0].prosperity -= random(20) * majorBattleMod; } else { V.lowerClass -= random(180) * majorBattleMod; - lostSlaves = random(230) * majorBattleMod; - V.NPCSlaves -= Math.trunc((V.NPCSlaves / V.ASlaves) * lostSlaves); - V.menials -= Math.trunc((V.menials / V.ASlaves) * lostSlaves); - V.fuckdolls -= Math.trunc((V.fuckdolls / V.ASlaves) * lostSlaves); - V.menialBioreactors -= Math.trunc((V.menialBioreactors / V.ASlaves) * lostSlaves); + App.SecExp.slavesDamaged(random(230) * majorBattleMod); V.arcologies[0].prosperity -= random(25) * majorBattleMod; } if (V.SecExp.battles.lossStreak >= 3) { @@ -530,8 +349,8 @@ App.Events.attackReport = function() { repX(2000 * majorBattleMod, "war"); V.SecExp.core.authority += 450 * majorBattleMod; } else if (V.SecExp.war.attacker.type === "old world") { - repX(1500 * majorBattleMod, "war"); - V.SecExp.core.authority += 300 * majorBattleMod; + repX(2100 * majorBattleMod, "war"); + V.SecExp.core.authority += 500 * majorBattleMod; } r.push(`which once sold produced`); if (V.SecExp.war.attacker.equip === 0) { @@ -561,11 +380,7 @@ App.Events.attackReport = function() { r.push(`${IncreasePCSkills('engineering', 0.1)}`); cashX(forceNeg(2000 * majorBattleMod), "war"); V.lowerClass -= random(10) * majorBattleMod; - lostSlaves = random(20) * majorBattleMod; - V.NPCSlaves -= Math.trunc((V.NPCSlaves / V.ASlaves) * lostSlaves); - V.menials -= Math.trunc((V.menials / V.ASlaves) * lostSlaves); - V.fuckdolls -= Math.trunc((V.fuckdolls / V.ASlaves) * lostSlaves); - V.menialBioreactors -= Math.trunc((V.menialBioreactors / V.ASlaves) * lostSlaves); + App.SecExp.slavesDamaged(random(20) * majorBattleMod); } else if (V.SecExp.war.result === -2) { r.push(`It was a close defeat, but nonetheless your <span class="red">reputation</span> and <span class="red">authority</span> slightly decreased. Your troops were not able to capture anyone or anything.`); if (V.SecExp.war.attacker.type === "raiders") { @@ -578,8 +393,8 @@ App.Events.attackReport = function() { repX(forceNeg(75 * majorBattleMod), "war"); V.SecExp.core.authority -= 75 * majorBattleMod; } else if (V.SecExp.war.attacker.type === "old world") { - repX(forceNeg(60 * majorBattleMod), "war"); - V.SecExp.core.authority -= 60 * majorBattleMod; + repX(forceNeg(80 * majorBattleMod), "war"); + V.SecExp.core.authority -= 80 * majorBattleMod; } App.Events.addParagraph(node, r); r = []; @@ -589,43 +404,23 @@ App.Events.attackReport = function() { cashX(forceNeg(3000 * majorBattleMod), "war"); if (V.week <= 30) { V.lowerClass -= random(50) * majorBattleMod; - lostSlaves = random(75) * majorBattleMod; - V.NPCSlaves -= Math.trunc((V.NPCSlaves / V.ASlaves) * lostSlaves); - V.menials -= Math.trunc((V.menials / V.ASlaves) * lostSlaves); - V.fuckdolls -= Math.trunc((V.fuckdolls / V.ASlaves) * lostSlaves); - V.menialBioreactors -= Math.trunc((V.menialBioreactors / V.ASlaves) * lostSlaves); + App.SecExp.slavesDamaged(random(75) * majorBattleMod); V.arcologies[0].prosperity -= random(2) * majorBattleMod; } else if (V.week <= 60) { V.lowerClass -= random(60) * majorBattleMod; - lostSlaves = random(85) * majorBattleMod; - V.NPCSlaves -= Math.trunc((V.NPCSlaves / V.ASlaves) * lostSlaves); - V.menials -= Math.trunc((V.menials / V.ASlaves) * lostSlaves); - V.fuckdolls -= Math.trunc((V.fuckdolls / V.ASlaves) * lostSlaves); - V.menialBioreactors -= Math.trunc((V.menialBioreactors / V.ASlaves) * lostSlaves); + App.SecExp.slavesDamaged(random(85) * majorBattleMod); V.arcologies[0].prosperity -= random(5) * majorBattleMod; } else if (V.week <= 90) { V.lowerClass -= random(70) * majorBattleMod; - lostSlaves = random(95) * majorBattleMod; - V.NPCSlaves -= Math.trunc((V.NPCSlaves / V.ASlaves) * lostSlaves); - V.menials -= Math.trunc((V.menials / V.ASlaves) * lostSlaves); - V.fuckdolls -= Math.trunc((V.fuckdolls / V.ASlaves) * lostSlaves); - V.menialBioreactors -= Math.trunc((V.menialBioreactors / V.ASlaves) * lostSlaves); + App.SecExp.slavesDamaged(random(95) * majorBattleMod); V.arcologies[0].prosperity -= random(7) * majorBattleMod; } else if (V.week <= 120) { V.lowerClass -= random(80) * majorBattleMod; - lostSlaves = random(105) * majorBattleMod; - V.NPCSlaves -= Math.trunc((V.NPCSlaves / V.ASlaves) * lostSlaves); - V.menials -= Math.trunc((V.menials / V.ASlaves) * lostSlaves); - V.fuckdolls -= Math.trunc((V.fuckdolls / V.ASlaves) * lostSlaves); - V.menialBioreactors -= Math.trunc((V.menialBioreactors / V.ASlaves) * lostSlaves); + App.SecExp.slavesDamaged(random(105) * majorBattleMod); V.arcologies[0].prosperity -= random(10) * majorBattleMod; } else { V.lowerClass -= random(90) * majorBattleMod; - lostSlaves = random(115) * majorBattleMod; - V.NPCSlaves -= Math.trunc((V.NPCSlaves / V.ASlaves) * lostSlaves); - V.menials -= Math.trunc((V.menials / V.ASlaves) * lostSlaves); - V.fuckdolls -= Math.trunc((V.fuckdolls / V.ASlaves) * lostSlaves); - V.menialBioreactors -= Math.trunc((V.menialBioreactors / V.ASlaves) * lostSlaves); + App.SecExp.slavesDamaged(random(115) * majorBattleMod); V.arcologies[0].prosperity -= random(12) * majorBattleMod; } } else if (V.SecExp.war.result === -1) { @@ -640,8 +435,8 @@ App.Events.attackReport = function() { repX(forceNeg(1000 * majorBattleMod), "war"); V.SecExp.core.authority -= 1000 * majorBattleMod; } else if (V.SecExp.war.attacker.type === "old world") { - repX(forceNeg(800 * majorBattleMod), "war"); - V.SecExp.core.authority -= 800 * majorBattleMod; + repX(forceNeg(1200 * majorBattleMod), "war"); + V.SecExp.core.authority -= 1200 * majorBattleMod; } App.Events.addParagraph(node, r); r = []; @@ -650,43 +445,23 @@ App.Events.attackReport = function() { cashX(forceNeg(1000 * majorBattleMod), "war"); if (V.week <= 30) { V.lowerClass -= random(80) * majorBattleMod; - lostSlaves = random(120) * majorBattleMod; - V.NPCSlaves -= Math.trunc((V.NPCSlaves / V.ASlaves) * lostSlaves); - V.menials -= Math.trunc((V.menials / V.ASlaves) * lostSlaves); - V.fuckdolls -= Math.trunc((V.fuckdolls / V.ASlaves) * lostSlaves); - V.menialBioreactors -= Math.trunc((V.menialBioreactors / V.ASlaves) * lostSlaves); + App.SecExp.slavesDamaged(random(120) * majorBattleMod); V.arcologies[0].prosperity -= random(5) * majorBattleMod; } else if (V.week <= 60) { V.lowerClass -= random(100) * majorBattleMod; - lostSlaves = random(140) * majorBattleMod; - V.NPCSlaves -= Math.trunc((V.NPCSlaves / V.ASlaves) * lostSlaves); - V.menials -= Math.trunc((V.menials / V.ASlaves) * lostSlaves); - V.fuckdolls -= Math.trunc((V.fuckdolls / V.ASlaves) * lostSlaves); - V.menialBioreactors -= Math.trunc((V.menialBioreactors / V.ASlaves) * lostSlaves); + App.SecExp.slavesDamaged(random(140) * majorBattleMod); V.arcologies[0].prosperity -= random(10) * majorBattleMod; } else if (V.week <= 90) { V.lowerClass -= random(120) * majorBattleMod; - lostSlaves = random(160) * majorBattleMod; - V.NPCSlaves -= Math.trunc((V.NPCSlaves / V.ASlaves) * lostSlaves); - V.menials -= Math.trunc((V.menials / V.ASlaves) * lostSlaves); - V.fuckdolls -= Math.trunc((V.fuckdolls / V.ASlaves) * lostSlaves); - V.menialBioreactors -= Math.trunc((V.menialBioreactors / V.ASlaves) * lostSlaves); + App.SecExp.slavesDamaged(random(160) * majorBattleMod); V.arcologies[0].prosperity -= random(15) * majorBattleMod; } else if (V.week <= 120) { V.lowerClass -= random(140) * majorBattleMod; - lostSlaves = random(180) * majorBattleMod; - V.NPCSlaves -= Math.trunc((V.NPCSlaves / V.ASlaves) * lostSlaves); - V.menials -= Math.trunc((V.menials / V.ASlaves) * lostSlaves); - V.fuckdolls -= Math.trunc((V.fuckdolls / V.ASlaves) * lostSlaves); - V.menialBioreactors -= Math.trunc((V.menialBioreactors / V.ASlaves) * lostSlaves); + App.SecExp.slavesDamaged(random(180) * majorBattleMod); V.arcologies[0].prosperity -= random(20) * majorBattleMod; } else { V.lowerClass -= random(160) * majorBattleMod; - lostSlaves = random(200) * majorBattleMod; - V.NPCSlaves -= Math.trunc((V.NPCSlaves / V.ASlaves) * lostSlaves); - V.menials -= Math.trunc((V.menials / V.ASlaves) * lostSlaves); - V.fuckdolls -= Math.trunc((V.fuckdolls / V.ASlaves) * lostSlaves); - V.menialBioreactors -= Math.trunc((V.menialBioreactors / V.ASlaves) * lostSlaves); + App.SecExp.slavesDamaged(random(200) * majorBattleMod); V.arcologies[0].prosperity -= random(25) * majorBattleMod; } } else if (V.SecExp.war.result === 0) { @@ -707,8 +482,8 @@ App.Events.attackReport = function() { repX(forceNeg(750 * majorBattleMod), "war"); V.SecExp.core.authority -= 750 * majorBattleMod; } else if (V.SecExp.war.attacker.type === "old world") { - repX(forceNeg(600 * majorBattleMod), "war"); - V.SecExp.core.authority -= 600 * majorBattleMod; + repX(forceNeg(800 * majorBattleMod), "war"); + V.SecExp.core.authority -= 800 * majorBattleMod; } App.Events.addParagraph(node, r); r = []; @@ -717,43 +492,23 @@ App.Events.attackReport = function() { cashX(-1000, "war"); if (V.week <= 30) { V.lowerClass -= random(80) * majorBattleMod; - lostSlaves = random(120) * majorBattleMod; - V.NPCSlaves -= Math.trunc((V.NPCSlaves / V.ASlaves) * lostSlaves); - V.menials -= Math.trunc((V.menials / V.ASlaves) * lostSlaves); - V.fuckdolls -= Math.trunc((V.fuckdolls / V.ASlaves) * lostSlaves); - V.menialBioreactors -= Math.trunc((V.menialBioreactors / V.ASlaves) * lostSlaves); + App.SecExp.slavesDamaged(random(120) * majorBattleMod); V.arcologies[0].prosperity -= random(5) * majorBattleMod; } else if (V.week <= 60) { V.lowerClass -= random(100) * majorBattleMod; - lostSlaves = random(140) * majorBattleMod; - V.NPCSlaves -= Math.trunc((V.NPCSlaves / V.ASlaves) * lostSlaves); - V.menials -= Math.trunc((V.menials / V.ASlaves) * lostSlaves); - V.fuckdolls -= Math.trunc((V.fuckdolls / V.ASlaves) * lostSlaves); - V.menialBioreactors -= Math.trunc((V.menialBioreactors / V.ASlaves) * lostSlaves); + App.SecExp.slavesDamaged(random(140) * majorBattleMod); V.arcologies[0].prosperity -= random(10) * majorBattleMod; } else if (V.week <= 90) { V.lowerClass -= random(120) * majorBattleMod; - lostSlaves = random(160) * majorBattleMod; - V.NPCSlaves -= Math.trunc((V.NPCSlaves / V.ASlaves) * lostSlaves); - V.menials -= Math.trunc((V.menials / V.ASlaves) * lostSlaves); - V.fuckdolls -= Math.trunc((V.fuckdolls / V.ASlaves) * lostSlaves); - V.menialBioreactors -= Math.trunc((V.menialBioreactors / V.ASlaves) * lostSlaves); + App.SecExp.slavesDamaged(random(160) * majorBattleMod); V.arcologies[0].prosperity -= random(15) * majorBattleMod; } else if (V.week <= 120) { V.lowerClass -= random(140) * majorBattleMod; - lostSlaves = random(180) * majorBattleMod; - V.NPCSlaves -= Math.trunc((V.NPCSlaves / V.ASlaves) * lostSlaves); - V.menials -= Math.trunc((V.menials / V.ASlaves) * lostSlaves); - V.fuckdolls -= Math.trunc((V.fuckdolls / V.ASlaves) * lostSlaves); - V.menialBioreactors -= Math.trunc((V.menialBioreactors / V.ASlaves) * lostSlaves); + App.SecExp.slavesDamaged(random(180) * majorBattleMod); V.arcologies[0].prosperity -= random(20) * majorBattleMod; } else { V.lowerClass -= random(160) * majorBattleMod; - lostSlaves = random(200) * majorBattleMod; - V.NPCSlaves -= Math.trunc((V.NPCSlaves / V.ASlaves) * lostSlaves); - V.menials -= Math.trunc((V.menials / V.ASlaves) * lostSlaves); - V.fuckdolls -= Math.trunc((V.fuckdolls / V.ASlaves) * lostSlaves); - V.menialBioreactors -= Math.trunc((V.menialBioreactors / V.ASlaves) * lostSlaves); + App.SecExp.slavesDamaged(random(200) * majorBattleMod); V.arcologies[0].prosperity -= random(25) * majorBattleMod; } App.Events.addParagraph(node, r); @@ -768,7 +523,7 @@ App.Events.attackReport = function() { } else if (V.SecExp.war.attacker.type === "freedom fighters") { repX(1000 * majorBattleMod, "war"); } else if (V.SecExp.war.attacker.type === "old world") { - repX(750 * majorBattleMod, "war"); + repX(1250 * majorBattleMod, "war"); } cashX(forceNeg(App.SecExp.battle.bribeCost()), "war"); } @@ -933,12 +688,7 @@ App.Events.attackReport = function() { r.push(`During the fighting <span class="red">you were wounded.</span> Your medics assure you it's nothing life threatening, but you'll be weakened for a few weeks.`); } } else if (V.SecExp.war.commander === "assistant") { - if (V.auto === 1) { - r.push(`${V.assistant.name}`); - } else { - r.push(`You`); - } - r.push(`let your personal assistant lead the troops.`); + r.push(`${V.assistant.name} lead the troops.`); if (App.SecExp.battle.deployedUnits('mercs') >= 1 || App.SecExp.battle.deployedUnits('militia') >= 1 || App.SecExp.battle.deployedUnits('slaves') >= 1) { r.push(`No soldier trusts a computer to be their commander,`); if (oldRep < 10000 && oldAuth < 10000) { @@ -960,25 +710,20 @@ App.Events.attackReport = function() { r.push(`You find`); } if (V.assistant.power === 0) { - r.push(`your assistant gives a rather poor field performance, due to the limited computing power available to ${himA}.`); + r.push(`your assistant gave a rather poor field performance, due to the limited computing power available to ${himA}.`); } else if (V.assistant.power === 1) { - r.push(`your assistant performs decently. While nothing to write home about your men are pleasantly surprised.`); + r.push(`your assistant performed decently. While nothing to write home about your men are pleasantly surprised.`); } else if (V.assistant.power === 2) { - r.push(`your assistant performs admirably. ${HisA} upgraded computing power allows ${himA} to monitor the battlefield closely, enhancing the efficiency of your troops and the effectiveness of your battle plan.`); + r.push(`your assistant performed admirably. ${HisA} upgraded computing power allows ${himA} to monitor the battlefield closely, enhancing the efficiency of your troops and the effectiveness of your battle plan.`); } else if (V.assistant.power >= 3) { - r.push(`your assistant performs admirably. ${HisA} vast computing power allows ${himA} to be everywhere on the battlefield, greatly enhancing the efficiency of your troops and the effectiveness of your battle plan.`); + r.push(`your assistant performed admirably. ${HisA} vast computing power allows ${himA} to be everywhere on the battlefield, greatly enhancing the efficiency of your troops and the effectiveness of your battle plan.`); } } else if (V.SecExp.war.commander === "bodyguard") { const { His, He, his, he, him } = getPronouns(S.Bodyguard); - if (V.auto === 1) { - r.push(`${V.assistant.name}`); - } else { - r.push(`You`); - } - r.push(`decided it will be your bodyguard that leads the troops.`); + r.push(`Your bodyguard lead the troops.`); if (App.SecExp.battle.deployedUnits('slaves') >= 1) { if (S.Bodyguard.devotion < -20) { r.push(`${His} low devotion has a negative impact on the morale of your slave soldiers.`); @@ -1151,12 +896,7 @@ App.Events.attackReport = function() { His, He, his, he, him } = getPronouns(S.HeadGirl); - if (V.auto === 1) { - r.push(`${V.assistant.name}`); - } else { - r.push(`You`); - } - r.push(`decided it will be your Head Girl that leads the troops.`); + r.push(`Your Head Girl lead the troops.`); if (App.SecExp.battle.deployedUnits('slaves') >= 1) { if (S.HeadGirl.devotion < -20) { r.push(`${His} low devotion has a negative impact on the morale of your slave soldiers.`); @@ -1323,12 +1063,7 @@ App.Events.attackReport = function() { } } } else if (V.SecExp.war.commander === "citizen") { - if (V.auto === 1) { - r.push(`${V.assistant.name}`); - } else { - r.push(`You`); - } - r.push(`decided to appoint one of your volunteers as the commander.`); + r.push(`One of your volunteers was the commander.`); if (V.arcologies[0].FSDegradationist === "unset" && V.arcologies[0].FSPaternalist === "unset") { if (App.SecExp.battle.deployedUnits('militia') >= 1) { r.push(`Your volunteers are honored and pleased that one of their own is leading the defense force of the city.`); @@ -1373,12 +1108,7 @@ App.Events.attackReport = function() { r.push(`During the battle a stray bullet managed to reach the leader. Your troops were greatly affected by the loss.`); } } else if (V.SecExp.war.commander === "mercenary") { - if (V.auto === 1) { - r.push(`${V.assistant.name}`); - } else { - r.push(`You`); - } - r.push(`decided to appoint one of your mercenary officers as the commander.`); + r.push(`One of your mercenary officers took command.`); if (App.SecExp.battle.deployedUnits('mercs') >= 1) { r.push(`Your mercenaries of course approve of your decision.`); } @@ -1397,12 +1127,7 @@ App.Events.attackReport = function() { r.push(`During the battle a stray bullet managed to reach the mercenary. Your troops were greatly affected by the loss of their leader.`); } } else if (V.SecExp.war.commander === "colonel") { - if (V.auto === 1) { - r.push(`${V.assistant.name}`); - } else { - r.push(`You`); - } - r.push(`decided to appoint The Colonel as the commander.`); + r.push(`The Colonel was the commander.`); if (App.SecExp.battle.deployedUnits('mercs') >= 1) { r.push(`Your mercenaries approve of such decisions, as they feel more confident by having a good, experienced commander.`); } @@ -1428,10 +1153,10 @@ App.Events.attackReport = function() { r = []; /* tactics */ - if (V.auto === 1) { - r.push(`${V.assistant.name}`); - } else { + if (V.SecExp.war.commander === "PC") { r.push(`You`); + } else { + r.push(`Your commander`); } if (V.SecExp.war.chosenTactic === "Bait and Bleed") { r.push(`chose to employ "bait and bleed" tactics or relying on quick attacks and harassment to tire and wound the enemy until their surrender.`); @@ -1576,6 +1301,60 @@ App.Events.attackReport = function() { } else if (V.SecExp.war.chosenTactic === "Human Wave") { r.push(`The wastelands, while rough, are mostly open terrain, where your men are able to mount effective mass assaults.`); } + } else if (V.SecExp.war.terrain === "international waters") { + if (V.SecExp.war.chosenTactic === "Bait and Bleed") { + r.push(`The open terrain of international waters does not lend itself well to bait and bleed tactics, making it harder for your men to achieve tactical superiority.`); + } else if (V.SecExp.war.chosenTactic === "Guerrilla") { + r.push(`The open terrain of international waters does not offer many hiding spots, making it harder for your men to perform guerrilla actions effectively.`); + } else if (V.SecExp.war.chosenTactic === "Choke Points") { + r.push(`The open terrain of international waters does not offer many natural choke points, making it hard for your troops to funnel the enemy towards highly defended positions.`); + } else if (V.SecExp.war.chosenTactic === "Interior Lines") { + r.push(`The open terrain allows your men to easily exploit the superior mobility of the defender, making excellent use of interior lines to strike where it hurts.`); + } else if (V.SecExp.war.chosenTactic === "Pincer Maneuver") { + r.push(`The open terrain affords your men great mobility, allowing them to easily position themselves for envelopment.`); + } else if (V.SecExp.war.chosenTactic === "Defense In Depth") { + r.push(`The open terrain affords your men great mobility, allowing them to exploit overextended assaults and concentrate where and when it matters.`); + } else if (V.SecExp.war.chosenTactic === "Blitzkrieg") { + r.push(`The open terrain affords your men great mobility, making it easier to accomplish concentrated lightning strikes.`); + } else if (V.SecExp.war.chosenTactic === "Human Wave") { + r.push(`The open terrain affords your men great mobility, making it easier to overwhelm the enemy with mass assaults.`); + } + } else if (V.SecExp.war.terrain === "an underwater cave") { + if (V.SecExp.war.chosenTactic === "Bait and Bleed") { + r.push(`The tight terrain of an underwater cave does not lend itself well to bait and bleed tactics, making it harder for your men to achieve tactical superiority.`); + } else if (V.SecExp.war.chosenTactic === "Guerrilla") { + r.push(`The tight terrain of an underwater cave does offers many hiding spots, making it easier for your men to perform guerrilla actions effectively.`); + } else if (V.SecExp.war.chosenTactic === "Choke Points") { + r.push(`The tight terrain of an underwater cave offers many natural choke points, making it easy for your troops to funnel the enemy towards highly defended positions.`); + } else if (V.SecExp.war.chosenTactic === "Interior Lines") { + r.push(`The tight terrain makes it hard for your men to easily exploit the superior mobility of the defender.`); + } else if (V.SecExp.war.chosenTactic === "Pincer Maneuver") { + r.push(`The tight terrain hinders the mobility of your army, allowing them to easily position themselves for envelopment.`); + } else if (V.SecExp.war.chosenTactic === "Defense In Depth") { + r.push(`The tight terrain hinders the mobility of your army, allowing them to exploit overextended assaults and concentrate where and when it matters.`); + } else if (V.SecExp.war.chosenTactic === "Blitzkrieg") { + r.push(`The tight terrain hinders the mobility of your army, making it easier to accomplish concentrated lightning strikes.`); + } else if (V.SecExp.war.chosenTactic === "Human Wave") { + r.push(`The tight terrain hinders the mobility of your army, making it easier to overwhelm the enemy with mass assaults.`); + } + } else if (V.SecExp.war.terrain === "a sunken ship") { + if (V.SecExp.war.chosenTactic === "Bait and Bleed") { + r.push(`The tight terrain of a sunken ship lends itself well to bait and bleed tactics, making it easier for your men to achieve tactical superiority.`); + } else if (V.SecExp.war.chosenTactic === "Guerrilla") { + r.push(`The tight terrain of a sunken ship offers many hiding spots, making it easy for your men to perform guerrilla actions effectively.`); + } else if (V.SecExp.war.chosenTactic === "Choke Points") { + r.push(`The tight terrain of a sunken ship offers many natural choke points, making it easy for your troops to funnel the enemy towards highly defended positions.`); + } else if (V.SecExp.war.chosenTactic === "Interior Lines") { + r.push(`The tight terrain does not allow your men to easily exploit the superior mobility of the defender.`); + } else if (V.SecExp.war.chosenTactic === "Pincer Maneuver") { + r.push(`The open terrain hinders the mobility of your army, allowing them to easily position themselves for envelopment.`); + } else if (V.SecExp.war.chosenTactic === "Defense In Depth") { + r.push(`The open terrain affords your men great mobility, allowing them to exploit overextended assaults and concentrate where and when it matters.`); + } else if (V.SecExp.war.chosenTactic === "Blitzkrieg") { + r.push(`The open terrain affords your men great mobility, making it easier to accomplish concentrated lightning strikes.`); + } else if (V.SecExp.war.chosenTactic === "Human Wave") { + r.push(`The open terrain affords your men great mobility, making it easier to overwhelm the enemy with mass assaults.`); + } } if (V.SecExp.war.chosenTactic === "Bait and Bleed") { @@ -1749,7 +1528,6 @@ App.Events.attackReport = function() { } /* resets variables */ - V.majorBattle = 0; V.SecExp.units.bots.isDeployed = 0; for (const squad of App.SecExp.unit.humanSquads()) { squad.isDeployed = 0; @@ -1774,7 +1552,7 @@ App.Events.attackReport = function() { if (unit.training < 100) { if (random(1, 100) > 60) { r.push(`Experience has increased.`); - unit.training += random(5, 15) + V.majorBattle * random(5, 15); + unit.training += random(5, 15) + (majorBattle ? 1 : 0) * random(5, 15); } } App.Events.addNode(el, r, "div"); @@ -1795,7 +1573,6 @@ App.Events.attackReport = function() { /* generates a list of randomized losses, from which each unit picks one at random */ let losses = V.SecExp.war.losses; const averageLosses = Math.trunc(losses / App.SecExp.battle.deployedUnits()); - let validityCount = 0; let assignedLosses; for (let i = 0; i < App.SecExp.battle.deployedUnits(); i++) { assignedLosses = Math.trunc(Math.clamp(averageLosses + random(-5, 5), 0, 100)); @@ -1806,7 +1583,6 @@ App.Events.attackReport = function() { losses -= assignedLosses; } lossesList.push(assignedLosses); - validityCount += assignedLosses; } if (losses > 0) { lossesList[random(lossesList.length - 1)] += losses; @@ -1917,7 +1693,7 @@ App.Events.attackReport = function() { if (unit.training < 100) { if (random(1, 100) > 60) { r.push(`Experience has increased.`); - unit.training += random(5, 15) + V.majorBattle * random(5, 15); + unit.training += random(5, 15) + (majorBattle ? 1 : 0) * random(5, 15); } } App.Events.addNode(el, r, "div"); diff --git a/src/Mods/SecExp/events/rebellionOptions.tw b/src/Mods/SecExp/events/rebellionOptions.tw index 98f16da666774eea322ff5f3d44b59379188e925..5a8e8d2dcf5771c6711e660418812e07caafed68 100644 --- a/src/Mods/SecExp/events/rebellionOptions.tw +++ b/src/Mods/SecExp/events/rebellionOptions.tw @@ -106,5 +106,5 @@ In order to preserve the structural integrity of the building and the lives of o <</if>> <br><br> <<includeDOM App.SecExp.unit.replenishAll()>> -[[Proceed|rebellionHandler][$SecExp.war.result = 4, $foughtThisWeek = 1]] /* sets $SecExp.war.result to a value outside accepted range (-3,3) to avoid evaluation problems */ -<br>[[Surrender|rebellionReport][$SecExp.war.result = -1, $foughtThisWeek = 1]] +[[Proceed|rebellionHandler][$SecExp.war.result = 4, $SecExp.war.foughtThisWeek = 1]] /* sets $SecExp.war.result to a value outside accepted range (-3,3) to avoid evaluation problems */ +<br>[[Surrender|rebellionReport][$SecExp.war.result = -1, $SecExp.war.foughtThisWeek = 1]] diff --git a/src/Mods/SecExp/events/unitsRebellionReport.tw b/src/Mods/SecExp/events/unitsRebellionReport.tw index f017ea8c6fb7d963c505b281d46bd14835952a69..375fd29ba1ec291197a73e92fbeddc3db22daa9f 100644 --- a/src/Mods/SecExp/events/unitsRebellionReport.tw +++ b/src/Mods/SecExp/events/unitsRebellionReport.tw @@ -204,7 +204,7 @@ <<if $SecExp.units.militia.squads[_j].training < 100>> <<if random(1,100) > 60>> Experience has increased. - <<set $SecExp.units.militia.squads[_j].training += random(5,15) + $majorBattle * random(5,15)>> + <<set $SecExp.units.militia.squads[_j].training += random(5,15)>> <</if>> <</if>> <<if $SecExp.units.militia.squads[_j].troops <= 0>> @@ -250,7 +250,7 @@ <<if $SecExp.units.slaves.squads[_j].training < 100>> <<if random(1,100) > 60>> Experience gained. - <<set $SecExp.units.slaves.squads[_j].training += random(5,15) + $majorBattle * random(5,15)>> + <<set $SecExp.units.slaves.squads[_j].training += random(5,15)>> <</if>> <</if>> <<if $SecExp.units.slaves.squads[_j].troops <= 0>> @@ -292,7 +292,7 @@ <<if $SecExp.units.mercs.squads[_j].training < 100>> <<if random(1,100) > 60>> Experience gained. - <<set $SecExp.units.mercs.squads[_j].training += random(5,15) + $majorBattle * random(5,15)>> + <<set $SecExp.units.mercs.squads[_j].training += random(5,15)>> <</if>> <</if>> <<if $SecExp.units.mercs.squads[_j].troops <= 0>> @@ -493,4 +493,4 @@ <</if>> <<run cashX(forceNeg(1000 * _mercRebelledID.length), "war")>> <<run $SecExp.units.mercs.squads.deleteWith((u) => _mercRebelledID.includes(u.ID))>> -<</if>> +<</if>> \ No newline at end of file diff --git a/src/Mods/SecExp/js/secExp.js b/src/Mods/SecExp/js/secExp.js index 00183102f1b2670ff4e3c92306462d83daadbdcc..6f940a8382f6bbe561b2675d352253edea809ac0 100644 --- a/src/Mods/SecExp/js/secExp.js +++ b/src/Mods/SecExp/js/secExp.js @@ -5,16 +5,15 @@ App.SecExp.generator = (function() { }; function shared() { - V.SecExp.war = V.SecExp.war || {}; V.SecExp.war.commander = "assistant"; V.SecExp.war.losses = 0; V.SecExp.war.attacker = {losses: 0}; } function attack() { - let attackChance = 0; // attackChance value is the chance out of 100 of an attack happening this week - // attacks are deactivated if the arcology is in the middle of the ocean, security drones are not around yet, there is not a rebellion this week or the last attack/rebellion happened within 3 weeks - if (V.terrain !== "oceanic" && V.arcologyUpgrade.drones === 1 && V.citizenRebellion === 0 && V.slaveRebellion === 0 && V.SecExp.battles.lastEncounterWeeks > 3 && V.SecExp.rebellions.lastEncounterWeeks > 3) { + let attackChance = 10000; // attackChance value is the chance out of 100 of an attack happening this week + // attacks are deactivated if security drones are not around yet, there is not a rebellion this week or the last attack/rebellion happened within 3 weeks + if (V.arcologyUpgrade.drones === 1 && V.citizenRebellion === 0 && V.slaveRebellion === 0 && V.SecExp.battles.lastEncounterWeeks > 3 && V.SecExp.rebellions.lastEncounterWeeks > 3) { if (V.week < 30) { attackChance = 5; } else if (V.week < 60) { @@ -33,9 +32,9 @@ App.SecExp.generator = (function() { if (V.SecExp.battles.lastEncounterWeeks >= 10) { attackChance += V.SecExp.battles.lastEncounterWeeks/2; // attackChance += 5; } - /* if (V.terrain === "oceanic") { + if (V.terrain === "oceanic") { attackChance -= 10; - } */ + } attackChance *= V.SecExp.settings.battle.frequency; // battle frequency } @@ -121,6 +120,7 @@ App.SecExp.generator = (function() { troops = random(30, 60); } + V.SecExp.war.type = 'Attack'; if (V.terrain === "urban") { terrain = either("outskirts", "urban", "wasteland"); } else if (V.terrain === "rural") { @@ -129,8 +129,8 @@ App.SecExp.generator = (function() { terrain = either("hills", "mountains", "outskirts", "wasteland"); } else if (V.terrain === "marine") { terrain = either("coast", "hills", "outskirts", "wasteland"); - // } else if (V.terrain === "oceanic") { - // terrain = either("international waters", "an underwater cave", "a sunken ship", "an island"); + } else if (V.terrain === "oceanic") { + terrain = either("international waters", "an underwater cave", "a sunken ship"); } else { terrain = "error"; } @@ -154,7 +154,7 @@ App.SecExp.generator = (function() { if (V.SecExp.settings.battle.major.enabled === 1) { // major battles have a 50% chance of firing after week 120 if ((V.week >= 120 && random(1, 100) >= 50) || V.SecExp.settings.battle.major.force === 1) { - V.majorBattle = 1; + V.SecExp.war.type = 'Major Attack'; const sfActive = V.SF.Toggle && V.SF.Active >= 1; troops *= sfActive ? random(4, 6) : random(2, 3); equip = sfActive ? either(3, 4) : either(2, 3, 4); @@ -199,7 +199,7 @@ App.SecExp.generator = (function() { } } - if (V.SecExp.settings.rebellion.force === 1 && V.foughtThisWeek === 0) { + if (V.SecExp.settings.rebellion.force === 1 && V.SecExp.war.foughtThisWeek === 0) { type = random(1, 100) <= 50 ? V.slaveRebellion = 1 : V.citizenRebellion = 1; } @@ -773,7 +773,7 @@ App.SecExp.battle = (function() { } else { cost = 30000 + baseBribePerAttacker * V.SecExp.war.attacker.troops; } - cost *= V.majorBattle > 0 ? 3 : 1; + cost *= (V.SecExp.war.type.includes("Major") ? 3 : 1); return Math.trunc(Math.clamp(cost, 0, 1000000)); } })(); @@ -950,3 +950,10 @@ App.SecExp.inflictBattleWound = (function() { return doWound; })(); + +App.SecExp.slavesDamaged = function(adjustValue) { + V.NPCSlaves -= Math.trunc((V.NPCSlaves / V.ASlaves) * adjustValue); + V.menials -= Math.trunc((V.menials / V.ASlaves) * adjustValue); + V.fuckdolls -= Math.trunc((V.fuckdolls / V.ASlaves) * adjustValue); + V.menialBioreactors -= Math.trunc((V.menialBioreactors / V.ASlaves) * adjustValue); +}; diff --git a/src/Mods/SecExp/js/terrainAndTactics.js b/src/Mods/SecExp/js/terrainAndTactics.js index 1848e1f1cdb563c5ae137bf97f4ac824cb06b5d6..8d23124ebdb5ab3fa8ca422d05e4980c99b00eb9 100644 --- a/src/Mods/SecExp/js/terrainAndTactics.js +++ b/src/Mods/SecExp/js/terrainAndTactics.js @@ -348,4 +348,130 @@ App.Data.SecExp.TerrainAndTactics = new Map([ tacChance: 0.25, }, }], + ["international waters", { + "Bait and Bleed": { + atkMod: -0.05, + defMod: -0.10, + tacChance: -0.15, + }, + "Guerrilla": { + atkMod: -0.10, + defMod: -0.10, + tacChance: -0.20, + }, + "Choke Points": { + atkMod: -0.10, + defMod: -0.15, + tacChance: -0.25, + }, + "Interior Lines": { + atkMod: 0.10, + defMod: 0.15, + tacChance: 0.25, + }, + "Pincer Maneuver": { + atkMod: 0.15, + defMod: 0.10, + tacChance: 0.25, + }, + "Defense In Depth": { + atkMod: 0.15, + defMod: 0.15, + tacChance: 0.30, + }, + "Blitzkrieg": { + atkMod: 0.15, + defMod: 0.10, + tacChance: 0.25, + }, + "Human Wave": { + atkMod: 0.20, + defMod: 0.05, + tacChance: 0.25, + }, + }], + ["an underwater cave", { + "Bait and Bleed": { + atkMod: -0.05, + defMod: -0.05, + tacChance: -0.10, + }, + "Guerrilla": { + atkMod: 0.30, + defMod: 0.30, + tacChance: 0.5, + }, + "Choke Points": { + atkMod: 0.30, + defMod: 0.30, + tacChance: 0.5, + }, + "Interior Lines": { + atkMod: -0.10, + defMod: -0.15, + tacChance: -0.05, + }, + "Pincer Maneuver": { + atkMod: -0.15, + defMod: -0.10, + tacChance: -0.25, + }, + "Defense In Depth": { + atkMod: 0.15, + defMod: 0.15, + tacChance: 0.35, + }, + "Blitzkrieg": { + atkMod: -0.15, + defMod: -0.15, + tacChance: -0.30, + }, + "Human Wave": { + atkMod: -0.20, + defMod: -0.05, + tacChance: -0.25, + }, + }], + ["a sunken ship", { + "Bait and Bleed": { + atkMod: 0.30, + defMod: 0.30, + tacChance: 0.5, + }, + "Guerrilla": { + atkMod: 0.30, + defMod: 0.30, + tacChance: 0.5, + }, + "Choke Points": { + atkMod: 0.30, + defMod: 0.30, + tacChance: 0.5, + }, + "Interior Lines": { + atkMod: -0.10, + defMod: -0.15, + tacChance: -0.05, + }, + "Pincer Maneuver": { + atkMod: -0.15, + defMod: -0.10, + tacChance: -0.05, + }, + "Defense In Depth": { + atkMod: -0.05, + defMod: -0.10, + tacChance: -0.15, + }, + "Blitzkrieg": { + atkMod: -0.15, + defMod: -0.15, + tacChance: -0.30, + }, + "Human Wave": { + atkMod: -0.20, + defMod: -0.05, + tacChance: -0.25, + }, + }], ]); diff --git a/src/Mods/SecExp/potentialToDo.txt b/src/Mods/SecExp/potentialToDo.txt index 488310875d036463afb62232e545990f7bfe81d8..eb00bfaed65dd8144fbdff1c78cfe73640c7060a 100644 --- a/src/Mods/SecExp/potentialToDo.txt +++ b/src/Mods/SecExp/potentialToDo.txt @@ -10,7 +10,7 @@ Hexall90's last merged commit: 52dde0b3 - Does having a large standing army give any bonus to authority/reputation growth? - Fix broken immigration stuff (https://gitgud.io/pregmodfan/fc-pregmod/-/issues/2073 && https://gitgud.io/pregmodfan/fc-pregmod/-/merge_requests/7375) - My personal asst keeps getting the credit, even though I choose to personally lead my forces. (Has been this way for a fewish days): Military01.swf -- Enable oceanic battles + Fine, I'll Do It Myself Pirates? Enemy navies? - 328279 Pirates could raid trade routs and such ,even could capture a high class cruise liner and you have to move retake it with an army similar to the ground battles. you could have an event where you gain a old world port to ship your goods to, and you have to defend it . -328413 diff --git a/src/endWeek/endWeek.js b/src/endWeek/endWeek.js index 89bc0b634c66679a9743558b906fb4d098db6a14..b2aa078cb8a0498a6ad1fe08b27b7c5bf3f524b9 100644 --- a/src/endWeek/endWeek.js +++ b/src/endWeek/endWeek.js @@ -14,6 +14,9 @@ globalThis.endWeek = (function() { } setUseWeights(); saveWeekTotals(); + if (V.secExpEnabled > 0) { + V.SecExp.war = {foughtThisWeek: 0, type: ""}; + } // pass time for objects that need it weather(); diff --git a/src/endWeek/nextWeek/nextWeek.js b/src/endWeek/nextWeek/nextWeek.js index fe29fa942a6840f5e1ca0b0bb399aaac1bb0af8a..ea1410dd64c08a763b17ded6fd50c88c5547bee1 100644 --- a/src/endWeek/nextWeek/nextWeek.js +++ b/src/endWeek/nextWeek/nextWeek.js @@ -301,12 +301,11 @@ App.EndWeek.nextWeek = function() { V.eventQueue.shift(); if (V.secExpEnabled > 0) { - V.foughtThisWeek = 0; if (V.SecExp.buildings.riotCenter) { V.SecExp.buildings.riotCenter.sentUnitCooldown = Math.max(V.SecExp.buildings.riotCenter.sentUnitCooldown - 1, 0); } V.SecExp.proclamation.cooldown = Math.max(V.SecExp.proclamation.cooldown - 1, 0); - delete V.SecExp.war; + V.SecExp.war = {foughtThisWeek: 0, type: ""}; } App.EndWeek.weather(); diff --git a/src/events/nonRandomEvent.js b/src/events/nonRandomEvent.js index 030f53b00797033b40a7d39ad97772d2c7914ba9..9a03572d6c80eb1ef35ce88ad1e1932c67758a1f 100644 --- a/src/events/nonRandomEvent.js +++ b/src/events/nonRandomEvent.js @@ -14,7 +14,7 @@ App.Events.getNonrandomEvents = function() { ], "P rival initiation"), new App.Events.TwineEvent().wrapPassage([ () => V.secExpEnabled > 0, - () => V.foughtThisWeek === 0, + () => V.SecExp.war.foughtThisWeek === 0, () => (V.slaveRebellion === 1 || V.citizenRebellion === 1) ], "rebellionOptions"), new App.Events.attackOptions(), diff --git a/src/gui/options/options.js b/src/gui/options/options.js index c01f554a9ad0e6e7b26a903da870fdf129d606c2..61905049329b37bd722b44f159cccf2698a8538b 100644 --- a/src/gui/options/options.js +++ b/src/gui/options/options.js @@ -164,9 +164,6 @@ App.UI.optionsPassage = function() { if (V.secExpEnabled > 0) { App.UI.DOM.appendNewElement("h2", el, `Security Expansion mod options`); - if (V.terrain === "oceanic") { - App.UI.DOM.appendNewElement("div", el, `Oceanic arcologies are not by default subject to external attacks. You can however allow them to happen anyway. If you choose to do so please keep in mind that descriptions and mechanics are intended for land combat.`); - } options = new App.UI.OptionsGroup(); if (V.SecExp.settings.battle.enabled > 0 || V.SecExp.settings.rebellion.enabled > 0) { diff --git a/src/js/economyJS.js b/src/js/economyJS.js index ff5179fb5f18b6a169750f977d1d841d0bd7cc63..85e2b2de7de308a0efcfa839a2584220d13de456 100644 --- a/src/js/economyJS.js +++ b/src/js/economyJS.js @@ -251,7 +251,6 @@ globalThis.calculateCosts = (function() { getMasterSuiteCosts() + getNurseryCosts() + getFarmyardCosts() + - getSecurityExpansionCost() + getLifestyleCosts() + getFSCosts() + getCitizenOrphanageCosts() + @@ -270,6 +269,10 @@ globalThis.calculateCosts = (function() { predictTotalSlaveCosts() ); + if (V.secExpEnabled > 0) { + totalCosts += getSecurityExpansionCost(); + } + if (V.incubator.capacity > 0) { totalCosts += getIncubatorCosts(); } @@ -303,7 +306,6 @@ globalThis.calculateCosts = (function() { cashX(forceNeg(getMasterSuiteCosts()), "masterSuite"); cashX(forceNeg(getNurseryCosts()), "nursery"); cashX(forceNeg(getFarmyardCosts()), "farmyard"); - cashX(forceNeg(getSecurityExpansionCost()), "securityExpansion"); cashX(forceNeg(getLifestyleCosts()), "personalLivingExpenses"); cashX(forceNeg(getFSCosts()), "futureSocieties"); cashX(forceNeg(getCitizenOrphanageCosts()), "citizenOrphanage"); @@ -321,6 +323,10 @@ globalThis.calculateCosts = (function() { cashX(forceNeg(getPCCosts()), "PCmedical"); getTotalSlaveCosts(); + if (V.secExpEnabled > 0) { + cashX(forceNeg(getSecurityExpansionCost()), "securityExpansion"); + } + if (V.incubator.capacity > 0) { cashX(forceNeg(getIncubatorCosts()), "incubator"); cashX(forceNeg(getIncubatorSlavesCosts()), "incubatorSlaves"); @@ -629,28 +635,25 @@ globalThis.calculateCosts = (function() { ); } - // security expansion function getSecurityExpansionCost() { let secExpCost = 0; - if (V.secExpEnabled > 0) { - const unitModifier = function(x) { - if (x === 'slaves') { - return 0.5; - } else if (x === 'mercs') { - return 1.5; - } - return 1; - }; + const soldierMod = 1 + V.SecExp.edicts.defense.soldierWages * 0.5; // 1.0, 1.5, 2.0 + const unitModifier = function(x) { + if (x === 'slaves') { + return 0.5; + } else if (x === 'mercs') { + return 1.5; + } + return 1; + }; - secExpCost += App.SecExp.upkeep.edictsCash(); - secExpCost += App.SecExp.upkeep.SF(); - secExpCost += App.SecExp.upkeep.buildings(); - const soldierMod = 1 + V.SecExp.edicts.defense.soldierWages * 0.5; // 1.0, 1.5, 2.0 + secExpCost += App.SecExp.upkeep.edictsCash(); + secExpCost += App.SecExp.upkeep.SF(); + secExpCost += App.SecExp.upkeep.buildings(); - for (const unit of App.SecExp.unit.list().slice(1)) { - for (const squad of V.SecExp.units[unit].squads) { - secExpCost += squad.troops * 10 * unitModifier(unit) * soldierMod; - } + for (const unit of App.SecExp.unit.list().slice(1)) { + for (const squad of V.SecExp.units[unit].squads) { + secExpCost += squad.troops * 10 * unitModifier(unit) * soldierMod; } } return secExpCost;