From 2696569c715b42026c505ed9a3ada3c46f51beca Mon Sep 17 00:00:00 2001 From: Svornost <11434-svornost@users.noreply.gitgud.io> Date: Sun, 28 Jun 2020 16:41:39 -0700 Subject: [PATCH] Remove rebellingUnits, rebellingMilitia, rebellingMercs, rebellingSlaves, and slaveIncreasedPrestige global variables. --- js/003-data/gameVariableData.js | 5 ----- src/Mods/SecExp/SecExpBackwardCompatibility.tw | 15 --------------- src/Mods/SecExp/attackReport.tw | 11 ++--------- src/Mods/SecExp/rebellionHandler.tw | 14 +++++++------- 4 files changed, 9 insertions(+), 36 deletions(-) diff --git a/js/003-data/gameVariableData.js b/js/003-data/gameVariableData.js index 2e263adb019..6ae89e11698 100644 --- a/js/003-data/gameVariableData.js +++ b/js/003-data/gameVariableData.js @@ -461,12 +461,8 @@ App.Data.resetOnNGPlus = { citizenRebellionEventFires: 0, slaveRebellion: 0, citizenRebellion: 0, - rebellingUnits: [], engageRule: 0, irregulars: 0, - rebellingMilitia: 0, - rebellingSlaves: 0, - rebellingMercs: 0, repairTime: 3, arcRepairTime: 0, garrison: {}, @@ -493,7 +489,6 @@ App.Data.resetOnNGPlus = { /* battle relevant vars */ slaveVictories: [], - slaveIncreasedPrestige: 0, totalKills: 0, battlesCount: 0, majorBattlesCount: 0, diff --git a/src/Mods/SecExp/SecExpBackwardCompatibility.tw b/src/Mods/SecExp/SecExpBackwardCompatibility.tw index 08918c7a8be..1be97c1e455 100644 --- a/src/Mods/SecExp/SecExpBackwardCompatibility.tw +++ b/src/Mods/SecExp/SecExpBackwardCompatibility.tw @@ -404,24 +404,12 @@ <<if ndef $citizenRebellion>> <<set $citizenRebellion = 0>> <</if>> -<<if ndef $rebellingUnits>> - <<set $rebellingUnits = []>> -<</if>> <<if ndef $engageRule>> <<set $engageRule = 0>> <</if>> <<if ndef $irregulars>> <<set $irregulars = 0>> <</if>> -<<if ndef $rebellingMilitia>> - <<set $rebellingMilitia = 0>> -<</if>> -<<if ndef $rebellingSlaves>> - <<set $rebellingSlaves = 0>> -<</if>> -<<if ndef $rebellingMercs>> - <<set $rebellingMercs = 0>> -<</if>> <<if ndef $repairTime>> <<set $repairTime = 3>> <</if>> @@ -527,9 +515,6 @@ <<if ndef $slaveVictories>> <<set $slaveVictories = []>> <</if>> -<<if ndef $slaveIncreasedPrestige>> - <<set $slaveIncreasedPrestige = 0>> -<</if>> <<if ndef $totalKills>> <<set $totalKills = 0>> <</if>> diff --git a/src/Mods/SecExp/attackReport.tw b/src/Mods/SecExp/attackReport.tw index b89024af670..3d92154f759 100644 --- a/src/Mods/SecExp/attackReport.tw +++ b/src/Mods/SecExp/attackReport.tw @@ -976,7 +976,7 @@ <<set $slaves[_j].prestigeDesc = "$He is known as a legendary commander all over the world.">> <</if>> <<set $slaveVictories[_i].victories = 0>> - <<set $slaveIncreasedPrestige = 1>> + $He brought your army to victory so many times that $his @@.green;prestige has increased.@@ <</if>> <</if>> <<break>> @@ -987,9 +987,6 @@ <<set $slaveVictories.push(_newSlave)>> <</if>> <</if>> - <<if $slaveIncreasedPrestige == 1>> - $He brought your army to victory so many times that $his @@.green;prestige has increased.@@ - <</if>> <<elseif $leadingTroops == "headGirl">> <<setLocalPronouns $HeadGirl>> <<if $auto == 1>>$assistant.name<<else>>You<</if>> decided it will be your Head Girl that leads the troops. @@ -1113,7 +1110,7 @@ <<set $slaves[_j].prestigeDesc = "$He is known as a legendary commander all over the world.">> <</if>> <<set $slaveVictories[_i].victories = 0>> - <<set $slaveIncreasedPrestige = 1>> + $He brought your army to victory so many times that $his @@.green;prestige has increased.@@ <</if>> <</if>> <<break>> @@ -1124,9 +1121,6 @@ <<set $slaveVictories.push(_newSlave)>> <</if>> <</if>> - <<if $slaveIncreasedPrestige == 1>> - $He brought your army to victory so many times that $his @@.green;prestige has increased.@@ - <</if>> <<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">> @@ -1506,7 +1500,6 @@ <<run delete $bribeCost>> <<set $leaderWounded = 0>> <<set $gainedWarfare = 0>> -<<set $slaveIncreasedPrestige = 0>> <<set $woundType = 0>> <<set $tacticsSuccessful = 0>> <<set $attackType = "none">> diff --git a/src/Mods/SecExp/rebellionHandler.tw b/src/Mods/SecExp/rebellionHandler.tw index 18e30661da3..ae14f8f02cc 100644 --- a/src/Mods/SecExp/rebellionHandler.tw +++ b/src/Mods/SecExp/rebellionHandler.tw @@ -138,10 +138,10 @@ <<set _armyMod = Math.trunc(_armyMod)>> <<if $slaveRebellion == 1>> - <<set $rebellingSlaves = 1>> + <<set _rebellingSlaves = 1>> <<set _unit = App.SecExp.getIrregularUnit("Slaves", $attackTroops, $attackEquip)>> <<else>> - <<set $rebellingMilitia = 1>> + <<set _rebellingMilitia = 1>> <<set _unit = App.SecExp.getIrregularUnit("Militia", $attackTroops, $attackEquip)>> <</if>> <<set _enemyAttack += _unit.attack * _armyMod>> @@ -150,7 +150,7 @@ <<for _i = 0; _i < $militiaUnits.length; _i++>> <<if $militiaUnits[_i].active == 1 && $rebellingID.includes($militiaUnits[_i].ID)>> - <<set $rebellingMilitia = 1>> + <<set _rebellingMilitia = 1>> <<set $attackTroops += $militiaUnits[_i].troops>> <<set $militiaUnits[_i].loyalty = 0>> <<set _unit = App.SecExp.getUnit("Militia", _i)>> @@ -161,7 +161,7 @@ <</for>> <<for _i = 0; _i < $slaveUnits.length; _i++>> <<if $slaveUnits[_i].active == 1 && $rebellingID.includes($slaveUnits[_i].ID)>> - <<set $rebellingSlaves = 1>> + <<set _rebellingSlaves = 1>> <<set $attackTroops += $slaveUnits[_i].troops>> <<set $slaveUnits[_i].loyalty = 0>> <<set _unit = App.SecExp.getUnit("Slaves", _i)>> @@ -172,7 +172,7 @@ <</for>> <<for _i = 0; _i < $mercUnits.length; _i++>> <<if $mercUnits[_i].active == 1 && $rebellingID.includes($mercUnits[_i].ID)>> - <<set $rebellingMercs = 1>> + <<set _rebellingMercs = 1>> <<set $attackTroops += $mercUnits[_i].troops>> <<set $mercUnits[_i].loyalty = 0>> <<set _unit = App.SecExp.getUnit("Mercs", _i)>> @@ -184,9 +184,9 @@ <<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 = 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)>> +<<set _enemyBaseHp = (App.SecExp.BaseMilitiaUnit.hp * _rebellingMilitia + App.SecExp.BaseSlaveUnit.hp * _rebellingSlaves + App.SecExp.BaseMercUnit.hp * _rebellingMercs) / (_rebellingMilitia + _rebellingSlaves + _rebellingMercs)>> <<if isNaN(_attack)>> <br>@@.red;Error: attack value reported NaN@@ -- GitLab