diff --git a/js/003-data/gameVariableData.js b/js/003-data/gameVariableData.js index 807375a16cf216d8417393f21aff147aa21b0768..96c74c650b51b1197f6b7eea42fc6b051306beb9 100644 --- a/js/003-data/gameVariableData.js +++ b/js/003-data/gameVariableData.js @@ -517,7 +517,6 @@ App.Data.resetOnNGPlus = { gainedWarfare: 0, SFIntervention: 0, rebellingID: [], - loyalID: [], saveValid: 0, lastSelection: [], diff --git a/src/Mods/SecExp/js/secExp.js b/src/Mods/SecExp/js/secExp.js index a739c0e6192ea9c13dc460d49ffec937b713aa23..67defdae1fa91fa53edc3d464493094c751bcb80 100644 --- a/src/Mods/SecExp/js/secExp.js +++ b/src/Mods/SecExp/js/secExp.js @@ -169,9 +169,9 @@ App.SecExp.conflict = (function() { militiaC++; } - militiaC += V.militiaUnits.filter((u) => u.active === 1 && V.loyalID.includes(u.ID)).length; - slavesC += V.slaveUnits.filter((u) => u.active === 1 && V.loyalID.includes(u.ID)).length; - mercsC += V.mercUnits.filter((u) => u.active === 1 && V.loyalID.includes(u.ID)).length; + militiaC += V.militiaUnits.filter((u) => u.active === 1 && !V.rebellingID.includes(u.ID)).length; + slavesC += V.slaveUnits.filter((u) => u.active === 1 && !V.rebellingID.includes(u.ID)).length; + mercsC += V.mercUnits.filter((u) => u.active === 1 && !V.rebellingID.includes(u.ID)).length; } if(input === '') { @@ -220,7 +220,7 @@ App.SecExp.conflict = (function() { if (V.secBots.active === 1) { troops += V.secBots.troops; } - countHumanTroops((u) => u.active === 1 && V.loyalID.includes(u.ID)); + countHumanTroops((u) => u.active === 1 && !V.rebellingID.includes(u.ID)); if (V.SF.Toggle && V.SF.Active >= 1) { troops += App.SecExp.troopsFromSF(); } diff --git a/src/Mods/SecExp/rebellionGenerator.tw b/src/Mods/SecExp/rebellionGenerator.tw index cb17b7b64985b00b84490a19aa7287f10395511f..2f52477998af4229265376c60d9230666de7485c 100644 --- a/src/Mods/SecExp/rebellionGenerator.tw +++ b/src/Mods/SecExp/rebellionGenerator.tw @@ -288,10 +288,7 @@ <</if>> /* resetting ID list */ -<<unset $rebellingID>> <<set $rebellingID = []>> -<<unset $loyalID>> -<<set $loyalID = []>> /* if a rebellion fires determine amount of rebels and rebelling units */ <<if $slaveRebellion == 1>> @@ -323,9 +320,6 @@ <<set $rebellingID.push($slaveUnits[_i].ID)>> <</if>> <</if>> - <<if !($rebellingID.includes($slaveUnits[_i].ID))>> - <<set $loyalID.push($slaveUnits[_i].ID)>> - <</if>> <</for>> <<for _i = 0; _i < $militiaUnits.length; _i++>> <<if $militiaUnits[_i].loyalty < 10>> @@ -341,9 +335,6 @@ <<set $rebellingID.push($militiaUnits[_i].ID)>> <</if>> <</if>> - <<if !($rebellingID.includes($militiaUnits[_i].ID))>> - <<set $loyalID.push($militiaUnits[_i].ID)>> - <</if>> <</for>> <<for _i = 0; _i < $mercUnits.length; _i++>> <<if $mercUnits[_i].loyalty < 10>> @@ -359,9 +350,6 @@ <<set $rebellingID.push($mercUnits[_i].ID)>> <</if>> <</if>> - <<if !($rebellingID.includes($mercUnits[_i].ID))>> - <<set $loyalID.push($mercUnits[_i].ID)>> - <</if>> <</for>> <<set $attackEquip = Math.clamp($weaponsLaw + random(-2,1),0,4)>> <<elseif $citizenRebellion == 1>> @@ -393,9 +381,6 @@ <<set $rebellingID.push($militiaUnits[_i].ID)>> <</if>> <</if>> - <<if !($rebellingID.includes($militiaUnits[_i].ID))>> - <<set $loyalID.push($militiaUnits[_i].ID)>> - <</if>> <</for>> <<for _i = 0; _i < $slaveUnits.length; _i++>> <<if $slaveUnits[_i].loyalty < 10>> @@ -411,9 +396,6 @@ <<set $rebellingID.push($slaveUnits[_i].ID)>> <</if>> <</if>> - <<if !($rebellingID.includes($slaveUnits[_i].ID))>> - <<set $loyalID.push($slaveUnits[_i].ID)>> - <</if>> <</for>> <<for _i = 0; _i < $mercUnits.length; _i++>> <<if $mercUnits[_i].loyalty < 10>> @@ -429,9 +411,6 @@ <<set $rebellingID.push($mercUnits[_i].ID)>> <</if>> <</if>> - <<if !($rebellingID.includes($mercUnits[_i].ID))>> - <<set $loyalID.push($mercUnits[_i].ID)>> - <</if>> <</for>> <<set $attackEquip = Math.clamp($weaponsLaw + random(-1,1),0,4)>> <<else>> diff --git a/src/Mods/SecExp/rebellionHandler.tw b/src/Mods/SecExp/rebellionHandler.tw index 2682d53b923997f71f86cae2c302738f0a01d76b..a250c2910385e82ce53cd7fe6e7f875d1936f968 100644 --- a/src/Mods/SecExp/rebellionHandler.tw +++ b/src/Mods/SecExp/rebellionHandler.tw @@ -59,7 +59,7 @@ <</if>> <<for _i = 0; _i < $militiaUnits.length; _i++>> - <<if $militiaUnits[_i].active == 1 && $loyalID.includes($militiaUnits[_i].ID)>> + <<if $militiaUnits[_i].active == 1 && (!$rebellingID.includes($militiaUnits[_i].ID))>> <<set _unit = App.SecExp.getUnit("Militia", _i)>> <<set _attack += _unit.attack>> <<set _defense += _unit.defense>> @@ -67,7 +67,7 @@ <</if>> <</for>> <<for _i = 0; _i < $slaveUnits.length; _i++>> - <<if $slaveUnits[_i].active == 1 && $loyalID.includes($slaveUnits[_i].ID)>> + <<if $slaveUnits[_i].active == 1 && (!$rebellingID.includes($slaveUnits[_i].ID))>> <<set _unit = App.SecExp.getUnit("Slaves", _i)>> <<set _attack += _unit.attack>> <<set _defense += _unit.defense>> @@ -75,7 +75,7 @@ <</if>> <</for>> <<for _i = 0; _i < $mercUnits.length; _i++>> - <<if $mercUnits[_i].active == 1 && $loyalID.includes($mercUnits[_i].ID)>> + <<if $mercUnits[_i].active == 1 && (!$rebellingID.includes($mercUnits[_i].ID))>> <<set _unit = App.SecExp.getUnit("Mercs", _i)>> <<set _attack += _unit.attack>> <<set _defense += _unit.defense>> diff --git a/src/Mods/SecExp/rebellionOptions.tw b/src/Mods/SecExp/rebellionOptions.tw index 8e7da9e0b9fff123a19a2ac5890864954295d233..217ea1b5c755c6f90bc6dffe2c5423d84f0bc3c3 100644 --- a/src/Mods/SecExp/rebellionOptions.tw +++ b/src/Mods/SecExp/rebellionOptions.tw @@ -63,14 +63,15 @@ betrayed you and joined the insurrection. <</if>> <<set _count = 0>> - <<if $loyalID.length > 0>> + <<set _loyalUnits = $militiaUnits.length + $slaveUnits.length + $mercUnits.length - $rebellingID.length>> + <<if _loyalUnits > 0>> <br> <br> <<if $arcologyUpgrade.drones == 1>>Your security drones,<</if>> <<for _i = 0; _i < $militiaUnits.length; _i++>> - <<if $militiaUnits[_i].active == 1 && ($loyalID.includes($militiaUnits[_i].ID))>> + <<if $militiaUnits[_i].active == 1 && (!$rebellingID.includes($militiaUnits[_i].ID))>> <<set _count++>> - <<if _count < $loyalID.length>> + <<if _count < _loyalUnits>> $militiaUnits[_i].platoonName, <<else>> $militiaUnits[_i].platoonName @@ -78,9 +79,9 @@ <</if>> <</for>> <<for _i = 0; _i < $slaveUnits.length; _i++>> - <<if $slaveUnits[_i].active == 1 && ($loyalID.includes($slaveUnits[_i].ID))>> + <<if $slaveUnits[_i].active == 1 && (!$rebellingID.includes($slaveUnits[_i].ID))>> <<set _count++>> - <<if _count < $loyalID.length>> + <<if _count < _loyalUnits>> $slaveUnits[_i].platoonName, <<else>> $slaveUnits[_i].platoonName @@ -88,16 +89,16 @@ <</if>> <</for>> <<for _i = 0; _i < $mercUnits.length; _i++>> - <<if $mercUnits[_i].active == 1 && ($loyalID.includes($mercUnits[_i].ID))>> + <<if $mercUnits[_i].active == 1 && (!$rebellingID.includes($mercUnits[_i].ID))>> <<set _count++>> - <<if _count < $loyalID.length>> + <<if _count < _loyalUnits>> $mercUnits[_i].platoonName, <<else>> $mercUnits[_i].platoonName <</if>> <</if>> <</for>> - <<if $SF.Toggle && $SF.Active >= 1>>and $SF.Lower, <<print num($SF.ArmySize)>> strong<</if>> + <<if $SF.Toggle && $SF.Active >= 1>>and $SF.Lower, <<print num($SF.ArmySize)>> strong<</if>> are called to defend the arcology from this menace. <<else>> <<if $arcologyUpgrade.drones == 1>>Your security drones<<if $SF.Toggle && $SF.Active >= 1>>and $SF.Lower, <<print num($SF.ArmySize)>> strong<</if>> <</if>> @@ -159,13 +160,14 @@ <</if>> <br> <<set _count = 0>> - <<if $loyalID.length > 0>> + <<set _loyalUnits = $militiaUnits.length + $slaveUnits.length + $mercUnits.length - $rebellingID.length>> + <<if _loyalUnits > 0>> <br> <<if $arcologyUpgrade.drones == 1>>Your security drones,<</if>> <<for _i = 0; _i < $militiaUnits.length; _i++>> - <<if $militiaUnits[_i].active == 1 && ($loyalID.includes($militiaUnits[_i].ID))>> + <<if $militiaUnits[_i].active == 1 && (!$rebellingID.includes($militiaUnits[_i].ID))>> <<set _count++>> - <<if _count < $loyalID.length>> + <<if _count < _loyalUnits>> $militiaUnits[_i].platoonName, <<else>> $militiaUnits[_i].platoonName @@ -173,9 +175,9 @@ <</if>> <</for>> <<for _i = 0; _i < $slaveUnits.length; _i++>> - <<if $slaveUnits[_i].active == 1 && ($loyalID.includes($slaveUnits[_i].ID))>> + <<if $slaveUnits[_i].active == 1 && (!$rebellingID.includes($slaveUnits[_i].ID))>> <<set _count++>> - <<if _count < $loyalID.length>> + <<if _count < _loyalUnits>> $slaveUnits[_i].platoonName, <<else>> $slaveUnits[_i].platoonName @@ -183,9 +185,9 @@ <</if>> <</for>> <<for _i = 0; _i < $mercUnits.length; _i++>> - <<if $mercUnits[_i].active == 1 && ($loyalID.includes($mercUnits[_i].ID))>> + <<if $mercUnits[_i].active == 1 && (!$rebellingID.includes($mercUnits[_i].ID))>> <<set _count++>> - <<if _count < $loyalID.length>> + <<if _count < _loyalUnits>> $mercUnits[_i].platoonName, <<else>> $mercUnits[_i].platoonName diff --git a/src/Mods/SecExp/unitsRebellionReport.tw b/src/Mods/SecExp/unitsRebellionReport.tw index 73534c482ef5add94aecacca3146bb4e3437b63c..e4586ae34de5519c12191c561df2cac703ce7879 100644 --- a/src/Mods/SecExp/unitsRebellionReport.tw +++ b/src/Mods/SecExp/unitsRebellionReport.tw @@ -12,13 +12,14 @@ <br>$SF.Lower, <<print num($SF.ArmySize)>> strong, was called to join the battle: no casualties suffered. <</if>> <<set _count = 0>> - <<if $loyalID.length > 0>> + <<set _loyalUnits = $militiaUnits.length + $slaveUnits.length + $mercUnits.length - $rebellingID.length>> + <<if _loyalUnits > 0>> <br> <<for _i = 0; _i < $militiaUnits.length; _i++>> - <<if $militiaUnits[_i].active == 1 && ($loyalID.includes($militiaUnits[_i].ID))>> + <<if $militiaUnits[_i].active == 1 && (!$rebellingID.includes($militiaUnits[_i].ID))>> <<set $militiaUnits[_i].battlesFought++>> <<set _count++>> - <<if _count < $loyalID.length>> + <<if _count < _loyalUnits>> $militiaUnits[_i].platoonName, <<else>> $militiaUnits[_i].platoonName @@ -26,10 +27,10 @@ <</if>> <</for>> <<for _i = 0; _i < $slaveUnits.length; _i++>> - <<if $slaveUnits[_i].active == 1 && ($loyalID.includes($slaveUnits[_i].ID))>> + <<if $slaveUnits[_i].active == 1 && (!$rebellingID.includes($slaveUnits[_i].ID))>> <<set $slaveUnits[_i].battlesFought++>> <<set _count++>> - <<if _count < $loyalID.length>> + <<if _count < _loyalUnits>> $slaveUnits[_i].platoonName, <<else>> $slaveUnits[_i].platoonName @@ -37,10 +38,10 @@ <</if>> <</for>> <<for _i = 0; _i < $mercUnits.length; _i++>> - <<if $mercUnits[_i].active == 1 && ($loyalID.includes($mercUnits[_i].ID))>> + <<if $mercUnits[_i].active == 1 && (!$rebellingID.includes($mercUnits[_i].ID))>> <<set $mercUnits[_i].battlesFought++>> <<set _count++>> - <<if _count < $loyalID.length>> + <<if _count < _loyalUnits>> $mercUnits[_i].platoonName, <<else>> $mercUnits[_i].platoonName @@ -176,7 +177,7 @@ <</if>> <<if App.SecExp.conflict.deployedUnits('militia') >= 1>> <<for _j = 0; _j < $militiaUnits.length; _j++>> - <<if $militiaUnits[_j].active == 1 && $loyalID.includes($militiaUnits[_j].ID)>> + <<if $militiaUnits[_j].active == 1 && !$rebellingID.includes($militiaUnits[_j].ID)>> <br><br> <<set $militiaUnits[_j].battlesFought++>> <<set _loss = _lossesList.pluck()>> @@ -218,7 +219,7 @@ <<if App.SecExp.conflict.deployedUnits('slaves') >= 1>> <<set _med = 0>> <<for _j = 0; _j < $slaveUnits.length; _j++>> - <<if $slaveUnits[_j].active == 1 && $loyalID.includes($slaveUnits[_j].ID)>> + <<if $slaveUnits[_j].active == 1 && !$rebellingID.includes($slaveUnits[_j].ID)>> <br><br> <<set $slaveUnits[_j].battlesFought++>> <<set _loss = _lossesList.pluck()>> @@ -263,7 +264,7 @@ <</if>> <<if App.SecExp.conflict.deployedUnits('mercs') >= 1>> <<for _j = 0; _j < $mercUnits.length; _j++>> - <<if $mercUnits[_j].active == 1 && $loyalID.includes($mercUnits[_j].ID)>> + <<if $mercUnits[_j].active == 1 && !$rebellingID.includes($mercUnits[_j].ID)>> <br><br> <<set $mercUnits[_j].battlesFought++>> <<set _loss = _lossesList.pluck()>>