From 8575f2f3791d8349a1afe5e2a47e42b6347e26dd Mon Sep 17 00:00:00 2001 From: Blank_Alt <12406-Blank_Alt@users.noreply.gitgud.io> Date: Tue, 18 Aug 2020 00:20:20 -0700 Subject: [PATCH] SecExp-backporting --- js/003-data/gameVariableData.js | 2 - src/002-config/fc-version.js | 2 +- .../SecExp/SecExpBackwardCompatibility.tw | 3 +- src/Mods/SecExp/attackGenerator.tw | 4 +- src/Mods/SecExp/attackHandler.tw | 134 +++--- src/Mods/SecExp/attackOptions.tw | 74 +--- src/Mods/SecExp/attackReport.tw | 165 ++++---- src/Mods/SecExp/authorityReport.tw | 25 +- src/Mods/SecExp/buildings/propagandaHub.tw | 60 +-- src/Mods/SecExp/buildings/secBarracks.tw | 121 ++---- src/Mods/SecExp/buildings/securityHQ.tw | 12 +- src/Mods/SecExp/js/Unit.js | 361 +++++++++++++--- src/Mods/SecExp/js/buildingsJS.js | 395 ++++++++++++++++++ src/Mods/SecExp/js/secExp.js | 380 ++++++----------- src/Mods/SecExp/js/secExpBC.js | 271 ++++++------ src/Mods/SecExp/js/secExpState.js | 131 ------ src/Mods/SecExp/rebellionGenerator.tw | 8 +- src/Mods/SecExp/rebellionHandler.tw | 74 ++-- src/Mods/SecExp/rebellionOptions.tw | 40 +- src/Mods/SecExp/rebellionReport.tw | 6 +- src/Mods/SecExp/secExpSmilingMan.tw | 4 +- src/Mods/SecExp/securityReport.tw | 30 +- src/Mods/SecExp/unitsBattleReport.tw | 53 +-- src/Mods/SecExp/unitsRebellionReport.tw | 66 ++- src/Mods/SecExp/widgets/miscSecExpWidgets.tw | 116 +---- src/descriptions/arcologyDescription.js | 6 +- src/events/intro/initNationalities.js | 3 +- src/gui/options/options.tw | 9 +- src/gui/quicklinks.js | 8 +- src/gui/storyCaption.tw | 8 +- src/uncategorized/arcmgmt.tw | 21 +- src/uncategorized/fsDevelopments.tw | 2 +- src/uncategorized/manageArcology.tw | 10 +- src/uncategorized/persBusiness.tw | 15 +- src/uncategorized/reputation.tw | 8 +- 35 files changed, 1365 insertions(+), 1262 deletions(-) create mode 100644 src/Mods/SecExp/js/buildingsJS.js delete mode 100644 src/Mods/SecExp/js/secExpState.js diff --git a/js/003-data/gameVariableData.js b/js/003-data/gameVariableData.js index 29919395a4f..15dabb22a45 100644 --- a/js/003-data/gameVariableData.js +++ b/js/003-data/gameVariableData.js @@ -348,7 +348,6 @@ App.Data.resetOnNGPlus = { personalShares: 0, publicShares: 0, SF: {}, - focus: "social engineering", thisWeeksFSWares: 0, thisWeeksIllegalWares: 0, Sweatshops: 0, @@ -438,7 +437,6 @@ App.Data.resetOnNGPlus = { /* battle relevant vars */ slaveVictories: [], - totalKills: 0, battlesCount: 0, majorBattlesCount: 0, chosenTactic: "none", diff --git a/src/002-config/fc-version.js b/src/002-config/fc-version.js index 1abc575f6fe..d6aeb9e1c1b 100644 --- a/src/002-config/fc-version.js +++ b/src/002-config/fc-version.js @@ -2,5 +2,5 @@ App.Version = { base: "0.10.7.1", // The vanilla version the mod is based off of, this should never be changed. pmod: "3.6.2", commitHash: null, - release: 1087 + release: 1088 }; diff --git a/src/Mods/SecExp/SecExpBackwardCompatibility.tw b/src/Mods/SecExp/SecExpBackwardCompatibility.tw index 514aa0743ee..6901f805633 100644 --- a/src/Mods/SecExp/SecExpBackwardCompatibility.tw +++ b/src/Mods/SecExp/SecExpBackwardCompatibility.tw @@ -111,8 +111,7 @@ <</if>> /* recalculation widgets */ -<<fixBrokenUnits>> <<fixBrokenStats>> <<set $wasToggledBefore = 1>> -<br>Missing Security Expansion variables set. All done! +<br>Missing Security Expansion variables set. All done! \ No newline at end of file diff --git a/src/Mods/SecExp/attackGenerator.tw b/src/Mods/SecExp/attackGenerator.tw index 5a5736aba9c..caeb958dbdc 100644 --- a/src/Mods/SecExp/attackGenerator.tw +++ b/src/Mods/SecExp/attackGenerator.tw @@ -82,12 +82,12 @@ <<set _free -= 8>> <</if>> /* raiders */ - <<if $SecExp.security.cap <= 50>> + <<if $SecExp.core.security <= 50>> <<set _oldWorld -= 5>> <<set _raider += 15>> <<set _freeCity -= 5>> <<set _free -= 5>> - <<elseif $SecExp.security.cap <= 25>> + <<elseif $SecExp.core.security <= 25>> <<set _oldWorld -= 8>> <<set _raider += 24>> <<set _freeCity -= 8>> diff --git a/src/Mods/SecExp/attackHandler.tw b/src/Mods/SecExp/attackHandler.tw index 220a0dbae4d..4b86e53d82d 100644 --- a/src/Mods/SecExp/attackHandler.tw +++ b/src/Mods/SecExp/attackHandler.tw @@ -4,46 +4,29 @@ <<if $battleResult == 1 || $battleResult == -1>> /* bribery/surrender check */ <<if $SecExp.settings.showStats == 1>> - bribery chosen - <<else>> - Surrender chosen + <<if $battleResult == 1>>Bribery<<else>>Surrender<</if>> chosen <</if>> <<if $battleResult == 1>> <<if $cash >= $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">> - <<if random(1,100) <= 50>> - <<set $battleResult = 0>> - <</if>> - <<elseif random(1,100) <= 10>> + <<if $attackType == "freedom fighters" && random(1,100) <= 50 || random(1,100) <= 10>> <<set $battleResult = 0>> <</if>> <<else>> - <<if random(1,100) <= 50>> - <<set $battleResult = 0>> - <</if>> + <<if random(1,100) <= 50>> <<set $battleResult = 0>> <</if>> <</if>> <<if $SecExp.settings.showStats == 1>> - <<if $battleResult == 0>> - <br>Bribery failed! - <<else>> - <br>Bribery Successful! - <</if>> - <br><br> - <<link "proceed">> - <<goto "attackReport">> - <</link>> + <br>Bribery <<if $battleResult == 0>>failed<<else>>Successful<</if>>! + <br><br>[[proceed|attackReport]] <<else>> <<goto "attackReport">> <</if>> <<else>> <<goto "attackReport">> <</if>> - <<else>> - /*Init*/ - <<if $majorBattle == 0>> - <<set _turns = $maxTurns>> + <<if $majorBattle == 0>> + <<set _turns = $maxTurns>> <</if>> <<set _attack = 0>> <<set _defense = 0>> @@ -834,7 +817,7 @@ <</if>> /* calculates PC army stats */ - <<if App.SecExp.conflict.deployedUnits('bots')>> + <<if App.SecExp.battle.deployedUnits('bots')>> <<set _unit = App.SecExp.getUnit("Bots")>> <<set _attack += _unit.attack * _atkMod>> <<set _defense += _unit.defense * _defMod>> @@ -895,12 +878,14 @@ <<set _SFMod = 1.5>> <</if>> - <<set _moraleTroopMod = Math.clamp(App.SecExp.conflict.troopCount() / 100,1,5)>> + <<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.conflict.deployedUnits('militia') + App.SecExp.BaseSlaveUnit.morale * _slaveMod * App.SecExp.conflict.deployedUnits('slaves') + App.SecExp.BaseMercUnit.morale * _mercMod * App.SecExp.conflict.deployedUnits('mercs') + App.SecExp.BaseSpecialForcesUnit.morale * $SFIntervention * _SFMod) / ($secBots.isDeployed + App.SecExp.conflict.deployedUnits('militia') + App.SecExp.conflict.deployedUnits('slaves') + App.SecExp.conflict.deployedUnits('mercs') + $SFIntervention)>> - <<set _morale = _morale + _morale * $SecExp.buildings.barracks.upgrades.luxury * 0.05>> /* barracks bonus */ + <<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)>> + <<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.conflict.deployedUnits('militia') + App.SecExp.BaseSlaveUnit.hp * App.SecExp.conflict.deployedUnits('slaves') + App.SecExp.BaseMercUnit.hp * App.SecExp.conflict.deployedUnits('mercs') + App.SecExp.BaseSpecialForcesUnit.hp * $SFIntervention) / ($secBots.isDeployed + App.SecExp.conflict.deployedUnits('militia') + App.SecExp.conflict.deployedUnits('slaves') + App.SecExp.conflict.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 * $SFIntervention) / ($secBots.isDeployed + App.SecExp.battle.deployedUnits('militia') + App.SecExp.battle.deployedUnits('slaves') + App.SecExp.battle.deployedUnits('mercs') + $SFIntervention)>> /* calculates enemy army stats */ <<if $week <= 30>> @@ -972,13 +957,14 @@ <<set _slaveMod = Math.round(_slaveMod * 100)>> <<set _SFMod = Math.round(_SFMod * 100)>> <<set _enemyMod = Math.round(_enemyMod * 100)>> - <<set _barracksBonus = $SecExp.buildings.barracks.upgrades.luxury * 5>> + <<if $SecExp.buildings.barracks>> + <<set _barracksBonus = $SecExp.buildings.barracks.luxury * 5>> + <</if>> <<set _moraleTroopMod = Math.round(_moraleTroopMod * 100)>> <<set _enemyMoraleTroopMod = Math.round(_enemyMoraleTroopMod * 100)>> <<set _difficulty *= 100>> - __Difficulty__: - <br> + __Difficulty__:<br> <<if $SecExp.settings.difficulty == 0.5>> Very easy <<elseif $SecExp.settings.difficulty == 0.75>> @@ -992,10 +978,8 @@ <<else>> Extremly hard <</if>> - <br> - <br> - __Army__: - <br>troops: <<print num(Math.round(App.SecExp.conflict.troopCount()))>> + <br><br>__Army__: + <br>troops: <<print num(Math.round(App.SecExp.battle.troopCount()))>> <br>attack: <<print num(Math.round(_attack))>> <br>defense: <<print num(Math.round(_defense))>> <br>hp: <<print num(Math.round(_hp))>> @@ -1009,20 +993,16 @@ <<if $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> <br>special force morale modifier: <<if _SFMod > 0>>+<</if>>_SFMod% <</if>> - <<if $SecExp.buildings.barracks.upgrades.luxury >= 1>> - <br>Barracks bonus morale modifier: +<<print _barracksBonus>>% + <<if $SecExp.buildings.barracks && $SecExp.buildings.barracks.luxury >= 1>> + <br>Barracks bonus morale modifier: +<<print _barracksBonus>>% <</if>> <<if _moraleTroopMod>> <br>morale increase due to troop numbers: +<<print _moraleTroopMod>>% <</if>> - <br> - <br> - __Tactics__: + <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> - <br> - __Enemy__: + <br><br>__Enemy__: <br>enemy troops: <<print num(Math.round($attackTroops))>> <br>enemy attack: <<print num(Math.round(_enemyAttack))>> <br>enemy defense: <<print num(Math.round(_enemyDefense))>> @@ -1038,23 +1018,18 @@ /* simulates the combat by pitting attk against def */ <<for _i = 0; _i < _turns; _i++>> - <br><br> - <<if $SecExp.settings.showStats == 1>> turn: <<print _i + 1>><</if>> + <<if $SecExp.settings.showStats == 1>> <br><br>turn: <<print _i + 1>><</if>> /* player army attacks */ <<set _damage = Math.clamp(_attack - _enemyDefense,_attack * 0.1,_attack)>> - <br> - <<if $SecExp.settings.showStats == 1>> player damage: <<print num(Math.round(_damage))>><</if>> + <<if $SecExp.settings.showStats == 1>> <br>player damage: <<print num(Math.round(_damage))>><</if>> <<set _enemyHp -= _damage>> - <br> - <<if $SecExp.settings.showStats == 1>> remaining enemy Hp: <<print num(Math.round(_enemyHp))>><</if>> + <<if $SecExp.settings.showStats == 1>> <br>remaining enemy Hp: <<print num(Math.round(_enemyHp))>><</if>> <<set $enemyLosses += _damage / _enemyBaseHp>> <<set _moraleDamage = Math.clamp(_damage / 2 + _damage / _enemyBaseHp,0,_damage*1.5)>> <<set _enemyMorale -= _moraleDamage>> - <br> - <<if $SecExp.settings.showStats == 1>> remaining enemy morale: <<print num(Math.round(_enemyMorale))>><</if>> + <<if $SecExp.settings.showStats == 1>> <br>remaining enemy morale: <<print num(Math.round(_enemyMorale))>><</if>> <<if _enemyHp <= 0 || _enemyMorale <= 0>> - <br> - <<if $SecExp.settings.showStats == 1>> <br>Victory!<</if>> + <<if $SecExp.settings.showStats == 1>> <br><br>Victory!<</if>> <<set $battleResult = 3>> <<set $battleTurns = _i>> <<break>> @@ -1065,61 +1040,50 @@ <<if _damage < _enemyAttack * 0.1>> <<set _damage = _enemyAttack * 0.1>> <</if>> - <br> - <<if $SecExp.settings.showStats == 1>> enemy damage: <<print num(Math.round(_damage))>><</if>> + <<if $SecExp.settings.showStats == 1>> <br>enemy damage: <<print num(Math.round(_damage))>><</if>> <<set _hp -= _damage>> - <br> - <<if $SecExp.settings.showStats == 1>> remaining hp: <<print num(Math.round(_hp))>><</if>> + <<if $SecExp.settings.showStats == 1>> <br>remaining hp: <<print num(Math.round(_hp))>><</if>> <<set $losses += _damage / _baseHp>> <<set _moraleDamage = Math.clamp(_damage / 2 + _damage / _baseHp,0,_damage*1.5)>> <<set _morale -= _moraleDamage>> - <br> - <<if $SecExp.settings.showStats == 1>> remaining morale: <<print Math.round(_morale)>><</if>> + <<if $SecExp.settings.showStats == 1>> <br>remaining morale: <<print Math.round(_morale)>><</if>> <<if _hp <= 0 || _morale <= 0>> - <br> - <<if $SecExp.settings.showStats == 1>> <br>Defeat!<</if>> + <<if $SecExp.settings.showStats == 1>> <br><br>Defeat!<</if>> <<set $battleResult = -3>> <<set $battleTurns = _i>> <<break>> <</if>> <</for>> <<if $battleResult != 3 && $battleResult != -3>> - <br> <<if _morale > _enemyMorale>> - <<if $SecExp.settings.showStats == 1>> <br>Partial victory!<</if>> + <<if $SecExp.settings.showStats == 1>> <br><br>Partial victory!<</if>> <<set $battleResult = 2>> <<elseif _morale < _enemyMorale>> - <<if $SecExp.settings.showStats == 1>> <br>Partial defeat!<</if>> + <<if $SecExp.settings.showStats == 1>> <br><br>Partial defeat!<</if>> <<set $battleResult = -2>> <</if>> <</if>> <<if $SecExp.settings.showStats == 1>> - <br> - <br>Losses: <<print num(Math.trunc($losses))>> + <br><br>Losses: <<print num(Math.trunc($losses))>> <br>Enemy losses: <<print num(Math.trunc($enemyLosses))>> <</if>> - <<if $battleResult > 3 || $battleResult < -3>> + <<if $battleResult > 3 || $battleResult < -3>> <br><br>@@.red;Error: failed to determine battle result@@ <</if>> - <<if $SecExp.settings.showStats == 1 && $majorBattle == 1 && $SecExp.settings.battle.major.gameOver == 1 && $battleResult == -3>> - <br><br> - <<link "Proceed">> - <<set $gameover = "major battle defeat">> - <<goto "Gameover">> - <</link>> - <<elseif $majorBattle == 1 && $SecExp.settings.battle.major.gameOver == 1 && $battleResult == -3>> - <<set $gameover = "major battle defeat">> - <<goto "Gameover">> - <<elseif $SecExp.settings.showStats == 1>> - <br><br> - <<link "Proceed">> - <<goto "attackReport">> - <</link>> + <<if $SecExp.settings.showStats == 1>> + <<if $majorBattle == 1 && $SecExp.settings.battle.major.gameOver == 1 && $battleResult == -3>> + <br><br>[[Proceed|Gameover][$gameover = "major battle defeat"]] + <<else>> + <br><br>[[Proceed|attackReport]] + <</if>> <<else>> - <<goto "attackReport">> + <<if $majorBattle == 1 && $SecExp.settings.battle.major.gameOver == 1 && $battleResult == -3>> + <<set $gameover = "major battle defeat">> <<goto "Gameover">> + <<else>> + <<goto "attackReport">> + <</if>> <</if>> - -<</if>> /* closes check for bribery */ +<</if>> /* closes check for bribery */ \ No newline at end of file diff --git a/src/Mods/SecExp/attackOptions.tw b/src/Mods/SecExp/attackOptions.tw index 99fcedc2136..f8620b33d0e 100644 --- a/src/Mods/SecExp/attackOptions.tw +++ b/src/Mods/SecExp/attackOptions.tw @@ -277,7 +277,7 @@ approximately <strong><<print _estimatedMen>> men</strong> are coming, they seem <<if _leaderFound === 1>> <br> - <<if App.SecExp.conflict.deployedUnits() > 0>> + <<if App.SecExp.battle.deployedUnits() > 0>> <<link "Send your orders" "attackHandler">> <<set $battleResult = 4>> /* sets $battleResult value outside accepted range to avoid evaluation problems */ <<set $foughtThisWeek = 1>> @@ -297,7 +297,7 @@ approximately <strong><<print _estimatedMen>> men</strong> are coming, they seem <<set $battleResult = 1>> <<set $foughtThisWeek = 1>> <</link>> - <br> //Will cost around <<print cashFormat(Math.round($bribeCost * (1 + either(-1,1) * random(2) * 0.1)))>> (estimate).// + //Will cost around <<print cashFormat(Math.round($bribeCost * (1 + either(-1,1) * random(2) * 0.1)))>> (estimate).// <<else>> Your leader needs to be present to proceed. <</if>> @@ -311,7 +311,7 @@ approximately <strong><<print _estimatedMen>> men</strong> are coming, they seem <</if>> <br> -<<if $lastSelection.length > 0>> <br> +<<if $lastSelection.length > 0>> <<link "Restore saved roster" "attackOptions">> <<for _i = 0; _i < $lastSelection.length; _i++>> <<if $lastSelection[_i] == -1>> @@ -345,7 +345,7 @@ approximately <strong><<print _estimatedMen>> men</strong> are coming, they seem | <<if $saveValid != 1>> <<link "Save current roster" "attackOptions">> - <<if App.SecExp.conflict.deployedUnits('bots')>> + <<if App.SecExp.battle.deployedUnits('bots')>> <<set _tmp = -1>> <<set $lastSelection.push(_tmp)>> <</if>> @@ -370,7 +370,7 @@ approximately <strong><<print _estimatedMen>> men</strong> are coming, they seem Save current roster <</if>> | -<<if App.SecExp.conflict.deployedUnits() > 0>> +<<if App.SecExp.battle.deployedUnits() > 0>> <<link "Clear current roster" "attackOptions">> <<set $secBots.isDeployed = 0>> <<for _i = 0; _i < $militiaUnits.length; _i++>> @@ -398,7 +398,7 @@ approximately <strong><<print _estimatedMen>> men</strong> are coming, they seem Clear saved roster <</if>> -<br><br> /* troop deployment */ +<br> /* troop deployment */ <<if App.SecExp.battle.deployableUnits() > 0>> With your current readiness level you can send an additional <strong><<print App.SecExp.battle.deployableUnits()>></strong> units. <</if>> @@ -410,19 +410,7 @@ approximately <strong><<print _estimatedMen>> men</strong> are coming, they seem <<run App.UI.tabBar.handlePreSelectedTab($tabChoice.Options)>> <<if App.SecExp.battle.deployableUnits() === 0>> <strong>Unit roster full.</strong> <</if>> -<<if $secBots.active == 1 && $secBots.troops > 0>> - <<= App.SecExp.getUnit("Bots").describe()>> <br> - <<if $secBots.isDeployed == 0 && App.SecExp.battle.deployableUnits() > 0>> - <<link "Deploy the unit" "attackOptions">> - <<set $secBots.isDeployed = 1, $saveValid = 0>> - <</link>> - <<else>> - <<link "Remove the unit" "attackOptions">> - <<set $secBots.isDeployed = 0, $saveValid = 0>> - <</link>> - <</if>> - <br><br> -<</if>> +<br> <<includeDOM App.SecExp.deployUnitMenu($secBots)>> <<if $militiaUnits.length > 0>> <button class="tab-links" onclick="App.UI.tabBar.openTab(event, 'militia')" id="tab militia">Militia: ($militiaUnits.length)</button> <</if>> @@ -436,63 +424,21 @@ approximately <strong><<print _estimatedMen>> men</strong> are coming, they seem <div id="militia" class="tab-content"> <div class="content"> <<for _i = 0; _i < _mL; _i++>> - <<capture _i>> - <<if $militiaUnits[_i].active == 1 && $militiaUnits[_i].troops > 0>> - <<= App.SecExp.getUnit("Militia", _i).describe()>> <br> - <<if $militiaUnits[_i].isDeployed == 0 && App.SecExp.battle.deployableUnits() > 0>> - <<link "Deploy the unit" "attackOptions">> - <<set $militiaUnits[_i].isDeployed = 1, $saveValid = 0>> - <</link>> - <<else>> - <<link "Remove the unit" "attackOptions">> - <<set $militiaUnits[_i].isDeployed = 0, $saveValid = 0>> - <</link>> - <</if>> - <br> - <</if>> - <</capture>> + <<includeDOM App.SecExp.deployUnitMenu($militiaUnits[_i], _i)>> <</for>> </div> </div> <div id="slaves" class="tab-content"> <div class="content"> <<for _i = 0; _i < _sL; _i++>> - <<capture _i>> - <<if $slaveUnits[_i].active == 1 && $slaveUnits[_i].troops > 0>> - <<= App.SecExp.getUnit("Slaves", _i).describe()>> <br> - <<if $slaveUnits[_i].isDeployed == 0 && App.SecExp.battle.deployableUnits() > 0>> - <<link "Deploy the unit" "attackOptions">> - <<set $slaveUnits[_i].isDeployed = 1, $saveValid = 0>> - <</link>> - <<else>> - <<link "Remove the unit" "attackOptions">> - <<set $slaveUnits[_i].isDeployed = 0, $saveValid = 0>> - <</link>> - <</if>> - <br> - <</if>> - <</capture>> + <<includeDOM App.SecExp.deployUnitMenu($slaveUnits[_i], _i)>> <</for>> </div> </div> <div id="mercs" class="tab-content"> <div class="content"> <<for _i = 0; _i < _meL; _i++>> - <<capture _i>> - <<if $mercUnits[_i].active == 1 && $mercUnits[_i].troops > 0>> - <<= App.SecExp.getUnit("Mercs", _i).describe()>> <br> - <<if $mercUnits[_i].isDeployed == 0 && App.SecExp.battle.deployableUnits() > 0>> - <<link "Deploy the unit" "attackOptions">> - <<set $mercUnits[_i].isDeployed = 1, $saveValid = 0>> - <</link>> - <<else>> - <<link "Remove the unit" "attackOptions">> - <<set $mercUnits[_i].isDeployed = 0, $saveValid = 0>> - <</link>> - <</if>> - <br> - <</if>> - <</capture>> + <<includeDOM App.SecExp.deployUnitMenu($mercUnits[_i], _i)>> <</for>> </div> </div> \ No newline at end of file diff --git a/src/Mods/SecExp/attackReport.tw b/src/Mods/SecExp/attackReport.tw index b6195f5eeff..f815fce001f 100644 --- a/src/Mods/SecExp/attackReport.tw +++ b/src/Mods/SecExp/attackReport.tw @@ -9,7 +9,7 @@ <<if $enemyLosses > $attackTroops>> <<set $enemyLosses = $attackTroops>> <</if>> -<<set $totalKills += $enemyLosses>> +<<set $SecExp.core.totalKills += $enemyLosses>> <<set $losses = Math.trunc($losses)>> <<set _loot = 0>> @@ -52,7 +52,7 @@ <<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>> - Our defense forces, <<print num(Math.trunc(App.SecExp.conflict.troopCount()))>> strong, clashed with them + 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">> @@ -114,7 +114,7 @@ <<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>> - Our defense forces, <<print num(Math.trunc(App.SecExp.conflict.troopCount()))>> strong, clashed with them + 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">> @@ -176,7 +176,7 @@ <<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>> - Our defense forces, <<print num(Math.trunc(App.SecExp.conflict.troopCount()))>> strong, clashed with them + 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">> @@ -238,7 +238,7 @@ <<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>> - Our defense forces, <<print num(Math.trunc(App.SecExp.conflict.troopCount()))>> strong, clashed with them + 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">> @@ -348,7 +348,7 @@ @@.yellowgreen;wealth worthy of the mightiest warlord.@@ <<set _loot += 20000 * _majorBattleMod>> <</if>> - <<if $SecExp.edicts.defense.privilege.mercSoldier == 1 && App.SecExp.conflict.deployedUnits('mercs') >= 1>> + <<if $SecExp.edicts.defense.privilege.mercSoldier == 1 && App.SecExp.battle.deployedUnits('mercs') >= 1>> Part of the loot is distributed to your mercenaries. <<set _captives = Math.trunc(_captives * 0.6)>> <<set _loot = Math.trunc(_loot * 0.6)>> @@ -458,7 +458,7 @@ @@.yellowgreen;a great amount of cash.@@ <<set _loot += 10000 * _majorBattleMod>> <</if>> - <<if $SecExp.edicts.defense.privilege.mercSoldier == 1 && App.SecExp.conflict.deployedUnits('mercs') >= 1>> + <<if $SecExp.edicts.defense.privilege.mercSoldier == 1 && App.SecExp.battle.deployedUnits('mercs') >= 1>> Part of the loot is distributed to your mercenaries. <<set _loot = Math.trunc(_loot * 0.6)>> <</if>> @@ -696,7 +696,7 @@ <<if $leadingTroops == "PC">> <<setPlayerPronouns>> You decided to personally lead the defense of your arcology. - <<if App.SecExp.conflict.deployedUnits('militia') >= 1>> + <<if App.SecExp.battle.deployedUnits('militia') >= 1>> <<if _oldRep <= 2500>> <<if _oldRep > 1000>> You're not particularly popular between the inhabitants of your arcology, so your presence does little to reassure the volunteers. @@ -733,7 +733,7 @@ <</if>> <</if>> <</if>> - <<if App.SecExp.conflict.deployedUnits('slaves') >= 1>> + <<if App.SecExp.battle.deployedUnits('slaves') >= 1>> <<if _oldAuth <= 2500>> <<if _oldAuth > 1000>> Your slave soldiers do not feel bound to you as much as they should, as your authority is far from absolute. @@ -766,7 +766,7 @@ <</if>> <</if>> <</if>> - <<if App.SecExp.conflict.deployedUnits('mercs') >= 1>> + <<if App.SecExp.battle.deployedUnits('mercs') >= 1>> <<set _mercLoyalty = App.SecExp.mercenaryAvgLoyalty()>> <<if _mercLoyalty <= 25>> <<if _mercLoyalty <= 10>> @@ -834,7 +834,7 @@ <<elseif $leadingTroops == "assistant">> <<setAssistantPronouns>> <<if $auto == 1>>$assistant.name<<else>>You<</if>> let your personal assistant lead the troops. - <<if App.SecExp.conflict.deployedUnits('mercs') >= 1 || App.SecExp.conflict.deployedUnits('militia') >= 1 || App.SecExp.conflict.deployedUnits('slaves') >= 1>> + <<if App.SecExp.battle.deployedUnits('mercs') >= 1 || App.SecExp.battle.deployedUnits('militia') >= 1 || App.SecExp.battle.deployedUnits('slaves') >= 1>> No soldier trusts a computer to be their commander, <<if _oldRep < 10000 && _oldAuth < 10000>> no algorithm can substitute experience, <<if $assistant.power == 0>>and as expected, <<else>>however, <</if>> @@ -856,7 +856,7 @@ <<elseif $leadingTroops == "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.conflict.deployedUnits('slaves') >= 1>> + <<if App.SecExp.battle.deployedUnits('slaves') >= 1>> <<if _S.Bodyguard.devotion < -20>> $His low devotion has a negative impact on the morale of your slave soldiers. <<elseif _S.Bodyguard.devotion > 51>> @@ -864,61 +864,61 @@ <</if>> <</if>> <<if _oldRep < 10000 && _oldAuth < 10000 || _S.Bodyguard.prestige < 1>> - <<if App.SecExp.conflict.deployedUnits('militia') >= 1>> - Your volunteers <<if App.SecExp.conflict.deployedUnits('slaves') >= 1>>however<</if>> are not enthusiastic to have a slave as a - <<if $SF.Toggle && $SF.Active >= 1 && App.SecExp.conflict.deployedUnits('mercs') == 1 && $SFIntervention>> + <<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>> commander, and neither are your mercenaries or your soldiers. - <<elseif App.SecExp.conflict.deployedUnits('mercs') >= 1>> + <<elseif App.SecExp.battle.deployedUnits('mercs') >= 1>> commander, and neither are your mercenaries. <<elseif $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> commander, and neither are your soldiers. <<else>> commander. <</if>> - <<elseif $SF.Toggle && $SF.Active >= 1 && App.SecExp.conflict.deployedUnits('mercs') == 1 && $SFIntervention>> - Your mercenaries and soldiers <<if App.SecExp.conflict.deployedUnits('slaves') >= 1>>however<</if>> are not enthusiastic to have a slave as a commander. - <<elseif App.SecExp.conflict.deployedUnits('mercs') >= 1>> - Your mercenaries <<if App.SecExp.conflict.deployedUnits('slaves') >= 1>>however<</if>> are not enthusiastic to have a slave as a commander. + <<elseif $SF.Toggle && $SF.Active >= 1 && App.SecExp.battle.deployedUnits('mercs') == 1 && $SFIntervention>> + 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>> - Your soldiers <<if App.SecExp.conflict.deployedUnits('slaves') >= 1>>however<</if>> are not enthusiastic to have a slave as a commander. + 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.conflict.deployedUnits('militia') >= 1>> + <<if App.SecExp.battle.deployedUnits('militia') >= 1>> Your - <<if App.SecExp.conflict.deployedUnits('mercs') == 1 && $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> + <<if App.SecExp.battle.deployedUnits('mercs') == 1 && $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> 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.conflict.deployedUnits('mercs') >= 1>> + <<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>> 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.conflict.deployedUnits('mercs') == 1 && $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> + <<elseif App.SecExp.battle.deployedUnits('mercs') == 1 && $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> Your mercenaries and soldiers are delighted to have such a prestigious individual as their commander, almost forgetting $he is a slave. - <<elseif App.SecExp.conflict.deployedUnits('mercs') >= 1>> + <<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>> Your soldiers are delighted to have such a prestigious individual as their commander, almost forgetting $he is a slave. <</if>> <<else>> - <<if App.SecExp.conflict.deployedUnits('militia') >= 1>> - Your volunteers <<if App.SecExp.conflict.deployedUnits('slaves') >= 1>>however<</if>> are not enthusiastic to have a slave as a - <<if App.SecExp.conflict.deployedUnits('mercs') == 1 && $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> + <<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>> commander, and neither are your mercenaries and soldiers, but they trust you enough not to question your decision. - <<elseif App.SecExp.conflict.deployedUnits('mercs') >= 1>> + <<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>> 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.conflict.deployedUnits('mercs') == 1 && $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> - Your mercenaries and soldiers <<if App.SecExp.conflict.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.conflict.deployedUnits('mercs') >= 1>> - Your mercenaries <<if App.SecExp.conflict.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 && $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> + 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>> - Your soldiers <<if App.SecExp.conflict.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. + 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>> <<set _BGCareerGivesBonus = setup.bodyguardCareers.includes(_S.Bodyguard.career) || setup.HGCareers.includes(_S.Bodyguard.career) || setup.secExCombatPrestige.includes(_S.Bodyguard.prestigeDesc)>> @@ -994,7 +994,7 @@ <<elseif $leadingTroops == "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.conflict.deployedUnits('slaves') >= 1>> + <<if App.SecExp.battle.deployedUnits('slaves') >= 1>> <<if _S.HeadGirl.devotion < -20>> $His low devotion has a negative impact on the morale of your slave soldiers. <<elseif _S.HeadGirl.devotion > 51>> @@ -1002,61 +1002,61 @@ <</if>> <</if>> <<if _oldRep < 10000 && _oldAuth < 10000 || _S.HeadGirl.prestige < 1>> - <<if App.SecExp.conflict.deployedUnits('militia') >= 1>> - Your volunteers <<if App.SecExp.conflict.deployedUnits('slaves') >= 1>>however<</if>> are not enthusiastic to have a slave as a - <<if App.SecExp.conflict.deployedUnits('mercs') == 1 && $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> + <<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>> commander, and neither are your mercenaries or your soldiers. - <<elseif App.SecExp.conflict.deployedUnits('mercs') >= 1>> + <<elseif App.SecExp.battle.deployedUnits('mercs') >= 1>> commander, and neither are your mercenaries. <<elseif $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> commander, and neither are your soldiers. <<else>> commander. <</if>> - <<elseif App.SecExp.conflict.deployedUnits('mercs') == 1 && $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> - Your mercenaries and soldiers <<if App.SecExp.conflict.deployedUnits('slaves') >= 1>>however<</if>> are not enthusiastic to have a slave as a commander. - <<elseif App.SecExp.conflict.deployedUnits('mercs') >= 1>> - Your mercenaries <<if App.SecExp.conflict.deployedUnits('slaves') >= 1>>however<</if>> are not enthusiastic to have a slave as a commander. + <<elseif App.SecExp.battle.deployedUnits('mercs') == 1 && $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> + 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>> - Your soldiers <<if App.SecExp.conflict.deployedUnits('slaves') >= 1>>however<</if>> are not enthusiastic to have a slave as a commander. + 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.conflict.deployedUnits('militia') >= 1>> + <<if App.SecExp.battle.deployedUnits('militia') >= 1>> Your - <<if App.SecExp.conflict.deployedUnits('mercs') == 1 && $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> + <<if App.SecExp.battle.deployedUnits('mercs') == 1 && $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> 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.conflict.deployedUnits('mercs') >= 1>> + <<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>> 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.conflict.deployedUnits('mercs') == 1 && $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> + <<elseif App.SecExp.battle.deployedUnits('mercs') == 1 && $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> Your mercenaries and soldiers are delighted to have such a prestigious individual as their commander, almost forgetting $he is a slave. - <<elseif App.SecExp.conflict.deployedUnits('mercs') >= 1>> + <<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>> Your soldiers are delighted to have such a prestigious individual as their commander, almost forgetting $he is a slave. <</if>> <<else>> - <<if App.SecExp.conflict.deployedUnits('militia') >= 1>> - Your volunteers <<if App.SecExp.conflict.deployedUnits('slaves') >= 1>>however<</if>> are not enthusiastic to have a slave as a - <<if App.SecExp.conflict.deployedUnits('mercs') == 1 && $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> + <<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>> commander, and neither are your mercenaries and soldiers, but they trust you enough not to question your decision. - <<elseif App.SecExp.conflict.deployedUnits('mercs') >= 1>> + <<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>> 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.conflict.deployedUnits('mercs') == 1 && $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> - Your mercenaries and soldiers <<if App.SecExp.conflict.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.conflict.deployedUnits('mercs') >= 1>> - Your mercenaries <<if App.SecExp.conflict.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 && $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> + 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>> - Your soldiers <<if App.SecExp.conflict.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. + 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>> <<if (setup.bodyguardCareers.includes(_S.HeadGirl.career) || setup.HGCareers.includes(_S.HeadGirl.career) || setup.secExCombatPrestige.includes(_S.HeadGirl.prestigeDesc)) && _S.HeadGirl.intelligence+_S.HeadGirl.intelligenceImplant > 95>> @@ -1130,30 +1130,30 @@ <<elseif $leadingTroops == "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.conflict.deployedUnits('militia') >= 1>> + <<if App.SecExp.battle.deployedUnits('militia') >= 1>> Your volunteers are honored and pleased that one of their own is leading the defense force of the city. <</if>> - <<if App.SecExp.conflict.deployedUnits('slaves') >= 1>> - Your slaves<<if App.SecExp.conflict.deployedUnits('militia') >= 1>>, however,<</if>> are not thrilled by the news. + <<if App.SecExp.battle.deployedUnits('slaves') >= 1>> + Your slaves<<if App.SecExp.battle.deployedUnits('militia') >= 1>>, however,<</if>> are not thrilled by the news. <</if>> <<elseif $arcologies[0].FSPaternalist != "unset">> - <<if App.SecExp.conflict.deployedUnits('militia') >= 1>> + <<if App.SecExp.battle.deployedUnits('militia') >= 1>> Your volunteers are honored and pleased that one of their own is leading the defense force of the city. <</if>> - <<if App.SecExp.conflict.deployedUnits('slaves') >= 1>> + <<if App.SecExp.battle.deployedUnits('slaves') >= 1>> Thanks to your paternalistic society, your slave soldiers trust your chosen citizen to treat them as more than cannon fodder. <</if>> <<elseif $arcologies[0].FSDegradationist != "unset">> - <<if App.SecExp.conflict.deployedUnits('militia') >= 1>> + <<if App.SecExp.battle.deployedUnits('militia') >= 1>> Your volunteers are honored and pleased that one of their own is leading the defense force of the city. <</if>> - <<if App.SecExp.conflict.deployedUnits('slaves') >= 1>> - Because of your degradationist society,<<if App.SecExp.conflict.deployedUnits('militia') >= 1>> however,<</if>> your slave soldiers are deeply distrustful of the new leader. + <<if App.SecExp.battle.deployedUnits('slaves') >= 1>> + Because of your degradationist society,<<if App.SecExp.battle.deployedUnits('militia') >= 1>> however,<</if>> your slave soldiers are deeply distrustful of the new leader. <</if>> <</if>> - <<if $arcologies[0].FSRomanRevivalist != "unset" && App.SecExp.conflict.deployedUnits('mercs') >= 1>> + <<if $arcologies[0].FSRomanRevivalist != "unset" && App.SecExp.battle.deployedUnits('mercs') >= 1>> Since you decided to revive old Rome, many of your citizens took on themselves to educate themselves in martial matters, because of this your mercenaries feel safe enough in the hands of one of your volunteers. - <<elseif App.SecExp.conflict.deployedUnits('mercs') >= 1>> + <<elseif App.SecExp.battle.deployedUnits('mercs') >= 1>> You 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>> @@ -1166,18 +1166,18 @@ <</if>> <<elseif $leadingTroops == "mercenary">> <<if $auto == 1>>$assistant.name<<else>>You<</if>> decided to appoint one of your mercenary officers as the commander. - <<if App.SecExp.conflict.deployedUnits('mercs') >= 1>> + <<if App.SecExp.battle.deployedUnits('mercs') >= 1>> Your mercenaries of course approve of your decision. <</if>> <<if $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> Your soldiers feel more confident going into battle with an experienced commander. <</if>> - <<if $arcologies[0].FSRomanRevivalist != "unset" && App.SecExp.conflict.deployedUnits('militia') >= 1>> + <<if $arcologies[0].FSRomanRevivalist != "unset" && App.SecExp.battle.deployedUnits('militia') >= 1>> Since you decided to revive old Rome, your volunteers are more willing to trust one of your mercenaries as their leader. - <<elseif App.SecExp.conflict.deployedUnits('militia') >= 1>> + <<elseif App.SecExp.battle.deployedUnits('militia') >= 1>> Your volunteers are not enthusiastic at the prospect of being commanded around by a gun for hire. <</if>> - <<if $arcologies[0].FSDegradationist != "unset" && App.SecExp.conflict.deployedUnits('slaves') >= 1>> + <<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>> @@ -1185,18 +1185,18 @@ <</if>> <<elseif $leadingTroops == "colonel">> <<if $auto == 1>>$assistant.name<<else>>You<</if>> decided to appoint The Colonel as the commander. - <<if App.SecExp.conflict.deployedUnits('mercs') >= 1>> + <<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>> The soldiers of $SF.Lower obviously approved of your decision. <</if>> - <<if $arcologies[0].FSRomanRevivalist != "unset" && App.SecExp.conflict.deployedUnits('militia') >= 1>> + <<if $arcologies[0].FSRomanRevivalist != "unset" && App.SecExp.battle.deployedUnits('militia') >= 1>> Since you decided to revive old Rome, your volunteers are more willing to trust one of your soldiers as their leader. - <<elseif App.SecExp.conflict.deployedUnits('militia') >= 1>> + <<elseif App.SecExp.battle.deployedUnits('militia') >= 1>> Your volunteers are not enthusiastic at the prospect of being commanded around by an old style military officer. <</if>> - <<if $arcologies[0].FSDegradationist != "unset" && App.SecExp.conflict.deployedUnits('slaves') >= 1>> + <<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>> @@ -1434,14 +1434,13 @@ 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>> - In the end <<if $leadingTroops == "PC">>you were<<else>>your commander was<</if>> @@.green;able to successfully employ <<print $chosenTactic>> tactics,@@ greatly enhancing the efficiency of your army. + @@.green;able to successfully employ <<print $chosenTactic>> tactics,@@ greatly enhancing <<else>> - In the end <<if $leadingTroops == "PC">>you were<<else>>your commander was<</if>> @@.red;not able to effectively employ <<print $chosenTactic>> tactics,@@ greatly affecting the efficiency of your army. + @@.red;not able to effectively employ <<print $chosenTactic>> tactics,@@ greatly affecting <</if>> - <br> - <br> - <<include "unitsBattleReport">> + the efficiency of your army. <br> <<include "unitsBattleReport">> <<if $SF.Toggle && $SF.Active >= 1 && ($SF.Squad.Firebase >= 7 || $SF.Squad.GunS >= 1 || $SF.Squad.Satellite >= 5 || $SF.Squad.GiantRobot >= 6 || $SF.Squad.MissileSilo >= 1)>> /* SF upgrades effects */ <br><br> @@ -1528,4 +1527,4 @@ <</for>> <<for _i = 0; _i < $mercUnits.length; _i++>> <<set $mercUnits[_i].isDeployed = 0>> -<</for>> +<</for>> \ No newline at end of file diff --git a/src/Mods/SecExp/authorityReport.tw b/src/Mods/SecExp/authorityReport.tw index dffcf96963e..5c1ebf747b5 100644 --- a/src/Mods/SecExp/authorityReport.tw +++ b/src/Mods/SecExp/authorityReport.tw @@ -48,13 +48,13 @@ Your authority is <<set _authGrowth += (10 * random(2,8))>> <</if>> -<<if $SecExp.security.cap >= 90>> +<<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.security.cap >= 70>> +<<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.security.cap >= 50>> +<<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>> @@ -144,14 +144,15 @@ Your authority is <<set _authGrowth -= $arcologies[0].FSNull>> <</if>> -<<if $SecExp.buildings.propHub.miniTruth >= 1>> - Your authenticity department works tirelessly to impose your authority in all of the arcology. - <<set _authGrowth += (15 * $SecExp.buildings.propHub.miniTruth)>> -<</if>> - -<<if $SecExp.buildings.propHub.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.secretService)>> +<<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>> @@ -174,4 +175,4 @@ This week <<if $SecExp.settings.rebellion.enabled == 1>> <br><br> <<include "rebellionGenerator">> /* rebellions */ -<</if>> \ No newline at end of file +<</if>> diff --git a/src/Mods/SecExp/buildings/propagandaHub.tw b/src/Mods/SecExp/buildings/propagandaHub.tw index dcdfa4c780e..3319a4ce0a7 100644 --- a/src/Mods/SecExp/buildings/propagandaHub.tw +++ b/src/Mods/SecExp/buildings/propagandaHub.tw @@ -29,9 +29,9 @@ The propaganda hub is a surprisingly inconspicuous building, dimly lit from the <br>//Providing them with an office will help boost your chosen campaign. This also stacks with the campaign boost edict.// <</if>> /* classic propaganda */ -<br><br><<if $SecExp.buildings.propHub.campaign == 0>> +<br><br><<if $SecExp.buildings.propHub.upgrades.campaign == 0>> <<link "Set up a propaganda campaign" "propagandaHub">> - <<set $SecExp.buildings.propHub.campaign += 1>> + <<set $SecExp.buildings.propHub.upgrades.campaign += 1>> <<run cashX(forceNeg(5000*$upgradeMultiplierArcology*_HistoryDiscount), "capEx")>> <<set $SecExp.buildings.propHub.focus = "social engineering">> <</link>> @@ -85,14 +85,14 @@ The propaganda hub is a surprisingly inconspicuous building, dimly lit from the convincing more citizens to enter the militia. <</if>> <br> - <<if $SecExp.buildings.propHub.campaign < 5>> + <<if $SecExp.buildings.propHub.upgrades.campaign < 5>> <<link "Invest more resources in the propaganda machine" "propagandaHub">> - <<run cashX(forceNeg(5000 * $upgradeMultiplierArcology * ($SecExp.buildings.propHub.campaign + 1) * _HistoryDiscount*$HackingSkillMultiplier), "capEx")>> - <<set $SecExp.buildings.propHub.campaign += 1>> + <<run cashX(forceNeg(5000 * $upgradeMultiplierArcology * ($SecExp.buildings.propHub.upgrades.campaign + 1) * _HistoryDiscount*$HackingSkillMultiplier), "capEx")>> + <<set $SecExp.buildings.propHub.upgrades.campaign += 1>> <<= IncreasePCSkills('hacking', 0.5)>> <</link>> <br>Invest more resources into the project to increase its effectiveness. - <br>//Costs <<print cashFormat(Math.trunc(5000 * $upgradeMultiplierArcology * ($SecExp.buildings.propHub.campaign + 1) * _HistoryDiscount*$HackingSkillMultiplier))>>. Will provide more of the focused resource each week but increase reputation upkeep.// + <br>//Costs <<print cashFormat(Math.trunc(5000 * $upgradeMultiplierArcology * ($SecExp.buildings.propHub.upgrades.campaign + 1) * _HistoryDiscount*$HackingSkillMultiplier))>>. Will provide more of the focused resource each week but increase reputation upkeep.// <<else>> You upgraded your propaganda machine to its limits. <</if>> @@ -102,46 +102,46 @@ The propaganda hub is a surprisingly inconspicuous building, dimly lit from the <br> /* ministry of truth */ -<<if $SecExp.buildings.propHub.miniTruth == 0>> +<<if $SecExp.buildings.propHub.upgrades.miniTruth == 0>> <<link "Set up the authenticity department" "propagandaHub">> - <<set $SecExp.buildings.propHub.miniTruth += 1>> + <<set $SecExp.buildings.propHub.upgrades.miniTruth += 1>> <<run cashX(forceNeg(5000*$upgradeMultiplierArcology*_HistoryDiscount), "capEx")>> <</link>> <br>Set up a department tasked with guaranteeing the authenticity of all information available in the arcology. Of course if reality is against what is best for the arcology, then it should be redacted as well. <br>//Costs <<print cashFormat(Math.trunc(5000*$upgradeMultiplierArcology * _HistoryDiscount))>>. Will provide authority and unlock special upgrades, but will increase upkeep.// <<else>> - <<if $SecExp.buildings.propHub.miniTruth < 5>> + <<if $SecExp.buildings.propHub.upgrades.miniTruth < 5>> <<link "Enlarge the authenticity department" "propagandaHub">> - <<run cashX(forceNeg(5000*$upgradeMultiplierArcology * ($SecExp.buildings.propHub.miniTruth + 1) * _HistoryDiscount), "capEx")>> - <<set $SecExp.buildings.propHub.miniTruth += 1>> + <<run cashX(forceNeg(5000*$upgradeMultiplierArcology * ($SecExp.buildings.propHub.upgrades.miniTruth + 1) * _HistoryDiscount), "capEx")>> + <<set $SecExp.buildings.propHub.upgrades.miniTruth += 1>> <</link>> <br>Invest more resources into the project to increase its effectiveness. - <br>//Costs <<print cashFormat(Math.trunc(5000 * $upgradeMultiplierArcology * ($SecExp.buildings.propHub.miniTruth + 1) * _HistoryDiscount))>>. Will provide more authority each week, but increases upkeep.// + <br>//Costs <<print cashFormat(Math.trunc(5000 * $upgradeMultiplierArcology * ($SecExp.buildings.propHub.upgrades.miniTruth + 1) * _HistoryDiscount))>>. Will provide more authority each week, but increases upkeep.// <<else>> You have upgraded the authenticity department to its maximum. <</if>> <br> - <<if $SecExp.buildings.propHub.fakeNews == 0>> + <<if $SecExp.buildings.propHub.upgrades.fakeNews == 0>> <<link "Install a news generator" "propagandaHub">> - <<set $SecExp.buildings.propHub.fakeNews = 1>> + <<set $SecExp.buildings.propHub.upgrades.fakeNews = 1>> <<run cashX(forceNeg(10000*$upgradeMultiplierArcology*_HistoryDiscount), "capEx")>> <</link>> <br>Install an automatic news generator, able to fabricate thousands of plausible sounding news every day. <br>//Costs <<print cashFormat(Math.trunc(10000 * $upgradeMultiplierArcology * _HistoryDiscount))>>. The authenticity dept. now provides a small amount of reputation as well as authority, but increases upkeep.// <<else>> - You have installed an automatic news generator. [[Remove news generator|propagandaHub][$SecExp.buildings.propHub.fakeNews = 0]] + You have installed an automatic news generator. [[Remove news generator|propagandaHub][$SecExp.buildings.propHub.upgrades.fakeNews = 0]] <</if>> <br> - <<if $SecExp.buildings.propHub.controlLeaks == 0>> + <<if $SecExp.buildings.propHub.upgrades.controlLeaks == 0>> <<link "Institute controlled leaks protocols" "propagandaHub">> - <<set $SecExp.buildings.propHub.controlLeaks = 1>> + <<set $SecExp.buildings.propHub.upgrades.controlLeaks = 1>> <<run cashX(forceNeg(10000*$upgradeMultiplierArcology*_HistoryDiscount*$HackingSkillMultiplier), "capEx")>> <<= IncreasePCSkills('hacking', 1)>> <</link>> <br>Institute a system able to release erroneous, but plausible, information about your business, leading your competitors to prepared financial traps. <br>//Costs <<print cashFormat(Math.trunc(10000 * $upgradeMultiplierArcology * _HistoryDiscount*$HackingSkillMultiplier))>>. The authenticity dept. now slightly increases prosperity each week as well as authority, but increases upkeep.// <<else>> - You have instituted controlled leaks protocols, able to create fabricated leaks of sensible information. [[Shut down leak protocols|propagandaHub][$SecExp.buildings.propHub.controlLeaks = 0]] + You have instituted controlled leaks protocols, able to create fabricated leaks of sensible information. [[Shut down leak protocols|propagandaHub][$SecExp.buildings.propHub.upgrades.controlLeaks = 0]] <</if>> <</if>> @@ -149,30 +149,30 @@ The propaganda hub is a surprisingly inconspicuous building, dimly lit from the <br> /* secret police */ -<<if $SecExp.buildings.propHub.secretService == 0>> +<<if $SecExp.buildings.propHub.upgrades.secretService == 0>> <<link "Set up personal secret service" "propagandaHub">> - <<set $SecExp.buildings.propHub.secretService += 1>> + <<set $SecExp.buildings.propHub.upgrades.secretService += 1>> <<run cashX(forceNeg(10000*$upgradeMultiplierArcology*_HistoryDiscount), "capEx")>> <</link>> <br>Set up a department tasked with the protection of your person, as well as operations requiring a delicate approach. <br>//Costs <<print cashFormat(Math.trunc(10000*$upgradeMultiplierArcology * _HistoryDiscount))>>. Will provide authority and unlock special upgrades, but will increase upkeep.// <<else>> - <<if $SecExp.buildings.propHub.secretService < 5 && $rep >= ($SecExp.buildings.propHub.secretService * 1000) + 5000>> + <<if $SecExp.buildings.propHub.upgrades.secretService < 5 && $rep >= ($SecExp.buildings.propHub.upgrades.secretService * 1000) + 5000>> <<link "Expand the secret service" "propagandaHub">> - <<set $SecExp.buildings.propHub.secretService += 1>> - <<run cashX(forceNeg(5000*$upgradeMultiplierArcology * ($SecExp.buildings.propHub.secretService + 1) * _HistoryDiscount), "capEx")>> + <<set $SecExp.buildings.propHub.upgrades.secretService += 1>> + <<run cashX(forceNeg(5000*$upgradeMultiplierArcology * ($SecExp.buildings.propHub.upgrades.secretService + 1) * _HistoryDiscount), "capEx")>> <</link>> <br>Invest more resources into the project to increase its effectiveness. - <br>//Costs <<print cashFormat(Math.trunc(5000 * $upgradeMultiplierArcology * ($SecExp.buildings.propHub.secretService + 1) * _HistoryDiscount))>>. Will provide more authority each week, but increases upkeep.// - <<elseif $SecExp.buildings.propHub.secretService < 5>> + <br>//Costs <<print cashFormat(Math.trunc(5000 * $upgradeMultiplierArcology * ($SecExp.buildings.propHub.upgrades.secretService + 1) * _HistoryDiscount))>>. Will provide more authority each week, but increases upkeep.// + <<elseif $SecExp.buildings.propHub.upgrades.secretService < 5>> You lack the reputation to further expand operations. <<else>> You have upgraded the secret service to its maximum. <</if>> <br> - <<if $SecExp.buildings.propHub.blackOps == 0>> + <<if $SecExp.buildings.propHub.upgrades.blackOps == 0>> <<link "Create a black ops team" "propagandaHub">> - <<set $SecExp.buildings.propHub.blackOps = 1>> + <<set $SecExp.buildings.propHub.upgrades.blackOps = 1>> <<run cashX(forceNeg(10000*$upgradeMultiplierArcology*_HistoryDiscount), "capEx")>> <</link>> <br>Create a black ops team, ready to carry out corporate sabotage and sensitive operations to further your goals. @@ -181,15 +181,15 @@ The propaganda hub is a surprisingly inconspicuous building, dimly lit from the You have created a black ops team. <</if>> <br> - <<if $SecExp.buildings.propHub.marketInfiltration == 0>> + <<if $SecExp.buildings.propHub.upgrades.marketInfiltration == 0>> <<link "Infiltrate" "propagandaHub">> - <<set $SecExp.buildings.propHub.marketInfiltration = 1>> + <<set $SecExp.buildings.propHub.upgrades.marketInfiltration = 1>> <<run cashX(forceNeg(10000*$upgradeMultiplierArcology*_HistoryDiscount), "capEx")>> <</link>> the black market in order to manipulate it. <br>//Costs <<print cashFormat(Math.trunc(10000 * $upgradeMultiplierArcology * _HistoryDiscount))>>. The secret services now provides cash as well as authority each week, but will increase crime growth.// <<else>> - You have infiltrated the black market and are now in partial control of it. [[Withdraw from the black market|propagandaHub][$SecExp.buildings.propHub.marketInfiltration = 0]] + You have infiltrated the black market and are now in partial control of it. [[Withdraw from the black market|propagandaHub][$SecExp.buildings.propHub.upgrades.marketInfiltration = 0]] <</if>> <</if>> diff --git a/src/Mods/SecExp/buildings/secBarracks.tw b/src/Mods/SecExp/buildings/secBarracks.tw index a6aea39b054..8796e362e40 100644 --- a/src/Mods/SecExp/buildings/secBarracks.tw +++ b/src/Mods/SecExp/buildings/secBarracks.tw @@ -5,76 +5,76 @@ The Barracks <hr>__Upgrades__<br> While this a sore sight for many citizens of $arcologies[0].name, the barracks stand proud before you. -<<if $SecExp.buildings.barracks.upgrades.size == 0>> +<<if $SecExp.buildings.barracks.size == 0>> The building is relatively small and able to house a limited number of units. -<<elseif $SecExp.buildings.barracks.upgrades.size == 1>> +<<elseif $SecExp.buildings.barracks.size == 1>> The building has been expanded and can now house more units comfortably. -<<elseif $SecExp.buildings.barracks.upgrades.size == 2>> +<<elseif $SecExp.buildings.barracks.size == 2>> The building has been further expanded and can now house a high number of units. -<<elseif $SecExp.buildings.barracks.upgrades.size == 3>> +<<elseif $SecExp.buildings.barracks.size == 3>> The building has been greatly expanded and can now house a sizable military. -<<elseif $SecExp.buildings.barracks.upgrades.size == 4>> +<<elseif $SecExp.buildings.barracks.size == 4>> The building has been greatly expanded and can now house a small army. <<else>> The building has been greatly expanded and can now house an army worthy of an old world nation. <</if>> -<<if $SecExp.buildings.barracks.upgrades.luxury == 0>> +<<if $SecExp.buildings.barracks.luxury == 0>> The barracks are a spartan building, with little to make the day to day lives of your soldiers pleasant. -<<elseif $SecExp.buildings.barracks.upgrades.luxury == 1>> +<<elseif $SecExp.buildings.barracks.luxury == 1>> The barracks have been made more comfortable by installing high tech furniture. -<<elseif $SecExp.buildings.barracks.upgrades.luxury == 2>> +<<elseif $SecExp.buildings.barracks.luxury == 2>> The barracks have been made more comfortable by installing high tech furniture and advanced kitchen facilities. -<<elseif $SecExp.buildings.barracks.upgrades.luxury == 3>> +<<elseif $SecExp.buildings.barracks.luxury == 3>> The barracks have been made more comfortable by installing high tech furniture and advanced kitchen facilities. It also provides free access to any digital media. <<else>> The barracks have been made more comfortable by installing high tech furniture and advanced kitchen facilities. It also provides free access to any digital media. A small limited-access brothel has been added to the structure. <</if>> -<<if $SecExp.buildings.barracks.upgrades.training == 0>> +<<if $SecExp.buildings.barracks.training == 0>> The building lacks the space and the equipment to train your units. -<<elseif $SecExp.buildings.barracks.upgrades.training == 1>> +<<elseif $SecExp.buildings.barracks.training == 1>> A training facility has been set up, allowing your units to better their skills with time. <<else>> The training facility has been filled with specialized equipment and skilled trainers. <</if>> -<<if $SecExp.buildings.barracks.upgrades.loyaltyMod == 0>> +<<if $SecExp.buildings.barracks.loyaltyMod == 0>> The barracks lack an indoctrination facility. -<<elseif $SecExp.buildings.barracks.upgrades.loyaltyMod == 1>> +<<elseif $SecExp.buildings.barracks.loyaltyMod == 1>> The barracks have been fitted with an indoctrination facility. <<else>> The barracks have been fitted with an advanced indoctrination facility. <</if>> <br><br> -<<if $SecExp.buildings.barracks.upgrades.size < 5>> +<<if $SecExp.buildings.barracks.size < 5>> <<link "Increase the size of the barracks" "secBarracks">> - <<run cashX(forceNeg(Math.trunc((5000 * ($SecExp.buildings.barracks.upgrades.size + 1))*$upgradeMultiplierArcology)), "capEx")>> - <<set $SecExp.buildings.barracks.upgrades.size += 1>> + <<run cashX(forceNeg(Math.trunc((5000 * ($SecExp.buildings.barracks.size + 1))*$upgradeMultiplierArcology)), "capEx")>> + <<set $SecExp.buildings.barracks.size += 1>> <</link>> - <br>//Costs <<print cashFormat((5000 * ($SecExp.buildings.barracks.upgrades.size + 1))*$upgradeMultiplierArcology)>> and will increase the maximum number of units by 2.// + <br>//Costs <<print cashFormat((5000 * ($SecExp.buildings.barracks.size + 1))*$upgradeMultiplierArcology)>> and will increase the maximum number of units by 2.// <<else>> You've expanded the barracks to their maximum. <</if>> <br> -<<if $SecExp.buildings.barracks.upgrades.luxury == 0>> +<<if $SecExp.buildings.barracks.luxury == 0>> <<link "Increase the quality of life of your soldiers by installing high tech furniture and appliances." "secBarracks">> - <<set $SecExp.buildings.barracks.upgrades.luxury += 1>> + <<set $SecExp.buildings.barracks.luxury += 1>> <<run cashX(forceNeg(Math.trunc(5000*$upgradeMultiplierTrade)), "capEx")>> <</link>> <br>//Costs <<print cashFormat(Math.trunc(5000*$upgradeMultiplierTrade))>> and will provide a 5% bonus to morale.// -<<elseif $SecExp.buildings.barracks.upgrades.luxury == 1>> +<<elseif $SecExp.buildings.barracks.luxury == 1>> <<link "Further increase the quality of life of your soldiers by installing advanced kitchen equipment and hiring skilled chefs." "secBarracks">> - <<set $SecExp.buildings.barracks.upgrades.luxury += 1>> + <<set $SecExp.buildings.barracks.luxury += 1>> <<run cashX(forceNeg(Math.trunc(10000*$upgradeMultiplierTrade)), "capEx")>> <</link>> <br>//Costs <<print cashFormat(Math.trunc(10000*$upgradeMultiplierTrade))>> and will provide a 5% bonus to morale, for a total of +10%.// -<<elseif $SecExp.buildings.barracks.upgrades.luxury == 2>> +<<elseif $SecExp.buildings.barracks.luxury == 2>> <<link "Further increase the quality of life of your soldiers by providing high speed, free access to digital media" "secBarracks">> - <<set $SecExp.buildings.barracks.upgrades.luxury += 1>> + <<set $SecExp.buildings.barracks.luxury += 1>> <<run cashX(forceNeg(Math.trunc(10000*$upgradeMultiplierTrade)), "capEx")>> <</link>> <br>//Costs <<print cashFormat(Math.trunc(10000*$upgradeMultiplierTrade))>> and will provide a 5% bonus to morale, for a total of +15%.// -<<elseif $SecExp.buildings.barracks.upgrades.luxury == 3>> +<<elseif $SecExp.buildings.barracks.luxury == 3>> <<link "Further increase the quality of life of your soldiers by adding and staffing an exclusive brothel to the structure" "secBarracks">> - <<set $SecExp.buildings.barracks.upgrades.luxury += 1>> + <<set $SecExp.buildings.barracks.luxury += 1>> <<run cashX(forceNeg(Math.trunc(15000*$upgradeMultiplierArcology)), "capEx")>> <</link>> <br>//Costs <<print cashFormat(Math.trunc(15000*$upgradeMultiplierArcology))>> and will provide a 5% bonus to morale, for a total of +20%.// @@ -82,15 +82,15 @@ While this a sore sight for many citizens of $arcologies[0].name, the barracks s You've made life in your barracks as good as it can get. <</if>> <br> -<<if $SecExp.buildings.barracks.upgrades.training == 0>> +<<if $SecExp.buildings.barracks.training == 0>> <<link "Add a training facility to the barracks" "secBarracks">> - <<set $SecExp.buildings.barracks.upgrades.training += 1>> + <<set $SecExp.buildings.barracks.training += 1>> <<run cashX(forceNeg(Math.trunc(10000*$upgradeMultiplierArcology)), "capEx")>> <</link>> <br>//Costs <<print cashFormat(Math.trunc(10000*$upgradeMultiplierArcology))>> and will allow units to accumulate some experience each week.// -<<elseif $SecExp.buildings.barracks.upgrades.training == 1>> +<<elseif $SecExp.buildings.barracks.training == 1>> <<link "Improve the training facility with modern equipment and skilled personnel" "secBarracks">> - <<set $SecExp.buildings.barracks.upgrades.training += 1>> + <<set $SecExp.buildings.barracks.training += 1>> <<run cashX(forceNeg(Math.trunc(20000*$upgradeMultiplierTrade)), "capEx")>> <</link>> <br>//Costs <<print cashFormat(Math.trunc(20000*$upgradeMultiplierTrade))>> and will allow units to accumulate experience each week.// @@ -98,15 +98,15 @@ While this a sore sight for many citizens of $arcologies[0].name, the barracks s You have improved the training facility to the limit. <</if>> <br> -<<if $SecExp.buildings.barracks.upgrades.loyaltyMod == 0>> +<<if $SecExp.buildings.barracks.loyaltyMod == 0>> <<link "Add an indoctrination facility to the barracks" "secBarracks">> - <<set $SecExp.buildings.barracks.upgrades.loyaltyMod += 1>> + <<set $SecExp.buildings.barracks.loyaltyMod += 1>> <<run cashX(forceNeg(Math.trunc(10000*$upgradeMultiplierArcology)), "capEx")>> <</link>> <br>//Costs <<print cashFormat(Math.trunc(10000*$upgradeMultiplierArcology))>> and will slowly raise loyalty of all units// -<<elseif $SecExp.buildings.barracks.upgrades.loyaltyMod == 1>> +<<elseif $SecExp.buildings.barracks.loyaltyMod == 1>> <<link "Improve the indoctrination facility with advanced equipment and skilled personnel" "secBarracks">> - <<set $SecExp.buildings.barracks.upgrades.loyaltyMod += 1>> + <<set $SecExp.buildings.barracks.loyaltyMod += 1>> <<run cashX(forceNeg(Math.trunc(20000*$upgradeMultiplierTrade)), "capEx")>> <</link>> <br>//Costs <<print cashFormat(Math.trunc(20000*$upgradeMultiplierTrade))>> and will raise loyalty of all units faster.// @@ -115,7 +115,7 @@ While this a sore sight for many citizens of $arcologies[0].name, the barracks s <</if>> <hr>__Units__<br> -Your current maximum number of units is <<print App.SecExp.battle.maxUnits()>> (<<print num($secBots.maxTroops+(50*App.SecExp.battle.maxUnits()))>> troops), <<print App.SecExp.battle.activeUnits()>> (<<print num($secBots.maxTroops+App.SecExp.Manpower.employedOverall)>> troops) are active and <<print (2 * App.SecExp.battle.deploySpeed())>> units can be deployed. <<if $SecExp.buildings.barracks.upgrades.luxury > 0>>The barracks provides <<print $SecExp.buildings.barracks.upgrades.luxury * 5>>% bonus morale when battle occurs.<</if>> <<if $SecExp.buildings.barracks.upgrades.training > 0>>The training facility will increase the effectiveness of your units with time.<</if>> +Your current maximum number of units is <<print App.SecExp.battle.maxUnits()>> (<<print num($secBots.maxTroops+(50*App.SecExp.battle.maxUnits()))>> troops), <<print App.SecExp.battle.activeUnits()>> (<<print num($secBots.maxTroops+App.SecExp.Manpower.employedOverall)>> troops) are active and <<print (2 * App.SecExp.battle.deploySpeed())>> units can be deployed. <<if $SecExp.buildings.barracks.luxury > 0>>The barracks provides <<print $SecExp.buildings.barracks.luxury * 5>>% bonus morale when battle occurs.<</if>> <<if $SecExp.buildings.barracks.training > 0>>The training facility will increase the effectiveness of your units with time.<</if>> <br> <<set _options = new App.UI.OptionsGroup()>> <<run _options.addOption("Unit descriptions are", "unitDescriptions", $SecExp.settings) @@ -124,9 +124,6 @@ Your current maximum number of units is <<print App.SecExp.battle.maxUnits()>> ( <<if App.SecExp.battle.activeUnits() >= App.SecExp.battle.maxUnits()>> <br>You have reached the maximum number of units. You'll have to disband one or enlarge the barracks before forming a new unit. <</if>> -<<if $arcologies[0].FSRomanRevivalist != "unset" || $arcologies[0].FSChineseRevivalist != "unset" || $arcologies[0].FSArabianRevivalist != "unset" || $arcologies[0].FSEdoRevivalist != "unset" || $arcologies[0].FSEgyptianRevivalist != "unset" || $arcologies[0].FSAztecRevivalist != "unset">> -<</if>> - <<replenishAllUnits>> <<if $arcologyUpgrade.drones === 0>> @@ -156,13 +153,12 @@ Your current maximum number of units is <<print App.SecExp.battle.maxUnits()>> ( <<set _secBotsCost = 500, _secBotsUpgradeCost = 250>> <<= App.SecExp.getUnit("Bots").describe()>> <br> <<if $secBots.active == 1>> - <<if $secBots.maxTroops > $secBots.troops>> <br> + <<if $secBots.maxTroops > $secBots.troops>> <<link "Replenish the unit" "secBarracks">> <<run cashX(forceNeg(($secBots.maxTroops - $secBots.troops) * _secBotsCost), "securityExpansion")>> <<set $secBots.troops = $secBots.maxTroops>> <</link>> <</if>> - <br> <<if $secBots.maxTroops < 80>> <br> <<link "Improve the digital control matrix" "secBarracks">> <<set $secBots.maxTroops += 10>> @@ -195,13 +191,6 @@ Your current maximum number of units is <<print App.SecExp.battle.maxUnits()>> ( <<if $SecExp.settings.showStats == 1>> <br><<= _App.SecExp.getUnit("Bots").printStats()>> <</if>> - <<if $secBots.troops < $secBots.maxTroops>> - | - <<link "Replenish the unit" "secBarracks">> - <<run cashX(forceNeg(($secBots.maxTroops - $secBots.troops) * _secBotsCost), "securityExpansion")>> - <<set $secBots.troops = $secBots.maxTroops>> - <</link>> - <</if>> <<else>> <<link "Rebuild the unit" "secBarracks">> <<run cashX(forceNeg(($secBots.maxTroops - $secBots.troops) * _secBotsCost), "securityExpansion")>> @@ -214,7 +203,7 @@ Your current maximum number of units is <<print App.SecExp.battle.maxUnits()>> ( <div id="Slaves" class="tab-content"> <div class="content"> You are free to organize your menial slaves into fighting units. Currently you have <<print num($menials)>> slaves available, while <<print num(App.SecExp.Manpower.employedSlave)>> are already employed as soldiers. During all your battles you lost a total of <<print num($slavesTotalCasualties)>>. - <<if $menials > 0 && App.SecExp.battle.activeUnits() < App.SecExp.battle.maxUnits()>> + <<if $menials > 0 && App.SecExp.battle.activeUnits() < App.SecExp.battle.maxUnits()>> <br> <<link "Form a new unit" "secBarracks">> <<set $slaveUnits.push(App.SecExp.generateUnit("slaves"))>> <</link>> @@ -238,6 +227,7 @@ Your current maximum number of units is <<print App.SecExp.battle.maxUnits()>> ( //Bulk transactions may require offering a premium.// <</if>> <</if>> + <br> <<set _sL = $slaveUnits.length>> <<for _i = 0; _i < _sL; _i++>> <<capture _i>> @@ -264,9 +254,7 @@ Your current maximum number of units is <<print App.SecExp.battle.maxUnits()>> ( <</if>> <</link>> <</if>> - <<if $SecExp.settings.showStats == 1>> - <br><<= App.SecExp.getUnit("Slaves", _i).printStats()>> - <</if>> + <<if $SecExp.settings.showStats == 1>> <<= App.SecExp.getUnit("Slaves", _i).printStats()>> <</if>> <<includeDOM App.SecExp.humanUnitUpgradeList($slaveUnits[_i])>> <<else>> <<if $menials > 0>> @@ -302,11 +290,12 @@ Your current maximum number of units is <<print App.SecExp.battle.maxUnits()>> ( With the adoption of a militarized society, your available manpower has swelled to be approximately 15% of the arcology's citizens population. <</if>> Your current total manpower is <<print num(App.SecExp.Manpower.totalMilitia)>>, of which <<print num(App.SecExp.Manpower.employedMilitia)>> is in active duty. You lost in total <<print num($militiaTotalCasualties)>> citizens, leaving you with <<print num($militiaFreeManpower)>> available citizens. - <<if $militiaFreeManpower > 0 && App.SecExp.battle.activeUnits() < App.SecExp.battle.maxUnits()>> <br><br> + <<if $militiaFreeManpower > 0 && App.SecExp.battle.activeUnits() < App.SecExp.battle.maxUnits()>> <br> <<link "Form a new unit" "secBarracks">> <<set $militiaUnits.push(App.SecExp.generateUnit("militia"))>> <</link>> <</if>> + <br> <<set _mL = $militiaUnits.length>> <<for _i = 0; _i < _mL; _i++>> <<capture _i>> @@ -333,9 +322,7 @@ Your current maximum number of units is <<print App.SecExp.battle.maxUnits()>> ( <</if>> <</link>> <</if>> - <<if $SecExp.settings.showStats == 1>> - <br><<= App.SecExp.getUnit("Militia", _i).printStats()>> - <</if>> + <<if $SecExp.settings.showStats == 1>> <<= App.SecExp.getUnit("Militia", _i).printStats()>> <</if>> <<includeDOM App.SecExp.humanUnitUpgradeList($militiaUnits[_i])>> <<else>> <<if $militiaFreeManpower > 0>> @@ -362,11 +349,12 @@ Your current maximum number of units is <<print App.SecExp.battle.maxUnits()>> ( <div class="content"> With the installation of a mercenary company in the arcology, many other are attracted to your free city, hoping to land a contract with you. You are able to organize them in units to use in the defense of the arcology. Excluding the defense force you set up, there are <<print num(App.SecExp.Manpower.totalMerc)>> mercenaries in your arcology, of which <<print num(App.SecExp.Manpower.employedMerc)>> actively employed and <<print num($mercFreeManpower)>> not yet under contract. In total <<print num($mercTotalCasualties)>> mercenaries have died defending your arcology. - <<if $mercFreeManpower > 0 && App.SecExp.battle.activeUnits() < App.SecExp.battle.maxUnits()>> <br><br> + <<if $mercFreeManpower > 0 && App.SecExp.battle.activeUnits() < App.SecExp.battle.maxUnits()>> <br> <<link "Form a new unit" "secBarracks">> <<set $mercUnits.push(App.SecExp.generateUnit("mercs"))>> <</link>> <</if>> + <br> <<set _meL = $mercUnits.length>> <<for _i = 0; _i < _meL; _i++>> <<capture _i>> @@ -393,27 +381,8 @@ Your current maximum number of units is <<print App.SecExp.battle.maxUnits()>> ( <</if>> <</link>> <</if>> - <<if $SecExp.settings.showStats == 1>> - <br><<= App.SecExp.getUnit("Mercs", _i).printStats()>> - <</if>> + <<if $SecExp.settings.showStats == 1>> <<= App.SecExp.getUnit("Mercs", _i).printStats()>> <</if>> <<includeDOM App.SecExp.humanUnitUpgradeList($mercUnits[_i])>> - - <<if $mercUnits[_i].troops < $mercUnits[_i].maxTroops && $mercFreeManpower > 0>> - | - <<link "Replenish unit" "secBarracks">> - <<if $mercFreeManpower >= $mercUnits[_i].maxTroops - $mercUnits[_i].troops>> - <<set $mercFreeManpower -= $mercUnits[_i].maxTroops - $mercUnits[_i].troops>> - <<set _expLoss = ($mercUnits[_i].maxTroops - $mercUnits[_i].troops) / $mercUnits[_i].troops>> - <<set $mercUnits[_i].training -= $mercUnits[_i].training * _expLoss>> - <<set $mercUnits[_i].troops = $mercUnits[_i].maxTroops>> - <<else>> - <<set _expLoss = $mercFreeManpower / $mercUnits[_i].troops>> - <<set $mercUnits[_i].training -= $mercUnits[_i].training * _expLoss>> - <<set $mercUnits[_i].troops += $mercFreeManpower>> - <<set $mercFreeManpower = 0>> - <</if>> - <</link>> - <</if>> <<else>> <<if $mercFreeManpower > 0>> | @@ -434,4 +403,4 @@ Your current maximum number of units is <<print App.SecExp.battle.maxUnits()>> ( <</capture>> <</for>> </div> -</div> +</div> \ No newline at end of file diff --git a/src/Mods/SecExp/buildings/securityHQ.tw b/src/Mods/SecExp/buildings/securityHQ.tw index 36f6fc97eb0..e4c576cf854 100644 --- a/src/Mods/SecExp/buildings/securityHQ.tw +++ b/src/Mods/SecExp/buildings/securityHQ.tw @@ -200,14 +200,14 @@ You have <span id="secHel"> <<print num($secMenials)>> </span> slaves working in <br><br> /* security level and upgrades */ -Your security level (@@.deepskyblue;$SecExp.security.cap@@) -<<if $SecExp.security.cap <= 20>> +Your security level (@@.deepskyblue;$SecExp.core.security@@) +<<if $SecExp.core.security <= 20>> is dangerously low. -<<elseif $SecExp.security.cap <= 40>> +<<elseif $SecExp.core.security <= 40>> is low. -<<elseif $SecExp.security.cap <= 60>> +<<elseif $SecExp.core.security <= 60>> is decent. -<<elseif $SecExp.security.cap <= 80>> +<<elseif $SecExp.core.security <= 80>> is good. <<else>> is great. @@ -439,4 +439,4 @@ Considering the current upgrades the maximum level of crime is <<print App.SecEx <</if>> <<else>> <br>You lack the authority to access more advanced upgrades. -<</if>> \ No newline at end of file +<</if>> diff --git a/src/Mods/SecExp/js/Unit.js b/src/Mods/SecExp/js/Unit.js index 59d4b73464d..29128bd9999 100644 --- a/src/Mods/SecExp/js/Unit.js +++ b/src/Mods/SecExp/js/Unit.js @@ -1,13 +1,13 @@ -/** Creates the requested unit object. - * @param {string} [type] the unit type to be created. -*/ +/** Reports changes to the supplied unit's loyalty. + * @param {object} [input] the unit type to be checked. + */ App.SecExp.humanUnitLoyaltyChanges = function(input) { let loyaltyChange = 0, el = document.createElement("div"); el.append(`${input.platoonName}: `); - if (V.SecExp.buildings.barracks.upgrades.loyaltyMod >= 1) { + if (V.SecExp.buildings.barracks && V.SecExp.buildings.barracks.loyaltyMod >= 1) { el.append("is periodically sent to the indoctrination facility in the barracks for thought correction therapy."); - loyaltyChange += 2 * V.SecExp.buildings.barracks.upgrades.loyaltyMod; + loyaltyChange += 2 * V.SecExp.buildings.barracks.loyaltyMod; } if (input.commissars >= 1) { el.append("The commissars attached to the unit carefully monitor the officers and grunts for signs of insubordination."); @@ -21,7 +21,7 @@ App.SecExp.humanUnitLoyaltyChanges = function(input) { } else if (input.platoonName.contains('mercenary')) { el.append("The mercenaries greatly appreciate the generous wage given to them for their service. After all coin is the fastest way to reach their hearts."); } - loyaltyChange += random(5,10); + loyaltyChange += random(5, 10); } else if (V.SecExp.edicts.defense.soldierWages === 1) { if (input.platoonName.contains('slave')) { el.append("The slaves appreciate the wage given to them for their service as soldiers, despite it being just adequate. Occasions to earn money for a slave are scarce after all."); @@ -30,7 +30,7 @@ App.SecExp.humanUnitLoyaltyChanges = function(input) { } else if (input.platoonName.contains('mercenary')) { el.append("The mercenaries do not appreciate the barely adequate wage given to them for their service. Still their professionalism keeps them determined to finish their contract."); } - loyaltyChange += random(-5,5); + loyaltyChange += random(-5, 5); } else { if (input.platoonName.contains('slave')) { el.append("The slaves do not appreciate the low wage given to them for their service as soldiers, but occasions to earn money for a slave are scarce, so they're not too affected by it."); @@ -39,21 +39,21 @@ App.SecExp.humanUnitLoyaltyChanges = function(input) { } else if (input.platoonName.contains('mercenary')) { el.append("The mercenaries do not appreciate the low wage given to them for their service. Their skill would be better served by a better contract and this world does not lack demand for guns for hire."); } - loyaltyChange -= random(5,10); + loyaltyChange -= random(5, 10); } if (input.platoonName.contains('slave') && V.SecExp.edicts.defense.privilege.slaveSoldier) { el.append("Allowing them to hold material possessions earns you their devotion and loyalty."); - loyaltyChange += random(1,2); + loyaltyChange += random(1, 2); } if (input.platoonName.contains('citizens') && V.SecExp.edicts.defense.privilege.militiaSoldier) { el.append("Allowing them to avoid rent payment for their military service earns you their happiness and loyalty."); - loyaltyChange += random(1,2); + loyaltyChange += random(1, 2); } if (input.platoonName.contains('mercenary') && V.SecExp.edicts.defense.privilege.mercSoldier) { el.append("Allowing them to keep part of the loot gained from your enemies earns you their trust and loyalty."); - loyaltyChange += random(1,2); + loyaltyChange += random(1, 2); } - + el.append("This week, the loyalty of this unit "); if (loyaltyChange > 0) { App.UI.DOM.appendNewElement("span", el, "increased.", "green"); @@ -62,27 +62,46 @@ App.SecExp.humanUnitLoyaltyChanges = function(input) { } else { App.UI.DOM.appendNewElement("span", el, "decreased.", "red"); } - input.loyalty = Math.clamp(input.loyalty + loyaltyChange,0,100); - if (input.training < 100 && V.SecExp.buildings.barracks.upgrades.training >= 1) { + input.loyalty = Math.clamp(input.loyalty + loyaltyChange, 0, 100); + if (input.training < 100 && V.SecExp.buildings && V.SecExp.buildings.barracks.training >= 1) { let options = document.createElement("div"); options.append("The unit is able to make use of the training facilities to better prepare its soldiers, slowly increasing their experience level."); el.append(options); - input.training += random(2,4) * 1.5 * V.SecExp.buildings.barracks.upgrades.training; + input.training += random(2, 4) * 1.5 * V.SecExp.buildings.barracks.training; } - + return el; -} +}; +/** Repairs unit if needed. + * @param {object} [input] the unit to be checked. + */ +App.SecExp.fixBrokenUnit = function(input) { + input.SF = input.SF || 0; + if (!jsDef(input.ID)) { + input.ID = App.SecExp.generateUnitID(); + } + input.cyber = input.cyber || 0; + input.commissars = input.commissars || 0; + input.maxTroops = Math.min(30, input.maxTroops); + Math.clamp(input.troops, 0, input.maxTroops); +}; + +/** Creates the requested unit object. + * @param {string} [type] the unit type to be created. + */ App.SecExp.generateUnit = function(type) { - let newUnit = {ID: -1, equip: 0, active: 1, isDeployed: 0, maxTroops:30, troops: 30}; + let newUnit = { + ID: -1, equip: 0, active: 1, isDeployed: 0, maxTroops:30, troops: 30 + }; if (type !== "bots") { Object.assign(newUnit, { training: 0, cyber: 0, medics: 0, SF: 0, commissars: 0, battlesFought: 0, - loyalty: jsRandom(40, 60), + loyalty: jsRandom(40, 60), ID: App.SecExp.generateUnitID() }); - + if (type === "slaves") { newUnit.platoonName = ordinalSuffix(++V.createdSlavesUnits) + " slave platoon"; newUnit.troops = Math.min(newUnit.maxTroops, V.menials); @@ -93,25 +112,61 @@ App.SecExp.generateUnit = function(type) { V.militiaFreeManpower -= newUnit.troops; } else if (type === "mercs") { newUnit.platoonName = ordinalSuffix(++V.createdMercUnits) + " mercenary platoon"; - newUnit.troops = Math.min(newUnit.maxTroops, V.mercFreeManpower); + newUnit.troops = Math.min(newUnit.maxTroops, V.mercFreeManpower); V.mercFreeManpower -= newUnit.troops; } } return newUnit; }; +/** Display's the deploy menu for the unit. + * @param {object} [input] the unit to be checked. + * @param {number} count + */ +App.SecExp.deployUnitMenu = function(input, count = 0) { + let el = document.createElement("div"), options = document.createElement("div"); + + if (input.active === 1 && input.troops > 0) { + if (!jsDef(input.platoonName)) { + $(el).append(App.SecExp.getUnit("Bots").describe()); + } else if (input.platoonName.contains('slave')) { + $(el).append(App.SecExp.getUnit("Slaves", count).describe()); + } else if (input.platoonName.contains('citizens')) { + $(el).append(App.SecExp.getUnit("Militia", count).describe()); + } else if (input.platoonName.contains('mercenary')) { + $(el).append(App.SecExp.getUnit("Mercs", count).describe()); + } + options = document.createElement("div"); + if (input.isDeployed === 0 && App.SecExp.battle.deployableUnits() > 0) { + options.append(App.UI.DOM.link("Deploy the unit", () => { + input.isDeployed = 1; V.saveValid = 0; + }, + [], passage() + )); + } else { + options.append(App.UI.DOM.link("Remove the unit", () => { + input.isDeployed = 0; V.saveValid = 0; + }, + [], passage() + )); + } + } + el.append(options); + return el; +}; + /** Prints a list of upgrades that can be applied to the passed human unit. * @param {object} [input] the human unit to be checked. -*/ + */ App.SecExp.humanUnitUpgradeList = function(input) { - const equipUpgradeCost = 250; let options, el = options = document.createElement("div"); - - options = document.createElement("div"); + const equipUpgradeCost = 250; + let el = document.createElement("div"), options = document.createElement("div"); + if (input.maxTroops < 50) { options.append(`For ${cashFormat(5000 + 10 * equipUpgradeCost * (input.equip + input.commissars + input.cyber + input.SF))} provide this unit's `); options.append(App.UI.DOM.link("officers with intensive training", () => { - input.maxTroops += 10, - cashX(-(5000 + 10 * equipUpgradeCost * (input.equip + input.commissars + input.cyber + input.SF)), "securityExpansion"); + input.maxTroops += 10, + cashX(-(5000 + 10 * equipUpgradeCost * (input.equip + input.commissars + input.cyber + input.SF)), "securityExpansion"); }, [], passage() )); @@ -120,13 +175,13 @@ App.SecExp.humanUnitUpgradeList = function(input) { options.append(`Your officers reached their peak. Further training will have little impact on the number of troops they can effectively lead.`); } el.append(options); - + options = document.createElement("div"); if (input.equip < 3) { options.append(`For ${cashFormat(equipUpgradeCost * input.maxTroops + 1000)} invest in `); options.append(App.UI.DOM.link("better equipment", () => { - input.equip++, - cashX(-(equipUpgradeCost * input.maxTroops + 1000), "securityExpansion"); + input.equip++, + cashX(-(equipUpgradeCost * input.maxTroops + 1000), "securityExpansion"); }, [], passage() )); @@ -140,8 +195,8 @@ App.SecExp.humanUnitUpgradeList = function(input) { if (input.commissars === 0) { options.append(`For ${cashFormat(equipUpgradeCost * input.maxTroops + 1000)} attach `); options.append(App.UI.DOM.link("commissars", () => { - input.commissars++, - cashX(-(equipUpgradeCost * input.maxTroops + 1000), "securityExpansion"); + input.commissars++, + cashX(-(equipUpgradeCost * input.maxTroops + 1000), "securityExpansion"); }, [], passage() )); @@ -149,8 +204,8 @@ App.SecExp.humanUnitUpgradeList = function(input) { } else if (input.commissars < 2) { options.append(`For ${cashFormat(equipUpgradeCost * input.maxTroops + 1000)} attach `); options.append(App.UI.DOM.link("commissars", () => { - input.commissars++, - cashX(-(equipUpgradeCost * input.maxTroops + 1000), "securityExpansion"); + input.commissars++, + cashX(-(equipUpgradeCost * input.maxTroops + 1000), "securityExpansion"); }, [], passage() )); @@ -164,12 +219,12 @@ App.SecExp.humanUnitUpgradeList = function(input) { el.append(options); options = document.createElement("div"); - if (V.prostheticsUpgrade >= 2 || V.researchLab.advCombatPLimb == 1) { + if (V.prostheticsUpgrade >= 2 || V.researchLab.advCombatPLimb === 1) { if (input.cyber === 0) { options.append(`For ${cashFormat(equipUpgradeCost * input.maxTroops + 1000)} `); options.append(App.UI.DOM.link("augment all soldiers of the unit", () => { - input.cyber++, - cashX(-(equipUpgradeCost * input.maxTroops + 2000), "securityExpansion"); + input.cyber++, + cashX(-(equipUpgradeCost * input.maxTroops + 2000), "securityExpansion"); }, [], passage() )); @@ -184,8 +239,8 @@ App.SecExp.humanUnitUpgradeList = function(input) { if (input.medics === 0) { options.append(`For ${cashFormat(equipUpgradeCost * input.maxTroops + 1000)} `); options.append(App.UI.DOM.link("attach trained medics to the unit", () => { - input.medics++, - cashX(-(equipUpgradeCost * input.maxTroops + 1000), "securityExpansion"); + input.medics++, + cashX(-(equipUpgradeCost * input.maxTroops + 1000), "securityExpansion"); }, [], passage() )); @@ -197,18 +252,18 @@ App.SecExp.humanUnitUpgradeList = function(input) { if (V.SF.Toggle && V.SF.Active >= 1) { options = document.createElement("div"); - + if (input.SF === 0) { options.append(`For ${cashFormat(equipUpgradeCost * input.maxTroops + 5000)} `); options.append(App.UI.DOM.link("attach Special Force advisors", () => { - input.SF++, - cashX(-(equipUpgradeCost * input.maxTroops + 5000), "securityExpansion"); + input.SF++, + cashX(-(equipUpgradeCost * input.maxTroops + 5000), "securityExpansion"); }, [], passage() )); options.append(' which will slightly increase the base stats of the unit.'); } else { - options.append('The unit has attached advisors from ${V.SF.Lower} that will help the squad remain tactically aware and active.'); + options.append(`The unit has attached advisors from ${V.SF.Lower} that will help the squad remain tactically aware and active.`); } el.append(options); } @@ -657,7 +712,6 @@ App.SecExp.HumanUnit = class SecExpHumanUnit extends App.SecExp.Unit { printStats() { let r = []; - r.push(`<br>`); r.push(`<br>${this._descType} base attack: ${this._baseUnit.attack} (After modifiers: ${Math.trunc(this.attack)})`); r.push(`<br>${this._descType} base defense: ${this._baseUnit.defense} (After modifiers: ${Math.trunc(this.defense)})`); if (this._data.equip > 0) { @@ -676,8 +730,8 @@ App.SecExp.HumanUnit = class SecExpHumanUnit extends App.SecExp.Unit { r.push(`<br>Special Force advisors bonus: +20%`); } r.push(`<br>${this._descType} base morale: ${this._baseUnit.morale} (After modifiers: ${this.morale})`); - if (V.SecExp.buildings.barracks.upgrades.luxury > 0) { - r.push(`<br>Barracks bonus: +${V.SecExp.buildings.barracks.upgrades.luxury * 5}%`); + if (jsDef(V.SecExp.buildings.barracks) && V.SecExp.buildings.barracks.luxury > 0) { + r.push(`<br>Barracks bonus: +${V.SecExp.buildings.barracks.luxury * 5}%`); } r.push(`<br>${this._descType} base hp: ${this._baseUnit.hp} (Total after modifiers for ${this._data.troops} troops: ${this.hp})`); if (this._data.medics > 0) { @@ -688,13 +742,11 @@ App.SecExp.HumanUnit = class SecExpHumanUnit extends App.SecExp.Unit { }; App.SecExp.troopsFromSF = function() { - if (V.slaveRebellion !== 1 || V.citizenRebellion !== 1) { - // attack: how many troops can we actually carry? + if (V.slaveRebellion !== 1 || V.citizenRebellion !== 1) { // attack: how many troops can we actually carry? const transportMax = Math.trunc(125 * (V.SF.Squad.GunS + ((V.SF.Squad.AV + V.SF.Squad.TV)/2))); return Math.min(transportMax, V.SF.ArmySize); } else { - // rebellion: transport capabilities are irrelevant - return V.SF.ArmySize; + return V.SF.ArmySize; // rebellion: transport capabilities are irrelevant } }; @@ -766,3 +818,212 @@ App.SecExp.IrregularUnit = class SecExpEnemyUnit extends App.SecExp.Unit { return (this._baseUnit.hp - V.humanUpgrade.defense) * this._data.troops; } }; + +App.SecExp.describeUnit = (function() { + return description; + + /** + * @param {FC.SecExp.PlayerUnitData} input + * @param {string} unitType + */ + function description(input, unitType = '') { + let r = ``; const brief = V.SecExp.settings.unitDescriptions; + + if (unitType !== "Bots") { + r += `<br><strong>${input.platoonName}</strong>${!brief ? ``:`. `} `; + if (!brief) { + if (input.battlesFought > 1) { + r += `has participated in ${input.battlesFought} battles and is ready to face the enemy once more at your command. `; + } else if (input.battlesFought === 1) { + r += `is ready to face the enemy once more at your command. `; + } else { + r += `is ready to face the enemy in battle. `; + } + r += `<br>Its ${input.troops} men and women are `; + + if (unitType === "Militia") { + r += `all proud citizens of your arcology, willing to put their lives on the line to protect their home. `; + } else if (unitType === "Slaves") { + r += `slaves in your possession, tasked with the protection of their owner and their arcology. `; + } else if (unitType === "Mercs") { + r += `mercenaries contracted to defend the arcology against external threats. `; + } + } else { + r += `Battles fought: ${input.battlesFought}. `; + } + } else { + if (!brief) { + r += `<br>The drone unit is made up of ${input.troops} drones. All of which are assembled in an ordered formation in front of you, absolutely silent and ready to receive their orders.`; + } else { + r += `<br>Drone squad.`; + } + } + + if (!brief) { + if (input.troops < input.maxTroops) { + r += `The unit is not at its full strength of ${input.maxTroops} operatives. `; + } + } else { + r += `Unit size: ${input.troops}/${input.maxTroops}.`; + } + + if (!brief) { + if (unitType !== "Bots") { + if (input.equip === 0) { + r += `They are issued with simple, yet effective equipment: firearms, a few explosives and standard uniforms, nothing more. `; + } else if (input.equip === 1) { + r += `They are issued with good, modern equipment: firearms, explosives and a few specialized weapons like sniper rifles and machine guns. They also carry simple body armor. `; + } else if (input.equip === 2) { + r += `They are issued with excellent, high tech equipment: modern firearms, explosives, specialized weaponry and modern body armor. They are also issued with modern instruments like night vision and portable radars. `; + } else { + r += `They are equipped with the best the modern world has to offer: modern firearms, explosives, specialized weaponry, experimental railguns, adaptive body armor and high tech recon equipment. `; + } + } else { + if (input.equip === 0) { + r += `They are equipped with light weaponry, mainly anti-riot nonlethal weapons. Not particularly effective in battle. `; + } else if (input.equip === 1) { + r += `They are equipped with light firearms, not an overwhelming amount of firepower, but with their mobility good enough to be effective. `; + } else if (input.equip === 2) { + r += `They are equipped with powerful, modern firearms and simple armor mounted around their frames. They do not make for a pretty sight, but on the battlefield they are a dangerous weapon. `; + } else { + r += `They are equipped with high energy railguns and adaptive armor. They are a formidable force on the battlefield, even for experienced soldiers. `; + } + } + } else { + r += `Equipment quality: `; + if (input.equip === 0) { + r += `basic. `; + } else if (input.equip === 1) { + r += `average. `; + } else if (input.equip === 2) { + r += `high. `; + } else { + r += `advanced. `; + } + } + + if (unitType !== "Bots") { + if (!brief) { + if (input.training <= 33) { + r += `They lack the experience to be considered professionals, but `; + if (unitType === "Militia") { + r += `their eagerness to defend the arcology makes up for it. `; + } else if (unitType === "Slaves") { + r += `their eagerness to prove themselves makes up for it. `; + } else if (unitType === "Mercs") { + r += `they're trained more than enough to still be an effective unit. `; + } + } else if (input.training <= 66) { + r += `They have trained `; + if (input.battlesFought > 0) { + r += `and fought `; + } + r += `enough to be considered disciplined, professional soldiers, ready to face the battlefield. `; + } else { + r += `They are consummate veterans, with a wealth of experience and perfectly trained. On the battlefield they are a well oiled war machine capable of facing pretty much anything. `; + } + + if(input.loyalty < 10) { + r += `The unit is extremely disloyal. Careful monitoring of their activities and relationships should be implemented. `; + } else if (input.loyalty < 33) { + r += `Their loyalty is low. Careful monitoring of their activities and relationships is advised. `; + } else if (input.loyalty < 66) { + r += `Their loyalty is not as high as it can be, but they are not actively working against their arcology owner. `; + } else if (input.loyalty < 90) { + r += `Their loyalty is high and strong. The likelihood of this unit betraying the arcology is low to non-existent. `; + } else { + r += `The unit is fanatically loyal. They would prefer death over betrayal. `; + } + + if (input.cyber > 0) { + r += `The soldiers of the unit have been enhanced with numerous cyberaugmentations which greatly increase their raw power. `; + } + if (input.medics > 0) { + r += `The unit has a dedicated squad of medics that will follow them in battle. `; + } + if(V.SF.Toggle && V.SF.Active >= 1 && input.SF > 0) { + r += `The unit has "advisors" from ${V.SF.Lower} that will help the squad remain tactically aware and active. `; + } + } else { + r += `\nTraining: `; + if (input.training <= 33) { + r += `low. `; + } else if(input.training <= 66) { + r += `medium. `; + } else { + r += `high. `; + } + + r += `Loyalty: `; + if(input.loyalty < 10) { + r += `extremely disloyal. `; + } else if (input.loyalty < 33) { + r += `low. `; + } else if (input.loyalty < 66) { + r += `medium. `; + } else if (input.loyalty < 90) { + r += `high. `; + } else { + r += `fanatical. `; + } + + if (jsDef(input.cyber) && input.cyber > 0) { + r += `\nCyberaugmentations applied. `; + } + if (jsDef(input.medics) && input.medics > 0) { + r += `Medical squad attached. `; + } + if(V.SF.Toggle && V.SF.Active >= 1 && jsDef(input.SF) || input.SF > 0) { + r += `${App.SF.Caps()} "advisors" attached. `; + } + } + } + + if (!input.active) { + r += `<br>This unit has lost too many operatives `; + if (jsDef(input.battlesFought)) { + r += `in the ${input.battlesFought} it fought `; + } + r += `and can no longer be considered a unit at all.`; + } + return r; + } +})(); + +App.SecExp.mercenaryAvgLoyalty = function() { + return _.mean(V.mercUnits.filter((u) => u.active === 1).map((u) => u.loyalty)); +}; + +App.SecExp.Manpower = { + get totalMilitia() { + return this.employedMilitia + this.freeMilitia; + }, + + get employedMilitia() { + return V.militiaUnits.reduce((acc, cur) => acc + cur.troops, 0); + }, + + get freeMilitia() { + return V.militiaFreeManpower; + }, + + get employedSlave() { + return V.slaveUnits.reduce((acc, cur) => acc + cur.troops, 0); + }, + + get totalMerc() { + return this.employedMerc + this.freeMerc; + }, + + get employedMerc() { + return V.mercUnits.reduce((acc, cur) => acc + cur.troops, 0); + }, + + get freeMerc() { + return V.mercFreeManpower; + }, + + get employedOverall() { + return this.employedMerc + this.employedMilitia + this.employedSlave; + } +}; diff --git a/src/Mods/SecExp/js/buildingsJS.js b/src/Mods/SecExp/js/buildingsJS.js new file mode 100644 index 00000000000..32d5c7f8f19 --- /dev/null +++ b/src/Mods/SecExp/js/buildingsJS.js @@ -0,0 +1,395 @@ +/* +App.SecExp.weapManuUpgrade = function() { + if (!V.currentUpgrade.ID) { + return; + } + + let name, type, unit = 1, purpose; + switch(V.currentUpgrade.ID) { + case -3: + name = "advanced synthetic alloys"; type = "hp"; unit = 0; + break; + case -2: + name = "adaptive armored frames"; type = "defense"; unit = 0; + break; + case -1: + name = "dynamic battle aware AI"; type = "attack"; unit = 0; + break; + case 0: + name = "magnetic based ballistic weaponry"; type = "attack"; + break; + case 1: + name = "ceramo-metallic alloys"; type = "defense"; + break; + case 2: + name = "rapid action stimulants"; type = "hp"; + break; + case 3: + name = "fast response neural stimulant"; type = "morale"; + break; + case 4: + name = "universal cyber enhancements"; type = "attackAndDefense"; + break; + case 5: + name = "remote neural links"; type = "hpAndMorale"; + break; + case 6: + name = "combined training regimens with the special force"; type = "attackAndDefense"; + break; + case 7: + name = "a variant of the stimulant cocktail that the special force created"; type = "hpAndMorale"; + break; + case 8: + name = "a mesh network based off the custom network of the special force"; type = "all"; + break; + } + + switch(type) { + case "hp": + purpose = "survivability"; break; + case "defense": + purpose = "defensive capabilities"; break; + case "attack": + purpose = "attack power"; break; + case "morale": + purpose = "standing power"; break; + case "attackAndDefense": + purpose = "offensive and defensive effectiveness."; break; + case "hpAndMorale": + purpose = "morale and survivability"; break; + case "all": + purpose = "offensive,defensive effectiveness in addition to morale and survivability"; break; + } + + return { + name: name, type: type, unit: unit, purpose: purpose + }; +}; +*/ +App.SecExp.propHub = (function() { + return { + Init:Init, + BC:BC + }; + + function Init() { + V.SecExp.buildings.propHub = { + recuriterOffice: 0, + upgrades: { + campaign: 0, + miniTruth: 0, + fakeNews: 0, + controlLeaks: 0, + secretService: 0, + blackOps: 0, + marketInfiltration: 0, + }, + focus: "social engineering", + }; + } + + function BC() { + if (V.SecExp.buildings.pr === null) { + delete V.SecExp.buildings.pr; + } + if (V.SecExp.buildings.pr) { + V.SecExp.buildings.propHub = V.SecExp.buildings.pr; + delete V.SecExp.buildings.pr; + } + + if (V.SecExp.buildings.propHub) { + delete V.SecExp.buildings.propHub.active; + } + if (V.SecExp.buildings.propHub && Object.entries(V.SecExp.buildings.propHub).length === 0) { + delete V.SecExp.buildings.propHub; + } else if (V.propHub || (V.SecExp.buildings.propHub && Object.entries(V.SecExp.buildings.propHub).length > 0)){ + V.SecExp.buildings.propHub = V.SecExp.buildings.propHub || {}; + V.SecExp.buildings.propHub.upgrades = V.SecExp.buildings.propHub.upgrades || {}; + V.SecExp.buildings.propHub.recruiterOffice = V.SecExp.buildings.propHub.recruiterOffice || V.recuriterOffice || V.RecuriterOffice || 0; + + V.SecExp.buildings.propHub.upgrades.campaign = V.SecExp.buildings.propHub.upgrades.campaign || V.SecExp.buildings.propHub.campaign || V.propCampaign || 0; + delete V.SecExp.buildings.propHub.campaign; + V.SecExp.buildings.propHub.upgrades.miniTruth = V.SecExp.buildings.propHub.upgrades.miniTruth || V.SecExp.buildings.propHub.miniTruth || V.miniTruth || 0; + delete V.SecExp.buildings.propHub.miniTruth; + + V.SecExp.buildings.propHub.upgrades.secretService = V.SecExp.buildings.propHub.upgrades.secretService || V.SecExp.buildings.propHub.secretService || V.SecExp.buildings.propHub.SS || V.secretService || 0; + delete V.SecExp.buildings.propHub.secretService; + delete V.SecExp.buildings.propHub.SS; + + V.SecExp.buildings.propHub.focus = V.SecExp.buildings.propHub.focus || "social engineering"; + if (V.propFocus && V.propFocus !== "none") { + V.SecExp.buildings.propHub.focus = V.propFocus; + } + + const vars = ['fakeNews', 'controlLeaks', 'marketInfiltration', 'blackOps']; + for(let i = 0; i < vars.length; i++) { + if (jsDef(V[vars[i]]) && V[vars[i]] > 0) { + V.SecExp.buildings.propHub[vars[i]] = V[vars[i]]; + delete V[vars[i]]; + } else { + V.SecExp.buildings.propHub.upgrades[vars[i]] = V.SecExp.buildings.propHub.upgrades[vars[i]] || V.SecExp.buildings.propHub[vars[i]] || 0; + delete V.SecExp.buildings.propHub[vars[i]]; + } + } + } + } +})(); + +App.SecExp.barracks = (function() { + return { + Init:Init, + BC:BC + }; + + function Init() { + V.SecExp.buildings.barracks = { + size: 0, + luxury: 0, + training: 0, + loyaltyMod: 0 + }; + } + + function BC() { + if (V.SecExp.buildings.barracks) { + delete V.SecExp.buildings.barracks.active; + } + if (V.SecExp.buildings.barracks && Object.entries(V.SecExp.buildings.barracks === 0).length) { + delete V.SecExp.buildings.barracks; + } else if (V.secBarracks || (V.SecExp.buildings.barracks && Object.entries(V.SecExp.buildings.barracks).length > 0)){ + V.SecExp.buildings.barracks = V.SecExp.buildings.barracks || V.SecExp.buildings.barracks.upgrades || V.secBarracksUpgrades || {}; + V.SecExp.buildings.barracks.size = V.SecExp.buildings.barracks.size || 0; + V.SecExp.buildings.barracks.luxury = V.SecExp.buildings.barracks.luxury || 0; + V.SecExp.buildings.barracks.training = V.SecExp.buildings.barracks.training || 0; + V.SecExp.buildings.barracks.loyaltyMod = V.SecExp.buildings.barracks.loyaltyMod || 0; + } + } + +})(); +/* +App.SecExp.secHub = (function() { + return { + Init:Init, + BC:BC + }; + + function Init() { + V.SecExp.buildings.secHub = { + menials: 0, + coldstorage: 0, + upgrades: { + security: { + nanoCams: 0, + cyberBots: 0, + eyeScan: 0, + cryptoAnalyzer: 0, + }, + crime: { + autoTrial: 0, + autoArchive: 0, + worldProfiler: 0, + advForensic: 0, + }, + intel : { + sensors: 0, + radar: 0, + signalIntercept: 0, + }, + readiness: { + earlyWarn: 0, + rapidPlatforms: 0, + pathways: 0, + rapidVehicles: 0, + } + } + }; + } + + function BC() { + if (V.secHQ || (V.SecExp.buildings.secHub && Object.entries(V.SecExp.buildings.secHub).length > 0)){ + V.SecExp.buildings.secHub.menials = V.SecExp.buildings.secHub.menials || V.secMenials || V.secHelots || 0; + V.SecExp.buildings.secHub.coldstorage = V.SecExp.buildings.secHub.coldstorage || V.secUpgrades.coldstorage || 0; + delete V.secUpgrades.coldstorage; + + V.SecExp.buildings.secHub.upgrades = V.SecExp.buildings.secHub.upgrades || {}; + V.SecExp.buildings.secHub.upgrades.security = V.SecExp.buildings.secHub.upgrades.security || V.secUpgrades || {}; + V.SecExp.buildings.secHub.upgrades.crime = V.SecExp.buildings.secHub.upgrades.crime || V.crimeUpgrades || {}; + V.SecExp.buildings.secHub.upgrades.intel = V.SecExp.buildings.secHub.upgrades.intel || V.intelUpgrades || {}; + V.SecExp.buildings.secHub.upgrades.readiness = V.SecExp.buildings.secHub.upgrades.readiness || V.readinessUpgrades || {}; + + V.SecExp.buildings.secHub.upgrades.security.nanoCams = V.SecExp.buildings.secHub.upgrades.security.nanoCams || 0; + V.SecExp.buildings.secHub.upgrades.security.cyberBots = V.SecExp.buildings.secHub.upgrades.security.cyberBots || 0; + V.SecExp.buildings.secHub.upgrades.security.eyeScan = V.SecExp.buildings.secHub.upgrades.security.eyeScan || 0; + V.SecExp.buildings.secHub.upgrades.security.cryptoAnalyzer = V.SecExp.buildings.secHub.upgrades.security.cryptoAnalyzer || 0; + + V.SecExp.buildings.secHub.upgrades.crime.autoTrial = V.SecExp.buildings.secHub.upgrades.crime.autoTrial || 0; + V.SecExp.buildings.secHub.upgrades.crime.autoArchive = V.SecExp.buildings.secHub.upgrades.crime.autoArchive || 0; + V.SecExp.buildings.secHub.upgrades.crime.worldProfiler = V.SecExp.buildings.secHub.upgrades.crime.worldProfiler || 0; + V.SecExp.buildings.secHub.upgrades.crime.advForensic = V.SecExp.buildings.secHub.upgrades.crime.advForensic || 0; + + V.SecExp.buildings.secHub.upgrades.intel.sensors = V.SecExp.buildings.secHub.upgrades.intel.sensors || 0; + V.SecExp.buildings.secHub.upgrades.intel.radar = V.SecExp.buildings.secHub.upgrades.intel.radar || 0; + V.SecExp.buildings.secHub.upgrades.intel.signalIntercept = V.SecExp.buildings.secHub.upgrades.intel.signalIntercept || 0; + + V.SecExp.buildings.secHub.upgrades.readiness.earlyWarn = V.SecExp.buildings.secHub.upgrades.readiness.earlyWarn || 0; + V.SecExp.buildings.secHub.upgrades.readiness.rapidPlatforms = V.SecExp.buildings.secHub.upgrades.readiness.rapidPlatforms || 0; + V.SecExp.buildings.secHub.upgrades.readiness.pathways = V.SecExp.buildings.secHub.upgrades.readiness.pathways || 0; + V.SecExp.buildings.secHub.upgrades.readiness.rapidVehicles = V.SecExp.buildings.secHub.upgrades.readiness.rapidVehicles || 0; + } + } + +})(); + +App.SecExp.riotCenter = (function() { + return { + Init:Init, + BC:BC + }; + + function Init() { + V.SecExp.buildings.riotCenter = { + upgrades: { + freeMedia: 0, + rapidUnit: 0, + rapidUnitSpeed: 0, + }, + fort: { + reactor: 0, + waterway: 0, + assistant: 0, + }, + sentUnitCooldown: 0, + advancedRiotEquip: 0, + brainImplant: -1, + brainImplantProject: 0, + }; + } + + function BC() { + if (V.riotCenter || (V.SecExp.buildings.riotCenter && Object.entries(V.SecExp.buildings.riotCenter).length > 0)) { + V.SecExp.buildings.riotCenter = V.SecExp.buildings.riotCenter || {}; + V.SecExp.buildings.riotCenter.upgrades = V.SecExp.buildings.riotCenter.upgrades || V.riotUpgrades || {}; + V.SecExp.buildings.riotCenter.fort = V.SecExp.buildings.riotCenter.fort || V.fort || {}; + + V.SecExp.buildings.riotCenter.upgrades.freeMedia = V.SecExp.buildings.riotCenter.upgrades.freeMedia || 0; + V.SecExp.buildings.riotCenter.upgrades.rapidUnit = V.SecExp.buildings.riotCenter.upgrades.rapidUnit || 0; + V.SecExp.buildings.riotCenter.upgrades.rapidUnitSpeed = V.SecExp.buildings.riotCenter.upgrades.rapidUnitSpeed || 0; + + V.SecExp.buildings.riotCenter.fort.reactor = V.SecExp.buildings.riotCenter.fort.reactor || 0; + V.SecExp.buildings.riotCenter.fort.waterway = V.SecExp.buildings.riotCenter.fort.waterway || 0; + V.SecExp.buildings.riotCenter.fort.assistant = V.SecExp.buildings.riotCenter.fort.assistant || 0; + + V.SecExp.buildings.riotCenter.sentUnitCooldown = V.SecExp.buildings.riotCenter.sentUnitCooldown || V.sentUnitCooldown || 0; + V.SecExp.buildings.riotCenter.advancedRiotEquip = V.SecExp.buildings.riotCenter.advancedRiotEquip || V.advancedRiotEquip || 0; + V.SecExp.buildings.riotCenter.brainImplant = V.SecExp.buildings.riotCenter.brainImplant || V.brainImplant || -1; + V.SecExp.buildings.riotCenter.brainImplantProject = V.SecExp.buildings.riotCenter.brainImplantProject || V.brainImplantProject || 0; + } + } + +})(); + +App.SecExp.weapManu = (function() { + return { + Init:Init, + BC:BC + }; + + function Init() { + V.SecExp.buildings.weapManu = { + menials: 0, + productivity: 1, + lab: 1, + sellTo: { + citizen: 1, + raiders: 1, + oldWorld: 1, + FC: 1, + }, + upgrades: { + drone: { + attack: 0, + defense: 0, + hp: 0, + }, + human: { + attack: 0, + defense: 0, + hp: 0, + morale: 0, + }, + completed: [], + current: {time: 0} + } + }; + } + + function BC() { + if (V.weapManu || (V.SecExp.buildings.weapManu && Object.entries(V.SecExp.buildings.weapManu).length > 0)) { + V.SecExp.buildings.weapManu = V.SecExp.buildings.weapManu || {}; + V.SecExp.buildings.weapManu.menials = V.SecExp.buildings.weapManu.menials || V.weapMenials || V.weapHelots || 0; + + V.SecExp.buildings.weapManu.productivity = V.SecExp.buildings.weapManu.productivity || V.weapProductivity || 1; + V.SecExp.buildings.weapManu.lab = V.SecExp.buildings.weapManu.lab || V.weapLab || 1; + + V.SecExp.buildings.weapManu.sellTo = V.SecExp.buildings.weapManu.sellTo || V.sellTo || {}; + V.SecExp.buildings.weapManu.sellTo.citizen = V.SecExp.buildings.weapManu.sellTo.citizen || 1; + V.SecExp.buildings.weapManu.sellTo.raiders = V.SecExp.buildings.weapManu.sellTo.raiders || 1; + V.SecExp.buildings.weapManu.sellTo.oldWorld = V.SecExp.buildings.weapManu.sellTo.oldWorld || 1; + V.SecExp.buildings.weapManu.sellTo.FC = V.SecExp.buildings.weapManu.sellTo.FC || 1; + + V.SecExp.buildings.weapManu.upgrades = V.SecExp.buildings.weapManu.upgrades || {}; + V.SecExp.buildings.weapManu.upgrades.drone = V.SecExp.buildings.weapManu.upgrades.drone || V.droneUpgrades || {}; + V.SecExp.buildings.weapManu.upgrades.human = V.SecExp.buildings.weapManu.upgrades.human || V.humanUpgrade || {}; + V.SecExp.buildings.weapManu.upgrades.completed = V.SecExp.buildings.weapManu.upgrades.completed || V.completedUpgrades || []; + + V.SecExp.buildings.weapManu.upgrades.drone.attack = V.SecExp.buildings.weapManu.upgrades.drone.attack || 0; + V.SecExp.buildings.weapManu.upgrades.drone.defense = V.SecExp.buildings.weapManu.upgrades.drone.defense || 0; + V.SecExp.buildings.weapManu.upgrades.drone.hp = V.SecExp.buildings.weapManu.upgrades.drone.hp || 0; + + V.SecExp.buildings.weapManu.upgrades.human.attack = V.SecExp.buildings.weapManu.upgrades.human.attack || 0; + V.SecExp.buildings.weapManu.upgrades.human.defense = V.SecExp.buildings.weapManu.upgrades.human.defense || 0; + V.SecExp.buildings.weapManu.upgrades.human.hp = V.SecExp.buildings.weapManu.upgrades.human.hp || 0; + V.SecExp.buildings.weapManu.upgrades.human.morale = V.SecExp.buildings.weapManu.upgrades.human.morale || 0; + + V.SecExp.buildings.weapManu.upgrades.current = V.SecExp.buildings.weapManu.upgrades.current || {time: 0}; + if (V.currentUpgrade) { + V.SecExp.buildings.weapManu.upgrades.current = {ID: V.currentUpgrade.ID, time: V.currentUpgrade.time}; + } + } + } + +})(); + +App.SecExp.transportHub = (function() { + return { + Init:Init, + BC:BC + }; + + function Init() { + V.SecExp.buildings.transportHub = { + airport: 1, + security: 1 + }; + if (V.terrain !== "oceanic" && V.terrain !== "marine") { + V.SecExp.buildings.transportHub.railway = 1; + } else { + V.SecExp.buildings.transportHub.docks = 1; + } + } + + function BC() { + if (V.transportHub || (V.SecExp.buildings.transportHub && Object.entries(V.SecExp.buildings.transportHub).length > 0)) { + V.SecExp.buildings.transportHub = V.SecExp.buildings.transportHub || {}; + V.SecExp.buildings.transportHub.airport = V.SecExp.buildings.transportHub.airport || V.airport || 1; + V.SecExp.buildings.transportHub.security = V.SecExp.buildings.transportHub.security || V.hubSecurity || 1; + + if (V.terrain !== "oceanic" && V.terrain !== "marine") { + V.SecExp.buildings.transportHub.railway = V.SecExp.buildings.transportHub.railway || V.railway || 1; + } else { + V.SecExp.buildings.transportHub.docks = V.SecExp.buildings.transportHub.docks || V.docks || 1; + } + } + } + +})(); diff --git a/src/Mods/SecExp/js/secExp.js b/src/Mods/SecExp/js/secExp.js index baf01b7290e..c035d050103 100644 --- a/src/Mods/SecExp/js/secExp.js +++ b/src/Mods/SecExp/js/secExp.js @@ -1,5 +1,18 @@ -globalThis.SecExpBase = function() { - return new App.SecExp.SecurityExpansionState(); +App.SecExp.initTrade = function() { + if (V.SecExp.core.trade === 0 || !jsDef(V.SecExp.core.trade)) { + let init = jsRandom(20, 30); + if (V.terrain === "urban") { + init += jsRandom(10, 10); + } else if (V.terrain === "ravine") { + init -= jsRandom(5, 5); + } + if (["BlackHat", "capitalist", "celebrity", "wealth"].includes(V.PC.career)) { + init += jsRandom(5, 5); + } else if (["escort", "gang", "servant"].includes(V.PC.career)) { + init -= jsRandom(5, 5); + } + V.SecExp.core.trade = init; + } }; App.SecExp.generalInit = function(){ @@ -8,6 +21,95 @@ App.SecExp.generalInit = function(){ } Object.assign(V.SecExp, { + /* + battles: { + major: 0, + slaveVictories : [], + victories: 0, + victoryStreak: 0, + losses: 0, + lossStreak: 0, + lastEncounterWeeks: 0, + saved: {} + }, + rebellions: { + tension: 0, + slaveProgress: 0, + citizenProgress: 0, + victories: 0, + losses: 0, + lastEncounterWeeks: 0 + }, + */ + core: { + trade: 0, + authority: 0, + security: 100, + crimeLow: 30, + totalKills: 0, + }, + settings: { + difficulty: 1, + unitDescriptions: 0, + battle: { + enabled: 1, + allowSlavePrestige: 1, + force: 0, + showStats: 0, + major: { + enabled: 0, + frequency: 1, + gameOver: 1, + mult: 1, + force: 0 + } + }, + rebellion: { + enabled: 1, + force: 0, + gameOver: 1, + speed: 1 + } + }, + buildings: {}, + proclamation: { + cooldown: 0, + currency: "", + type: "crime" + }, + /* + repairTime: { + waterway: 0, + assistant: 0, + reactor: 0, + arc: 0 + }, + garrison: { + penthouse: 0, + reactor: 0, + assistant: 0, + waterway: 0 + }, + units: { + slaves: { + created: 0, + casualties: 0, + sqauds: [] + }, + milita: { + created: 0, + free: 0, + casualties: 0, + sqauds: [] + }, + mercs: { + created: 0, + free: 0, + casualties: 0, + sqauds: [] + } + }, + */ edicts: { alternativeRents: 0, enslavementRights: 0, @@ -51,7 +153,9 @@ App.SecExp.generalInit = function(){ smilingMan: { progress : 0, } - }); + }); + + App.SecExp.initTrade(); }; App.SecExp.upkeep = (function() { @@ -140,19 +244,8 @@ App.SecExp.upkeep = (function() { function buildings() { let value = 0; const base = V.facilityCost * 5, upgrade = 50; - if (V.SecExp.buildings.propHub.active > 0) { - value += base; - let buildingUgradePool = []; - buildingUgradePool.push(V.SecExp.buildings.propHub.campaign); - buildingUgradePool.push(V.SecExp.buildings.propHub.miniTruth); - buildingUgradePool.push(V.SecExp.buildings.propHub.fakeNews); - buildingUgradePool.push(V.SecExp.buildings.propHub.controlLeaks); - buildingUgradePool.push(V.SecExp.buildings.propHub.secretService); - buildingUgradePool.push(V.SecExp.buildings.propHub.blackOps); - buildingUgradePool.push(V.SecExp.buildings.propHub.marketInfiltration); - for(let i = 0; i < buildingUgradePool.length; i++) { - value += upgrade*buildingUgradePool[i]; - } + if (V.SecExp.buildings.propHub) { + value += base + upgrade * Object.values(V.SecExp.buildings.propHub.upgrades).reduce((a, b) => a + b); } if (V.secHQ > 0) { value += base + 20 * V.secMenials; @@ -168,12 +261,8 @@ App.SecExp.upkeep = (function() { value += 1000; } } - if (V.SecExp.buildings.barracks.active > 0) { - value += base; - let buildingUgradePool = Object.values(V.SecExp.buildings.barracks.upgrades); - for(let i = 0; i < buildingUgradePool.length; i++) { - value += upgrade*buildingUgradePool[i]; - } + if (V.SecExp.buildings.barracks) { + value += base + upgrade* Object.values(V.SecExp.buildings.barracks).reduce((a, b) => a + b); } if (V.riotCenter > 0) { value += base; @@ -192,11 +281,17 @@ App.SecExp.upkeep = (function() { } })(); -App.SecExp.conflict = (function() { +App.SecExp.battle = (function() { "use strict"; return { deployedUnits, troopCount, + deploySpeed, + deployableUnits, + activeUnits, + maxUnits, + recon, + bribeCost, }; /** Get count of deployed/active units for a particular battle @@ -285,18 +380,6 @@ App.SecExp.conflict = (function() { } return troops; } -})(); - -App.SecExp.battle = (function() { - "use strict"; - return { - deploySpeed:deploySpeed, - deployableUnits:deployableUnits, - activeUnits:activeUnits, - maxUnits:maxUnits, - recon:recon, - bribeCost:bribeCost, - }; /** Get mobilization readiness (in *pairs* of units) given upgrades * @returns {number} readiness @@ -368,11 +451,15 @@ App.SecExp.battle = (function() { * @returns {number} */ function maxUnits() { - let max = 8 + (V.SecExp.buildings.barracks.upgrades.size * 2); - if(App.SecExp.battle.deploySpeed() === 10) { - max += 2; + if (V.SecExp.buildings.barracks) { + let max = 8 + (V.SecExp.buildings.barracks.size * 2); + if(App.SecExp.battle.deploySpeed() === 10) { + max += 2; + } + return max; + } else { + return 0; } - return max; } /** Get recon score (scale 0-4) @@ -421,9 +508,9 @@ App.SecExp.battle = (function() { App.SecExp.Check = (function() { "use strict"; return { - secRestPoint:secRestPoint, - crimeCap:crimeCap, - reqMenials:reqMenials, + secRestPoint, + crimeCap, + reqMenials, }; function secRestPoint() { @@ -520,215 +607,6 @@ App.SecExp.Check = (function() { } })(); -App.SecExp.describeUnit = (function() { - return description; - - /** - * @param {FC.SecExp.PlayerUnitData} input - * @param {string} unitType - */ - function description(input, unitType = '') { - let r = ``; - if (V.SecExp.settings.unitDescriptions === 0) { - if (unitType !== "Bots") { - r += `\n<strong>${input.platoonName}</strong> `; - } else { - r += `\nThe drone unit is made up of ${input.troops} drones. `; - } - - if (unitType !== "Bots") { - if(input.battlesFought > 1) { - r += `has participated in ${input.battlesFought} battles and is ready to face the enemy once more at your command. `; - } else if (input.battlesFought === 1) { - r += `is ready to face the enemy once more at your command. `; - } else { - r += `is ready to face the enemy in battle. `; - } - r += `\nIts ${input.troops} men and women are `; - - if (unitType === "Militia") { - r += `all proud citizens of your arcology, willing to put their lives on the line to protect their home. `; - } else if (unitType === "Slaves") { - r += `slaves in your possession, tasked with the protection of their owner and their arcology. `; - } else if (unitType === "Mercs") { - r += `mercenaries contracted to defend the arcology against external threats. `; - } - } else { - r += `All of which are assembled in an ordered formation in front of you, absolutely silent and ready to receive their orders. `; - } - - if(input.troops < input.maxTroops) { - r += `The unit is not at its full strength of ${input.maxTroops} operatives. `; - } - - if(unitType !== "Bots") { - if(input.equip === 0) { - r += `They are issued with simple, yet effective equipment: firearms, a few explosives and standard uniforms, nothing more. `; - } else if (input.equip === 1) { - r += `They are issued with good, modern equipment: firearms, explosives and a few specialized weapons like sniper rifles and machine guns. They also carry simple body armor. `; - } else if (input.equip === 2) { - r += `They are issued with excellent, high tech equipment: modern firearms, explosives, specialized weaponry and modern body armor. They are also issued with modern instruments like night vision and portable radars. `; - } else { - r += `They are equipped with the best the modern world has to offer: modern firearms, explosives, specialized weaponry, experimental railguns, adaptive body armor and high tech recon equipment. `; - } - } else { - if(input.equip === 0) { - r += `They are equipped with light weaponry, mainly anti-riot nonlethal weapons. Not particularly effective in battle. `; - } else if (input.equip === 1) { - r += `They are equipped with light firearms, not an overwhelming amount of firepower, but with their mobility good enough to be effective. `; - } else if (input.equip === 2) { - r += `They are equipped with powerful, modern firearms and simple armor mounted around their frames. They do not make for a pretty sight, but on the battlefield they are a dangerous weapon. `; - } else { - r += `They are equipped with high energy railguns and adaptive armor. They are a formidable force on the battlefield, even for experienced soldiers. `; - } - } - - if(unitType !== "Bots") { - if(input.training <= 33) { - r += `They lack the experience to be considered professionals, but `; - if (unitType === "Militia") { - r += `their eagerness to defend the arcology makes up for it. `; - } else if (unitType === "Slaves") { - r += `their eagerness to prove themselves makes up for it. `; - } else if (unitType === "Mercs") { - r += `they're trained more than enough to still be an effective unit. `; - } - } else if (input.training <= 66) { - r += `They have trained `; - if (input.battlesFought > 0) { - r += `and fought `; - } - r += `enough to be considered disciplined, professional soldiers, ready to face the battlefield. `; - } else { - r += `They are consummate veterans, with a wealth of experience and perfectly trained. On the battlefield they are a well oiled war machine capable of facing pretty much anything. `; - } - - if(input.loyalty < 10) { - r += `The unit is extremely disloyal. Careful monitoring of their activities and relationships should be implemented. `; - } else if (input.loyalty < 33) { - r += `Their loyalty is low. Careful monitoring of their activities and relationships is advised. `; - } else if (input.loyalty < 66) { - r += `Their loyalty is not as high as it can be, but they are not actively working against their arcology owner. `; - } else if (input.loyalty < 90) { - r += `Their loyalty is high and strong. The likelihood of this unit betraying the arcology is low to non-existent. `; - } else { - r += `The unit is fanatically loyal. They would prefer death over betrayal. `; - } - - if (input.cyber > 0) { - r += `The soldiers of the unit have been enhanced with numerous cyberaugmentations which greatly increase their raw power. `; - } - if (input.medics > 0) { - r += `The unit has a dedicated squad of medics that will follow them in battle. `; - } - if(V.SF.Toggle && V.SF.Active >= 1 && input.SF > 0) { - r += `The unit has attached "advisors" from ${V.SF.Lower} that will help the squad remain tactically aware and active. `; - } - } - } else if (V.SecExp.settings.unitDescriptions > 0) { - if (unitType !== "Bots") { - r += `\n${input.platoonName}. `; - } else { - r += `Drone squad. `; - } - r += `Unit size: ${input.troops}. `; - r += `Equipment quality: `; - if (input.equip === 0) { - r += `basic. `; - } else if (input.equip === 1) { - r += `average. `; - } else if (input.equip === 2) { - r += `high. `; - } else { - r += `advanced. `; - } - if (jsDef(input.battlesFought)) { - r += `Battles fought: ${input.battlesFought}. `; - } - if (jsDef(input.training)) { - r += `\nTraining: `; - if (input.training <= 33) { - r += `low. `; - } else if(input.training <= 66) { - r += `medium. `; - } else { - r += `high. `; - } - } - if (jsDef(input.loyalty)) { - r += `Loyalty: `; - if(input.loyalty < 10) { - r += `extremely disloyal. `; - } else if (input.loyalty < 33) { - r += `low. `; - } else if (input.loyalty < 66) { - r += `medium. `; - } else if (input.loyalty < 90) { - r += `high. `; - } else { - r += `fanatical. `; - } - } - if (jsDef(input.cyber) && input.cyber > 0) { - r += `\nHave been cyberaugmentated. `; - } - if (jsDef(input.medics) && input.medics > 0) { - r += `Has a medic squad attached. `; - } - if(V.SF.Toggle && V.SF.Active >= 1 && jsDef(input.SF) || input.SF > 0) { - r += `${App.SF.Caps()} "advisors" are attached. `; - } - } - - if (!input.active) { - r += `<br>This unit has lost too many operatives `; - if (jsDef(input.battlesFought)) { - r += `in the ${input.battlesFought} it fought `; - } - r += `and can no longer be considered a unit at all.`; - } - return r; - } -})(); - -App.SecExp.mercenaryAvgLoyalty = function() { - return _.mean(V.mercUnits.filter((u) => u.active === 1).map((u) => u.loyalty)); -}; - -App.SecExp.Manpower = { - get totalMilitia() { - return this.employedMilitia + this.freeMilitia; - }, - - get employedMilitia() { - return V.militiaUnits.reduce((acc, cur) => acc + cur.troops, 0); - }, - - get freeMilitia() { - return V.militiaFreeManpower; - }, - - get employedSlave() { - return V.slaveUnits.reduce((acc, cur) => acc + cur.troops, 0); - }, - - get totalMerc() { - return this.employedMerc + this.freeMerc; - }, - - get employedMerc() { - return V.mercUnits.reduce((acc, cur) => acc + cur.troops, 0); - }, - - get freeMerc() { - return V.mercFreeManpower; - }, - - get employedOverall() { - return this.employedMerc + this.employedMilitia + this.employedSlave; - } -}; - App.SecExp.inflictBattleWound = (function() { /** @typedef {object} Wound * @property {number} weight diff --git a/src/Mods/SecExp/js/secExpBC.js b/src/Mods/SecExp/js/secExpBC.js index 5f70a78267e..0028ce2edb2 100644 --- a/src/Mods/SecExp/js/secExpBC.js +++ b/src/Mods/SecExp/js/secExpBC.js @@ -1,22 +1,21 @@ // @ts-nocheck -App.SecExp.generalBC = function (){ +App.SecExp.generalBC = function() { if (jsDef(V.secExp)) { if (V.secExpEnabled !== 1) { V.secExpEnabled = V.secExp; } - delete V.secExp; } if (typeof V.secExpEnabled !== "number") { V.secExpEnabled = 0; } - V.SecExp = V.SecExp || SecExpBase(); V.SecExp.settings = V.SecExp.settings || {}; delete V.SecExp.settings.show; - delete V.SecExp.army; - if (V.secExpEnabled > 0) { + if (V.secExpEnabled === 0) { + return; + } else { V.SecExp.edicts = V.SecExp.edicts || {}; V.SecExp.edicts.alternativeRents = V.SecExp.edicts.alternativeRents || V.alternativeRents || 0; V.SecExp.edicts.enslavementRights = V.SecExp.edicts.enslavementRights || V.enslavementRights || 0; @@ -35,7 +34,7 @@ App.SecExp.generalBC = function (){ V.SecExp.edicts.defense.soldierWages = V.SecExp.edicts.defense.soldierWages || V.soldierWages || 1; V.SecExp.edicts.defense.slavesOfficers = V.SecExp.edicts.defense.slavesOfficers || V.slavesOfficers || 0; V.SecExp.edicts.defense.discountMercenaries = V.SecExp.edicts.defense.discountMercenaries || V.discountMercenaries || 0; - + V.SecExp.edicts.defense.militia = V.SecExp.edicts.defense.militia || 0; if (V.militiaFounded) { V.SecExp.edicts.defense.militia = 1; @@ -52,7 +51,7 @@ App.SecExp.generalBC = function (){ if (V.militarizedSociety) { V.SecExp.edicts.defense.militia = 5; } - + V.SecExp.edicts.defense.militaryExemption = V.SecExp.edicts.defense.militaryExemption || V.militaryExemption || 0; V.SecExp.edicts.defense.noSubhumansInArmy = V.SecExp.edicts.defense.noSubhumansInArmy || V.noSubhumansInArmy || 0; V.SecExp.edicts.defense.pregExemption = V.SecExp.edicts.defense.pregExemption || V.pregExemption || 0; @@ -76,6 +75,7 @@ App.SecExp.generalBC = function (){ V.SecExp.edicts.defense.privilege.slaveSoldier = V.SecExp.edicts.defense.privilege.slaveSoldier || V.slaveSoldier || 0; V.SecExp.edicts.defense.privilege.mercSoldier = V.SecExp.edicts.defense.privilege.mercSoldier || V.mercSoldier || 0; + // V.SecExp.units = V.SecExp.units || {}; Object.assign(V.secBots, { active: V.secBots.active || V.arcologyUpgrade.drones > 0 ? 1 : 0, ID: -1, @@ -83,19 +83,58 @@ App.SecExp.generalBC = function (){ troops: Math.max(V.secBots.troops, V.arcologyUpgrade.drones > 0 ? 30 : 0), maxTroops: Math.max(V.secBots.maxTroops, V.arcologyUpgrade.drones > 0 ? 30 : 0) }); - + /* if (V.secBots) { + V.SecExp.units.bots = V.secBots; + } + + V.SecExp.units.slaves = V.SecExp.units.slaves || {}; + V.SecExp.units.slaves.casualties = V.SecExp.units.slaves.casualties || V.slavesTotalCasualties || 0; + V.SecExp.units.slaves.created = V.SecExp.units.slaves.created || V.createdSlavesUnits || 0; + V.SecExp.units.slaves.sqauds = V.SecExp.units.slaves.sqauds || V.slaveUnits || []; + */ + for (let i = 0; i < V.slaveUnits; i++) { + App.SecExp.fixBrokenUnit(V.slaveUnits[i]); + } + /* + V.SecExp.units.milita = V.SecExp.units.milita || {}; + V.SecExp.units.milita.created = V.SecExp.units.milita.created || V.createdMilitiaUnits || 0; + V.SecExp.units.milita.free = V.SecExp.units.milita.free || V.militiaFreeManpower || 0; + V.SecExp.units.milita.casualties = V.SecExp.units.milita.casualties || V.militiaTotalCasualties || 0; + V.SecExp.units.milita.sqauds = V.SecExp.units.milita.sqauds || V.militiaUnits || []; + */ + for (let i = 0; i < V.militiaUnits; i++) { + App.SecExp.fixBrokenUnit(V.militiaUnits[i]); + } + /* + V.SecExp.units.mercs = V.SecExp.units.mercs || {}; + V.SecExp.units.mercs.created = V.SecExp.units.mercs.created || V.createdMercUnits || 0; + V.SecExp.units.mercs.free = V.SecExp.units.mercs.free || V.mercFreeManpower || 0; + if (V.SecExp.units.mercs.free === 0) { + if (V.mercenaries === 1) { + V.SecExp.units.mercs.free = 15; + } else if (V.mercenaries > 1) { + V.SecExp.units.mercs.free = 30; + } + } + V.SecExp.units.mercs.casualties = V.SecExp.units.mercs.casualties || V.mercTotalCasualties || 0; + V.SecExp.units.mercs.sqauds = V.SecExp.units.mercs.sqauds || V.mercUnits || []; + */ + for (let i = 0; i < V.mercUnits; i++) { + App.SecExp.fixBrokenUnit(V.mercUnits[i]); + } + V.SecExp.smilingMan = V.SecExp.smilingMan || {}; V.SecExp.smilingMan.progress = V.SecExp.smilingMan.progress || V.smilingManProgress || 0; if (V.smilingManFate) { if (V.smilingManFate === 0) { // Offer $him a new life - V.SecExp.smilingMan.progress = 10; + V.SecExp.smilingMan.progress = 10; } else if (V.smilingManFate === 1) { // Make $him pay - V.SecExp.smilingMan.progress = 20; + V.SecExp.smilingMan.progress = 20; } else if (V.smilingManFate === 2) { // Enslave $him - V.SecExp.smilingMan.progress = 30; + V.SecExp.smilingMan.progress = 30; } } - + if (V.SecExp.smilingMan.progress < 4) { if (V.SecExp.smilingMan.progress === 0 && V.investedFunds) { V.SecExp.smilingMan.investedFunds = V.investedFunds; @@ -107,46 +146,59 @@ App.SecExp.generalBC = function (){ V.SecExp.smilingMan.globalCrisisWeeks = V.globalCrisisWeeks; } } - + V.SecExp.core = V.SecExp.core || {}; + delete V.SecExp.core.crimeCap; - V.SecExp.core.trade = V.SecExp.core.trade || 0; - if (passage() === "Acquisition" || V.SecExp.core.trade === 0) { - let init = jsRandom(20, 30); - if (V.terrain === "urban") { - init += jsRandom(10, 10); - } else if (V.terrain === "ravine") { - init -= jsRandom(5, 5); - } - if (["BlackHat", "capitalist", "celebrity", "wealth"].includes(V.PC.career)) { - init += jsRandom(5, 5); - } else if (["escort", "gang", "servant"].includes(V.PC.career)) { - init -= jsRandom(5, 5); - } - V.SecExp.core.trade = init; - } - if (jsDef(V.trade)) { - V.SecExp.core.trade = V.trade; - } - - V.SecExp.core.authority = V.SecExp.core.authority || 0; - if (jsDef(V.authority)) { - V.SecExp.core.authority = V.authority; + V.SecExp.core.trade = V.SecExp.core.trade || V.trade || 0; + App.SecExp.initTrade(); + + V.SecExp.core.authority = V.SecExp.core.authority || V.authority || 0; + V.SecExp.core.security = V.SecExp.core.security || V.security || 100; + if (jsDef(V.SecExp.security)) { + V.SecExp.core.security = V.SecExp.security.cap; + delete V.SecExp.security; } + V.SecExp.core.totalKills = V.SecExp.core.totalKills || V.totalKills || 0; - V.SecExp.security = V.SecExp.security || {}; - V.SecExp.security.cap = V.SecExp.security.cap || 100; - if (jsDef(V.security)) { - V.SecExp.security.cap = V.security; - } if (V.week === 1 || !jsDef(V.SecExp.core.crimeLow)) { V.SecExp.core.crimeLow = 30; } V.SecExp.core.crimeLow = Math.clamp(V.SecExp.core.crimeLow, 0, 100); - if (jsDef(V.crime)) { + if (V.crime) { V.SecExp.core.crimeLow = V.crime; } + /* + if (V.sectionInFirebase) { + V.SecExp.sectionInFirebase = V.sectionInFirebase; + } + + V.SecExp.battles = V.SecExp.battles || {}; + V.SecExp.battles.slaveVictories = V.SecExp.battles.slaveVictories || V.slaveVictories || []; + V.SecExp.battles.major = V.SecExp.battles.major || V.majorBattlesCount || 0; + V.SecExp.battles.victories = V.SecExp.battles.victories || V.PCvictories || 0; + V.SecExp.batlles.victoryStreak = V.SecExp.batlles.victoryStreak || V.PCvictoryStreak || 0; + V.SecExp.battles.losses = V.SecExp.battles.losses || V.PClosses || 0; + V.SecExp.battles.lossStreak = V.SecExp.battles.lossStreak || V.PClossStreak || 0; + V.SecExp.battles.lastEncounterWeeks = V.SecExp.battles.lastEncounterWeeks || V.lastAttackWeeks || 0; + V.SecExp.battles.lastSelection = V.SecExp.battles.lastSelection || V.lastSelection || []; + V.SecExp.battles.saved = V.SecExp.battles.saved || {}; + V.SecExp.battles.saved.commander = V.SecExp.battles.saved.commander || V.SavedLeader || ""; + V.SecExp.battles.saved.sfSupport = V.SecExp.battles.saved.sfSupport || V.SavedSFI || 0; + + V.SecExp.rebellions = V.SecExp.rebellions || {}; + V.SecExp.rebellions.tension = V.SecExp.rebellions.tension || V.tension || 0; + V.SecExp.rebellions.slaveProgress = V.SecExp.rebellions.slaveProgress || V.slaveProgress || 0; + V.SecExp.rebellions.citizenProgress = V.SecExp.rebellions.citizenProgress || V.citizenProgress || 0; + V.SecExp.rebellions.victories = V.SecExp.rebellions.victories || V.PCrebWon || 0; + V.SecExp.rebellions.losses = V.SecExp.rebellions.losses || V.PCrebLoss || 0; + V.SecExp.rebellions.lastEncounterWeeks = V.SecExp.battles.lastEncounterWeeks || V.lastRebellionWeeks || 0; + if (V.SFGear) { + V.SecExp.rebellions.sfArmor = V.SFGear; + } + */ + V.SecExp.settings.difficulty = V.SecExp.settings.difficulty || 1; if (jsDef(V.difficulty)) { V.SecExp.settings.difficulty = V.difficulty; @@ -170,13 +222,11 @@ App.SecExp.generalBC = function (){ if (jsDef(V.forceBattle)) { V.SecExp.settings.battle.force = V.forceBattle; } - - if (jsDef(V.readiness)) { - if(V.readiness === 10) { - V.sectionInFirebase = 1; - } + + if (V.readiness && V.readiness === 10) { + V.SecExp.sectionInFirebase = 1; } - + V.SecExp.settings.unitDescriptions = V.SecExp.settings.unitDescriptions || 0; if (!jsDef(V.SecExp.settings.battle.allowSlavePrestige)) { @@ -235,99 +285,60 @@ App.SecExp.generalBC = function (){ } V.SecExp.buildings = V.SecExp.buildings || {}; - V.SecExp.buildings.propHub = V.SecExp.buildings.propHub || {}; - V.SecExp.buildings.propHub.active = V.SecExp.buildings.propHub.active || 0; - if (V.SecExp.buildings.pr === null) { - delete V.SecExp.buildings.pr; + App.SecExp.propHub.BC(); + App.SecExp.barracks.BC(); + /* + App.SecExp.secHub.BC(); + App.SecExp.riotCenter.BC(); + App.SecExp.weapManu.BC(); + */ + V.SecExp.proclamation = V.SecExp.proclamation || {}; + V.SecExp.proclamation.cooldown = V.SecExp.proclamation.cooldown || V.proclamationsCooldown || 0; + V.SecExp.proclamation.currency = V.SecExp.proclamation.currency || V.proclamationCurrency || ""; + V.SecExp.proclamation.type = V.SecExp.proclamation.type || "crime"; + if (jsDef(V.proclamationType)) { + if (V.proclamationType !== "none") { + V.SecExp.proclamation.type = V.proclamationType; + } } - if (jsDef(V.SecExp.buildings.pr)) { - V.SecExp.buildings.propHub = V.SecExp.buildings.pr; - delete V.SecExp.buildings.pr; + /* + V.SecExp.rebellions.repairTime = V.SecExp.rebellions.repairTime || {}; + V.SecExp.rebellions.repairTime.waterway = V.SecExp.rebellions.repairTime.waterway || 0; + if (V.garrison && V.garrison.waterwayTime) { + V.SecExp.rebellions.repairTime.waterway = V.garrison.waterwayTime; } - if (jsDef(V.propHub)) { - V.SecExp.buildings.propHub.active = V.propHub; + V.SecExp.rebellions.repairTime.assistant = V.SecExp.rebellions.repairTime.assistant || 0; + if (V.garrison && V.garrison.assistantTime) { + V.SecExp.rebellions.repairTime.assistant = V.garrison.assistantTime; } - - if (V.SecExp.buildings.propHub.active > 0) { - V.SecExp.buildings.propHub.recruiterOffice = V.SecExp.buildings.propHub.recruiterOffice || 0; - V.SecExp.buildings.propHub.campaign = V.SecExp.buildings.propHub.campaign || 0; - if (jsDef(V.propCampaign)) { - V.SecExp.buildings.propHub.campaign = V.propCampaign; - } - - V.SecExp.buildings.propHub.miniTruth = V.SecExp.buildings.propHub.miniTruth || 0; - if (jsDef(V.miniTruth)) { - V.SecExp.buildings.propHub.miniTruth = V.miniTruth; - } - - V.SecExp.buildings.propHub.secretService = V.SecExp.buildings.propHub.secretService || 0; - if (jsDef(V.secretService)) { - V.SecExp.buildings.propHub.secretService = V.secretService; - } - if (jsDef(V.SecExp.buildings.propHub.SS)) { - V.SecExp.buildings.propHub.secretService = V.SecExp.buildings.propHub.SS; - delete V.SecExp.buildings.propHub.SS; - } - - if (V.SecExp.buildings.propHub.campaign >= 1) { - V.SecExp.buildings.propHub.focus = V.SecExp.buildings.propHub.focus || "social engineering"; - if (jsDef(V.propFocus) && V.propFocus !== "none") { - V.SecExp.buildings.propHub.focus = V.propFocus; - } - } - - if (V.RecuriterOffice) { - V.SecExp.buildings.propHub.recruiterOffice = V.RecuriterOffice; - } - if (V.recuriterOffice ) { - V.SecExp.buildings.propHub.recruiterOffice = V.recuriterOffice ; - } - const vars = ['fakeNews', 'controlLeaks', 'marketInfiltration', 'blackOps']; - for(let i = 0; i < vars.length; i++) { - if (jsDef(V[vars[i]]) && V[vars[i]] > 0) { - V.SecExp.buildings.propHub[vars[i]] = V[vars[i]]; - delete V[vars[i]]; - } else { - V.SecExp.buildings.propHub[vars[i]] = V.SecExp.buildings.propHub[vars[i]] || 0; - } - } + V.SecExp.rebellions.repairTime.reactor = V.SecExp.rebellions.repairTime.reactor || 0; + if (V.garrison && V.garrison.reactorTime) { + V.SecExp.rebellions.repairTime.reactor = V.garrison.reactorTime; } - - V.SecExp.buildings.barracks = V.SecExp.buildings.barracks || {}; - V.SecExp.buildings.barracks.active = V.SecExp.buildings.barracks.active || 0; - if (jsDef(V.secBarracks)) { - V.SecExp.buildings.barracks.active = V.secBarracks; + V.SecExp.rebellions.repairTime.arc = V.SecExp.rebellions.repairTime.arc || 0; + if (V.arcRepairTime) { + V.SecExp.rebellions.repairTime.arc = V.arcRepairTime; } - if (V.SecExp.buildings.barracks.active > 0) { - V.SecExp.buildings.barracks.upgrades = V.SecExp.buildings.barracks.upgrades || {}; - V.SecExp.buildings.barracks.upgrades.size = V.SecExp.buildings.barracks.upgrades.size || 0; - V.SecExp.buildings.barracks.upgrades.luxury = V.SecExp.buildings.barracks.upgrades.luxury || 0; - V.SecExp.buildings.barracks.upgrades.training = V.SecExp.buildings.barracks.upgrades.training || 0; - V.SecExp.buildings.barracks.upgrades.loyaltyMod = V.SecExp.buildings.barracks.upgrades.loyaltyMod || 0; - if (jsDef(V.secBarracksUpgrades)) { - V.SecExp.buildings.barracks.upgrades = V.secBarracksUpgrades; - } + V.SecExp.rebellions.garrison = V.SecExp.rebellions.garrison || {}; + V.SecExp.rebellions.garrison.penthouse = V.SecExp.rebellions.garrison.penthouse || 0; + if (V.garrison && V.garrison.penthouse) { + V.SecExp.rebellions.garrison.penthouse = V.garrison.penthouse; } - - V.SecExp.proclamation = V.SecExp.proclamation || {}; - V.SecExp.proclamation.cooldown = V.SecExp.proclamation.cooldown || 0; - if (jsDef(V.proclamationsCooldown)) { - V.SecExp.proclamation.cooldown = V.proclamationsCooldown; + V.SecExp.rebellions.garrison.reactor = V.SecExp.rebellions.garrison.reactor || 0; + if (V.garrison && V.garrison.reactor) { + V.SecExp.rebellions.garrison.reactor = V.garrison.reactor; } - V.SecExp.proclamation.currency = V.SecExp.proclamation.currency || ""; - if (jsDef(V.proclamationCurrency)) { - V.SecExp.proclamation.currency = V.proclamationCurrency; + V.SecExp.rebellions.garrison.assistant = V.SecExp.rebellions.garrison.assistant || 0; + if (V.garrison && V.garrison.assistant) { + V.SecExp.rebellions.garrison.assistant = V.garrison.assistant; } - V.SecExp.proclamation.type = V.SecExp.proclamation.type || "crime"; - if (jsDef(V.proclamationType)) { - if (V.proclamationType !== "none") { - V.SecExp.proclamation.type = V.proclamationType; - } + V.SecExp.rebellions.garrison.waterway = V.SecExp.rebellions.garrison.waterway || 0; + if (V.garrison && V.garrison.waterway) { + V.SecExp.rebellions.garrison.waterway = V.garrison.waterway; } + */ } - if (jsDef(V.SecExp.core)) { - delete V.SecExp.core.crimeCap; - } + delete V.SecExp.security; }; diff --git a/src/Mods/SecExp/js/secExpState.js b/src/Mods/SecExp/js/secExpState.js deleted file mode 100644 index 40c4ef94845..00000000000 --- a/src/Mods/SecExp/js/secExpState.js +++ /dev/null @@ -1,131 +0,0 @@ -App.SecExp.majorBattleState = class { - constructor() { - this.enabled = 1; - this.gameOver = 1; - this.force = 0; - this.mult = 1; - } -}; - -App.SecExp.battleState = class { - constructor() { - this.enabled = 1; - this.frequency = 1; - this.force = 0; - this.allowSlavePrestige = 1; - this.major = new App.SecExp.majorBattleState(); - } -}; - -App.SecExp.rebellionState = class { - constructor() { - this.enabled = 1; - this.gameOver = 1; - this.force = 0; - this.speed = 1; - } -}; - -App.SecExp.settingsState = class { - constructor() { - this.difficulty = 1; - this.unitDescriptions = 0; - this.showStats = 0; - this.battle = new App.SecExp.battleState(); - this.rebellion = new App.SecExp.rebellionState(); - } -}; - -App.SecExp.coreState = class { - constructor() { - this.trade = 0; - this.authority = 0; - this.crimeLow = 30; - } -}; - -App.SecExp.securityState = class { - constructor() { - this.cap = 100; - } -}; - -App.SecExp.propHubState = class { - constructor() { - this.active = 0; - this.recruiterOffice = 0; - this.campaign = 0; - this.miniTruth = 0; - this.secretService = 0; - this.fakeNews = 0; - this.controlLeaks = 0; - this.marketInfiltration = 0; - this.blackOps = 0; - this.focus = "social engineering"; - } -}; - -App.SecExp.barracksUpgradesState = class { - constructor() { - this.size = 0; - this.luxury = 0; - this.training = 0; - this.loyaltyMod = 0; - } -}; - -App.SecExp.barracksState = class { - constructor() { - this.active = 0; - this.upgrades = new App.SecExp.barracksUpgradesState(); - } -}; - -App.SecExp.buildingState = class { - constructor() { - this.propHub = new App.SecExp.propHubState(); - this.barracks = new App.SecExp.barracksState(); - } -}; - -App.SecExp.proclamationState = class { - constructor() { - this.cooldown = 0; - this.currency = "cash"; - this.type = "crime"; - } -}; - -App.SecExp.SecurityExpansionState = class SecurityExpansionState { - constructor() { - this.settings = new App.SecExp.settingsState(); - this.core = new App.SecExp.coreState(); - this.security = new App.SecExp.securityState(); - this.buildings = new App.SecExp.buildingState(); - this.proclamation = new App.SecExp.buildingState(); - } - - /** Creates an object suitable for setting nested attributes as it would be a SecurityExpansionState - * @returns {object} object containing all the attributes - * that are complex objects in the SecurityExpansionState class - */ - static makeSecExpSkeleton() { - return { - settings: { - battle: { - major: {} - }, - rebellion: {}, - }, - core: {}, - security: {}, - buildings: { - propHub: {}, - barracks: { - upgrades: {} - }, - }, - proclamation: {}, - }; - } -}; diff --git a/src/Mods/SecExp/rebellionGenerator.tw b/src/Mods/SecExp/rebellionGenerator.tw index ca6f9b700fe..74614e0ca64 100644 --- a/src/Mods/SecExp/rebellionGenerator.tw +++ b/src/Mods/SecExp/rebellionGenerator.tw @@ -49,16 +49,16 @@ Citizen and slave populations are sufficiently balanced not to cause problems either way. <<set _slave -= 1>> <</if>> -<<if $SecExp.security.cap <= 10>> +<<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.security.cap <= 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.security.cap <= 60>> +<<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.security.cap >= 90>> +<<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>> diff --git a/src/Mods/SecExp/rebellionHandler.tw b/src/Mods/SecExp/rebellionHandler.tw index 7260fe6d976..a30bed87ce9 100644 --- a/src/Mods/SecExp/rebellionHandler.tw +++ b/src/Mods/SecExp/rebellionHandler.tw @@ -111,13 +111,13 @@ <<set _hp *= 0.95>> <</if>> -<<set _moraleTroopMod = Math.clamp(App.SecExp.conflict.troopCount() / 100,1,10)>> +<<set _moraleTroopMod = Math.clamp(App.SecExp.battle.troopCount() / 100,1,10)>> /* morale and baseHp calculation */ -<<set _morale = (App.SecExp.BaseDroneUnit.morale * $secBots.active + App.SecExp.BaseMilitiaUnit.morale * App.SecExp.conflict.deployedUnits('militia') + App.SecExp.BaseSlaveUnit.morale * App.SecExp.conflict.deployedUnits('slaves') + App.SecExp.BaseMercUnit.morale * App.SecExp.conflict.deployedUnits('mercs') + App.SecExp.BaseSpecialForcesUnit.morale * $SF.Active) / ($secBots.active + App.SecExp.conflict.deployedUnits('militia') + App.SecExp.conflict.deployedUnits('slaves') + App.SecExp.conflict.deployedUnits('mercs') + $SF.Active)>> -<<set _morale = _morale + _morale * $SecExp.buildings.barracks.upgrades.luxury * 0.05>> /* barracks bonus */ +<<set _morale = (App.SecExp.BaseDroneUnit.morale * $secBots.active + App.SecExp.BaseMilitiaUnit.morale * App.SecExp.battle.deployedUnits('militia') + App.SecExp.BaseSlaveUnit.morale * App.SecExp.battle.deployedUnits('slaves') + App.SecExp.BaseMercUnit.morale * App.SecExp.battle.deployedUnits('mercs') + App.SecExp.BaseSpecialForcesUnit.morale * $SF.Active) / ($secBots.active + App.SecExp.battle.deployedUnits('militia') + App.SecExp.battle.deployedUnits('slaves') + App.SecExp.battle.deployedUnits('mercs') + $SF.Active)>> +<<set _morale = _morale + _morale * $SecExp.buildings ? $SecExp.buildings.barracks.luxury : 0 * 0.05>> /* barracks bonus */ <<set _morale *= _moraleTroopMod>> -<<set _baseHp = (App.SecExp.BaseDroneUnit.hp * $secBots.active + App.SecExp.BaseMilitiaUnit.hp * App.SecExp.conflict.deployedUnits('militia') + App.SecExp.BaseSlaveUnit.hp * App.SecExp.conflict.deployedUnits('slaves') + App.SecExp.BaseMercUnit.hp * App.SecExp.conflict.deployedUnits('mercs') + App.SecExp.BaseSpecialForcesUnit.hp * $SF.Active) / ($secBots.active + App.SecExp.conflict.deployedUnits('militia') + App.SecExp.conflict.deployedUnits('slaves') + App.SecExp.conflict.deployedUnits('mercs') + $SF.Active)>> +<<set _baseHp = (App.SecExp.BaseDroneUnit.hp * $secBots.active + 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 * $SF.Active) / ($secBots.active + App.SecExp.battle.deployedUnits('militia') + App.SecExp.battle.deployedUnits('slaves') + App.SecExp.battle.deployedUnits('mercs') + $SF.Active)>> /* calculates rebelling army stats */ <<if $week <= 30>> @@ -180,7 +180,6 @@ <</for>> <<set _enemyMoraleTroopMod = Math.clamp($attackTroops / 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)>> @@ -210,7 +209,6 @@ <br>@@.red;Error: enemy morale value reported NaN@@ <</if>> - /* difficulty */ <<set _enemyAttack *= $SecExp.settings.difficulty>> <<set _enemyDefense *= $SecExp.settings.difficulty>> @@ -223,8 +221,7 @@ <<set _engageMod = Math.round(_engageMod * 100)>> <<set _difficulty = ($SecExp.settings.difficulty -1) * 100>> -__Difficulty__: -<br> +__Difficulty__:<br> <<if $SecExp.settings.difficulty == 0.5>> Very easy <<elseif $SecExp.settings.difficulty == 0.75>> @@ -238,10 +235,8 @@ __Difficulty__: <<else>> Extremly hard <</if>> -<br> -<br> -__Army__: -<br>troops: <<print num(Math.round(App.SecExp.conflict.troopCount()))>> +<br><br>__Army__: +<br>troops: <<print num(Math.round(App.SecExp.battle.troopCount()))>> <br>attack: <<print num(Math.round(_attack))>> <br>defense: <<print num(Math.round(_defense))>> <br>engagement rule modifier: <<if _engageMod > 0>>+<</if>><<print _engageMod>>% @@ -251,9 +246,7 @@ __Army__: <<if _enemyMoraleTroopMod > 0>> <br>morale increase due to troop numbers: +<<print _moraleTroopMod>>% <</if>> -<br> -<br> -__Rebels__: +<br><br>__Rebels__: <br>enemy troops: <<print num(Math.round($attackTroops))>> <br>enemy attack: <<print num(Math.round(_enemyAttack))>> <br>enemy defense: <<print num(Math.round(_enemyDefense))>> @@ -268,20 +261,16 @@ __Rebels__: /* simulates the combat by pitting attk against def */ <<for _i = 0; _i < _turns; _i++>> - <br><br> - <<if $SecExp.settings.showStats == 1>> turn: <<print _i + 1>><</if>> + <<if $SecExp.settings.showStats == 1>> <br><br>turn: <<print _i + 1>><</if>> /* player army attacks */ <<set _damage = Math.clamp(_attack - _enemyDefense,_attack * 0.1,_attack)>> - <br> - <<if $SecExp.settings.showStats == 1>> player damage: <<print num(Math.round(_damage))>><</if>> + <<if $SecExp.settings.showStats == 1>> <br>player damage: <<print num(Math.round(_damage))>><</if>> <<set _enemyHp -= _damage>> - <br> - <<if $SecExp.settings.showStats == 1>> remaining enemy Hp: <<print num(Math.round(_enemyHp))>><</if>> + <<if $SecExp.settings.showStats == 1>> <br>remaining enemy Hp: <<print num(Math.round(_enemyHp))>><</if>> <<set $enemyLosses += _damage / _enemyBaseHp>> <<set _moraleDamage = Math.clamp(_damage/ 2 + _damage / _enemyBaseHp,0,_damage*1.5)>> <<set _enemyMorale -= _moraleDamage>> - <br> - <<if $SecExp.settings.showStats == 1>> remaining enemy morale: <<print num(Math.round(_enemyMorale))>><</if>> + <<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>> @@ -294,16 +283,13 @@ __Rebels__: <<if _damage < _enemyAttack * 0.1>> <<set _damage = _enemyAttack * 0.1>> <</if>> - <br> - <<if $SecExp.settings.showStats == 1>> enemy damage: <<print num(Math.round(_damage))>><</if>> + <<if $SecExp.settings.showStats == 1>> <br>enemy damage: <<print num(Math.round(_damage))>><</if>> <<set _hp -= _damage*($SFGear ? 0.85 : 1)>> - <br> - <<if $SecExp.settings.showStats == 1>> remaining hp: <<print num(Math.round(_hp))>><</if>> + <<if $SecExp.settings.showStats == 1>> <br>remaining hp: <<print num(Math.round(_hp))>><</if>> <<set $losses += _damage / _baseHp>> <<set _moraleDamage = Math.clamp(_damage / 2 + _damage / _baseHp,0,_damage*1.5)>> <<set _morale -= _moraleDamage>> - <br> - <<if $SecExp.settings.showStats == 1>> remaining morale: <<print num(Math.round(_morale))>><</if>> + <<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>> @@ -321,22 +307,20 @@ __Rebels__: <</if>> <</if>> -<<if $battleResult > 3 || $battleResult < -3>> - <br>@@.red;Error: failed to determine battle result@@ +<<if $battleResult > 3 || $battleResult < -3>> + <br><br>@@.red;Error: failed to determine battle result@@ <</if>> -<<if $SecExp.settings.showStats == 1 && $SecExp.settings.rebellion.gameOver == 1 && $battleResult == -3>> - <br><br> - <<link "Proceed" "Gameover">> - <<set $gameover = "Rebellion defeat">> - <</link>> -<<elseif $SecExp.settings.rebellion.gameOver == 1 && $battleResult == -3>> - <<set $gameover = "Rebellion defeat">> - <<goto "Gameover">> -<<elseif $SecExp.settings.showStats == 1>> - <br><br> - <<link "Proceed" "rebellionReport">> - <</link>> +<<if $SecExp.settings.showStats == 1>> + <<if $SecExp.settings.rebellion.gameOver == 1 && $battleResult == -3>> + <br>[[Proceed|Gameover][$gameover = "Rebellion defeat"]] + <<else>> + <br>[[Proceed|rebellionReport]] + <</if>> <<else>> - <<goto "rebellionReport">> -<</if>> + <<if $SecExp.settings.rebellion.gameOver == 1 && $battleResult == -3>> + <<set $gameover = "Rebellion defeat">> <<goto "Gameover">> + <<else>> + <<goto "rebellionReport">> + <</if>> +<</if>> \ No newline at end of file diff --git a/src/Mods/SecExp/rebellionOptions.tw b/src/Mods/SecExp/rebellionOptions.tw index aef6f210007..5a8abc3ef54 100644 --- a/src/Mods/SecExp/rebellionOptions.tw +++ b/src/Mods/SecExp/rebellionOptions.tw @@ -2,11 +2,7 @@ <<set $nextButton = " ", $nextLink = "rebellionOptions", $encyclopedia = "Battles">> -<<if $slaveRebellion == 1>> - <strong>Slave Rebellion!</strong> -<<else>> - <strong>Citizen Rebellion!</strong> -<</if>> +<strong> <<if $slaveRebellion == 1>>Slave<<else>>Citizen<</if>> Rebellion!</strong> <hr> <<if $slaveRebellion == 1>> @@ -28,8 +24,7 @@ <</if>> <<set _count = 0>> <<if $rebellingID.length > 0>> - <br> - <br> + <br><br> <<for _i = 0; _i < $militiaUnits.length; _i++>> <<if $militiaUnits[_i].active == 1 && ($rebellingID.includes($militiaUnits[_i].ID))>> <<set _count++>> @@ -65,8 +60,7 @@ <<set _count = 0>> <<set _loyalUnits = $militiaUnits.length + $slaveUnits.length + $mercUnits.length - $rebellingID.length>> <<if _loyalUnits > 0>> - <br> - <br> + <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))>> @@ -123,9 +117,8 @@ <<print num(Math.trunc($irregulars))>> of your citizens took up arms to defend their arcology owner. <</if>> <<set _count = 0>> - <br> <<if $rebellingID.length > 0>> - <br> + <br><br> <<for _i = 0; _i < $militiaUnits.length; _i++>> <<if $militiaUnits[_i].active == 1 && ($rebellingID.includes($militiaUnits[_i].ID))>> <<set _count++>> @@ -158,11 +151,11 @@ <</for>> betrayed you and joined the insurrection. <</if>> - <br> + <<set _count = 0>> <<set _loyalUnits = $militiaUnits.length + $slaveUnits.length + $mercUnits.length - $rebellingID.length>> <<if _loyalUnits > 0>> - <br> + <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))>> @@ -203,8 +196,6 @@ <hr> <</if>> -<br> -<br> 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">> @@ -225,7 +216,6 @@ In order to preserve the structural integrity of the building and the lives of o <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>> - <<if $advancedRiotEquip == 1>> <br><<link "Advanced riot protocol">> <<set $engageRule = 3>> @@ -239,10 +229,7 @@ In order to preserve the structural integrity of the building and the lives of o <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> -<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. +<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>> @@ -284,16 +271,11 @@ We can dedicate some of our forces to the protection of the vital parts of the a <</link>> <</if>> -<br><br> -<<replenishAllUnits>> - -<br><br> +<br><br> <<replenishAllUnits>> <<link "Proceed" "rebellionHandler">> - <<set $battleResult = 4>> /* sets $battleResult value outside accepted range to avoid evaluation problems */ - <<set $foughtThisWeek = 1>> + <<set $battleResult = 4, $foughtThisWeek = 1>> /* sets $battleResult value outside accepted range (-3, 3) to avoid evaluation problems */ <</link>> <br> <<link "Surrender" "rebellionHandler">> - <<set $battleResult = -1>> - <<set $foughtThisWeek = 1>> -<</link>> + <<set $battleResult = -1, $foughtThisWeek = 1>> +<</link>> \ No newline at end of file diff --git a/src/Mods/SecExp/rebellionReport.tw b/src/Mods/SecExp/rebellionReport.tw index a32f7242c41..77ea87cedc3 100644 --- a/src/Mods/SecExp/rebellionReport.tw +++ b/src/Mods/SecExp/rebellionReport.tw @@ -7,7 +7,7 @@ <<if $enemyLosses > $attackTroops>> <<set $enemyLosses = $attackTroops>> <</if>> -<<set $totalKills += $enemyLosses>> +<<set $SecExp.core.totalKills += $enemyLosses>> <<set $losses = Math.trunc($losses)>> <<set $rebellionsCount++>> <<if $battleResult == 3>> @@ -29,7 +29,7 @@ <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.conflict.troopCount()))>> strong, fought with them street by street + 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. <<else>> @@ -161,7 +161,7 @@ <<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.conflict.troopCount())>> strong, fought with them street by street + 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. <<else>> diff --git a/src/Mods/SecExp/secExpSmilingMan.tw b/src/Mods/SecExp/secExpSmilingMan.tw index 0aa02e6a594..226561cf079 100644 --- a/src/Mods/SecExp/secExpSmilingMan.tw +++ b/src/Mods/SecExp/secExpSmilingMan.tw @@ -217,7 +217,7 @@ Your cold storage facility has ensured that the Smiling Man's destruction of the primary archives was unable to damage the security of your arcology. <<elseif $secUpgrades.coldstorage == 0>> Your security department sees its archives butchered by the Smiling Man. Almost all data on criminals, citizens, and operations are lost. The <span class="red">security of the arcology is greatly reduced.</span> Criminals, on the other hand, with their past erased, cannot wait to join this new world, so <span class="red">crime will inevitably increase.</span> - <<set $SecExp.security.cap = Math.clamp($SecExp.security.cap * 0.2,0,100)>> + <<set $SecExp.core.security = Math.clamp($SecExp.core.security * 0.2,0,100)>> <<set $SecExp.core.crimeLow = Math.clamp($SecExp.core.crimeLow * 1.5, 20,100)>> <</if>> </p> @@ -453,4 +453,4 @@ </p> <</if>> <<run delete $SecExp.smilingMan.relationship>> -<</if>> \ No newline at end of file +<</if>> diff --git a/src/Mods/SecExp/securityReport.tw b/src/Mods/SecExp/securityReport.tw index 6e28f4d8a21..136a163d014 100644 --- a/src/Mods/SecExp/securityReport.tw +++ b/src/Mods/SecExp/securityReport.tw @@ -172,7 +172,7 @@ <</if>> <</if>> -<<if $SecExp.buildings.propHub.blackOps > 0>> +<<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>> @@ -212,13 +212,13 @@ <</if>> The security level of the arcology is -<<if $SecExp.security.cap > (_secRest + 5)>> +<<if $SecExp.core.security > (_secRest + 5)>> over its effective resting point, limiting the achievable growth this week. <<set _secGrowth *= 0.5>> -<<elseif $SecExp.security.cap < (_secRest - 5)>> +<<elseif $SecExp.core.security < (_secRest - 5)>> under its effective resting point, speeding up its growth. <<set _secGrowth *= 1.5>> -<<elseif $SecExp.security.cap == _secRest>> +<<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>> @@ -227,16 +227,16 @@ The security level of the arcology is <<set _secGrowth *= 0.3>> <</if>> <</if>> -<<set _restGrowth = (_secRest - $SecExp.security.cap) * 0.2>> -<<set _newSec = Math.trunc($SecExp.security.cap + _secGrowth + _restGrowth)>> -<<if _newSec < $SecExp.security.cap>> +<<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.security.cap>> +<<elseif _newSec == $SecExp.core.security>> This week @@.yellow;security did not change.@@ <<else>> This week @@.green;security improved.@@ <</if>> -<<set $SecExp.security.cap = Math.clamp(_newSec, 0, 100)>> +<<set $SecExp.core.security = Math.clamp(_newSec, 0, 100)>> <br><br> <strong>Crime</strong>: @@ -291,12 +291,12 @@ Due to the deterioration of the old world countries, organized crime focuses mor 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.security.cap <= 20>> +<<if $SecExp.core.security <= 20>> The security measures in place are severely limited, allowing crime to grow uncontested. -<<elseif $SecExp.security.cap <= 50>> +<<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.security.cap <= 75>> +<<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>> @@ -322,7 +322,7 @@ Due to the deterioration of the old world countries, organized crime focuses mor 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.active > 0 && $SecExp.buildings.propHub.marketInfiltration > 0>> +<<if $SecExp.buildings.propHub && $SecExp.buildings.propHub.upgrades.marketInfiltration > 0>> <<set _crimeGrowth += 0.5 * random(1,2)>> <</if>> @@ -356,7 +356,7 @@ Due to the deterioration of the old world countries, organized crime focuses mor 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>> - <<if $SecExp.buildings.propHub.active > 0>> + <<if $SecExp.buildings.propHub>> <<if $SecExp.buildings.propHub.campaign >= 1 && $SecExp.buildings.propHub.focus == "recruitment">> <<if $SecExp.buildings.propHub.recruiterOffice === 0 || $RecruiterID == 0>> <<if $SecExp.edicts.propCampaignBoost == 1>> @@ -589,4 +589,4 @@ Due to the deterioration of the old world countries, organized crime focuses mor <<else>> It will be finished in <<= numberWithPluralOne($currentUpgrade.time, "week")>>. <</if>> -<</if>> \ No newline at end of file +<</if>> diff --git a/src/Mods/SecExp/unitsBattleReport.tw b/src/Mods/SecExp/unitsBattleReport.tw index 95887d2edf5..7d92a211e5c 100644 --- a/src/Mods/SecExp/unitsBattleReport.tw +++ b/src/Mods/SecExp/unitsBattleReport.tw @@ -1,19 +1,16 @@ :: unitsBattleReport [nobr] <<if $losses == 0>> - <<if App.SecExp.conflict.deployedUnits('bots')>> - <br> - Security Drones: no casualties. + <<if App.SecExp.battle.deployedUnits('bots')>> + <br>Security Drones: no casualties. <</if>> <<if $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> - <br> - <<print num($SF.ArmySize)>> soldiers from $SF.Lower joined the battle: no casualties suffered. + <br><<print num($SF.ArmySize)>> soldiers from $SF.Lower joined the battle: no casualties suffered. <</if>> - <<if App.SecExp.conflict.deployedUnits('militia') >= 1>> + <<if App.SecExp.battle.deployedUnits('militia') >= 1>> <<for _j = 0; _j < $militiaUnits.length; _j++>> <<if $militiaUnits[_j].isDeployed == 1>> - <br> - $militiaUnits[_j].platoonName: no casualties. + <br>$militiaUnits[_j].platoonName: no casualties. <<set $militiaUnits[_j].battlesFought++>> <<if $militiaUnits[_j].training < 100>> <<if random(1,100) > 60>> @@ -24,11 +21,10 @@ <</if>> <</for>> <</if>> - <<if App.SecExp.conflict.deployedUnits('slaves') >= 1>> + <<if App.SecExp.battle.deployedUnits('slaves') >= 1>> <<for _j = 0; _j < $slaveUnits.length; _j++>> <<if $slaveUnits[_j].isDeployed == 1>> - <br> - $slaveUnits[_j].platoonName: no casualties. + <br>$slaveUnits[_j].platoonName: no casualties. <<set $slaveUnits[_j].battlesFought++>> <<if $slaveUnits[_j].training < 100>> <<if random(1,100) > 60>> @@ -39,11 +35,10 @@ <</if>> <</for>> <</if>> - <<if App.SecExp.conflict.deployedUnits('mercs') >= 1>> + <<if App.SecExp.battle.deployedUnits('mercs') >= 1>> <<for _j = 0; _j < $mercUnits.length; _j++>> <<if $mercUnits[_j].isDeployed == 1>> - <br> - $mercUnits[_j].platoonName: no casualties. + <br>$mercUnits[_j].platoonName: no casualties. <<set $mercUnits[_j].battlesFought++>> <<if $mercUnits[_j].training < 100>> <<if random(1,100) > 60>> @@ -54,15 +49,14 @@ <</if>> <</for>> <</if>> - <<elseif $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 _averageLosses = Math.trunc(_losses / App.SecExp.conflict.deployedUnits())>> + <<set _averageLosses = Math.trunc(_losses / App.SecExp.battle.deployedUnits())>> <<set _lossesList = []>> <<set _validityCount = 0>> - <<for _i = 0; _i < App.SecExp.conflict.deployedUnits(); _i++>> + <<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>> @@ -96,12 +90,11 @@ <</if>> /* assigns the losses and notify the player */ - <<if App.SecExp.conflict.deployedUnits('bots')>> - <br> + <<if App.SecExp.battle.deployedUnits('bots')>> <<set _loss = _lossesList.pluck()>> <<set _loss = Math.clamp(_loss,0,$secBots.troops)>> <<set $secBots.troops -= _loss>> - Security drones: + <br>Security drones: <<if _loss <= 0>> no casualties <<elseif _loss <= $secBots.troops * 0.2>> @@ -123,10 +116,9 @@ <br> <</if>> <<if $SF.Toggle && $SF.Active >= 1 && $SFIntervention>> - <br> <<set _loss = _lossesList.pluck()>> <<set _loss = Math.clamp(_loss,0,$SF.ArmySize)>> - <<print num($SF.ArmySize)>> soldiers from $SF.Lower joined the battle: + <br> <<print num($SF.ArmySize)>> soldiers from $SF.Lower joined the battle: <<if _loss <= 0>> no casualties <<elseif _loss <= 10>> @@ -142,14 +134,13 @@ <<set $SF.ArmySize -= _loss>> <br> <</if>> - <<if App.SecExp.conflict.deployedUnits('militia') >= 1>> + <<if App.SecExp.battle.deployedUnits('militia') >= 1>> <<for _j = 0; _j < $militiaUnits.length; _j++>> <<if $militiaUnits[_j].isDeployed == 1>> - <br> <<set $militiaUnits[_j].battlesFought++>> <<set _loss = _lossesList.pluck()>> <<set _loss = Math.clamp(_loss,0,$militiaUnits[_j].troops)>> - $militiaUnits[_j].platoonName: + <br>$militiaUnits[_j].platoonName: <<if _loss <= 0>> no casualties <<elseif _loss <= $militiaUnits[_j].troops * 0.2>> @@ -183,14 +174,13 @@ <</if>> <</for>> <</if>> - <<if App.SecExp.conflict.deployedUnits('slaves') >= 1>> + <<if App.SecExp.battle.deployedUnits('slaves') >= 1>> <<for _j = 0; _j < $slaveUnits.length; _j++>> <<if $slaveUnits[_j].isDeployed == 1>> - <br> <<set $slaveUnits[_j].battlesFought++>> <<set _loss = _lossesList.pluck()>> <<set _loss = Math.clamp(_loss,0,$slaveUnits[_j].troops)>> - $slaveUnits[_j].platoonName: + <br>$slaveUnits[_j].platoonName: <<if _loss <= 0>> no casualties <<elseif _loss <= $slaveUnits[_j].troops * 0.2>> @@ -224,14 +214,13 @@ <</if>> <</for>> <</if>> - <<if App.SecExp.conflict.deployedUnits('mercs') >= 1>> + <<if App.SecExp.battle.deployedUnits('mercs') >= 1>> <<for _j = 0; _j < $mercUnits.length; _j++>> <<if $mercUnits[_j].isDeployed == 1>> - <br> <<set $mercUnits[_j].battlesFought++>> <<set _loss = _lossesList.pluck()>> <<set _loss = Math.clamp(_loss,0,$mercUnits[_j].troops)>> - $mercUnits[_j].platoonName: + <br>$mercUnits[_j].platoonName: <<if _loss <= 0>> no casualties <<elseif _loss <= $mercUnits[_j].troops * 0.2>> @@ -267,4 +256,4 @@ <</if>> <<else>> <br>@@.red;Error: losses are a negative number or NaN@@ -<</if>> /* closes check for more than zero casualties */ +<</if>> /* closes check for more than zero casualties */ \ No newline at end of file diff --git a/src/Mods/SecExp/unitsRebellionReport.tw b/src/Mods/SecExp/unitsRebellionReport.tw index e4586ae34de..9ec5cb55eea 100644 --- a/src/Mods/SecExp/unitsRebellionReport.tw +++ b/src/Mods/SecExp/unitsRebellionReport.tw @@ -4,17 +4,15 @@ <<if $irregulars > 0>> The volunteering citizens were quickly organized into an irregular militia unit and deployed in the arcology. No casualties suffered. <</if>> - <<if App.SecExp.conflict.deployedUnits('bots') >= 1>> - <br> - Security drones: no casualties suffered. + <<if App.SecExp.battle.deployedUnits('bots') >= 1>> + <br>Security drones: no casualties suffered. <</if>> <<if $SF.Toggle && $SF.Active >= 1>> <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>> - <<if _loyalUnits > 0>> - <br> + <<if _loyalUnits > 0>> <br> <<for _i = 0; _i < $militiaUnits.length; _i++>> <<if $militiaUnits[_i].active == 1 && (!$rebellingID.includes($militiaUnits[_i].ID))>> <<set $militiaUnits[_i].battlesFought++>> @@ -53,9 +51,9 @@ <<elseif $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.conflict.deployedUnits())>> + <<set _averageLosses = Math.trunc($losses / App.SecExp.battle.deployedUnits())>> <<set _lossesList = []>> - <<for _i = 0; _i < App.SecExp.conflict.deployedUnits(); _i++>> + <<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>> @@ -89,12 +87,11 @@ /* assigns the losses and notify the player */ <<if $irregulars > 0>> - <br><br> <<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*/ <</if>> - The volunteering citizens were quickly organized into an irregular militia unit and deployed in the arcology: + <br><br>The volunteering citizens were quickly organized into an irregular militia unit and deployed in the arcology: <<if _loss <= 0>> no casualties <<elseif _loss <= 10>> @@ -132,11 +129,10 @@ <</if>> <</if>> <<if $secBots.active == 1>> - <br><br> <<set _loss = _lossesList.pluck()>> <<set _loss = Math.clamp(_loss,0,$secBots.troops)>> <<set $secBots.troops -= _loss>> - Security drones: + <br><br>Security drones: <<if _loss <= 0>> no casualties <<elseif _loss <= 10>> @@ -157,10 +153,9 @@ <</if>> <</if>> <<if $SF.Toggle && $SF.Active >= 1>> - <br><br> <<set _loss = _lossesList.pluck()>> <<set _loss = Math.clamp(_loss,0,$SF.ArmySize)>> - <<= App.SF.Caps()>>, $SF.ArmySize strong, is called to join the battle: + <br><br> <<= App.SF.Caps()>>, $SF.ArmySize strong, is called to join the battle: <<set $SF.ArmySize -= _loss>> <<if _loss <= 0>> no casualties @@ -175,14 +170,14 @@ <</if>> suffered. <</if>> - <<if App.SecExp.conflict.deployedUnits('militia') >= 1>> + <<if App.SecExp.battle.deployedUnits('militia') >= 1>> + <br> <<set _med = 0>> <<for _j = 0; _j < $militiaUnits.length; _j++>> <<if $militiaUnits[_j].active == 1 && !$rebellingID.includes($militiaUnits[_j].ID)>> - <br><br> <<set $militiaUnits[_j].battlesFought++>> <<set _loss = _lossesList.pluck()>> <<set _loss = Math.clamp(_loss,0,$militiaUnits[_j].troops)>> - $militiaUnits[_j].platoonName participated in the battle. They remained loyal to you. + <br>$militiaUnits[_j].platoonName participated in the battle. They remained loyal to you. <<if _loss <= 0>> No casualties <<elseif _loss <= $militiaUnits[_j].troops * 0.2>> @@ -216,11 +211,10 @@ <</if>> <</for>> <</if>> - <<if App.SecExp.conflict.deployedUnits('slaves') >= 1>> - <<set _med = 0>> + <<if App.SecExp.battle.deployedUnits('slaves') >= 1>> + <br> <<set _med = 0>> <<for _j = 0; _j < $slaveUnits.length; _j++>> <<if $slaveUnits[_j].active == 1 && !$rebellingID.includes($slaveUnits[_j].ID)>> - <br><br> <<set $slaveUnits[_j].battlesFought++>> <<set _loss = _lossesList.pluck()>> <<if !(Number.isInteger(_loss))>> @@ -228,7 +222,7 @@ <<break>> <</if>> <<set _loss = Math.clamp(_loss,0,$slaveUnits[_j].troops)>> - $slaveUnits[_j].platoonName participated in the battle. They remained loyal to you. + <br>$slaveUnits[_j].platoonName participated in the battle. They remained loyal to you. <<if _loss <= 0>> No casualties <<elseif _loss <= $slaveUnits[_j].troops * 0.2>> @@ -262,14 +256,14 @@ <</if>> <</for>> <</if>> - <<if App.SecExp.conflict.deployedUnits('mercs') >= 1>> + <<if App.SecExp.battle.deployedUnits('mercs') >= 1>> + <br> <<set _med = 0>> <<for _j = 0; _j < $mercUnits.length; _j++>> <<if $mercUnits[_j].active == 1 && !$rebellingID.includes($mercUnits[_j].ID)>> - <br><br> <<set $mercUnits[_j].battlesFought++>> <<set _loss = _lossesList.pluck()>> <<set _loss = Math.clamp(_loss,0,$mercUnits[_j].troops)>> - $mercUnits[_j].platoonName participated in the battle. They remained loyal to you. + <br>$mercUnits[_j].platoonName participated in the battle. They remained loyal to you. <<if _loss <= 0>> No casualties <<elseif _loss <= $mercUnits[_j].troops * 0.2>> @@ -307,15 +301,11 @@ <br>@@.red;Error: losses are a negative number or NaN@@ <</if>> -<<if $rebellingID.length > 0 && $battleResult >= 2>> - /* rebellion win */ - <br><br> - /* militia */ - <<set _militiaRebelledID = []>> - <<set _militiaManpower = 0>> +<<if $rebellingID.length > 0 && $battleResult >= 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)>> - $militiaUnits[_j].platoonName, + <br>$militiaUnits[_j].platoonName, <<set _militiaRebelledID.push($militiaUnits[_j].ID)>> <<set _militiaManpower += Math.clamp($militiaUnits[_j].troops - random(_averageLosses),0,$militiaUnits[_j].troops)>> <</if>> @@ -358,14 +348,11 @@ <br>//Will positively influence the loyalty of the other units, but no manpower will be refunded.// </span> <</if>> - - /* slaves */ - <<set _slaveRebelledID = []>> - <<set _slaveManpower = 0>> - <br> + + <br> <<set _slaveRebelledID = [], _slaveManpower = 0>> <<for _j = 0; _j < $slaveUnits.length; _j++>> <<if $slaveUnits[_j].active == 1 && $rebellingID.includes($slaveUnits[_j].ID)>> - $slaveUnits[_j].platoonName, + <br>$slaveUnits[_j].platoonName, <<set _slaveRebelledID.push($slaveUnits[_j].ID)>> <<set _slaveManpower += Math.clamp($slaveUnits[_j].troops - random(_averageLosses),0,$slaveUnits[_j].troops)>> <</if>> @@ -409,13 +396,10 @@ </span> <</if>> - /* mercs */ - <<set _mercRebelledID = []>> - <<set _mercManpower = 0>> - <br> + <br> <<set _mercRebelledID = [], _mercManpower = 0>> <<for _j = 0; _j < $mercUnits.length; _j++>> <<if $mercUnits[_j].active == 1 && $rebellingID.includes($mercUnits[_j].ID)>> - $mercUnits[_j].platoonName, + <br>$mercUnits[_j].platoonName, <<set _mercRebelledID.push($mercUnits[_j].ID)>> <<set _mercManpower += Math.clamp($mercUnits[_j].troops - random(_averageLosses),0,$mercUnits[_j].troops)>> <</if>> diff --git a/src/Mods/SecExp/widgets/miscSecExpWidgets.tw b/src/Mods/SecExp/widgets/miscSecExpWidgets.tw index 8f7fee5c2ba..23f8b40b0e7 100644 --- a/src/Mods/SecExp/widgets/miscSecExpWidgets.tw +++ b/src/Mods/SecExp/widgets/miscSecExpWidgets.tw @@ -1,119 +1,8 @@ :: miscSecExpWidgets [widget nobr] -<<widget "fixBrokenUnits">> - <<if ndef $secBots.ID>> - <<set $secBots.ID = -1>> - <</if>> - <<if $secBots.maxTroops < 30>> - <br>Fixed security bots wrong max troop count. - <<set $secBots.maxTroops = 30>> - <</if>> - <<if !Number.isInteger($secBots.troops)>> - <br>Fixed security bots wrong max troop count. - <<set $secBots.troops = $secBots.maxTroops>> - <</if>> - <<if $secBots.troops > 0 && $secBots.active != 1>> - <br>Fixed security bots wrong "active" flag. - <<set $secBots.active = 1>> - <</if>> - - <<for _i = 0; _i < $militiaUnits.length; _i++>> - <<if ndef $militiaUnits[_i].SF>> - <br>Set militia missing flag - <<set $militiaUnits[_i].SF = 0>> - <</if>> - <<if ndef $militiaUnits[_i].ID>> - <br>Set militia missing ID - <<set $militiaUnits[_i].ID = App.SecExp.generateUnitID()>> - <</if>> - <<if ndef $militiaUnits[_i].cyber>> - <br>Set militia missing flag - <<set $militiaUnits[_i].cyber = 0>> - <</if>> - <<if ndef $militiaUnits[_i].commissars>> - <br>Set militia missing flag - <<set $militiaUnits[_i].commissars = 0>> - <</if>> - <<if $militiaUnits[_i].maxTroops < 30>> - <br>Fixed militia unit wrong max troop count. - <<set $militiaUnits[_i].maxTroops = 30>> - <</if>> - <<if !Number.isInteger($militiaUnits[_i].troops)>> - <<set $militiaUnits[_i].troops = $militiaUnits[_i].maxTroops>> - <br>Fixed militia unit wrong troop count. - <</if>> - <<if $militiaUnits[_i].troops > 0 && $militiaUnits[_i].active != 1>> - <br>Fixed militia unit wrong "active" flag. - <<set $militiaUnits[_i].active = 1>> - <</if>> - <</for>> - - <<for _i = 0; _i < $slaveUnits.length; _i++>> - <<if ndef $slaveUnits[_i].SF>> - <br>Set slave missing flag - <<set $slaveUnits[_i].SF = 0>> - <</if>> - <<if ndef $slaveUnits[_i].ID>> - <br>Set slave missing ID - <<set $slaveUnits[_i].ID = App.SecExp.generateUnitID()>> - <</if>> - <<if ndef $slaveUnits[_i].cyber>> - <br>Set slave missing flag - <<set $slaveUnits[_i].cyber = 0>> - <</if>> - <<if ndef $slaveUnits[_i].commissars>> - <br>Set slave missing flag - <<set $slaveUnits[_i].commissars = 0>> - <</if>> - <<if $slaveUnits[_i].maxTroops < 30>> - <br>Fixed slave unit wrong max troop count. - <<set $slaveUnits[_i].maxTroops = 30>> - <</if>> - <<if !Number.isInteger($slaveUnits[_i].troops)>> - <<set $slaveUnits[_i].troops = $slaveUnits[_i].maxTroops>> - <br>Fixed slave unit wrong troop count. - <</if>> - <<if $slaveUnits[_i].troops > 0 && $slaveUnits[_i].active != 1>> - <br>Fixed slave unit wrong "active" flag. - <<set $slaveUnits[_i].active = 1>> - <</if>> - <</for>> - - <<for _i = 0; _i < $mercUnits.length; _i++>> - <<if ndef $mercUnits[_i].SF>> - <br>Set merc missing flag - <<set $mercUnits[_i].SF = 0>> - <</if>> - <<if ndef $mercUnits[_i].ID>> - <br>Set merc missing ID - <<set $mercUnits[_i].ID = App.SecExp.generateUnitID()>> - <</if>> - <<if ndef $mercUnits[_i].cyber>> - <br>Set merc missing flag - <<set $mercUnits[_i].cyber = 0>> - <</if>> - <<if ndef $mercUnits[_i].commissars>> - <br>Set merc missing flag - <<set $mercUnits[_i].commissars = 0>> - <</if>> - <<if $mercUnits[_i].maxTroops < 30>> - <br>Fixed merc unit wrong max troop count. - <<set $mercUnits[_i].maxTroops = 30>> - <</if>> - <<if !Number.isInteger($mercUnits[_i].troops)>> - <<set $mercUnits[_i].troops = $mercUnits[_i].maxTroops>> - <br>Fixed merc unit wrong troop count. - <</if>> - <<if $mercUnits[_i].troops > 0 && $mercUnits[_i].active != 1>> - <br>Fixed merc unit wrong "active" flag. - <<set $mercUnits[_i].active = 1>> - <</if>> - <</for>> -<</widget>> - <<widget "fixBrokenStats">> - <<if !Number.isInteger($totalKills)>> - <<set $totalKills = 0>> + <<if !Number.isInteger($SecExp.core.totalKills)>> + <<set $SecExp.core.totalKills = 0>> <</if>> <<if !Number.isInteger($mercTotalCasualties)>> <<set $mercTotalCasualties = 0>> @@ -230,5 +119,4 @@ <</link>> //Will replenish units as long as requirements are met.//<br> <</if>> - <</widget>> diff --git a/src/descriptions/arcologyDescription.js b/src/descriptions/arcologyDescription.js index c013250fc54..d7777d7311a 100644 --- a/src/descriptions/arcologyDescription.js +++ b/src/descriptions/arcologyDescription.js @@ -447,18 +447,18 @@ App.Desc.playerArcology = function(lastElement) { * @returns {string} */ function secExp() { - if (V.secExpEnabled !== 1) { + if (V.secExpEnabled === 0) { return ""; } let buffer = []; - if (V.SecExp.buildings.propHub.active === 1) { + if (V.SecExp.buildings.propHub) { buffer.push(`A small street hides a surprisingly inconspicuous building, whose task is to manage your public image, protection and population control.`); } if (V.secHQ === 1) { buffer.push(`In a secure corner of the penthouse, the Security HQ silently works to build a safe and prosperous arcology.`); } - if (V.SecExp.buildings.barracks.active === 1) { + if (V.SecExp.buildings.barracks) { buffer.push(`At the center of the structure the barracks can be found filling the halls with the noise of ballistic weapons and training troops.`); } if (V.weapManu === 1) { diff --git a/src/events/intro/initNationalities.js b/src/events/intro/initNationalities.js index 4ec5a805b35..45b2c5abbc4 100644 --- a/src/events/intro/initNationalities.js +++ b/src/events/intro/initNationalities.js @@ -1,8 +1,7 @@ App.Intro.initNationalities = function() { function initSecExp() { /* base vars */ - V.SecExp = SecExpBase(); - App.SecExp.generalBC(); + App.SecExp.generalInit(); V.secUpgrades = { nanoCams: 0, cyberBots: 0, diff --git a/src/gui/options/options.tw b/src/gui/options/options.tw index 84ff75f2981..18b0a57ff69 100644 --- a/src/gui/options/options.tw +++ b/src/gui/options/options.tw @@ -35,9 +35,6 @@ </div> <div class="indent"> [[Apply Backwards Compatibility Update|Backwards Compatibility]] - <<if $secExpEnabled > 0>> - <br>[[Apply Security Expansion mod backwards compatibility |SecExpBackwardCompatibility]] - <</if>> </div> <<link "Reset extended family mode controllers">> <<run resetFamilyCounters()>> @@ -395,7 +392,7 @@ <<run _options.addOption("The Security Expansion mod is", "secExpEnabled") .addValue("Enabled", 1).on().addValue("Disabled", 0).off() .addComment("<div>The mod can be activated in any moment, but it may result in unbalanced gameplay if activated very late in the game.</div> - <div>''If you are enabling the mod mid game for the first time, run the either the main or mod specific BC option listed near the top.''</div>")>> + <div>''If you are enabling the mod mid game for the first time, run the main BC option listed near the top.''</div>")>> <<includeDOM _options.render()>> @@ -564,10 +561,10 @@ <tr> <td style="text-align:right"> <<link "Raise security" "Options">> - <<set $SecExp.security.cap = Math.clamp($SecExp.security.cap + 5, 0, 100)>> + <<set $SecExp.core.security = Math.clamp($SecExp.core.security + 5, 0, 100)>> <</link>> | <<link "Lower security" "Options">> - <<set $SecExp.security.cap = Math.clamp($SecExp.security.cap - 5, 0, 100)>> + <<set $SecExp.core.security = Math.clamp($SecExp.core.security - 5, 0, 100)>> <</link>> </td> diff --git a/src/gui/quicklinks.js b/src/gui/quicklinks.js index f829381e8b0..dc78a193be9 100644 --- a/src/gui/quicklinks.js +++ b/src/gui/quicklinks.js @@ -105,12 +105,12 @@ App.UI.quickMenu = (function() { Nursery: () => !V.nursery, "Organ Farm": () => !V.organFarmUpgrade, Pit: () => !V.pit, - propagandaHub: () => V.secExpEnabled !== 1 || V.SecExp.buildings.propHub.active <= 0, + propagandaHub: () => V.secExpEnabled === 0 || !V.SecExp.buildings.propHub, "Prosthetic Lab": () => V.researchLab.level === 0, - riotControlCenter: () => V.secExpEnabled !== 1 || V.riotCenter <= 0, + riotControlCenter: () => V.secExpEnabled === 0 || V.riotCenter <= 0, Schoolroom: () => !V.schoolroom, - secBarracks: () => V.secExpEnabled !== 1 || V.SecExp.buildings.barracks.active <= 0, - securityHQ: () => V.secExpEnabled !== 1 || V.secHQ <= 0, + secBarracks: () => V.secExpEnabled === 0 || !V.SecExp.buildings.barracks, + securityHQ: () => V.secExpEnabled === 0 || V.secHQ <= 0, "Servants' Quarters": () => !V.servantsQuarters, Spa: () => !V.spa, "The Black Market": () => V.rep < 10000, diff --git a/src/gui/storyCaption.tw b/src/gui/storyCaption.tw index cbe3ed11056..fd44c46a26a 100644 --- a/src/gui/storyCaption.tw +++ b/src/gui/storyCaption.tw @@ -242,12 +242,12 @@ <<if $sideBarOptions.Security > 0>> <div> - @@.deepskyblue;Security@@ | @@.deepskyblue;<<= Math.trunc($SecExp.security.cap)>>%@@ + @@.deepskyblue;Security@@ | @@.deepskyblue;<<= Math.trunc($SecExp.core.security)>>%@@ <<if _Pass == "Main" && $cheatMode && $cheatModeM>> - <<set _TSec = $SecExp.security.cap>> - <<textbox "$SecExp.security.cap" $SecExp.security.cap>> + <<set _TSec = $SecExp.core.security>> + <<textbox "$SecExp.core.security" $SecExp.core.security>> <<link "Apply">> - <<set $SecExp.security.cap = Math.clamp(Math.trunc(Number($SecExp.security.cap) || _TSec), 0, 100), $cheater = 1>> + <<set $SecExp.core.security = Math.clamp(Math.trunc(Number($SecExp.core.security) || _TSec), 0, 100), $cheater = 1>> <</link>> <</if>> </div> diff --git a/src/uncategorized/arcmgmt.tw b/src/uncategorized/arcmgmt.tw index b5ac50296b3..d64634bff2d 100644 --- a/src/uncategorized/arcmgmt.tw +++ b/src/uncategorized/arcmgmt.tw @@ -787,17 +787,14 @@ $menialBioreactors -= _expirationBR>> /*Bunch of visitor stuff*/ <<if _weatherFreeze == 0>> -<<set _FSScore = _FSScore / $FSCreditCount>> +<<set _FSScore = _FSScore / $FSCreditCount, _transportHub = 1>> <<if $secExpEnabled > 0>> + <<set _transportHub = 0.7 + $airport / 10>> <<if $docks > 0>> - <<set _transportHub = 0.7 + $docks / 10 + $airport / 10>> + <<set _transportHub += $docks / 10>> <<elseif $railway > 0>> - <<set _transportHub = 0.7 + $railway / 10 + $airport / 10>> - <<else>> - <<set _transportHub = 0.7>> + <<set _transportHub += $railway / 10>> <</if>> -<<else>> - <<set _transportHub = 1>> <</if>> <<if $secExpEnabled > 0>> <<set _crime = (100 - $SecExp.core.crimeLow) / 100 + 0.2>> @@ -1535,10 +1532,10 @@ You own Your authority is so high it discourages new business, slowing down the economic growth of the arcology. <<set _AWeekGrowth-->> <</if>> - <<if $SecExp.security.cap > 80>> + <<if $SecExp.core.security > 80>> Your arcology is extremely safe and stable. Many businesses are attracted to it because of this. <<set _AWeekGrowth++>> - <<elseif $SecExp.security.cap < 20>> + <<elseif $SecExp.core.security < 20>> Your arcology's low security is an instability factor simply too dangerous to be ignored. Many businesses avoid your arcology because of this. <<set _AWeekGrowth-->> <</if>> @@ -1549,7 +1546,7 @@ You own The fairly liberal flow of weapons in your arcology has a positive impact on its economy. <<set _AWeekGrowth++>> <</if>> - <<if $SecExp.buildings.propHub.controlLeaks > 0>> + <<if $SecExp.buildings.propHub && $SecExp.buildings.propHub.upgrades.controlLeaks > 0>> The authenticity department prepares extremely accurate, but false financial reports, misleading many of your competitors, allowing your arcology more space to grow undisturbed. <<set _AWeekGrowth++>> <</if>> @@ -1588,9 +1585,7 @@ You own <</if>> <<if $secExpEnabled > 0>> - <br> - <br> - <<include "tradeReport">> + <br><br> <<include "tradeReport">> <</if>> diff --git a/src/uncategorized/fsDevelopments.tw b/src/uncategorized/fsDevelopments.tw index 968480e655b..c0a2c588d5a 100644 --- a/src/uncategorized/fsDevelopments.tw +++ b/src/uncategorized/fsDevelopments.tw @@ -86,7 +86,7 @@ <<setLocalPronouns _S.Recruiter>> <span class='slave-name'><<= SlaveFullName(_S.Recruiter)>></span> is able to further boost your societal engineering campaign from $his PR hub office. <<if $SecExp.edicts.propCampaignBoost == 1>> - <<set _broadProgress += $SecExp.buildings.propHub.campaign + Math.floor((_S.Recruiter.intelligence+_S.Recruiter.intelligenceImplant)/32)>> + <<set _broadProgress += $SecExp.buildings.propHub.upgrades.campaign + Math.floor((_S.Recruiter.intelligence+_S.Recruiter.intelligenceImplant)/32)>> <<else>> <<set _broadProgress += 1 + Math.floor((_S.Recruiter.intelligence+_S.Recruiter.intelligenceImplant)/32)>> <</if>> diff --git a/src/uncategorized/manageArcology.tw b/src/uncategorized/manageArcology.tw index 2a62ac0b99d..f8de9e45bd0 100644 --- a/src/uncategorized/manageArcology.tw +++ b/src/uncategorized/manageArcology.tw @@ -50,7 +50,7 @@ The first major upgrade needed is the installation of a drone security system so higher-class citizens will feel safe and protected should they choose to immigrate. This upgrade will cost <<print cashFormat(Math.trunc(5000*$upgradeMultiplierArcology))>>. </span> <<link "Install drone security system" "Manage Arcology">> - <<run cashX(forceNeg(Math.trunc(5000*$upgradeMultiplierArcology)), "capEx")>> + <<run cashX(-Math.trunc(5000*$upgradeMultiplierArcology), "capEx")>> <<set $arcologyUpgrade.drones = 1, $PC.skill.engineering += 1>> <<if $secExpEnabled > 0>> <<set $secBots = App.SecExp.generateUnit("bots")>> @@ -180,8 +180,8 @@ <p> <div> - <<if $SecExp.buildings.propHub.active == 0>> - [[Set up the propaganda Hub|Manage Arcology][cashX(forceNeg(Math.trunc((5000*$upgradeMultiplierArcology*$HackingSkillMultiplier))), "capEx"), $SecExp.buildings.propHub.active = 1, $PC.skill.engineering += 1, $PC.skill.hacking += 1, App.SecExp.generalBC()]] + <<if !$SecExp.buildings.propHub>> + [[Set up the propaganda Hub|Manage Arcology][cashX(forceNeg(Math.trunc((5000*$upgradeMultiplierArcology*$HackingSkillMultiplier))), "capEx"), App.SecExp.propHub.Init(), $PC.skill.engineering += 1, $PC.skill.hacking += 1]] <span class="detail"> Costs <<print cashFormat(Math.trunc((5000*$upgradeMultiplierArcology*$HackingSkillMultiplier)))>>. <div class="indent">Building specialized in the management of authority.</div> @@ -204,8 +204,8 @@ </div> <div> - <<if $SecExp.buildings.barracks.active == 0>> - [[Set up the barracks|Manage Arcology][cashX(forceNeg(Math.trunc(5000*$upgradeMultiplierArcology)), "capEx"), $SecExp.buildings.barracks.active = 1, $PC.skill.engineering += 1, App.SecExp.generalBC()]] + <<if !$SecExp.buildings.barracks>> + [[Set up the barracks|Manage Arcology][cashX(forceNeg(Math.trunc(5000*$upgradeMultiplierArcology)), "capEx"), App.SecExp.barracks.Init(), $PC.skill.engineering += 1]] <span class="detail"> Costs <<print cashFormat(Math.trunc(5000*$upgradeMultiplierArcology))>> <div class="indent">Building specialized in the management of armed forces.</div> diff --git a/src/uncategorized/persBusiness.tw b/src/uncategorized/persBusiness.tw index 5c12c5d2a10..d9ae718da16 100644 --- a/src/uncategorized/persBusiness.tw +++ b/src/uncategorized/persBusiness.tw @@ -409,7 +409,7 @@ After several days of preparation you are ready to issue the proclamation. You announce to the arcology your plans and in short order you use <<if $SecExp.proclamation.currency == "authority">>control over the arcology<<elseif $SecExp.proclamation.currency == "reputation">>great influence<<elseif $SecExp.proclamation.currency == "cash">> vast financial means<</if>> to <<if $SecExp.proclamation.type == "security">> gather crucial information for your security department. In just a few many hours holes are plugged and most moles are eliminated. @@.green;Your security greatly increased.@@ - <<set $SecExp.security.cap = Math.clamp($SecExp.security.cap + 25,0,100)>> + <<set $SecExp.core.security = Math.clamp($SecExp.core.security + 25,0,100)>> <<elseif $SecExp.proclamation.type == "crime">> force the arrest of many suspected citizens. Their personal power allowed them to avoid justice for a long time, but this day is their end. @@.green;Your crime greatly decreased.@@ <<set $SecExp.core.crimeLow = Math.clamp($SecExp.core.crimeLow - 25,0,100)>> @@ -778,7 +778,7 @@ <</if>> <</if>> - <<if $SecExp.buildings.propHub.active > 0 && $SecExp.buildings.propHub.marketInfiltration > 0>> + <<if $SecExp.buildings.propHub && $SecExp.buildings.propHub.upgrades.marketInfiltration > 0>> <<set _blackMarket = random(7000,8000)>> Your secret service makes use of black markets and illegal streams of goods to make a profit, making you @@.yellowgreen;<<print cashFormat(_blackMarket)>>.@@ This however allows @@.red;crime to flourish@@ in the underbelly of the arcology. <<set $SecExp.core.crimeLow += random(1,3)>> @@ -792,12 +792,9 @@ <</if>> <<if $weapManu == 1>> - <br><br> - The weapons manufacturing complex produces armaments - <<if $weapProductivity <= 2>> - at a steady pace. - <<else>> - with great efficiency. + <br><br>The weapons manufacturing complex produces armaments + <<if $weapProductivity <= 2>> at a steady pace. + <<else>> with great efficiency. <</if>> <<set _income = 0>> <<set _price = Math.trunc(Math.clamp(random(1,2) + ($arcologies[0].prosperity / 15) - ($week / 30), 2, 8))>> @@ -1047,4 +1044,4 @@ The RomanFS may need further tweaking (it probably got weaker). Could increase t <</if>> <</if>> -<<if $SF.Toggle && $SF.Active >= 1>> <<= App.SF.AAR()>> <</if>> \ No newline at end of file +<<if $SF.Toggle && $SF.Active >= 1>> <<= App.SF.AAR()>> <</if>> diff --git a/src/uncategorized/reputation.tw b/src/uncategorized/reputation.tw index b3c547ad8c1..e4858ecc817 100644 --- a/src/uncategorized/reputation.tw +++ b/src/uncategorized/reputation.tw @@ -783,11 +783,9 @@ _enduringRep = $enduringRep>> <<run repX(500, "policies")>> <</if>> -<<if $secExpEnabled > 0>> - <<if $SecExp.buildings.propHub.fakeNews > 0>> - The authenticity department produces and distributes copious amounts of plausible enough news and reports, @@.green;increasing your reputation.@@ - <<run repX(10 * $SecExp.buildings.propHub.miniTruth, "policies")>> - <</if>> +<<if $secExpEnabled > 0 && $SecExp.buildings.propHub && $SecExp.buildings.propHub.upgrades.fakeNews > 0>> + The authenticity department produces and distributes copious amounts of plausible enough news and reports, @@.green;increasing your reputation.@@ + <<run repX(10 * $SecExp.buildings.propHub.upgrades.fakeNews, "policies")>> <</if>> <br> -- GitLab