From f9770a0f0e6592dbd33436f1da8cf8518610c7e9 Mon Sep 17 00:00:00 2001 From: hexall90 <hexall90@gmail.com> Date: Tue, 7 Nov 2017 12:50:09 +0100 Subject: [PATCH] fixes and loyalty --- TODO.txt | 10 +- src/SecExp/SecExpBackwardCompatibility.tw | 18 ++- src/SecExp/attackReport.tw | 31 ++-- src/SecExp/edicts.tw | 89 +++++++++++ src/SecExp/secBarracks.tw | 50 ++++++- src/SecExp/secInit.tw | 7 +- src/SecExp/securityReport.tw | 170 +++++++++++++--------- src/SecExp/seeUnit.tw | 69 +++++++++ src/SecExp/unitsBattleReport.tw | 2 +- src/SecExp/widgets/miscSecExpWidgets.tw | 28 ++++ src/SecExp/widgets/unitsWidgets.tw | 21 +++ src/uncategorized/arcmgmt.tw | 6 +- src/uncategorized/manageArcology.tw | 4 +- src/uncategorized/nonRandomEvent.tw | 2 - 14 files changed, 410 insertions(+), 97 deletions(-) diff --git a/TODO.txt b/TODO.txt index d2849749bb4..1d5e18f4035 100644 --- a/TODO.txt +++ b/TODO.txt @@ -2,11 +2,13 @@ Main: -finish recalc widgets Rebellions: --citizens rebellions --riot control center +-citizens mini events -add security maluses to losses --add to unit descriptions loyalty description --options of what to do with the rebels +-soldiers wages edict +-privileges for soldiers edicts + -slave slodiers can hold property + -militia can avoid rent + -mercs can get battle loot further development: -specialized slave schools diff --git a/src/SecExp/SecExpBackwardCompatibility.tw b/src/SecExp/SecExpBackwardCompatibility.tw index 01a3109e398..3fdac1289d0 100644 --- a/src/SecExp/SecExpBackwardCompatibility.tw +++ b/src/SecExp/SecExpBackwardCompatibility.tw @@ -182,6 +182,18 @@ <<if ndef $weaponsLaw || $wasToggledBefore == 1>> <<set $weaponsLaw = 3>> <</if>> +<<if ndef $soldierWages>> +<<set $soldierWages = 1>> +<</if>> +<<if ndef $militiaSoldierPrivilege>> +<<set $militiaSoldierPrivilege = 0>> +<</if>> +<<if ndef $slaveSoldierPrivilege>> +<<set $slaveSoldierPrivilege = 0>> +<</if>> +<<if ndef $mercSoldierPrivilege>> +<<set $mercSoldierPrivilege = 0>> +<</if>> /* buildings */ <<if ndef $secHQ>> @@ -194,7 +206,11 @@ <<set $secBarracksUpgrades ={ size: 0, luxury: 0, - training: 0}>> + training: 0, + loyaltyMod:0 }>> +<</if>> +<<if ndef $secBarracksUpgrades.loyaltyMod>> +<<set $secBarracksUpgrades.loyaltyMod = 0>> <</if>> <<if ndef $secHelots>> <<set $secHelots = 0>> diff --git a/src/SecExp/attackReport.tw b/src/SecExp/attackReport.tw index 3ae15cf2852..a4860db8cf5 100644 --- a/src/SecExp/attackReport.tw +++ b/src/SecExp/attackReport.tw @@ -417,20 +417,26 @@ and some of their equipment, which once sold produced <<if $attackEquip == 0>> @@.yellowgreen;a small amount of cash.@@ - <<set $cash += 1000 * _majorBattleMod>> + <<set _loot += 1000 * _majorBattleMod>> <<elseif $attackEquip == 1>> @@.yellowgreen;a moderate amount of cash.@@ - <<set $cash += 5000 * _majorBattleMod>> + <<set _loot += 5000 * _majorBattleMod>> <<elseif $attackEquip == 2>> @@.yellowgreen;a good amount of cash.@@ - <<set $cash += 10000 * _majorBattleMod>> + <<set _loot += 10000 * _majorBattleMod>> <<elseif $attackEquip == 3>> @@.yellowgreen;a great amount of cash.@@ - <<set $cash += 15000 * _majorBattleMod>> + <<set _loot += 15000 * _majorBattleMod>> <<elseif $attackEquip == 4>> @@.yellowgreen;wealth worthy of the mightiest warlord.@@ - <<set $cash += 20000 * _majorBattleMod>> + <<set _loot += 20000 * _majorBattleMod>> <</if>> + <<if $mercSoldierPrivilege == 1 && $deployingMercs == 1>> + Part of the loot is distributed to your mercenaries. + <<set _captives = Math.trunc(_captives * 0.6)>> + <<set _loot = Math.trunc(_loot * 0.6)>> + <</if>> + <<set $cash += _loot>> <br> 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. <<set $cash -= 1000 * _majorBattleMod>> @@ -499,20 +505,25 @@ which once sold produced <<if $attackEquip == 0>> @@.yellowgreen;a bit of cash.@@ - <<set $cash += 500 * _majorBattleMod>> + <<set _loot += 500 * _majorBattleMod>> <<elseif $attackEquip == 1>> @@.yellowgreen;a small amount of cash.@@ - <<set $cash += 2500 * _majorBattleMod>> + <<set _loot += 2500 * _majorBattleMod>> <<elseif $attackEquip == 2>> @@.yellowgreen;a moderate amount of cash.@@ - <<set $cash += 5000 * _majorBattleMod>> + <<set _loot += 5000 * _majorBattleMod>> <<elseif $attackEquip == 3>> @@.yellowgreen;a good amount of cash.@@ - <<set $cash += 7500 * _majorBattleMod>> + <<set _loot += 7500 * _majorBattleMod>> <<elseif $attackEquip == 4>> @@.yellowgreen;a great amount of cash.@@ - <<set $cash += 10000 * _majorBattleMod>> + <<set _loot += 10000 * _majorBattleMod>> + <</if>> + <<if $mercSoldierPrivilege == 1 && $deployingMercs == 1>> + Part of the loot is distributed to your mercenaries. + <<set _loot = Math.trunc(_loot * 0.6)>> <</if>> + <<set $cash += _loot>> <br> Damage to the city was @@.red;limited@@, it won't take much to rebuild. Very few citizens or slaves were involved in the fight and even fewer met their end, safeguarding the prosperity of the arcology. <<set $cash -= 2000 * _majorBattleMod>> diff --git a/src/SecExp/edicts.tw b/src/SecExp/edicts.tw index 734211ec42b..d1a28303988 100644 --- a/src/SecExp/edicts.tw +++ b/src/SecExp/edicts.tw @@ -80,6 +80,16 @@ <<if $hasFoughtOnce == 1>> <br><br>__Defense Force:__ + <<if $soldierWages == 0>> + <br>''Low wages for soldiers:'' wages for soldiers are set to a low amount compared to market standards. + [[Repeal|edicts][$soldierWages = 1]] + <<elseif $soldierWages == 1>> + <br>''Average wages for soldiers:'' wages for soldiers are set to to the market standards. + <<else>> + <br>''High wages for soldiers:'' wages for soldiers are set to a high amount compared to market standards. + [[Repeal|edicts][$soldierWages = 1]] + <</if>> + <<if $slavesOfficers == 1>> <br>''Slave Officers:'' your trusted slaves are allowed to lead the defense forces of the arcology. [[Repeal|edicts][$slavesOfficers = 0, $edictsAuthUpkeep -= 10]] @@ -127,6 +137,21 @@ <</if>> <</if>> + <<if $militiaSoldierPrivilege == 1>> + <br>''Special militia privileges:'' citizens joining the militia are exempt from rent payment. + [[Repeal|edicts][$militiaSoldierPrivilege = 0]] + <</if>> + + <<if $slaveSoldierPrivilege == 1>> + <br>''Special slaves privileges:'' Slaves into the army are allowed to have material possessions. + [[Repeal|edicts][$slaveSoldierPrivilege = 0, $edictsAuthUpkeep -= 10]] + <</if>> + + <<if $mercSoldierPrivilege == 1>> + <br>''Special mercenary privileges:'' Mercenaries under contract can claim part of the loot gained from battles. + [[Repeal|edicts][$mercSoldierPrivilege = 0]] + <</if>> + <<if $martialSchool == 1>> <br>''@@.lime;Slave martial schools:@@'' specialized schools are training slaves in martial arts and bodyguarding. [[Repeal|edicts][$martialSchool = 0, $edictsUpkeep -= 1000, $slaveBaseMorale -= 5]] @@ -350,6 +375,40 @@ <<if $hasFoughtOnce == 1 || $mercenaries > 0>> <br><br>__Defense Force__: + + <<if $soldierWages == 0>> + <br>''Average wages for soldiers:'' will set the wages paid to the soldiers of the arcology to an average amount. + <<if $authority >= 1000>> + [[Implement|edicts][$soldierWages += 1, $cash -=5000, $authority -= 1000]] + <<else>> + <br>//Not enough Authority.// + <</if>> + <br> //Will raise all units upkeep and loyalty to average levels.// + <<elseif $soldierWages == 1>> + <br>''Low wages for soldiers:'' will set the wages paid to the soldiers of the arcology to a low amount. + <<if $authority >= 1000>> + [[Implement|edicts][$soldierWages -= 1, $cash -=5000, $authority -= 1000]] + <<else>> + <br>//Not enough Authority.// + <</if>> + <br> //Will lower all units upkeep and loyalty to low levels.// + <br>''Average wages for soldiers:'' will set the wages paid to the soldiers of the arcology to a high amount. + <<if $authority >= 1000>> + [[Implement|edicts][$soldierWages += 1, $cash -=5000, $authority -= 1000]] + <<else>> + <br>//Not enough Authority.// + <</if>> + <br> //Will raise all units upkeep and loyalty to high levels.// + <<else>> + <br>''Average wages for soldiers:'' will set the wages paid to the soldiers of the arcology to an average amount. + <<if $authority >= 1000>> + [[Implement|edicts][$soldierWages -= 1, $cash -=5000, $authority -= 1000]] + <<else>> + <br>//Not enough Authority.// + <</if>> + <br> //Will lower all units upkeep and loyalty to average levels.// + <</if>> + <<if $slavesOfficers == 0>> <br>''Slave Officers:'' allow your trusted slaves to lead the defense forces of the arcology. <<if $authority >= 1000>> @@ -467,6 +526,36 @@ <</if>> <</if>> + <<if $militiaSoldierPrivilege == 0>> + <br>''Special militia privileges'' will give the privilege to citizens joining the militia of avoiding paying rent. + <<if $authority >= 1000>> + [[Implement|edicts][$militiaSoldierPrivilege = 1, $cash -=5000, $authority -= 1000]] + <<else>> + <br>//Not enough Authority.// + <</if>> + <br> //Will increase the loyalty of militia units, but will decrease rents.// + <</if>> + + <<if $slaveSoldierPrivilege == 0>> + <br>''Special slaves privileges'' will give the privilege to slaves drafted into the army of being able to have material possessions. + <<if $authority >= 1000>> + [[Implement|edicts][$slaveSoldierPrivilege = 1, $cash -=5000, $authority -= 1000, $edictsAuthUpkeep += 10]] + <<else>> + <br>//Not enough Authority.// + <</if>> + <br> //Will increase the loyalty of slave units, but will cost authority each week.// + <</if>> + + <<if $mercSoldierPrivilege == 0>> + <br>''Special mercenary privileges'' will give th privilege to mercenaries under contract to claim part of the loot gained from battles. + <<if $authority >= 1000>> + [[Implement|edicts][$mercSoldierPrivilege = 1, $cash -=5000, $authority -= 1000]] + <<else>> + <br>//Not enough Authority.// + <</if>> + <br> //Will increase the loyalty of mercenary units, but will cash and menial slaves gained from battles.// + <</if>> + <<if $arcologies[0].FSPhysicalIdealist >= 40>> <<if $martialSchool == 0>> <br>''@@.lime;Slave martial schools:@@'' specialized schools will be set up to train slaves in martial arts and bodyguarding. diff --git a/src/SecExp/secBarracks.tw b/src/SecExp/secBarracks.tw index cc1f75f0fed..6786c2c8157 100644 --- a/src/SecExp/secBarracks.tw +++ b/src/SecExp/secBarracks.tw @@ -32,6 +32,13 @@ While for many a sore sight in a free city, the barracks stand proud before you. <<else>> The training facility has been filled with specialized equipment and skilled trainers. <</if>> +<<if $secBarracksUpgrades.loyaltyMod == 0>> + The barracks lack an indocrination facility. +<<elseif $secBarracksUpgrades.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 $secBarracksUpgrades.size < 2>> @@ -102,6 +109,25 @@ While for many a sore sight in a free city, the barracks stand proud before you. <<else>> You have improved the training facility to the limit. <</if>> +<<if $secBarracksUpgrades.loyaltyMod == 0>> + <<link "Add an indoctrination facility to the barracks">> + <<set $secBarracksUpgrades.loyaltyMod += 1>> + <<set $cash -= 10000>> + <<set $secBarracksUpkeep += $upgradeUpkeep>> + <<goto "secBarracks">> + <</link>> + <br>//Costs ¤10000 and will raise minimum loyalty level of units by 1.// +<<elseif $secBarracksUpgrades.loyaltyMod == 1>> + <<link "Improve the indoctrination facility with advanced equipment and skilled personnel">> + <<set $secBarracksUpgrades.loyaltyMod += 1>> + <<set $cash -= 20000>> + <<set $secBarracksUpkeep += $upgradeUpkeep>> + <<goto "secBarracks">> + <</link>> + <br>//Costs ¤20000 and will raise minimum loyalty level of units by another 1 for a total of 2.// +<<else>> + You have improved the indocrination facility to the limit. +<</if>> <hr> __Units__ @@ -184,9 +210,11 @@ You are free to organize your menial slaves into fighting units. Currently you h maxTroops: $maxTroops, equip: 0, training: 0, - loyalty: 7, + loyalty: 3, + minLoyalty: 0, medics: 0, SF: 0, + commissars: 0, battlesFought: 0}>> <<set $slaveUnits.push(_newUnit)>> <<set $helots -= 30>> @@ -201,9 +229,11 @@ You are free to organize your menial slaves into fighting units. Currently you h maxTroops: $maxTroops, equip: 0, training: 0, - loyalty: 0, + loyalty: 3, + minLoyalty: 0, medics: 0, SF: 0, + commissars: 0, battlesFought: 0}>> <<set $slaveUnits.push(_newUnit)>> <<set $slavesEmployedManpower += _newUnit.troops>> @@ -341,9 +371,11 @@ __Militia__ maxTroops: $maxTroops, equip: 0, training: 0, - loyalty: 7, + loyalty: 3, + minLoyalty: 0, medics: 0, SF: 0, + commissars: 0, battlesFought: 0}>> <<set $militiaUnits.push(_newUnit)>> <<set $militiaFreeManpower -= 30>> @@ -358,9 +390,11 @@ __Militia__ maxTroops: $maxTroops, equip: 0, training: 0, - loyalty: 0, + loyalty: 3, + minLoyalty: 0, medics: 0, SF: 0, + commissars: 0, battlesFought: 0}>> <<set $militiaUnits.push(_newUnit)>> <<set $militiaEmployedManpower += _newUnit.troops>> @@ -499,9 +533,11 @@ __Mercenaries__ maxTroops: $maxTroops, equip: 0, training: 0, - loyalty: 7, + loyalty: 3, + minLoyalty: 0, medics: 0, SF: 0, + commissars: 0, battlesFought: 0}>> <<set $mercUnits.push(_newUnit)>> <<set $mercFreeManpower -= 30>> @@ -516,9 +552,11 @@ __Mercenaries__ maxTroops: $maxTroops, equip: 0, training: 0, - loyalty: 0, + loyalty: 3, + minLoyalty: 0, medics: 0, SF: 0, + commissars: 0, battlesFought: 0}>> <<set $mercUnits.push(_newUnit)>> <<set $mercEmployedManpower += _newUnit.troops>> diff --git a/src/SecExp/secInit.tw b/src/SecExp/secInit.tw index 9df7ab3674b..eb86b4110f5 100644 --- a/src/SecExp/secInit.tw +++ b/src/SecExp/secInit.tw @@ -64,6 +64,10 @@ <<set $ronin = 0>> <<set $sunTzu = 0>> <<set $weaponsLaw = 3>> +<<set $soldierWages = 1>> +<<set $militiaSoldierPrivilege = 0>> +<<set $slaveSoldierPrivilege = 0>> +<<set $mercSoldierPrivilege = 0>> /* buildings */ <<set $upgradeUpkeep = 40>> @@ -74,7 +78,8 @@ <<set $secBarracksUpgrades ={ size: 0, luxury: 0, - training: 0}>> + training: 0, + loyaltyMod: 0}>> <<set $secHelots = 0>> <<set $reqHelots = 20>> <<set $secUpgrades = { diff --git a/src/SecExp/securityReport.tw b/src/SecExp/securityReport.tw index 6619ae36908..385d1bafd06 100644 --- a/src/SecExp/securityReport.tw +++ b/src/SecExp/securityReport.tw @@ -384,76 +384,108 @@ <</if>> <</if>> - /* training */ - <<if $secBarracksUpgrades.training >= 1>> - <<if $secBarracksUpgrades.training == 1>> - <<set _sL = $slaveUnits.length>> - <<for _i = 0; _i < _sL; _i++>> - <<if $slaveUnits[_i].training < 100>> - <br>$slaveUnits[_i].platoonName is able to make use of the training facilities to better prepare its soldiers, slowing increasing their experience level. - <<set $slaveUnits[_i].training += random(2,4)>> - <</if>> - <</for>> - <<set _mL = $militiaUnits.length>> - <<for _i = 0; _i < _mL; _i++>> - <<if $militiaUnits[_i].training < 100>> - <br>$militiaUnits[_i].platoonName is able to make use of the training facilities to better prepare its soldiers, slowing increasing their experience level. - <<set $militiaUnits[_i].training += random(2,4)>> - <</if>> - <</for>> - <<set _meL = $mercUnits.length>> - <<for _i = 0; _i < _meL; _i++>> - <<if $mercUnits[_i].training < 100>> - <br>$mercUnits[_i].platoonName is able to make use of the training facilities to better prepare its soldiers, slowing increasing their experience level. - <<set $mercUnits[_i].training += random(2,4)>> - <</if>> - <</for>> - <<elseif $secBarracksUpgrades.training == 2>> - <<set _sL = $slaveUnits.length>> - <<for _i = 0; _i < _sL; _i++>> - <<if $slaveUnits[_i].training < 100>> - <br>$slaveUnits[_i].platoonName is able to make use of the training facilities to better prepare its soldiers, increasing their experience level. - <<set $slaveUnits[_i].training += random(3,5)>> - <</if>> - <</for>> - <<set _mL = $militiaUnits.length>> - <<for _i = 0; _i < _mL; _i++>> - <<if $militiaUnits[_i].training < 100>> - <br>$militiaUnits[_i].platoonName is able to make use of the training facilities to better prepare its soldiers, increasing their experience level. - <<set $militiaUnits[_i].training += random(3,5)>> - <</if>> - <</for>> - <<set _meL = $mercUnits.length>> - <<for _i = 0; _i < _meL; _i++>> - <<if $mercUnits[_i].training < 100>> - <br>$mercUnits[_i].platoonName is able to make use of the training facilities to better prepare its soldiers, increasing their experience level. - <<set $mercUnits[_i].training += random(4,6)>> - <</if>> - <</for>> - <<elseif $secBarracksUpgrades.training == 3>> - <<set _sL = $slaveUnits.length>> - <<for _i = 0; _i < _sL; _i++>> - <<if $slaveUnits[_i].training < 100>> - <br>$slaveUnits[_i].platoonName is able to make use of the training facilities to better prepare its soldiers, quickly increasing their experience level. - <<set $slaveUnits[_i].training += random(4,6)>> - <</if>> - <</for>> - <<set _mL = $militiaUnits.length>> - <<for _i = 0; _i < _mL; _i++>> - <<if $militiaUnits[_i].training < 100>> - <br>$militiaUnits[_i].platoonName is able to make use of the training facilities to better prepare its soldiers, quickly increasing their experience level. - <<set $militiaUnits[_i].training += random(4,6)>> - <</if>> - <</for>> - <<set _meL = $mercUnits.length>> - <<for _i = 0; _i < _meL; _i++>> - <<if $mercUnits[_i].training < 100>> - <br>$mercUnits[_i].platoonName is able to make use of the training facilities to better prepare its soldiers, quickly increasing their experience level. - <<set $mercUnits[_i].training += random(4,6)>> - <</if>> - <</for>> + /* loyalty and training */ + <<set _sL = $slaveUnits.length>> + <<for _i = 0; _i < _sL; _i++>> + <<if $slaveUnits[_i].minLoyalty < $secBarracksUpgrades.loyaltyMod + $slaveUnits[_i].commissars>> + <<set $slaveUnits[_i].minLoyalty = $secBarracksUpgrades.loyaltyMod + $slaveUnits[_i].commissars>> <</if>> - <</if>> + <<if $slaveUnits[_i].training < 100 && secBarracksUpgrades.training >= 1>> + <br>$slaveUnits[_i].platoonName is able to make use of the training facilities to better prepare its soldiers, slowing increasing their experience level. + <<set $slaveUnits[_i].training += random(2,4) * 1.5 * $secBarracksUpgrades.training>> + <</if>> + <<set _newLoyalty = $slaveUnits[_i].minLoyalty>> + <<if $soldierWages == 2>> + $slaveUnits[_i].platoonName greatly appreciate the generous wage given to them for their service as soldiers. Occasions to earn money for a slave are scarce after all. + <<set _newLoyalty++>> + <<elseif $soldierWages == 1>> + $slaveUnits[_i].platoonName 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. + <<set _newLoyalty += random(0,1)>> + <<else>> + $slaveUnits[_i].platoonName 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. + <<set _newLoyalty -= random(1)>> + <</if>> + <<if $slaveSoldierPrivilege == 1>> + Allowing them to hold material possessions earns you their devotion and loyalty. + <<set _newLoyalty += random(1,2)>> + <</if>> + <<if _newLoyalty > $slaveUnits[_i].loyalty>> + The loyalty of this unit @@.green;increased@@ this week. + <<elseif _newLoyalty == $slaveUnits[_i].loyalty>> + The loyalty of this unit @@.yellow;did not change@@ this week. + <<else>> + The loyalty of this unit @@.red;decreased@@ this week. + <</if>> + <<set $slaveUnits[_i].loyalty = Math.clamp(_newLoyalty,0,10)>> + <</for>> + <<set _mL = $militiaUnits.length>> + <<for _i = 0; _i < _mL; _i++>> + <<for _i = 0; _i < _sL; _i++>> + <<if $militiaUnits[_i].minLoyalty < $secBarracksUpgrades.loyaltyMod + $militiaUnits[_i].commissars>> + <<set $militiaUnits[_i].minLoyalty = $secBarracksUpgrades.loyaltyMod + $militiaUnits[_i].commissars>> + <</if>> + <<if $militiaUnits[_i].training < 100 && secBarracksUpgrades.training >= 1>> + <br>$militiaUnits[_i].platoonName is able to make use of the training facilities to better prepare its soldiers, slowing increasing their experience level. + <<set $militiaUnits[_i].training += random(2,4) * 1.5 * $secBarracksUpgrades.training>> + <</if>> + <<set _newLoyalty = $militiaUnits[_i].minLoyalty>> + <<if $soldierWages == 2>> + $militiaUnits[_i].platoonName greatly appreciate the generous wage given to them for their service as soldiers. They are proud to defend their homes while making a small fortune out of it. + <<set _newLoyalty += random(1,2)>> + <<elseif $soldierWages == 1>> + $militiaUnits[_i].platoonName appreciate the wage given to them for their service as soldiers, despite it being just adequate. They are proud to defend their homes, though at the cost of possible financial gains. + <<set _newLoyalty += random(0,1)>> + <<else>> + $militiaUnits[_i].platoonName do not appreciate the low wage given to them for their service as soldiers. Their sense of duty keeps them proud of their role as defenders of the arcology, but many do feel its financial weight. + <<set _newLoyalty -= random(1,2)>> + <</if>> + <<if $militiaSoldierPrivilege == 1>> + Allowing them to avoid rent payment for their military service earns you their happiness and loyalty. + <<set _newLoyalty += random(1,2)>> + <</if>> + <<if _newLoyalty > $militiaUnits[_i].loyalty>> + The loyalty of this unit @@.green;increased@@ this week. + <<elseif _newLoyalty == $militiaUnits[_i].loyalty>> + The loyalty of this unit @@.yellow;did not change@@ this week. + <<else>> + The loyalty of this unit @@.red;decreased@@ this week. + <</if>> + <<set $militiaUnits[_i].loyalty = Math.clamp(_newLoyalty,0,10)>> + <</for>> + <<set _meL = $mercUnits.length>> + <<for _i = 0; _i < _meL; _i++>> + <<for _i = 0; _i < _sL; _i++>> + <<if $mercUnits[_i].minLoyalty < $secBarracksUpgrades.loyaltyMod + $mercUnits[_i].commissars>> + <<set $mercUnits[_i].minLoyalty = $secBarracksUpgrades.loyaltyMod + $mercUnits[_i].commissars>> + <</if>> + <<if $mercUnits[_i].training < 100 && secBarracksUpgrades.training >= 1>> + <br>$mercUnits[_i].platoonName is able to make use of the training facilities to better prepare its soldiers, slowing increasing their experience level. + <<set $mercUnits[_i].training += random(2,4) * 1.5 * $secBarracksUpgrades.training>> + <</if>> + <<set _newLoyalty = $mercUnits[_i].minLoyalty>> + <<if $soldierWages == 2>> + $mercUnits[_i].platoonName greatly appreciate the generous wage given to them for their service. After all coin is the fastest way to reach their hearts. + <<set _newLoyalty++>> + <<elseif $soldierWages == 1>> + $mercUnits[_i].platoonName do not appreciate the barely adequate wage given to them for their service. Still their professionalism keeps them determined to finish their contract. + <<set _newLoyalty += random(-1,1)>> + <<else>> + $mercUnits[_i].platoonName 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. + <<set _newLoyalty -= random(3)>> + <</if>> + <<if $mercSoldierPrivilege == 1>> + Allowing them to keep part of the loot gained from your enemies earns you their trust and loyalty. + <<set _newLoyalty += random(1,2)>> + <</if>> + <<if _newLoyalty > $mercUnits[_i].loyalty>> + The loyalty of this unit @@.green;increased@@ this week. + <<elseif _newLoyalty == $mercUnits[_i].loyalty>> + The loyalty of this unit @@.yellow;did not change@@ this week. + <<else>> + The loyalty of this unit @@.red;decreased@@ this week. + <</if>> + <<set $mercUnits[_i].loyalty = Math.clamp(_newLoyalty,0,10)>> + <</for>> <</if>> <br> diff --git a/src/SecExp/seeUnit.tw b/src/SecExp/seeUnit.tw index dfae5da68ac..a704d4f40bf 100644 --- a/src/SecExp/seeUnit.tw +++ b/src/SecExp/seeUnit.tw @@ -70,6 +70,28 @@ The unit is equipped with state of the art weaponry and equipment. <</if>> <br> + <<if $militiaUnits[$targetIndex].commissars == 0>> + <<link "Attach commissars to the unit">> + <<set $militiaUnits[$targetIndex].commissars = 1>> + <<set $cash -= $equipUpgradeCost * $militiaUnits[$targetIndex].maxTroops + 1000>> + <<goto "seeUnit">> + <</link>> + Attach a small squad of commissars to the unit. + <br>//Costs <<print ($equipUpgradeCost * $militiaUnits[$targetIndex].maxTroops) + 1000>> and will increase the minimum loyalty of the unit by 1.// + <<elseif $militiaUnits[$targetIndex].commissars < 2>> + <<link "Intensive loyalty training">> + <<set $militiaUnits[$targetIndex].commissars += 1>> + <<set $cash -= $equipUpgradeCost * $militiaUnits[$targetIndex].maxTroops + 1000>> + <<goto "seeUnit">> + <</link>> + Provide special training for the officers and the commissars of the unit. + <br>//Costs <<print ($equipUpgradeCost * $militiaUnits[$targetIndex].maxTroops) + 1000>> and will increase the minimum loyalty of the unit by a further 1.// + <<elseif $militiaUnits[$targetIndex].commissars == 1>> + The unit has a commissar detachment, keeping under control the ambitions of the unit's officers. + <<else>> + The unit has a perfectly trained and loyal commissar detachment, keeping under control the ambitions of the unit's officers. + <</if>> + <br> <<if $militiaUnits[$targetIndex].medics == 0>> <<link "Attach trained medics to the unit">> <<set $militiaUnits[$targetIndex].medics = 1>> @@ -81,6 +103,7 @@ <<else>> The unit has a medic detachment following it into battle, decreasing the number of casualties the unit suffers. <</if>> + <br> <<if $securityForceActive == 1>> <<if $militiaUnits[$targetIndex].SF == 0>> <<link "Attach Security Force advisors">> @@ -133,6 +156,28 @@ The unit is equipped with state of the art weaponry and equipment. <</if>> <br> + <<if $slaveUnits[$targetIndex].commissars == 0>> + <<link "Attach commissars to the unit">> + <<set $slaveUnits[$targetIndex].commissars = 1>> + <<set $cash -= $equipUpgradeCost * $slaveUnits[$targetIndex].maxTroops + 1000>> + <<goto "seeUnit">> + <</link>> + Attach a small squad of commissars to the unit. + <br>//Costs <<print ($equipUpgradeCost * $slaveUnits[$targetIndex].maxTroops) + 1000>> and will increase the minimum loyalty of the unit by 1.// + <<elseif $slaveUnits[$targetIndex].commissars < 2>> + <<link "Intensive loyalty training">> + <<set $slaveUnits[$targetIndex].commissars += 1>> + <<set $cash -= $equipUpgradeCost * $slaveUnits[$targetIndex].maxTroops + 1000>> + <<goto "seeUnit">> + <</link>> + Provide special training for the officers and the commissars of the unit. + <br>//Costs <<print ($equipUpgradeCost * $slaveUnits[$targetIndex].maxTroops) + 1000>> and will increase the minimum loyalty of the unit by a further 1.// + <<elseif $slaveUnits[$targetIndex].commissars == 1>> + The unit has a commissar detachment, keeping under control the ambitions of the unit's officers. + <<else>> + The unit has a perfectly trained and loyal commissar detachment, keeping under control the ambitions of the unit's officers. + <</if>> + <br> <<if $slaveUnits[$targetIndex].medics == 0>> <<link "Attach trained medics to the unit">> <<set $slaveUnits[$targetIndex].medics = 1>> @@ -144,6 +189,7 @@ <<else>> The unit has a medic detachment following it into battle, decreasing the number of casualties the unit suffers. <</if>> + <br> <<if $securityForceActive == 1>> <<if $slaveUnits[$targetIndex].SF == 0>> <<link "Attach Security Force advisors">> @@ -196,6 +242,28 @@ The unit is equipped with state of the art weaponry and equipment. <</if>> <br> + <<if $mercUnits[$targetIndex].commissars == 0>> + <<link "Attach commissars to the unit">> + <<set $mercUnits[$targetIndex].commissars = 1>> + <<set $cash -= $equipUpgradeCost * $mercUnits[$targetIndex].maxTroops + 1000>> + <<goto "seeUnit">> + <</link>> + Attach a small squad of commissars to the unit. + <br>//Costs <<print ($equipUpgradeCost * $mercUnits[$targetIndex].maxTroops) + 1000>> and will increase the minimum loyalty of the unit by 1.// + <<elseif $mercUnits[$targetIndex].commissars < 2>> + <<link "Intensive loyalty training">> + <<set $mercUnits[$targetIndex].commissars += 1>> + <<set $cash -= $equipUpgradeCost * $mercUnits[$targetIndex].maxTroops + 1000>> + <<goto "seeUnit">> + <</link>> + Provide special training for the officers and the commissars of the unit. + <br>//Costs <<print ($equipUpgradeCost * $mercUnits[$targetIndex].maxTroops) + 1000>> and will increase the minimum loyalty of the unit by a further 1.// + <<elseif $mercUnits[$targetIndex].commissars == 1>> + The unit has a commissar detachment, keeping under control the ambitions of the unit's officers. + <<else>> + The unit has a perfectly trained and loyal commissar detachment, keeping under control the ambitions of the unit's officers. + <</if>> + <br> <<if $mercUnits[$targetIndex].medics == 0>> <<link "Attach trained medics to the unit">> <<set $mercUnits[$targetIndex].medics = 1>> @@ -207,6 +275,7 @@ <<else>> The unit has a medic detachment following it into battle, decreasing the number of casualties the unit suffers. <</if>> + <br> <<if $securityForceActive == 1>> <<if $mercUnits[$targetIndex].SF == 0>> <<link "Attach Security Force advisors">> diff --git a/src/SecExp/unitsBattleReport.tw b/src/SecExp/unitsBattleReport.tw index a8f198c5778..20f599db5b0 100644 --- a/src/SecExp/unitsBattleReport.tw +++ b/src/SecExp/unitsBattleReport.tw @@ -53,7 +53,7 @@ <<set _lossesList.push(_assignedLosses)>> <</for>> <<if $losses > 0>> - <<set _lossesList[random(_lossesList.length] += $losses>> + <<set _lossesList[random(_lossesList.length)] += $losses>> <</if>> <<set _lossesList.shuffle()>> diff --git a/src/SecExp/widgets/miscSecExpWidgets.tw b/src/SecExp/widgets/miscSecExpWidgets.tw index 45fa6b8d471..fa3c2aab43c 100644 --- a/src/SecExp/widgets/miscSecExpWidgets.tw +++ b/src/SecExp/widgets/miscSecExpWidgets.tw @@ -142,6 +142,10 @@ <<if $sellData == 1>> <<set _newAuthUpkeep += 10>> <</if>> + + <<if $slaveSoldierPrivilege == 1>> + <<set _newAuthUpkeep += 10>> + <</if>> <<if $weaponsLaw == 0>> <<set _newAuthUpkeep += 30>> @@ -204,6 +208,14 @@ <br>Set militia missing flag <<set $militiaUnits[_i].SF = 0>> <</if>> + <<if ndef $militiaUnits[_i].minLoyalty>> + <br>Set militia missing flag + <<set $militiaUnits[_i].minLoyalty = 0>> + <</if>> + <<if ndef $militiaUnits[_i].commissars>> + <br>Set militia missing flag + <<set $militiaUnits[_i].commissars = 0>> + <</if>> <<if !isInt($militiaUnits[_i].troops)>> <<set $militiaUnits[_i].troops = $militiaUnits[_i].maxTroops>> <br>Fixed militia unit wrong troop count. @@ -215,6 +227,14 @@ <br>Set slave missing flag <<set $slaveUnits[_i].SF = 0>> <</if>> + <<if ndef $slaveUnits[_i].minLoyalty>> + <br>Set slave missing flag + <<set $slaveUnits[_i].minLoyalty = 0>> + <</if>> + <<if ndef $slaveUnits[_i].commissars>> + <br>Set slave missing flag + <<set $slaveUnits[_i].commissars = 0>> + <</if>> <<if !isInt($slaveUnits[_i].troops)>> <<set $slaveUnits[_i].troops = $slaveUnits[_i].maxTroops>> <br>Fixed slave unit wrong troop count. @@ -226,6 +246,14 @@ <br>Set merc missing flag <<set $mercUnits[_i].SF = 0>> <</if>> + <<if ndef $mercUnits[_i].minLoyalty>> + <br>Set merc missing flag + <<set $mercUnits[_i].minLoyalty = 0>> + <</if>> + <<if ndef $mercUnits[_i].commissars>> + <br>Set merc missing flag + <<set $mercUnits[_i].commissars = 0>> + <</if>> <<if !isInt($mercUnits[_i].troops)>> <<set $mercUnits[_i].troops = $mercUnits[_i].maxTroops>> <br>Fixed merc unit wrong troop count. diff --git a/src/SecExp/widgets/unitsWidgets.tw b/src/SecExp/widgets/unitsWidgets.tw index e7fb0b99121..d790d2b3e5b 100644 --- a/src/SecExp/widgets/unitsWidgets.tw +++ b/src/SecExp/widgets/unitsWidgets.tw @@ -21,6 +21,13 @@ <<else>> They are consumed 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>> + <<if $args[0].loyalty < 3>> + Their loyalty is low. Careful monitoring of their activities and relationships should be implemented. + <<elseif $args[0].loyalty < 6>> + Their loyalty is not as high as it can be, but they are not actively working against their arcology owner. + <<else>> + Their loyalty is high and strong. The likelyhood of this unit betraying the arcology is low to non-existent. + <</if>> <<if $args[0].medics == 1>> The unit has a dedicated squad of medics that will follow them in battle. <</if>> @@ -53,6 +60,13 @@ <<else>> They are consumed 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>> + <<if $args[0].loyalty < 3>> + Their loyalty is low. Careful monitoring of their activities and relationships should be implemented. + <<elseif $args[0].loyalty < 6>> + Their loyalty is not as high as it can be, but they are not actively working against their arcology owner. + <<else>> + Their loyalty is high and strong. The likelyhood of this unit betraying the arcology is low to non-existent. + <</if>> <<if $args[0].medics == 1>> The unit has a dedicated squad of medics that will follow them in battle. <</if>> @@ -85,6 +99,13 @@ <<else>> They are consumed 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>> + <<if $args[0].loyalty < 3>> + Their loyalty is low. Careful monitoring of their activities and relationships should be implemented. + <<elseif $args[0].loyalty < 6>> + Their loyalty is not as high as it can be, but they are not actively working against their arcology owner. + <<else>> + Their loyalty is high and strong. The likelyhood of this unit betraying the arcology is low to non-existent. + <</if>> <<if $args[0].medics == 1>> The unit has a dedicated squad of medics that will follow them in battle. <</if>> diff --git a/src/uncategorized/arcmgmt.tw b/src/uncategorized/arcmgmt.tw index 22be24430f6..2f2e604d9c0 100644 --- a/src/uncategorized/arcmgmt.tw +++ b/src/uncategorized/arcmgmt.tw @@ -252,7 +252,11 @@ $ACitizens citizens and <<print $ASlaves+$helots+$slaves.length>> slaves now liv <</if>> <<if $discountMercenaries == 1>> Mercenaries willing to come to your arcology are given a discount on rent. - <<set $rentalMultiplier -= 0.1>> + <<set $rentalMultiplier -= 0.05>> +<</if>> +<<if $militiaSoldierPrivilege == 1>> + Citizens in the militia are exempt from rent payment. + <<set $rentalMultiplier -= 0.05>> <</if>> <<if $arcologies[0].FSArabianRevivalistLaw == 1>> <<set $rentalMultiplier += 0.1>> diff --git a/src/uncategorized/manageArcology.tw b/src/uncategorized/manageArcology.tw index 2587820e2fb..2eb231cf717 100644 --- a/src/uncategorized/manageArcology.tw +++ b/src/uncategorized/manageArcology.tw @@ -110,7 +110,7 @@ __Construction__ The [[security HQ|securityHQ]] is constantly working to protect your arcology. <</if>> - <<if $arcologyUpgrade.drones == 1 && $secBarracks == 0>> + <<if $secBarracks == 0>> <br> [[Set up the barracks|Manage Arcology][$cash -= Math.trunc(5000*$upgradeMultiplierArcology), $secBarracks = 1]] //Costs ¤<<print Math.trunc(5000*$upgradeMultiplierArcology)>>// @@ -125,7 +125,7 @@ __Construction__ [[Set up the riot control center|Manage Arcology][$cash -= Math.trunc(5000*$upgradeMultiplierArcology), $riotCenter = 1]] //Costs ¤<<print Math.trunc(5000*$upgradeMultiplierArcology)>>// <br>//Building specialized in the management and suppression of rebellions.// - <<else>> + <<elseif $rebellionsEnabled == 1>> <br> The [[Riot Control Center|riotControlCenter]] stands ready for action. <</if>> diff --git a/src/uncategorized/nonRandomEvent.tw b/src/uncategorized/nonRandomEvent.tw index e15beeca424..a40d844f32d 100644 --- a/src/uncategorized/nonRandomEvent.tw +++ b/src/uncategorized/nonRandomEvent.tw @@ -4,8 +4,6 @@ <<if $plot>> -<<set _roll = random(25,35)>> - <<set _effectiveWeek = $week-$nationHate>> <<set $toSearch = $arcologies[0].name>> <<if (_effectiveWeek == 4) && ($toSearch.indexOf("Arcology ") != -1)>> -- GitLab