From 7cec0a76373388c1bb7c8502d6c77f37b13417f4 Mon Sep 17 00:00:00 2001 From: Blank_Alt <12406-Blank_Alt@users.noreply.gitgud.io> Date: Fri, 25 Sep 2020 21:28:20 -0700 Subject: [PATCH] SecExp-minorTweaking [Ready for merge review] --- js/003-data/gameVariableData.js | 7 -- src/002-config/fc-version.js | 2 +- src/Mods/SecExp/attackOptions.tw | 32 ++++----- src/Mods/SecExp/attackReport.tw | 116 +++++++++++++++--------------- src/Mods/SecExp/js/Unit.js | 27 +++---- src/Mods/SecExp/js/buildingsJS.js | 4 +- src/Mods/SecExp/js/secExp.js | 8 +-- src/Mods/SecExp/js/secExpBC.js | 14 ++-- 8 files changed, 94 insertions(+), 116 deletions(-) diff --git a/js/003-data/gameVariableData.js b/js/003-data/gameVariableData.js index abab64bd930..fdb0f727dcd 100644 --- a/js/003-data/gameVariableData.js +++ b/js/003-data/gameVariableData.js @@ -396,9 +396,6 @@ App.Data.resetOnNGPlus = { attackType: "none", attackThisWeek: 0, majorBattle: 0, - PCvictoryStreak: 0, - PClossStreak: 0, - slaveVictories: [], chosenTactic: "none", leadingTroops: "none", attackTroops: 0, @@ -416,7 +413,6 @@ App.Data.resetOnNGPlus = { SFIntervention: 0, rebellingID: [], saveValid: 0, - lastSelection: [], /* units */ /** @type {FC.SecExp.PlayerUnitData} */ secBots: {}, @@ -426,9 +422,6 @@ App.Data.resetOnNGPlus = { slaveUnits: [], /** @type {FC.SecExp.PlayerHumanUnitData[]} */ mercUnits: [], - /* SFanon additions */ - SavedLeader: 0, - SavedSFI: 0, /* base vars */ SecExp: {}, diff --git a/src/002-config/fc-version.js b/src/002-config/fc-version.js index 3da0f41a9c6..86e59381e0e 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.8.0", commitHash: null, - release: 1103 // When gettting close to 2000, please remove the check located within the onLoad() function defined at line five of src/js/eventHandlers.js. + release: 1104 // When gettting close to 2000, please remove the check located within the onLoad() function defined at line five of src/js/eventHandlers.js. }; diff --git a/src/Mods/SecExp/attackOptions.tw b/src/Mods/SecExp/attackOptions.tw index 71be491baea..9e883235e55 100644 --- a/src/Mods/SecExp/attackOptions.tw +++ b/src/Mods/SecExp/attackOptions.tw @@ -297,33 +297,33 @@ approximately <strong><<print _estimatedMen>> men</strong> are coming, they seem <</if>> <br> -<<if $lastSelection.length > 0>> +<<if $SecExp.battles.lastSelection.length > 0>> <<link "Restore saved roster" "attackOptions">> - <<for _i = 0; _i < $lastSelection.length; _i++>> - <<if $lastSelection[_i] == -1>> + <<for _i = 0; _i < $SecExp.battles.lastSelection.length; _i++>> + <<if $SecExp.battles.lastSelection[_i] == -1>> <<set $secBots.isDeployed = 1>> <<else>> <<for _j = 0; _j < $militiaUnits.length; _j++>> - <<if $lastSelection[_i] == $militiaUnits[_j].ID>> + <<if $SecExp.battles.lastSelection[_i] == $militiaUnits[_j].ID>> <<set $militiaUnits[_j].isDeployed = 1>> <<break>> <</if>> <</for>> <<for _j = 0; _j < $slaveUnits.length; _j++>> - <<if $lastSelection[_i] == $slaveUnits[_j].ID>> + <<if $SecExp.battles.lastSelection[_i] == $slaveUnits[_j].ID>> <<set $slaveUnits[_j].isDeployed = 1>> <<break>> <</if>> <</for>> <<for _j = 0; _j < $mercUnits.length; _j++>> - <<if $lastSelection[_i] == $mercUnits[_j].ID>> + <<if $SecExp.battles.lastSelection[_i] == $mercUnits[_j].ID>> <<set $mercUnits[_j].isDeployed = 1>> <<break>> <</if>> <</for>> <</if>> <</for>> - <<set $saveValid = 1,$leadingTroops = $SavedLeader, $SFIntervention = $SavedSFI>> + <<set $saveValid = 1, $leadingTroops = $SecExp.battles.saved.commander, $SFIntervention = $SecExp.battles.saved.sfSupport>> <</link>> <<else>> Restore saved roster @@ -333,24 +333,24 @@ approximately <strong><<print _estimatedMen>> men</strong> are coming, they seem <<link "Save current roster" "attackOptions">> <<if App.SecExp.battle.deployedUnits('bots')>> <<set _tmp = -1>> - <<set $lastSelection.push(_tmp)>> + <<set $SecExp.battles.lastSelection.push(_tmp)>> <</if>> <<for _i = 0; _i < $militiaUnits.length; _i++>> <<if $militiaUnits[_i].isDeployed == 1>> - <<set $lastSelection.push($militiaUnits[_i].ID)>> + <<set $SecExp.battles.lastSelection.push($militiaUnits[_i].ID)>> <</if>> <</for>> <<for _i = 0; _i < $slaveUnits.length; _i++>> <<if $slaveUnits[_i].isDeployed == 1>> - <<set $lastSelection.push($slaveUnits[_i].ID)>> + <<set $SecExp.battles.lastSelection.push($slaveUnits[_i].ID)>> <</if>> <</for>> <<for _i = 0; _i < $mercUnits.length; _i++>> <<if $mercUnits[_i].isDeployed == 1>> - <<set $lastSelection.push($mercUnits[_i].ID)>> + <<set $SecExp.battles.lastSelection.push($mercUnits[_i].ID)>> <</if>> <</for>> - <<set $saveValid = 1,$SavedLeader = $leadingTroops,$SavedSFI = $SFIntervention>> + <<set $saveValid = 1, $SecExp.battles.saved.commander = $leadingTroops, $SecExp.battles.saved.sfSupport = $SFIntervention>> <</link>> <<else>> Save current roster @@ -374,12 +374,8 @@ approximately <strong><<print _estimatedMen>> men</strong> are coming, they seem Clear current roster <</if>> | -<<if $lastSelection.length > 0>> - <<link "Clear saved roster" "attackOptions">> - <<unset $lastSelection>> - <<set $lastSelection = []>> - <<set $saveValid = 0>> - <</link>> +<<if $SecExp.battles.lastSelection.length > 0>> + [[Clear saved roster|attackOptions][$SecExp.battles.lastSelection = [], $saveValid = 0]] <<else>> Clear saved roster <</if>> diff --git a/src/Mods/SecExp/attackReport.tw b/src/Mods/SecExp/attackReport.tw index c7187a119f3..2ab7bd40ede 100644 --- a/src/Mods/SecExp/attackReport.tw +++ b/src/Mods/SecExp/attackReport.tw @@ -22,13 +22,13 @@ <</if>> <<if $battleResult == 3>> <strong>Victory!</strong> - <<set $PClossStreak = 0>> - <<set $PCvictoryStreak += 1>> + <<set $SecExp.battles.lossStreak = 0>> + <<set $SecExp.battles.victoryStreak += 1>> <<set $SecExp.battles.victories++>> <<elseif $battleResult == -3>> <strong>Defeat!</strong> - <<set $PClossStreak += 1>> - <<set $PCvictoryStreak = 0>> + <<set $SecExp.battles.lossStreak += 1>> + <<set $SecExp.battles.victoryStreak = 0>> <<set $SecExp.battles.losses++>> <<elseif $battleResult == 2>> <strong>Partial victory!</strong> @@ -75,28 +75,28 @@ <</if>> <<if $battleResult == 3>> <<if $battleTurns <= 5>> - The fight was quick and one sided, our men easily stopped the disorganized horde's futile attempt at raiding your arcology<<if $PCvictoryStreak >= 2 || $PClossStreak >= 2>>,<<else>>.<</if>> + The fight was quick and one sided, our men easily stopped the disorganized horde's futile attempt at raiding your arcology<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> <<elseif $battleTurns <= 7>> - The fight was hard, but in the end our men stopped the disorganized horde attempt at raiding your arcology<<if $PCvictoryStreak >= 2 || $PClossStreak >= 2>>,<<else>>.<</if>> + The fight was hard, but in the end our men stopped the disorganized horde attempt at raiding your arcology<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> <<else>> - The fight was long and hard, but our men managed to stop the horde raiding party<<if $PCvictoryStreak >= 2 || $PClossStreak >= 2>>,<<else>>.<</if>> + The fight was long and hard, but our men managed to stop the horde raiding party<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> <</if>> - <<if $PCvictoryStreak >= 2>> + <<if $SecExp.battles.victoryStreak >= 2>> adding another victory to the growing list of our military's successes. - <<elseif $PClossStreak >= 2>> + <<elseif $SecExp.battles.lossStreak >= 2>> finally putting an end to a series of unfortunate defeats. <</if>> <<elseif $battleResult == -3>> <<if $battleTurns <= 5>> - The fight was quick and one sided, our men were easily crushed by the barbaric horde of raiders<<if $PCvictoryStreak >= 2 || $PClossStreak >= 2>>,<<else>>.<</if>> + The fight was quick and one sided, our men were easily crushed by the barbaric horde of raiders<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> <<elseif $battleTurns <= 7>> - The fight was hard and in the end the bandits proved too much to handle for our men<<if $PCvictoryStreak >= 2 || $PClossStreak >= 2>>,<<else>>.<</if>> + The fight was hard and in the end the bandits proved too much to handle for our men<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> <<else>> - The fight was long and hard, but despite their bravery the horde proved too much for our men<<if $PCvictoryStreak >= 2 || $PClossStreak >= 2>>,<<else>>.<</if>> + The fight was long and hard, but despite their bravery the horde proved too much for our men<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> <</if>> - <<if $PCvictoryStreak >= 2>> + <<if $SecExp.battles.victoryStreak >= 2>> so interrupting a long series of military successes. - <<elseif $PClossStreak >= 2>> + <<elseif $SecExp.battles.lossStreak >= 2>> confirming the long list of recent failures our armed forces collected. <</if>> <<elseif $battleResult == 2>> @@ -137,28 +137,28 @@ <</if>> <<if $battleResult == 3>> <<if $battleTurns <= 5>> - The fight was quick and one sided, our men easily stopped the mercenaries dead in their tracks<<if $PCvictoryStreak >= 2 || $PClossStreak >= 2>>,<<else>>.<</if>> + The fight was quick and one sided, our men easily stopped the mercenaries dead in their tracks<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> <<elseif $battleTurns <= 7>> - The fight was hard, but in the end our men stopped the slavers attempt at weakening your arcology<<if $PCvictoryStreak >= 2 || $PClossStreak >= 2>>,<<else>>.<</if>> + The fight was hard, but in the end our men stopped the slavers attempt at weakening your arcology<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> <<else>> - The fight was long and hard, but our men managed to stop the free city mercenaries<<if $PCvictoryStreak >= 2 || $PClossStreak >= 2>>,<<else>>.<</if>> + The fight was long and hard, but our men managed to stop the free city mercenaries<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> <</if>> - <<if $PCvictoryStreak >= 2>> + <<if $SecExp.battles.victoryStreak >= 2>> adding another victory to the growing list of our military's successes. - <<elseif $PClossStreak >= 2>> + <<elseif $SecExp.battles.lossStreak >= 2>> finally putting an end to a series of unfortunate defeats. <</if>> <<elseif $battleResult == -3>> <<if $battleTurns <= 5>> - The fight was quick and one sided, our men were easily crushed by the consumed mercenary veterans sent against us<<if $PCvictoryStreak >= 2 || $PClossStreak >= 2>>,<<else>>.<</if>> + The fight was quick and one sided, our men were easily crushed by the consumed mercenary veterans sent against us<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> <<elseif $battleTurns <= 7>> - The fight was hard and in the end the slavers proved too much to handle for our men<<if $PCvictoryStreak >= 2 || $PClossStreak >= 2>>,<<else>>.<</if>> + The fight was hard and in the end the slavers proved too much to handle for our men<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> <<else>> - The fight was long and hard, but despite their bravery the mercenary slavers proved too much for our men<<if $PCvictoryStreak >= 2 || $PClossStreak >= 2>>,<<else>>.<</if>> + The fight was long and hard, but despite their bravery the mercenary slavers proved too much for our men<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> <</if>> - <<if $PCvictoryStreak >= 2>> + <<if $SecExp.battles.victoryStreak >= 2>> so interrupting a long series of military successes. - <<elseif $PClossStreak >= 2>> + <<elseif $SecExp.battles.lossStreak >= 2>> confirming the long list of recent failures our armed forces collected. <</if>> <<elseif $battleResult == 2>> @@ -199,28 +199,28 @@ <</if>> <<if $battleResult == 3>> <<if $battleTurns <= 5>> - The fight was quick and one sided, our men easily stopped the freedom fighters dead in their tracks<<if $PCvictoryStreak >= 2 || $PClossStreak >= 2>>,<<else>>.<</if>> + The fight was quick and one sided, our men easily stopped the freedom fighters dead in their tracks<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> <<elseif $battleTurns <= 7>> - The fight was hard, but in the end our men stopped the fighters attack<<if $PCvictoryStreak >= 2 || $PClossStreak >= 2>>,<<else>>.<</if>> + The fight was hard, but in the end our men stopped the fighters attack<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> <<else>> - The fight was long and hard, but our men managed to stop the freedom fighters<<if $PCvictoryStreak >= 2 || $PClossStreak >= 2>>,<<else>>.<</if>> + The fight was long and hard, but our men managed to stop the freedom fighters<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> <</if>> - <<if $PCvictoryStreak >= 2>> + <<if $SecExp.battles.victoryStreak >= 2>> adding another victory to the growing list of our military's successes. - <<elseif $PClossStreak >= 2>> + <<elseif $SecExp.battles.lossStreak >= 2>> finally putting an end to a series of unfortunate defeats. <</if>> <<elseif $battleResult == -3>> <<if $battleTurns <= 5>> - The fight was quick and one sided, our men were easily crushed by the fanatical fury of the freedom fighters<<if $PCvictoryStreak >= 2 || $PClossStreak >= 2>>,<<else>>.<</if>> + The fight was quick and one sided, our men were easily crushed by the fanatical fury of the freedom fighters<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> <<elseif $battleTurns <= 7>> - The fight was hard and in the end the freedom fighters proved too much to handle for our men<<if $PCvictoryStreak >= 2 || $PClossStreak >= 2>>,<<else>>.<</if>> + The fight was hard and in the end the freedom fighters proved too much to handle for our men<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> <<else>> - The fight was long and hard, but despite their bravery the freedom fighters fury proved too much for our men<<if $PCvictoryStreak >= 2 || $PClossStreak >= 2>>,<<else>>.<</if>> + The fight was long and hard, but despite their bravery the freedom fighters fury proved too much for our men<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> <</if>> - <<if $PCvictoryStreak >= 2>> + <<if $SecExp.battles.victoryStreak >= 2>> so interrupting a long series of military successes. - <<elseif $PClossStreak >= 2>> + <<elseif $SecExp.battles.lossStreak >= 2>> confirming the long list of recent failures our armed forces collected. <</if>> <<elseif $battleResult == 2>> @@ -261,28 +261,28 @@ <</if>> <<if $battleResult == 3>> <<if $battleTurns <= 5>> - The fight was quick and one sided, our men easily stopped the old world soldiers dead in their tracks<<if $PCvictoryStreak >= 2 || $PClossStreak >= 2>>,<<else>>.<</if>> + The fight was quick and one sided, our men easily stopped the old world soldiers dead in their tracks<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> <<elseif $battleTurns <= 7>> - The fight was hard, but in the end our men stopped the soldiers of the old world<<if $PCvictoryStreak >= 2 || $PClossStreak >= 2>>,<<else>>.<</if>> + The fight was hard, but in the end our men stopped the soldiers of the old world<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> <<else>> - The fight was long and hard, but our men managed to stop the old world soldiers<<if $PCvictoryStreak >= 2 || $PClossStreak >= 2>>,<<else>>.<</if>> + The fight was long and hard, but our men managed to stop the old world soldiers<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> <</if>> - <<if $PCvictoryStreak >= 2>> + <<if $SecExp.battles.victoryStreak >= 2>> adding another victory to the growing list of our military's successes. - <<elseif $PClossStreak >= 2>> + <<elseif $SecExp.battles.lossStreak >= 2>> finally putting an end to a series of unfortunate defeats. <</if>> <<elseif $battleResult == -3>> <<if $battleTurns <= 5>> - The fight was quick and one sided, our men were easily crushed by the discipline of the old world armies<<if $PCvictoryStreak >= 2 || $PClossStreak >= 2>>,<<else>>.<</if>> + The fight was quick and one sided, our men were easily crushed by the discipline of the old world armies<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> <<elseif $battleTurns <= 7>> - The fight was hard and in the end the old world proved too much to handle for our men<<if $PCvictoryStreak >= 2 || $PClossStreak >= 2>>,<<else>>.<</if>> + The fight was hard and in the end the old world proved too much to handle for our men<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> <<else>> - The fight was long and hard, but despite their bravery the determination of the old world troops proved too much for our men<<if $PCvictoryStreak >= 2 || $PClossStreak >= 2>>,<<else>>.<</if>> + The fight was long and hard, but despite their bravery the determination of the old world troops proved too much for our men<<if $SecExp.battles.victoryStreak >= 2 || $SecExp.battles.lossStreak >= 2>>,<<else>>.<</if>> <</if>> - <<if $PCvictoryStreak >= 2>> + <<if $SecExp.battles.victoryStreak >= 2>> so interrupting a long series of military successes. - <<elseif $PClossStreak >= 2>> + <<elseif $SecExp.battles.lossStreak >= 2>> confirming the long list of recent failures our armed forces collected. <</if>> <<elseif $battleResult == 2>> @@ -357,7 +357,7 @@ Damage to the infrastructure was @@.yellow;virtually non-existent,@@ costing only pocket cash to bring the structure back to normal. The inhabitants as well reported little to no injuries, because of this the prosperity of the arcology did not suffer. <<= IncreasePCSkills('engineering', 0.1)>> <<run cashX(forceNeg(1000 * _majorBattleMod), "war")>> - <<if $PCvictoryStreak >= 3>> + <<if $SecExp.battles.victoryStreak >= 3>> It seems your victories over the constant threats directed your way is having @@.green;a positive effect on the prosperity of the arcology,@@ due to the security your leadership affords. <<set $arcologies[0].prosperity += 5 * _majorBattleMod>> <</if>> @@ -421,7 +421,7 @@ $menialBioreactors -= Math.trunc(($menialBioreactors / $ASlaves) * _lostSlaves)>> <<set $arcologies[0].prosperity -= random(25) * _majorBattleMod>> <</if>> - <<if $PClossStreak >= 3>> + <<if $SecExp.battles.lossStreak >= 3>> This only confirms the fears of many, @@.red;your arcology is not safe@@ and it is clear their business will be better somewhere else. <<set $arcologies[0].prosperity -= 5 * _majorBattleMod>> <</if>> @@ -964,11 +964,11 @@ <</if>> <<if $battleResult == 3 && $SecExp.settings.battle.allowSlavePrestige == 1>> <<set _found = 0>> - <<for _i = 0; _i < $slaveVictories.length; _i++>> - <<if $slaveVictories[_i].ID == $BodyguardID>> - <<set $slaveVictories[_i].victories++>> + <<for _i = 0; _i < $SecExp.battles.slaveVictories.length; _i++>> + <<if $SecExp.battles.slaveVictories[_i].ID == $BodyguardID>> + <<set $SecExp.battles.slaveVictories[_i].victories++>> <<set _found = 1>> - <<if $slaveVictories[_i].victories >= 10>> + <<if $SecExp.battles.slaveVictories[_i].victories >= 10>> <<if _S.Bodyguard.prestige < 3>> <<set _S.Bodyguard.prestige++>> <<if _S.Bodyguard.prestige == 1>> @@ -978,7 +978,7 @@ <<elseif _S.Bodyguard.prestige == 3>> <<set _S.Bodyguard.prestigeDesc = "$He is known as a legendary commander all over the world.">> <</if>> - <<set $slaveVictories[_i].victories = 0>> + <<set $SecExp.battles.slaveVictories[_i].victories = 0>> $He brought your army to victory so many times that $his @@.green;prestige has increased.@@ <</if>> <</if>> @@ -987,7 +987,7 @@ <</for>> <<if _found == 0>> <<set _newSlave = {ID: $BodyguardID, victories: 0}>> - <<set $slaveVictories.push(_newSlave)>> + <<set $SecExp.battles.slaveVictories.push(_newSlave)>> <</if>> <</if>> <<elseif $leadingTroops == "headGirl">> @@ -1100,11 +1100,11 @@ <</if>> <<if $battleResult == 3 && $SecExp.settings.battle.allowSlavePrestige == 1>> <<set _found = 0>> - <<for _i = 0; _i < $slaveVictories.length; _i++>> - <<if $slaveVictories[_i].ID == $HeadGirlID>> - <<set $slaveVictories[_i].victories++>> + <<for _i = 0; _i < $SecExp.battles.slaveVictories.length; _i++>> + <<if $SecExp.battles.slaveVictories[_i].ID == $HeadGirlID>> + <<set $SecExp.battles.slaveVictories[_i].victories++>> <<set _found = 1>> - <<if $slaveVictories[_i].victories >= 10>> + <<if $SecExp.battles.slaveVictories[_i].victories >= 10>> <<if _S.HeadGirl.prestige < 3>> <<set _S.HeadGirl.prestige++>> <<if _S.HeadGirl.prestige == 1>> @@ -1114,7 +1114,7 @@ <<elseif _S.HeadGirl.prestige == 3>> <<set _S.HeadGirl.prestigeDesc = "$He is known as a legendary commander all over the world.">> <</if>> - <<set $slaveVictories[_i].victories = 0>> + <<set $SecExp.battles.slaveVictories[_i].victories = 0>> $He brought your army to victory so many times that $his @@.green;prestige has increased.@@ <</if>> <</if>> @@ -1123,7 +1123,7 @@ <</for>> <<if _found == 0>> <<set _newSlave = {ID: $HeadGirlID, victories: 0}>> - <<set $slaveVictories.push(_newSlave)>> + <<set $SecExp.battles.slaveVictories.push(_newSlave)>> <</if>> <</if>> <<elseif $leadingTroops == "citizen">> diff --git a/src/Mods/SecExp/js/Unit.js b/src/Mods/SecExp/js/Unit.js index 76dc8ad2f35..77260493c86 100644 --- a/src/Mods/SecExp/js/Unit.js +++ b/src/Mods/SecExp/js/Unit.js @@ -178,31 +178,20 @@ App.SecExp.generateUnit = function(type) { */ App.SecExp.deployUnitMenu = function(input, type, count = 0) { let el = document.createElement("div"), options = document.createElement("div"); + const canDeploy = input.isDeployed === 0 && App.SecExp.battle.deployableUnits() > 0; if (input.active === 1 && input.troops > 0) { if (type === "bots") { $(el).append(App.SecExp.getUnit("Bots").describe()); - } else if (type === "slaves") { - $(el).append(App.SecExp.getUnit("Slaves", count).describe()); - } else if (type === "militia") { - $(el).append(App.SecExp.getUnit("Militia", count).describe()); - } else if (type === "mercs") { - $(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(App.SecExp.getUnit(capFirstChar(type), count).describe()); } + options = document.createElement("div"); + options.append(App.UI.DOM.link(`${canDeploy ? 'Deploy' : 'Remove'} the unit`, () => { + input.isDeployed = canDeploy ? 1 : 0; V.saveValid = 0; + }, + [], passage() + )); } el.append(options); return el; diff --git a/src/Mods/SecExp/js/buildingsJS.js b/src/Mods/SecExp/js/buildingsJS.js index 0f38e300498..17d2c374426 100644 --- a/src/Mods/SecExp/js/buildingsJS.js +++ b/src/Mods/SecExp/js/buildingsJS.js @@ -120,7 +120,7 @@ App.SecExp.weapManuUpgrade = (function() { if (!V.SecExp.buildings.weapManu.upgrades.completed.includes(x)) { for (let i = 0; i < V.SecExp.buildings.weapManu.upgrades.queue.length; i++) { if (V.SecExp.buildings.weapManu.upgrades.queue[i].ID === x) { - found = [i]; break; + found = i; break; } } const item = current(x), time = Math.ceil(baseTime() / V.SecExp.buildings.weapManu.productivity); @@ -154,7 +154,7 @@ App.SecExp.weapManuUpgrade = (function() { } function fully() { - const human = [0, 1, 2, 3, 4, 5] + (V.SF.Toggle && V.SF.Active >= 1 ? [,6, 7, 8] : []); + const human = (V.SF.Toggle && V.SF.Active >= 1) ? [0, 1, 2, 3, 4, 5, 6, 7, 8] : [0, 1, 2, 3, 4, 5]; return { human: V.SecExp.buildings.weapManu.upgrades.completed.includesAll(human), bots: V.SecExp.buildings.weapManu.upgrades.completed.includesAll(-1, -2, -3), diff --git a/src/Mods/SecExp/js/secExp.js b/src/Mods/SecExp/js/secExp.js index ac9fa94738e..d22540af592 100644 --- a/src/Mods/SecExp/js/secExp.js +++ b/src/Mods/SecExp/js/secExp.js @@ -23,13 +23,13 @@ App.SecExp.generalInit = function(){ Object.assign(V.SecExp, { battles: { major: 0, - // slaveVictories : [], + slaveVictories : [], victories: 0, - // victoryStreak: 0, + victoryStreak: 0, losses: 0, - // lossStreak: 0, + lossStreak: 0, lastEncounterWeeks: 0, - // saved: {} + saved: {} }, rebellions: { tension: 0, diff --git a/src/Mods/SecExp/js/secExpBC.js b/src/Mods/SecExp/js/secExpBC.js index 24d99891491..2fb8117f3f5 100644 --- a/src/Mods/SecExp/js/secExpBC.js +++ b/src/Mods/SecExp/js/secExpBC.js @@ -178,7 +178,7 @@ App.SecExp.generalBC = function() { } V.SecExp.battles = V.SecExp.battles || {}; - // V.SecExp.battles.slaveVictories = V.SecExp.battles.slaveVictories || V.slaveVictories || []; + V.SecExp.battles.slaveVictories = V.SecExp.battles.slaveVictories || V.slaveVictories || []; V.SecExp.battles.major = V.SecExp.battles.major || 0; if (jsDef(V.majorBattlesCount)) { if (V.majorBattlesCount === 0 && V.hasFoughtMajorBattleOnce === 1) { @@ -188,14 +188,14 @@ App.SecExp.generalBC = function() { } } V.SecExp.battles.victories = V.SecExp.battles.victories || V.PCvictories || 0; - // V.SecExp.battles.victoryStreak = V.SecExp.battles.victoryStreak || V.PCvictoryStreak || 0; + V.SecExp.battles.victoryStreak = V.SecExp.battles.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.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.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; -- GitLab