diff --git a/js/003-data/gameVariableData.js b/js/003-data/gameVariableData.js index 8d4b01837a85c33f2096f891012c5fb8d484dbd3..ade55171dd80cbaa96a6ba98e68f3115dd19d01c 100644 --- a/js/003-data/gameVariableData.js +++ b/js/003-data/gameVariableData.js @@ -374,12 +374,8 @@ App.Data.resetOnNGPlus = { foughtThisWeek: 0, /* rebellions */ - slaveRebellionEventFires: 0, - citizenRebellionEventFires: 0, slaveRebellion: 0, citizenRebellion: 0, - engageRule: 0, - irregulars: 0, repairTime: 3, arcRepairTime: 0, garrison: {}, @@ -393,26 +389,8 @@ App.Data.resetOnNGPlus = { createdMilitiaUnits: 0, createdMercUnits: 0, /* battle relevant vars */ - attackType: "none", attackThisWeek: 0, majorBattle: 0, - chosenTactic: "none", - leadingTroops: "none", - attackTroops: 0, - attackEquip: 0, - battleTerrain: "none", - maxTurns: 10, - battleResult: 4, // sets battleResult value outside accepted range (-3,3) to avoid evaluation problems - losses: 0, - enemyLosses: 0, - battleTurns: 0, - tacticsSuccessful: 0, - leaderWounded: 0, - gainedCombat: 0, - gainedWarfare: 0, - SFIntervention: 0, - rebellingID: [], - saveValid: 0, /* units */ /** @type {FC.SecExp.PlayerUnitData} */ secBots: {}, diff --git a/src/Mods/SecExp/attackGenerator.tw b/src/Mods/SecExp/attackGenerator.tw deleted file mode 100644 index 980c5d5748079c38d196099ab9af742ef394f712..0000000000000000000000000000000000000000 --- a/src/Mods/SecExp/attackGenerator.tw +++ /dev/null @@ -1,176 +0,0 @@ -:: attackGenerator [nobr] - -/* _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 $terrain == "oceanic" || $arcologyUpgrade.drones != 1 || $SecExp.battles.lastEncounterWeeks <= 3 || $citizenRebellion == 1 || $slaveRebellion == 1 || $SecExp.rebellions.lastEncounterWeeks <= 3>> - <<set _attackChance = 0>> -<<else>> - <<if $week < 30>> - <<set _attackChance = 5>> - <<elseif $week < 60>> - <<set _attackChance = 8>> - <<elseif $week < 90>> - <<set _attackChance = 12>> - <<elseif $week < 120>> - <<set _attackChance = 16>> - <<else>> - <<set _attackChance = 20>> - <</if>> - <<if $SecExp.battles.victories + $SecExp.battles.losses > 0>> - <<set _attackChance = 25>> - <</if>> - <<if $SecExp.battles.lastEncounterWeeks >= 10>> - <<set _attackChance += 5>> - <</if>> -<</if>> -/* battle frequency */ -<<set _attackChance *= $SecExp.settings.battle.frequency>> - -<<if $SecExp.settings.battle.force == 1 && $SecExp.settings.rebellion.force != 1 && $foughtThisWeek == 0>> - <<set _attackChance = 100>> -<</if>> - -/* Rolls to see if attack happens this week */ -/* raiders are attracted by low security */ -/* the old world by "degenerate" future societies */ -/* free Cities by high prosperity */ -/* freedom fighters by high slave/citizen ratio */ -<<if random(1,100) <= _attackChance>> - <<set $attackThisWeek = 1>> - <<set $SecExp.battles.lastEncounterWeeks = 0>> - <<set $leadingTroops = "assistant">> - <<set $chosenTactic = either("Bait and Bleed", "Blitzkrieg", "Choke Points", "Defense In Depth", "Guerrilla", "Human Wave", "Interior Lines", "Pincer Maneuver")>> - /* _type is the chance out of 100 of an attack of that type happening */ - <<set _raider = 25>> - <<set _oldWorld = 25>> - <<set _freeCity = 25>> - <<set _free = 25>> - /* old world */ - <<if $arcologies[0].FSRomanRevivalist != "unset" || $arcologies[0].FSEdoRevivalist != "unset" || $arcologies[0].FSArabianRevivalist != "unset" || $arcologies[0].FSChineseRevivalist != "unset" || $arcologies[0].FSEgyptianRevivalist != "unset" || $arcologies[0].FSAztecRevivalist != "unset" || $arcologies[0].FSRepopulationFocus != "unset" || $arcologies[0].FSGenderRadicalist != "unset" || $arcologies[0].FSPastoralist != "unset" || $arcologies[0].FSChattelReligionist != "unset" || $arcologies[0].FSNeoImperialist != "unset">> - <<set _oldWorld += 15>> - <<set _raider -= 5>> - <<set _freeCity -= 5>> - <<set _free -= 5>> - <<elseif ($arcologies[0].FSRomanRevivalist != "unset" || $arcologies[0].FSEdoRevivalist != "unset" || $arcologies[0].FSArabianRevivalist != "unset" || $arcologies[0].FSChineseRevivalist != "unset" || $arcologies[0].FSEgyptianRevivalist != "unset" || $arcologies[0].FSAztecRevivalist != "unset") && ($arcologies[0].FSRepopulationFocus != "unset" || $arcologies[0].FSGenderRadicalist != "unset" || $arcologies[0].FSPastoralist != "unset" || $arcologies[0].FSChattelReligionist != "unset" || $arcologies[0].FSNeoImperialist != "unset")>> - <<set _oldWorld += 24>> - <<set _raider -= 8>> - <<set _freeCity -= 8>> - <<set _free -= 8>> - <</if>> - /* freedom fighter */ - <<if $ASlaves > $ACitizens * 2>> - <<set _oldWorld -= 8>> - <<set _raider -= 8>> - <<set _freeCity -= 8>> - <<set _free += 24>> - <<elseif $ASlaves > $ACitizens * 1.2 || $arcologies[0].FSDegradationist != "unset">> - <<set _oldWorld -= 5>> - <<set _raider -= 5>> - <<set _freeCity -= 5>> - <<set _free += 15>> - <</if>> - /* Free Cities */ - <<if $arcologies[0].prosperity >= 10 && $arcologies[0].prosperity < 20>> - <<set _oldWorld -= 5>> - <<set _raider -= 5>> - <<set _freeCity += 15>> - <<set _free -= 5>> - <<elseif $arcologies[0].prosperity >= 20>> - <<set _oldWorld -= 8>> - <<set _raider -= 8>> - <<set _freeCity += 24>> - <<set _free -= 8>> - <</if>> - /* raiders */ - <<if $SecExp.core.security <= 50>> - <<set _oldWorld -= 5>> - <<set _raider += 15>> - <<set _freeCity -= 5>> - <<set _free -= 5>> - <<elseif $SecExp.core.security <= 25>> - <<set _oldWorld -= 8>> - <<set _raider += 24>> - <<set _freeCity -= 8>> - <<set _free -= 8>> - <</if>> - - /* makes the actual roll */ - <<set _roll = random(1,100)>> - <<if _roll <= _raider>> - <<set $attackType = "raiders">> - <<elseif _roll <= _raider + _oldWorld>> - <<set $attackType = "old world">> - <<elseif _roll <= _raider + _oldWorld + _freeCity>> - <<set $attackType = "free city">> - <<elseif _roll <= _raider + _oldWorld + _freeCity + _free>> - <<set $attackType = "freedom fighters">> - <</if>> -<<else>> - <<set $SecExp.battles.lastEncounterWeeks++>> -<</if>> - -/* if an attack happens */ -<<if $attackThisWeek == 1>> - - /* terrain */ - <<if $terrain == "urban">> - <<set $battleTerrain = either("outskirts", "urban", "wasteland")>> - <<elseif $terrain == "rural">> - <<set $battleTerrain = either("hills", "outskirts", "rural", "wasteland")>> - <<elseif $terrain == "ravine">> - <<set $battleTerrain = either("hills", "mountains", "outskirts", "wasteland")>> - <<elseif $terrain == "marine">> - <<set $battleTerrain = either("coast", "hills", "outskirts", "wasteland")>> - <<elseif $terrain == "oceanic">> - <<set $battleTerrain = either("coast", "hills", "outskirts", "wasteland")>> - <<else>> - <<set $battleTerrain = "error">> - <</if>> - - <<set _L=0>> - <<if $attackType == "raiders">> - <<set $attackTroops = random(40,80),_L=1>> - <<elseif $attackType == "free city">> - <<set $attackTroops = random(20,40)>> - <<elseif $attackType == "old world">> - <<set $attackTroops = random(25,50)>> - <<elseif $attackType == "freedom fighters">> - <<set $attackTroops = random(30,60)>> - <</if>> - <<if $week < 30>> - /*<<set $attackTroops *= Math.trunc(random( (1*(1.01+($week/100))), (2*(1.01+($week/100))) ))>>*/ <<set $attackTroops *= random(1,2)>> - <<elseif $week < 60>> - /*<<set $attackTroops *= Math.trunc(random( (1*(1.01+($week/200))), (3*(1.01+($week/200))) ))>>*/ <<set $attackTroops *= random(1,3)>> - <<elseif $week < 90>> - /*<<set $attackTroops *= Math.trunc(random( (2*(1.01+($week/300))), (3*(1.01+($week/300))) ))>>*/ <<set $attackTroops *= random(2,3)>> - <<elseif $week < 120>> - /*<<set $attackTroops *= Math.trunc(random( (2*(1.01+($week/400))), (4*(1.01+($week/400))) ))>>*/ <<set $attackTroops *= random(2,4)>> - <<else>> - <<set $attackTroops *= random(3,5)>> - <</if>> - <<if $week < 60>> - <<set $attackEquip = random(0,1)>> - <<elseif $week < 90>> - <<set $attackEquip = random(0,3-_L)>> /*"raiders" <<set $attackEquip = random(0,2)>>*/ - <<elseif $week < 120>> - <<set $attackEquip = random(1-_L,3)>> /*"raiders" <<set $attackEquip = random(0,3)>>*/ - <<else>> - <<set $attackEquip = random(2-_L,4-_L)>> /*"raiders" <<set $attackEquip = random(1,3)>>*/ - <</if>> - - /* major battles have a 50% chance of firing after week 120 */ - <<if $SecExp.settings.battle.major.enabled == 1>> - <<if ($week >= 120 && $attackType != "none") || ($SecExp.settings.battle.major.force == 1 && $foughtThisWeek == 0)>> - <<if random(1,100) >= 50 || $SecExp.settings.battle.major.force == 1>> - <<set $majorBattle = 1>> - <<if $SF.Toggle && $SF.Active >= 1>> - <<set $attackTroops = Math.trunc($attackTroops * random(4,6) * $SecExp.settings.battle.major.mult)>> - <<set $attackEquip = either(3,4)>> - <<else>> - <<set $attackTroops = Math.trunc($attackTroops * random(2,3) * $SecExp.settings.battle.major.mult)>> - <<set $attackEquip = either(2,3,4)>> - <</if>> - <</if>> - <</if>> - <</if>> -<</if>> \ No newline at end of file diff --git a/src/Mods/SecExp/attackHandler.tw b/src/Mods/SecExp/attackHandler.tw index 9219ddbf2b6da965264c9f004e27c8ac6151f278..7c3f87ef87085e22cf736511974f4292bbe92aed 100644 --- a/src/Mods/SecExp/attackHandler.tw +++ b/src/Mods/SecExp/attackHandler.tw @@ -2,20 +2,20 @@ <<set $nextButton = " ", $nextLink = "attackReport", $encyclopedia = "Battles">> -<<if $battleResult == 1 || $battleResult == -1>> /* bribery/surrender check */ +<<if $SecExp.war.result == 1 || $SecExp.war.result == -1>> /* bribery/surrender check */ <<if $SecExp.settings.showStats == 1>> - <<if $battleResult == 1>>Bribery<<else>>Surrender<</if>> chosen + <<if $SecExp.war.result == 1>>Bribery<<else>>Surrender<</if>> chosen <</if>> - <<if $battleResult == 1>> + <<if $SecExp.war.result == 1>> <<if $cash >= App.SecExp.battle.bribeCost()>> /* if there's enough cash there's a 10% chance bribery fails. If there isn't there's instead a 50% chance it fails */ - <<if $attackType == "freedom fighters" && random(1,100) <= 50 || random(1,100) <= 10>> - <<set $battleResult = 0>> + <<if $SecExp.war.attacker.type == "freedom fighters" && random(1,100) <= 50 || random(1,100) <= 10>> + <<set $SecExp.war.result = 0>> <</if>> <<else>> - <<if random(1,100) <= 50>> <<set $battleResult = 0>> <</if>> + <<if random(1,100) <= 50>> <<set $SecExp.war.result = 0>> <</if>> <</if>> <<if $SecExp.settings.showStats == 1>> - <br>Bribery <<if $battleResult == 0>>failed<<else>>Successful<</if>>! + <br>Bribery <<if $SecExp.war.result == 0>>failed<<else>>Successful<</if>>! <br><br>[[proceed|attackReport]] <<else>> <<goto "attackReport">> @@ -25,9 +25,7 @@ <</if>> <<else>> /*Init*/ - <<if $majorBattle == 0>> - <<set _turns = $maxTurns>> - <</if>> + <<set _turns = 10>> <<set _attack = 0>> <<set _defense = 0>> <<set _morale = 0>> @@ -56,7 +54,7 @@ <<set _mercMod = 1.5>> <<set _enemyMod = 1.5>> <<set _SFMod = 1.5>> - <<set _turns = $maxTurns * 2>> + <<set _turns *= 2>> <<if $SF.Toggle && $SF.Active >= 1>> <<if $SF.Squad.Firebase >= 7>> <<set _atkMod += ($SF.Squad.Firebase - 6) * 0.05>> @@ -77,7 +75,7 @@ <</if>> /* Leaders */ - <<if $leadingTroops == "PC">> + <<if $SecExp.war.commander == "PC">> <<if $SecExp.core.authority <= 2500 && $SecExp.core.authority > 1000>> <<set _slaveMod -= 0.10>> <<elseif $SecExp.core.authority <= 1000>> @@ -133,7 +131,7 @@ <</if>> /* 80% chance of increasing warfare */ <<if $PC.skill.warfare < 100 && random(1,100) <= 80>> - <<set $gainedWarfare = 1>> + <<set $SecExp.war.gainedWarfare = 1>> <<= IncreasePCSkills('warfare', 10)>> <<set $PC.skill.warfare = Math.clamp($PC.skill.warfare,-100,100)>> <</if>> @@ -165,7 +163,7 @@ <<set _woundChance += 1>> <</if>> <<if random(1,100) <= _woundChance>> - <<set $leaderWounded = 1>> + <<set $SecExp.war.leaderWounded = 1>> <<set _militiaMod -= 0.2>> <<set _slaveMod -= 0.2>> <<set _mercMod -= 0.2>> @@ -173,7 +171,7 @@ <<set _enemyMod += 0.2>> <<run healthDamage($PC, 60)>> <</if>> - <<elseif $leadingTroops == "assistant">> + <<elseif $SecExp.war.commander == "assistant">> <<if $rep < 10000 && $SecExp.core.authority < 10000>> <<set _militiaMod -= 0.15>> <<set _slaveMod -= 0.15>> @@ -193,7 +191,7 @@ <<set _defMod += 0.15>> <<set _tacChance += 0.30>> <</if>> - <<elseif $leadingTroops == "bodyguard">> + <<elseif $SecExp.war.commander == "bodyguard">> <<if _S.Bodyguard.devotion < -20>> <<set _slaveMod -= 0.15>> <<elseif _S.Bodyguard.devotion > 50>> @@ -290,7 +288,7 @@ <<set _woundChance += 1>> <</if>> <<if random(1,100) <= _woundChance>> - <<set $leaderWounded = 1>> + <<set $SecExp.war.leaderWounded = 1>> <<set _militiaMod -= 0.2>> <<set _slaveMod -= 0.2>> <<set _mercMod -= 0.2>> @@ -299,10 +297,10 @@ <</if>> /* 60% chance of getting combat skill if not already have it */ <<if _S.Bodyguard.skill.combat == 0 && random(1,100) <= 60>> - <<set $gainedCombat = 1>> + <<set $SecExp.war.gainedCombat = 1>> <<set _S.Bodyguard.skill.combat = 1>> <</if>> - <<elseif $leadingTroops == "headGirl">> + <<elseif $SecExp.war.commander == "headGirl">> <<if _S.HeadGirl.devotion < -20>> <<set _slaveMod -= 0.15>> <<elseif _S.HeadGirl.devotion > 51>> @@ -397,7 +395,7 @@ <<set _woundChance += 1>> <</if>> <<if random(1,100) <= _woundChance>> - <<set $leaderWounded = 1>> + <<set $SecExp.war.leaderWounded = 1>> <<set _militiaMod -= 0.2>> <<set _slaveMod -= 0.2>> <<set _mercMod -= 0.2>> @@ -406,10 +404,10 @@ <</if>> /* 60% chance of getting combat skill if not already have it */ <<if _S.HeadGirl.skill.combat == 0 && random(1,100) <= 60>> - <<set $gainedCombat = 1>> + <<set $SecExp.war.gainedCombat = 1>> <<set _S.HeadGirl.skill.combat = 1>> <</if>> - <<elseif $leadingTroops == "citizen">> + <<elseif $SecExp.war.commander == "citizen">> <<if $arcologies[0].FSDegradationist == "unset" && $arcologies[0].FSPaternalist == "unset">> <<set _militiaMod += 0.15>> <<set _slaveMod -= 0.15>> @@ -430,7 +428,7 @@ <<set _atkMod += either(-1,1) * random(10) * 0.1>> <<set _defMod += either(-1,1) * random(10) * 0.1>> <<set _tacChance += either(-1,1) * random(20) * 0.1>> - <<elseif $leadingTroops == "mercenary">> + <<elseif $SecExp.war.commander == "mercenary">> <<set _mercMod += 0.10>> <<set _SFMod += 0.10>> <<if $arcologies[0].FSRomanRevivalist != "unset" || $arcologies[0].FSNeoImperialist != "unset">> @@ -444,7 +442,7 @@ <<set _atkMod += random(15) * 0.1>> <<set _defMod += random(15) * 0.1>> <<set _tacChance += random(30) * 0.1>> - <<elseif $leadingTroops == "colonel">> + <<elseif $SecExp.war.commander == "colonel">> <<set _mercMod += 0.10>> <<set _SFMod += 0.15>> <<if $arcologies[0].FSRomanRevivalist != "unset" || $arcologies[0].FSNeoImperialist != "unset">> @@ -460,322 +458,322 @@ <<set _tacChance += random(40) * 0.1>> <</if>> /* Terrain and Tactics */ - <<if $battleTerrain == "urban">> - <<if $chosenTactic == "Bait and Bleed">> + <<if $SecExp.war.terrain == "urban">> + <<if $SecExp.war.chosenTactic == "Bait and Bleed">> <<set _atkMod += 0.15>> <<set _defMod += 0.10>> <<set _tacChance += 0.25>> - <<elseif $chosenTactic == "Guerrilla">> + <<elseif $SecExp.war.chosenTactic == "Guerrilla">> <<set _atkMod += 0.10>> <<set _defMod += 0.15>> <<set _tacChance += 0.25>> - <<elseif $chosenTactic == "Choke Points">> + <<elseif $SecExp.war.chosenTactic == "Choke Points">> <<set _atkMod += 0.10>> <<set _defMod += 0.15>> <<set _tacChance += 0.25>> - <<elseif $chosenTactic == "Interior Lines">> + <<elseif $SecExp.war.chosenTactic == "Interior Lines">> <<set _atkMod += 0.05>> <<set _defMod += 0.10>> <<set _tacChance += 0.15>> - <<elseif $chosenTactic == "Pincer Maneuver">> + <<elseif $SecExp.war.chosenTactic == "Pincer Maneuver">> <<set _atkMod -= 0.05>> <<set _defMod -= 0.10>> <<set _tacChance -= 0.15>> - <<elseif $chosenTactic == "Defense In Depth">> + <<elseif $SecExp.war.chosenTactic == "Defense In Depth">> <<set _atkMod -= 0.05>> <<set _defMod -= 0.05>> <<set _tacChance -= 0.10>> - <<elseif $chosenTactic == "Blitzkrieg">> + <<elseif $SecExp.war.chosenTactic == "Blitzkrieg">> <<set _atkMod -= 0.15>> <<set _defMod -= 0.10>> <<set _tacChance -= 0.25>> - <<elseif $chosenTactic == "Human Wave">> + <<elseif $SecExp.war.chosenTactic == "Human Wave">> <<set _atkMod -= 0.15>> <<set _defMod -= 0.15>> <<set _tacChance -= 0.30>> <</if>> - <<elseif $battleTerrain == "rural">> - <<if $chosenTactic == "Bait and Bleed">> + <<elseif $SecExp.war.terrain == "rural">> + <<if $SecExp.war.chosenTactic == "Bait and Bleed">> <<set _atkMod -= 0.05>> <<set _defMod -= 0.10>> <<set _tacChance -= 0.15>> - <<elseif $chosenTactic == "Guerrilla">> + <<elseif $SecExp.war.chosenTactic == "Guerrilla">> <<set _atkMod -= 0.10>> <<set _defMod -= 0.10>> <<set _tacChance -= 0.20>> - <<elseif $chosenTactic == "Choke Points">> + <<elseif $SecExp.war.chosenTactic == "Choke Points">> <<set _atkMod -= 0.10>> <<set _defMod -= 0.15>> <<set _tacChance -= 0.25>> - <<elseif $chosenTactic == "Interior Lines">> + <<elseif $SecExp.war.chosenTactic == "Interior Lines">> <<set _atkMod += 0.10>> <<set _defMod += 0.15>> <<set _tacChance += 0.25>> - <<elseif $chosenTactic == "Pincer Maneuver">> + <<elseif $SecExp.war.chosenTactic == "Pincer Maneuver">> <<set _atkMod += 0.15>> <<set _defMod += 0.10>> <<set _tacChance += 0.25>> - <<elseif $chosenTactic == "Defense In Depth">> + <<elseif $SecExp.war.chosenTactic == "Defense In Depth">> <<set _atkMod += 0.15>> <<set _defMod += 0.15>> <<set _tacChance += 0.30>> - <<elseif $chosenTactic == "Blitzkrieg">> + <<elseif $SecExp.war.chosenTactic == "Blitzkrieg">> <<set _atkMod += 0.15>> <<set _defMod += 0.10>> <<set _tacChance += 0.25>> - <<elseif $chosenTactic == "Human Wave">> + <<elseif $SecExp.war.chosenTactic == "Human Wave">> <<set _atkMod += 0.20>> <<set _defMod += 0.05>> <<set _tacChance += 0.25>> <</if>> - <<elseif $battleTerrain == "hills">> - <<if $chosenTactic == "Bait and Bleed">> + <<elseif $SecExp.war.terrain == "hills">> + <<if $SecExp.war.chosenTactic == "Bait and Bleed">> <<set _atkMod += 0.05>> <<set _defMod += 0.05>> <<set _tacChance += 0.10>> - <<elseif $chosenTactic == "Guerrilla">> + <<elseif $SecExp.war.chosenTactic == "Guerrilla">> <<set _atkMod += 0.05>> <<set _defMod += 0.10>> <<set _tacChance += 0.15>> - <<elseif $chosenTactic == "Choke Points">> + <<elseif $SecExp.war.chosenTactic == "Choke Points">> <<set _atkMod += 0.10>> <<set _defMod += 0.10>> <<set _tacChance += 0.20>> - <<elseif $chosenTactic == "Interior Lines">> + <<elseif $SecExp.war.chosenTactic == "Interior Lines">> <<set _atkMod -= 0.05>> <<set _defMod -= 0.05>> <<set _tacChance -= 0.10>> - <<elseif $chosenTactic == "Pincer Maneuver">> + <<elseif $SecExp.war.chosenTactic == "Pincer Maneuver">> <<set _atkMod += 0.10>> <<set _defMod += 0.05>> <<set _tacChance += 0.15>> - <<elseif $chosenTactic == "Defense In Depth">> + <<elseif $SecExp.war.chosenTactic == "Defense In Depth">> <<set _atkMod -= 0.10>> <<set _defMod -= 0.05>> <<set _tacChance -= 0.15>> - <<elseif $chosenTactic == "Blitzkrieg">> + <<elseif $SecExp.war.chosenTactic == "Blitzkrieg">> <<set _atkMod -= 0.10>> <<set _defMod -= 0.15>> <<set _tacChance += 0.25>> - <<elseif $chosenTactic == "Human Wave">> + <<elseif $SecExp.war.chosenTactic == "Human Wave">> <<set _atkMod -= 0.15>> <<set _defMod -= 0.15>> <<set _tacChance -= 0.30>> <</if>> - <<elseif $battleTerrain == "coast">> - <<if $chosenTactic == "Bait and Bleed">> + <<elseif $SecExp.war.terrain == "coast">> + <<if $SecExp.war.chosenTactic == "Bait and Bleed">> <<set _atkMod -= 0.05>> <<set _defMod -= 0.05>> <<set _tacChance -= 0.10>> - <<elseif $chosenTactic == "Guerrilla">> + <<elseif $SecExp.war.chosenTactic == "Guerrilla">> <<set _atkMod += 0.05>> <<set _defMod += 0.05>> <<set _tacChance += 0.10>> - <<elseif $chosenTactic == "Choke Points">> + <<elseif $SecExp.war.chosenTactic == "Choke Points">> <<set _atkMod += 0.05>> <<set _defMod += 0.15>> <<set _tacChance += 0.15>> - <<elseif $chosenTactic == "Interior Lines">> + <<elseif $SecExp.war.chosenTactic == "Interior Lines">> <<set _atkMod += 0.10>> <<set _defMod += 0.10>> <<set _tacChance += 0.20>> - <<elseif $chosenTactic == "Pincer Maneuver">> + <<elseif $SecExp.war.chosenTactic == "Pincer Maneuver">> <<set _atkMod -= 0.10>> <<set _defMod -= 0.10>> <<set _tacChance -= 0.20>> - <<elseif $chosenTactic == "Defense In Depth">> + <<elseif $SecExp.war.chosenTactic == "Defense In Depth">> <<set _atkMod += 0.10>> <<set _defMod += 0.10>> <<set _tacChance += 0.20>> - <<elseif $chosenTactic == "Blitzkrieg">> + <<elseif $SecExp.war.chosenTactic == "Blitzkrieg">> <<set _atkMod -= 0.05>> <<set _defMod -= 0.05>> <<set _tacChance -= 0.10>> - <<elseif $chosenTactic == "Human Wave">> + <<elseif $SecExp.war.chosenTactic == "Human Wave">> <<set _atkMod += 0.05>> <<set _defMod -= 0.05>> <</if>> - <<elseif $battleTerrain == "outskirts">> - <<if $chosenTactic == "Bait and Bleed">> + <<elseif $SecExp.war.terrain == "outskirts">> + <<if $SecExp.war.chosenTactic == "Bait and Bleed">> <<set _atkMod -= 0.10>> <<set _defMod -= 0.15>> <<set _tacChance -= 0.25>> - <<elseif $chosenTactic == "Guerrilla">> + <<elseif $SecExp.war.chosenTactic == "Guerrilla">> <<set _atkMod -= 0.10>> <<set _defMod -= 0.05>> <<set _tacChance -= 0.15>> - <<elseif $chosenTactic == "Choke Points">> + <<elseif $SecExp.war.chosenTactic == "Choke Points">> <<set _atkMod += 0.10>> <<set _defMod += 0.15>> <<set _tacChance += 0.25>> - <<elseif $chosenTactic == "Interior Lines">> + <<elseif $SecExp.war.chosenTactic == "Interior Lines">> <<set _atkMod += 0.15>> <<set _defMod += 0.10>> <<set _tacChance += 0.25>> - <<elseif $chosenTactic == "Pincer Maneuver">> + <<elseif $SecExp.war.chosenTactic == "Pincer Maneuver">> <<set _atkMod += 0.05>> <<set _defMod += 0.10>> <<set _tacChance += 0.15>> - <<elseif $chosenTactic == "Defense In Depth">> + <<elseif $SecExp.war.chosenTactic == "Defense In Depth">> <<set _atkMod += 0.10>> <<set _defMod += 0.15>> <<set _tacChance += 0.25>> - <<elseif $chosenTactic == "Blitzkrieg">> + <<elseif $SecExp.war.chosenTactic == "Blitzkrieg">> <<set _atkMod += 0.10>> <<set _defMod -= 0.05>> <<set _tacChance += 0.05>> - <<elseif $chosenTactic == "Human Wave">> + <<elseif $SecExp.war.chosenTactic == "Human Wave">> <<set _atkMod += 0.10>> <<set _defMod -= 0.10>> <</if>> - <<elseif $battleTerrain == "mountains">> - <<if $chosenTactic == "Bait and Bleed">> + <<elseif $SecExp.war.terrain == "mountains">> + <<if $SecExp.war.chosenTactic == "Bait and Bleed">> <<set _atkMod += 0.10>> <<set _defMod += 0.15>> <<set _tacChance += 0.25>> - <<elseif $chosenTactic == "Guerrilla">> + <<elseif $SecExp.war.chosenTactic == "Guerrilla">> <<set _atkMod += 0.10>> <<set _defMod += 0.15>> <<set _tacChance += 0.25>> - <<elseif $chosenTactic == "Choke Points">> + <<elseif $SecExp.war.chosenTactic == "Choke Points">> <<set _atkMod += 0.05>> <<set _defMod += 0.20>> <<set _tacChance += 0.25>> - <<elseif $chosenTactic == "Interior Lines">> + <<elseif $SecExp.war.chosenTactic == "Interior Lines">> <<set _atkMod += 0.10>> <<set _defMod += 0.10>> <<set _tacChance += 0.20>> - <<elseif $chosenTactic == "Pincer Maneuver">> + <<elseif $SecExp.war.chosenTactic == "Pincer Maneuver">> <<set _atkMod += 0.10>> <<set _defMod -= 0.05>> <<set _tacChance += 0.05>> - <<elseif $chosenTactic == "Defense In Depth">> + <<elseif $SecExp.war.chosenTactic == "Defense In Depth">> <<set _atkMod += 0.10>> <<set _defMod += 0.10>> <<set _tacChance += 0.20>> - <<elseif $chosenTactic == "Blitzkrieg">> + <<elseif $SecExp.war.chosenTactic == "Blitzkrieg">> <<set _atkMod -= 0.10>> <<set _defMod -= 0.10>> <<set _tacChance -= 0.20>> - <<elseif $chosenTactic == "Human Wave">> + <<elseif $SecExp.war.chosenTactic == "Human Wave">> <<set _atkMod -= 0.10>> <<set _defMod -= 0.10>> <<set _tacChance -= 0.20>> <</if>> - <<elseif $battleTerrain == "wasteland">> - <<if $chosenTactic == "Bait and Bleed">> + <<elseif $SecExp.war.terrain == "wasteland">> + <<if $SecExp.war.chosenTactic == "Bait and Bleed">> <<set _atkMod += 0.05>> <<set _defMod += 0.05>> <<set _tacChance += 0.10>> - <<elseif $chosenTactic == "Guerrilla">> + <<elseif $SecExp.war.chosenTactic == "Guerrilla">> <<set _atkMod += 0.10>> <<set _defMod += 0.05>> <<set _tacChance += 0.15>> - <<elseif $chosenTactic == "Choke Points">> + <<elseif $SecExp.war.chosenTactic == "Choke Points">> <<set _atkMod -= 0.10>> <<set _defMod += 0.05>> <<set _tacChance -= 0.05>> - <<elseif $chosenTactic == "Interior Lines">> + <<elseif $SecExp.war.chosenTactic == "Interior Lines">> <<set _atkMod += 0.10>> <<set _defMod += 0.15>> <<set _tacChance += 0.25>> - <<elseif $chosenTactic == "Pincer Maneuver">> + <<elseif $SecExp.war.chosenTactic == "Pincer Maneuver">> <<set _atkMod += 0.15>> <<set _defMod += 0.10>> <<set _tacChance += 0.25>> - <<elseif $chosenTactic == "Defense In Depth">> + <<elseif $SecExp.war.chosenTactic == "Defense In Depth">> <<set _atkMod += 0.05>> <<set _defMod += 0.10>> <<set _tacChance += 0.15>> - <<elseif $chosenTactic == "Blitzkrieg">> + <<elseif $SecExp.war.chosenTactic == "Blitzkrieg">> <<set _atkMod += 0.15>> <<set _defMod += 0.15>> <<set _tacChance += 0.30>> - <<elseif $chosenTactic == "Human Wave">> + <<elseif $SecExp.war.chosenTactic == "Human Wave">> <<set _atkMod += 0.20>> <<set _defMod += 0.05>> <<set _tacChance += 0.25>> <</if>> <</if>> - <<if $chosenTactic == "Bait and Bleed">> - <<if $attackType == "raiders">> + <<if $SecExp.war.chosenTactic == "Bait and Bleed">> + <<if $SecExp.war.attacker.type == "raiders">> <<set _tacChance -= 0.10>> - <<elseif $attackType == "free city">> + <<elseif $SecExp.war.attacker.type == "free city">> <<set _tacChance += 0.10>> - <<elseif $attackType == "old world">> + <<elseif $SecExp.war.attacker.type == "old world">> <<set _tacChance += 0.25>> - <<elseif $attackType == "freedom fighters">> + <<elseif $SecExp.war.attacker.type == "freedom fighters">> <<set _tacChance -= 0.15>> <</if>> - <<elseif $chosenTactic == "Guerrilla">> - <<if $attackType == "raiders">> + <<elseif $SecExp.war.chosenTactic == "Guerrilla">> + <<if $SecExp.war.attacker.type == "raiders">> <<set _tacChance -= 0.20>> - <<elseif $attackType == "free city">> + <<elseif $SecExp.war.attacker.type == "free city">> <<set _tacChance += 0.15>> - <<elseif $attackType == "old world">> + <<elseif $SecExp.war.attacker.type == "old world">> <<set _tacChance += 0.25>> - <<elseif $attackType == "freedom fighters">> + <<elseif $SecExp.war.attacker.type == "freedom fighters">> <<set _tacChance -= 0.25>> <</if>> - <<elseif $chosenTactic == "Choke Points">> - <<if $attackType == "raiders">> + <<elseif $SecExp.war.chosenTactic == "Choke Points">> + <<if $SecExp.war.attacker.type == "raiders">> <<set _tacChance += 0.25>> - <<elseif $attackType == "free city">> + <<elseif $SecExp.war.attacker.type == "free city">> <<set _tacChance -= 0.05>> - <<elseif $attackType == "old world">> + <<elseif $SecExp.war.attacker.type == "old world">> <<set _tacChance -= 0.10>> - <<elseif $attackType == "freedom fighters">> + <<elseif $SecExp.war.attacker.type == "freedom fighters">> <<set _tacChance += 0.05>> <</if>> - <<elseif $chosenTactic == "Interior Lines">> - <<if $attackType == "raiders">> + <<elseif $SecExp.war.chosenTactic == "Interior Lines">> + <<if $SecExp.war.attacker.type == "raiders">> <<set _tacChance -= 0.15>> - <<elseif $attackType == "free city">> + <<elseif $SecExp.war.attacker.type == "free city">> <<set _tacChance += 0.15>> - <<elseif $attackType == "old world">> + <<elseif $SecExp.war.attacker.type == "old world">> <<set _tacChance += 0.20>> - <<elseif $attackType == "freedom fighters">> + <<elseif $SecExp.war.attacker.type == "freedom fighters">> <<set _tacChance -= 0.10>> <</if>> - <<elseif $chosenTactic == "Pincer Maneuver">> - <<if $attackType == "raiders">> + <<elseif $SecExp.war.chosenTactic == "Pincer Maneuver">> + <<if $SecExp.war.attacker.type == "raiders">> <<set _tacChance += 0.15>> - <<elseif $attackType == "free city">> + <<elseif $SecExp.war.attacker.type == "free city">> <<set _tacChance += 0.10>> - <<elseif $attackType == "old world">> + <<elseif $SecExp.war.attacker.type == "old world">> <<set _tacChance -= 0.10>> - <<elseif $attackType == "freedom fighters">> + <<elseif $SecExp.war.attacker.type == "freedom fighters">> <<set _tacChance += 0.15>> <</if>> - <<elseif $chosenTactic == "Defense In Depth">> - <<if $attackType == "raiders">> + <<elseif $SecExp.war.chosenTactic == "Defense In Depth">> + <<if $SecExp.war.attacker.type == "raiders">> <<set _tacChance -= 0.20>> - <<elseif $attackType == "free city">> + <<elseif $SecExp.war.attacker.type == "free city">> <<set _tacChance += 0.10>> - <<elseif $attackType == "old world">> + <<elseif $SecExp.war.attacker.type == "old world">> <<set _tacChance += 0.20>> - <<elseif $attackType == "freedom fighters">> + <<elseif $SecExp.war.attacker.type == "freedom fighters">> <<set _tacChance -= 0.05>> <</if>> - <<elseif $chosenTactic == "Blitzkrieg">> - <<if $attackType == "raiders">> + <<elseif $SecExp.war.chosenTactic == "Blitzkrieg">> + <<if $SecExp.war.attacker.type == "raiders">> <<set _tacChance += 0.10>> - <<elseif $attackType == "free city">> + <<elseif $SecExp.war.attacker.type == "free city">> <<set _tacChance -= 0.20>> - <<elseif $attackType == "old world">> + <<elseif $SecExp.war.attacker.type == "old world">> <<set _tacChance += 0.25>> - <<elseif $attackType == "freedom fighters">> + <<elseif $SecExp.war.attacker.type == "freedom fighters">> <<set _tacChance -= 0.10>> <</if>> - <<elseif $chosenTactic == "Human Wave">> - <<if $attackType == "raiders">> + <<elseif $SecExp.war.chosenTactic == "Human Wave">> + <<if $SecExp.war.attacker.type == "raiders">> <<set _tacChance -= 0.10>> - <<elseif $attackType == "free city">> + <<elseif $SecExp.war.attacker.type == "free city">> <<set _tacChance += 0.10>> - <<elseif $attackType == "old world">> + <<elseif $SecExp.war.attacker.type == "old world">> <<set _tacChance -= 0.15>> - <<elseif $attackType == "freedom fighters">> + <<elseif $SecExp.war.attacker.type == "freedom fighters">> <<set _tacChance += 0.10>> <</if>> <</if>> @@ -792,7 +790,7 @@ <<set _mercMod += 0.20>> <<set _atkMod += 0.10>> <<set _defMod += 0.10>> - <<set $tacticsSuccessful = 1>> + <<set $SecExp.war.tacticsSuccessful = 1>> <<else>> <<set _enemyMod += 0.20>> <<set _militiaMod -= 0.20>> @@ -800,7 +798,6 @@ <<set _mercMod -= 0.20>> <<set _atkMod -= 0.10>> <<set _defMod -= 0.10>> - <<set $tacticsSuccessful = 0>> <</if>> /* enemy morale mods */ @@ -848,7 +845,7 @@ <</if>> <</for>> - <<if $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> + <<if $SF.Toggle && $SF.Active >= 1 && $SecExp.war.deploySF>> <<set _unit = App.SecExp.getUnit("SF")>> <<set _attack += _unit.attack>> <<set _defense += _unit.defense>> @@ -880,24 +877,24 @@ <<set _moraleTroopMod = Math.clamp(App.SecExp.battle.troopCount() / 100,1,5)>> - <<set _morale = (App.SecExp.BaseDroneUnit.morale * $secBots.isDeployed + App.SecExp.BaseMilitiaUnit.morale * _militiaMod * App.SecExp.battle.deployedUnits('militia') + App.SecExp.BaseSlaveUnit.morale * _slaveMod * App.SecExp.battle.deployedUnits('slaves') + App.SecExp.BaseMercUnit.morale * _mercMod * App.SecExp.battle.deployedUnits('mercs') + App.SecExp.BaseSpecialForcesUnit.morale * $SFIntervention * _SFMod) / ($secBots.isDeployed + App.SecExp.battle.deployedUnits('militia') + App.SecExp.battle.deployedUnits('slaves') + App.SecExp.battle.deployedUnits('mercs') + $SFIntervention)>> + <<set _morale = (App.SecExp.BaseDroneUnit.morale * $secBots.isDeployed + App.SecExp.BaseMilitiaUnit.morale * _militiaMod * App.SecExp.battle.deployedUnits('militia') + App.SecExp.BaseSlaveUnit.morale * _slaveMod * App.SecExp.battle.deployedUnits('slaves') + App.SecExp.BaseMercUnit.morale * _mercMod * App.SecExp.battle.deployedUnits('mercs') + App.SecExp.BaseSpecialForcesUnit.morale * $SecExp.war.deploySF * _SFMod) / ($secBots.isDeployed + App.SecExp.battle.deployedUnits('militia') + App.SecExp.battle.deployedUnits('slaves') + App.SecExp.battle.deployedUnits('mercs') + $SecExp.war.deploySF)>> <<if $SecExp.buildings.barracks>> <<set _morale = _morale + _morale * $SecExp.buildings.barracks.luxury * 0.05>> /* barracks bonus */ <</if>> <<set _morale *= _moraleTroopMod>> - <<set _baseHp = (App.SecExp.BaseDroneUnit.hp * $secBots.isDeployed + App.SecExp.BaseMilitiaUnit.hp * App.SecExp.battle.deployedUnits('militia') + App.SecExp.BaseSlaveUnit.hp * App.SecExp.battle.deployedUnits('slaves') + App.SecExp.BaseMercUnit.hp * App.SecExp.battle.deployedUnits('mercs') + App.SecExp.BaseSpecialForcesUnit.hp * $SFIntervention) / ($secBots.isDeployed + App.SecExp.battle.deployedUnits('militia') + App.SecExp.battle.deployedUnits('slaves') + App.SecExp.battle.deployedUnits('mercs') + $SFIntervention)>> + <<set _baseHp = (App.SecExp.BaseDroneUnit.hp * $secBots.isDeployed + App.SecExp.BaseMilitiaUnit.hp * App.SecExp.battle.deployedUnits('militia') + App.SecExp.BaseSlaveUnit.hp * App.SecExp.battle.deployedUnits('slaves') + App.SecExp.BaseMercUnit.hp * App.SecExp.battle.deployedUnits('mercs') + App.SecExp.BaseSpecialForcesUnit.hp * $SecExp.war.deploySF) / ($secBots.isDeployed + App.SecExp.battle.deployedUnits('militia') + App.SecExp.battle.deployedUnits('slaves') + App.SecExp.battle.deployedUnits('mercs') + $SecExp.war.deploySF)>> /* calculates enemy army stats */ <<if $week <= 30>> - <<set _armyMod = $attackTroops / 80>> + <<set _armyMod = $SecExp.war.attacker.troops / 80>> <<elseif $week <= 60>> - <<set _armyMod = $attackTroops / 75>> + <<set _armyMod = $SecExp.war.attacker.troops / 75>> <<elseif $week <= 90>> - <<set _armyMod = $attackTroops / 70>> + <<set _armyMod = $SecExp.war.attacker.troops / 70>> <<elseif $week <= 120>> - <<set _armyMod = $attackTroops / 65>> + <<set _armyMod = $SecExp.war.attacker.troops / 65>> <<else>> - <<set _armyMod = $attackTroops / 60>> + <<set _armyMod = $SecExp.war.attacker.troops / 60>> <</if>> <<set _armyMod = Math.trunc(_armyMod)>> <<if $majorBattle == 1>> @@ -907,14 +904,14 @@ <<set _armyMod = 1>> <</if>> - <<set _enemyMoraleTroopMod = Math.clamp($attackTroops / 100,1,5)>> + <<set _enemyMoraleTroopMod = Math.clamp($SecExp.war.attacker.troops / 100,1,5)>> - <<set _unit = App.SecExp.getEnemyUnit($attackType, $attackTroops, $attackEquip)>> + <<set _unit = App.SecExp.getEnemyUnit($SecExp.war.attacker.type, $SecExp.war.attacker.troops, $SecExp.war.attacker.equip)>> <<set _enemyAttack = _unit.attack * _armyMod>> <<set _enemyDefense = _unit.defense * _armyMod>> <<set _enemyMorale = _unit.morale * _enemyMod * _enemyMoraleTroopMod>> <<set _enemyHp = _unit.hp>> - <<set _enemyBaseHp = _unit.hp / $attackTroops>> + <<set _enemyBaseHp = _unit.hp / $SecExp.war.attacker.troops>> /* difficulty */ <<set _enemyAttack *= $SecExp.settings.difficulty>> @@ -990,7 +987,7 @@ <br>militia morale modifier: <<if _militiaMod > 0>>+<</if>>_militiaMod% <br>slaves morale modifier: <<if _slaveMod > 0>>+<</if>>_slaveMod% <br>mercenaries morale modifier: <<if _mercMod > 0>>+<</if>>_mercMod% - <<if $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> + <<if $SF.Toggle && $SF.Active >= 1 && $SecExp.war.deploySF>> <br>special force morale modifier: <<if _SFMod > 0>>+<</if>>_SFMod% <</if>> <<if $SecExp.buildings.barracks && $SecExp.buildings.barracks.luxury >= 1>> @@ -1001,9 +998,9 @@ <</if>> <br><br>__Tactics__: <br>tactic chance of success: <<print num(Math.round(_tacChance * 100))>>% - <br>was tactic chosen successful?: <<if $tacticsSuccessful == 1>> yes <<else>> no<</if>> + <br>was tactic chosen successful?: <<if $SecExp.war.tacticsSuccessful == 1>> yes <<else>> no<</if>> <br><br>__Enemy__: - <br>enemy troops: <<print num(Math.round($attackTroops))>> + <br>enemy troops: <<print num(Math.round($SecExp.war.attacker.troops))>> <br>enemy attack: <<print num(Math.round(_enemyAttack))>> <br>enemy defense: <<print num(Math.round(_enemyDefense))>> <br>enemy Hp: <<print num(Math.round(_enemyHp))>> @@ -1024,14 +1021,14 @@ <<if $SecExp.settings.showStats == 1>> <br>player damage: <<print num(Math.round(_damage))>><</if>> <<set _enemyHp -= _damage>> <<if $SecExp.settings.showStats == 1>> <br>remaining enemy Hp: <<print num(Math.round(_enemyHp))>><</if>> - <<set $enemyLosses += _damage / _enemyBaseHp>> + <<set $SecExp.war.attacker.losses += _damage / _enemyBaseHp>> <<set _moraleDamage = Math.clamp(_damage / 2 + _damage / _enemyBaseHp,0,_damage*1.5)>> <<set _enemyMorale -= _moraleDamage>> <<if $SecExp.settings.showStats == 1>> <br>remaining enemy morale: <<print num(Math.round(_enemyMorale))>><</if>> <<if _enemyHp <= 0 || _enemyMorale <= 0>> <<if $SecExp.settings.showStats == 1>> <br><br>Victory!<</if>> - <<set $battleResult = 3>> - <<set $battleTurns = _i>> + <<set $SecExp.war.result = 3>> + <<set $SecExp.war.turns = _i>> <<break>> <</if>> @@ -1043,44 +1040,44 @@ <<if $SecExp.settings.showStats == 1>> <br>enemy damage: <<print num(Math.round(_damage))>><</if>> <<set _hp -= _damage>> <<if $SecExp.settings.showStats == 1>> <br>remaining hp: <<print num(Math.round(_hp))>><</if>> - <<set $losses += _damage / _baseHp>> + <<set $SecExp.war.losses += _damage / _baseHp>> <<set _moraleDamage = Math.clamp(_damage / 2 + _damage / _baseHp,0,_damage*1.5)>> <<set _morale -= _moraleDamage>> <<if $SecExp.settings.showStats == 1>> <br>remaining morale: <<print Math.round(_morale)>><</if>> <<if _hp <= 0 || _morale <= 0>> <<if $SecExp.settings.showStats == 1>> <br><br>Defeat!<</if>> - <<set $battleResult = -3>> - <<set $battleTurns = _i>> + <<set $SecExp.war.result = -3>> + <<set $SecExp.war.turns = _i>> <<break>> <</if>> <</for>> - <<if $battleResult != 3 && $battleResult != -3>> + <<if $SecExp.war.result != 3 && $SecExp.war.result != -3>> <<if _morale > _enemyMorale>> <<if $SecExp.settings.showStats == 1>> <br><br>Partial victory!<</if>> - <<set $battleResult = 2>> + <<set $SecExp.war.result = 2>> <<elseif _morale < _enemyMorale>> <<if $SecExp.settings.showStats == 1>> <br><br>Partial defeat!<</if>> - <<set $battleResult = -2>> + <<set $SecExp.war.result = -2>> <</if>> <</if>> <<if $SecExp.settings.showStats == 1>> - <br><br>Losses: <<print num(Math.trunc($losses))>> - <br>Enemy losses: <<print num(Math.trunc($enemyLosses))>> + <br><br>Losses: <<print num(Math.trunc($SecExp.war.losses))>> + <br>Enemy losses: <<print num(Math.trunc($SecExp.war.attacker.losses))>> <</if>> - <<if $battleResult > 3 || $battleResult < -3>> + <<if $SecExp.war.result > 3 || $SecExp.war.result < -3>> <br><br>@@.red;Error: failed to determine battle result@@ <</if>> <<if $SecExp.settings.showStats == 1>> - <<if $majorBattle == 1 && $SecExp.settings.battle.major.gameOver == 1 && $battleResult == -3>> + <<if $majorBattle == 1 && $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 && $battleResult == -3>> + <<if $majorBattle == 1 && $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/attackOptions.tw b/src/Mods/SecExp/attackOptions.tw index 9e883235e5561895640f07c3a6d83b3ae3816ea7..8de316c784924698485b46d797c1f3c70af21f11 100644 --- a/src/Mods/SecExp/attackOptions.tw +++ b/src/Mods/SecExp/attackOptions.tw @@ -3,7 +3,7 @@ <<if ndef $SecExp.settings.unitDescriptions>> <<set $SecExp.settings.unitDescriptions = 0>> <</if>> -<<set $nextButton = " ", $nextLink = "attackOptions", $encyclopedia = "Battles">> +<<set $nextButton = " ", $encyclopedia = "Battles">> <<set _options = new App.UI.OptionsGroup()>> <<run _options.addOption("Unit descriptions are", "unitDescriptions", $SecExp.settings) @@ -16,7 +16,7 @@ <<if $majorBattle == 0>> <<if $SecExp.battles.victories + $SecExp.battles.losses > 0>> The ominous message dominates the screens of your office, and <<print $assistant.name>> quickly gathers all information available to prepare for battle. - <<if $attackType == "raiders">> + <<if $SecExp.war.attacker.type === "raiders">> <<if App.SecExp.battle.recon() >= 1>> A disorganized horde of raiders is coming to your city. To such jackals your arcology surely looks like an appetizing morsel. Fortunately you knew of their coming, thanks to your recon systems. @@ -24,7 +24,7 @@ Some of your citizens saw the disorganized horde of raiders coming towards the city and quickly reported it. To such jackals your arcology surely looks like an appetizing morsel. <</if>> <br>Raiders are roaming gangs of bandits, preying on the vulnerable supply lines of Free Cities and old world nations. They are rarely equipped with decent armaments and even more rarely have any formal military training, but they make up for that with high mobility and numbers. - <<elseif $attackType == "free city">> + <<elseif $SecExp.war.attacker.type === "free city">> <<if App.SecExp.battle.recon() >= 1>> A menacing column of slavers and hired mercenaries is coming to your city. Another free city is ready to use their best tools to hit a dangerous competitor where it hurts. Fortunately you knew of their coming, thanks to your recon systems. @@ -32,7 +32,7 @@ Some of your citizens saw the menacing column of slavers and hired mercenaries and rushed to your office to bring the grim news. Another free city is ready to use their best tools to bring down a dangerous competitor. <</if>> <br>Free City expeditions are usually composed of mercenaries hired to take down sensible supplies or infrastructure in order to damage the enemies of their contractor. They have on average good equipment and training, together with decent mobility, making them a formidable force. Their biggest weakness however is their relatively low numbers. - <<elseif $attackType == "freedom fighters">> + <<elseif $SecExp.war.attacker.type === "freedom fighters">> <<if App.SecExp.battle.recon() >= 1>> A dangerous looking army of guerrillas is gathering just outside the arcology. Fanatics and idealists armed with dead men's words and hope, set on erasing your fledgling empire. Fortunately you knew of their coming, thanks to your recon systems. @@ -40,7 +40,7 @@ Some of your citizens saw the dangerous looking army of guerrillas is gathering just outside the arcology. Fanatics and idealists armed with dead men's words and hope, set on erasing your fledgling empire. <</if>> <br>Freedom Fighters are groups of individuals fighting to rid the planet of "evils" such as the Free Cities and their way of life. Lacking the strength to assault one directly they fight guerrilla style slowly starving to death their enemies. They are rarely well equipped, but with good training and mobility they are not a threat that can be taken lightly. - <<elseif $attackType == "old world">> + <<elseif $SecExp.war.attacker.type === "old world">> <<if App.SecExp.battle.recon() >= 1>> A disciplined yet dusty, scruffy old world army is approaching the confines of your arcology. There's nothing better than a good war to unite the electorate and your arcology is just the perfect target. Fortunately you knew of their coming, thanks to your recon systems. @@ -59,7 +59,7 @@ <<else>> Your assistant interrupted your rest to bring the grim news. You quickly rush to your console, where you can see the satellite images coming in of the force about to crash against your arcology. It's not the first time your armies fought for the survival of your empire, but this time it seems it will be a fight for life or death. <</if>> - <<if $attackType == "raiders">> + <<if $SecExp.war.attacker.type === "raiders">> <<if App.SecExp.battle.recon() >= 1>> A massive, disorganized horde of raiders is coming to your city. It seems a warlord of the wastelands amassed enough men to try and obtain a slice of territory of his own; if he's not defeated there won't be a tomorrow for the arcology. Fortunately you knew of their coming, thanks to your recon systems. @@ -67,7 +67,7 @@ Some of your citizens saw the massive, disorganized horde of raiders coming towards the city and quickly reported it. It seems a warlord of the wastelands amassed enough men to try and obtain a slice of territory of his own; if he's not defeated there won't be a tomorrow for the arcology. <</if>> <br>Raiders are roaming gangs of bandits, preying on the vulnerable supply lines of Free Cities and old world nations. They are rarely equipped with decent armaments and even more rarely have any formal military training, but they make up for that with high mobility and numbers. - <<elseif $attackType == "free city">> + <<elseif $SecExp.war.attacker.type === "free city">> <<if App.SecExp.battle.recon() >= 1>> A massive, menacing column of slavers and hired mercenaries is coming to your city. The quantity of money invested in this assault is staggering; it seems you made some very powerful enemies. If they're not defeated your story will end this day. Fortunately you knew of their coming, thanks to your recon systems. @@ -75,7 +75,7 @@ Some of your citizens saw the massive, menacing column of slavers and hired mercenaries and rushed to your office to bring the grim news. The quantity of money invested in this assault is staggering; it seems you made some very powerful enemies. If they're not defeated your story will end this day. <</if>> <br>Free City expeditions are usually composed of mercenaries hired to take down sensible supplies or infrastructure in order to damage the enemies of their contractor. They have, on average, good equipment and training, together with decent mobility, making them a formidable force. Their biggest weakness, however, is their relatively low numbers. - <<elseif $attackType == "freedom fighters">> + <<elseif $SecExp.war.attacker.type === "freedom fighters">> <<if App.SecExp.battle.recon() >= 1>> A massive, dangerous army of guerrillas is gathering just outside the arcology. A huge ocean of fanatics and idealists armed with dead men's words and hope, set on erasing your fledgling empire once and for all. And this time they won't stop until your body is burnt to a crisp. Fortunately you knew of their coming, thanks to your recon systems. @@ -83,7 +83,7 @@ Some of your citizens saw the massive, dangerous army of guerrillas is gathering just outside the arcology. A huge ocean of fanatics and idealists armed with dead men's words and hope, set on erasing your fledgling empire once and for all. And this time they won't stop until your body is burnt to a crisp. <</if>> <br>Freedom Fighters are groups of individuals fighting to rid the planet of "evils" such as the Free Cities and their way of life. Lacking the strength to assault one directly, they fight guerrilla style, slowly starving to death their enemies. They are rarely well equipped, but with good training and mobility they are not a threat that can be taken lightly. - <<elseif $attackType == "old world">> + <<elseif $SecExp.war.attacker.type === "old world">> <<if App.SecExp.battle.recon() >= 1>> A massive, disciplined old world army is approaching the confines of your arcology. It seems one of the nations of the old world is determined to put your arcology to rest once and for all or die trying. Fortunately you knew of their coming, thanks to your recon systems. @@ -94,27 +94,31 @@ <</if>> <</if>> <br><br>__Recon__: -<<set _estimatedMen = normalRandInt($attackTroops, $attackTroops * (4 - App.SecExp.battle.recon()) * 0.05)>> -<<set _expectedEquip = normalRandInt($attackEquip, (4 - App.SecExp.battle.recon()) * 0.25)>> +<<set _estimatedMen = $SecExp.war.estimatedMen>> +<<set _expectedEquip = $SecExp.war.expectedEquip>> <br>It seems your troops and your adversary will fight -<<if $battleTerrain == "rural">> +<<if $SecExp.war.terrain === "rural">> in <strong>the rural land</strong> surrounding the free city. -<<elseif $battleTerrain == "urban">> +<<elseif $SecExp.war.terrain === "urban">> in the old <strong>abandoned city</strong> surrounding the free city. -<<elseif $battleTerrain == "hills">> +<<elseif $SecExp.war.terrain === "hills">> on <strong>the hills</strong> around the free city. -<<elseif $battleTerrain == "coast">> +<<elseif $SecExp.war.terrain === "coast">> along <strong>the coast</strong> just outside the free city. -<<elseif $battleTerrain == "outskirts">> +<<elseif $SecExp.war.terrain === "outskirts">> right against <strong>the walls of the arcology.</strong> -<<elseif $battleTerrain == "mountains">> +<<elseif $SecExp.war.terrain === "mountains">> in <strong>the mountains</strong> overlooking the arcology. -<<elseif $battleTerrain == "wasteland">> +<<elseif $SecExp.war.terrain === "wasteland">> in <strong>the wastelands</strong> outside the free city territory. -<<elseif $battleTerrain == "error">> - <br>@@.red;Error: failed to assign terrain.@@ battleTerrain reads "<<print $battleTerrain>>". +<<elseif $SecExp.war.terrain == "international waters">> + in <strong>the water surrounding</strong> the free city. +<<elseif ["an underwater cave", "a sunken ship", "an island"].includes($SecExp.war.terrain)>> + in <strong>$SecExp.war.terrain</strong> near the free city. +<<elseif $SecExp.war.terrain === "error">> + <br>@@.red;Error: failed to assign terrain.@@ SecExp.war.terrain reads: $SecExp.war.terrain. <<else>> - <br>@@.red;Error: failed to read terrain.@@ battleTerrain reads "<<print $battleTerrain>>". + <br>@@.red;Error: failed to read terrain.@@ SecExp.war.terrain reads: $SecExp.war.terrain. <</if>> <<if App.SecExp.battle.recon() == 3>> Your recon capabilities are top notch. The information collected will be most likely correct or very close to be so: @@ -125,7 +129,7 @@ <<else>> Your recon capabilities are almost non-existent. The information collected will be wild guesses at best: <</if>> -approximately <strong><<print _estimatedMen>> men</strong> are coming, they seem to be +approximately <strong>_estimatedMen men</strong> are coming, they seem to be <<if _expectedEquip <= 0>> <strong>poorly armed</strong>. Old rusty small arms are the norm with just a few barely working civilian vehicles. <<elseif _expectedEquip == 1>> @@ -140,11 +144,11 @@ approximately <strong><<print _estimatedMen>> men</strong> are coming, they seem <hr>__Battle Plan__:<br> <<set _leaderFound = 1>> -<<if $leadingTroops === "bodyguard" && $BodyguardID === 0 || $leadingTroops === "headGirl" && $HeadGirlID === 0>> - @@.warning;Chosen leader $leadingTroops cannot be found, please select another.@@ +<<if $SecExp.war.commander === "bodyguard" && $BodyguardID === 0 || $SecExp.war.commander === "headGirl" && $HeadGirlID === 0>> + @@.warning;Chosen leader $SecExp.war.commander cannot be found, please select another.@@ <<set _leaderFound = 0>> <</if>> -<<switch $leadingTroops>> +<<switch $SecExp.war.commander>> <<case "PC">> <<set _leader = "Personally">> <<case "assistant">> @@ -162,127 +166,63 @@ approximately <strong><<print _estimatedMen>> men</strong> are coming, they seem <</switch>> /* leader assignment */ -<span id="leader"><strong><<print _leader>></strong></span> lead your troops. +<strong>_leader</strong> lead your troops. <br> -<<link "Personally join the battle">> - <<set $leadingTroops = "PC">> - <<set _leader = "Personally">> - <<replace "#leader">><strong><<print _leader>></strong><</replace>> -<</link>> -| -<<link "Let $assistant.name lead the troops">> - <<set $leadingTroops = "assistant">> - <<set _leader = "$assistant.name will">> - <<replace "#leader">><strong><<print _leader>></strong><</replace>> -<</link>> -<<if $BodyguardID != 0 && $SecExp.edicts.defense.slavesOfficers == 1>> - | - <<link "Let your bodyguard lead your troops">> - <<set $leadingTroops = "bodyguard">> - <<set _leader = "_S.Bodyguard.slaveName will">> - <<replace "#leader">><strong><<print _leader>></strong><</replace>> - <</link>> +[[Personally join the battle|attackOptions][$SecExp.war.commander = "Personally"]] +|<<link "Let $assistant.name lead your troops""attackOptions">> <<set $SecExp.war.commander = "assistant">> <</link>> +<<if $BodyguardID !== 0 && $SecExp.edicts.defense.slavesOfficers === 1>> + |[[Let your bodyguard lead your troops|attackOptions][$SecExp.war.commander = "bodyguard"]] <</if>> -<<if $HeadGirlID != 0 && $SecExp.edicts.defense.slavesOfficers == 1>> - | - <<link "Let your Head Girl lead your troops">> - <<set $leadingTroops = "headGirl">> - <<set _leader = "_S.HeadGirl.slaveName will">> - <<replace "#leader">><strong><<print _leader>></strong><</replace>> - <</link>> +<<if $HeadGirlID !== 0 && $SecExp.edicts.defense.slavesOfficers === 1>> + |[[Let your Head Girl lead your troops|attackOptions][$SecExp.war.commander = "headGirl"]] <</if>> <<if $SecExp.edicts.defense.militia >= 1>> - | - <<link "Let the citizens' militia officers lead the troops">> - <<set $leadingTroops = "citizen">> - <<set _leader = "The citizens' militia commander will">> - <<replace "#leader">><strong><<print _leader>></strong><</replace>> - <</link>> + |[[Let the citizens' militia officers lead the troops|attackOptions][$SecExp.war.commander = "citizen"]] <</if>> <<if $mercenaries > 0>> - | - <<link "Let the mercenary officers lead the troops">> - <<set $leadingTroops = "mercenary">> - <<set _leader = "The mercenary commander will">> - <<replace "#leader">><strong><<print _leader>></strong><</replace>> - <</link>> + |[[Let the mercenary officers lead the troops|attackOptions][$SecExp.war.commander = "mercenary"]] <</if>> <<if $SF.Toggle && $SF.Active >= 1 && $SF.MercCon.CanAttend === -2>> - | - <<link "Let The Colonel lead the troops">> - <<set $leadingTroops = "colonel">> - <<set _leader = capFirstChar($SF.Lower || "the special force") +"'s Colonel will">> - <<replace "#leader">><strong><<print _leader>></strong><</replace>> - <</link>> + |[[Let The Colonel lead the troops|attackOptions][$SecExp.war.commander = "colonel"]] <</if>> -<br>For this battle you choose to follow <span id="tactic"><strong><<print $chosenTactic>></strong></span> tactics.<br> +<br>For this battle you choose to follow <strong>$SecExp.war.chosenTactic</strong> tactics.<br> <button class="tab-links" onclick="App.UI.tabBar.openTab(event, 'defensiveTactics')" id="tab defensive tactics">Defensive tactics</button> <button class="tab-links" onclick="App.UI.tabBar.openTab(event, 'offensiveTactics')" id="tab offensiveTactics">Offensive Tactics</button> <div id="defensiveTactics" class="tab-content"> <div class="content"> - <<link "Bait and Bleed">> - <<set $chosenTactic = "Bait and Bleed">> - <<replace "#tactic">><strong><<print $chosenTactic>></strong><</replace>> - <</link>> + [[Bait and Bleed|attackOptions][$SecExp.war.chosenTactic = "Bait and Bleed"]] <br> //Combines bait and switch tactics with guerrilla style assaults, with the objective of slowly bleed the enemy.// - <br> - <<link "Guerrilla">> - <<set $chosenTactic = "Guerrilla">> - <<replace "#tactic">><strong><<print $chosenTactic>></strong><</replace>> - <</link>> + <br>[[Guerrilla|attackOptions][$SecExp.war.chosenTactic = "Guerrilla"]] <br> //Involves using terrain knowledge and small fast attacks to hinder and weaken the enemy.// - <br> - <<link "Choke Points">> - <<set $chosenTactic = "Choke Points">> - <<replace "#tactic">><strong><<print $chosenTactic>></strong><</replace>> - <</link>> + <br>[[Choke Points|attackOptions][$SecExp.war.chosenTactic = "Choke Points"]] <br> //Involves using terrain knowledge and strong fortifications in order to stop the enemy on its track.// - <br> - <<link "Interior Lines">> - <<set $chosenTactic = "Interior Lines">> - <<replace "#tactic">><strong><<print $chosenTactic>></strong><</replace>> - <</link>> + <br>[[Interior Lines|attackOptions][$SecExp.war.chosenTactic = "Interior Lines"]] <br> //Involves exploiting a defender's shorter logistics lines and redeployment times in order to keep the enemy pressured.// - <br> - <<link "Pincer Maneuver">> - <<set $chosenTactic = "Pincer Maneuver">> - <<replace "#tactic">><strong><<print $chosenTactic>></strong><</replace>> - <</link>> + <br>[[Pincer Maneuver|attackOptions][$SecExp.war.chosenTactic = "Pincer Maneuver"]] <br> //Involves letting the enemy push back the center in order to envelop their formation.// - <br> - <<link "Defense In Depth">> - <<set $chosenTactic = "Defense In Depth">> - <<replace "#tactic">><strong><<print $chosenTactic>></strong><</replace>> - <</link>> + <br>[[Defense In Depth|attackOptions][$SecExp.war.chosenTactic = "Defense In Depth"]] <br> //Involves letting the enemy gain terrain to gain tactical superiority by alternating between delaying actions and small counterattacks.// </div> </div> <div id="offensiveTactics" class="tab-content"> <div class="content"> - <<link "Blitzkrieg">> - <<set $chosenTactic = "Blitzkrieg">> - <<replace "#tactic">><strong><<print $chosenTactic>></strong><</replace>> - <</link>> + [[Blitzkrieg|attackOptions][$SecExp.war.chosenTactic = "Blitzkrieg"]] <br> //Involves breaking the front of the enemy with a fast armored force concentrated into a small area.// - <br> - <<link "Human Wave">> - <<set $chosenTactic = "Human Wave">> - <<replace "#tactic">><strong><<print $chosenTactic>></strong><</replace>> - <</link>> + <br>[[Human Wave|attackOptions][$SecExp.war.chosenTactic = "Human Wave"]] <br> //Involves assaulting the enemy with large numbers of infantry to overwhelm their lines.// </div> </div> <<if _leaderFound === 1>> <<if App.SecExp.battle.deployedUnits() > 0>> - <br>[[Send your orders|attackHandler][$battleResult = 4, $foughtThisWeek = 1]] /* sets $battleResult value outside accepted range (-3, 3) to avoid evaluation problems */ + <br>[[Send your orders|attackHandler][$SecExp.war.result = 4, $foughtThisWeek = 1]] /* sets $SecExp.war.result value outside accepted range (-3, 3) to avoid evaluation problems */ <<else>> <br>You need at least a unit in your roster to proceed to battle. <</if>> - <br>[[Surrender|attackReport][$battleResult = -1, $foughtThisWeek = 1]] - <br>[[Attempt to bribe|attackHandler][$battleResult = 1, $foughtThisWeek = 1]] + <br>[[Surrender|attackReport][$SecExp.war.result = -1, $foughtThisWeek = 1]] + <br>[[Attempt to bribe|attackHandler][$SecExp.war.result = 1, $foughtThisWeek = 1]] //Will cost around <<print cashFormat(Math.round(App.SecExp.battle.bribeCost() * (1 + either(-1,1) * random(2) * 0.1)))>> (estimate).// <<else>> Your leader needs to be present to proceed. @@ -290,7 +230,7 @@ approximately <strong><<print _estimatedMen>> men</strong> are coming, they seem <<if $SF.Toggle && $SF.Active >= 1 && $majorBattle>> <br> <<set _options = new App.UI.OptionsGroup()>> - <<run _options.addOption("The incoming attack's scale warrants deploying the special force.", "SFIntervention") + <<run _options.addOption("The incoming attack's scale warrants deploying the special force.", "SecExp.war.deploySF") .addValue("Green light", 1).on().addValue("Red light", 0).off() .addComment("Some upgrades will be able to support your troops even if the special force is not deployed in the fight.")>> <<includeDOM _options.render()>> @@ -303,54 +243,54 @@ approximately <strong><<print _estimatedMen>> men</strong> are coming, they seem <<if $SecExp.battles.lastSelection[_i] == -1>> <<set $secBots.isDeployed = 1>> <<else>> - <<for _j = 0; _j < $militiaUnits.length; _j++>> - <<if $SecExp.battles.lastSelection[_i] == $militiaUnits[_j].ID>> - <<set $militiaUnits[_j].isDeployed = 1>> + <<for _unit range $militiaUnits>> + <<if $SecExp.battles.lastSelection[_i] === _unit.ID>> + <<set _unit.isDeployed = 1>> <<break>> <</if>> <</for>> - <<for _j = 0; _j < $slaveUnits.length; _j++>> - <<if $SecExp.battles.lastSelection[_i] == $slaveUnits[_j].ID>> - <<set $slaveUnits[_j].isDeployed = 1>> + <<for _unit range $slaveUnits>> + <<if $SecExp.battles.lastSelection[_i] === _unit.ID>> + <<set _unit.isDeployed = 1>> <<break>> <</if>> <</for>> - <<for _j = 0; _j < $mercUnits.length; _j++>> - <<if $SecExp.battles.lastSelection[_i] == $mercUnits[_j].ID>> - <<set $mercUnits[_j].isDeployed = 1>> + <<for _unit range $mercUnits>> + <<if $SecExp.battles.lastSelection[_i] === _unit.ID>> + <<set _unit.isDeployed = 1>> <<break>> <</if>> <</for>> <</if>> <</for>> - <<set $saveValid = 1, $leadingTroops = $SecExp.battles.saved.commander, $SFIntervention = $SecExp.battles.saved.sfSupport>> + <<set $SecExp.war.saveValid = 1, $SecExp.war.commander = $SecExp.battles.saved.commander, $SecExp.war.deploySF = $SecExp.battles.saved.sfSupport>> <</link>> <<else>> Restore saved roster <</if>> | -<<if $saveValid != 1>> +<<if $SecExp.war.saveValid !== 1>> <<link "Save current roster" "attackOptions">> <<if App.SecExp.battle.deployedUnits('bots')>> <<set _tmp = -1>> <<set $SecExp.battles.lastSelection.push(_tmp)>> <</if>> - <<for _i = 0; _i < $militiaUnits.length; _i++>> - <<if $militiaUnits[_i].isDeployed == 1>> - <<set $SecExp.battles.lastSelection.push($militiaUnits[_i].ID)>> + <<for _unit range $militiaUnits>> + <<if _unit.isDeployed === 1>> + <<set $SecExp.battles.lastSelection.push(_unit.ID)>> <</if>> <</for>> - <<for _i = 0; _i < $slaveUnits.length; _i++>> - <<if $slaveUnits[_i].isDeployed == 1>> - <<set $SecExp.battles.lastSelection.push($slaveUnits[_i].ID)>> + <<for _unit range $slaveUnits>> + <<if _unit.isDeployed === 1>> + <<set $SecExp.battles.lastSelection.push(_unit.ID)>> <</if>> <</for>> - <<for _i = 0; _i < $mercUnits.length; _i++>> - <<if $mercUnits[_i].isDeployed == 1>> - <<set $SecExp.battles.lastSelection.push($mercUnits[_i].ID)>> + <<for _unit range $mercUnits>> + <<if _unit.isDeployed === 1>> + <<set $SecExp.battles.lastSelection.push(_unit.ID)>> <</if>> <</for>> - <<set $saveValid = 1, $SecExp.battles.saved.commander = $leadingTroops, $SecExp.battles.saved.sfSupport = $SFIntervention>> + <<set $SecExp.war.saveValid = 1, $SecExp.battles.saved.commander = $SecExp.war.commander, $SecExp.battles.saved.sfSupport = $SecExp.war.deploySF>> <</link>> <<else>> Save current roster @@ -359,23 +299,23 @@ approximately <strong><<print _estimatedMen>> men</strong> are coming, they seem <<if App.SecExp.battle.deployedUnits() > 0>> <<link "Clear current roster" "attackOptions">> <<set $secBots.isDeployed = 0>> - <<for _i = 0; _i < $militiaUnits.length; _i++>> - <<set $militiaUnits[_i].isDeployed = 0>> + <<for _unit range $militiaUnits>> + <<set _unit.isDeployed = 0>> <</for>> - <<for _i = 0; _i < $slaveUnits.length; _i++>> - <<set $slaveUnits[_i].isDeployed = 0>> + <<for _unit range $slaveUnits>> + <<set _unit.isDeployed = 0>> <</for>> - <<for _i = 0; _i < $mercUnits.length; _i++>> - <<set $mercUnits[_i].isDeployed = 0>> + <<for _unit range $mercUnits>> + <<set _unit.isDeployed = 0>> <</for>> - <<set $saveValid = 0>> + <<set $SecExp.war.saveValid = 0>> <</link>> <<else>> Clear current roster <</if>> | <<if $SecExp.battles.lastSelection.length > 0>> - [[Clear saved roster|attackOptions][$SecExp.battles.lastSelection = [], $saveValid = 0]] + [[Clear saved roster|attackOptions][$SecExp.battles.lastSelection = [], $SecExp.war.saveValid = 0]] <<else>> Clear saved roster <</if>> @@ -393,14 +333,14 @@ approximately <strong><<print _estimatedMen>> men</strong> are coming, they seem <<if App.SecExp.battle.deployableUnits() === 0>> <strong>Unit roster full.</strong> <</if>> <br> <<includeDOM App.SecExp.deployUnitMenu($secBots, "bots")>> -<<if $militiaUnits.length > 0>> - <button class="tab-links" onclick="App.UI.tabBar.openTab(event, 'militia')" id="tab militia">Militia: ($militiaUnits.length)</button> +<<if _mL > 0>> + <button class="tab-links" onclick="App.UI.tabBar.openTab(event, 'militia')" id="tab militia">Militia: (_mL)</button> <</if>> -<<if $slaveUnits.length > 0>> - <button class="tab-links" onclick="App.UI.tabBar.openTab(event, 'slaves')" id="tab slaves">Slaves: ($slaveUnits.length)</button> +<<if _sL > 0>> + <button class="tab-links" onclick="App.UI.tabBar.openTab(event, 'slaves')" id="tab slaves">Slaves: (_sL)</button> <</if>> -<<if $mercUnits.length > 0>> - <button class="tab-links" onclick="App.UI.tabBar.openTab(event, 'mercs')" id="tab mercs">Mercs: ($mercUnits.length)</button> +<<if _meL > 0>> + <button class="tab-links" onclick="App.UI.tabBar.openTab(event, 'mercs')" id="tab mercs">Mercs: (_meL)</button> <</if>> <div id="militia" class="tab-content"> diff --git a/src/Mods/SecExp/attackReport.tw b/src/Mods/SecExp/attackReport.tw index 2ab7bd40ede5f84a06b6c05a60b2339569942ed1..d065ed12a5379496ca7965ce8cc399829c6cfde4 100644 --- a/src/Mods/SecExp/attackReport.tw +++ b/src/Mods/SecExp/attackReport.tw @@ -5,12 +5,12 @@ /*init*/ <<set _oldRep = $rep>> <<set _oldAuth = $SecExp.core.authority>> -<<set $enemyLosses = Math.trunc($enemyLosses)>> -<<if $enemyLosses > $attackTroops>> - <<set $enemyLosses = $attackTroops>> +<<set $SecExp.war.attacker.losses = Math.trunc($SecExp.war.attacker.losses)>> +<<if $SecExp.war.attacker.losses > $SecExp.war.attacker.troops>> + <<set $SecExp.war.attacker.losses = $SecExp.war.attacker.troops>> <</if>> -<<set $SecExp.core.totalKills += $enemyLosses>> -<<set $losses = Math.trunc($losses)>> +<<set $SecExp.core.totalKills += $SecExp.war.attacker.losses>> +<<set $SecExp.war.losses = Math.trunc($SecExp.war.losses)>> <<set _loot = 0>> /* result */ @@ -20,63 +20,63 @@ <<set _majorBattleMod = 2>> <<set $SecExp.battles.major++>> <</if>> -<<if $battleResult == 3>> +<<if $SecExp.war.result == 3>> <strong>Victory!</strong> <<set $SecExp.battles.lossStreak = 0>> <<set $SecExp.battles.victoryStreak += 1>> <<set $SecExp.battles.victories++>> -<<elseif $battleResult == -3>> +<<elseif $SecExp.war.result == -3>> <strong>Defeat!</strong> <<set $SecExp.battles.lossStreak += 1>> <<set $SecExp.battles.victoryStreak = 0>> <<set $SecExp.battles.losses++>> -<<elseif $battleResult == 2>> +<<elseif $SecExp.war.result == 2>> <strong>Partial victory!</strong> <<set $SecExp.battles.victories++>> -<<elseif $battleResult == -2>> +<<elseif $SecExp.war.result == -2>> <strong>Partial defeat!</strong> <<set $SecExp.battles.losses++>> -<<elseif $battleResult == -1>> +<<elseif $SecExp.war.result == -1>> <strong>We surrendered</strong> <<set $SecExp.battles.losses++>> -<<elseif $battleResult == 0>> +<<elseif $SecExp.war.result == 0>> <strong>Failed bribery!</strong> <<set $SecExp.battles.losses++>> -<<elseif $battleResult == 1>> +<<elseif $SecExp.war.result == 1>> <strong>Successful bribery!</strong> <<set $SecExp.battles.victories++>> <</if>> <hr> -<<if $attackType == "raiders">> - Today, <<= asDateString($week, random(0,7))>>, our arcology was attacked by a band of wild raiders, <<print num(Math.trunc($attackTroops))>> men strong. - <<if $battleResult != 1 && $battleResult != 0 && $battleResult != -1>> +<<if $SecExp.war.attacker.type == "raiders">> + Today, <<= asDateString($week, random(0,7))>>, our arcology was attacked by a band of wild raiders, <<print num(Math.trunc($SecExp.war.attacker.troops))>> men strong. + <<if $SecExp.war.result != 1 && $SecExp.war.result != 0 && $SecExp.war.result != -1>> Our defense forces, <<print num(Math.trunc(App.SecExp.battle.troopCount()))>> strong, clashed with them - <<if $battleTerrain == "urban">> - in the streets of <<if $terrain == "urban">>the old world city surrounding the arcology<<else>>of the free city<</if>>, - <<elseif $battleTerrain == "rural">> + <<if $SecExp.war.terrain == "urban">> + in the streets of <<if $SecExp.war.terrain == "urban">>the old world city surrounding the arcology<<else>>of the free city<</if>>, + <<elseif $SecExp.war.terrain == "rural">> in the rural land surrounding the free city, - <<elseif $battleTerrain == "hills">> + <<elseif $SecExp.war.terrain == "hills">> on the hills around the free city, - <<elseif $battleTerrain == "coast">> + <<elseif $SecExp.war.terrain == "coast">> along the coast just outside the free city, - <<elseif $battleTerrain == "outskirts">> + <<elseif $SecExp.war.terrain == "outskirts">> just against the walls of the arcology, - <<elseif $battleTerrain == "mountains">> + <<elseif $SecExp.war.terrain == "mountains">> in the mountains overlooking the arcology, - <<elseif $battleTerrain == "wasteland">> + <<elseif $SecExp.war.terrain == "wasteland">> in the wastelands outside the free city territory, <</if>> - <<if $enemyLosses != $attackTroops>> - inflicting <<print num(Math.trunc($enemyLosses))>> casualties, while sustaining <<if $losses > 1>><<print num(Math.trunc($losses))>> casualties<<elseif $losses > 0>>a casualty<<else>>zero<</if>> themselves. + <<if $SecExp.war.attacker.losses != $SecExp.war.attacker.troops>> + inflicting <<print num(Math.trunc($SecExp.war.attacker.losses))>> casualties, while sustaining <<if $SecExp.war.losses > 1>><<print num(Math.trunc($SecExp.war.losses))>> casualties<<elseif $SecExp.war.losses > 0>>a casualty<<else>>zero<</if>> themselves. <<else>> - completely annihilating their troops, while sustaining <<if $losses > 1>><<print num(Math.trunc($losses))>> casualties<<elseif $losses > 0>>a casualty<<else>>zero casualties<</if>>. + completely annihilating their troops, while sustaining <<if $SecExp.war.losses > 1>><<print num(Math.trunc($SecExp.war.losses))>> casualties<<elseif $SecExp.war.losses > 0>>a casualty<<else>>zero casualties<</if>>. <</if>> <</if>> - <<if $battleResult == 3>> - <<if $battleTurns <= 5>> + <<if $SecExp.war.result == 3>> + <<if $SecExp.war.turns <= 5>> The fight was quick and one sided, our men easily stopped the disorganized horde's futile attempt at raiding your arcology<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> - <<elseif $battleTurns <= 7>> + <<elseif $SecExp.war.turns <= 7>> The fight was hard, but in the end our men stopped the disorganized horde attempt at raiding your arcology<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> <<else>> The fight was long and hard, but our men managed to stop the horde raiding party<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> @@ -86,10 +86,10 @@ <<elseif $SecExp.battles.lossStreak >= 2>> finally putting an end to a series of unfortunate defeats. <</if>> - <<elseif $battleResult == -3>> - <<if $battleTurns <= 5>> + <<elseif $SecExp.war.result == -3>> + <<if $SecExp.war.turns <= 5>> The fight was quick and one sided, our men were easily crushed by the barbaric horde of raiders<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> - <<elseif $battleTurns <= 7>> + <<elseif $SecExp.war.turns <= 7>> The fight was hard and in the end the bandits proved too much to handle for our men<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> <<else>> The fight was long and hard, but despite their bravery the horde proved too much for our men<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> @@ -99,46 +99,46 @@ <<elseif $SecExp.battles.lossStreak >= 2>> confirming the long list of recent failures our armed forces collected. <</if>> - <<elseif $battleResult == 2>> + <<elseif $SecExp.war.result == 2>> The fight was long and hard, but in the end our men managed to repel the raiders, though not without difficulty. - <<elseif $battleResult == -2>> + <<elseif $SecExp.war.result == -2>> 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. - <<elseif $battleResult == -1>> + <<elseif $SecExp.war.result == -1>> You gave your troops the order to surrender, obediently they stand down. - <<elseif $battleResult == 0>> + <<elseif $SecExp.war.result == 0>> You decided in favor of a financial approach rather than open hostilities. Your troops remain inside the arcology's walls. - <<elseif $battleResult == 1>> + <<elseif $SecExp.war.result == 1>> You decided in favor of a financial approach rather than open hostilities. Your troops remain inside the arcology's walls. <</if>> -<<elseif $attackType == "free city">> - Today, <<= asDateString($week, random(0,7))>>, our arcology was attacked by a contingent of mercenaries hired by a competing free city, <<print num(Math.trunc($attackTroops))>> men strong. - <<if $battleResult != 1 && $battleResult != 0 && $battleResult != -1>> +<<elseif $SecExp.war.attacker.type == "free city">> + Today, <<= asDateString($week, random(0,7))>>, our arcology was attacked by a contingent of mercenaries hired by a competing free city, <<print num(Math.trunc($SecExp.war.attacker.troops))>> men strong. + <<if $SecExp.war.result != 1 && $SecExp.war.result != 0 && $SecExp.war.result != -1>> Our defense forces, <<print num(Math.trunc(App.SecExp.battle.troopCount()))>> strong, clashed with them - <<if $battleTerrain == "urban">> - in the streets of <<if $terrain == "urban">>the old world city surrounding the arcology<<else>>of the free city<</if>>, - <<elseif $battleTerrain == "rural">> + <<if $SecExp.war.terrain == "urban">> + in the streets of <<if $SecExp.war.terrain == "urban">>the old world city surrounding the arcology<<else>>of the free city<</if>>, + <<elseif $SecExp.war.terrain == "rural">> in the rural land surrounding the free city, - <<elseif $battleTerrain == "hills">> + <<elseif $SecExp.war.terrain == "hills">> on the hills around the free city, - <<elseif $battleTerrain == "coast">> + <<elseif $SecExp.war.terrain == "coast">> along the coast just outside the free city, - <<elseif $battleTerrain == "outskirts">> + <<elseif $SecExp.war.terrain == "outskirts">> just against the walls of the arcology, - <<elseif $battleTerrain == "mountains">> + <<elseif $SecExp.war.terrain == "mountains">> in the mountains overlooking the arcology, - <<elseif $battleTerrain == "wasteland">> + <<elseif $SecExp.war.terrain == "wasteland">> in the wastelands outside the free city territory, <</if>> - <<if $enemyLosses != $attackTroops>> - inflicting <<print $enemyLosses>> casualties, while sustaining <<if $losses > 1>> <<print num(Math.trunc($losses))>> casualties <<elseif $losses > 0>> a casualty <<else>> zero <</if>> themselves. + <<if $SecExp.war.attacker.losses != $SecExp.war.attacker.troops>> + inflicting <<print $SecExp.war.attacker.losses>> casualties, while sustaining <<if $SecExp.war.losses > 1>> <<print num(Math.trunc($SecExp.war.losses))>> casualties <<elseif $SecExp.war.losses > 0>> a casualty <<else>> zero <</if>> themselves. <<else>> - completely annihilating their troops, while sustaining <<if $losses > 1>> <<print num(Math.trunc($losses))>> casualties. <<elseif $losses > 0>> a casualty.<<else>> zero casualties.<</if>> + completely annihilating their troops, while sustaining <<if $SecExp.war.losses > 1>> <<print num(Math.trunc($SecExp.war.losses))>> casualties. <<elseif $SecExp.war.losses > 0>> a casualty.<<else>> zero casualties.<</if>> <</if>> <</if>> - <<if $battleResult == 3>> - <<if $battleTurns <= 5>> + <<if $SecExp.war.result == 3>> + <<if $SecExp.war.turns <= 5>> The fight was quick and one sided, our men easily stopped the mercenaries dead in their tracks<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> - <<elseif $battleTurns <= 7>> + <<elseif $SecExp.war.turns <= 7>> The fight was hard, but in the end our men stopped the slavers attempt at weakening your arcology<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> <<else>> The fight was long and hard, but our men managed to stop the free city mercenaries<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> @@ -148,10 +148,10 @@ <<elseif $SecExp.battles.lossStreak >= 2>> finally putting an end to a series of unfortunate defeats. <</if>> - <<elseif $battleResult == -3>> - <<if $battleTurns <= 5>> + <<elseif $SecExp.war.result == -3>> + <<if $SecExp.war.turns <= 5>> The fight was quick and one sided, our men were easily crushed by the consumed mercenary veterans sent against us<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> - <<elseif $battleTurns <= 7>> + <<elseif $SecExp.war.turns <= 7>> The fight was hard and in the end the slavers proved too much to handle for our men<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> <<else>> The fight was long and hard, but despite their bravery the mercenary slavers proved too much for our men<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> @@ -161,46 +161,46 @@ <<elseif $SecExp.battles.lossStreak >= 2>> confirming the long list of recent failures our armed forces collected. <</if>> - <<elseif $battleResult == 2>> + <<elseif $SecExp.war.result == 2>> The fight was long and hard, but in the end our men managed to repel the mercenaries, though not without difficulty. - <<elseif $battleResult == -2>> + <<elseif $SecExp.war.result == -2>> 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. - <<elseif $battleResult == -1>> + <<elseif $SecExp.war.result == -1>> You gave your troops the order to surrender, obediently they stand down. - <<elseif $battleResult == 0>> + <<elseif $SecExp.war.result == 0>> You decided in favor of a financial approach rather than open hostilities. Your troops remain inside the arcology's walls. - <<elseif $battleResult == 1>> + <<elseif $SecExp.war.result == 1>> You decided in favor of a financial approach rather than open hostilities. Your troops remain inside the arcology's walls. <</if>> -<<elseif $attackType == "freedom fighters">> - Today, <<= asDateString($week, random(0,7))>>, our arcology was attacked by a group of freedom fighters bent on the destruction of the institution of slavery, <<print num(Math.trunc($attackTroops))>> men strong. - <<if $battleResult != 1 && $battleResult != 0 && $battleResult != -1>> +<<elseif $SecExp.war.attacker.type == "freedom fighters">> + Today, <<= asDateString($week, random(0,7))>>, our arcology was attacked by a group of freedom fighters bent on the destruction of the institution of slavery, <<print num(Math.trunc($SecExp.war.attacker.troops))>> men strong. + <<if $SecExp.war.result != 1 && $SecExp.war.result != 0 && $SecExp.war.result != -1>> Our defense forces, <<print num(Math.trunc(App.SecExp.battle.troopCount()))>> strong, clashed with them - <<if $battleTerrain == "urban">> - in the streets of <<if $terrain == "urban">>the old world city surrounding the arcology<<else>>of the free city<</if>>, - <<elseif $battleTerrain == "rural">> + <<if $SecExp.war.terrain == "urban">> + in the streets of <<if $SecExp.war.terrain == "urban">>the old world city surrounding the arcology<<else>>of the free city<</if>>, + <<elseif $SecExp.war.terrain == "rural">> in the rural land surrounding the free city, - <<elseif $battleTerrain == "hills">> + <<elseif $SecExp.war.terrain == "hills">> on the hills around the free city, - <<elseif $battleTerrain == "coast">> + <<elseif $SecExp.war.terrain == "coast">> along the coast just outside the free city, - <<elseif $battleTerrain == "outskirts">> + <<elseif $SecExp.war.terrain == "outskirts">> just against the walls of the arcology, - <<elseif $battleTerrain == "mountains">> + <<elseif $SecExp.war.terrain == "mountains">> in the mountains overlooking the arcology, - <<elseif $battleTerrain == "wasteland">> + <<elseif $SecExp.war.terrain == "wasteland">> in the wastelands outside the free city territory, <</if>> - <<if $enemyLosses != $attackTroops>> - inflicting <<print $enemyLosses>> casualties, while sustaining <<if $losses > 1>> <<print num(Math.trunc($losses))>> casualties <<elseif $losses > 0>> a casualty <<else>> zero <</if>> themselves. + <<if $SecExp.war.attacker.losses != $SecExp.war.attacker.troops>> + inflicting <<print $SecExp.war.attacker.losses>> casualties, while sustaining <<if $SecExp.war.losses > 1>> <<print num(Math.trunc($SecExp.war.losses))>> casualties <<elseif $SecExp.war.losses > 0>> a casualty <<else>> zero <</if>> themselves. <<else>> - completely annihilating their troops, while sustaining <<if $losses > 1>> <<print num(Math.trunc($losses))>> casualties. <<elseif $losses > 0>> a casualty. <<else>> zero casualties.<</if>> + completely annihilating their troops, while sustaining <<if $SecExp.war.losses > 1>> <<print num(Math.trunc($SecExp.war.losses))>> casualties. <<elseif $SecExp.war.losses > 0>> a casualty. <<else>> zero casualties.<</if>> <</if>> <</if>> - <<if $battleResult == 3>> - <<if $battleTurns <= 5>> + <<if $SecExp.war.result == 3>> + <<if $SecExp.war.turns <= 5>> The fight was quick and one sided, our men easily stopped the freedom fighters dead in their tracks<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> - <<elseif $battleTurns <= 7>> + <<elseif $SecExp.war.turns <= 7>> The fight was hard, but in the end our men stopped the fighters attack<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> <<else>> The fight was long and hard, but our men managed to stop the freedom fighters<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> @@ -210,10 +210,10 @@ <<elseif $SecExp.battles.lossStreak >= 2>> finally putting an end to a series of unfortunate defeats. <</if>> - <<elseif $battleResult == -3>> - <<if $battleTurns <= 5>> + <<elseif $SecExp.war.result == -3>> + <<if $SecExp.war.turns <= 5>> The fight was quick and one sided, our men were easily crushed by the fanatical fury of the freedom fighters<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> - <<elseif $battleTurns <= 7>> + <<elseif $SecExp.war.turns <= 7>> The fight was hard and in the end the freedom fighters proved too much to handle for our men<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> <<else>> The fight was long and hard, but despite their bravery the freedom fighters fury proved too much for our men<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> @@ -223,46 +223,46 @@ <<elseif $SecExp.battles.lossStreak >= 2>> confirming the long list of recent failures our armed forces collected. <</if>> - <<elseif $battleResult == 2>> + <<elseif $SecExp.war.result == 2>> The fight was long and hard, but in the end our men managed to repel the freedom fighters, though not without difficulty. - <<elseif $battleResult == -2>> + <<elseif $SecExp.war.result == -2>> 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. - <<elseif $battleResult == -1>> + <<elseif $SecExp.war.result == -1>> You gave your troops the order to surrender, obediently they stand down. - <<elseif $battleResult == 0>> + <<elseif $SecExp.war.result == 0>> You decided in favor of a financial approach rather than open hostilities. Your troops remain inside the arcology's walls. - <<elseif $battleResult == 1>> + <<elseif $SecExp.war.result == 1>> You decided in favor of a financial approach rather than open hostilities. Your troops remain inside the arcology's walls. <</if>> -<<elseif $attackType == "old world">> - Today, <<= asDateString($week, random(0,7))>>, our arcology was attacked by an old world nation boasting a misplaced sense of superiority, <<print num(Math.trunc($attackTroops))>> men strong. - <<if $battleResult != 1 && $battleResult != 0 && $battleResult != -1>> +<<elseif $SecExp.war.attacker.type == "old world">> + Today, <<= asDateString($week, random(0,7))>>, our arcology was attacked by an old world nation boasting a misplaced sense of superiority, <<print num(Math.trunc($SecExp.war.attacker.troops))>> men strong. + <<if $SecExp.war.result != 1 && $SecExp.war.result != 0 && $SecExp.war.result != -1>> Our defense forces, <<print num(Math.trunc(App.SecExp.battle.troopCount()))>> strong, clashed with them - <<if $battleTerrain == "urban">> - in the streets of <<if $terrain == "urban">>the old world city surrounding the arcology<<else>>of the free city<</if>>, - <<elseif $battleTerrain == "rural">> + <<if $SecExp.war.terrain == "urban">> + in the streets of <<if $SecExp.war.terrain == "urban">>the old world city surrounding the arcology<<else>>of the free city<</if>>, + <<elseif $SecExp.war.terrain == "rural">> in the rural land surrounding the free city, - <<elseif $battleTerrain == "hills">> + <<elseif $SecExp.war.terrain == "hills">> on the hills around the free city, - <<elseif $battleTerrain == "coast">> + <<elseif $SecExp.war.terrain == "coast">> along the coast just outside the free city, - <<elseif $battleTerrain == "outskirts">> + <<elseif $SecExp.war.terrain == "outskirts">> just against the walls of the arcology, - <<elseif $battleTerrain == "mountains">> + <<elseif $SecExp.war.terrain == "mountains">> in the mountains overlooking the arcology, - <<elseif $battleTerrain == "wasteland">> + <<elseif $SecExp.war.terrain == "wasteland">> in the wastelands outside the free city territory, <</if>> - <<if $enemyLosses != $attackTroops>> - inflicting <<print $enemyLosses>> casualties, while sustaining <<if $losses > 1>> <<print num(Math.trunc($losses))>> casualties <<elseif $losses > 0>> a casualty <<else>> zero <</if>> themselves. + <<if $SecExp.war.attacker.losses != $SecExp.war.attacker.troops>> + inflicting <<print $SecExp.war.attacker.losses>> casualties, while sustaining <<if $SecExp.war.losses > 1>> <<print num(Math.trunc($SecExp.war.losses))>> casualties <<elseif $SecExp.war.losses > 0>> a casualty <<else>> zero <</if>> themselves. <<else>> - completely annihilating their troops, while sustaining <<if $losses > 1>> <<print num(Math.trunc($losses))>> casualties. <<elseif $losses > 0>> a casualty. <<else>> zero casualties.<</if>> + completely annihilating their troops, while sustaining <<if $SecExp.war.losses > 1>> <<print num(Math.trunc($SecExp.war.losses))>> casualties. <<elseif $SecExp.war.losses > 0>> a casualty. <<else>> zero casualties.<</if>> <</if>> <</if>> - <<if $battleResult == 3>> - <<if $battleTurns <= 5>> + <<if $SecExp.war.result == 3>> + <<if $SecExp.war.turns <= 5>> The fight was quick and one sided, our men easily stopped the old world soldiers dead in their tracks<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> - <<elseif $battleTurns <= 7>> + <<elseif $SecExp.war.turns <= 7>> The fight was hard, but in the end our men stopped the soldiers of the old world<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> <<else>> The fight was long and hard, but our men managed to stop the old world soldiers<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> @@ -272,10 +272,10 @@ <<elseif $SecExp.battles.lossStreak >= 2>> finally putting an end to a series of unfortunate defeats. <</if>> - <<elseif $battleResult == -3>> - <<if $battleTurns <= 5>> + <<elseif $SecExp.war.result == -3>> + <<if $SecExp.war.turns <= 5>> The fight was quick and one sided, our men were easily crushed by the discipline of the old world armies<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> - <<elseif $battleTurns <= 7>> + <<elseif $SecExp.war.turns <= 7>> The fight was hard and in the end the old world proved too much to handle for our men<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> <<else>> The fight was long and hard, but despite their bravery the determination of the old world troops proved too much for our men<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> @@ -285,65 +285,65 @@ <<elseif $SecExp.battles.lossStreak >= 2>> confirming the long list of recent failures our armed forces collected. <</if>> - <<elseif $battleResult == 2>> + <<elseif $SecExp.war.result == 2>> The fight was long and hard, but in the end our men managed to repel the old world soldiers, though not without difficulty. - <<elseif $battleResult == -2>> + <<elseif $SecExp.war.result == -2>> 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. - <<elseif $battleResult == -1>> + <<elseif $SecExp.war.result == -1>> You gave your troops the order to surrender, obediently they stand down. - <<elseif $battleResult == 0>> + <<elseif $SecExp.war.result == 0>> You decided in favor of a financial approach rather than open hostilities. Your troops remain inside the arcology's walls. - <<elseif $battleResult == 1>> + <<elseif $SecExp.war.result == 1>> You decided in favor of a financial approach rather than open hostilities. Your troops remain inside the arcology's walls. <</if>> <</if>> <br><br> /* calculates effects on the city */ -<<if $battleResult == 3>> +<<if $SecExp.war.result == 3>> Thanks to your victory, your @@.green;reputation@@ and @@.darkviolet;authority@@ increased. You were also able to capture - <<if $attackType == "raiders">> + <<if $SecExp.war.attacker.type == "raiders">> <<run repX(4000 * _majorBattleMod, "war")>> <<set $SecExp.core.authority += 800 * _majorBattleMod>> - <<elseif $attackType == "free city">> + <<elseif $SecExp.war.attacker.type == "free city">> <<run repX(6000 * _majorBattleMod, "war")>> <<set $SecExp.core.authority += 1200 * _majorBattleMod>> - <<elseif $attackType == "freedom fighters">> + <<elseif $SecExp.war.attacker.type == "freedom fighters">> <<run repX(7500 * _majorBattleMod, "war")>> <<set $SecExp.core.authority += 1500 * _majorBattleMod>> - <<elseif $attackType == "old world">> + <<elseif $SecExp.war.attacker.type == "old world">> <<run repX(6000 * _majorBattleMod, "war")>> <<set $SecExp.core.authority += 1200 * _majorBattleMod>> <</if>> - <<if $attackTroops - $enemyLosses <= 50>> + <<if $SecExp.war.attacker.troops - $SecExp.war.attacker.losses <= 50>> a small amount of attackers, - <<set _captives = ($attackTroops - $enemyLosses) * 0.1 * random(1,3)>> - <<elseif $attackTroops - $enemyLosses <= 100>> + <<set _captives = ($SecExp.war.attacker.troops - $SecExp.war.attacker.losses) * 0.1 * random(1,3)>> + <<elseif $SecExp.war.attacker.troops - $SecExp.war.attacker.losses <= 100>> an healthy group of attackers, - <<set _captives = ($attackTroops - $enemyLosses) * 0.1 * random(1,3)>> - <<elseif $attackTroops - $enemyLosses <= 150>> + <<set _captives = ($SecExp.war.attacker.troops - $SecExp.war.attacker.losses) * 0.1 * random(1,3)>> + <<elseif $SecExp.war.attacker.troops - $SecExp.war.attacker.losses <= 150>> a big group of attackers, - <<set _captives = ($attackTroops - $enemyLosses) * 0.1 * random(1,3)>> - <<elseif $attackTroops - $enemyLosses <= 200>> + <<set _captives = ($SecExp.war.attacker.troops - $SecExp.war.attacker.losses) * 0.1 * random(1,3)>> + <<elseif $SecExp.war.attacker.troops - $SecExp.war.attacker.losses <= 200>> a huge group of attackers, - <<set _captives = ($attackTroops - $enemyLosses) * 0.1 * random(1,3)>> - <<elseif $attackTroops - $enemyLosses > 200>> + <<set _captives = ($SecExp.war.attacker.troops - $SecExp.war.attacker.losses) * 0.1 * random(1,3)>> + <<elseif $SecExp.war.attacker.troops - $SecExp.war.attacker.losses > 200>> a great amount of attackers, - <<set _captives = ($attackTroops - $enemyLosses) * 0.1 * random(1,3)>> + <<set _captives = ($SecExp.war.attacker.troops - $SecExp.war.attacker.losses) * 0.1 * random(1,3)>> <</if>> and some of their equipment, which once sold produced - <<if $attackEquip == 0>> + <<if $SecExp.war.attacker.equip == 0>> @@.yellowgreen;a small amount of cash.@@ <<set _loot += 1000 * _majorBattleMod>> - <<elseif $attackEquip == 1>> + <<elseif $SecExp.war.attacker.equip == 1>> @@.yellowgreen;a moderate amount of cash.@@ <<set _loot += 5000 * _majorBattleMod>> - <<elseif $attackEquip == 2>> + <<elseif $SecExp.war.attacker.equip == 2>> @@.yellowgreen;a good amount of cash.@@ <<set _loot += 10000 * _majorBattleMod>> - <<elseif $attackEquip == 3>> + <<elseif $SecExp.war.attacker.equip == 3>> @@.yellowgreen;a great amount of cash.@@ <<set _loot += 15000 * _majorBattleMod>> - <<elseif $attackEquip == 4>> + <<elseif $SecExp.war.attacker.equip == 4>> @@.yellowgreen;wealth worthy of the mightiest warlord.@@ <<set _loot += 20000 * _majorBattleMod>> <</if>> @@ -361,18 +361,18 @@ It seems your victories over the constant threats directed your way is having @@.green;a positive effect on the prosperity of the arcology,@@ due to the security your leadership affords. <<set $arcologies[0].prosperity += 5 * _majorBattleMod>> <</if>> -<<elseif $battleResult == -3>> +<<elseif $SecExp.war.result == -3>> Due to your defeat, your @@.red;reputation@@ and @@.red;authority@@ decreased. Obviously your troops were not able to capture anyone or anything. - <<if $attackType == "raiders">> + <<if $SecExp.war.attacker.type == "raiders">> <<run repX(forceNeg(400 * _majorBattleMod), "war")>> <<set $SecExp.core.authority -= 400 * _majorBattleMod>> - <<elseif $attackType == "free city">> + <<elseif $SecExp.war.attacker.type == "free city">> <<run repX(forceNeg(600 * _majorBattleMod), "war")>> <<set $SecExp.core.authority -= 600 * _majorBattleMod>> - <<elseif $attackType == "freedom fighters">> + <<elseif $SecExp.war.attacker.type == "freedom fighters">> <<run repX(forceNeg(750 * _majorBattleMod), "war")>> <<set $SecExp.core.authority -= 750 * _majorBattleMod>> - <<elseif $attackType == "old world">> + <<elseif $SecExp.war.attacker.type == "old world">> <<run repX(forceNeg(600 * _majorBattleMod), "war")>> <<set $SecExp.core.authority -= 600 * _majorBattleMod>> <</if>> @@ -425,35 +425,35 @@ This only confirms the fears of many, @@.red;your arcology is not safe@@ and it is clear their business will be better somewhere else. <<set $arcologies[0].prosperity -= 5 * _majorBattleMod>> <</if>> -<<elseif $battleResult == 2>> +<<elseif $SecExp.war.result == 2>> Thanks to your victory, your @@.green;reputation@@ and @@.darkviolet;authority@@ slightly increased. Our men were not able to capture any combatants, however some equipment was seized during the enemy's hasty retreat, - <<if $attackType == "raiders">> + <<if $SecExp.war.attacker.type == "raiders">> <<run repX(1000 * _majorBattleMod, "war")>> <<set $SecExp.core.authority += 200 * _majorBattleMod>> - <<elseif $attackType == "free city">> + <<elseif $SecExp.war.attacker.type == "free city">> <<run repX(1500 * _majorBattleMod, "war")>> <<set $SecExp.core.authority += 300 * _majorBattleMod>> - <<elseif $attackType == "freedom fighters">> + <<elseif $SecExp.war.attacker.type == "freedom fighters">> <<run repX(2000 * _majorBattleMod, "war")>> <<set $SecExp.core.authority += 450 * _majorBattleMod>> - <<elseif $attackType == "old world">> + <<elseif $SecExp.war.attacker.type == "old world">> <<run repX(1500 * _majorBattleMod, "war")>> <<set $SecExp.core.authority += 300 * _majorBattleMod>> <</if>> which once sold produced - <<if $attackEquip == 0>> + <<if $SecExp.war.attacker.equip == 0>> @@.yellowgreen;a bit of cash.@@ <<set _loot += 500 * _majorBattleMod>> - <<elseif $attackEquip == 1>> + <<elseif $SecExp.war.attacker.equip == 1>> @@.yellowgreen;a small amount of cash.@@ <<set _loot += 2500 * _majorBattleMod>> - <<elseif $attackEquip == 2>> + <<elseif $SecExp.war.attacker.equip == 2>> @@.yellowgreen;a moderate amount of cash.@@ <<set _loot += 5000 * _majorBattleMod>> - <<elseif $attackEquip == 3>> + <<elseif $SecExp.war.attacker.equip == 3>> @@.yellowgreen;a good amount of cash.@@ <<set _loot += 7500 * _majorBattleMod>> - <<elseif $attackEquip == 4>> + <<elseif $SecExp.war.attacker.equip == 4>> @@.yellowgreen;a great amount of cash.@@ <<set _loot += 10000 * _majorBattleMod>> <</if>> @@ -472,18 +472,18 @@ $menials -= Math.trunc(($menials / $ASlaves) * _lostSlaves), $fuckdolls -= Math.trunc(($fuckdolls / $ASlaves) * _lostSlaves), $menialBioreactors -= Math.trunc(($menialBioreactors / $ASlaves) * _lostSlaves)>> -<<elseif $battleResult == -2>> +<<elseif $SecExp.war.result == -2>> It was a close defeat, but nonetheless your @@.red;reputation@@ and @@.red;authority@@ slightly decreased. Your troops were not able to capture anyone or anything. - <<if $attackType == "raiders">> + <<if $SecExp.war.attacker.type == "raiders">> <<run repX(forceNeg(40 * _majorBattleMod), "war")>> <<set $SecExp.core.authority -= 40 * _majorBattleMod>> - <<elseif $attackType == "free city">> + <<elseif $SecExp.war.attacker.type == "free city">> <<run repX(forceNeg(60 * _majorBattleMod), "war")>> <<set $SecExp.core.authority -= 60 * _majorBattleMod>> - <<elseif $attackType == "freedom fighters">> + <<elseif $SecExp.war.attacker.type == "freedom fighters">> <<run repX(forceNeg(75 * _majorBattleMod), "war")>> <<set $SecExp.core.authority -= 75 * _majorBattleMod>> - <<elseif $attackType == "old world">> + <<elseif $SecExp.war.attacker.type == "old world">> <<run repX(forceNeg(60 * _majorBattleMod), "war")>> <<set $SecExp.core.authority -= 60 * _majorBattleMod>> <</if>> @@ -533,18 +533,18 @@ $menialBioreactors -= Math.trunc(($menialBioreactors / $ASlaves) * _lostSlaves)>> <<set $arcologies[0].prosperity -= random(12) * _majorBattleMod>> <</if>> -<<elseif $battleResult == -1>> +<<elseif $SecExp.war.result == -1>> Rather than waste the lives of your men you decided to surrender, hoping your enemy will cause less damage if you indulge them, this is however a big hit to your status. Your @@.red;reputation@@ and @@.red;authority@@ are significantly impacted. - <<if $attackType == "raiders">> + <<if $SecExp.war.attacker.type == "raiders">> <<run repX(forceNeg(600 * _majorBattleMod), "war")>> <<set $SecExp.core.authority -= 600 * _majorBattleMod>> - <<elseif $attackType == "free city">> + <<elseif $SecExp.war.attacker.type == "free city">> <<run repX(forceNeg(800 * _majorBattleMod), "war")>> <<set $SecExp.core.authority -= 800 * _majorBattleMod>> - <<elseif $attackType == "freedom fighters">> + <<elseif $SecExp.war.attacker.type == "freedom fighters">> <<run repX(forceNeg(1000 * _majorBattleMod), "war")>> <<set $SecExp.core.authority -= 1000 * _majorBattleMod>> - <<elseif $attackType == "old world">> + <<elseif $SecExp.war.attacker.type == "old world">> <<run repX(forceNeg(800 * _majorBattleMod), "war")>> <<set $SecExp.core.authority -= 800 * _majorBattleMod>> <</if>> @@ -593,19 +593,19 @@ $menialBioreactors -= Math.trunc(($menialBioreactors / $ASlaves) * _lostSlaves)>> <<set $arcologies[0].prosperity -= random(25) * _majorBattleMod>> <</if>> -<<elseif $battleResult == 0>> - Unfortunately your adversary did not accept your money. <<if $attackType == "freedom fighters">> Their ideological crusade would not allow such thing<<else>>They saw your attempt as nothing more than admission of weakness<</if>>. There was no time to organize a defense and so the enemy walked into the arcology as it was his. +<<elseif $SecExp.war.result == 0>> + Unfortunately your adversary did not accept your money. <<if $SecExp.war.attacker.type == "freedom fighters">> Their ideological crusade would not allow such thing<<else>>They saw your attempt as nothing more than admission of weakness<</if>>. There was no time to organize a defense and so the enemy walked into the arcology as it was his. Your reputation and authority suffer a hit. - <<if $attackType == "raiders">> + <<if $SecExp.war.attacker.type == "raiders">> <<run repX(forceNeg(400 * _majorBattleMod), "war")>> <<set $SecExp.core.authority -= 400 * _majorBattleMod>> - <<elseif $attackType == "free city">> + <<elseif $SecExp.war.attacker.type == "free city">> <<run repX(forceNeg(600 * _majorBattleMod), "war")>> <<set $SecExp.core.authority -= 600 * _majorBattleMod>> - <<elseif $attackType == "freedom fighters">> + <<elseif $SecExp.war.attacker.type == "freedom fighters">> <<run repX(forceNeg(750 * _majorBattleMod), "war")>> <<set $SecExp.core.authority -= 750 * _majorBattleMod>> - <<elseif $attackType == "old world">> + <<elseif $SecExp.war.attacker.type == "old world">> <<run repX(forceNeg(600 * _majorBattleMod), "war")>> <<set $SecExp.core.authority -= 600 * _majorBattleMod>> <</if>> @@ -655,16 +655,16 @@ <<set $arcologies[0].prosperity -= random(25) * _majorBattleMod>> <</if>> <br> -<<elseif $battleResult == 1>> +<<elseif $SecExp.war.result == 1>> The attackers wisely take the money offered them to leave your territory without further issues. The strength of the Free Cities was never in their guns but in their dollars, and today's events are the perfect demonstration of such strength. Your @@.green;reputation slightly increases.@@ - <<if $attackType == "raiders">> + <<if $SecExp.war.attacker.type == "raiders">> <<run repX(500 * _majorBattleMod, "war")>> - <<elseif $attackType == "free city">> + <<elseif $SecExp.war.attacker.type == "free city">> <<run repX(750 * _majorBattleMod, "war")>> - <<elseif $attackType == "freedom fighters">> + <<elseif $SecExp.war.attacker.type == "freedom fighters">> <<run repX(1000 * _majorBattleMod, "war")>> - <<elseif $attackType == "old world">> + <<elseif $SecExp.war.attacker.type == "old world">> <<run repX(750 * _majorBattleMod, "war")>> <</if>> <<run cashX(forceNeg(App.SecExp.battle.bribeCost()), "war")>> @@ -689,10 +689,10 @@ <</if>> <br><br> -<<if $battleResult != 1 && $battleResult != 0 && $battleResult != -1>> +<<if $SecExp.war.result != 1 && $SecExp.war.result != 0 && $SecExp.war.result != -1>> /* leaders */ - <<if $leadingTroops == "PC">> + <<if $SecExp.war.commander == "PC">> <<setPlayerPronouns>> You decided to personally lead the defense of your arcology. <<if App.SecExp.battle.deployedUnits('militia') >= 1>> @@ -802,7 +802,7 @@ Your reputation is so high your name carries power by itself. Having you on the battlefield puts fear even in the hardiest of warriors. <</if>> <</if>> - <<if $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> + <<if $SF.Toggle && $SF.Active >= 1 && $SecExp.war.deploySF>> <<if $PC.career == "mercenary" || $PC.career == "slaver" || $PC.career == "capitalist" || $PC.career == "gang" || $PC.skill.warfare > 75>> The soldiers of $SF.Lower are ready and willing to follow you into battle, confident in your past experience. <<elseif $PC.career == "wealth" || $PC.career == "medicine" || $PC.career == "engineer">> @@ -824,13 +824,13 @@ <<elseif $PC.skill.warfare >= 75>> Your great experience in military matters has a major positive impact on your troops performance and the effectiveness of your battle plan. <</if>> - <<if $gainedWarfare == 1>> + <<if $SecExp.war.gainedWarfare>> Battlefield experience increased your understanding of warfare, making you a better commander. <</if>> <<if $PC.health.shortDamage >= 60>> During the fighting @@.red;you were wounded.@@ Your medics assure you it's nothing life threatening, but you'll be weakened for a few weeks. <</if>> - <<elseif $leadingTroops == "assistant">> + <<elseif $SecExp.war.commander == "assistant">> <<setAssistantPronouns>> <<if $auto == 1>>$assistant.name<<else>>You<</if>> let your personal assistant lead the troops. <<if App.SecExp.battle.deployedUnits('mercs') >= 1 || App.SecExp.battle.deployedUnits('militia') >= 1 || App.SecExp.battle.deployedUnits('slaves') >= 1>> @@ -852,7 +852,7 @@ <<elseif $assistant.power >= 3>> 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. <</if>> - <<elseif $leadingTroops == "bodyguard">> + <<elseif $SecExp.war.commander == "bodyguard">> <<setLocalPronouns _S.Bodyguard>> <<if $auto == 1>>$assistant.name<<else>>You<</if>> decided it will be your bodyguard that leads the troops. <<if App.SecExp.battle.deployedUnits('slaves') >= 1>> @@ -865,58 +865,58 @@ <<if _oldRep < 10000 && _oldAuth < 10000 || _S.Bodyguard.prestige < 1>> <<if App.SecExp.battle.deployedUnits('militia') >= 1>> Your volunteers <<if App.SecExp.battle.deployedUnits('slaves') >= 1>>however<</if>> are not enthusiastic to have a slave as a - <<if $SF.Toggle && $SF.Active >= 1 && App.SecExp.battle.deployedUnits('mercs') == 1 && $SFIntervention>> + <<if $SF.Toggle && $SF.Active >= 1 && App.SecExp.battle.deployedUnits('mercs') == 1 && $SecExp.war.deploySF>> commander, and neither are your mercenaries or your soldiers. <<elseif App.SecExp.battle.deployedUnits('mercs') >= 1>> commander, and neither are your mercenaries. - <<elseif $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> + <<elseif $SF.Toggle && $SF.Active >= 1 && $SecExp.war.deploySF>> commander, and neither are your soldiers. <<else>> commander. <</if>> - <<elseif $SF.Toggle && $SF.Active >= 1 && App.SecExp.battle.deployedUnits('mercs') == 1 && $SFIntervention>> + <<elseif $SF.Toggle && $SF.Active >= 1 && App.SecExp.battle.deployedUnits('mercs') == 1 && $SecExp.war.deploySF>> Your mercenaries and soldiers <<if App.SecExp.battle.deployedUnits('slaves') >= 1>>however<</if>> are not enthusiastic to have a slave as a commander. <<elseif App.SecExp.battle.deployedUnits('mercs') >= 1>> Your mercenaries <<if App.SecExp.battle.deployedUnits('slaves') >= 1>>however<</if>> are not enthusiastic to have a slave as a commander. - <<elseif $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> + <<elseif $SF.Toggle && $SF.Active >= 1 && $SecExp.war.deploySF>> Your soldiers <<if App.SecExp.battle.deployedUnits('slaves') >= 1>>however<</if>> are not enthusiastic to have a slave as a commander. <</if>> <<elseif _S.Bodyguard.prestige >= 2>> <<if App.SecExp.battle.deployedUnits('militia') >= 1>> Your - <<if App.SecExp.battle.deployedUnits('mercs') == 1 && $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> + <<if App.SecExp.battle.deployedUnits('mercs') == 1 && $SF.Toggle && $SF.Active >= 1 && $SecExp.war.deploySF>> volunteers, your mercenaries and your soldiers are delighted to have such a prestigious individual as their commander, almost forgetting $he is a slave. <<elseif App.SecExp.battle.deployedUnits('mercs') >= 1>> volunteers and your mercenaries are delighted to have such a prestigious individual as their commander, almost forgetting $he is a slave. - <<elseif $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> + <<elseif $SF.Toggle && $SF.Active >= 1 && $SecExp.war.deploySF>> volunteers and your soldiers are delighted to have such a prestigious individual as their commander, almost forgetting $he is a slave. <<else>> volunteers are delighted to have such a prestigious individual as their commander, almost forgetting $he is a slave. <</if>> - <<elseif App.SecExp.battle.deployedUnits('mercs') == 1 && $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> + <<elseif App.SecExp.battle.deployedUnits('mercs') == 1 && $SF.Toggle && $SF.Active >= 1 && $SecExp.war.deploySF>> Your mercenaries and soldiers are delighted to have such a prestigious individual as their commander, almost forgetting $he is a slave. <<elseif App.SecExp.battle.deployedUnits('mercs') >= 1>> Your mercenaries are delighted to have such a prestigious individual as their commander, almost forgetting $he is a slave. - <<elseif $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> + <<elseif $SF.Toggle && $SF.Active >= 1 && $SecExp.war.deploySF>> Your soldiers are delighted to have such a prestigious individual as their commander, almost forgetting $he is a slave. <</if>> <<else>> <<if App.SecExp.battle.deployedUnits('militia') >= 1>> Your volunteers <<if App.SecExp.battle.deployedUnits('slaves') >= 1>>however<</if>> are not enthusiastic to have a slave as a - <<if App.SecExp.battle.deployedUnits('mercs') == 1 && $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> + <<if App.SecExp.battle.deployedUnits('mercs') == 1 && $SF.Toggle && $SF.Active >= 1 && $SecExp.war.deploySF>> commander, and neither are your mercenaries and soldiers, but they trust you enough not to question your decision. <<elseif App.SecExp.battle.deployedUnits('mercs') >= 1>> commander, and neither are your mercenaries, but they trust you enough not to question your decision. - <<elseif $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> + <<elseif $SF.Toggle && $SF.Active >= 1 && $SecExp.war.deploySF>> commander, and neither are your soldiers, but they trust you enough not to question your decision. <<else>> commander, but they trust you enough not to question your decision. <</if>> - <<elseif App.SecExp.battle.deployedUnits('mercs') == 1 && $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> + <<elseif App.SecExp.battle.deployedUnits('mercs') == 1 && $SF.Toggle && $SF.Active >= 1 && $SecExp.war.deploySF>> Your mercenaries and soldiers <<if App.SecExp.battle.deployedUnits('slaves') >= 1>>however,<</if>> are not enthusiastic to have a slave as a commander, but they trust you enough not to question your decision. <<elseif App.SecExp.battle.deployedUnits('mercs') >= 1>> Your mercenaries <<if App.SecExp.battle.deployedUnits('slaves') >= 1>>however,<</if>> are not enthusiastic to have a slave as a commander, but they trust you enough not to question your decision. - <<elseif $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> + <<elseif $SF.Toggle && $SF.Active >= 1 && $SecExp.war.deploySF>> Your soldiers <<if App.SecExp.battle.deployedUnits('slaves') >= 1>>however,<</if>> are not enthusiastic to have a slave as a commander, but they trust you enough not to question your decision. <</if>> <</if>> @@ -943,10 +943,10 @@ <<elseif _BGTotalIntelligence < -15>> $He lacks the experience and the intelligence to be an effective commander, the performance of your troops suffers because of $his poor leadership. <</if>> - <<if $gainedCombat == 1>> + <<if $SecExp.war.gainedCombat>> During the battle, $he had to fight for $his life, giving $him experience in modern combat. $He is now proficient with modern firearms and hand to hand combat. <</if>> - <<if $leaderWounded == 1>> + <<if $SecExp.war.leaderWounded>> Unfortunately, @@.red;$he sustained major injuries.@@ <<set _woundType = App.SecExp.inflictBattleWound(_S.Bodyguard)>> <<if _woundType == "voice">> @@ -962,7 +962,7 @@ <</if>> Your troops were greatly affected by the loss of their leader. <</if>> - <<if $battleResult == 3 && $SecExp.settings.battle.allowSlavePrestige == 1>> + <<if $SecExp.war.result == 3 && $SecExp.settings.battle.allowSlavePrestige == 1>> <<set _found = 0>> <<for _i = 0; _i < $SecExp.battles.slaveVictories.length; _i++>> <<if $SecExp.battles.slaveVictories[_i].ID == $BodyguardID>> @@ -990,7 +990,7 @@ <<set $SecExp.battles.slaveVictories.push(_newSlave)>> <</if>> <</if>> - <<elseif $leadingTroops == "headGirl">> + <<elseif $SecExp.war.commander == "headGirl">> <<setLocalPronouns _S.HeadGirl>> <<if $auto == 1>>$assistant.name<<else>>You<</if>> decided it will be your Head Girl that leads the troops. <<if App.SecExp.battle.deployedUnits('slaves') >= 1>> @@ -1003,58 +1003,58 @@ <<if _oldRep < 10000 && _oldAuth < 10000 || _S.HeadGirl.prestige < 1>> <<if App.SecExp.battle.deployedUnits('militia') >= 1>> Your volunteers <<if App.SecExp.battle.deployedUnits('slaves') >= 1>>however<</if>> are not enthusiastic to have a slave as a - <<if App.SecExp.battle.deployedUnits('mercs') == 1 && $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> + <<if App.SecExp.battle.deployedUnits('mercs') == 1 && $SF.Toggle && $SF.Active >= 1 && $SecExp.war.deploySF>> commander, and neither are your mercenaries or your soldiers. <<elseif App.SecExp.battle.deployedUnits('mercs') >= 1>> commander, and neither are your mercenaries. - <<elseif $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> + <<elseif $SF.Toggle && $SF.Active >= 1 && $SecExp.war.deploySF>> commander, and neither are your soldiers. <<else>> commander. <</if>> - <<elseif App.SecExp.battle.deployedUnits('mercs') == 1 && $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> + <<elseif App.SecExp.battle.deployedUnits('mercs') == 1 && $SF.Toggle && $SF.Active >= 1 && $SecExp.war.deploySF>> Your mercenaries and soldiers <<if App.SecExp.battle.deployedUnits('slaves') >= 1>>however<</if>> are not enthusiastic to have a slave as a commander. <<elseif App.SecExp.battle.deployedUnits('mercs') >= 1>> Your mercenaries <<if App.SecExp.battle.deployedUnits('slaves') >= 1>>however<</if>> are not enthusiastic to have a slave as a commander. - <<elseif $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> + <<elseif $SF.Toggle && $SF.Active >= 1 && $SecExp.war.deploySF>> Your soldiers <<if App.SecExp.battle.deployedUnits('slaves') >= 1>>however<</if>> are not enthusiastic to have a slave as a commander. <</if>> <<elseif _S.HeadGirl.prestige >= 2>> <<if App.SecExp.battle.deployedUnits('militia') >= 1>> Your - <<if App.SecExp.battle.deployedUnits('mercs') == 1 && $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> + <<if App.SecExp.battle.deployedUnits('mercs') == 1 && $SF.Toggle && $SF.Active >= 1 && $SecExp.war.deploySF>> volunteers, your mercenaries and your soldiers are delighted to have such a prestigious individual as their commander, almost forgetting $he is a slave. <<elseif App.SecExp.battle.deployedUnits('mercs') >= 1>> volunteers and your mercenaries are delighted to have such a prestigious individual as their commander, almost forgetting $he is a slave. - <<elseif $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> + <<elseif $SF.Toggle && $SF.Active >= 1 && $SecExp.war.deploySF>> volunteers and your soldiers are delighted to have such a prestigious individual as their commander, almost forgetting $he is a slave. <<else>> volunteers are delighted to have such a prestigious individual as their commander, almost forgetting $he is a slave. <</if>> - <<elseif App.SecExp.battle.deployedUnits('mercs') == 1 && $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> + <<elseif App.SecExp.battle.deployedUnits('mercs') == 1 && $SF.Toggle && $SF.Active >= 1 && $SecExp.war.deploySF>> Your mercenaries and soldiers are delighted to have such a prestigious individual as their commander, almost forgetting $he is a slave. <<elseif App.SecExp.battle.deployedUnits('mercs') >= 1>> Your mercenaries are delighted to have such a prestigious individual as their commander, almost forgetting $he is a slave. - <<elseif $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> + <<elseif $SF.Toggle && $SF.Active >= 1 && $SecExp.war.deploySF>> Your soldiers are delighted to have such a prestigious individual as their commander, almost forgetting $he is a slave. <</if>> <<else>> <<if App.SecExp.battle.deployedUnits('militia') >= 1>> Your volunteers <<if App.SecExp.battle.deployedUnits('slaves') >= 1>>however<</if>> are not enthusiastic to have a slave as a - <<if App.SecExp.battle.deployedUnits('mercs') == 1 && $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> + <<if App.SecExp.battle.deployedUnits('mercs') == 1 && $SF.Toggle && $SF.Active >= 1 && $SecExp.war.deploySF>> commander, and neither are your mercenaries and soldiers, but they trust you enough not to question your decision. <<elseif App.SecExp.battle.deployedUnits('mercs') >= 1>> commander, and neither are your mercenaries, but they trust you enough not to question your decision. - <<elseif $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> + <<elseif $SF.Toggle && $SF.Active >= 1 && $SecExp.war.deploySF>> commander, and neither are your soldiers, but they trust you enough not to question your decision. <<else>> commander, but they trust you enough not to question your decision. <</if>> - <<elseif App.SecExp.battle.deployedUnits('mercs') == 1 && $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> + <<elseif App.SecExp.battle.deployedUnits('mercs') == 1 && $SF.Toggle && $SF.Active >= 1 && $SecExp.war.deploySF>> Your mercenaries and soldiers <<if App.SecExp.battle.deployedUnits('slaves') >= 1>>however<</if>> are not enthusiastic to have a slave as a commander, but they trust you enough not to question your decision. <<elseif App.SecExp.battle.deployedUnits('mercs') >= 1>> Your mercenaries <<if App.SecExp.battle.deployedUnits('slaves') >= 1>>however<</if>> are not enthusiastic to have a slave as a commander, but they trust you enough not to question your decision. - <<elseif $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> + <<elseif $SF.Toggle && $SF.Active >= 1 && $SecExp.war.deploySF>> Your soldiers <<if App.SecExp.battle.deployedUnits('slaves') >= 1>>however<</if>> are not enthusiastic to have a slave as a commander, but they trust you enough not to question your decision. <</if>> <</if>> @@ -1079,10 +1079,10 @@ <<elseif _S.HeadGirl.intelligence+_S.HeadGirl.intelligenceImplant < -15>> $He lacks the experience and the intelligence to be an effective commander, the performance of your troops suffers because of $his poor leadership. <</if>> - <<if $gainedCombat == 1>> + <<if $SecExp.war.gainedCombat>> During the battle, $he had to fight for $his life, giving $him experience in modern combat. $He is now proficient with modern firearms and hand to hand combat. <</if>> - <<if $leaderWounded == 1>> + <<if $SecExp.war.leaderWounded>> Unfortunately, @@.red;$he sustained major injuries.@@ <<set _woundType = App.SecExp.inflictBattleWound(_S.Bodyguard)>> <<if _woundType == "voice">> @@ -1098,7 +1098,7 @@ <</if>> Your troops were greatly affected by the loss of their leader. <</if>> - <<if $battleResult == 3 && $SecExp.settings.battle.allowSlavePrestige == 1>> + <<if $SecExp.war.result == 3 && $SecExp.settings.battle.allowSlavePrestige == 1>> <<set _found = 0>> <<for _i = 0; _i < $SecExp.battles.slaveVictories.length; _i++>> <<if $SecExp.battles.slaveVictories[_i].ID == $HeadGirlID>> @@ -1126,7 +1126,7 @@ <<set $SecExp.battles.slaveVictories.push(_newSlave)>> <</if>> <</if>> - <<elseif $leadingTroops == "citizen">> + <<elseif $SecExp.war.commander == "citizen">> <<if $auto == 1>>$assistant.name<<else>>You<</if>> decided to appoint one of your volunteers as the commander. <<if $arcologies[0].FSDegradationist == "unset" && $arcologies[0].FSPaternalist == "unset">> <<if App.SecExp.battle.deployedUnits('militia') >= 1>> @@ -1157,22 +1157,22 @@ <<elseif App.SecExp.battle.deployedUnits('mercs') >= 1>> Your mercenaries are not thrilled to be lead by a civilian without any formal martial training or education. <</if>> - <<if $arcologies[0].FSRomanRevivalist != "unset" && $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> + <<if $arcologies[0].FSRomanRevivalist != "unset" && $SF.Toggle && $SF.Active >= 1 && $SecExp.war.deploySF>> Since you decided to revive old Rome, many of your citizens took on themselves to educate themselves in martial matters, because of this your soldiers feel safe enough in the hands of one of your volunteers. <<elseif $arcologies[0].FSNeoImperialist != "unset" && App.SecExp.battle.deployedUnits('mercs') >= 1>> Since having institued an Imperial society, your citizens have become adept at modern warfare and the line soldiers feel much more comfortable being commanded by one of your Imperial Knights. - <<elseif $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> + <<elseif $SF.Toggle && $SF.Active >= 1 && $SecExp.war.deploySF>> You soldiers are not thrilled to be lead by a civilian without any formal martial training or education. <</if>> - <<if $leaderWounded == 1>> + <<if $SecExp.war.leaderWounded>> During the battle a stray bullet managed to reach the leader. Your troops were greatly affected by the loss. <</if>> - <<elseif $leadingTroops == "mercenary">> + <<elseif $SecExp.war.commander == "mercenary">> <<if $auto == 1>>$assistant.name<<else>>You<</if>> decided to appoint one of your mercenary officers as the commander. <<if App.SecExp.battle.deployedUnits('mercs') >= 1>> Your mercenaries of course approve of your decision. <</if>> - <<if $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> + <<if $SF.Toggle && $SF.Active >= 1 && $SecExp.war.deploySF>> Your soldiers feel more confident going into battle with an experienced commander. <</if>> <<if $arcologies[0].FSRomanRevivalist != "unset" && App.SecExp.battle.deployedUnits('militia') >= 1>> @@ -1183,15 +1183,15 @@ <<if $arcologies[0].FSDegradationist != "unset" && App.SecExp.battle.deployedUnits('slaves') >= 1>> Because of your degradationist society, your slave soldiers are highly distrustful of the gun for hire you forced them to accept as leader. <</if>> - <<if $leaderWounded == 1>> + <<if $SecExp.war.leaderWounded>> During the battle a stray bullet managed to reach the mercenary. Your troops were greatly affected by the loss of their leader. <</if>> - <<elseif $leadingTroops == "colonel">> + <<elseif $SecExp.war.commander == "colonel">> <<if $auto == 1>>$assistant.name<<else>>You<</if>> decided to appoint The Colonel as the commander. <<if App.SecExp.battle.deployedUnits('mercs') >= 1>> Your mercenaries approve of such decisions, as they feel more confident by having a good, experienced commander. <</if>> - <<if $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> + <<if $SF.Toggle && $SF.Active >= 1 && $SecExp.war.deploySF>> The soldiers of $SF.Lower obviously approved of your decision. <</if>> <<if $arcologies[0].FSRomanRevivalist != "unset" && App.SecExp.battle.deployedUnits('militia') >= 1>> @@ -1204,7 +1204,7 @@ <<if $arcologies[0].FSDegradationist != "unset" && App.SecExp.battle.deployedUnits('slaves') >= 1>> Because of your degradationist society, your slave soldiers are highly distrustful of the soldier you forced them to accept as leader. <</if>> - <<if $leaderWounded == 1>> + <<if $SecExp.war.leaderWounded>> During the battle a stray bullet managed to reach The Colonel, wounding her slightly. Your troops were greatly affected by the loss of their leader. <</if>> <</if>> @@ -1213,237 +1213,237 @@ /* tactics */ <<if $auto == 1>>$assistant.name<<else>>You<</if>> - <<if $chosenTactic == "Bait and Bleed">> + <<if $SecExp.war.chosenTactic == "Bait and Bleed">> chose to employ "bait and bleed" tactics or relying on quick attacks and harassment to tire and wound the enemy until their surrender. - <<elseif $chosenTactic == "Guerrilla">> + <<elseif $SecExp.war.chosenTactic == "Guerrilla">> chose to employ "guerrilla" tactics or relying on stealth, terrain knowledge and subterfuge to undermine and ultimately destroy the enemy. - <<elseif $chosenTactic == "Choke Points">> + <<elseif $SecExp.war.chosenTactic == "Choke Points">> chose to employ "choke points" tactics or the extensive use of fortified or highly defensive positions to slow down and eventually stop the enemy. - <<elseif $chosenTactic == "Interior Lines">> + <<elseif $SecExp.war.chosenTactic == "Interior Lines">> chose to employ "interior lines" tactics or exploiting the defender's shorter front to quickly disengage and concentrate troops when and where needed. - <<elseif $chosenTactic == "Pincer Maneuver">> + <<elseif $SecExp.war.chosenTactic == "Pincer Maneuver">> chose to employ "pincer maneuver" tactics or attempting to encircle the enemy by faking a collapsing center front. - <<elseif $chosenTactic == "Defense In Depth">> + <<elseif $SecExp.war.chosenTactic == "Defense In Depth">> chose to employ "defense in depth" tactics or relying on mobility to disengage and exploit overextended enemy troops by attacking their freshly exposed flanks. - <<elseif $chosenTactic == "Blitzkrieg">> + <<elseif $SecExp.war.chosenTactic == "Blitzkrieg">> chose to employ "blitzkrieg" tactics or shattering the enemy's front-line with a violent, concentrated armored assault. - <<elseif $chosenTactic == "Human Wave">> + <<elseif $SecExp.war.chosenTactic == "Human Wave">> chose to employ "human wave" tactics or overwhelming the enemy's army with a massive infantry assault. <</if>> - <<if $battleTerrain == "urban">> - <<if $chosenTactic == "Bait and Bleed">> + <<if $SecExp.war.terrain == "urban">> + <<if $SecExp.war.chosenTactic == "Bait and Bleed">> The urban terrain synergized well with bait and bleed tactics, slowly chipping away at the enemy's forces from the safety of the narrow streets and empty buildings. - <<elseif $chosenTactic == "Guerrilla">> + <<elseif $SecExp.war.chosenTactic == "Guerrilla">> The urban terrain synergized well with guerrilla tactics, eroding your enemy's determination from the safety of the narrow streets and empty buildings. - <<elseif $chosenTactic == "Choke Points">> + <<elseif $SecExp.war.chosenTactic == "Choke Points">> The urban environment offers many opportunities to hunker down and stop the momentum of the enemy's assault while keeping your soldiers in relative safety. - <<elseif $chosenTactic == "Interior Lines">> + <<elseif $SecExp.war.chosenTactic == "Interior Lines">> While the urban environment offers many highly defensive position, it does restrict movement and with it the advantages of exploiting interior lines. - <<elseif $chosenTactic == "Pincer Maneuver">> + <<elseif $SecExp.war.chosenTactic == "Pincer Maneuver">> The urban terrain does not allow for wide maneuvers, the attempts of your forces to encircle the attackers are mostly unsuccessful. - <<elseif $chosenTactic == "Defense In Depth">> + <<elseif $SecExp.war.chosenTactic == "Defense In Depth">> While the urban environment offers many defensive positions, it limits mobility, limiting the advantages of using a defense in depth tactic. - <<elseif $chosenTactic == "Blitzkrieg">> + <<elseif $SecExp.war.chosenTactic == "Blitzkrieg">> The urban terrain is difficult to traverse, making your troops attempt at a lightning strike unsuccessful. - <<elseif $chosenTactic == "Human Wave">> + <<elseif $SecExp.war.chosenTactic == "Human Wave">> The urban terrain offers great advantages to the defender, your men find themselves in great disadvantage while mass assaulting the enemy's position. <</if>> - <<elseif $battleTerrain == "rural">> - <<if $chosenTactic == "Bait and Bleed">> + <<elseif $SecExp.war.terrain == "rural">> + <<if $SecExp.war.chosenTactic == "Bait and Bleed">> The open terrain of rural lands does not lend itself well to bait and bleed tactics, making it harder for your men to achieve tactical superiority. - <<elseif $chosenTactic == "Guerrilla">> + <<elseif $SecExp.war.chosenTactic == "Guerrilla">> The open terrain of rural lands does not offer many hiding spots, making it harder for your men to perform guerrilla actions effectively. - <<elseif $chosenTactic == "Choke Points">> + <<elseif $SecExp.war.chosenTactic == "Choke Points">> The open terrain of rural lands does not offer many natural choke points, making it hard for your troops to funnel the enemy towards highly defended positions. - <<elseif $chosenTactic == "Interior Lines">> + <<elseif $SecExp.war.chosenTactic == "Interior Lines">> 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. - <<elseif $chosenTactic == "Pincer Maneuver">> + <<elseif $SecExp.war.chosenTactic == "Pincer Maneuver">> The open terrain affords your men great mobility, allowing them to easily position themselves for envelopment. - <<elseif $chosenTactic == "Defense In Depth">> + <<elseif $SecExp.war.chosenTactic == "Defense In Depth">> The open terrain affords your men great mobility, allowing them to exploit overextended assaults and concentrate where and when it matters. - <<elseif $chosenTactic == "Blitzkrieg">> + <<elseif $SecExp.war.chosenTactic == "Blitzkrieg">> The open terrain affords your men great mobility, making it easier to accomplish concentrated lightning strikes. - <<elseif $chosenTactic == "Human Wave">> + <<elseif $SecExp.war.chosenTactic == "Human Wave">> The open terrain affords your men great mobility, making it easier to overwhelm the enemy with mass assaults. <</if>> - <<elseif $battleTerrain == "hills">> - <<if $chosenTactic == "Bait and Bleed">> + <<elseif $SecExp.war.terrain == "hills">> + <<if $SecExp.war.chosenTactic == "Bait and Bleed">> While the hills offer some protection, they also make it harder to maneuver; bait and bleed tactics will not be 100% effective here. - <<elseif $chosenTactic == "Guerrilla">> + <<elseif $SecExp.war.chosenTactic == "Guerrilla">> The hills offer protection to both your troops and your enemy's, making it harder for your men to accomplish guerrilla attacks effectively. - <<elseif $chosenTactic == "Choke Points">> + <<elseif $SecExp.war.chosenTactic == "Choke Points">> While not as defensible as mountains, hills offer numerous opportunities to funnel the enemy towards highly defensible choke points. - <<elseif $chosenTactic == "Interior Lines">> + <<elseif $SecExp.war.chosenTactic == "Interior Lines">> The limited mobility on hills hampers the capability of your troops to exploit the defender's greater mobility afforded by interior lines. - <<elseif $chosenTactic == "Pincer Maneuver">> + <<elseif $SecExp.war.chosenTactic == "Pincer Maneuver">> Limited mobility due to the hills is a double edged sword, affording your men a decent shot at encirclement. - <<elseif $chosenTactic == "Defense In Depth">> + <<elseif $SecExp.war.chosenTactic == "Defense In Depth">> The limited mobility on hills hampers the capability of your troops to use elastic defense tactics. - <<elseif $chosenTactic == "Blitzkrieg">> + <<elseif $SecExp.war.chosenTactic == "Blitzkrieg">> The limited mobility on hills hampers the capability of your troops to organize lightning strikes. - <<elseif $chosenTactic == "Human Wave">> + <<elseif $SecExp.war.chosenTactic == "Human Wave">> The defensibility of hills makes it harder to accomplish victory through mass assaults. <</if>> - <<elseif $battleTerrain == "coast">> - <<if $chosenTactic == "Bait and Bleed">> + <<elseif $SecExp.war.terrain == "coast">> + <<if $SecExp.war.chosenTactic == "Bait and Bleed">> On the coast there's little space and protection to effectively employ bait and bleed tactics. - <<elseif $chosenTactic == "Guerrilla">> + <<elseif $SecExp.war.chosenTactic == "Guerrilla">> On the coast there's little space and protection to effectively employ guerrilla tactics. - <<elseif $chosenTactic == "Choke Points">> + <<elseif $SecExp.war.chosenTactic == "Choke Points">> Amphibious attacks are difficult in the best of situations; the defender has a very easy time funneling the enemy towards their key defensive positions. - <<elseif $chosenTactic == "Interior Lines">> + <<elseif $SecExp.war.chosenTactic == "Interior Lines">> While in an amphibious landing mobility is not the defender's best weapon, exploiting interior lines still affords your troops some advantages. - <<elseif $chosenTactic == "Pincer Maneuver">> + <<elseif $SecExp.war.chosenTactic == "Pincer Maneuver">> Attempting to encircle a landing party is not the best course of action, but not the worst either. - <<elseif $chosenTactic == "Defense In Depth">> + <<elseif $SecExp.war.chosenTactic == "Defense In Depth">> In an amphibious assault it's very easy for the enemy to overextend, making defense in depth tactics quite effective. - <<elseif $chosenTactic == "Blitzkrieg">> + <<elseif $SecExp.war.chosenTactic == "Blitzkrieg">> The rough, restricted terrain does not lend itself well to lightning strikes, but the precarious position of the enemy still gives your mobile troops tactical superiority. - <<elseif $chosenTactic == "Human Wave">> + <<elseif $SecExp.war.chosenTactic == "Human Wave">> The rough, restricted terrain does not lend itself well to mass assaults, but the precarious position of the enemy still gives your troops tactical superiority. <</if>> - <<elseif $battleTerrain == "outskirts">> - <<if $chosenTactic == "Bait and Bleed">> + <<elseif $SecExp.war.terrain == "outskirts">> + <<if $SecExp.war.chosenTactic == "Bait and Bleed">> Fighting just beneath the walls of the arcology does not allow for the dynamic redeployment of troops bait and bleed tactics would require. - <<elseif $chosenTactic == "Guerrilla">> + <<elseif $SecExp.war.chosenTactic == "Guerrilla">> Fighting just beneath the walls of the arcology does not allow for the dynamic redeployment of troops guerrilla tactics would require. - <<elseif $chosenTactic == "Choke Points">> + <<elseif $SecExp.war.chosenTactic == "Choke Points">> The imposing structure of the arcology itself provides plenty of opportunities to create fortified choke points from which to shatter the enemy assault. - <<elseif $chosenTactic == "Interior Lines">> + <<elseif $SecExp.war.chosenTactic == "Interior Lines">> While the presence of the arcology near the battlefield is an advantage, it does limit maneuverability, lowering overall effectiveness of interior lines tactics. - <<elseif $chosenTactic == "Pincer Maneuver">> + <<elseif $SecExp.war.chosenTactic == "Pincer Maneuver">> While the presence of the arcology near the battlefield is an advantage, it does limit maneuverability, lowering the chances of making an effective encirclement. - <<elseif $chosenTactic == "Defense In Depth">> + <<elseif $SecExp.war.chosenTactic == "Defense In Depth">> Having the arcology near the battlefield means there are limited available maneuvers to your troops, who still needs to defend the structure, making defense in depth tactics not as effective. - <<elseif $chosenTactic == "Blitzkrieg">> + <<elseif $SecExp.war.chosenTactic == "Blitzkrieg">> While an assault may save the arcology from getting involved at all, having the imposing structure so near does limit maneuverability and so the impetus of the lightning strike. - <<elseif $chosenTactic == "Human Wave">> + <<elseif $SecExp.war.chosenTactic == "Human Wave">> While an attack may save the arcology from getting involved at all, having the imposing structure so near does limit maneuverability and so the impetus of the mass assault. <</if>> - <<elseif $battleTerrain == "mountains">> - <<if $chosenTactic == "Bait and Bleed">> + <<elseif $SecExp.war.terrain == "mountains">> + <<if $SecExp.war.chosenTactic == "Bait and Bleed">> While the mountains offer great protection, they also limit maneuverability; bait and bleed tactics will not be quite as effective here. - <<elseif $chosenTactic == "Guerrilla">> + <<elseif $SecExp.war.chosenTactic == "Guerrilla">> The mountains offer many excellent hiding spots and defensive positions, making guerrilla tactics very effective. - <<elseif $chosenTactic == "Choke Points">> + <<elseif $SecExp.war.chosenTactic == "Choke Points">> The mountains offer plenty of opportunity to build strong defensive positions from which to shatter the enemy's assault. - <<elseif $chosenTactic == "Interior Lines">> + <<elseif $SecExp.war.chosenTactic == "Interior Lines">> While the rough terrain complicates maneuvers, the defensive advantages offered by the mountains offsets its negative impact. - <<elseif $chosenTactic == "Pincer Maneuver">> + <<elseif $SecExp.war.chosenTactic == "Pincer Maneuver">> The rough terrain complicates maneuvers; your men have a really hard time pulling off an effective encirclement in this environment. - <<elseif $chosenTactic == "Defense In Depth">> + <<elseif $SecExp.war.chosenTactic == "Defense In Depth">> While mobility is limited, defensive positions are plentiful; your men are not able to fully exploit overextended assaults, but are able to better resist them. - <<elseif $chosenTactic == "Blitzkrieg">> + <<elseif $SecExp.war.chosenTactic == "Blitzkrieg">> The rough terrain complicates maneuvers; your men have a really hard time pulling off an effective lightning strike in this environment. - <<elseif $chosenTactic == "Human Wave">> + <<elseif $SecExp.war.chosenTactic == "Human Wave">> The rough terrain complicates maneuvers; your men have a really hard time pulling off an effective mass assault in this environment. <</if>> - <<elseif $battleTerrain == "wasteland">> - <<if $chosenTactic == "Bait and Bleed">> + <<elseif $SecExp.war.terrain == "wasteland">> + <<if $SecExp.war.chosenTactic == "Bait and Bleed">> While the wastelands are mostly open terrain, there are enough hiding spots to make bait and bleed tactics work well enough. - <<elseif $chosenTactic == "Guerrilla">> + <<elseif $SecExp.war.chosenTactic == "Guerrilla">> While the wastelands are mostly open terrain, there are enough hiding spots to make guerrilla tactics work well enough. - <<elseif $chosenTactic == "Choke Points">> + <<elseif $SecExp.war.chosenTactic == "Choke Points">> The wastelands are mostly open terrain; your men have a difficult time setting up effective fortified positions. - <<elseif $chosenTactic == "Interior Lines">> + <<elseif $SecExp.war.chosenTactic == "Interior Lines">> The wastelands, while rough, are mostly open terrain, where your men can exploit to the maximum the superior mobility of the defender. - <<elseif $chosenTactic == "Pincer Maneuver">> + <<elseif $SecExp.war.chosenTactic == "Pincer Maneuver">> The wastelands, while rough, are mostly open terrain; your men can set up an effective encirclement here. - <<elseif $chosenTactic == "Defense In Depth">> + <<elseif $SecExp.war.chosenTactic == "Defense In Depth">> The wastelands, while rough, are mostly open terrain, allowing your men to liberally maneuver to exploit overextended enemies. - <<elseif $chosenTactic == "Blitzkrieg">> + <<elseif $SecExp.war.chosenTactic == "Blitzkrieg">> The wastelands, while rough, are mostly open terrain, where your men are able to mount effective lightning strikes. - <<elseif $chosenTactic == "Human Wave">> + <<elseif $SecExp.war.chosenTactic == "Human Wave">> The wastelands, while rough, are mostly open terrain, where your men are able to mount effective mass assaults. <</if>> <</if>> - <<if $chosenTactic == "Bait and Bleed">> - <<if $attackType == "raiders">> + <<if $SecExp.war.chosenTactic == "Bait and Bleed">> + <<if $SecExp.war.attacker.type == "raiders">> Since the bands of raiders are used to be on high alert and on the move constantly, bait and bleed tactics are not effective against them. - <<elseif $attackType == "free city">> + <<elseif $SecExp.war.attacker.type == "free city">> The modern armies hired by Free Cities are decently mobile, which means quick hit and run attacks will be less successful, but their discipline and confidence still make them quite susceptible to this type of attack. - <<elseif $attackType == "old world">> + <<elseif $SecExp.war.attacker.type == "old world">> While old world armies are tough nuts to crack, their predictability makes them the perfect target for hit and run and harassment tactics. - <<elseif $attackType == "freedom fighters">> + <<elseif $SecExp.war.attacker.type == "freedom fighters">> Freedom fighters live every day as chasing and being chased by far superior forces, they are far more experienced than your troops in this type of warfare and much less susceptible to it. <</if>> - <<elseif $chosenTactic == "Guerrilla">> - <<if $attackType == "raiders">> + <<elseif $SecExp.war.chosenTactic == "Guerrilla">> + <<if $SecExp.war.attacker.type == "raiders">> Since the bands of raiders are used to be on high alert and on the move constantly, guerrilla tactics are not effective against them. - <<elseif $attackType == "free city">> + <<elseif $SecExp.war.attacker.type == "free city">> The modern armies hired by Free Cities are highly mobile, which means quick hit and run attacks will be less successful, but their discipline and confidence still make them quite susceptible to this type of attack. - <<elseif $attackType == "old world">> + <<elseif $SecExp.war.attacker.type == "old world">> While old world armies are tough nuts to crack, their predictability makes them the perfect target for hit and run and harassment tactics. - <<elseif $attackType == "freedom fighters">> + <<elseif $SecExp.war.attacker.type == "freedom fighters">> Freedom fighters live every day as chasing and being chased by far superior forces, they are far more experienced than your troops in this type of warfare and much less susceptible to it. <</if>> - <<elseif $chosenTactic == "Choke Points">> - <<if $attackType == "raiders">> + <<elseif $SecExp.war.chosenTactic == "Choke Points">> + <<if $SecExp.war.attacker.type == "raiders">> Raiders lack heavy weaponry or armor, so making use of fortified positions is an excellent way to dissipate the otherwise powerful momentum of their assault. - <<elseif $attackType == "free city">> + <<elseif $SecExp.war.attacker.type == "free city">> The high tech equipment Free Cities can afford to give their guns for hire means there's no defensive position strong enough to stop them, still the relatively low numbers means they will have to take a careful approach, slowing them down. - <<elseif $attackType == "old world">> + <<elseif $SecExp.war.attacker.type == "old world">> Old world armies have both the manpower and the equipment to conquer any defensive position, making use of strong fortifications will only bring you this far against them. - <<elseif $attackType == "freedom fighters">> + <<elseif $SecExp.war.attacker.type == "freedom fighters">> The lack of specialized weaponry means freedom fighters have a rather hard time overcoming tough defensive positions, unfortunately they have also a lot of experience in avoiding them. <</if>> - <<elseif $chosenTactic == "Interior Lines">> - <<if $attackType == "raiders">> + <<elseif $SecExp.war.chosenTactic == "Interior Lines">> + <<if $SecExp.war.attacker.type == "raiders">> The highly mobile horde of raiders will not give much room for your troops to maneuver, lowering their tactical superiority. - <<elseif $attackType == "free city">> + <<elseif $SecExp.war.attacker.type == "free city">> While decently mobile, Free Cities forces are not in high enough numbers to risk maintaining prolonged contact, allowing your troops to quickly disengage and redeploy where it hurts. - <<elseif $attackType == "old world">> + <<elseif $SecExp.war.attacker.type == "old world">> Old world armies are not famous for the mobility, which makes them highly susceptible to any tactic that exploits maneuverability and speed. - <<elseif $attackType == "freedom fighters">> + <<elseif $SecExp.war.attacker.type == "freedom fighters">> While not the best equipped army, the experience and mobility typical of freedom fighters groups make them tough targets for an army that relies itself on mobility. <</if>> - <<elseif $chosenTactic == "Pincer Maneuver">> - <<if $attackType == "raiders">> + <<elseif $SecExp.war.chosenTactic == "Pincer Maneuver">> + <<if $SecExp.war.attacker.type == "raiders">> While numerous, the undisciplined masses of raiders are easy prey for encirclements. - <<elseif $attackType == "free city">> + <<elseif $SecExp.war.attacker.type == "free city">> While decently mobile, the low number of Free Cities expedition forces make them good candidates for encirclements. - <<elseif $attackType == "old world">> + <<elseif $SecExp.war.attacker.type == "old world">> The discipline and numbers of old world armies make them quite difficult to encircle. - <<elseif $attackType == "freedom fighters">> + <<elseif $SecExp.war.attacker.type == "freedom fighters">> While not particularly mobile, freedom fighters are used to fight against overwhelming odds, diminishing the effectiveness of the encirclement. <</if>> - <<elseif $chosenTactic == "Defense In Depth">> - <<if $attackType == "raiders">> + <<elseif $SecExp.war.chosenTactic == "Defense In Depth">> + <<if $SecExp.war.attacker.type == "raiders">> While their low discipline makes them prime candidates for an elastic defense type of strategy, their high numbers limit your troops maneuverability. - <<elseif $attackType == "free city">> + <<elseif $SecExp.war.attacker.type == "free city">> With their low numbers Free Cities mercenaries are quite susceptible to this type of tactic, despite their mobility. - <<elseif $attackType == "old world">> + <<elseif $SecExp.war.attacker.type == "old world">> With their low mobility old world armies are very susceptible to this type of strategy. - <<elseif $attackType == "freedom fighters">> + <<elseif $SecExp.war.attacker.type == "freedom fighters">> Low mobility and not particularly high numbers mean freedom fighters can be defeated by employing elastic defense tactics. <</if>> - <<elseif $chosenTactic == "Blitzkrieg">> - <<if $attackType == "raiders">> + <<elseif $SecExp.war.chosenTactic == "Blitzkrieg">> + <<if $SecExp.war.attacker.type == "raiders">> With their low discipline and lack of heavy equipment, lightning strikes are very effective against raider hordes. - <<elseif $attackType == "free city">> + <<elseif $SecExp.war.attacker.type == "free city">> Having good equipment and discipline on their side, Free Cities expeditions are capable of responding to even strong lightning strikes. - <<elseif $attackType == "old world">> + <<elseif $SecExp.war.attacker.type == "old world">> While disciplined, old world armies low mobility makes them highly susceptible to lightning strikes. - <<elseif $attackType == "freedom fighters">> + <<elseif $SecExp.war.attacker.type == "freedom fighters">> While not well equipped, freedom fighters have plenty of experience fighting small, mobile attacks, making them difficult to defeat with lightning strikes. <</if>> - <<elseif $chosenTactic == "Human Wave">> - <<if $attackType == "raiders">> + <<elseif $SecExp.war.chosenTactic == "Human Wave">> + <<if $SecExp.war.attacker.type == "raiders">> The hordes of raiders are much more experienced than your soldiers in executing mass assaults and they also have a lot more bodies to throw in the grinder. - <<elseif $attackType == "free city">> + <<elseif $SecExp.war.attacker.type == "free city">> The good equipment and mobility of Free Cities mercenaries cannot save them from an organized mass assault. - <<elseif $attackType == "old world">> + <<elseif $SecExp.war.attacker.type == "old world">> Unfortunately the discipline and good equipment of old world armies allow them to respond well against a mass assault. - <<elseif $attackType == "freedom fighters">> + <<elseif $SecExp.war.attacker.type == "freedom fighters">> The relative low numbers and not great equipment typical of freedom fighters make them susceptible to being overwhelmed by an organized mass assault. <</if>> <</if>> - In the end <<if $leadingTroops == "PC">>you were<<else>>your commander was<</if>> - <<if $tacticsSuccessful == 1>> - @@.green;able to successfully employ <<print $chosenTactic>> tactics,@@ greatly enhancing + In the end <<if $SecExp.war.commander == "PC">>you were<<else>>your commander was<</if>> + <<if $SecExp.war.tacticsSuccessful>> + @@.green;able to successfully employ <<print $SecExp.war.chosenTactic>> tactics,@@ greatly enhancing <<else>> - @@.red;not able to effectively employ <<print $chosenTactic>> tactics,@@ greatly affecting + @@.red;not able to effectively employ <<print $SecExp.war.chosenTactic>> tactics,@@ greatly affecting <</if>> the efficiency of your army. <br> <<include "unitsBattleReport">> @@ -1507,21 +1507,8 @@ <</if>> /* resets variables */ -<<set $leaderWounded = 0>> -<<set $gainedWarfare = 0>> -<<set $tacticsSuccessful = 0>> -<<set $attackType = "none">> -<<set $chosenTactic = "none">> -<<set $leadingTroops = "none">> -<<set $attackTroops = 0>> -<<set $attackEquip = 0>> -<<set $battleTerrain = "none">> <<set $attackThisWeek = 0>> -<<set $enemyLosses = 0>> -<<set $losses = 0>> -<<set $battleTurns = 0>> <<set $majorBattle = 0>> -<<set $SFIntervention = 0>> <<set $secBots.isDeployed = 0>> <<for _i = 0; _i < $militiaUnits.length; _i++>> <<set $militiaUnits[_i].isDeployed = 0>> diff --git a/src/Mods/SecExp/authorityReport.tw b/src/Mods/SecExp/authorityReport.tw deleted file mode 100644 index 2a03cc223e371c6cd0eab14f9bd877a527d383c9..0000000000000000000000000000000000000000 --- a/src/Mods/SecExp/authorityReport.tw +++ /dev/null @@ -1,179 +0,0 @@ -:: authorityReport [nobr] - -<<if $useTabs == 0>>__Authority__<</if>> -<br> -Your authority is -<<if $SecExp.core.authority > 19500>> - nearly absolute. The arcology is yours to command as it pleases you. -<<elseif $SecExp.core.authority > 15000>> - extremely high. There's little you cannot do within the walls of your arcology. -<<elseif $SecExp.core.authority > 10000>> - high. You command respect and fear in equal measure. -<<elseif $SecExp.core.authority > 5000>> - moderate. You command some respect from your citizens. -<<else>> - low. You command no respect or fear from your citizens. -<</if>> - -<<set _authGrowth = 0>> - -<<if $PC.career == "wealth">> - As part of the idle rich, you were used to having obedience coming naturally to you. Now you find it harder to maintain authority over the arcology. - <<set _authGrowth -= (10 * random(5,15))>> -<<elseif $PC.career == "slaver">> - Your past as a slaver helps you assert your authority over the arcology. - <<set _authGrowth += (10 * random(5,15))>> -<<elseif $PC.career == "escort">> - Given your past career as an escort, you find it hard to assert your authority over the arcology and its inhabitants. - <<set _authGrowth -= (10 * random(5,15))>> -<<elseif $PC.career == "servant">> - Given your past career as a servant, you find it hard to assert your authority over the arcology and its inhabitants. - <<set _authGrowth -= (10 * random(5,15))>> -<<elseif $PC.career == "BlackHat">> - Given your past career as a (rather questionable) incursion specialist, you find it hard to assert your authority over the arcology and its inhabitants, despite what you may know about them. - <<set _authGrowth -= (10 * random(5,15))>> -<<elseif $PC.career == "gang">> - Given your past life as a gang leader, you find it easier to assert your authority over the arcology and its inhabitants. - <<set _authGrowth += (10 * random(5,15))>> -<</if>> - -<<if $rep >= 19500>> - Your legend is so well known that your mere presence commands respect and obedience, increasing your authority. - <<set _authGrowth += (10 * random(10,20))>> -<<elseif $rep >= 15000>> - Your reputation is so high that your mere presence commands respect, increasing your authority. - <<set _authGrowth += (10 * random(5,15))>> -<<elseif $rep >= 10000>> - Your reputation is high enough that your presence commands some respect, increasing your authority. - <<set _authGrowth += (10 * random(2,8))>> -<</if>> - -<<if $SecExp.core.security >= 90>> - Your arcology is incredibly secure and your citizens know quite well who to thank, greatly increasing your authority. - <<set _authGrowth += (10 * random(10,20))>> -<<elseif $SecExp.core.security >= 70>> - Your arcology is really secure and your citizens know quite well who to thank, increasing your authority. - <<set _authGrowth += (10 * random(5,15))>> -<<elseif $SecExp.core.security >= 50>> - Your arcology is quite secure and your citizens know who to thank, increasing your authority. - <<set _authGrowth += (10 * random(2,8))>> -<</if>> - -<<if $SecExp.core.crimeLow >= 90>> - The all powerful criminal organizations controlling the arcology have a very easy time undermining your authority. - <<set _authGrowth -= (10 * random(10,20))>> -<<elseif $SecExp.core.crimeLow >= 70>> - Crime is king in the arcology, powerful criminals have a very easy time undermining your authority. - <<set _authGrowth -= (10 * random(5,15))>> -<<elseif $SecExp.core.crimeLow >= 50>> - Criminal organizations have a strong foothold in the arcology, their activities undermine your authority. - <<set _authGrowth -= (10 * random(2,8))>> -<</if>> - -<<if $averageDevotion >= 50 && $averageTrust >= 50>> - The high devotion and trust of your slaves speak eloquently of your leadership capabilities, helping your authority grow. - <<set _authGrowth += (5 * (($averageDevotion + $averageTrust) / 10))>> -<<elseif $averageDevotion >= 50>> - The high devotion of your slaves speaks eloquently of your leadership capabilities, helping your authority grow. - <<set _authGrowth += (5 * ($averageDevotion / 10))>> -<<elseif $averageTrust >= 50>> - The high trust of your slaves speaks eloquently of your leadership capabilities, helping your authority grow. - <<set _authGrowth += (5 * ($averageTrust / 10))>> -<</if>> - -<<if $arcologies[0].ownership >= 90>> - You own so much of the arcology that your authority quickly increases. - <<set _authGrowth += (5 * Math.trunc($arcologies[0].ownership / 10))>> -<<elseif $arcologies[0].ownership >= 70>> - You own a big part of the arcology, causing your authority to increase. - <<set _authGrowth += (5 * Math.trunc($arcologies[0].ownership / 10))>> -<<elseif $arcologies[0].ownership >= 50>> - You own the majority of the arcology, causing your authority to slowly increase. - <<set _authGrowth += (5 * Math.trunc($arcologies[0].ownership / 10))>> -<<else>> - Your low ownership of the arcology causes your authority to decrease. - <<set _authGrowth -= (5 * Math.trunc($arcologies[0].ownership / 10))>> -<</if>> - -<<if App.SecExp.battle.activeUnits() >= 9>> - Your military is massive; commanding so many troops greatly increases your authority. -<<elseif App.SecExp.battle.activeUnits() >= 7>> - Your military is huge; commanding such a number of soldiers increases your authority. -<<elseif App.SecExp.battle.activeUnits() >= 4>> - Your military is at a decent size; commanding a small army increases your authority. -<</if>> -<<if App.SecExp.battle.activeUnits() >= 4>> - <<set _authGrowth += (12 * App.SecExp.battle.activeUnits())>> -<</if>> - -<<set _size = App.SF.upgrades.total()>> -<<if $SF.Toggle && $SF.Active >= 1 && _size > 10>> - Having a powerful special force increases your authority. - <<set _authGrowth += (_size/10)>> -<</if>> - -<<if $arcologies[0].FSChattelReligionist >= 90>> - Religious organizations have a tight grip on the minds of your residents and their dogma greatly helps your authority grow. - <<set _authGrowth += $arcologies[0].FSChattelReligionist>> -<<elseif $arcologies[0].FSChattelReligionist >= 50>> - Religious organizations have a tight grip on the minds of your residents and their dogma helps your authority grow. - <<set _authGrowth += $arcologies[0].FSChattelReligionist>> -<</if>> - -<<set _elite = $arcologies[0].FSNeoImperialistLaw2 == 1 ? 'Barons' : 'Societal Elite'>> -<<if $arcologies[0].FSRestart >= 90>> - The arcology's society is extremely stratified. The reliance on the _elite by the lower classes greatly increases your reputation. - <<set _authGrowth += $arcologies[0].FSRestart>> -<<elseif $arcologies[0].FSRestart >= 50>> - The arcology's society is very stratified. The reliance on the _elite by the lower classes increases your reputation. - <<set _authGrowth += $arcologies[0].FSRestart>> -<</if>> - -<<if $arcologies[0].FSPaternalist >= 90>> - Your extremely paternalistic society has the unfortunate side effects of spreading dangerous ideals in the arcology, greatly damaging your authority. - <<set _authGrowth -= Math.clamp($arcologies[0].FSPaternalist, 0, 100)>> -<<elseif $arcologies[0].FSPaternalist >= 50>> - Your paternalistic society has the unfortunate side effects of spreading dangerous ideals in the arcology, damaging your authority. - <<set _authGrowth -= Math.clamp($arcologies[0].FSPaternalist, 0, 100)>> -<</if>> - -<<if $arcologies[0].FSNull >= 90>> - Extreme cultural openness allows dangerous ideas to spread in your arcology, greatly damaging your reputation. - <<set _authGrowth -= $arcologies[0].FSNull>> -<<elseif $arcologies[0].FSNull >= 50>> - Mild cultural openness allows dangerous ideas to spread in your arcology, damaging your reputation. - <<set _authGrowth -= $arcologies[0].FSNull>> -<</if>> - -<<if $SecExp.buildings.propHub>> - <<if $SecExp.buildings.propHub.upgrades.miniTruth >= 1>> - Your authenticity department works tirelessly to impose your authority in all of the arcology. - <<set _authGrowth += (15 * $SecExp.buildings.propHub.upgrades.miniTruth)>> - <</if>> - <<if $SecExp.buildings.propHub.upgrades.secretService >= 1>> - Your secret services constantly keep under surveillance any potential threat, intervening when necessary. Rumors of the secretive security service and mysterious disappearances make your authority increase. - <<set _authGrowth += (15 * $SecExp.buildings.propHub.upgrades.secretService)>> - <</if>> -<</if>> - -<<if App.SecExp.upkeep.edictsAuth() > 0>> - Some of your authority is spent maintaining your edicts. - <<set _authGrowth -= App.SecExp.upkeep.edictsAuth()>> -<</if>> - -This week -<<if _authGrowth > 0>> - @@.green;authority has increased.@@ -<<elseif _authGrowth == 0>> - @@.yellow;authority did not change.@@ -<<else>> - @@.red;authority has decreased.@@ -<</if>> - -<<set $SecExp.core.authority += _authGrowth>> -<<set $SecExp.core.authority = Math.trunc(Math.clamp($SecExp.core.authority, 0, 20000))>> - -<<if $SecExp.settings.rebellion.enabled == 1>> - <br><br> - <<include "rebellionGenerator">> /* rebellions */ -<</if>> diff --git a/src/Mods/SecExp/js/Unit.js b/src/Mods/SecExp/js/Unit.js index 65b528b2a1264f235816be7c63591069f84b0024..63ef3e4cf437e5a414c0521cdaf10578ebd0d503 100644 --- a/src/Mods/SecExp/js/Unit.js +++ b/src/Mods/SecExp/js/Unit.js @@ -187,7 +187,7 @@ App.SecExp.deployUnitMenu = function(input, type, count = 0) { } options = document.createElement("div"); options.append(App.UI.DOM.link(`${canDeploy ? 'Deploy' : 'Remove'} the unit`, () => { - input.isDeployed = canDeploy ? 1 : 0; V.saveValid = 0; + input.isDeployed = canDeploy ? 1 : 0; V.SecExp.war.saveValid = 0; }, [], passage() )); diff --git a/src/Mods/SecExp/js/authorityReport.js b/src/Mods/SecExp/js/authorityReport.js new file mode 100644 index 0000000000000000000000000000000000000000..be3e4d7be55a9681ad75919ad0fd2b06abf6423a --- /dev/null +++ b/src/Mods/SecExp/js/authorityReport.js @@ -0,0 +1,457 @@ +App.SecExp.authorityReport = function() { + let authGrowth = 0; + let r = V.useTabs === 0 ? [`Authority`] : []; + let t = `<br>Your authority is `; + + if (V.SecExp.core.authority > 19500) { + r.push(t + `nearly absolute. The arcology is yours to command as it pleases you.`); + } else if (V.SecExp.core.authority > 15000) { + r.push(t +`extremely high. There's little you cannot do within the walls of your arcology.`); + } else if (V.SecExp.core.authority > 10000) { + r.push(t +`high. You command respect and fear in equal measure.`); + } else if (V.SecExp.core.authority > 5000) { + r.push(t +`moderate. You command some respect from your citizens.`); + } else { + r.push(t + `low. You command no respect or fear from your citizens.`); + } + + if (V.PC.career === "wealth") { + r.push(`As part of the idle rich, you were used to having obedience coming naturally to you. Now you find it harder to maintain authority over the arcology.`); + } else if (V.PC.career === "slaver") { + r.push(`Your past as a slaver helps you assert your authority over the arcology.`); + } else if (V.PC.career === "escort") { + r.push(`Given your past career as an escort, you find it hard to assert your authority over the arcology and its inhabitants.`); + } else if (V.PC.career === "servant") { + r.push(`Given your past career as a servant, you find it hard to assert your authority over the arcology and its inhabitants.`); + } else if (V.PC.career === "BlackHat") { + r.push(`Given your past career as a (rather questionable) incursion specialist, you find it hard to assert your authority over the arcology and its inhabitants, despite what you may know about them.`); + } else if (V.PC.career === "gang") { + r.push(`Given your past life as a gang leader, you find it easier to assert your authority over the arcology and its inhabitants.`); + } + + if (["wealth", "escort", "servant", "BlackHat"].includes(V.PC.career)) { + authGrowth -= (10 * random(5, 15)); + } else if (["slaver", "slaver"].includes(V.PC.career)){ + authGrowth += (10 * random(5, 15)); + } + + if (V.rep >= 19500) { + r.push(`Your legend is so well known that your mere presence commands respect and obedience, increasing your authority.`); + authGrowth += (10 * random(10, 20)); + } else if (V.rep >= 15000) { + r.push(`Your reputation is so high that your mere presence commands respect, increasing your authority.`); + authGrowth += (10 * random(5, 15)); + } else if (V.rep >= 10000) { + r.push(`Your reputation is high enough that your presence commands some respect, increasing your authority.`); + authGrowth += (10 * random(2, 8)); + } + + if (V.SecExp.core.security >= 90) { + r.push(`Your arcology is incredibly secure and your citizens know quite well who to thank, greatly increasing your authority.`); + authGrowth += (10 * random(10, 20)); + } else if (V.SecExp.core.security >= 70) { + r.push(`Your arcology is really secure and your citizens know quite well who to thank, increasing your authority.`); + authGrowth += (10 * random(5, 15)); + } else if (V.SecExp.core.security >= 50) { + r.push(`Your arcology is quite secure and your citizens know who to thank, increasing your authority.`); + authGrowth += (10 * random(2, 8)); + } + + if (V.SecExp.core.crimeLow >= 90) { + r.push(`The all powerful criminal organizations controlling the arcology have a very easy time undermining your authority.`); + authGrowth -= (10 * random(10, 20)); + } else if (V.SecExp.core.crimeLow >= 70) { + r.push(`Crime is king in the arcology, powerful criminals have a very easy time undermining your authority.`); + authGrowth -= (10 * random(5, 15)); + } else if (V.SecExp.core.crimeLow >= 50) { + r.push(`Criminal organizations have a strong foothold in the arcology, their activities undermine your authority.`); + authGrowth -= (10 * random(2, 8)); + } + + if (V.averageDevotion >= 50 && V.averageTrust >= 50) { + r.push(`The high devotion and trust of your slaves speak eloquently of your leadership capabilities, helping your authority grow.`); + authGrowth += (5 * ((V.averageDevotion + V.averageTrust) / 10)); + } else if (V.averageDevotion >= 50) { + r.push(`The high devotion of your slaves speaks eloquently of your leadership capabilities, helping your authority grow.`); + authGrowth += (5 * (V.averageDevotion / 10)); + } else if (V.averageTrust >= 50) { + r.push(`The high trust of your slaves speaks eloquently of your leadership capabilities, helping your authority grow.`); + authGrowth += (5 * (V.averageTrust / 10)); + } + + if (V.arcologies[0].ownership >= 90) { + r.push(`You own so much of the arcology that your authority quickly increases.`); + } else if (V.arcologies[0].ownership >= 70) { + r.push(`You own a big part of the arcology, causing your authority to increase.`); + } else if (V.arcologies[0].ownership >= 50) { + r.push(`You own the majority of the arcology, causing your authority to slowly increase.`); + } else { + r.push(`Your low ownership of the arcology causes your authority to decrease.`); + } + + if (V.arcologies[0].ownership >= 50) { + authGrowth += (5 * Math.trunc(V.arcologies[0].ownership / 10)); + } else { + authGrowth -= (5 * Math.trunc(V.arcologies[0].ownership / 10)); + } + + const activeUnits = App.SecExp.battle.activeUnits(); + if (activeUnits >= 4) { + t = `Your military is `; + if (activeUnits >= 9) { + r.push(`massive; commanding so many troops greatly`); + } else if (activeUnits >= 7) { + r.push(`huge; commanding such a number of soldiers`); + } else if (activeUnits >= 4) { + r.push(`at a decent size; commanding a small army`); + } + r.push(t += ` increases your authority.`); + authGrowth += (12 * activeUnits); + } + + const SF = App.SecExp.assistanceSF('authority'); + r.push(SF.text); authGrowth += SF.bonus; + + const FSChattel = V.arcologies[0].FSChattelReligionist; + if (FSChattel >= 50) { + r.push(`Religious organizations have a tight grip on the minds of your residents and their dogma ${FSChattel >= 90 ? 'greatly' : ''} helps your authority grow.`); + authGrowth += FSChattel; + } + + const FSRestart = V.arcologies[0].FSRestart; + if (FSRestart >= 50) { + r.push(`The arcology's society is ${FSRestart >= 90 ? 'extremely' : 'very'} stratified. The reliance on the ${V.arcologies[0].FSNeoImperialistLaw2 === 1 ? 'Barons' : 'Societal Elite'} by the lower classes increases ${FSRestart >= 90 ? 'greatly' : ''} your reputation.`); + authGrowth += FSRestart; + } + + const FSPaternalist = V.arcologies[0].FSPaternalist; + if (FSPaternalist >= 50) { + r.push(`Your ${FSPaternalist >= 90 ? 'extremely' : ''} paternalistic society has the unfortunate side effects of spreading dangerous ideals in the arcology, ${FSPaternalist >= 90 ? 'greatly' : ''} damaging your authority.`); + authGrowth -= Math.clamp(FSPaternalist, 0, 100); + } + + const FSNull = V.arcologies[0].FSNull; + if (FSNull >= 50) { + r.push(`${FSNull >= 90 ? 'Extreme' : 'Mild'} cultural openness allows dangerous ideas to spread in your arcology, ${FSNull >= 90 ? 'greatly' : ''} damaging your reputation.`); + authGrowth -= FSNull; + } + + if (V.SecExp.buildings.propHub) { + if (V.SecExp.buildings.propHub.upgrades.miniTruth >= 1) { + r.push(`Your authenticity department works tirelessly to impose your authority in all of the arcology.`); + authGrowth += (15 * V.SecExp.buildings.propHub.upgrades.miniTruth); + } + if (V.SecExp.buildings.propHub.upgrades.secretService >= 1) { + r.push(`Your secret services constantly keep under surveillance any potential threat, intervening when necessary. Rumors of the secretive security service and mysterious disappearances make your authority increase.`); + authGrowth += (15 * V.SecExp.buildings.propHub.upgrades.secretService); + } + } + + if (App.SecExp.upkeep.edictsAuth() > 0) { + r.push(`Some of your authority is spent maintaining your edicts.`); + authGrowth -= App.SecExp.upkeep.edictsAuth(); + } + + if (authGrowth > 0) { + r.push(`This week <span class="green">authority has increased.</span>`); + } else if (authGrowth === 0) { + r.push(`This week <span class="yellow">authority did not change.</span>`); + } else { + r.push(`This week <span class="red">authority has decreased.</span>`); + } + V.SecExp.core.authority = Math.trunc(Math.clamp(V.SecExp.core.authority + authGrowth, 0, 20000)); + + if (V.SecExp.settings.rebellion.enabled === 1) { + const authorityEffects = function(group) { + let t, bonus; + if (V.SecExp.core.authority <= 3000) { + t = `Your very low authority allows ${group} to think too freely.`; + bonus = 30; + } else if (V.SecExp.core.authority <= 6000) { + t = `Your low authority allows ${group} to think too freely.`; + bonus = 25; + } else if (V.SecExp.core.authority <= 9000) { + t = `Your moderate authority allows ${group} to think a bit too freely.`; + bonus = 20; + } else if (V.SecExp.core.authority <= 12000) { + t = `Your good authority does not allow ${group} to think too freely.`; + bonus = 15; + } else if (V.SecExp.core.authority <= 15000) { + t = `Your high authority does not allow ${group} to think too freely.`; + bonus = 10; + } else if (V.SecExp.core.authority <= 18000) { + t = `Your very high authority does not allow ${group} to think too freely.`; + bonus = 5; + } else { + t = `Your absolute authority does not allow ${group} to have a single free thought.`; + bonus = 1; + } + return {text: t, bonus: bonus}; + }; + + let slave, citizen; + const CSratio = V.ACitizens / V.ASlaves; + t = `<br><br> <strong>Slaves security analysis:</strong> `; + r.push(t + authorityEffects('slaves').text); slave = authorityEffects('slaves').bonus; + if (CSratio <= 0.4) { + r.push(`There are a lot more slaves than citizens, making some doubt their masters are strong enough to stop them.`); + slave += 30; + } else if (CSratio <= 0.6) { + r.push(`There are a lot more slaves than citizens, making some doubt their masters are strong enough to stop them.`); + slave += 25; + } else if (CSratio <= 0.8) { + r.push(`There are more slaves than citizens, making some doubt their masters are strong enough to stop them.`); + slave += 20; + } else if (CSratio <= 1) { + r.push(`There are more slaves than citizens, making some doubt their masters are strong enough to stop them.`); + slave += 15; + } else if (CSratio <= 1.5) { + r.push(`There are fewer slaves than citizens, making some doubt they would be strong enough to defeat their masters.`); + slave += 10; + } else if (CSratio >= 3) { + r.push(`There are fewer slaves than citizens, making some doubt they would be strong enough to defeat their masters.`); + slave -= 5; + } else { + r.push(`Citizen and slave populations are sufficiently balanced not to cause problems either way.`); + slave -= 1; + } + if (V.SecExp.core.security <= 10) { + r.push(`The very low security of the arcology leaves free space for slaves to organize and agitate.`); + slave += 30; + } else if (V.SecExp.core.security <= 30) { + r.push(`The low security of the arcology leaves free space for slaves to organize and agitate.`); + slave += 20; + } else if (V.SecExp.core.security <= 60) { + r.push(`The moderate security of the arcology does not allow free space for slaves to organize and agitate.`); + slave += 10; + } else if (V.SecExp.core.security >= 90) { + r.push(`The high security of the arcology does not allow free space for slaves to organize and agitate.`); + slave -= 5; + } else { + r.push(`The high security of the arcology does not allow free space for slaves to organize and agitate.`); + slave -= 1; + } + if (V.arcologies[0].FSDegradationist !== "unset") { + r.push(`Many slaves are so disgusted by your degradationist society, that they are willing to rise up against their masters to escape.`); + slave += 30; + } else if (V.arcologies[0].FSPaternalist !== "unset") { + r.push(`Many slaves are content to live in your paternalist society.`); + slave -= 5; + } else { + slave += 5; + } + if (V.arcologies[0].FSRestart !== "unset") { + r.push(`Many slaves are worried by your eugenics projects and some are pushed towards radicalization.`); + slave += 30; + } else if (V.arcologies[0].FSRepopulationFocus !== "unset") { + r.push(`Many slaves are pleasantly happy of your repopulation effort, affording them the freedom to reproduce.`); + slave -= 5; + } else { + slave += 5; + } + + t = `<br><br><strong>Citizens security analysis:</strong>`; + r.push(t + authorityEffects('your citizens').text); citizen = authorityEffects('your citizens').bonus; + if (V.SecExp.core.crimeLow >= 90) { + r.push(`The very high crime level of the arcology breeds extreme discontent between your citizens.`); + citizen += 30; + } else if (V.SecExp.core.crimeLow >= 60) { + r.push(`The high crime level of the arcology breeds high discontent between your citizens.`); + citizen += 15; + } else if (V.SecExp.core.crimeLow >= 30) { + r.push(`The low crime level of the arcology leaves your citizens happy and satisfied.`); + citizen += 5; + } else { + r.push(`The very low crime level of the arcology leaves your citizens happy and satisfied.`); + citizen -= 5; + } + + const militia = V.SecExp.edicts.defense.militia; + const militarizedSociety = [ + 'FSRomanRevivalist', 'FSAztecRevivalist', 'FSEgyptianRevivalist', + 'FSEdoRevivalist', 'FSArabianRevivalist', 'FSChineseRevivalist', + 'FSNeoImperialist'].every((FS) => V.arcologies[0][FS] === "unset"); + if (militia >= 1) { + if (militia >= 4) { + r.push(`${!militarizedSociety ? 'Many' : 'Some'} of your citizens are offended by your ${militia === 5 ? 'extreme' : ''} militarization of the arcology's society.`); + if (!militarizedSociety) { + citizen += militia === 5 ? 20 : 15; + } else { + citizen += militia === 5 ? 10 : 5; + } + } else { + citizen += !militarizedSociety ? 10 : -5; + } + } + if (V.arcologies[0].FSNull !== "unset") { + r.push(`Many of your more conservative citizens do not enjoy the cultural freedom you afford the residents of the arcology.`); + citizen += either(20, 30); + } + if (V.arcologies[0].FSRestart !== "unset") { + if (CSratio > 2 || CSratio > 1) { + r.push(`Your citizens are not happy with the ${CSratio > 2 ? 'noticeable' : ''} lack of slaves compared to their numbers.`); + citizen += CSratio > 2 ? 20 : 15; + } else if (CSratio < 0.5) { + citizen -= 5; + } + } else if (V.arcologies[0].FSRepopulationFocus !== "unset") { + if (CSratio < 0.5 || CSratio < 1) { + r.push(`Your citizens are not happy about being outbred by the slaves of the arcology.`); + citizen += CSratio < 0.5 ? 20 : 15; + } else if (CSratio > 1.4) { + citizen += 5; + } + } + + Math.clamp(slave, 0, 95); Math.clamp(citizen, 0, 95); // rolls to see if event happens - there's always a min 5% chance nothing happens + const roll = random(1, slave + citizen); + slave = Math.trunc(slave * V.SecExp.settings.rebellion.speed); citizen = Math.trunc(citizen * V.SecExp.settings.rebellion.speed); + if (V.SecExp.buildings.riotCenter && V.SecExp.buildings.riotCenter.brainImplant === 106) { + slave /= 2; citizen /= 2; + } + + let rebellionEventFires; + if (roll <= slave && random(1, 100) < slave) { + rebellionEventFires = 'slave'; + } else if (roll > slave && random(1, 100) < citizen) { + rebellionEventFires = 'citizen'; + } + + const oldTension = V.SecExp.rebellions.tension; + if (rebellionEventFires) { // if there is an advancement selects a random mini event + let miniEvent, rand; + V.SecExp.rebellions[rebellionEventFires + 'Progress'] += random(1, 5); + if (V.SecExp.rebellions.tension !== 0) { + V.SecExp.rebellions[rebellionEventFires + 'Progress'] *= Math.trunc(random(1, 5) * (V.SecExp.rebellions.tension / 100) * 10); // progress scales with tension + } + if (V.SecExp.rebellions.tension <= 33) { + miniEvent = rebellionEventFires === 'slave' ? 1 : 4; + V.SecExp.rebellions.tension += random(1, 5); + rand = random(0, 6); + } else if (V.SecExp.rebellions.tension <= 66) { + miniEvent = rebellionEventFires === 'slave' ? 2 : 5; + V.SecExp.rebellions.tension += random(5, 10); + rand = random(0, 5); + } else { + miniEvent = rebellionEventFires === 'slave' ? 3 : 6; + V.SecExp.rebellions.tension += random(10, 15); + rand = random(0, 4); + } + + t = `<br><br>`; + const {HeU, heU, hisU, himU, himselfU} = getNonlocalPronouns(V.seeDicks); + switch (miniEvent) { + case 1: + if (rand === 0) { + r.push(t + `This week several slaves were found plotting the death of their master. They were quickly dealt with, but their owner's choice of punishment did little to calm tensions in the arcology.`); + } else if (rand === 1) { + r.push(t + `This week a large group of slaves attempted to escape. Several were recaptured, but others were deemed too dangerous and were shot on sight. The unfortunate circumstances raised the disapproval of many citizens, either because of the waste of good slaves or the brutality with which the operation was carried. With a bit of luck, however, the incident will be soon forgotten.`); + } else if (rand === 2) { + r.push(t + `This week books of unknown origin and dangerous content were found in the possession of several slaves. They were mostly sociopolitical treaties, making it clear that the intent of the ones responsible was to fan the fire of rebellion. The books were quickly collected and archived, hopefully this affair will not have lasting consequences.`); + } else if (rand === 3) { + r.push(t + `This week a citizen was caught giving refuge to an escaped slave. He was not able to pay for the value of the stolen goods, so he was processed as the case required and the slave returned to their rightful master. Many questions however remain without answers.`); + } else if (rand === 4) { + r.push(t + `This week a member of a well known anti-slavery group was caught trying to infiltrate the arcology. During the capture attempt shots were fired and several guards were injured, and in the end the fugitive unfortunately managed to escape. Reports indicate several slaves helped the criminal, some going as far as using themselves as shields against the bullets of the security drones.`); + } else if (rand === 5) { + r.push(t + `This week a slave was caught attempting to sabotage a machine in one of the factories. ${HeU} explained ${hisU} action as "trying to defend ${himselfU} from a dangerous machine". Reports confirmed that the apparatus is indeed quite deadly, having killed several slaves since it was installed, but the expert way ${heU} handled the sabotage leaves open the possibility of a deliberate plan or even external help.`); + } else { + r.push(t + `This week a slave was found dead in one of the sewer tunnels. It seems ${heU} was stabbed repeatedly with a sharp object. ${HeU} was fairly famous for ${hisU} capabilities as a slave trainer; ${hisU} old master spent not an insignificant amount of money trying to find ${himU} once he realized ${heU} was missing. The episode might have been a simple mugging gone wrong, but ${hisU} activities as a slave breaker might have played a role in ${hisU} homicide.`); + } + break; + case 2: + if (rand === 0) { + r.push(t + `This week some strange reports came in: it seems some assemblies of slaves were observed several nights in a row. The slaves were traced and their masters notified, but many suspect there may be something deeper than a few slaves congregating in the night.`); + } else if (rand === 1) { + t += `This week an underground railroad was discovered. The rebels did not go down without a fight, but in the end `; + t += `your ${V.mercenaries >= 1 ? 'mercenaries' : 'security drones'}`; + r.push(t + ` managed to destroy the old tunnels they were using to ship out slaves out of the arcology.`); + } else if (rand === 2) { + r.push(t + `This week a famous citizen was assaulted and brutally murdered by his slaves. The ones responsible were apprehended and dealt with easily enough, but the mere fact something like this could have happened is concerning. Those slaves had to be aware of their certain doom.`); + } else if (rand === 3) { + r.push(t + `This week a group of slavers entering the arcology was assaulted. Many reported heavy injuries, but fortunately there were no casualties. The attackers were disguised, but the security systems already identified several slaves who were likely part of the group, based on camera feeds.`); + } else if (rand === 4) { + r.push(t + `This week the waterways were found infected by a virulent pathogen. The cause was later found to be a diseased slave that died while in the maintenance tunnels. It's not clear if the slave was there because of orders given to${himU} or if heU was trying to escape.`); + } else { + r.push(t + `This week a sleeper cell of a famous anti slavery organization was discovered in the low levels of the arcology. The group, however, was aware of the coming security forces and retreated before they could be dealt with.`); + } + break; + case 3: + if (rand === 0) { + r.push(t + `This week a group of slaves took control of one of the manufacturing plants and barricaded themselves inside. It took several days of negotiations and skirmishes to finally end this little insurrection. Many of the slaves involved will be executed in the next few days.`); + } else if (rand === 1) { + r.push(t + `This week a number of shops were burned to the ground by rioting slaves and sympathetic citizens. It took considerable effort for the security forces to take control of the situation. Harsh punishment is required and scheduled for the instigators.`); + } else if (rand === 2) { + r.push(t + `This week a mass escape attempt was barely stopped before becoming a catastrophe. Many citizens were trampled by the desperate horde of slaves. It will take some time to restore the streets involved to working order.`); + } else if (rand === 3) { + r.push(t + `This week a number of riots inflamed the arcology. Many slaves took violent actions against citizens and security personnel. The number of victims keeps getting higher as still now the last sparks of revolt are still active.`); + } + break; + case 4: + if (rand === 0) { + r.push(t + `This week a citizen refused to pay rent, claiming ideological opposition to the arcology's ownership policies. He was quickly dealt with, but his words might not have fallen silent yet.`); + } else if (rand === 1) { + r.push(t + `This week books of unknown origin and dangerous content were found in the possession of several citizens. They were mostly sociopolitical treaties, making it clear that the intent of the ones responsible was to fan the fire of rebellion. Most of them were bought and archived, but a few are still circling amongst the citizens of the arcology.`); + } else if (rand === 2) { + r.push(t + `This week a citizen was caught giving refuge to other citizens, who would be liable to be enslaved because of their debts. The situation was quickly resolved, but the misplaced generosity of that citizen might have inflamed a few souls.`); + } else if (rand === 3) { + r.push(t + `This week a citizen died in one of the factories. His death sparked some outrage, even some talk of protests against the owners of the factory, but things seem to have calmed down for now.`); + } else if (rand === 4) { + r.push(t + `This week a citizen refused to be evicted from his house. After some negotiations the man was forcibly removed from the property by your security forces. Unfortunately the forced entry caused some damage to the building.`); + } else if (rand === 5) { + r.push(t + `This week a citizen refused to be enslaved as his contract established. With an impressive display of his rhetoric capabilities he managed to gather a small crowd agreeing with his position. The impromptu assembly was promptly disrupted by the drones.`); + } else { + r.push(`This week a security drone was found disabled and stripped of important electronic components. It seems the act was not dictated by greed, as the most precious parts of the drone were left on the machine, but rather to cover up something that the drone saw.`); + } + break; + case 5: + if (rand === 0) { + r.push(t + `This week a factory was subject to a strike by a group of citizens protesting against the owner. They were promptly arrested and the factory returned to its rightful proprietor by your security department.`); + } else if (rand === 1) { + r.push(t + `This week a group of citizens organized a protest against the systemic enslavement of the citizens of the arcology. Their little parade gathered a surprisingly large crowd, but it was nonetheless quickly suppressed by your forces.`); + } else if (rand === 2) { + r.push(t + `This week the security department registered the formation of several assemblies of citizens, whose purpose seems to be political in nature. For now no further steps were taken, but it's a worrying sign of further political opposition within the arcology.`); + } else if (rand === 3) { + r.push(t + `This week there was a protest against one of the wealthiest citizen of the arcology. Many criticize his near monopoly. Supporters of the citizen met the protesters on the streets and it was just thanks to the intervention of the security drones that violence was avoided.`); + } else if (rand === 4) { + r.push(t + `This week several cameras were sabotaged and in many cases damaged beyond repair. A group of anonymous citizens claims to be responsible; their motivation is apparently the excessive surveillance in the arcology and their attack a response to the breach of their privacy.`); + } else { + r.push(t + `This week several citizens barricaded themselves in a private brothel. It seems their intention is to protest against the use of ex-citizens in the sex trade, claiming that such a position is unfitting for them. The problem was quickly resolved with the intervention of the security department.`); + } + break; + case 6: + if (rand === 0) { + r.push(t + `This week the arcology was shaken by a number of strikes throughout the manufacturing levels. Many lament the predatory nature of Free Cities society, many other just want to cause damage to their perceived oppressors. It was a significant effort for the security department to stop all protests.`); + } else if (rand === 1) { + r.push(t + `This week several factories were set aflame by their workers. The security department worked day and night to control the fire and apprehend the criminals behind the act. Many are known dissidents, but there are a fair few new faces within them. This is a worrying sign.`); + } else if (rand === 2) { + r.push(t + `This week numerous riots exploded all over the arcology. Many citizens took to the streets to protest against the arcology owner and its supporters. The security forces slowly managed to stop the rioters, with no small amount of trouble and only through generous use of violence.`); + } else if (rand === 3) { + r.push(t + `This week a massive protest of citizens and slaves gathered just outside the penthouse. The crowd was dispersed only after several hours. There were several victims from both sides and no shortage of injured.`); + } + break; + } + V.SecExp.rebellions.tension = Math.clamp(V.SecExp.rebellions.tension, 0, 100); + } else if (V.SecExp.rebellions.tension > 0) { // otherwise SecExp.rebellions.tension decays + r.push(`<br><br><strong>SecExp.rebellions.tension</strong>:`); + if (V.SecExp.buildings.riotCenter.upgrades.freeMedia >= 1) { + r.push(`The guaranteed free media access you offer does wonders to lower tensions in the arcology.`); + V.SecExp.rebellions.tension = Math.trunc(Math.clamp(V.SecExp.rebellions.tension - V.SecExp.buildings.riotCenter.upgrades.freeMedia / 2, 0, 100)); + } + r.push(`In the absence of noteworthy events, tensions in the arcology are able to relax.`); + V.SecExp.rebellions.tension = Math.trunc(Math.clamp(V.SecExp.rebellions.tension * 0.97, 0, 100)); + } + + if (V.SecExp.rebellions.tension < oldTension) { + r.push(`<br><br>This week <span class="green">tensions relaxed.</span><br>`); + } else if (V.SecExp.rebellions.tension === oldTension && V.SecExp.rebellions.tension !== 0) { + r.push(`<br><br>This week <span class="yellow">tensions did not change.</span><br>`); + } else if (V.SecExp.rebellions.tension > oldTension) { + r.push(`<br><br>This week <span class="red">tension rose</span> and <span class="red">${rebellionEventFires} malcontent increased.</span><br>`); + } else if (!Number.isInteger(V.SecExp.rebellions.tension)) { + r.push(`<br><br><span class="red">Error: tension is outside accepted range.</span><br>`); + } + + App.SecExp.generator.rebellion(); // rolls for rebellions + } + return r.join(" "); +}; diff --git a/src/Mods/SecExp/js/buildingsJS.js b/src/Mods/SecExp/js/buildingsJS.js index 76b52a16408e9b86c220d9763471bd03f171411e..ad1f3d367ca84845cb1577bfb0d2b24f98b94c7f 100644 --- a/src/Mods/SecExp/js/buildingsJS.js +++ b/src/Mods/SecExp/js/buildingsJS.js @@ -80,7 +80,7 @@ App.SecExp.weapManuUpgrade = (function() { break; case 7: Object.assign(o, { - dec: `a variant of the stimulant cocktail that the ${V.SF.Lower} created`, type: "hp and morale", + dec: `a variant of the stimulant cocktail that the ${V.SF.Lower} created`, type: "hp and morale", cost: 300000 }); break; diff --git a/src/Mods/SecExp/js/secExp.js b/src/Mods/SecExp/js/secExp.js index 6e1edc00fab7bf3cd6eeafd043d33a8a89df3e1f..f8a3e6c6c52169eecbb5891c7db82bf9ed3b32c8 100644 --- a/src/Mods/SecExp/js/secExp.js +++ b/src/Mods/SecExp/js/secExp.js @@ -1,3 +1,267 @@ +App.SecExp.generator = (function() { + return { + attack, + rebellion, + }; + + function loyaltyCheck(squad) { + if ((squad.loyalty < 10 && random(1, 100) <= 70) || (squad.loyalty < 33 && random(1, 100) <= 30) || (squad.loyalty < 66 && random(1, 100) <= 10)) { + rebellingID.push(squad.ID); + } + } + + 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) { + if (V.week < 30) { + attackChance = 5; + } else if (V.week < 60) { + attackChance = 8; + } else if (V.week < 90) { + attackChance = 12; + } else if (V.week < 120) { + attackChance = 16; + } else { + attackChance = 20; + } + if (V.SecExp.battles.victories + V.SecExp.battles.losses >= 0) { + attackChance = 25; + } + + if (V.SecExp.battles.lastEncounterWeeks >= 10) { + attackChance += V.SecExp.battles.lastEncounterWeeks/2; // attackChance += 5; + } + /* if (V.terrain === "oceanic") { + attackChance -= 10; + } */ + attackChance *= V.SecExp.settings.battle.frequency; // battle frequency + if (V.SecExp.settings.battle.force === 1 && V.SecExp.settings.rebellion.force === 0) { + attackChance = 100; + } + } + + if (random(1, 100) > attackChance) { // Rolls to see if attack happens this week + V.SecExp.battles.lastEncounterWeeks++; + } else { + let type, terrain, troops, equip; + V.attackThisWeek = 1; + V.SecExp.battles.lastEncounterWeeks = 0; + let raider = 25, oldWorld = 25, freeCity = 25, free = 25; // type is the chance out of 100 of an attack of that type happening + // the old world attracted by "degenerate" future societies + const setA = [ + 'FSRomanRevivalist', 'FSEdoRevivalist', 'FSArabianRevivalist', + 'FSChineseRevivalist', 'FSEgyptianRevivalist', 'FSAztecRevivalist']; + const setB = [ + 'FSRepopulationFocus', 'FSGenderRadicalist', 'FSPastoralist', + 'FSChattelReligionist', 'FSNeoImperialist']; + const resultA = setA.some((FS) => V.arcologies[0][FS] !== "unset"); + const resultB = setB.some((FS) => V.arcologies[0][FS] !== "unset"); + if (resultA && resultB) { + oldWorld += 15; + raider -= 5; + freeCity -= 5; + free -= 5; + } else if (resultA || resultB) { + oldWorld += 24; + raider -= 8; + freeCity -= 8; + free -= 8; + } + // freedom fighters attracted by high slave/citizen ratio + if (V.ASlaves > V.ACitizens * 2) { + oldWorld -= 8; + raider -= 8; + freeCity -= 8; + free += 24; + } else if (V.ASlaves > V.ACitizens * 1.2 || V.arcologies[0].FSDegradationist !== "unset") { + oldWorld -= 5; + raider -= 5; + freeCity -= 5; + free += 15; + } + // free Cities attracted by high prosperity + if (V.arcologies[0].prosperity >= 10 && V.arcologies[0].prosperity < 20) { + oldWorld -= 5; + raider -= 5; + freeCity += 15; + free -= 5; + } else if (V.arcologies[0].prosperity >= 20) { + oldWorld -= 8; + raider -= 8; + freeCity += 24; + free -= 8; + } + // raiders are attracted by low security + if (V.SecExp.core.security <= 50) { + oldWorld -= 5; + raider += 15; + freeCity -= 5; + free -= 5; + } else if (V.SecExp.core.security <= 25) { + oldWorld -= 8; + raider += 24; + freeCity -= 8; + free -= 8; + } + + const roll = random(1, 100); // makes the actual roll + if (roll <= raider) { + type = "raiders"; + } else if (roll <= raider + oldWorld) { + type = "old world"; + } else if (roll <= raider + oldWorld + freeCity) { + type = "free city"; + } else if (roll <= raider + oldWorld + freeCity + free) { + type = "freedom fighters"; + } + + if (V.terrain === "urban") { + terrain = either("outskirts", "urban", "wasteland"); + } else if (V.terrain === "rural") { + terrain = either("hills", "outskirts", "rural", "wasteland"); + } else if (V.terrain === "ravine") { + 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 { + terrain = "error"; + } + + let L = 0; + if (type === "raiders") { + troops = random(40, 80); L = 1; + } else if (type === "free city") { + troops = random(20, 40); + } else if (type === "old world") { + troops = random(25, 50); + } else if (type === "freedom fighters") { + troops = random(30, 60); + } + if (V.week < 30) { + troops *= random(1, 2); // troops *= Math.trunc(random( (1*(1.01+(V.week/100))), (2*(1.01+(V.week/100))) ))) { + } else if (V.week < 60) { + troops *= random(1, 3); // troops *= Math.trunc(random( (1*(1.01+(V.week/200))), (3*(1.01+(V.week/200))) ))) { + } else if (V.week < 90) { + troops *= random(2, 3); // troops *= Math.trunc(random( (2*(1.01+(V.week/300))), (3*(1.01+(V.week/300))) ))) { + } else if (V.week < 120) { + troops *= random(2, 4); // troops *= Math.trunc(random( (2*(1.01+(V.week/400))), (4*(1.01+(V.week/400))) ))) { + } else { + troops *= random(3, 5); + } + if (V.week < 60) { + equip = random(0, 1); + } else if (V.week < 90) { + equip = random(0, 3-L); // "raiders" equip = random(0,2)) { + } else if (V.week < 120) { + equip = random(1-L, 3); // "raiders" equip = random(0,3)) { + } else { + equip = random(2-L, 4-L); // "raiders" equip = random(1,3)) { + } + + if (V.SecExp.settings.battle.major.enabled === 1) { // major battles have a 50% chance of firing after week 120 + if (V.week >= 120 || V.SecExp.settings.battle.major.force === 1) { + if (random(1, 100) >= 50 || V.SecExp.settings.battle.major.force === 1) { + V.majorBattle = 1; + 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); + } + } + } + + shared(); + V.SecExp.war.attacker.troops = troops; + V.SecExp.war.attacker.equip = equip; + V.SecExp.war.attacker.type = type; + V.SecExp.war.terrain = terrain; + V.SecExp.war.deploySF = 0; + V.SecExp.war.saveValid = 0; + V.SecExp.war.tacticsSuccessful = 0; + V.SecExp.war.chosenTactic = either("Bait and Bleed", "Blitzkrieg", "Choke Points", "Defense In Depth", "Guerrilla", "Human Wave", "Interior Lines", "Pincer Maneuver"); + V.SecExp.war.estimatedMen = normalRandInt(troops, troops * (4 - App.SecExp.battle.recon()) * 0.05); + V.SecExp.war.expectedEquip = normalRandInt(equip, (4 - App.SecExp.battle.recon()) * 0.25); + } + } + + function rebellion() { + let type; + if (V.SecExp.rebellions.slaveProgress >= 100) { + if (random(1, 100) <= 80) { // 80% of firing a rebellion once progress is at 100 + type = V.slaveRebellion = 1; + V.SecExp.rebellions.slaveProgress = 0; + V.SecExp.rebellions.citizenProgress *= 0.2; + } else { + V.SecExp.rebellions.slaveProgress = 100; + } + } else if (V.SecExp.rebellions.citizenProgress >= 100) { + if (random(1, 100) <= 80) { + type = V.citizenRebellion = 1; + V.SecExp.rebellions.citizenProgress = 0; + V.SecExp.rebellions.slaveProgress *= 0.2; + } else { + V.SecExp.rebellions.citizenProgress = 100; + } + } + + if (V.SecExp.settings.rebellion.force === 1 && V.foughtThisWeek === 0) { + type = random(1, 100) <= 50 ? V.slaveRebellion = 1 : V.citizenRebellion = 1; + } + + if (!type) { + V.SecExp.rebellions.lastEncounterWeeks++; + } else { + const isSlaveRebellion = V.slaveRebellion === 1; + let weekMod, rebellingID = []; + if (V.week <= 30) { + weekMod = 0.75 + (0.01+(V.week/200)); + } else if (V.week <= 60) { + weekMod = 1 + (0.01+(V.week/300)); + } else if (V.week <= 90) { + weekMod = 1.25 + (0.01+(V.week/400)); + } else if (V.week <= 120) { + weekMod = 1.50 + (0.01+(V.week/500)); + } else { + weekMod = 1.75; + } + + shared(); + V.SecExp.rebellions.lastEncounterWeeks = 0; + const authFactor = Math.clamp(1 - (V.SecExp.core.authority / 20000), 0.4, 0.6); + const repFactor = Math.clamp(V.rep / 20000, 0.4, 0.6); + const rebelPercent = 0.3 * authFactor; + const irregularPercent = 0.2 * repFactor; + + for (const unit of V.slaveUnits) { + loyaltyCheck(unit); + } + for (const unit of V.militiaUnits) { + loyaltyCheck(unit); + } + for (const unit of V.mercUnits) { + loyaltyCheck(unit); + } + + const baseValue = Math.trunc((isSlaveRebellion ? V.ASlaves : V.ACitizens) * rebelPercent * weekMod) + random(-100, 100); + const highestValue = isSlaveRebellion ? V.ASlaves : V.ACitizens; + V.SecExp.war.attacker.troops = Math.clamp(baseValue, 50, highestValue); + V.SecExp.war.attacker.equip = Math.clamp(V.SecExp.edicts.weaponsLaw + random((isSlaveRebellion ? -2 : -1), 1), 0, 4); + V.SecExp.war.irregulars = Math.clamp(Math.trunc(V.ACitizens * irregularPercent * weekMod) + random(-100, 100), 50, V.ACitizens); + V.SecExp.war.engageRule = 0; + V.SecExp.war.rebellingID = rebellingID; + } + } +})(); + /** * Returns the effect (if any) the Special Force provides. * @param {string} [report] which report is this function being called from. @@ -187,26 +451,7 @@ App.SecExp.generalInit = function() { reactor: 0, arc: 0 }, - units: { - bots: {}, - slaves: { - created: 0, - casualties: 0, - squads: [] - }, - militia: { - created: 0, - free: 0, - casualties: 0, - squads: [] - }, - mercs: { - created: 0, - free: 0, - casualties: 0, - squads: [] - } - }, + units: {}, */ edicts: { alternativeRents: 0, @@ -395,7 +640,7 @@ App.SecExp.battle = (function() { if (V.secBots.isDeployed > 0) { bots++; } - if (V.SF.Toggle && V.SF.Active >= 1 && V.SFIntervention) { + if (V.SF.Toggle && V.SF.Active >= 1 && V.SecExp.war.deploySF) { init++; } @@ -409,13 +654,13 @@ App.SecExp.battle = (function() { if (V.SF.Toggle && V.SF.Active >= 1) { init++; } - if (V.irregulars > 0) { + if (V.SecExp.war.irregulars > 0) { militiaC++; } - militiaC += V.militiaUnits.filter((u) => u.active === 1 && !V.rebellingID.includes(u.ID)).length; - slavesC += V.slaveUnits.filter((u) => u.active === 1 && !V.rebellingID.includes(u.ID)).length; - mercsC += V.mercUnits.filter((u) => u.active === 1 && !V.rebellingID.includes(u.ID)).length; + militiaC += V.militiaUnits.filter((u) => u.active === 1 && !V.SecExp.war.rebellingID.includes(u.ID)).length; + slavesC += V.slaveUnits.filter((u) => u.active === 1 && !V.SecExp.war.rebellingID.includes(u.ID)).length; + mercsC += V.mercUnits.filter((u) => u.active === 1 && !V.SecExp.war.rebellingID.includes(u.ID)).length; } if (input === '') { @@ -454,17 +699,17 @@ App.SecExp.battle = (function() { troops += V.secBots.troops; } countHumanTroops((u) => u.isDeployed === 1); - if (V.SF.Toggle && V.SF.Active >= 1 && V.SFIntervention) { + if (V.SF.Toggle && V.SF.Active >= 1 && V.SecExp.war.deploySF) { troops += App.SecExp.troopsFromSF(); } } else { - if (V.irregulars > 0) { - troops += V.irregulars; + if (V.SecExp.war.irregulars > 0) { + troops += V.SecExp.war.irregulars; } if (V.secBots.active === 1) { troops += V.secBots.troops; } - countHumanTroops((u) => u.active === 1 && !V.rebellingID.includes(u.ID)); + countHumanTroops((u) => u.active === 1 && !V.SecExp.war.rebellingID.includes(u.ID)); if (V.SF.Toggle && V.SF.Active >= 1) { troops += App.SecExp.troopsFromSF(); } @@ -564,17 +809,17 @@ App.SecExp.battle = (function() { function bribeCost() { let cost; const baseBribePerAttacker = 5; if (V.week <= 30) { - cost = 5000 + baseBribePerAttacker * V.attackTroops; + cost = 5000 + baseBribePerAttacker * V.SecExp.war.attacker.troops; } else if (V.week <= 40) { - cost = 10000 + baseBribePerAttacker * V.attackTroops; + cost = 10000 + baseBribePerAttacker * V.SecExp.war.attacker.troops; } else if (V.week <= 50) { - cost = 15000 + baseBribePerAttacker * V.attackTroops; + cost = 15000 + baseBribePerAttacker * V.SecExp.war.attacker.troops; } else if (V.week <= 60) { - cost = 20000 + baseBribePerAttacker * V.attackTroops; + cost = 20000 + baseBribePerAttacker * V.SecExp.war.attacker.troops; } else if (V.week <= 70) { - cost = 25000 + baseBribePerAttacker * V.attackTroops; + cost = 25000 + baseBribePerAttacker * V.SecExp.war.attacker.troops; } else { - cost = 30000 + baseBribePerAttacker * V.attackTroops; + cost = 30000 + baseBribePerAttacker * V.SecExp.war.attacker.troops; } cost *= V.majorBattle > 0 ? 3 : 1; return Math.trunc(Math.clamp(cost, 0, 1000000)); diff --git a/src/Mods/SecExp/js/securityReport.js b/src/Mods/SecExp/js/securityReport.js new file mode 100644 index 0000000000000000000000000000000000000000..1e8592a75be334351e2c589c0c29ea43aa6cf20a --- /dev/null +++ b/src/Mods/SecExp/js/securityReport.js @@ -0,0 +1,516 @@ +App.SecExp.securityReport = function() { + let immigration = 0, emigration = 0, secGrowth = 0, crimeGrowth = 0; + if (V.ACitizens > V.oldACitizens) { + immigration = V.ACitizens - V.oldACitizens; + } else { + emigration = V.oldACitizens - V.ACitizens; // takes into account citizens leaving and those getting enslaved + } + const activeUnits = App.SecExp.battle.activeUnits(); + let SF, t = ``; + let r = V.useTabs === 0 ? [' <br>__Security__<br>'] : []; + + if (V.SecExp.buildings.secHub && V.SecExp.buildings.secHub.menials > 0) { + r.push(`${num(V.SecExp.buildings.secHub.menials)} slaves work to improve the security of your arcology, while your`); + } else { + r.push(`Your `); + } + + if (V.mercenaries >= 1 && V.arcologyUpgrade.drones === 1) { + r.push(`mercenaries and security drones tirelessly patrol the streets to keep them safe.`); + } else if (V.arcologyUpgrade.drones === 1) { + r.push(`security drones tirelessly patrol the arcology to keep it safe.`); + } else { + r.push(`loyal subordinates try to keep the arcology safe to the best of their abilities.`); + } + + // security modifiers + if (V.PC.career === "mercenary") { + r.push(`Your past life as a mercenary makes it easier to manage the security of the arcology.`); + secGrowth += 1; + } + if (V.SecExp.smilingMan.progress === 10) { + r.push(`The ex-criminal known to the world as The Smiling Man puts their impressive skills to work, dramatically increasing the efficiency of your security measures.`); + secGrowth += 2; + } + if (V.ACitizens + V.ASlaves <= 5000) { + r.push(`The small number of residents makes their job easier.`); + secGrowth += 2; + } else if (V.ACitizens + V.ASlaves <= 7500) { + r.push(`The fairly low number of residents makes their job a little easier.`); + secGrowth += 1; + } else if (V.ACitizens + V.ASlaves <= 10000) { + r.push(`The fairly high number of residents makes their job a little harder.`); + secGrowth -= -0.5; + } else if (V.ACitizens + V.ASlaves <= 15000) { + r.push(`The high number of residents makes their job harder.`); + secGrowth -= 1; + } else { + r.push(`The extremely high number of residents makes their job a lot harder.`); + secGrowth -= 2; + } + if (immigration >= 0 && emigration === 0) { + if (immigration < 50) { + r.push(`The limited number of immigrants that reached the arcology this week does not have any serious impact on the efficiency of current security measures.`); + secGrowth += 0.5; + } else if (immigration < 150) { + r.push(`The number of immigrants that reached the arcology this week is high enough to complicate security protocols.`); + secGrowth -= 0.2; + } else if (immigration < 300) { + r.push(`The high number of immigrants that reached the arcology this week complicates security protocols.`); + secGrowth -= 0.5; + } else if (immigration < 500) { + r.push(`The high number of immigrants that reached the arcology this week severely complicates security protocols.`); + secGrowth -= 1; + } else { + r.push(`The extremely high number of immigrants that reached the arcology this week severely complicates security protocols.`); + secGrowth -= 2; + } + } + if (V.visitors < 300) { + r.push(`The limited number of visitors coming and going did not have any serious impact on the efficiency of current security measures.`); + secGrowth += 0.5; + } else if (immigration < 750) { + r.push(`The number of visitors coming and going somewhat complicates security protocols.`); + secGrowth -= 0.2; + } else if (immigration < 1500) { + r.push(`The high number of visitors coming and going complicates security protocols.`); + secGrowth -= 0.5; + } else if (immigration < 2500) { + r.push(`The high number of visitors coming and going greatly complicates security protocols.`); + secGrowth -= 1; + } else { + r.push(`The extremely high number of visitors coming and going severely complicates security protocols.`); + secGrowth -= 2; + } + if (emigration !== 0 && immigration === 0) { + if (emigration < 100) { + r.push(`The limited reduction in citizens this week does not have any serious impact on the efficiency of current security measures.`); + secGrowth += 0.5; + } else if (emigration < 300) { + r.push(`The reduction in citizens this week is high enough to complicate security protocols.`); + secGrowth -= 0.2; + } else if (emigration < 600) { + r.push(`The large reduction in citizens this week complicates security protocols.`); + secGrowth -= 0.5; + } else if (emigration < 1000) { + r.push(`The huge reduction in citizens this week severely complicates security protocols.`); + secGrowth -= 1; + } else { + r.push(`The extreme reduction in citizens this week severely complicates security protocols.`); + secGrowth -= 2; + } + } + if (V.SecExp.core.crimeLow < 20) { + r.push(`Crime is a distant problem in the arcology, which makes improving security easier.`); + secGrowth += 1; + } else if (V.SecExp.core.crimeLow < 40) { + r.push(`Crime is a minor problem in the arcology, not serious enough to disrupt security efforts.`); + } else if (V.SecExp.core.crimeLow < 60) { + r.push(`Crime is an issue in the arcology, which makes improving security harder.`); + secGrowth -= 0.5; + } else if (V.SecExp.core.crimeLow < 80) { + r.push(`Crime is an overbearing problem in the arcology, which makes improving security a lot harder.`); + secGrowth -= 1; + } else { + r.push(`Crime is sovereign in the arcology, which makes improving security extremely difficult.`); + secGrowth -= 2; + } + if (V.SecExp.core.authority < 5000) { + r.push(`The low authority you hold on the arcology hampers the efforts of your security department.`); + secGrowth -= 1; + } else if (V.SecExp.core.authority < 7500) { + r.push(`The limited authority you hold on the arcology hampers the efforts of your security department.`); + secGrowth -= 0.5; + } else if (V.SecExp.core.authority < 10000) { + r.push(`The authority you hold on the arcology does not significantly impact the efforts of your security department.`); + } else if (V.SecExp.core.authority < 15000) { + r.push(`The high authority you hold on the arcology facilitates the security department's work.`); + secGrowth += 0.5; + } else { + r.push(`The absolute authority you hold on the arcology makes the security department's work a lot easier.`); + secGrowth += 1; + } + if (activeUnits >= 6) { + r.push(`Your military is the size of a small army. Security is easier to maintain with such forces at your disposal.`); + secGrowth += 0.5; + } + if (V.SecExp.battles.victories + V.SecExp.battles.losses >= 1) { + if (V.SecExp.battles.lastEncounterWeeks < 3) { + r.push(`The recent attack has a negative effect on the security of the arcology.`); + secGrowth -= 1; + } else if (V.SecExp.battles.lastEncounterWeeks < 5) { + r.push(`While some time has passed, the last attack still has a negative effect on the security of the arcology.`); + secGrowth -= 0.5; + } else { + r.push(`The arcology has not been attacked in a while, which has a positive effect on security.`); + secGrowth += 0.5; + } + } + + if (V.SecExp.buildings.transportHub) { + secGrowth -= (V.SecExp.buildings.transportHub.airport + V.SecExp.buildings.transportHub.surfaceTransport - V.SecExp.buildings.transportHub.security * 3) / 2; + t = `The transport hub, for all its usefulness, is a hotspot of malicious`; + if (V.SecExp.buildings.transportHub.airport + V.SecExp.buildings.transportHub.surfaceTransport > V.SecExp.buildings.transportHub.security * 3) { + r.push(t + `activity and hub security forces are not sufficient to keep up with all threats.`); + } else { + r.push(t + `activity, but the hub security forces are up to the task.`); + } + } + + if (V.SecExp.buildings.propHub && V.SecExp.buildings.propHub.upgrades.blackOps > 0) { + r.push(`Your black ops team proves to be a formidable tool against anyone threatening the security of your arcology.`); + secGrowth += 0.5 * random(1, 2); + } + + const assistantDamaged = V.garrison.assistantTime; + if (assistantDamaged > 0) { + t = `With the central CPU core of the assistant down, managing security is a much harder task. Inevitably some little but important details will slip past your agents.`; + r.push(t + `${numberWithPluralOne(assistantDamaged, 'week')} to finish repair works.`); + secGrowth--; + crimeGrowth++; + V.garrison.assistantTime--; IncreasePCSkills('engineering', 0.1); + } + + if (V.SF.Toggle && V.SF.Active >= 1) { + if (V.SecExp.edicts.SFSupportLevel >= 3) { + r.push(`The two squads of ${V.SF.Lower} assigned to the Security HQ provide an essential help to the security department.`); + } + if (V.SecExp.edicts.SFSupportLevel >= 2) { + r.push(`The training officers of ${V.SF.Lower} assigned to the Security HQ improve its effectiveness.`); + } + if (V.SecExp.edicts.SFSupportLevel >= 1) { + r.push(`Providing your Security Department with equipment from ${V.SF.Lower} slightly boosts the security of your arcology.`); + } + secGrowth *= 1+(V.SecExp.edicts.SFSupportLevel/10); + } + + let secRest = App.SecExp.Check.secRestPoint() * (Math.clamp(V.SecExp.buildings.secHub ? V.SecExp.buildings.secHub.menials : 0, 0, App.SecExp.Check.reqMenials()) / App.SecExp.Check.reqMenials()); + secRest = Math.max(20, secRest); + if (secRest < App.SecExp.Check.reqMenials() && V.SecExp.buildings.secHub) { + r.push(`The limited staff assigned to the HQ hampered the improvements to security achieved this week.`); + } else if (secRest < App.SecExp.Check.reqMenials()) { + r.push(`The limited infrastructure available slowly erodes away the security level of the arcology.`); + } + + t = `The security level of the arcology is`; + if (V.SecExp.core.security > (secRest + 5)) { + r.push(t + `over its effective resting point, limiting the achievable growth this week.`); + secGrowth *= 0.5; + } else if (V.SecExp.core.security < (secRest - 5)) { + r.push(t + `under its effective resting point, speeding up its growth.`); + secGrowth *= 1.5; + } else if (V.SecExp.core.security === secRest) { + r.push(t + `at its effective resting point, this severely limits the influence of external factors on the change achievable this week.`); + secGrowth *= 0.3; + } else { + r.push(t + `near its effective resting point, this severely limits the influence of external factors on the change achievable this week.`); + if (secGrowth < 0) { + secGrowth *= 0.3; + } + } + + const restGrowth = (secRest - V.SecExp.core.security) * 0.2; + const newSec = Math.trunc(V.SecExp.core.security + secGrowth + restGrowth); + if (newSec < V.SecExp.core.security) { + r.push(`This week <span class="red">security decreased.</span>`); + } else if (newSec === V.SecExp.core.security) { + r.push(`This week <span class="yellow">security did not change.</span>`); + } else { + r.push(`This week <span class="green">security improved.</span>`); + } + V.SecExp.core.security = Math.clamp(newSec, 0, 100); + + r.push(`<br><br><strong>Crime</strong>:`); + t = `Due to the deterioration of the old world countries, organized crime focuses more and more on the prosperous Free Cities, yours included. This has a`; + if (V.week < 30) { + t += `small`; + crimeGrowth += 0.5; + } else if (V.week < 60) { + t += `noticeable`; + crimeGrowth += 1; + } else if (V.week < 90) { + t += `moderate`; + crimeGrowth += 1.5; + } else if (V.week < 120) { + t += `big`; + crimeGrowth += 2; + } else { + r.push(`huge`); + crimeGrowth += 2.5; + } + r.push(t + `impact on the growth of criminal activities in your arcology.`); + + if (V.arcologies[0].prosperity < 50) { + r.push(`The low prosperity of the arcology facilitates criminal recruitment and organization.`); + crimeGrowth += 1; + } else if (V.arcologies[0].prosperity < 80) { + r.push(`The fairly low prosperity of the arcology facilitates criminal recruitment and organization.`); + crimeGrowth += 0.5; + } else if (V.arcologies[0].prosperity < 120) { + r.push(`The prosperity of the arcology is not high or low enough to have significant effects on criminal recruitment and organization.`); + } else if (V.arcologies[0].prosperity < 160) { + r.push(`The prosperity of the arcology is high enough to provide its citizens a decent life, hampering criminal recruitment and organization.`); + crimeGrowth -= 0.5; + } else if (V.arcologies[0].prosperity < 180) { + r.push(`The prosperity of the arcology is high enough to provide its citizens a decent life, significantly hampering criminal recruitment and organization.`); + crimeGrowth -= 1; + } else { + r.push(`The prosperity of the arcology is high enough to provide its citizens a very good life, significantly hampering criminal recruitment and organization.`); + crimeGrowth -= 2; + } + if (V.ASlaves < 1000) { + r.push(`The low number of slaves in the arcology does not hinder the activity of law enforcement, limiting crime growth.`); + crimeGrowth -= 1; + } else if (V.ASlaves < 2000) { + r.push(`The fairly low number of slaves in the arcology does not hinder significantly the activity of law enforcement, limiting crime growth.`); + crimeGrowth -= 0.5; + } else if (V.ASlaves < 3000) { + r.push(`The number of slaves in the arcology is becoming an impediment for law enforcement, facilitating crime growth.`); + crimeGrowth += 1; + } else { + r.push(`The number of slaves in the arcology is becoming a big issue for law enforcement, facilitating crime growth.`); + crimeGrowth += 1.5; + } + if (V.SecExp.core.security <= 20) { + r.push(`The security measures in place are severely limited, allowing crime to grow uncontested.`); + } else if (V.SecExp.core.security <= 50) { + r.push(`The security measures in place are of limited effect and use, giving only mixed results in their fight against crime.`); + crimeGrowth -= 1.5; + } else if (V.SecExp.core.security <= 75) { + r.push(`The security measures in place are well developed and effective, making a serious dent in the profitability of criminal activity in your arcology.`); + crimeGrowth -= 3; + } else { + r.push(`The security measures in place are extremely well developed and very effective, posing a serious threat even to the most powerful criminal organizations in existence.`); + crimeGrowth -= 5.5; + } + if (V.SecExp.core.authority < 5000) { + r.push(`Your low authority allows crime to grow undisturbed.`); + crimeGrowth += 1; + } else if (V.SecExp.core.authority < 7500) { + r.push(`Your relatively low authority facilitates criminal activities.`); + crimeGrowth += 0.5; + } else if (V.SecExp.core.authority < 10000) { + r.push(`Your authority is not high enough to discourage criminal activity.`); + } else if (V.SecExp.core.authority < 15000) { + r.push(`Your high authority is an effective tool against crime.`); + crimeGrowth -= 1; + } else { + r.push(`Your absolute authority is an extremely effective tool against crime.`); + crimeGrowth -= 2; + } + if (V.cash >= 100000) { + r.push(`Your great wealth acts as a beacon for the greediest criminals, calling them to your arcology as moths to a flame.`); + crimeGrowth += 0.5; + } + if (V.SecExp.buildings.propHub && V.SecExp.buildings.propHub.upgrades.marketInfiltration > 0) { + crimeGrowth += 0.5 * random(1, 2); + } + + const crimeCap = Math.trunc(Math.clamp(App.SecExp.Check.crimeCap() + (App.SecExp.Check.crimeCap() - App.SecExp.Check.crimeCap() * ((V.SecExp.buildings.secHub ? V.SecExp.buildings.secHub.menials : 0) / App.SecExp.Check.reqMenials())), 0, 100)); + if (crimeCap > App.SecExp.Check.crimeCap() && V.SecExp.buildings.secHub) { + r.push(`The limited staff assigned to the HQ allows more space for criminals to act.`); + } + if (V.SecExp.core.authority > 12000) { + if (V.SecExp.buildings.secHub.coldstorage < 6) { + if (V.SecExp.buildings.secHub.coldstorage === 0) { + t = `Adding a facility`; + } else { + t = `Improving the cold storage facility attached`; + } + r.push(t + ` to the SecurityHQ should allow the staff to be more efficient in dealing with crime.`); + } else { + r.push(`The cold storage facility attached to SecurityHQ allows the staff to be more efficient in dealing with crime.`); + } + } + const newCrime = Math.trunc(Math.clamp(V.SecExp.core.crimeLow + crimeGrowth, 0, crimeCap)); + if (newCrime > V.SecExp.core.crimeLow) { + r.push(`This week <span class="red">crime increased.</span>`); + } else if (newCrime === V.SecExp.core.crimeLow) { + r.push(`This week <span class="yellow">crime did not change.</span>`); + } else { + r.push(`This week <span class="green">crime decreased.</span>`); + } + V.SecExp.core.crimeLow = Math.clamp(newCrime, 0, 100); + + if (V.SecExp.edicts.defense.militia >= 1 || activeUnits >= 1) { + r.push(`<br><br> <strong>Military</strong>:`); + if (V.SecExp.edicts.defense.militia >= 1) { + let recruitsMultiplier = 1, recruitLimit = 0, adjst; + + SF = App.SecExp.assistanceSF('security', 'militia'); + r.push(SF.text); recruitsMultiplier += SF.bonus; + + const propagandaEffects = App.SecExp.propagandaEffects("recruitment"); + r.push(`${propagandaEffects.text}`); + recruitsMultiplier *= (1 + propagandaEffects.effect); + if (V.SecExp.edicts.defense.militia === 2) { + r.push(`Your militia accepts only volunteering citizens, ready to defend their arcology.`); + recruitLimit = App.SecExp.militiaCap(); adjst = 0.0025; + if (V.rep >= 10000) { + r.push(`Many citizens volunteer just to fight for someone of your renown.`); + recruitLimit += adjst; + } + if (V.SecExp.core.authority >= 10000) { + r.push(`Many citizens feel it is their duty to fight for you, boosting volunteer enrollment.`); + recruitLimit += adjst; + } + } else if (V.SecExp.edicts.defense.militia === 3) { + r.push(`Adult citizens are required to join the militia for a period of time.`); + recruitLimit = App.SecExp.militiaCap(); adjst = 0.005; + } else if (V.SecExp.edicts.defense.militia === 4) { + r.push(`Adult citizens are required to register and serve in the militia whenever necessary.`); + recruitLimit = App.SecExp.militiaCap(); adjst = 0.01; + } else if (V.SecExp.edicts.defense.militia === 5) { + r.push(`Every citizen is required to train and participate in the military activities of the arcology.`); + recruitLimit = App.SecExp.militiaCap(); adjst = 0.02; + } + if (V.SecExp.edicts.defense.lowerRequirements === 1) { + r.push(`Your lax physical requirements to enter the militia allows for a greater number of citizens to join.`); + recruitLimit += adjst; + } + if (V.SecExp.edicts.defense.militia >= 3) { + if (V.SecExp.edicts.defense.militaryExemption === 1) { + r.push(`Some citizens prefer to contribute to the arcology's defense through financial support rather than military service, making you <span class="yellowgreen">a small sum.</span>`); + recruitLimit -= adjst; + cashX(250, "securityExpansion"); + } + if (V.SecExp.edicts.defense.noSubhumansInArmy === 1) { + r.push(`Guaranteeing the purity of your armed forces comes with a small loss of potential recruits.`); + recruitLimit -= adjst; + } + if (V.SecExp.edicts.defense.pregExemption === 1) { + r.push(`Many pregnant citizens prefer to avoid military service not to endanger themselves and their children.`); + recruitLimit -= adjst; + } + } + + const recruits = Math.trunc((recruitLimit * V.ACitizens - App.SecExp.Manpower.totalMilitia) / 20 * recruitsMultiplier); + if (recruits > 0) { + V.militiaFreeManpower += recruits; + r.push(`This week ${recruits} citizens joined the militia.<br>`); + } else if (V.SecExp.edicts.defense.militia === 5) { + r.push(`No citizens joined your militia this week because your society is as militarized as it can get.<br>`); + } else if (V.SecExp.edicts.defense.militia === 2) { + r.push(`There are no more citizens willing to join the arcology armed forces. You'll need to enact higher recruitment edicts if you need more manpower.<br>`); + } else { + r.push(`No more citizens could be drafted into your militia. You'll need to enact higher recruitment edicts if you need more manpower.<br>`); + } + } + + if (V.mercenaries >= 1) { // mercs + let newMercs = random(0, 3); + if (V.rep < 6000) { + r.push(`Your low reputation turns some mercenaries away, hoping to find contracts that would bring them more renown.`); + newMercs -= 1; + } else if (V.rep < 12000) { + r.push(`Your reputation is not high enough to attract many mercenaries to your free city.`); + } else { + r.push(`Your reputation attracts many guns for hire who would be proud to have such distinct character on their resume.`); + newMercs += 1; + } + if (V.arcologies[0].prosperity < 50) { + r.push(`The low prosperity of the arcology discourages new guns for hire from coming to your arcology.`); + newMercs -= 1; + } else if (V.arcologies[0].prosperity < 80) { + r.push(`The fairly low prosperity of the arcology discourages new guns for hire from coming to your arcology.`); + newMercs += 1; + } else if (V.arcologies[0].prosperity < 120) { + r.push(`The prosperity of the arcology attracts a few mercenaries, hopeful to find lucrative contracts within its walls.`); + newMercs += random(1, 2); + } else if (V.arcologies[0].prosperity < 160) { + r.push(`The fairly high prosperity of the arcology attracts some mercenaries, hopeful to find lucrative contracts within its walls.`); + newMercs += random(2, 3); + } else if (V.arcologies[0].prosperity < 180) { + r.push(`The high prosperity of the arcology is attracts some mercenaries, hopeful to find lucrative contracts within its walls.`); + newMercs += random(2, 4); + } else { + r.push(`The very high prosperity of the arcology attracts a lot of mercenaries, hopeful to find lucrative contracts within its walls.`); + newMercs += random(3, 5); + } + if (V.SecExp.core.crimeLow > 60) { + r.push(`The powerful crime organizations that nested themselves in the arcology have an unending need for cheap guns for hire, many mercenaries flock to your free city in search of employment.`); + newMercs += random(1, 2); + } + + SF = App.SecExp.assistanceSF('security', 'mercs'); + r.push(SF.text); newMercs += SF.bonus; + + if (V.SecExp.edicts.defense.discountMercenaries > 0) { + r.push(`More mercenaries are attracted to your arcology as a result of the reduced rent.`); + newMercs += random(2, 4); + } + newMercs = Math.trunc(newMercs / 2); + if (newMercs > 0) { + V.mercFreeManpower += newMercs; + r.push(`This week ${newMercs} mercenaries reached the arcology.<br>`); + } else { + r.push(`This week no new mercenaries reached the arcology.<br>`); + } + V.mercFreeManpower = Math.clamp(V.mercFreeManpower, 0, 2000); + } + + if (activeUnits > 0) { // loyalty and training + for (const unit of V.slaveUnits) { + App.SecExp.humanUnitLoyaltyChanges(unit, 'slave'); + } + for (const unit of V.militiaUnits) { + App.SecExp.humanUnitLoyaltyChanges(unit, 'citizens'); + } + for (const unit of V.mercUnits) { + App.SecExp.humanUnitLoyaltyChanges(unit, 'mercenary'); + } + } + } + + if (V.SecExp.buildings.riotCenter && V.SecExp.buildings.riotCenter.brainImplantProject > 0 && V.SecExp.buildings.riotCenter.brainImplant < 106) { + r.push(`<br><br>`); + V.SecExp.buildings.riotCenter.brainImplant += V.SecExp.buildings.riotCenter.brainImplantProject; + if (100 - V.SecExp.buildings.riotCenter.brainImplant <= 0) { + r.push(`The project has been completed!`); + V.SecExp.buildings.riotCenter.brainImplant = 106; + } else { + t = `The great brain implant project is proceeding steadily. This week we made `; + if (V.SecExp.buildings.riotCenter.brainImplantProject <= 2) { + r.push(t + `some small progress.`); + } else if (V.SecExp.buildings.riotCenter.brainImplantProject <= 4) { + r.push(t + `some progress.`); + } else { + r.push(t + `good progress.`); + } + } + } + + if (V.SecExp.buildings.weapManu) { + if (App.SecExp.weapManuUpgrade.fully().bots && App.SecExp.weapManuUpgrade.fully().human) { + delete V.SecExp.buildings.weapManu.upgrades.queue; + } + if (jsDef(V.SecExp.buildings.weapManu.upgrades.queue) && V.SecExp.buildings.weapManu.upgrades.queue.length > 0 && V.SecExp.buildings.weapManu.upgrades.queue[0].time > 0) { + let current = App.SecExp.weapManuUpgrade.current(); V.SecExp.buildings.weapManu.upgrades.queue[0].time--; + t = `<br>In the research lab, ${current.dec} `; + switch (current.dec) { + case "adaptive armored frames": + case "advanced synthetic alloys": + case "ceramo-metallic alloys": + case "rapid action stimulants": + case "universal cyber enhancements": + case "remote neural links": + case "combined training regimens with the special force": + t += `are`; break; + default: t += `is`; + } + t += ` being developed with the aim of enhancing ${current.unit}' ${current.purpose}.`; + if (V.SecExp.buildings.weapManu.upgrades.queue[0].time <= 0) { + t += ` Reports indicate it is ready for deployment and will be issued in the following days.`; + V.SecExp.buildings.weapManu.upgrades.completed.push(current.ID); + V.SecExp.buildings.weapManu.upgrades.queue.splice(0, 1); + } else { + t += ` It will be finished in ${numberWithPluralOne(V.SecExp.buildings.weapManu.upgrades.queue[0].time, "week")}.`; + } + for (let i = 1; i < V.SecExp.buildings.weapManu.upgrades.queue.length; i++) { + current = App.SecExp.weapManu.currentUpgrade(V.SecExp.buildings.weapManu.upgrades.queue[i].ID); + r.push(t + `<br>${ordinalSuffix(i + 1)} in queue: ${current.dec} for ${current.unit}. It will enhance their ${current.purpose}.`); + } + } + } + return r.join(" "); +}; diff --git a/src/Mods/SecExp/rebellionEvents.tw b/src/Mods/SecExp/rebellionEvents.tw deleted file mode 100644 index fcf207cfee32573b25c100a950f32103ffe0f069..0000000000000000000000000000000000000000 --- a/src/Mods/SecExp/rebellionEvents.tw +++ /dev/null @@ -1,120 +0,0 @@ -:: rebellionEvents [nobr] - -<<if $slaveRebellionEventFires == 1>> - <<if $SecExp.rebellions.tension <= 33>> - <<set _event = 1>> - <<elseif $SecExp.rebellions.tension <= 66>> - <<set _event = 2>> - <<else>> - <<set _event = 3>> - <</if>> -<<elseif $citizenRebellionEventFires == 1>> - <<if $SecExp.rebellions.tension <= 33>> - <<set _event = 4>> - <<elseif $SecExp.rebellions.tension <= 66>> - <<set _event = 5>> - <<else>> - <<set _event = 6>> - <</if>> -<</if>> - -<<setNonlocalPronouns $seeDicks>> -<<switch _event>> -<<case 1>> - /* low tension slave rebellion events */ - <<set _rand = random(0,6)>> - <<if _rand == 0>> - This week several slaves were found plotting the death of their master. They were quickly dealt with, but their owner's choice of punishment did little to calm tensions in the arcology. - <<elseif _rand == 1>> - This week a large group of slaves attempted to escape. Several were recaptured, but others were deemed too dangerous and were shot on sight. The unfortunate circumstances raised the disapproval of many citizens, either because of the waste of good slaves or the brutality with which the operation was carried. With a bit of luck, however, the incident will be soon forgotten. - <<elseif _rand == 2>> - This week books of unknown origin and dangerous content were found in the possession of several slaves. They were mostly sociopolitical treaties, making it clear that the intent of the ones responsible was to fan the fire of rebellion. The books were quickly collected and archived, hopefully this affair will not have lasting consequences. - <<elseif _rand == 3>> - This week a citizen was caught giving refuge to an escaped slave. He was not able to pay for the value of the stolen goods, so he was processed as the case required and the slave returned to their rightful master. Many questions however remain without answers. - <<elseif _rand == 4>> - This week a member of a well known anti-slavery group was caught trying to infiltrate the arcology. During the capture attempt shots were fired and several guards were injured, and in the end the fugitive unfortunately managed to escape. Reports indicate several slaves helped the criminal, some going as far as using themselves as shields against the bullets of the security drones. - <<elseif _rand == 5>> - This week a slave was caught attempting to sabotage a machine in one of the factories. _HeU explained _hisU action as "trying to defend _himselfU from a dangerous machine". Reports confirmed that the apparatus is indeed quite deadly, having killed several slaves since it was installed, but the expert way _heU handled the sabotage leaves open the possibility of a deliberate plan or even external help. - <<else>> - This week a slave was found dead in one of the sewer tunnels. It seems _heU was stabbed repeatedly with a sharp object. _HeU was fairly famous for _hisU capabilities as a slave trainer; _hisU old master spent not an insignificant amount of money trying to find _himU once he realized _heU was missing. The episode might have been a simple mugging gone wrong, but _hisU activities as a slave breaker might have played a role in _hisU homicide. - <</if>> - <<set $SecExp.rebellions.tension += random(1,5)>> -<<case 2>> - /* med tension slave rebellion events */ - <<set _rand = random(0,5)>> - <<if _rand == 0>> - This week some strange reports came in: it seems some assemblies of slaves were observed several nights in a row. The slaves were traced and their masters notified, but many suspect there may be something deeper than a few slaves congregating in the night. - <<elseif _rand == 1>> - This week an underground railroad was discovered. The rebels did not go down without a fight, but in the end <<if $mercenaries >= 1>>your mercenaries<<else>>your security drones<</if>> managed to destroy the old tunnels they were using to ship out slaves out of the arcology. - <<elseif _rand == 2>> - This week a famous citizen was assaulted and brutally murdered by his slaves. The ones responsible were apprehended and dealt with easily enough, but the mere fact something like this could have happened is concerning. Those slaves had to be aware of their certain doom. - <<elseif _rand == 3>> - This week a group of slavers entering the arcology was assaulted. Many reported heavy injuries, but fortunately there were no casualties. The attackers were disguised, but the security systems already identified several slaves who were likely part of the group, based on camera feeds. - <<elseif _rand == 4>> - This week the waterways were found infected by a virulent pathogen. The cause was later found to be a diseased slave that died while in the maintenance tunnels. It's not clear if the slave was there because of orders given to _himU or if _heU was trying to escape. - <<else>> - This week a sleeper cell of a famous anti slavery organization was discovered in the low levels of the arcology. The group, however, was aware of the coming security forces and retreated before they could be dealt with. - <</if>> - <<set $SecExp.rebellions.tension += random(5,10)>> -<<case 3>> - /* high tension slave rebellion events */ - <<set _rand = random(0,4)>> - <<if _rand == 0>> - This week a group of slaves took control of one of the manufacturing plants and barricaded themselves inside. It took several days of negotiations and skirmishes to finally end this little insurrection. Many of the slaves involved will be executed in the next few days. - <<elseif _rand == 1>> - This week a number of shops were burned to the ground by rioting slaves and sympathetic citizens. It took considerable effort for the security forces to take control of the situation. Harsh punishment is required and scheduled for the instigators. - <<elseif _rand == 2>> - This week a mass escape attempt was barely stopped before becoming a catastrophe. Many citizens were trampled by the desperate horde of slaves. It will take some time to restore the streets involved to working order. - <<elseif _rand == 3>> - This week a number of riots inflamed the arcology. Many slaves took violent actions against citizens and security personnel. The number of victims keeps getting higher as still now the last sparks of revolt are still active. - <</if>> - <<set $SecExp.rebellions.tension += random(10,15)>> -<<case 4>> - <<set _rand = random(0,6)>> - <<if _rand == 0>> - This week a citizen refused to pay rent, claiming ideological opposition to the arcology's ownership policies. He was quickly dealt with, but his words might not have fallen silent yet. - <<elseif _rand == 1>> - This week books of unknown origin and dangerous content were found in the possession of several citizens. They were mostly sociopolitical treaties, making it clear that the intent of the ones responsible was to fan the fire of rebellion. Most of them were bought and archived, but a few are still circling amongst the citizens of the arcology. - <<elseif _rand == 2>> - This week a citizen was caught giving refuge to other citizens, who would be liable to be enslaved because of their debts. The situation was quickly resolved, but the misplaced generosity of that citizen might have inflamed a few souls. - <<elseif _rand == 3>> - This week a citizen died in one of the factories. His death sparked some outrage, even some talk of protests against the owners of the factory, but things seem to have calmed down for now. - <<elseif _rand == 4>> - This week a citizen refused to be evicted from his house. After some negotiations the man was forcibly removed from the property by your security forces. Unfortunately the forced entry caused some damage to the building. - <<elseif _rand == 5>> - This week a citizen refused to be enslaved as his contract established. With an impressive display of his rhetoric capabilities he managed to gather a small crowd agreeing with his position. The impromptu assembly was promptly disrupted by the drones. - <<else>> - This week a security drone was found disabled and stripped of important electronic components. It seems the act was not dictated by greed, as the most precious parts of the drone were left on the machine, but rather to cover up something that the drone saw. - <</if>> - <<set $SecExp.rebellions.tension += random(1,5)>> -<<case 5>> - <<set _rand = random(0,5)>> - <<if _rand == 0>> - This week a factory was subject to a strike by a group of citizens protesting against the owner. They were promptly arrested and the factory returned to its rightful proprietor by your security department. - <<elseif _rand == 1>> - This week a group of citizens organized a protest against the systemic enslavement of the citizens of the arcology. Their little parade gathered a surprisingly large crowd, but it was nonetheless quickly suppressed by your forces. - <<elseif _rand == 2>> - This week the security department registered the formation of several assemblies of citizens, whose purpose seems to be political in nature. For now no further steps were taken, but it's a worrying sign of further political opposition within the arcology. - <<elseif _rand == 3>> - This week there was a protest against one of the wealthiest citizen of the arcology. Many criticize his near monopoly. Supporters of the citizen met the protesters on the streets and it was just thanks to the intervention of the security drones that violence was avoided. - <<elseif _rand == 4>> - This week several cameras were sabotaged and in many cases damaged beyond repair. A group of anonymous citizens claims to be responsible; their motivation is apparently the excessive surveillance in the arcology and their attack a response to the breach of their privacy. - <<else>> - This week several citizens barricaded themselves in a private brothel. It seems their intention is to protest against the use of ex-citizens in the sex trade, claiming that such a position is unfitting for them. The problem was quickly resolved with the intervention of the security department. - <</if>> - <<set $SecExp.rebellions.tension += random(5,10)>> -<<case 6>> - <<set _rand = random(0,4)>> - <<if _rand == 0>> - This week the arcology was shaken by a number of strikes throughout the manufacturing levels. Many lament the predatory nature of Free Cities society, many other just want to cause damage to their perceived oppressors. It was a significant effort for the security department to stop all protests. - <<elseif _rand == 1>> - This week several factories were set aflame by their workers. The security department worked day and night to control the fire and apprehend the criminals behind the act. Many are known dissidents, but there are a fair few new faces within them. This is a worrying sign. - <<elseif _rand == 2>> - This week numerous riots exploded all over the arcology. Many citizens took to the streets to protest against the arcology owner and its supporters. The security forces slowly managed to stop the rioters, with no small amount of trouble and only through generous use of violence. - <<elseif _rand == 3>> - This week a massive protest of citizens and slaves gathered just outside the penthouse. The crowd was dispersed only after several hours. There were several victims from both sides and no shortage of injured. - <</if>> - <<set $SecExp.rebellions.tension += random(10,15)>> -<</switch>> - -<<set $SecExp.rebellions.tension = Math.clamp($SecExp.rebellions.tension,0,100)>> \ No newline at end of file diff --git a/src/Mods/SecExp/rebellionGenerator.tw b/src/Mods/SecExp/rebellionGenerator.tw deleted file mode 100644 index 43fb8ee501970b0bae5604a550366b031f10916a..0000000000000000000000000000000000000000 --- a/src/Mods/SecExp/rebellionGenerator.tw +++ /dev/null @@ -1,410 +0,0 @@ -:: rebellionGenerator [nobr] - -<<set _slave = 0>> -<<set _citizen = 0>> -<<set _CSratio = $ACitizens / ($ASlaves)>> - -<strong>Slaves security analysis:</strong> -<<if $SecExp.core.authority <= 3000>> - Your very low authority allows slaves to think too freely. - <<set _slave += 30>> -<<elseif $SecExp.core.authority <= 6000>> - Your low authority allows slaves to think too freely. - <<set _slave += 25>> -<<elseif $SecExp.core.authority <= 9000>> - Your moderate authority allows slaves to think a bit too freely. - <<set _slave += 20>> -<<elseif $SecExp.core.authority <= 12000>> - Your good authority does not allow slaves to think too freely. - <<set _slave += 15>> -<<elseif $SecExp.core.authority <= 15000>> - Your high authority does not allow slaves to think too freely. - <<set _slave += 10>> -<<elseif $SecExp.core.authority <= 18000>> - Your very high authority does not allow slaves to think too freely. - <<set _slave += 5>> -<<else>> - Your absolute authority does not allow slaves to have a single free thought. - <<set _slave += 1>> -<</if>> -<<if _CSratio <= 0.4>> - There are a lot more slaves than citizens, making some doubt their masters are strong enough to stop them. - <<set _slave += 30>> -<<elseif _CSratio <= 0.6>> - There are a lot more slaves than citizens, making some doubt their masters are strong enough to stop them. - <<set _slave += 25>> -<<elseif _CSratio <= 0.8>> - There are more slaves than citizens, making some doubt their masters are strong enough to stop them. - <<set _slave += 20>> -<<elseif _CSratio <= 1>> - There are more slaves than citizens, making some doubt their masters are strong enough to stop them. - <<set _slave += 15>> -<<elseif _CSratio <= 1.5>> - There are fewer slaves than citizens, making some doubt they would be strong enough to defeat their masters. - <<set _slave += 10>> -<<elseif _CSratio >= 3>> - There are fewer slaves than citizens, making some doubt they would be strong enough to defeat their masters. - <<set _slave -= 5>> -<<else>> - Citizen and slave populations are sufficiently balanced not to cause problems either way. - <<set _slave -= 1>> -<</if>> -<<if $SecExp.core.security <= 10>> - The very low security of the arcology leaves free space for slaves to organize and agitate. - <<set _slave += 30>> -<<elseif $SecExp.core.security <= 30>> - The low security of the arcology leaves free space for slaves to organize and agitate. - <<set _slave += 20>> -<<elseif $SecExp.core.security <= 60>> - The moderate security of the arcology does not allow free space for slaves to organize and agitate. - <<set _slave += 10>> -<<elseif $SecExp.core.security >= 90>> - The high security of the arcology does not allow free space for slaves to organize and agitate. - <<set _slave -= 5>> -<<else>> - The high security of the arcology does not allow free space for slaves to organize and agitate. - <<set _slave -= 1>> -<</if>> -<<if $arcologies[0].FSDegradationist != "unset">> - Many slaves are so disgusted by your degradationist society, that they are willing to rise up against their masters to escape. - <<set _slave += 30>> -<<elseif $arcologies[0].FSPaternalist != "unset">> - Many slaves are content to live in your paternalist society. - <<set _slave -= 5>> -<<else>> - <<set _slave += 5>> -<</if>> -<<if $arcologies[0].FSRestart != "unset">> - Many slaves are worried by your eugenics projects and some are pushed towards radicalization. - <<set _slave += 30>> -<<elseif $arcologies[0].FSRepopulationFocus != "unset">> - Many slaves are pleasantly happy of your repopulation effort, affording them the freedom to reproduce. - <<set _slave -= 5>> -<<else>> - <<set _slave += 5>> -<</if>> -<br><br> -<strong>Citizens security analysis:</strong> -<<if $SecExp.core.authority <= 3000>> - Your very low authority allows your citizens to think too freely. - <<set _citizen += 30>> -<<elseif $SecExp.core.authority <= 6000>> - Your very low authority allows your citizens to think too freely. - <<set _citizen += 25>> -<<elseif $SecExp.core.authority <= 9000>> - Your moderate authority allows your citizens to think a bit too freely. - <<set _citizen += 20>> -<<elseif $SecExp.core.authority <= 12000>> - Your good authority does not allow your citizens to think too freely. - <<set _citizen += 15>> -<<elseif $SecExp.core.authority <= 15000>> - Your high authority does not allow your citizens to think too freely. - <<set _citizen += 10>> -<<elseif $SecExp.core.authority <= 18000>> - Your very high authority does not allow your citizens to think too freely. - <<set _citizen += 5>> -<<else>> - Your absolute authority does not allow your citizens to have a single free thought. - <<set _citizen += 1>> -<</if>> -<<if $SecExp.core.crimeLow >= 90>> - The very high crime level of the arcology breeds extreme discontent between your citizens. - <<set _citizen += 30>> -<<elseif $SecExp.core.crimeLow >= 60>> - The high crime level of the arcology breeds high discontent between your citizens. - <<set _citizen += 15>> -<<elseif $SecExp.core.crimeLow >= 30>> - The low crime level of the arcology leaves your citizens happy and satisfied. - <<set _citizen += 5>> -<<else>> - The very low crime level of the arcology leaves your citizens happy and satisfied. - <<set _citizen -= 5>> -<</if>> -<<if $SecExp.edicts.defense.militia >= 1>> - <<if ($arcologies[0].FSRomanRevivalist == "unset" && $arcologies[0].FSAztecRevivalist == "unset" && $arcologies[0].FSEgyptianRevivalist == "unset" && $arcologies[0].FSEdoRevivalist == "unset" && $arcologies[0].FSArabianRevivalist == "unset" && $arcologies[0].FSChineseRevivalist == "unset" && $arcologies[0].FSNeoImperialist == "unset")>> - <<if $SecExp.edicts.defense.militia === 5>> - Many of your citizens are offended by your extreme militarization of the arcology's society. - <<set _citizen += 20>> - <<elseif $SecExp.edicts.defense.militia === 4>> - Many of your citizens are offended by your militarization of the arcology's society. - <<set _citizen += 15>> - <<else>> - <<set _citizen += 10>> - <</if>> - <<else>> - <<if $SecExp.edicts.defense.militia === 5>> - Some of your citizens are offended by your extreme militarization of the arcology's society. - <<set _citizen += 10>> - <<elseif $SecExp.edicts.defense.militia === 4>> - Some of your citizens are offended by your militarization of the arcology's society. - <<set _citizen += 5>> - <<else>> - <<set _citizen -= 5>> - <</if>> - <</if>> -<</if>> -<<if $arcologies[0].FSNull != "unset">> - Many of your more conservative citizens do not enjoy the cultural freedom you afford the residents of the arcology. - <<set _citizen += either(20,30)>> -<</if>> -<<if $arcologies[0].FSRestart != "unset">> - <<if _CSratio > 2>> - Your citizens are not happy with the noticeable lack of slaves compared to their numbers. - <<set _citizen += 20>> - <<elseif _CSratio > 1>> - Your citizens are not happy with the lack of slaves compared to their numbers. - <<set _citizen += 15>> - <<elseif _CSratio < 0.5>> - <<set _citizen -= 5>> - <</if>> -<<elseif $arcologies[0].FSRepopulationFocus != "unset">> - <<if _CSratio < 0.5>> - Your citizens are not happy about being outbred by the slaves of the arcology. - <<set _citizen += 20>> - <<elseif _CSratio < 1>> - Your citizens are not happy about being outbred by the slaves of the arcology. - <<set _citizen += 15>> - <<elseif _CSratio > 1.4>> - <<set _citizen += 5>> - <</if>> -<</if>> - -/* rolls to see if event happens */ -<<if _slave < 0>> - <<set _slave = 0>> -<<elseif _slave >= 95>> - <<set _slave = 95>> /* there's always a min 5% chance nothing happens */ -<</if>> -<<if _citizen < 0>> - <<set _citizen = 0>> -<<elseif _citizen >= 95>> - <<set _citizen = 95>> -<</if>> -<<set _roll = random(1,_slave + _citizen)>> -<<if $SecExp.buildings.riotCenter && $SecExp.buildings.riotCenter.brainImplant == 106>> - <<set _slave = Math.trunc(_slave * 0.5 * $SecExp.settings.rebellion.speed), _citizen = Math.trunc(_citizen * 0.5 * $SecExp.settings.rebellion.speed)>> -<<else>> - <<set _slave = Math.trunc(_slave * $SecExp.settings.rebellion.speed), _citizen = Math.trunc(_citizen * $SecExp.settings.rebellion.speed)>> -<</if>> -<<if _roll <= _slave>> - <<if random(1,100) < _slave>> - <<set $slaveRebellionEventFires = 1>> - <<set $citizenRebellionEventFires = 0>> - <<if $SecExp.rebellions.tension != 0>> - <<set $SecExp.rebellions.slaveProgress += Math.trunc(random(1,5) * ($SecExp.rebellions.tension / 100) * 10)>> /* progress scales with tension */ - <<else>> - <<set $SecExp.rebellions.slaveProgress += random(1,5)>> - <</if>> - <</if>> -<<else>> - <<if random(1,100) < _citizen>> - <<set $slaveRebellionEventFires = 0>> - <<set $citizenRebellionEventFires = 1>> - <<if $SecExp.rebellions.tension != 0>> - <<set $SecExp.rebellions.citizenProgress += Math.trunc(random(1,5) * ($SecExp.rebellions.tension / 100) * 10)>> - <<else>> - <<set $SecExp.rebellions.citizenProgress += random(1,5)>> - <</if>> - <</if>> -<</if>> - -/* if there is an advancement selects a random mini event */ -<<set _oldTension = $SecExp.rebellions.tension>> -<<if $slaveRebellionEventFires == 1 || $citizenRebellionEventFires == 1>> - <br><br> <<include "rebellionEvents">> -<<elseif $SecExp.rebellions.tension > 0>> - /* otherwise tension decays */ - <br><br> - <strong>Tension</strong>: - <<if $SecExp.buildings.riotCenter && $SecExp.buildings.riotCenter.upgrades.freeMedia >= 1>> - The guaranteed free media access you offer does wonders to lower tensions in the arcology. - <<set $SecExp.rebellions.tension = Math.trunc(Math.clamp($SecExp.rebellions.tension - $SecExp.buildings.riotCenter.upgrades.freeMedia / 2,0,100))>> - <</if>> - In the absence of noteworthy events, tensions in the arcology are able to relax. - <<set $SecExp.rebellions.tension = Math.trunc(Math.clamp($SecExp.rebellions.tension * 0.97,0,100))>> -<</if>> -<br> -<<if $SecExp.rebellions.tension < _oldTension>> - <br>This week @@.green;tensions relaxed.@@<br> -<<elseif $SecExp.rebellions.tension == _oldTension && $SecExp.rebellions.tension != 0>> - <br>This week @@.yellow;tensions did not change.@@<br> -<<elseif $SecExp.rebellions.tension > _oldTension>> - <br>This week @@.red;tension rose@@ and - <<if $slaveRebellionEventFires == 1>> - @@.red;slave malcontent increased.@@<br> - <<elseif $citizenRebellionEventFires == 1>> - @@.red;citizen malcontent increased.@@<br> - <</if>> -<<elseif !Number.isInteger($SecExp.rebellions.tension)>> - <br>Error: tension is outside accepted range.<br> -<</if>> - -/* resets flags */ -<<set $slaveRebellionEventFires = 0>> -<<set $citizenRebellionEventFires = 0>> - -/* rolls for rebellions */ -<<if $SecExp.rebellions.slaveProgress >= 100>> - <<if random(1,100) <= 80>> /* 80% of firing a rebellion once progress is at 100 */ - <<set $slaveRebellion = 1>> - <<set $SecExp.rebellions.slaveProgress = 0>> - <<set $SecExp.rebellions.citizenProgress *= 0.2>> - <<else>> - <<set $SecExp.rebellions.slaveProgress = 100>> - <</if>> -<<elseif $SecExp.rebellions.citizenProgress >= 100>> - <<if random(1,100) <= 80>> - <<set $citizenRebellion = 1>> - <<set $SecExp.rebellions.citizenProgress = 0>> - <<set $SecExp.rebellions.slaveProgress *= 0.2>> - <<else>> - <<set $SecExp.rebellions.citizenProgress = 100>> - <</if>> -<</if>> - -<<if $SecExp.settings.rebellion.force == 1 && $foughtThisWeek == 0>> - <<if random(1,100) <= 50>> - <<set $slaveRebellion = 1>> - <<set $citizenRebellion = 0>> - <<else>> - <<set $slaveRebellion = 0>> - <<set $citizenRebellion = 1>> - <</if>> -<</if>> - -<<set _weekMod = 0.50>> -<<if $week <= 30>> - <<set _weekMod = 0.75 + (0.01+($week/200))>> -<<elseif $week <= 60>> - <<set _weekMod = 1 + (0.01+($week/300))>> -<<elseif $week <= 90>> - <<set _weekMod = 1.25 + (0.01+($week/400))>> -<<elseif $week <= 120>> - <<set _weekMod = 1.50 + (0.01+($week/500))>> -<<else>> - <<set _weekMod = 1.75>> -<</if>> - -/* resetting ID list */ -<<set $rebellingID = []>> - -/* if a rebellion fires determine amount of rebels and rebelling units */ -<<if $slaveRebellion == 1>> - <<set $engageRule = 0>> - <<set $SecExp.rebellions.lastEncounterWeeks = 0>> - <<set $leadingTroops = "assistant">> - /* calc how many slaves and citizens participate */ - <<set _authFactor = Math.clamp(1 - ($SecExp.core.authority / 20000),0.4,0.6)>> - <<set _repFactor = Math.clamp($rep / 20000,0.4,0.6)>> - <<set _rebelPercent = 0.3 * _authFactor>> - <<set _irregularPercent = 0.2 * _repFactor>> - <<set $attackTroops = Math.clamp(Math.trunc($ASlaves * _rebelPercent * _weekMod) + random(-100,100),50,$ASlaves)>> - <<set $irregulars = Math.clamp(Math.trunc($ACitizens * _irregularPercent * _weekMod) + random(-100,100),50,$ACitizens)>> - /* calc if units rebel */ - <<for _i = 0; _i < $slaveUnits.length; _i++>> - <<if $slaveUnits[_i].loyalty < 10>> - <<if random(1,100) <= 70>> - <<set $rebellingID.push($slaveUnits[_i].ID)>> - <</if>> - <<elseif $slaveUnits[_i].loyalty < 33>> - <<if random(1,100) <= 30>> - <<set $rebellingID.push($slaveUnits[_i].ID)>> - <</if>> - <<elseif $slaveUnits[_i].loyalty < 66>> - <<if random(1,100) <= 10>> - <<set $rebellingID.push($slaveUnits[_i].ID)>> - <</if>> - <</if>> - <</for>> - <<for _i = 0; _i < $militiaUnits.length; _i++>> - <<if $militiaUnits[_i].loyalty < 10>> - <<if random(1,100) <= 70>> - <<set $rebellingID.push($militiaUnits[_i].ID)>> - <</if>> - <<elseif $militiaUnits[_i].loyalty < 33>> - <<if random(1,100) <= 30>> - <<set $rebellingID.push($militiaUnits[_i].ID)>> - <</if>> - <<elseif $militiaUnits[_i].loyalty < 66>> - <<if random(1,100) <= 10>> - <<set $rebellingID.push($militiaUnits[_i].ID)>> - <</if>> - <</if>> - <</for>> - <<for _i = 0; _i < $mercUnits.length; _i++>> - <<if $mercUnits[_i].loyalty < 10>> - <<if random(1,100) <= 70>> - <<set $rebellingID.push($mercUnits[_i].ID)>> - <</if>> - <<elseif $mercUnits[_i].loyalty < 33>> - <<if random(1,100) <= 30>> - <<set $rebellingID.push($mercUnits[_i].ID)>> - <</if>> - <<elseif $mercUnits[_i].loyalty < 66>> - <<if random(1,100) <= 10>> - <<set $rebellingID.push($mercUnits[_i].ID)>> - <</if>> - <</if>> - <</for>> - <<set $attackEquip = Math.clamp($SecExp.edicts.weaponsLaw + random(-2,1),0,4)>> -<<elseif $citizenRebellion == 1>> - <<set $engageRule = 0>> - <<set $SecExp.rebellions.lastEncounterWeeks = 0>> - <<set $leadingTroops = "assistant">> - /* calc how many citizens participate */ - <<set _authFactor = Math.clamp(1 - ($SecExp.core.authority / 20000),0.4,0.6)>> - <<set _repFactor = Math.clamp($rep / 20000,0.4,0.6)>> - <<set _rebelPercent = 0.3 * _authFactor>> - <<set _irregularPercent = 0.2 * _repFactor>> - <<set $attackTroops = Math.clamp(Math.trunc($ACitizens * _rebelPercent * _weekMod) + random(-100,100),50,$ACitizens)>> - <<set $irregulars = Math.clamp(Math.trunc($ACitizens * _irregularPercent * _weekMod) + random(-100,100),50,$ACitizens)>> - /* calc if units rebel */ - <<for _i = 0; _i < $militiaUnits.length; _i++>> - <<if $militiaUnits[_i].loyalty < 10>> - <<if random(1,100) <= 70>> - <<set $rebellingID.push($militiaUnits[_i].ID)>> - <</if>> - <<elseif $militiaUnits[_i].loyalty < 33>> - <<if random(1,100) <= 30>> - <<set $rebellingID.push($militiaUnits[_i].ID)>> - <</if>> - <<elseif $militiaUnits[_i].loyalty < 66>> - <<if random(1,100) <= 10>> - <<set $rebellingID.push($militiaUnits[_i].ID)>> - <</if>> - <</if>> - <</for>> - <<for _i = 0; _i < $slaveUnits.length; _i++>> - <<if $slaveUnits[_i].loyalty < 10>> - <<if random(1,100) <= 70>> - <<set $rebellingID.push($slaveUnits[_i].ID)>> - <</if>> - <<elseif $slaveUnits[_i].loyalty < 33>> - <<if random(1,100) <= 30>> - <<set $rebellingID.push($slaveUnits[_i].ID)>> - <</if>> - <<elseif $slaveUnits[_i].loyalty < 66>> - <<if random(1,100) <= 10>> - <<set $rebellingID.push($slaveUnits[_i].ID)>> - <</if>> - <</if>> - <</for>> - <<for _i = 0; _i < $mercUnits.length; _i++>> - <<if $mercUnits[_i].loyalty < 10>> - <<if random(1,100) <= 70>> - <<set $rebellingID.push($mercUnits[_i].ID)>> - <</if>> - <<elseif $mercUnits[_i].loyalty < 33>> - <<if random(1,100) <= 30>> - <<set $rebellingID.push($mercUnits[_i].ID)>> - <</if>> - <<elseif $mercUnits[_i].loyalty < 66>> - <<if random(1,100) <= 10>> - <<set $rebellingID.push($mercUnits[_i].ID)>> - <</if>> - <</if>> - <</for>> - <<set $attackEquip = Math.clamp($SecExp.edicts.weaponsLaw + random(-1,1),0,4)>> -<<else>> - <<set $SecExp.rebellions.lastEncounterWeeks++>> -<</if>> \ No newline at end of file diff --git a/src/Mods/SecExp/rebellionHandler.tw b/src/Mods/SecExp/rebellionHandler.tw index 6bee0a3f1933229e6b4f8ca0b3bc9d50213a6ad2..aaeae9668b5faf77ec5a8c42ca695538bbad3912 100644 --- a/src/Mods/SecExp/rebellionHandler.tw +++ b/src/Mods/SecExp/rebellionHandler.tw @@ -2,7 +2,7 @@ <<set $nextButton = " ", $nextLink = "attackReport", $encyclopedia = "Battles">> -<<set _turns = $maxTurns * 2>> +<<set _turns = 10 * 2>> <<set _attack = 0>> <<set _defense = 0>> <<set _morale = 0>> @@ -18,30 +18,30 @@ <<set _armyMod = 0>> /* calculates PC army stats */ -<<if $engageRule == 0>> +<<if $SecExp.war.engageRule == 0>> <<set _engageMod = 0.5>> -<<elseif $engageRule == 1>> +<<elseif $SecExp.war.engageRule == 1>> <<set _engageMod = 0.75>> -<<elseif $engageRule == 2>> +<<elseif $SecExp.war.engageRule == 2>> <<set _engageMod = 1>> <<else>> <<set _engageMod = 1.4>> <</if>> <<if $week <= 30>> - <<set _irregularMod = $irregulars / 60>> + <<set _irregularMod = $SecExp.war.irregulars / 60>> <<elseif $week <= 60>> - <<set _irregularMod = $irregulars / 50>> + <<set _irregularMod = $SecExp.war.irregulars / 50>> <<elseif $week <= 90>> - <<set _irregularMod = $irregulars / 40>> + <<set _irregularMod = $SecExp.war.irregulars / 40>> <<elseif $week <= 120>> - <<set _irregularMod = $irregulars / 30>> + <<set _irregularMod = $SecExp.war.irregulars / 30>> <<else>> - <<set _irregularMod = $irregulars / 20>> + <<set _irregularMod = $SecExp.war.irregulars / 20>> <</if>> -<<if $irregulars > 0>> +<<if $SecExp.war.irregulars > 0>> <<set _irregularMod = Math.trunc(_irregularMod)>> - <<set _unit = App.SecExp.getIrregularUnit("Militia", $irregulars, $attackEquip)>> + <<set _unit = App.SecExp.getIrregularUnit("Militia", $SecExp.war.irregulars, $SecExp.war.attacker.equip)>> <<set _attack += _unit.attack * _irregularMod * 0.80>> <<set _defense += _unit.defense * _irregularMod * 0.80>> <<set _hp += _unit.hp>> @@ -55,7 +55,7 @@ <</if>> <<for _i = 0; _i < $militiaUnits.length; _i++>> - <<if $militiaUnits[_i].active == 1 && (!$rebellingID.includes($militiaUnits[_i].ID))>> + <<if $militiaUnits[_i].active == 1 && (!$SecExp.war.rebellingID.includes($militiaUnits[_i].ID))>> <<set _unit = App.SecExp.getUnit("Militia", _i)>> <<set _attack += _unit.attack>> <<set _defense += _unit.defense>> @@ -63,7 +63,7 @@ <</if>> <</for>> <<for _i = 0; _i < $slaveUnits.length; _i++>> - <<if $slaveUnits[_i].active == 1 && (!$rebellingID.includes($slaveUnits[_i].ID))>> + <<if $slaveUnits[_i].active == 1 && (!$SecExp.war.rebellingID.includes($slaveUnits[_i].ID))>> <<set _unit = App.SecExp.getUnit("Slaves", _i)>> <<set _attack += _unit.attack>> <<set _defense += _unit.defense>> @@ -71,7 +71,7 @@ <</if>> <</for>> <<for _i = 0; _i < $mercUnits.length; _i++>> - <<if $mercUnits[_i].active == 1 && (!$rebellingID.includes($mercUnits[_i].ID))>> + <<if $mercUnits[_i].active == 1 && (!$SecExp.war.rebellingID.includes($mercUnits[_i].ID))>> <<set _unit = App.SecExp.getUnit("Mercs", _i)>> <<set _attack += _unit.attack>> <<set _defense += _unit.defense>> @@ -121,34 +121,34 @@ /* calculates rebelling army stats */ <<if $week <= 30>> - <<set _armyMod = $attackTroops / 100>> + <<set _armyMod = $SecExp.war.attacker.troops / 100>> <<elseif $week <= 60>> - <<set _armyMod = $attackTroops / 90>> + <<set _armyMod = $SecExp.war.attacker.troops / 90>> <<elseif $week <= 90>> - <<set _armyMod = $attackTroops / 80>> + <<set _armyMod = $SecExp.war.attacker.troops / 80>> <<elseif $week <= 120>> - <<set _armyMod = $attackTroops / 70>> + <<set _armyMod = $SecExp.war.attacker.troops / 70>> <<else>> - <<set _armyMod = $attackTroops / 60>> + <<set _armyMod = $SecExp.war.attacker.troops / 60>> <</if>> <<set _armyMod = Math.trunc(_armyMod)>> <<set _rebellingSlaves = 0, _rebellingMilitia = 0, _rebellingMercs = 0>> <<if $slaveRebellion == 1>> <<set _rebellingSlaves = 1>> - <<set _unit = App.SecExp.getIrregularUnit("Slaves", $attackTroops, $attackEquip)>> + <<set _unit = App.SecExp.getIrregularUnit("Slaves", $SecExp.war.attacker.troops, $SecExp.war.attacker.equip)>> <<else>> <<set _rebellingMilitia = 1>> - <<set _unit = App.SecExp.getIrregularUnit("Militia", $attackTroops, $attackEquip)>> + <<set _unit = App.SecExp.getIrregularUnit("Militia", $SecExp.war.attacker.troops, $SecExp.war.attacker.equip)>> <</if>> <<set _enemyAttack += _unit.attack * _armyMod>> <<set _enemyDefense += _unit.defense * _armyMod>> <<set _enemyHp += _unit.hp>> <<for _i = 0; _i < $militiaUnits.length; _i++>> - <<if $militiaUnits[_i].active == 1 && $rebellingID.includes($militiaUnits[_i].ID)>> + <<if $militiaUnits[_i].active == 1 && $SecExp.war.rebellingID.includes($militiaUnits[_i].ID)>> <<set _rebellingMilitia = 1>> - <<set $attackTroops += $militiaUnits[_i].troops>> + <<set $SecExp.war.attacker.troops += $militiaUnits[_i].troops>> <<set $militiaUnits[_i].loyalty = 0>> <<set _unit = App.SecExp.getUnit("Militia", _i)>> <<set _enemyAttack += _unit.attack>> @@ -157,9 +157,9 @@ <</if>> <</for>> <<for _i = 0; _i < $slaveUnits.length; _i++>> - <<if $slaveUnits[_i].active == 1 && $rebellingID.includes($slaveUnits[_i].ID)>> + <<if $slaveUnits[_i].active == 1 && $SecExp.war.rebellingID.includes($slaveUnits[_i].ID)>> <<set _rebellingSlaves = 1>> - <<set $attackTroops += $slaveUnits[_i].troops>> + <<set $SecExp.war.attacker.troops += $slaveUnits[_i].troops>> <<set $slaveUnits[_i].loyalty = 0>> <<set _unit = App.SecExp.getUnit("Slaves", _i)>> <<set _enemyAttack += _unit.attack>> @@ -168,9 +168,9 @@ <</if>> <</for>> <<for _i = 0; _i < $mercUnits.length; _i++>> - <<if $mercUnits[_i].active == 1 && $rebellingID.includes($mercUnits[_i].ID)>> + <<if $mercUnits[_i].active == 1 && $SecExp.war.rebellingID.includes($mercUnits[_i].ID)>> <<set _rebellingMercs = 1>> - <<set $attackTroops += $mercUnits[_i].troops>> + <<set $SecExp.war.attacker.troops += $mercUnits[_i].troops>> <<set $mercUnits[_i].loyalty = 0>> <<set _unit = App.SecExp.getUnit("Mercs", _i)>> <<set _enemyAttack += _unit.attack>> @@ -179,7 +179,7 @@ <</if>> <</for>> -<<set _enemyMoraleTroopMod = Math.clamp($attackTroops / 100,1,10)>> +<<set _enemyMoraleTroopMod = Math.clamp($SecExp.war.attacker.troops / 100,1,10)>> <<set _enemyMorale = 1.5 * (App.SecExp.BaseMilitiaUnit.morale * _rebellingMilitia + App.SecExp.BaseSlaveUnit.morale * _rebellingSlaves + App.SecExp.BaseMercUnit.morale * _rebellingMercs) / (_rebellingMilitia + _rebellingSlaves + _rebellingMercs)>> <<set _enemyMorale *= _enemyMoraleTroopMod>> <<set _enemyBaseHp = (App.SecExp.BaseMilitiaUnit.hp * _rebellingMilitia + App.SecExp.BaseSlaveUnit.hp * _rebellingSlaves + App.SecExp.BaseMercUnit.hp * _rebellingMercs) / (_rebellingMilitia + _rebellingSlaves + _rebellingMercs)>> @@ -247,7 +247,7 @@ __Difficulty__:<br> <br>morale increase due to troop numbers: +<<print _moraleTroopMod>>% <</if>> <br><br>__Rebels__: -<br>enemy troops: <<print num(Math.round($attackTroops))>> +<br>enemy troops: <<print num(Math.round($SecExp.war.attacker.troops))>> <br>enemy attack: <<print num(Math.round(_enemyAttack))>> <br>enemy defense: <<print num(Math.round(_enemyDefense))>> <br>enemy Hp: <<print num(Math.round(_enemyHp))>> @@ -267,14 +267,14 @@ __Difficulty__:<br> <<if $SecExp.settings.showStats == 1>> <br>player damage: <<print num(Math.round(_damage))>><</if>> <<set _enemyHp -= _damage>> <<if $SecExp.settings.showStats == 1>> <br>remaining enemy Hp: <<print num(Math.round(_enemyHp))>><</if>> - <<set $enemyLosses += _damage / _enemyBaseHp>> + <<set $SecExp.war.attacker.losses += _damage / _enemyBaseHp>> <<set _moraleDamage = Math.clamp(_damage/ 2 + _damage / _enemyBaseHp,0,_damage*1.5)>> <<set _enemyMorale -= _moraleDamage>> <<if $SecExp.settings.showStats == 1>> <br>remaining enemy morale: <<print num(Math.round(_enemyMorale))>><</if>> <<if _enemyHp <= 0 || _enemyMorale <= 0>> <<if $SecExp.settings.showStats == 1>> <br>Victory!<</if>> - <<set $battleResult = 3>> - <<set $battleTurns = _i>> + <<set $SecExp.war.result = 3>> + <<set $SecExp.war.turns = _i>> <<break>> <</if>> @@ -286,39 +286,39 @@ __Difficulty__:<br> <<if $SecExp.settings.showStats == 1>> <br>enemy damage: <<print num(Math.round(_damage))>><</if>> <<set _hp -= _damage*($SecExp.rebellions.sfArmor ? 0.85 : 1)>> <<if $SecExp.settings.showStats == 1>> <br>remaining hp: <<print num(Math.round(_hp))>><</if>> - <<set $losses += _damage / _baseHp>> + <<set $SecExp.war.losses += _damage / _baseHp>> <<set _moraleDamage = Math.clamp(_damage / 2 + _damage / _baseHp,0,_damage*1.5)>> <<set _morale -= _moraleDamage>> <<if $SecExp.settings.showStats == 1>> <br>remaining morale: <<print num(Math.round(_morale))>><</if>> <<if _hp <= 0 || _morale <= 0>> <<if $SecExp.settings.showStats == 1>> <br>Defeat!<</if>> - <<set $battleResult = -3>> - <<set $battleTurns = _i>> + <<set $SecExp.war.result = -3>> + <<set $SecExp.war.turns = _i>> <<break>> <</if>> <</for>> -<<if $battleResult != 3 && $battleResult != -3>> +<<if $SecExp.war.result != 3 && $SecExp.war.result != -3>> <<if _morale > _enemyMorale>> <<if $SecExp.settings.showStats == 1>> <br>Partial victory!<</if>> - <<set $battleResult = 2>> + <<set $SecExp.war.result = 2>> <<elseif _morale < _enemyMorale>> <<if $SecExp.settings.showStats == 1>> <br>Partial defeat!<</if>> - <<set $battleResult = -2>> + <<set $SecExp.war.result = -2>> <</if>> <</if>> -<<if $battleResult > 3 || $battleResult < -3>> +<<if $SecExp.war.result > 3 || $SecExp.war.result < -3>> <br><br>@@.red;Error: failed to determine battle result@@ <</if>> <<if $SecExp.settings.showStats == 1>> - <<if $SecExp.settings.rebellion.gameOver == 1 && $battleResult == -3>> + <<if $SecExp.settings.rebellion.gameOver == 1 && $SecExp.war.result == -3>> <br>[[Proceed|Gameover][$gameover = "Rebellion defeat"]] <<else>> <br>[[Proceed|rebellionReport]] <</if>> <<else>> - <<if $SecExp.settings.rebellion.gameOver == 1 && $battleResult == -3>> + <<if $SecExp.settings.rebellion.gameOver == 1 && $SecExp.war.result == -3>> <<set $gameover = "Rebellion defeat">> <<goto "Gameover">> <<else>> <<goto "rebellionReport">> diff --git a/src/Mods/SecExp/rebellionOptions.tw b/src/Mods/SecExp/rebellionOptions.tw index 8616b3b5c29f3b51ef81349ab1afff450c42be72..8dec36223fc81d66f1f8ee395fac74ce5cec7646 100644 --- a/src/Mods/SecExp/rebellionOptions.tw +++ b/src/Mods/SecExp/rebellionOptions.tw @@ -1,281 +1,149 @@ :: rebellionOptions [nobr] -<<set $nextButton = " ", $nextLink = "rebellionOptions", $encyclopedia = "Battles">> +<<set $nextButton = " ", $encyclopedia = "Battles">> +<<set _isSlaveRebellion = $slaveRebellion === 1, _loyalUnits = $militiaUnits.length + $slaveUnits.length + $mercUnits.length - $SecExp.war.rebellingID.length>> -<strong> <<if $slaveRebellion == 1>>Slave<<else>>Citizen<</if>> Rebellion!</strong> +<strong> <<if _isSlaveRebellion>>Slave<<else>>Citizen<</if>> Rebellion!</strong> <hr> -<<if $slaveRebellion == 1>> - In the end it happened, the slaves of your arcology dared took up arms and rose up against their betters. Your penthouse is flooded with reports from all over the arcology of small skirmishes between the rioting slaves and the security forces. - It appears <strong><<print num(Math.trunc($attackTroops))>></strong> rebels are in the streets right now, building barricades and freeing their peers. They are - <<if $attackEquip <= 0>> - <strong>poorly armed</strong>. - <<elseif $attackEquip == 1>> - <strong>lightly armed</strong>. - <<elseif $attackEquip == 2>> - <strong>decently armed</strong>. - <<elseif $attackEquip == 3>> - <strong>well armed</strong>. - <<elseif $attackEquip >= 4>> - <strong>extremely well armed</strong>. - <</if>> - <<if $irregulars > 0>> - <<print num(Math.trunc($irregulars))>> of your citizens took up arms to defend their arcology owner. - <</if>> - <<set _count = 0>> - <<if $rebellingID.length > 0>> - <br><br> - <<for _i = 0; _i < $militiaUnits.length; _i++>> - <<if $militiaUnits[_i].active == 1 && ($rebellingID.includes($militiaUnits[_i].ID))>> - <<set _count++>> - <<if _count < $rebellingID.length>> - $militiaUnits[_i].platoonName, - <<else>> - $militiaUnits[_i].platoonName - <</if>> - <</if>> - <</for>> - <<for _i = 0; _i < $slaveUnits.length; _i++>> - <<if $slaveUnits[_i].active == 1 && ($rebellingID.includes($slaveUnits[_i].ID))>> - <<set _count++>> - <<if _count < $rebellingID.length>> - $slaveUnits[_i].platoonName, - <<else>> - $slaveUnits[_i].platoonName - <</if>> - <</if>> - <</for>> - <<for _i = 0; _i < $mercUnits.length; _i++>> - <<if $mercUnits[_i].active == 1 && ($rebellingID.includes($mercUnits[_i].ID))>> - <<set _count++>> - <<if _count < $rebellingID.length>> - $mercUnits[_i].platoonName, - <<else>> - $mercUnits[_i].platoonName - <</if>> - <</if>> - <</for>> - betrayed you and joined the insurrection. - <</if>> - <<set _count = 0>> - <<set _loyalUnits = $militiaUnits.length + $slaveUnits.length + $mercUnits.length - $rebellingID.length>> - <<if _loyalUnits > 0>> - <br><br> - <<if $arcologyUpgrade.drones == 1>>Your security drones,<</if>> - <<for _i = 0; _i < $militiaUnits.length; _i++>> - <<if $militiaUnits[_i].active == 1 && (!$rebellingID.includes($militiaUnits[_i].ID))>> - <<set _count++>> - <<if _count < _loyalUnits>> - $militiaUnits[_i].platoonName, - <<else>> - $militiaUnits[_i].platoonName - <</if>> - <</if>> - <</for>> - <<for _i = 0; _i < $slaveUnits.length; _i++>> - <<if $slaveUnits[_i].active == 1 && (!$rebellingID.includes($slaveUnits[_i].ID))>> - <<set _count++>> - <<if _count < _loyalUnits>> - $slaveUnits[_i].platoonName, - <<else>> - $slaveUnits[_i].platoonName - <</if>> - <</if>> - <</for>> - <<for _i = 0; _i < $mercUnits.length; _i++>> - <<if $mercUnits[_i].active == 1 && (!$rebellingID.includes($mercUnits[_i].ID))>> - <<set _count++>> - <<if _count < _loyalUnits>> - $mercUnits[_i].platoonName, - <<else>> - $mercUnits[_i].platoonName - <</if>> - <</if>> - <</for>> - <<if $SF.Toggle && $SF.Active >= 1>>and $SF.Lower, <<print num($SF.ArmySize)>> strong<</if>> - are called to defend the arcology from this menace. - <<else>> - <<if $arcologyUpgrade.drones == 1>>Your security drones<<if $SF.Toggle && $SF.Active >= 1>>and $SF.Lower, <<print num($SF.ArmySize)>> strong<</if>> <</if>> - are called to defend the arcology from this menace. - <</if>> - <hr> -<<else>> - In the end it happened, the citizens of your arcology dared took up arms and rose up against their betters. Your penthouse is flooded with reports from all over the arcology of small skirmishes between the rioting residents and the security forces. - It appears <<print num(Math.trunc($attackTroops))>> rebels are in the streets right now, building barricades and destroying your property. They are - <<if $attackEquip <= 0>> - <strong>poorly armed</strong>. - <<elseif $attackEquip == 1>> - <strong>lightly armed</strong>. - <<elseif $attackEquip == 2>> - <strong>decently armed</strong>. - <<elseif $attackEquip == 3>> - <strong>well armed</strong>. - <<elseif $attackEquip >= 4>> - <strong>extremely well armed</strong>. - <</if>> - <<if $irregulars > 0>> - <<print num(Math.trunc($irregulars))>> of your citizens took up arms to defend their arcology owner. - <</if>> - <<set _count = 0>> - <<if $rebellingID.length > 0>> - <br><br> - <<for _i = 0; _i < $militiaUnits.length; _i++>> - <<if $militiaUnits[_i].active == 1 && ($rebellingID.includes($militiaUnits[_i].ID))>> - <<set _count++>> - <<if _count < $rebellingID.length>> - $militiaUnits[_i].platoonName, - <<else>> - $militiaUnits[_i].platoonName - <</if>> +In the end it happened, the <<if _isSlaveRebellion>>slaves<<else>>citizens<</if>> +of your arcology dared took up arms and rose up against their betters. Your penthouse is flooded with reports from all over the arcology of small skirmishes between the rioting slaves and the security forces. +It appears <strong><<print num(Math.trunc($SecExp.war.attacker.troops))>></strong> rebels are in the streets right now, building barricades and +<<if _isSlaveRebellion>>freeing their peers<<else>>destroying your property<</if>>. +<<if $SecExp.war.attacker.equip <= 0>> + They are <strong>poorly armed</strong>. +<<elseif $SecExp.war.attacker.equip == 1>> + They are <strong>lightly armed</strong>. +<<elseif $SecExp.war.attacker.equip == 2>> + They are <strong>decently armed</strong>. +<<elseif $SecExp.war.attacker.equip == 3>> + They are <strong>well armed</strong>. +<<elseif $SecExp.war.attacker.equip >= 4>> + They are <strong>extremely well armed</strong>. +<</if>> +<<if $SecExp.war.irregulars > 0>> + <<print num(Math.trunc($SecExp.war.irregulars))>> of your citizens took up arms to defend their arcology owner. +<</if>> +<<set _count = 0>> +<<if $SecExp.war.rebellingID.length > 0>> + <br><br> + <<for _unit range $militiaUnits>> + <<if _unit.active == 1 && ($SecExp.war.rebellingID.includes(_unit.ID))>> + <<set _count++>> + <<if _count < $SecExp.war.rebellingID.length>> + _unit.platoonName, + <<else>> + _unit.platoonName <</if>> - <</for>> - <<for _i = 0; _i < $slaveUnits.length; _i++>> - <<if $slaveUnits[_i].active == 1 && ($rebellingID.includes($slaveUnits[_i].ID))>> - <<set _count++>> - <<if _count < $rebellingID.length>> - $slaveUnits[_i].platoonName, - <<else>> - $slaveUnits[_i].platoonName - <</if>> + <</if>> + <</for>> + <<for _unit range $slaveUnits>> + <<if _unit.active == 1 && ($SecExp.war.rebellingID.includes(_unit.ID))>> + <<set _count++>> + <<if _count < $SecExp.war.rebellingID.length>> + _unit.platoonName, + <<else>> + _unit.platoonName <</if>> - <</for>> - <<for _i = 0; _i < $mercUnits.length; _i++>> - <<if $mercUnits[_i].active == 1 && ($rebellingID.includes($mercUnits[_i].ID))>> - <<set _count++>> - <<if _count < $rebellingID.length>> - $mercUnits[_i].platoonName, - <<else>> - $mercUnits[_i].platoonName - <</if>> + <</if>> + <</for>> + <<for _unit range $mercUnits>> + <<if _unit.active == 1 && ($SecExp.war.rebellingID.includes(_unit.ID))>> + <<set _count++>> + <<if _count < $SecExp.war.rebellingID.length>> + _unit.platoonName, + <<else>> + _unit.platoonName <</if>> - <</for>> - betrayed you and joined the insurrection. - <</if>> - - <<set _count = 0>> - <<set _loyalUnits = $militiaUnits.length + $slaveUnits.length + $mercUnits.length - $rebellingID.length>> - <<if _loyalUnits > 0>> - <br><br> - <<if $arcologyUpgrade.drones == 1>>Your security drones,<</if>> - <<for _i = 0; _i < $militiaUnits.length; _i++>> - <<if $militiaUnits[_i].active == 1 && (!$rebellingID.includes($militiaUnits[_i].ID))>> - <<set _count++>> - <<if _count < _loyalUnits>> - $militiaUnits[_i].platoonName, - <<else>> - $militiaUnits[_i].platoonName - <</if>> + <</if>> + <</for>> + betrayed you and joined the insurrection. +<</if>> +<<set _count = 0, _dualUnits = $arcologyUpgrade.drones === 1 && $SF.Toggle && $SF.Active >= 1>> +<br><br> <<if $arcologyUpgrade.drones === 1>>Your security drones<</if>><<if _loyalUnits > 0>>,<</if>> +<<if _loyalUnits > 0>> + <<for _unit range $militiaUnits>> + <<if _unit.active == 1 && (!$SecExp.war.rebellingID.includes(_unit.ID))>> + <<set _count++>> + <<if _count < _loyalUnits>> + _unit.platoonName, + <<else>> + _unit.platoonName <</if>> - <</for>> - <<for _i = 0; _i < $slaveUnits.length; _i++>> - <<if $slaveUnits[_i].active == 1 && (!$rebellingID.includes($slaveUnits[_i].ID))>> - <<set _count++>> - <<if _count < _loyalUnits>> - $slaveUnits[_i].platoonName, - <<else>> - $slaveUnits[_i].platoonName - <</if>> + <</if>> + <</for>> + <<for _unit range $slaveUnits>> + <<if _unit.active == 1 && (!$SecExp.war.rebellingID.includes(_unit.ID))>> + <<set _count++>> + <<if _count < _loyalUnits>> + _unit.platoonName, + <<else>> + _unit.platoonName <</if>> - <</for>> - <<for _i = 0; _i < $mercUnits.length; _i++>> - <<if $mercUnits[_i].active == 1 && (!$rebellingID.includes($mercUnits[_i].ID))>> - <<set _count++>> - <<if _count < _loyalUnits>> - $mercUnits[_i].platoonName, - <<else>> - $mercUnits[_i].platoonName - <</if>> + <</if>> + <</for>> + <<for _unit range $mercUnits>> + <<if _unit.active == 1 && (!$SecExp.war.rebellingID.includes(_unit.ID))>> + <<set _count++>> + <<if _count < _loyalUnits>> + _unit.platoonName, + <<else>> + _unit.platoonName <</if>> - <</for>> - <<if $SF.Toggle && $SF.Active >= 1>>and $SF.Lower, <<print num($SF.ArmySize)>> strong<</if>> - are called to defend the arcology from this menace. - <<else>> - <<if $arcologyUpgrade.drones == 1>>Your security drones<<if $SF.Toggle && $SF.Active >= 1>>and $SF.Lower, <<print num($SF.ArmySize)>> strong<</if>><</if>> - are called to defend the arcology from this menace. + <</if>> + <</for>> +<</if>> +<<if $arcologyUpgrade.drones === 1 || $SF.Toggle && $SF.Active >= 1>> + <<if $SF.Toggle && $SF.Active >= 1>> + <<if _dualUnits || _loyalUnits > 0>>and $SF.Lower,<<else>><<= capFirstChar($SF.Lower)>><</if>> <<print num($SF.ArmySize)>> strong <</if>> - <hr> + are called to defend the arcology from this menace. <</if>> - The confined spaces of the arcology and the number of vital yet delicate systems within its walls do not allow a lot of tactical flexibility. This will be a long and strenuous fight, street after street, barricade after barricade. In order to preserve the structural integrity of the building and the lives of our civilians, we will have to limit our firepower. -<br><<link "Only light firearms and nonlethal weapons">> - <<set $engageRule = 0>> - <<replace "#engage">> - <br>Your troops will use only nonlethal weapons or light firearms to limit to the maximum the collateral damage. This will however weaken our troops considerably. - <</replace>> -<</link>> -<br><<link "No heavy ordnance">> - <<set $engageRule = 1>> - <<replace "#engage">> - <br>Your troops will limit the use of explosives and heavy weapons to limit considerably the collateral damage. This will however weaken our troops. - <</replace>> -<</link>> -<br><<link "Normal engagement rules">> - <<set $engageRule = 2>> - <<replace "#engage">> - <br>Your troops will not limit their arsenal. This will put the structure and your citizens at risk, but our troops will be at full capacity. - <</replace>> -<</link>> +<br>[[Only light firearms and nonlethal weapons|rebellionOptions][$SecExp.war.engageRule = 0]] +<br>[[No heavy ordnance|rebellionOptions][$SecExp.war.engageRule = 1]] +<br>[[Normal engagement rules|rebellionOptions][$SecExp.war.engageRule = 2]] <<if $SecExp.buildings.riotCenter && $SecExp.buildings.riotCenter.advancedRiotEquip == 1>> - <br><<link "Advanced riot protocol">> - <<set $engageRule = 3>> - <<replace "#engage">> - <br>Your troops will make use of the special weaponry, equipment and infrastructure developed by the riot control center to surgically eliminate rebels and dissidents with little to no collateral damage. - <</replace>> - <</link>> + <br>[[Advanced riot protocol|rebellionOptions][$SecExp.war.engageRule = 3]] <</if>> -<span id="engage"> +<<if $SecExp.war.engageRule === 0>> <br>Your troops will use only nonlethal weapons or light firearms to limit to the maximum the collateral damage. This will however weaken our troops considerably. -</span> +<<elseif $SecExp.war.engageRule === 1>> + <br>Your troops will limit the use of explosives and heavy weapons to limit considerably the collateral damage. This will however weaken our troops. +<<elseif $SecExp.war.engageRule === 2>> + <br>Your troops will not limit their arsenal. This will put the structure and your citizens at risk, but our troops will be at full capacity. +<<elseif $SecExp.war.engageRule === 3>> + <br>Your troops will make use of the special weaponry, equipment and infrastructure developed by the riot control center to surgically eliminate rebels and dissidents with little to no collateral damage. +<</if>> <br><br>We can dedicate some of our forces to the protection of the vital parts of the arcology, doing so will prevent the failure of said systems, but will also take away strength from our assault. <<if $garrison.penthouse == 0>> - <br><<link "Garrison the penthouse" "rebellionOptions">> - <<set $garrison.penthouse = 1>> - <</link>> + <br>[[Garrison the penthouse|rebellionOptions][$garrison.penthouse = 1]] <<else>> <br>Troops will be dispatched to the penthouse. - <<link "Discard the order" "rebellionOptions">> - <<set $garrison.penthouse = 0>> - <</link>> + [[Discard the order|rebellionOptions][$garrison.penthouse = 0]] <</if>> <<if $garrison.reactor == 0>> - <br><<link "Garrison the reactors" "rebellionOptions">> - <<set $garrison.reactor = 1>> - <</link>> + <br>[[Garrison the reactors|rebellionOptions][$garrison.reactor = 1]] <<else>> <br>Troops will be dispatched to the reactors. - <<link "Discard the order" "rebellionOptions">> - <<set $garrison.reactor = 0>> - <</link>> + [[Discard the order|rebellionOptions][$garrison.reactor = 0]] <</if>> <<if $garrison.assistant == 0>> - <br><<link "Garrison the assistant's central CPU" "rebellionOptions">> - <<set $garrison.assistant = 1>> - <</link>> + <br>[[Garrison the assistant's central CPU|rebellionOptions][$garrison.assistant = 1]] <<else>> <br>Troops will be dispatched to the assistant's central CPU. - <<link "Discard the order" "rebellionOptions">> - <<set $garrison.assistant = 0>> - <</link>> + [[Discard the order|rebellionOptions][$garrison.assistant = 0]] <</if>> <<if $garrison.waterway == 0>> - <br><<link "Garrison the waterways" "rebellionOptions">> - <<set $garrison.waterway = 1>> - <</link>> + <br>[[Garrison the waterways|rebellionOptions][$garrison.waterway = 1]] <<else>> <br>Troops will be dispatched to the waterways. - <<link "Discard the order" "rebellionOptions">> - <<set $garrison.waterway = 0>> - <</link>> + [[Discard the order|rebellionOptions][$garrison.waterway = 0]] <</if>> -<br><br> <<replenishAllUnits>> -<<link "Proceed" "rebellionHandler">> - <<set $battleResult = 4, $foughtThisWeek = 1>> /* sets $battleResult value outside accepted range (-3, 3) to avoid evaluation problems */ -<</link>> -<br> -<<link "Surrender" "rebellionReport">> - <<set $battleResult = -1, $foughtThisWeek = 1>> -<</link>> +<br><br> <<replenishAllUnits>> <br> +[[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]] \ No newline at end of file diff --git a/src/Mods/SecExp/rebellionReport.tw b/src/Mods/SecExp/rebellionReport.tw index 382d12c303bc8d06a1b9abbe64aeb1d1fc0b78dc..75d8742a2c7a5f00f02f44d3a35db3fa1d303210 100644 --- a/src/Mods/SecExp/rebellionReport.tw +++ b/src/Mods/SecExp/rebellionReport.tw @@ -3,106 +3,106 @@ <<set $nextButton = "Continue", $nextLink = "Scheduled Event", $encyclopedia = "Battles">> <<set _oldRep = $rep>> <<set _oldAuth = $SecExp.core.authority>> -<<set $enemyLosses = Math.trunc($enemyLosses)>> -<<if $enemyLosses > $attackTroops>> - <<set $enemyLosses = $attackTroops>> +<<set $SecExp.war.attacker.losses = Math.trunc($SecExp.war.attacker.losses)>> +<<if $SecExp.war.attacker.losses > $SecExp.war.attacker.troops>> + <<set $SecExp.war.attacker.losses = $SecExp.war.attacker.troops>> <</if>> -<<set $SecExp.core.totalKills += $enemyLosses>> -<<set $losses = Math.trunc($losses)>> -<<if $battleResult == 3>> +<<set $SecExp.core.totalKills += $SecExp.war.attacker.losses>> +<<set $SecExp.war.losses = Math.trunc($SecExp.war.losses)>> +<<if $SecExp.war.result == 3>> <strong>Victory!</strong> <<set $SecExp.rebellions.victories++>> -<<elseif $battleResult == -3>> +<<elseif $SecExp.war.result == -3>> <strong>Defeat!</strong> <<set $SecExp.rebellions.losses++>> -<<elseif $battleResult == 2>> +<<elseif $SecExp.war.result == 2>> <strong>Partial victory!</strong> <<set $SecExp.rebellions.victories++>> -<<elseif $battleResult == -2>> +<<elseif $SecExp.war.result == -2>> <strong>Partial defeat!</strong> <<set $SecExp.rebellions.losses++>> -<<elseif $battleResult == -1>> +<<elseif $SecExp.war.result == -1>> <strong>We surrendered</strong> <<set $SecExp.rebellions.losses++>> <</if>> <hr> <<if $slaveRebellion == 1>> - Today, <<= asDateString($week, random(0,7))>>, our arcology was inflamed by the fires of rebellion. <<print num(Math.trunc($attackTroops))>> rebels from all over the structure dared rise up against their owners and conquer their freedom through blood. Our defense force, <<print num(Math.trunc(App.SecExp.battle.troopCount()))>> strong, fought with them street by street - <<if $enemyLosses != $attackTroops>> - inflicting <<print num(Math.trunc($enemyLosses))>> casualties, while sustaining <<if $losses > 1>><<print num(Math.trunc($losses))>> casualties<<elseif $losses > 0>>a casualty<<else>>zero<</if>> themselves. + Today, <<= asDateString($week, random(0,7))>>, our arcology was inflamed by the fires of rebellion. <<print num(Math.trunc($SecExp.war.attacker.troops))>> rebels from all over the structure dared rise up against their owners and conquer their freedom through blood. Our defense force, <<print num(Math.trunc(App.SecExp.battle.troopCount()))>> strong, fought with them street by street + <<if $SecExp.war.attacker.losses != $SecExp.war.attacker.troops>> + inflicting <<print num(Math.trunc($SecExp.war.attacker.losses))>> casualties, while sustaining <<if $SecExp.war.losses > 1>><<print num(Math.trunc($SecExp.war.losses))>> casualties<<elseif $SecExp.war.losses > 0>>a casualty<<else>>zero<</if>> themselves. <<else>> - completely annihilating their troops, while sustaining <<if $losses > 1>><<print num(Math.trunc($losses))>> casualties<<elseif $losses > 0>>a casualty<<else>>zero casualties<</if>>. + completely annihilating their troops, while sustaining <<if $SecExp.war.losses > 1>><<print num(Math.trunc($SecExp.war.losses))>> casualties<<elseif $SecExp.war.losses > 0>>a casualty<<else>>zero casualties<</if>>. <</if>> <<if $SecExp.rebellions.sfArmor>> More units were able to survive thanks to wearing $SF.Lower's combat armor suits. <</if>> - <<set $NPCSlaves -= Math.trunc(($NPCSlaves / $ASlaves) * $enemyLosses), - $menials -= Math.trunc(($menials / $ASlaves) * $enemyLosses), - $fuckdolls -= Math.trunc(($fuckdolls / $ASlaves) * $enemyLosses), - $menialBioreactors -= Math.trunc(($menialBioreactors / $ASlaves) * $enemyLosses)>> - <<if $battleResult == 3>> - <<if $battleTurns <= 5>> + <<set $NPCSlaves -= Math.trunc(($NPCSlaves / $ASlaves) * $SecExp.war.attacker.losses), + $menials -= Math.trunc(($menials / $ASlaves) * $SecExp.war.attacker.losses), + $fuckdolls -= Math.trunc(($fuckdolls / $ASlaves) * $SecExp.war.attacker.losses), + $menialBioreactors -= Math.trunc(($menialBioreactors / $ASlaves) * $SecExp.war.attacker.losses)>> + <<if $SecExp.war.result == 3>> + <<if $SecExp.war.turns <= 5>> The fight was quick and one sided: our men easily stopped the disorganized revolt in a few well aimed assaults. - <<elseif $battleTurns <= 7>> + <<elseif $SecExp.war.turns <= 7>> The fight was hard, but in the end our men stopped the disorganized revolt with several well aimed assaults. <<else>> The fight was long and hard, but in the end our men stopped the revolt before it could accumulate momentum. <</if>> - <<elseif $battleResult == -3>> - <<if $battleTurns <= 5>> + <<elseif $SecExp.war.result == -3>> + <<if $SecExp.war.turns <= 5>> The fight was quick and one sided: our men were easily crushed by the furious charge of the rebels. - <<elseif $battleTurns <= 7>> + <<elseif $SecExp.war.turns <= 7>> The fight was hard and in the end the rebels proved too much to handle for our men. <<else>> The fight was long and hard, but despite their bravery the rebels proved too much for our men. <</if>> - <<elseif $battleResult == 2>> + <<elseif $SecExp.war.result == 2>> The fight was long and hard, but in the end our men managed to stop the revolt, though not without difficulty. - <<elseif $battleResult == -2>> + <<elseif $SecExp.war.result == -2>> The fight was long and hard. In the end, our men had to yield to the rebelling slaves, which were fortunately unable to capitalize on their victory. - <<elseif $battleResult == -1>> + <<elseif $SecExp.war.result == -1>> You gave your troops the order to surrender; they obediently stand down. <</if>> /* effects */ - <<if $battleResult == 3>> + <<if $SecExp.war.result == 3>> Thanks to your victory, your @@.green;reputation@@ and @@.darkviolet;authority@@ increased. <<run repX(random(800,1000), "war")>> <<set $SecExp.core.authority += random(800,1000)>> <br>Many of the rebelling slaves were recaptured and punished. The instigators were executed one after another in a public trial that lasted for almost three days. <<set $NPCSlaves -= random(10,30)>> - <<elseif $battleResult == -3>> + <<elseif $SecExp.war.result == -3>> Due to your defeat, your @@.red;reputation@@ and @@.red;authority@@ decreased. <<run repX(random(-800,-1000), "war")>> <<set $SecExp.core.authority -= random(800,1000)>> <br>After the battle most of the rebelling slaves managed to escape, while others remained in the arcology for days looting and hunting their former masters. The arcology will bear the scars of this day for a long time. <<set $lowerClass -= random(50,100)>> - <<set _lostSlaves = Math.trunc(($attackTroops - $enemyLosses) * 0.8), + <<set _lostSlaves = Math.trunc(($SecExp.war.attacker.troops - $SecExp.war.attacker.losses) * 0.8), $NPCSlaves -= Math.trunc(($NPCSlaves / $ASlaves) * _lostSlaves), $menials -= Math.trunc(($menials / $ASlaves) * _lostSlaves), $fuckdolls -= Math.trunc(($fuckdolls / $ASlaves) * _lostSlaves), $menialBioreactors -= Math.trunc(($menialBioreactors / $ASlaves) * _lostSlaves)>> <<set $rebelDefeatAftermath = 5>> - <<elseif $battleResult == -2>> + <<elseif $SecExp.war.result == -2>> Due to your defeat, your @@.red;reputation@@ and @@.red;authority@@ decreased. <<run repX(random(-600,-800), "war")>> <<set $SecExp.core.authority -= random(600,800)>> <br>After the battle most of the rebelling slaves managed to escape, while others remained in the arcology for days looting and hunting their former masters. The arcology will bear the scars of this day for a long time. <<set $lowerClass -= random(40,80)>> - <<set _lostSlaves = Math.trunc(($attackTroops - $enemyLosses) * 0.8), + <<set _lostSlaves = Math.trunc(($SecExp.war.attacker.troops - $SecExp.war.attacker.losses) * 0.8), $NPCSlaves -= Math.trunc(($NPCSlaves / $ASlaves) * _lostSlaves), $menials -= Math.trunc(($menials / $ASlaves) * _lostSlaves), $fuckdolls -= Math.trunc(($fuckdolls / $ASlaves) * _lostSlaves), $menialBioreactors -= Math.trunc(($menialBioreactors / $ASlaves) * _lostSlaves)>> <<set $rebelDefeatAftermath = 3>> - <<elseif $battleResult == 2>> + <<elseif $SecExp.war.result == 2>> Thanks to your victory, your @@.green;reputation@@ and @@.darkviolet;authority@@ increased. <<run repX(random(600,180), "war")>> <<set $SecExp.core.authority += random(600,800)>> <br>Many of the rebelling slaves were recaptured and punished. The instigators were executed one after another in a public trial that lasted for almost three days. <<set $NPCSlaves -= random(10,30)>> - <<elseif $battleResult == -1>> + <<elseif $SecExp.war.result == -1>> Rather than waste the lives of your men you decided to surrender, hoping the rebels will cause less damage if you indulge them, this is however a big hit to your status. Your @@.red;reputation@@ and @@.red;authority@@ are significantly impacted. <<run repX(random(-1000,-1200), "war")>> <<set $SecExp.core.authority -= random(1000,1200)>> @@ -152,7 +152,7 @@ <</if>> <br>After the battle most of the rebelling slaves managed to escape, while others remained in the arcology for days looting and hunting their former masters. The arcology will bear the scars of this day for a long time. <<set $lowerClass -= random(50,100)>> - <<set _lostSlaves = Math.trunc(($attackTroops - $enemyLosses) * 0.8), + <<set _lostSlaves = Math.trunc(($SecExp.war.attacker.troops - $SecExp.war.attacker.losses) * 0.8), $NPCSlaves -= Math.trunc(($NPCSlaves / $ASlaves) * _lostSlaves), $menials -= Math.trunc(($menials / $ASlaves) * _lostSlaves), $fuckdolls -= Math.trunc(($fuckdolls / $ASlaves) * _lostSlaves), @@ -160,76 +160,76 @@ <<set $rebelDefeatAftermath = 5>> <</if>> <<else>> - Today, <<= asDateString($week, random(0,7))>>, our arcology was inflamed by the fires of rebellion. <<print num(Math.trunc($attackTroops))>> rebels from all over the structure dared rise up to dethrone their arcology owner. Our defense force, <<print num(App.SecExp.battle.troopCount())>> strong, fought with them street by street - <<if $enemyLosses != $attackTroops>> - inflicting <<print num(Math.trunc($enemyLosses))>> casualties, while sustaining <<if $losses > 1>> <<print num(Math.trunc($losses))>> casualties <<else>> a casualty<</if>> themselves. + Today, <<= asDateString($week, random(0,7))>>, our arcology was inflamed by the fires of rebellion. <<print num(Math.trunc($SecExp.war.attacker.troops))>> rebels from all over the structure dared rise up to dethrone their arcology owner. Our defense force, <<print num(App.SecExp.battle.troopCount())>> strong, fought with them street by street + <<if $SecExp.war.attacker.losses != $SecExp.war.attacker.troops>> + inflicting <<print num(Math.trunc($SecExp.war.attacker.losses))>> casualties, while sustaining <<if $SecExp.war.losses > 1>> <<print num(Math.trunc($SecExp.war.losses))>> casualties <<else>> a casualty<</if>> themselves. <<else>> - completely annihilating their troops, while sustaining <<if $losses > 1>> <<print num(Math.trunc($losses))>> casualties <<else>> a casualty.<</if>> + completely annihilating their troops, while sustaining <<if $SecExp.war.losses > 1>> <<print num(Math.trunc($SecExp.war.losses))>> casualties <<else>> a casualty.<</if>> <</if>> <<if $SecExp.rebellions.sfArmor>> More units were able to survive thanks to wearing $SF.Lower's combat armor suits. <</if>> - <<set $NPCSlaves -= Math.trunc(($NPCSlaves / $ASlaves) * $enemyLosses), - $menials -= Math.trunc(($menials / $ASlaves) * $enemyLosses), - $fuckdolls -= Math.trunc(($fuckdolls / $ASlaves) * $enemyLosses), - $menialBioreactors -= Math.trunc(($menialBioreactors / $ASlaves) * $enemyLosses)>> - <<if $battleResult == 3>> - <<if $battleTurns <= 5>> + <<set $NPCSlaves -= Math.trunc(($NPCSlaves / $ASlaves) * $SecExp.war.attacker.losses), + $menials -= Math.trunc(($menials / $ASlaves) * $SecExp.war.attacker.losses), + $fuckdolls -= Math.trunc(($fuckdolls / $ASlaves) * $SecExp.war.attacker.losses), + $menialBioreactors -= Math.trunc(($menialBioreactors / $ASlaves) * $SecExp.war.attacker.losses)>> + <<if $SecExp.war.result == 3>> + <<if $SecExp.war.turns <= 5>> The fight was quick and one sided, our men easily stopped the disorganized revolt in a few well aimed assaults. - <<elseif $battleTurns <= 7>> + <<elseif $SecExp.war.turns <= 7>> The fight was hard, but in the end our men stopped the disorganized revolt with several well aimed assaults. <<else>> The fight was long and hard, but in the end our men stopped the revolt before it could accumulate momentum. <</if>> - <<elseif $battleResult == -3>> - <<if $battleTurns <= 5>> + <<elseif $SecExp.war.result == -3>> + <<if $SecExp.war.turns <= 5>> The fight was quick and one sided, our men were easily crushed by the furious charge of the rebels. - <<elseif $battleTurns <= 7>> + <<elseif $SecExp.war.turns <= 7>> The fight was hard and in the end the rebels proved too much to handle for our men. <<else>> The fight was long and hard, but despite their bravery the rebels proved too much for our men. <</if>> - <<elseif $battleResult == 2>> + <<elseif $SecExp.war.result == 2>> The fight was long and hard, but in the end our men managed to stop the revolt, though not without difficulty. - <<elseif $battleResult == -2>> + <<elseif $SecExp.war.result == -2>> The fight was long and hard. Our men in the end had to yield to the rebelling slaves, which were fortunately unable to fully capitalize on their victory. - <<elseif $battleResult == -1>> + <<elseif $SecExp.war.result == -1>> You gave your troops the order to surrender, obediently they stand down. <</if>> /* effects */ - <<if $battleResult == 3>> + <<if $SecExp.war.result == 3>> Thanks to your victory, your @@.green;reputation@@ and @@.darkviolet;authority@@ increased. <<run repX(random(800,1000), "war")>> <<set $SecExp.core.authority += random(800,1000)>> <br>Many of the rebelling citizens were captured and punished, many others enslaved. The instigators were executed one after another in a public trial that lasted for almost three days. <<set $lowerClass -= random(10,30)>> - <<elseif $battleResult == -3>> + <<elseif $SecExp.war.result == -3>> Due to your defeat, your @@.red;reputation@@ and @@.red;authority@@ decreased. <<run repX(random(-800,-1000), "war")>> <<set $SecExp.core.authority -= random(800,1000)>> <br>After the battle most of the rebelling citizens remained in the arcology for days looting and hunting their former arcology. We will bear the scars of this day for a long time. - <<set $lowerClass -= Math.trunc(($attackTroops - $enemyLosses) * 0.8)>> + <<set $lowerClass -= Math.trunc(($SecExp.war.attacker.troops - $SecExp.war.attacker.losses) * 0.8)>> <<set $rebelDefeatAftermath = 5>> - <<elseif $battleResult == -2>> + <<elseif $SecExp.war.result == -2>> Due to your defeat, your @@.red;reputation@@ and @@.red;authority@@ decreased. <<run repX(random(-600,-800), "war")>> <<set $SecExp.core.authority -= random(600,800)>> <br>After the battle most of the rebelling citizens remained in the arcology for days looting and hunting their former arcology. We will bear the scars of this day for a long time. <<set $lowerClass -= random(40,80)>> - <<set _lostSlaves = Math.trunc(($attackTroops - $enemyLosses) * 0.6), + <<set _lostSlaves = Math.trunc(($SecExp.war.attacker.troops - $SecExp.war.attacker.losses) * 0.6), $NPCSlaves -= Math.trunc(($NPCSlaves / $ASlaves) * _lostSlaves), $menials -= Math.trunc(($menials / $ASlaves) * _lostSlaves), $fuckdolls -= Math.trunc(($fuckdolls / $ASlaves) * _lostSlaves), $menialBioreactors -= Math.trunc(($menialBioreactors / $ASlaves) * _lostSlaves)>> <<set $rebelDefeatAftermath = 3>> - <<elseif $battleResult == 2>> + <<elseif $SecExp.war.result == 2>> Thanks to your victory, your @@.green;reputation@@ and @@.darkviolet;authority@@ increased. <<run repX(random(600,180), "war")>> <<set $SecExp.core.authority += random(600,800)>> <br>Many of the rebelling citizens were captured and punished, many others enslaved. The instigators were executed one after another in a public trial that lasted for almost three days. <<set $NPCSlaves -= random(10,30)>> - <<elseif $battleResult == -1>> + <<elseif $SecExp.war.result == -1>> Rather than waste the lives of your men you decided to surrender, hoping the rebels will cause less damage if you indulge them, this is however a big hit to your status. Your @@.red;reputation@@ and @@.red;authority@@ are significantly impacted. <<run repX(random(-1000,-1200), "war")>> <<set $SecExp.core.authority -= random(1000,1200)>> @@ -279,7 +279,7 @@ <</if>> <br>After the battle most of the rebelling citizens remained in the arcology for days looting and hunting their former arcology. We will bear the scars of this day for a long time. <<set $lowerClass -= random(50,100)>> - <<set _lostSlaves = Math.trunc(($attackTroops - $enemyLosses) * 0.8), + <<set _lostSlaves = Math.trunc(($SecExp.war.attacker.troops - $SecExp.war.attacker.losses) * 0.8), $NPCSlaves -= Math.trunc(($NPCSlaves / $ASlaves) * _lostSlaves), $menials -= Math.trunc(($menials / $ASlaves) * _lostSlaves), $fuckdolls -= Math.trunc(($fuckdolls / $ASlaves) * _lostSlaves), @@ -289,8 +289,8 @@ <</if>> /* engage rules */ -<<if $battleResult != -1>> - <<if $engageRule == 0>> +<<if $SecExp.war.result != -1>> + <<if $SecExp.war.engageRule == 0>> Since you ordered your troops to limit their weaponry to low caliber or nonlethal, the arcology reported only @@.red;minor damage.@@ Most citizens and non involved slaves remained unharmed, though some casualties between the civilians were inevitable. A few businesses were looted and burned, but the damage was pretty limited. <<set $arcRepairTime += 3, IncreasePCSkills('engineering', 0.1)>> @@ -335,7 +335,7 @@ $menialBioreactors -= Math.trunc(($menialBioreactors / $ASlaves) * _lostSlaves)>> <<set $arcologies[0].prosperity -= random(12)>> <</if>> - <<elseif $engageRule == 1>> + <<elseif $SecExp.war.engageRule == 1>> You ordered your troops to limit their weaponry to non-heavy, non-explosive, because of this the arcology reported @@.red;moderate damage.@@ Most citizens and non involved slaves remained unharmed or only lightly wounded, but many others did not make it. Unfortunately casualties between the civilians were inevitable. A few businesses were looted and burned, but the damage was pretty limited. <<set $arcRepairTime += 5, IncreasePCSkills('engineering', 0.1)>> @@ -380,7 +380,7 @@ $menialBioreactors -= Math.trunc(($menialBioreactors / $ASlaves) * _lostSlaves)>> <<set $arcologies[0].prosperity -= random(14)>> <</if>> - <<elseif $engageRule == 2>> + <<elseif $SecExp.war.engageRule == 2>> Since you did not apply any restriction on the weapons your forces should use, the arcology reported @@.red;heavy damage.@@ Many citizens and uninvolved slaves are reported killed or missing. Casualties between the civilians were inevitable. Many businesses were damaged during the battle either by the fight itself, by fires which spread unchecked for hours or by looters. <<set $arcRepairTime += 7, IncreasePCSkills('engineering', 0.1)>> @@ -473,12 +473,8 @@ <</if>> <</if>> <</if>> -<<if $lowerClass < 0>> - <<set $lowerClass = 0>> -<</if>> -<<if $NPCSlaves < 0>> - <<set $NPCSlaves = 0>> -<</if>> +<<set $lowerClass = Math.max($lowerClass, 0)>> +<<set $NPCSlaves = Math.max($NPCSlaves, 0)>> /* garrisons */ <<if $garrison.reactor == 0>> @@ -885,12 +881,6 @@ <<include "unitsRebellionReport">> /* resets variables and flags */ -<<set $attackTroops = 0>> -<<set $attackEquip = 0>> -<<set $enemyLosses = 0>> -<<set $losses = 0>> -<<set $battleTurns = 0>> -<<set $irregulars = 0>> <<if $slaveRebellion == 1>> <<set $SecExp.rebellions.slaveProgress = 0>> <<set $SecExp.rebellions.citizenProgress = Math.clamp($SecExp.rebellions.citizenProgress - random(50,100), 0, 100)>> diff --git a/src/Mods/SecExp/securityReport.tw b/src/Mods/SecExp/securityReport.tw deleted file mode 100644 index ce5a7a471e275b47d0102884ba6219598cabf544..0000000000000000000000000000000000000000 --- a/src/Mods/SecExp/securityReport.tw +++ /dev/null @@ -1,517 +0,0 @@ -:: securityReport [nobr] - -/* init */ -<<if $ACitizens > $oldACitizens>> - <<set _immigration = $ACitizens - $oldACitizens, _emigration = 0>> -<<else>> - <<set _emigration = $oldACitizens - $ACitizens, _immigration = 0>> /*takes into account citizens leaving and those getting enslaved*/ -<</if>> -<<set _secGrowth = 0>> -<<set _crimeGrowth = 0>> -<<set _recruitsMultiplier = 1>> - -<<if $useTabs == 0>> <br>__Security__<br><</if>> -<<if $terrain === "oceanic">> - Due to the @@.green;massive economic and logistical challenges@@ of attacking an oceanic arcology, your security force(s) -<<else>> - The @@.red;easily manageable economic and logistical challenges@@ of attacking an $terrain arcology ensure that your security force(s) do not -<</if>> - have the luxury of focusing exclusively on internal matters.<br> -<<if (def $SecExp.buildings.secHub) && ($SecExp.buildings.secHub.menials > 0)>> - <<print num($SecExp.buildings.secHub.menials)>> slaves work to improve the security of your arcology, while your -<<else>> - Your -<</if>> - -<<if $mercenaries >= 1 && $arcologyUpgrade.drones == 1>> - mercenaries and security drones tirelessly patrol the streets to keep them safe. -<<elseif $arcologyUpgrade.drones == 1>> - security drones tirelessly patrol the arcology to keep it safe. -<<else>> - loyal subordinates try to keep the arcology safe to the best of their abilities. -<</if>> - -/* security modifiers */ -<<if $PC.career == "mercenary">> - Your past life as a mercenary makes it easier to manage the security of the arcology. - <<set _secGrowth += 1>> -<</if>> -<<if $SecExp.smilingMan.progress === 10>> - The ex-criminal known to the world as The Smiling Man puts their impressive skills to work, dramatically increasing the efficiency of your security measures. - <<set _secGrowth += 2>> -<</if>> -<<if $ACitizens + $ASlaves <= 5000>> - The small number of residents makes their job easier. - <<set _secGrowth += 2>> -<<elseif $ACitizens + $ASlaves <= 7500>> - The fairly low number of residents makes their job a little easier. - <<set _secGrowth += 1>> -<<elseif $ACitizens + $ASlaves <= 10000>> - The fairly high number of residents makes their job a little harder. - <<set _secGrowth -= -0.5>> -<<elseif $ACitizens + $ASlaves <= 15000>> - The high number of residents makes their job harder. - <<set _secGrowth -= 1>> -<<else>> - The extremely high number of residents makes their job a lot harder. - <<set _secGrowth -= 2>> -<</if>> -<<if _immigration >= 0 && _emigration == 0>> - <<if _immigration < 50>> - The limited number of immigrants that reached the arcology this week does not have any serious impact on the efficiency of current security measures. - <<set _secGrowth += 0.5>> - <<elseif _immigration < 150>> - The number of immigrants that reached the arcology this week is high enough to complicate security protocols. - <<set _secGrowth -= 0.2>> - <<elseif _immigration < 300>> - The high number of immigrants that reached the arcology this week complicates security protocols. - <<set _secGrowth -= 0.5>> - <<elseif _immigration < 500>> - The high number of immigrants that reached the arcology this week severely complicates security protocols. - <<set _secGrowth -= 1>> - <<else>> - The extremely high number of immigrants that reached the arcology this week severely complicates security protocols. - <<set _secGrowth -= 2>> - <</if>> -<</if>> -<<if $visitors < 300>> - The limited number of visitors coming and going did not have any serious impact on the efficiency of current security measures. - <<set _secGrowth += 0.5>> -<<elseif _immigration < 750>> - The number of visitors coming and going somewhat complicates security protocols. - <<set _secGrowth -= 0.2>> -<<elseif _immigration < 1500>> - The high number of visitors coming and going complicates security protocols. - <<set _secGrowth -= 0.5>> -<<elseif _immigration < 2500>> - The high number of visitors coming and going greatly complicates security protocols. - <<set _secGrowth -= 1>> -<<else>> - The extremely high number of visitors coming and going severely complicates security protocols. - <<set _secGrowth -= 2>> -<</if>> -<<if _emigration != 0 && _immigration == 0>> - <<if _emigration < 100>> - The limited reduction in citizens this week does not have any serious impact on the efficiency of current security measures. - <<set _secGrowth += 0.5>> - <<elseif _emigration < 300>> - The reduction in citizens this week is high enough to complicate security protocols. - <<set _secGrowth -= 0.2>> - <<elseif _emigration < 600>> - The large reduction in citizens this week complicates security protocols. - <<set _secGrowth -= 0.5>> - <<elseif _emigration < 1000>> - The huge reduction in citizens this week severely complicates security protocols. - <<set _secGrowth -= 1>> - <<else>> - The extreme reduction in citizens this week severely complicates security protocols. - <<set _secGrowth -= 2>> - <</if>> -<</if>> -<<if $SecExp.core.crimeLow < 20>> - Crime is a distant problem in the arcology, which makes improving security easier. - <<set _secGrowth += 1>> -<<elseif $SecExp.core.crimeLow < 40>> - Crime is a minor problem in the arcology, not serious enough to disrupt security efforts. -<<elseif $SecExp.core.crimeLow < 60>> - Crime is an issue in the arcology, which makes improving security harder. - <<set _secGrowth -= 0.5>> -<<elseif $SecExp.core.crimeLow < 80>> - Crime is an overbearing problem in the arcology, which makes improving security a lot harder. - <<set _secGrowth -= 1>> -<<else>> - Crime is sovereign in the arcology, which makes improving security extremely difficult. - <<set _secGrowth -= 2>> -<</if>> -<<if $SecExp.core.authority < 5000>> - The low authority you hold on the arcology hampers the efforts of your security department. - <<set _secGrowth -= 1>> -<<elseif $SecExp.core.authority < 7500>> - The limited authority you hold on the arcology hampers the efforts of your security department. - <<set _secGrowth -= 0.5>> -<<elseif $SecExp.core.authority < 10000>> - The authority you hold on the arcology does not significantly impact the efforts of your security department. -<<elseif $SecExp.core.authority < 15000>> - The high authority you hold on the arcology facilitates the security department's work. - <<set _secGrowth += 0.5>> -<<else>> - The absolute authority you hold on the arcology makes the security department's work a lot easier. - <<set _secGrowth += 1>> -<</if>> -<<if App.SecExp.battle.activeUnits() >= 6>> - Your military is the size of a small army. Security is easier to maintain with such forces at your disposal. - <<set _secGrowth += 0.5>> -<</if>> -<<set _count = $SecExp.battles.victories + $SecExp.battles.losses>> -<<if $SecExp.battles.lastEncounterWeeks < 3 && _count > 0>> - The recent attack has a negative effect on the security of the arcology. - <<set _secGrowth -= 1>> -<<elseif $SecExp.battles.lastEncounterWeeks < 5 && _count > 0>> - While some time has passed, the last attack still has a negative effect on the security of the arcology. - <<set _secGrowth -= 0.5>> -<<elseif _count > 0>> - The arcology has not been attacked in a while, which has a positive effect on security. - <<set _secGrowth += 0.5>> -<</if>> - -<<if $SecExp.buildings.transportHub>> - <<set _secGrowth -= ($SecExp.buildings.transportHub.airport + $SecExp.buildings.transportHub.surfaceTransport - $SecExp.buildings.transportHub.security * 3) / 2>> - The transport hub, for all its usefulness, is a hotspot of malicious - <<if $SecExp.buildings.transportHub.airport + $SecExp.buildings.transportHub.surfaceTransport > $SecExp.buildings.transportHub.security * 3>> - activity and hub security forces are not sufficient to keep up with all threats. - <<else>> - activity, but the hub security forces are up to the task. - <</if>> -<</if>> - -<<if $SecExp.buildings.propHub && $SecExp.buildings.propHub.upgrades.blackOps > 0>> - Your black ops team proves to be a formidable tool against anyone threatening the security of your arcology. - <<set _secGrowth += 0.5 * random(1,2)>> -<</if>> - -<<if $garrison.assistantTime > 0>> - With the central CPU core of the assistant down, managing security is a much harder task. Inevitably some little but important details will slip past your agents. - It will still take <<if $garrison.assistantTime> 1>>$garrison.assistantTime weeks<<else>>a week<</if>> to finish repair works. - <<set _secGrowth-->> - <<set _crimeGrowth++>> - <<set $garrison.assistantTime--, IncreasePCSkills('engineering', 0.1)>> -<</if>> - -<<if $SF.Toggle && $SF.Active >= 1>> - <<if $SecExp.edicts.SFSupportLevel >= 3>> - The two squads of $SF.Lower assigned to the Security HQ provide an essential help to the security department. - <</if>> - <<if $SecExp.edicts.SFSupportLevel >= 2>> - The training officers of $SF.Lower assigned to the Security HQ improve its effectiveness. - <</if>> - <<if $SecExp.edicts.SFSupportLevel >= 1>> - Providing your Security Department with equipment from $SF.Lower slightly boosts the security of your arcology. - <</if>> - <<set _secGrowth *= 1+($SecExp.edicts.SFSupportLevel/10)>> -<</if>> - -/* resting point */ -<<set _secRest = App.SecExp.Check.secRestPoint() * (Math.clamp($SecExp.buildings.secHub ? $SecExp.buildings.secHub.menials : 0 ,0 , App.SecExp.Check.reqMenials()) / App.SecExp.Check.reqMenials())>> -<<if _secRest < 0>> <<set _secRest = 20>> <</if>> -<<if _secRest < App.SecExp.Check.reqMenials() && $SecExp.buildings.secHub>> - The limited staff assigned to the HQ hampered the improvements to security achieved this week. -<<elseif _secRest < App.SecExp.Check.reqMenials()>> - The limited infrastructure available slowly erodes away the security level of the arcology. -<</if>> - -The security level of the arcology is -<<if $SecExp.core.security > (_secRest + 5)>> - over its effective resting point, limiting the achievable growth this week. - <<set _secGrowth *= 0.5>> -<<elseif $SecExp.core.security < (_secRest - 5)>> - under its effective resting point, speeding up its growth. - <<set _secGrowth *= 1.5>> -<<elseif $SecExp.core.security == _secRest>> - at its effective resting point, this severely limits the influence of external factors on the change achievable this week. - <<set _secGrowth *= 0.3>> -<<else>> - near its effective resting point, this severely limits the influence of external factors on the change achievable this week. - <<if _secGrowth < 0>> <<set _secGrowth *= 0.3>> <</if>> -<</if>> -<<set _restGrowth = (_secRest - $SecExp.core.security) * 0.2>> -<<set _newSec = Math.trunc($SecExp.core.security + _secGrowth + _restGrowth)>> -<<if _newSec < $SecExp.core.security>> - This week @@.red;security decreased.@@ -<<elseif _newSec == $SecExp.core.security>> - This week @@.yellow;security did not change.@@ -<<else>> - This week @@.green;security improved.@@ -<</if>> -<<set $SecExp.core.security = Math.clamp(_newSec, 0, 100)>> - -<br><br> -<strong>Crime</strong>: -/* crime modifiers */ -Due to the deterioration of the old world countries, organized crime focuses more and more on the prosperous Free Cities, yours included. This has a -<<if $week < 30>> - small - <<set _crimeGrowth += 0.5>> -<<elseif $week < 60>> - noticeable - <<set _crimeGrowth += 1>> -<<elseif $week < 90>> - moderate - <<set _crimeGrowth += 1.5>> -<<elseif $week < 120>> - big - <<set _crimeGrowth += 2>> -<<else>> - huge - <<set _crimeGrowth += 2.5>> -<</if>> - impact on the growth of criminal activities in your arcology. - -<<if $arcologies[0].prosperity < 50>> - The low prosperity of the arcology facilitates criminal recruitment and organization. - <<set _crimeGrowth += 1>> -<<elseif $arcologies[0].prosperity < 80>> - The fairly low prosperity of the arcology facilitates criminal recruitment and organization. - <<set _crimeGrowth += 0.5>> -<<elseif $arcologies[0].prosperity < 120>> - The prosperity of the arcology is not high or low enough to have significant effects on criminal recruitment and organization. -<<elseif $arcologies[0].prosperity < 160>> - The prosperity of the arcology is high enough to provide its citizens a decent life, hampering criminal recruitment and organization. - <<set _crimeGrowth -= 0.5>> -<<elseif $arcologies[0].prosperity < 180>> - The prosperity of the arcology is high enough to provide its citizens a decent life, significantly hampering criminal recruitment and organization. - <<set _crimeGrowth -= 1>> -<<else>> - The prosperity of the arcology is high enough to provide its citizens a very good life, significantly hampering criminal recruitment and organization. - <<set _crimeGrowth -= 2>> -<</if>> -<<if $ASlaves < 1000>> - The low number of slaves in the arcology does not hinder the activity of law enforcement, limiting crime growth. - <<set _crimeGrowth -= 1>> -<<elseif $ASlaves < 2000>> - The fairly low number of slaves in the arcology does not hinder significantly the activity of law enforcement, limiting crime growth. - <<set _crimeGrowth -= 0.5>> -<<elseif $ASlaves < 3000>> - The number of slaves in the arcology is becoming an impediment for law enforcement, facilitating crime growth. - <<set _crimeGrowth += 1>> -<<else>> - The number of slaves in the arcology is becoming a big issue for law enforcement, facilitating crime growth. - <<set _crimeGrowth += 1.5>> -<</if>> -<<if $SecExp.core.security <= 20>> - The security measures in place are severely limited, allowing crime to grow uncontested. -<<elseif $SecExp.core.security <= 50>> - The security measures in place are of limited effect and use, giving only mixed results in their fight against crime. - <<set _crimeGrowth -= 1.5>> -<<elseif $SecExp.core.security <= 75>> - The security measures in place are well developed and effective, making a serious dent in the profitability of criminal activity in your arcology. - <<set _crimeGrowth -= 3>> -<<else>> - The security measures in place are extremely well developed and very effective, posing a serious threat even to the most powerful criminal organizations in existence. - <<set _crimeGrowth -= 5.5>> -<</if>> -<<if $SecExp.core.authority < 5000>> - Your low authority allows crime to grow undisturbed. - <<set _crimeGrowth += 1>> -<<elseif $SecExp.core.authority < 7500>> - Your relatively low authority facilitates criminal activities. - <<set _crimeGrowth += 0.5>> -<<elseif $SecExp.core.authority < 10000>> - Your authority is not high enough to discourage criminal activity. -<<elseif $SecExp.core.authority < 15000>> - Your high authority is an effective tool against crime. - <<set _crimeGrowth -= 1>> -<<else>> - Your absolute authority is an extremely effective tool against crime. - <<set _crimeGrowth -= 2>> -<</if>> -<<if $cash >= 100000>> - Your great wealth acts as a beacon for the greediest criminals, calling them to your arcology as moths to a flame. - <<set _crimeGrowth += 0.5>> -<</if>> -<<if $SecExp.buildings.propHub && $SecExp.buildings.propHub.upgrades.marketInfiltration > 0>> - <<set _crimeGrowth += 0.5 * random(1,2)>> -<</if>> - -/* crime cap */ -<<set _crimeCap = Math.trunc(Math.clamp(App.SecExp.Check.crimeCap() + (App.SecExp.Check.crimeCap() - App.SecExp.Check.crimeCap() * (($SecExp.buildings.secHub ? $SecExp.buildings.secHub.menials : 0) / App.SecExp.Check.reqMenials())), 0, 100))>> -<<if _crimeCap > App.SecExp.Check.crimeCap() && $SecExp.buildings.secHub>> - The limited staff assigned to the HQ allows more space for criminals to act. -<</if>> -<<if $SecExp.core.authority > 12000>> - <<if $SecExp.buildings.secHub.coldstorage < 6>> - <<if $SecExp.buildings.secHub.coldstorage === 0>>Adding a facility<<else>>Improving the cold storage facility attached<</if>> to the SecurityHQ should allow the staff to be more efficient in dealing with crime. - <<else>> - The cold storage facility attached to SecurityHQ allows the staff to be more efficient in dealing with crime. - <</if>> -<</if>> -<<set _newCrime = Math.trunc(Math.clamp($SecExp.core.crimeLow + _crimeGrowth,0,_crimeCap))>> -<<if _newCrime > $SecExp.core.crimeLow>> - This week @@.red;crime increased.@@ -<<elseif _newCrime == $SecExp.core.crimeLow>> - This week @@.yellow;crime did not change.@@ -<<else>> - This week @@.green;crime decreased.@@ -<</if>> -<<set $SecExp.core.crimeLow = Math.clamp(_newCrime,0,100)>> - -<<if $SecExp.edicts.defense.militia >= 1 || App.SecExp.battle.activeUnits() >= 1>> - <<set _size = App.SF.upgrades.total()>> - <br><br> <strong>Military</strong>: - <<if $SecExp.edicts.defense.militia >= 1>> - <<if $SF.Toggle && $SF.Active >= 1 && _size > 10>> - Having a powerful special force attracts a lot of citizens, hopeful that they may be able to fight along side it. - <<set _recruitsMultiplier *= 1 + (random(1, (Math.round(_size / 10))) / 20)>> /* not sure how high _size goes, so I hope this makes sense */ - <</if>> - <<set _propagandaEffects = App.SecExp.propagandaEffects("recruitment")>> - _propagandaEffects.text - <<set _recruitsMultiplier *= (1 + _propagandaEffects.effect)>> - <<if $SecExp.edicts.defense.militia === 2>> - Your militia accepts only volunteering citizens, ready to defend their arcology. - <<set _recruitLimit = App.SecExp.militiaCap(), _adjst = 0.0025>> - <<if $rep >= 10000>> - Many citizens volunteer just to fight for someone of your renown. - <<set _recruitLimit += _adjst>> - <</if>> - <<if $SecExp.core.authority >= 10000>> - Many citizens feel it is their duty to fight for you, boosting volunteer enrollment. - <<set _recruitLimit += _adjst>> - <</if>> - <<elseif $SecExp.edicts.defense.militia === 3>> - Adult citizens are required to join the militia for a period of time. - <<set _recruitLimit = App.SecExp.militiaCap(), _adjst = 0.005>> - <<elseif $SecExp.edicts.defense.militia === 4>> - Adult citizens are required to register and serve in the militia whenever necessary. - <<set _recruitLimit = App.SecExp.militiaCap(), _adjst = 0.01>> - <<elseif $SecExp.edicts.defense.militia === 5>> - Every citizen is required to train and participate in the military activities of the arcology. - <<set _recruitLimit = App.SecExp.militiaCap(), _adjst = 0.02>> - <</if>> - <<if $SecExp.edicts.defense.lowerRequirements == 1>> - Your lax physical requirements to enter the militia allows for a greater number of citizens to join. - <<set _recruitLimit += _adjst>> - <</if>> - <<if $SecExp.edicts.defense.militia >= 3>> - <<if $SecExp.edicts.defense.militaryExemption === 1>> - Some citizens prefer to contribute to the arcology's defense through financial support rather than military service, making you @@.yellowgreen;a small sum.@@ - <<set _recruitLimit -= _adjst>> - <<run cashX(250, "securityExpansion")>> - <</if>> - <<if $SecExp.edicts.defense.noSubhumansInArmy === 1>> - Guaranteeing the purity of your armed forces comes with a small loss of potential recruits. - <<set _recruitLimit -= _adjst>> - <</if>> - <<if $SecExp.edicts.defense.pregExemption === 1>> - Many pregnant citizens prefer to avoid military service not to endanger themselves and their children. - <<set _recruitLimit -= _adjst>> - <</if>> - <</if>> - - <<set _recruits = Math.trunc((_recruitLimit * $ACitizens - App.SecExp.Manpower.totalMilitia) / 20 * _recruitsMultiplier)>> - <<if _recruits > 0>> - <<set $militiaFreeManpower += _recruits>> - This week <<print _recruits>> citizens joined the militia. - <<elseif $SecExp.edicts.defense.militia === 5>> - No citizens joined your militia this week because your society is as militarized as it can get. - <<elseif $SecExp.edicts.defense.militia === 2>> - There are no more citizens willing to join the arcology armed forces. You'll need to enact higher recruitment edicts if you need more manpower. - <<else>> - No more citizens could be drafted into your militia. You'll need to enact higher recruitment edicts if you need more manpower. - <</if>> - <br> - <</if>> - - /* mercs */ - <<if $mercenaries >= 1>> - <<set _newMercs = random(0,3)>> - <<if $rep < 6000>> - Your low reputation turns some mercenaries away, hoping to find contracts that would bring them more renown. - <<set _newMercs -= 1>> - <<elseif $rep < 12000>> - Your reputation is not high enough to attract many mercenaries to your free city. - <<else>> - Your reputation attracts many guns for hire who would be proud to have such distinct character on their resume. - <<set _newMercs += 1>> - <</if>> - <<if $arcologies[0].prosperity < 50>> - The low prosperity of the arcology discourages new guns for hire from coming to your arcology. - <<set _newMercs -= 1>> - <<elseif $arcologies[0].prosperity < 80>> - The fairly low prosperity of the arcology discourages new guns for hire from coming to your arcology. - <<set _newMercs += 1>> - <<elseif $arcologies[0].prosperity < 120>> - The prosperity of the arcology attracts a few mercenaries, hopeful to find lucrative contracts within its walls. - <<set _newMercs += random(1,2)>> - <<elseif $arcologies[0].prosperity < 160>> - The fairly high prosperity of the arcology attracts some mercenaries, hopeful to find lucrative contracts within its walls. - <<set _newMercs += random(2,3)>> - <<elseif $arcologies[0].prosperity < 180>> - The high prosperity of the arcology is attracts some mercenaries, hopeful to find lucrative contracts within its walls. - <<set _newMercs += random(2,4)>> - <<else>> - The very high prosperity of the arcology attracts a lot of mercenaries, hopeful to find lucrative contracts within its walls. - <<set _newMercs += random(3,5)>> - <</if>> - <<if $SecExp.core.crimeLow > 60>> - The powerful crime organizations that nested themselves in the arcology have an unending need for cheap guns for hire, many mercenaries flock to your free city in search of employment. - <<set _newMercs += random(1,2)>> - <</if>> - <<if $SF.Toggle && $SF.Active >= 1 && _size > 10>> - Having a powerful special force attracts a lot of mercenaries, hopeful that they may be able to fight along side it. - <<set _newMercs += random(1,Math.round(_size/10))>> - <</if>> - <<if $SecExp.edicts.defense.discountMercenaries > 0>> - More mercenaries are attracted to your arcology as a result of the reduced rent. - <<set _newMercs += random(2,4)>> - <</if>> - <<set _newMercs = Math.trunc(_newMercs / 2)>> - <<if _newMercs > 0>> - <<set $mercFreeManpower += _newMercs>> - This week <<print _newMercs>> mercenaries reached the arcology. - <<else>> - This week no new mercenaries reached the arcology. - <</if>> - <<set $mercFreeManpower = Math.clamp($mercFreeManpower, 0, 2000)>> - <br> - <</if>> - - <<if App.SecExp.battle.activeUnits() > 0>> - /* loyalty and training */ - <<set _sL = $slaveUnits.length, _mL = $militiaUnits.length, _meL = $mercUnits.length>> - <<for _i = 0; _i < _sL; _i++>> - <<includeDOM App.SecExp.humanUnitLoyaltyChanges($slaveUnits[_i], 'slave')>> - <</for>> - <<for _i = 0; _i < _mL; _i++>> - <<includeDOM App.SecExp.humanUnitLoyaltyChanges($militiaUnits[_i], 'citizens')>> - <</for>> - <<for _i = 0; _i < _meL; _i++>> - <<includeDOM App.SecExp.humanUnitLoyaltyChanges($mercUnits[_i], 'mercenary')>> - <</for>> - <</if>> -<</if>> - - -<<if $SecExp.buildings.riotCenter && $SecExp.buildings.riotCenter.brainImplantProject > 0 && $SecExp.buildings.riotCenter.brainImplant < 106>> - <br><br> - <<set $SecExp.buildings.riotCenter.brainImplant += $SecExp.buildings.riotCenter.brainImplantProject>> - <<if 100 - $SecExp.buildings.riotCenter.brainImplant <= 0>> - The project has been completed! - <<set $SecExp.buildings.riotCenter.brainImplant = 106>> - <<else>> - The great brain implant project is proceeding steadily. This week we made - <<if $SecExp.buildings.riotCenter.brainImplantProject <= 2>> - some small - <<elseif $SecExp.buildings.riotCenter.brainImplantProject <= 4>> - some - <<else>> - good - <</if>> - progress. - <</if>> -<</if>> - -<<if $SecExp.buildings.weapManu>> - <<if App.SecExp.weapManuUpgrade.fully().bots && App.SecExp.weapManuUpgrade.fully().human>> <<run delete $SecExp.buildings.weapManu.upgrades.queue>> <</if>> - <<if jsDef($SecExp.buildings.weapManu.upgrades.queue) && $SecExp.buildings.weapManu.upgrades.queue.length > 0 && $SecExp.buildings.weapManu.upgrades.queue[0].time > 0>> - <<set _current = App.SecExp.weapManuUpgrade.current(), $SecExp.buildings.weapManu.upgrades.queue[0].time-->> - <br>In the research lab, _current.dec - <<switch _current.dec>> - <<case "adaptive armored frames" "advanced synthetic alloys" "ceramo-metallic alloys" "rapid action stimulants" "universal cyber enhancements" "remote neural links" "combined training regimens with the special force">> - are - <<default>> - is - <</switch>> - being developed with the aim of enhancing _current.unit' _current.purpose. - <<if $SecExp.buildings.weapManu.upgrades.queue[0].time <= 0>> - Reports indicate it is ready for deployment and will be issued in the following days. - <<set $SecExp.buildings.weapManu.upgrades.completed.push(_current.ID)>> - <<run $SecExp.buildings.weapManu.upgrades.queue.splice(0, 1)>> - <<else>> - It will be finished in <<= numberWithPluralOne($SecExp.buildings.weapManu.upgrades.queue[0].time, "week")>>. - <</if>> - <<for _i = 1; _i < $SecExp.buildings.weapManu.upgrades.queue.length; _i++>> - <<set _current = App.SecExp.weapManuUpgrade.current($SecExp.buildings.weapManu.upgrades.queue[_i].ID)>> - <br><<= ordinalSuffix(_i + 1)>> in queue: - _current.dec for _current.unit. It will enhance their _current.purpose. - <</for>> - <</if>> -<</if>> diff --git a/src/Mods/SecExp/unitsBattleReport.tw b/src/Mods/SecExp/unitsBattleReport.tw index 7d92a211e5cc14e990daa1cda3e75e2c87e8e989..871323bcdc45436e281aeeda423776f3b3fc4003 100644 --- a/src/Mods/SecExp/unitsBattleReport.tw +++ b/src/Mods/SecExp/unitsBattleReport.tw @@ -1,10 +1,10 @@ :: unitsBattleReport [nobr] -<<if $losses == 0>> +<<if $SecExp.war.losses == 0>> <<if App.SecExp.battle.deployedUnits('bots')>> <br>Security Drones: no casualties. <</if>> - <<if $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> + <<if $SF.Toggle && $SF.Active >= 1 && $SecExp.war.deploySF>> <br><<print num($SF.ArmySize)>> soldiers from $SF.Lower joined the battle: no casualties suffered. <</if>> <<if App.SecExp.battle.deployedUnits('militia') >= 1>> @@ -49,10 +49,10 @@ <</if>> <</for>> <</if>> -<<elseif $losses > 0>> +<<elseif $SecExp.war.losses > 0>> /* if the losses are more than zero */ /* generates a list of randomized losses, from which each unit picks one at random */ - <<set _losses = $losses>> + <<set _losses = $SecExp.war.losses>> <<set _averageLosses = Math.trunc(_losses / App.SecExp.battle.deployedUnits())>> <<set _lossesList = []>> <<set _validityCount = 0>> @@ -80,11 +80,11 @@ <</if>> <<set _count += _lossesList[_i]>> <</for>> - <<if _count < $losses>> + <<if _count < $SecExp.war.losses>> <<set _rand = random(_lossesList.length - 1)>> - <<set _lossesList[_rand] += $losses - _count>> - <<elseif _count > $losses>> - <<set _diff = _count - $losses>> + <<set _lossesList[_rand] += $SecExp.war.losses - _count>> + <<elseif _count > $SecExp.war.losses>> + <<set _diff = _count - $SecExp.war.losses>> <<set _rand = random(_lossesList.length - 1)>> <<set _lossesList[_rand] = Math.trunc(_lossesList[_rand]-_diff,0,100)>> <</if>> @@ -115,7 +115,7 @@ <</if>> <br> <</if>> - <<if $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> + <<if $SF.Toggle && $SF.Active >= 1 && $SecExp.war.deploySF>> <<set _loss = _lossesList.pluck()>> <<set _loss = Math.clamp(_loss,0,$SF.ArmySize)>> <br> <<print num($SF.ArmySize)>> soldiers from $SF.Lower joined the battle: diff --git a/src/Mods/SecExp/unitsRebellionReport.tw b/src/Mods/SecExp/unitsRebellionReport.tw index b2549223e94d38e93822f287a34735e9a398a3c8..4d9efb039a6ad2a9909c327f022b72dbd18961fd 100644 --- a/src/Mods/SecExp/unitsRebellionReport.tw +++ b/src/Mods/SecExp/unitsRebellionReport.tw @@ -1,7 +1,7 @@ :: unitsRebellionReport [nobr] -<<if $losses == 0>> - <<if $irregulars > 0>> +<<if $SecExp.war.losses == 0>> + <<if $SecExp.war.irregulars > 0>> <p>The volunteering citizens were quickly organized into an irregular militia unit and deployed in the arcology. No casualties suffered.</p> <</if>> <<if App.SecExp.battle.deployedUnits('bots') >= 1>> @@ -11,11 +11,11 @@ <br>$SF.Lower, <<print num($SF.ArmySize)>> strong, was called to join the battle: no casualties suffered. <</if>> <<set _count = 0>> - <<set _loyalUnits = $militiaUnits.length + $slaveUnits.length + $mercUnits.length - $rebellingID.length>> + <<set _loyalUnits = $militiaUnits.length + $slaveUnits.length + $mercUnits.length - $SecExp.war.rebellingID.length>> <<if _loyalUnits > 0>> <p> <<for _i = 0; _i < $militiaUnits.length; _i++>> - <<if $militiaUnits[_i].active == 1 && (!$rebellingID.includes($militiaUnits[_i].ID))>> + <<if $militiaUnits[_i].active == 1 && (!$SecExp.war.rebellingID.includes($militiaUnits[_i].ID))>> <<set $militiaUnits[_i].battlesFought++>> <<set _count++>> <<if _count < _loyalUnits>> @@ -26,7 +26,7 @@ <</if>> <</for>> <<for _i = 0; _i < $slaveUnits.length; _i++>> - <<if $slaveUnits[_i].active == 1 && (!$rebellingID.includes($slaveUnits[_i].ID))>> + <<if $slaveUnits[_i].active == 1 && (!$SecExp.war.rebellingID.includes($slaveUnits[_i].ID))>> <<set $slaveUnits[_i].battlesFought++>> <<set _count++>> <<if _count < _loyalUnits>> @@ -37,7 +37,7 @@ <</if>> <</for>> <<for _i = 0; _i < $mercUnits.length; _i++>> - <<if $mercUnits[_i].active == 1 && (!$rebellingID.includes($mercUnits[_i].ID))>> + <<if $mercUnits[_i].active == 1 && (!$SecExp.war.rebellingID.includes($mercUnits[_i].ID))>> <<set $mercUnits[_i].battlesFought++>> <<set _count++>> <<if _count < _loyalUnits>> @@ -50,23 +50,23 @@ participated in the battle without taking any casualties. They remained loyal until the end. </p> <</if>> -<<elseif $losses > 0>> +<<elseif $SecExp.war.losses > 0>> /* if the losses are more than zero */ /* generates a list of randomized losses, from which each unit picks one at random */ - <<set _averageLosses = Math.trunc($losses / App.SecExp.battle.deployedUnits())>> + <<set _averageLosses = Math.trunc($SecExp.war.losses / App.SecExp.battle.deployedUnits())>> <<set _lossesList = []>> <<for _i = 0; _i < App.SecExp.battle.deployedUnits(); _i++>> <<set _assignedLosses = Math.trunc(Math.clamp(_averageLosses + random(-5,5), 0, 100))>> - <<if _assignedLosses > $losses>> - <<set _assignedLosses = $losses>> - <<set $losses = 0>> + <<if _assignedLosses > $SecExp.war.losses>> + <<set _assignedLosses = $SecExp.war.losses>> + <<set $SecExp.war.losses = 0>> <<else>> - <<set $losses -= _assignedLosses>> + <<set $SecExp.war.losses -= _assignedLosses>> <</if>> <<set _lossesList.push(_assignedLosses)>> <</for>> - <<if $losses > 0>> - <<set _lossesList[random(_lossesList.length - 1)] += $losses>> + <<if $SecExp.war.losses > 0>> + <<set _lossesList[random(_lossesList.length - 1)] += $SecExp.war.losses>> <</if>> <<set _lossesList.shuffle()>> @@ -78,17 +78,17 @@ <</if>> <<set _count += _lossesList[_i]>> <</for>> - <<if _count < $losses>> + <<if _count < $SecExp.war.losses>> <<set _rand = random(_lossesList.length - 1)>> - <<set _lossesList[_rand] += $losses - _count>> - <<elseif _count > $losses>> - <<set _diff = _count - $losses>> + <<set _lossesList[_rand] += $SecExp.war.losses - _count>> + <<elseif _count > $SecExp.war.losses>> + <<set _diff = _count - $SecExp.war.losses>> <<set _rand = random(_lossesList.length - 1)>> <<set _lossesList[_rand] = Math.trunc(_lossesList[_rand]-_diff,0,100)>> <</if>> /* assigns the losses and notify the player */ - <<if $irregulars > 0>> + <<if $SecExp.war.irregulars > 0>> <<set _loss = _lossesList.pluck()>> <<if _loss > $ACitizens * 0.95>> <<set _loss = Math.trunc($ACitizens * 0.95)>> /* this is unlikely to happen, but might as well be safe*/ @@ -178,7 +178,7 @@ <<if App.SecExp.battle.deployedUnits('militia') >= 1>> <p> <<set _med = 0>> <<for _j = 0; _j < $militiaUnits.length; _j++>> - <<if $militiaUnits[_j].active == 1 && !$rebellingID.includes($militiaUnits[_j].ID)>> + <<if $militiaUnits[_j].active == 1 && !$SecExp.war.rebellingID.includes($militiaUnits[_j].ID)>> <<set $militiaUnits[_j].battlesFought++>> <<set _loss = _lossesList.pluck()>> <<set _loss = Math.clamp(_loss,0,$militiaUnits[_j].troops)>> @@ -220,7 +220,7 @@ <<if App.SecExp.battle.deployedUnits('slaves') >= 1>> <p> <<set _med = 0>> <<for _j = 0; _j < $slaveUnits.length; _j++>> - <<if $slaveUnits[_j].active == 1 && !$rebellingID.includes($slaveUnits[_j].ID)>> + <<if $slaveUnits[_j].active == 1 && !$SecExp.war.rebellingID.includes($slaveUnits[_j].ID)>> <<set $slaveUnits[_j].battlesFought++>> <<set _loss = _lossesList.pluck()>> <<if !(Number.isInteger(_loss))>> @@ -266,7 +266,7 @@ <<if App.SecExp.battle.deployedUnits('mercs') >= 1>> <p> <<set _med = 0>> <<for _j = 0; _j < $mercUnits.length; _j++>> - <<if $mercUnits[_j].active == 1 && !$rebellingID.includes($mercUnits[_j].ID)>> + <<if $mercUnits[_j].active == 1 && !$SecExp.war.rebellingID.includes($mercUnits[_j].ID)>> <<set $mercUnits[_j].battlesFought++>> <<set _loss = _lossesList.pluck()>> <<set _loss = Math.clamp(_loss,0,$mercUnits[_j].troops)>> @@ -309,10 +309,10 @@ <br>@@.red;Error: losses are a negative number or NaN@@ <</if>> -<<if $rebellingID.length > 0 && $battleResult >= 2>> /* rebellion win */ +<<if $SecExp.war.rebellingID.length > 0 && $SecExp.war.result >= 2>> /* rebellion win */ <br> <<set _militiaRebelledID = [], _militiaManpower = 0>> <<for _j = 0; _j < $militiaUnits.length; _j++>> - <<if $militiaUnits[_j].active == 1 && $rebellingID.includes($militiaUnits[_j].ID)>> + <<if $militiaUnits[_j].active == 1 && $SecExp.war.rebellingID.includes($militiaUnits[_j].ID)>> <br>$militiaUnits[_j].platoonName, <<set _militiaRebelledID.push($militiaUnits[_j].ID)>> <<set _militiaManpower += Math.clamp($militiaUnits[_j].troops - random(_averageLosses),0,$militiaUnits[_j].troops)>> @@ -359,7 +359,7 @@ <br> <<set _slaveRebelledID = [], _slaveManpower = 0>> <<for _j = 0; _j < $slaveUnits.length; _j++>> - <<if $slaveUnits[_j].active == 1 && $rebellingID.includes($slaveUnits[_j].ID)>> + <<if $slaveUnits[_j].active == 1 && $SecExp.war.rebellingID.includes($slaveUnits[_j].ID)>> <br>$slaveUnits[_j].platoonName, <<set _slaveRebelledID.push($slaveUnits[_j].ID)>> <<set _slaveManpower += Math.clamp($slaveUnits[_j].troops - random(_averageLosses),0,$slaveUnits[_j].troops)>> @@ -406,7 +406,7 @@ <br> <<set _mercRebelledID = [], _mercManpower = 0>> <<for _j = 0; _j < $mercUnits.length; _j++>> - <<if $mercUnits[_j].active == 1 && $rebellingID.includes($mercUnits[_j].ID)>> + <<if $mercUnits[_j].active == 1 && $SecExp.war.rebellingID.includes($mercUnits[_j].ID)>> <br>$mercUnits[_j].platoonName, <<set _mercRebelledID.push($mercUnits[_j].ID)>> <<set _mercManpower += Math.clamp($mercUnits[_j].troops - random(_averageLosses),0,$mercUnits[_j].troops)>> @@ -450,12 +450,12 @@ <br>//Will positively influence the loyalty of the other units, but no manpower will be refunded.// </span> <</if>> -<<elseif $rebellingID.length > 0>> +<<elseif $SecExp.war.rebellingID.length > 0>> /* rebellion loss */ <br><br> <<set _militiaRebelledID = []>> <<for _j = 0; _j < $militiaUnits.length; _j++>> - <<if $militiaUnits[_j].active == 1 && $rebellingID.includes($militiaUnits[_j].ID)>> + <<if $militiaUnits[_j].active == 1 && $SecExp.war.rebellingID.includes($militiaUnits[_j].ID)>> <<set _militiaRebelledID.push($militiaUnits[_j].ID)>> $militiaUnits[_j].platoonName, <</if>> @@ -468,7 +468,7 @@ <br> <<set _slaveRebelledID = []>> <<for _j = 0; _j < $slaveUnits.length; _j++>> - <<if $slaveUnits[_j].active == 1 && $rebellingID.includes($slaveUnits[_j].ID)>> + <<if $slaveUnits[_j].active == 1 && $SecExp.war.rebellingID.includes($slaveUnits[_j].ID)>> <<set _slaveRebelledID.push($slaveUnits[_j].ID)>> $slaveUnits[_j].platoonName, <</if>> @@ -482,7 +482,7 @@ <<set _mercRebelledID = []>> <<set _count = 0>> <<for _j = 0; _j < $mercUnits.length; _j++>> - <<if $mercUnits[_j].active == 1 && $rebellingID.includes($mercUnits[_j].ID)>> + <<if $mercUnits[_j].active == 1 && $SecExp.war.rebellingID.includes($mercUnits[_j].ID)>> <<set _mercRebelledID.push($mercUnits[_j].ID)>> <<set _count++>> $mercUnits[_j].platoonName, diff --git a/src/endWeek/economics/arcmgmt.js b/src/endWeek/economics/arcmgmt.js index 5db18dbee0a6095f447d699269f9a90f5dfecb10..1f2ea06b302e385e8d53c4f89a2f1c659d731081 100644 --- a/src/endWeek/economics/arcmgmt.js +++ b/src/endWeek/economics/arcmgmt.js @@ -1107,7 +1107,7 @@ App.EndWeek.arcManagement = function() { _upperClass += -13.5; _upperClassP *= 0.995; _topClass += -5; - _topClass *= 0.99; + _topClassP *= 0.99; r.push(`The rent promotion for new immigrants brings new citizens to the arcology.`); } if (V.policies.immigrationRep === 1) { @@ -1118,7 +1118,7 @@ App.EndWeek.arcManagement = function() { _upperClass += -13.5; _upperClassP *= 0.995; _topClass += -5; - _topClass *= 0.99; + _topClassP *= 0.99; r.push(`Your welcome program for new citizens helps encourage wealthy people from the old world to immigrate, but <span class="red">annoys some longstanding citizens.</span>`); repX(forceNeg(100), "policies"); } @@ -1130,7 +1130,7 @@ App.EndWeek.arcManagement = function() { _upperClass += 13.5; _upperClassP *= 1.005; _topClass += 5; - _topClass *= 1.01; + _topClassP *= 1.01; r.push(`You covertly <span class="yellowgreen">sell</span> the private information of potential arcology immigrants on the old world black market.`); cashX(random(500, 1500), "policies"); } @@ -1142,7 +1142,7 @@ App.EndWeek.arcManagement = function() { _upperClass += 13.5; _upperClassP *= 1.005; _topClass += 5; - _topClass *= 1.01; + _topClassP *= 1.01; r.push(`You allow citizens input on potential immigrants, a <span class="green">popular</span> program.`); repX(100, "policies"); } @@ -1152,7 +1152,7 @@ App.EndWeek.arcManagement = function() { _lowerClass += -200; _lowerClassP *= .99; _topClass += 5; - _topClass *= 1.01; + _topClassP *= 1.01; r.push(`You <span class="yellowgreen">take kickbacks</span> for ignoring enslavement of citizens.`); cashX(random(500, 1500), "policies"); } @@ -1162,7 +1162,7 @@ App.EndWeek.arcManagement = function() { _lowerClass += -200; _lowerClassP *= 0.99; _topClass += 5; - _topClass *= 1.01; + _topClassP *= 1.01; r.push(`You <span class="green">make friends</span> by tacitly supporting enslavement of upstart citizens.`); repX(100, "policies"); } @@ -1172,7 +1172,7 @@ App.EndWeek.arcManagement = function() { _lowerClass += 200; _lowerClassP *= 1.02; _topClass += -5; - _topClass *= 0.98; + _topClassP *= 0.98; r.push(`Your charity purse prevents a few citizens from falling into slavery.`); } if (V.policies.enslavementRep === -1) { @@ -1181,7 +1181,7 @@ App.EndWeek.arcManagement = function() { _lowerClass += 200; _lowerClassP *= 1.01; _topClass += -5; - _topClass *= 0.99; + _topClassP *= 0.99; r.push(`You use your personal influence to help struggling citizens.`); repX(forceNeg(100), "policies"); } diff --git a/src/endWeek/nextWeek/nextWeek.js b/src/endWeek/nextWeek/nextWeek.js index 768b530f525a3ac65ed611428493d6e757b3a6bc..a6add17ab0d2ff3fcc6780dc864333278a16134f 100644 --- a/src/endWeek/nextWeek/nextWeek.js +++ b/src/endWeek/nextWeek/nextWeek.js @@ -295,12 +295,11 @@ App.EndWeek.nextWeek = function() { V.foughtThisWeek = 0; } - if (V.SecExp.buildings.riotCenter && V.SecExp.buildings.riotCenter.sentUnitCooldown > 0) { - V.SecExp.buildings.riotCenter.sentUnitCooldown--; - } - if (V.SecExp.proclamation.cooldown > 0) { - V.SecExp.proclamation.cooldown--; + 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; } App.EndWeek.weather(); diff --git a/src/events/gameover.tw b/src/events/gameover.tw index 70975838ca93e6bb3184caf2ba74b874984c3431..144b9b464eb0b40e859473d40a79bea5801f69ab 100644 --- a/src/events/gameover.tw +++ b/src/events/gameover.tw @@ -32,16 +32,16 @@ Your appointed successor arrives in your old office to find $assistant.name ready to help them take control of the arcology. Most of your assets have been liquidated to create a huge endowment for $arcologies[0].name's Sisters. They'll never have to sell one of their own again, and will be able to afford all the advanced drugs and surgeries they desire. From the most matronly futa down to their newest Sister, none of them need concern themselves with anything other than sex. <<case "major battle defeat">> - <<if $attackType == "raiders">> + <<if $SecExp.war.attacker.type === "raiders">> As the horde of raiders breaks the battle lines and enters the arcology, all hell breaks loose. You citizens are raped, your slaves captured and abused, your penthouse burned. As for you, you are quickly captured and brought in front of the warlord himself. With a satisfied smile he aims his pistol to your forehead and squeezes the trigger. - <<elseif $attackType == "old world">> + <<elseif $SecExp.war.attacker.type === "old world">> As the interminable column of old world puppets breaks the battle lines and enters the arcology, all hell breaks loose. Properties are seized and wealth stolen and distributed between the victorious soldiers. You are stripped of everything you possessed and left to rot in a corner of your once glorious arcology. - <<elseif $attackType == "freedom fighters">> + <<elseif $SecExp.war.attacker.type === "freedom fighters">> As the army of freedom fighters invades the arcology, all hell breaks loose. Their righteous fury torches everything you held dear, while the streets of the arcology run red with the blood of the masters. You are reserved a special death: crucified in front of the arcology's entrance, your corpse a grim reminder of your legacy. - <<elseif $attackType == "free city">> + <<elseif $SecExp.war.attacker.type === "free city">> As the mercenaries break the battle lines and enter the arcology all hell breaks loose. The sectors are pillaged one by one, systematically and thoroughly. When they break in the penthouse they quickly capture and send you to their employers as proof of their success. Your personal story may continue, but that part of it worthy of retelling has now ended. <</if>> diff --git a/src/interaction/siRules.js b/src/interaction/siRules.js index 8f11eafa8bc344259ae0d4acdd2f54afdaa21fbb..b5e02a194109390fe129440b443977390d131e8e 100644 --- a/src/interaction/siRules.js +++ b/src/interaction/siRules.js @@ -143,7 +143,7 @@ App.UI.SlaveInteract.rules = function(slave) { div.append("Sleep rules: "); if ([Job.NURSE, Job.HEADGIRL, Job.TEACHER, Job.STEWARD, Job.MATRON, Job.FARMER, Job.MADAM, Job.WARDEN, Job.DJ, Job.MILKMAID].includes(slave.assignment)) { App.UI.DOM.appendNewElement("span", div, ` ${His} sleeping schedule is managed by ${his} assignment.`, "note"); - } else if ([Job.QUARTER, Job.DAIRY, Job.FUCKTOY, Job.CLUB, Job.PUBLIC, Job.FARMYARD, Job.WHORE, Job.GLORYHOLE].includes(slave.assignment) || (V.dairyRestraintsSetting < 2 && slave.assignment === Job.DAIRY)) { + } else if ([Job.GLORYHOLE, Job.FARMYARD, Job.CLUB, Job.PUBLIC, Job.WHORE, Job.BROTHEL, Job.SUBORDINATE, Job.HOUSE, Job.QUARTER, Job.FUCKTOY, Job.MASTERSUITE, Job.MILKED].includes(slave.assignment) || (V.dairyRestraintsSetting < 2 && slave.assignment === Job.DAIRY)) { choices = [ {value: "none"}, {value: "cruel"}, diff --git a/src/uncategorized/economics.tw b/src/uncategorized/economics.tw index cd70fccb641b9edf62dcc3c665636166911b1f7c..de324fddc29471836e632c9ec791b370b9dc88ba 100644 --- a/src/uncategorized/economics.tw +++ b/src/uncategorized/economics.tw @@ -31,8 +31,8 @@ <<if $secExpEnabled > 0>> <br> - <<include "authorityReport">> - <<include "securityReport">> + <<= App.SecExp.authorityReport()>> + <<= App.SecExp.securityReport()>> <</if>> <<includeDOM App.EndWeek.reputation()>> @@ -95,13 +95,13 @@ <<if $secExpEnabled > 0>> <div id="Authority" class="tab-content"> <div class="content"> - <<include "authorityReport">> + <<= App.SecExp.authorityReport()>> </div> </div> <div id="securityReport" class="tab-content"> <div class="content"> - <<include "securityReport">> + <<= App.SecExp.securityReport()>> </div> </div> <</if>> @@ -130,4 +130,4 @@ document.getElementById("defaultOpen").click(); </script> </body> -<</if>> \ No newline at end of file +<</if>> diff --git a/src/uncategorized/scheduledEvent.tw b/src/uncategorized/scheduledEvent.tw index d496164f619d38e12a26af9f097e62eba25ab2ab..e38e8183f4f89876d51dd7b422cf87b325e4e268 100644 --- a/src/uncategorized/scheduledEvent.tw +++ b/src/uncategorized/scheduledEvent.tw @@ -76,7 +76,7 @@ <</if>> <<if $secExpEnabled > 0 && $SecExp.settings.battle.enabled > 0>> - <<include "attackGenerator">> + <<= App.SecExp.generator.attack()>> <</if>> <<if $rivalOwner == -1>>