diff --git a/src/SecExp/SecExpBackwardCompatibility.tw b/src/SecExp/SecExpBackwardCompatibility.tw index aa9c965952be2f9d7f9824a5e8ad20a192f7de46..a3247388874c7de377a02cadfa410ecbea493432 100644 --- a/src/SecExp/SecExpBackwardCompatibility.tw +++ b/src/SecExp/SecExpBackwardCompatibility.tw @@ -376,8 +376,18 @@ <<if ndef $createdMercUnits>> <<set $createdMercUnits = 0>> <</if>> +<<recalcManpower>> /* battle relevant vars */ +<<if ndef $totalKills>> +<<set $totalKills = 0>> +<</if>> +<<if ndef $battlesCount>> +<<set $battlesCount = 0>> +<</if>> +<<if ndef $majorBattlesCount>> +<<set $majorBattlesCount = 0>> +<</if>> <<if ndef $chosenTactic>> <<set $chosenTactic = "none">> <</if>> diff --git a/src/SecExp/attackHandler.tw b/src/SecExp/attackHandler.tw index fc76e1cc3cf418d42f703830850103dbf5d49d7a..2904d3bfb67a7c22c9304d5e1fc88dbc9cb08fb7 100644 --- a/src/SecExp/attackHandler.tw +++ b/src/SecExp/attackHandler.tw @@ -2,6 +2,26 @@ <<set $nextButton = " ", $nextLink = "attackReport", $showEncyclopedia = 0>> +/* updates deployed flags */ +<<for _i = 0; _i < $militiaUnits.length; _i++>> + <<if $militiaUnits[_i].isDeployed == 1>> + <<set $deployingMilitia = 1>> + <<break>> + <</if>> +<</for>> +<<for _i = 0; _i < $slaveUnits.length; _i++>> + <<if $slaveUnits[_i].isDeployed == 1>> + <<set $deployingSlaves = 1>> + <<break>> + <</if>> +<</for>> +<<for _i = 0; _i < $mercUnits.length; _i++>> + <<if $mercUnits[_i].isDeployed == 1>> + <<set $deployingMercs = 1>> + <<break>> + <</if>> +<</for>> + <<if $battleResult == 1>> /* bribery check */ <<if $showBattleStatistics == 1>>bribery chosen<</if>> <<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 */ @@ -53,6 +73,7 @@ <<set _enemyMod = 1>> <<set _SFMod = 1>> <<set _expBonus = 0>> +<<set _armyMod = 0>> /* major battle */ <<if $majorBattle == 1>> @@ -843,18 +864,13 @@ <<set _enemyMod += 0.75>> <</if>> -<<set _secBotsMorale = 0>> -<<set _militiaMorale = 0>> -<<set _slaveMorale = 0>> -<<set _mercMorale = 0>> - /* calculates PC army stats */ <<if $secBots.isDeployed == 1>> <<set _attack += ($secBotsBaseAttack + $secBotsBaseAttack * $secBots.equip * $equipMod) * _atkMod>> <<set _defense += ($secBotsBaseDefense + $secBotsBaseDefense * $secBots.equip * $equipMod) * _defMod>> <<set _hp += $secBotsBaseHp * $secBots.troops>> <</if>> -<<for _i = 0; _i < _mL; _i++>> +<<for _i = 0; _i < $militiaUnits.length; _i++>> <<if $militiaUnits[_i].isDeployed == 1>> <<if $militiaUnits[_i].training <= 10>> <<set _expBonus = 0>> @@ -870,7 +886,7 @@ <<set _hp += ($militiaBaseHp + $militiaBaseHp * $militiaUnits[_i].medics * $equipMod) * $militiaUnits[_i].troops>> <</if>> <</for>> -<<for _i = 0; _i < _sL; _i++>> +<<for _i = 0; _i < $slaveUnits.length; _i++>> <<if $slaveUnits[_i].isDeployed == 1>> <<if $slaveUnits[_i].training <= 33>> <<set _expBonus = 0>> @@ -884,7 +900,7 @@ <<set _hp += ($slaveBaseHp + $slaveBaseHp * $slaveUnits[_i].medics * 0.25) * $slaveUnits[_i].troops>> <</if>> <</for>> -<<for _i = 0; _i < _meL; _i++>> +<<for _i = 0; _i < $mercUnits.length; _i++>> <<if $mercUnits[_i].isDeployed == 1>> <<if $mercUnits[_i].training <= 33>> <<set _expBonus = 0>> @@ -923,32 +939,50 @@ <<if _SFMod < 0.5>> <<set _SFMod = 0.5>> <</if>> -<<set _morale = ($secBotsMorale * $deployingBots + _militiaMorale * _militiaMod * $deployingMilitia + $slaveBaseMorale * _slaveMod * $deployingSlaves + $mercBaseMorale * _mercMod * $deployingMercs + $SFBaseMorale * $SFIntervention * _SFMod) / ($deployingBots + $deployingMilitia +$deployingSlaves + $deployingMercs + $SFIntervention)>> +<<set _morale = ($secBotsMorale * $deployingBots + $militiaBaseMorale * _militiaMod * $deployingMilitia + $slaveBaseMorale * _slaveMod * $deployingSlaves + $mercBaseMorale * _mercMod * $deployingMercs + $SFBaseMorale * $SFIntervention * _SFMod) / ($deployingBots + $deployingMilitia +$deployingSlaves + $deployingMercs + $SFIntervention)>> <<set _morale = _morale + _morale * $secBarracksUpgrades.luxury * 0.05>> /* barracks bonus */ <<set _baseHp = ($secBotsBaseHp * $deployingBots + $militiaBaseHp * $deployingMilitia + $slaveBaseHp * $deployingSlaves + $mercBaseHp * $deployingMercs + $SFBaseHp * $SFIntervention) / ($deployingBots + $deployingMilitia +$deployingSlaves + $deployingMercs + $SFIntervention)>> /* calculates enemy army stats */ +<<if $week <= 30>> + <<set _armyMod = $attackTroops / 60>> +<<elseif $week <= 60>> + <<set _armyMod = $attackTroops / 50>> +<<elseif $week <= 90>> + <<set _armyMod = $attackTroops / 40>> +<<elseif $week <= 120>> + <<set _armyMod = $attackTroops / 30>> +<<else>> + <<set _armyMod = $attackTroops / 20>> +<</if>> +<<set _armyMod = Math.trunc(_armyMod)>> +<<if $majorBattle == 1>> + <<set _armyMod *= 2>> +<</if>> +<<if _armyMod <= 0>> + <<set _armyMod = 1>> +<</if>> <<if $attackType == "raiders">> - <<set _enemyAttack = $raBaseAttack + $raBaseAttack * $attackEquip * $equipMod>> - <<set _enemyDefense = $raBaseDefense + $raBaseDefense * $attackEquip * $equipMod>> + <<set _enemyAttack = ($raBaseAttack + $raBaseAttack * $attackEquip * $equipMod) * _armyMod>> + <<set _enemyDefense = ($raBaseDefense + $raBaseDefense * $attackEquip * $equipMod) * _armyMod>> <<set _enemyMorale = $raBaseMorale* _enemyMod>> <<set _enemyHp = $raBaseHp * $attackTroops>> <<set _enemyBaseHp = $raBaseHp>> <<elseif $attackType == "free city">> - <<set _enemyAttack = $fcBaseAttack + $fcBaseAttack * $attackEquip * $equipMod>> - <<set _enemyDefense = $fcBaseDefense + $fcBaseDefense * $attackEquip * $equipMod>> + <<set _enemyAttack = ($fcBaseAttack + $fcBaseAttack * $attackEquip * $equipMod) * _armyMod>> + <<set _enemyDefense = ($fcBaseDefense + $fcBaseDefense * $attackEquip * $equipMod) * _armyMod>> <<set _enemyMorale = $fcBaseMorale * _enemyMod>> <<set _enemyHp = $fcBaseHp * $attackTroops>> <<set _enemyBaseHp = $fcBaseHp>> <<elseif $attackType == "old world">> - <<set _enemyAttack = $owBaseAttack + $owBaseAttack * $attackEquip * $equipMod>> - <<set _enemyDefense = $owBaseDefense + $owBaseDefense * $attackEquip * $equipMod>> + <<set _enemyAttack = ($owBaseAttack + $owBaseAttack * $attackEquip * $equipMod) * _armyMod>> + <<set _enemyDefense = ($owBaseDefense + $owBaseDefense * $attackEquip * $equipMod) * _armyMod>> <<set _enemyMorale = $owBaseMorale * _enemyMod>> <<set _enemyHp = $owBaseHp * $attackTroops>> <<set _enemyBaseHp = $owBaseHp>> <<elseif $attackType == "freedom fighters">> - <<set _enemyAttack = $ffBaseAttack + $ffBaseAttack * $attackEquip * $equipMod>> - <<set _enemyDefense = $ffBaseDefense + $ffBaseDefense * $attackEquip * $equipMod>> + <<set _enemyAttack = ($ffBaseAttack + $ffBaseAttack * $attackEquip * $equipMod) * _armyMod>> + <<set _enemyDefense = ($ffBaseDefense + $ffBaseDefense * $attackEquip * $equipMod) * _armyMod>> <<set _enemyMorale = $ffBaseMorale * _enemyMod>> <<set _enemyHp = $ffBaseHp * $attackTroops>> <<set _enemyBaseHp = $ffBaseHp>> @@ -991,7 +1025,7 @@ /* simulates the combat by pitting attk against def */ <<for _i = 0; _i < _turns; _i++>> <br><br> - <<if $showBattleStatistics == 1>> turn: _i<</if>> + <<if $showBattleStatistics == 1>> turn: <<print _i + 1>><</if>> /* player army attacks */ <<set _damage = _attack - _enemyDefense>> <<if _damage <= 0>> diff --git a/src/SecExp/attackOptions.tw b/src/SecExp/attackOptions.tw index 447d6fe2e08aab19154ad75ce3fdfd41b68afa58..ffa28d0af9fdc414c1eafd8e33e71926b4c6f7b1 100644 --- a/src/SecExp/attackOptions.tw +++ b/src/SecExp/attackOptions.tw @@ -248,6 +248,7 @@ With your current readiness level you can <<if $deployedUnits > 0>>still send <s <</link>> <</if>> <<for _i = 0; _i < _mL; _i++>> + <<capture _i>> <<if $militiaUnits[_i].active == 1 && $militiaUnits[_i].isDeployed == 0 && $militiaUnits[_i].troops > 0>> <br> <<militiaUnitsDescription $militiaUnits[_i]>> @@ -259,8 +260,10 @@ With your current readiness level you can <<if $deployedUnits > 0>>still send <s <<goto "attackOptions">> <</link>> <</if>> + <</capture>> <</for>> <<for _i = 0; _i < _sL; _i++>> + <<capture _i>> <<if $slaveUnits[_i].active == 1 && $slaveUnits[_i].isDeployed == 0 && $slaveUnits[_i].troops > 0>> <br> <<slaveUnitsDescription $slaveUnits[_i]>> @@ -272,8 +275,10 @@ With your current readiness level you can <<if $deployedUnits > 0>>still send <s <<goto "attackOptions">> <</link>> <</if>> + <</capture>> <</for>> <<for _i = 0; _i < _meL; _i++>> + <<capture _i>> <<if $mercUnits[_i].active == 1 && $mercUnits[_i].isDeployed == 0 && $mercUnits[_i].troops > 0>> <br> <<mercUnitsDescription $mercUnits[_i]>> @@ -285,10 +290,11 @@ With your current readiness level you can <<if $deployedUnits > 0>>still send <s <<goto "attackOptions">> <</link>> <</if>> + <</capture>> <</for>> <<else>> <br> - Unit roster full. + <strong>Unit roster full.</strong> <</if>> <br><br> @@ -309,6 +315,7 @@ Units about to be deployed: <</link>> <</if>> <<for _i = 0; _i < _mL; _i++>> + <<capture _i>> <<if $militiaUnits[_i].isDeployed == 1>> <br> <<militiaUnitsDescription $militiaUnits[_i]>> @@ -320,8 +327,10 @@ Units about to be deployed: <<goto "attackOptions">> <</link>> <</if>> + <</capture>> <</for>> <<for _i = 0; _i < _sL; _i++>> + <<capture _i>> <<if $slaveUnits[_i].isDeployed == 1>> <br> <<slaveUnitsDescription $slaveUnits[_i]>> @@ -333,8 +342,10 @@ Units about to be deployed: <<goto "attackOptions">> <</link>> <</if>> + <</capture>> <</for>> <<for _i = 0; _i < _meL; _i++>> + <<capture _i>> <<if $mercUnits[_i].isDeployed == 1>> <br> <<mercUnitsDescription $mercUnits[_i]>> @@ -346,26 +357,9 @@ Units about to be deployed: <<goto "attackOptions">> <</link>> <</if>> + <</capture>> <</for>> <</if>> -<<for _i = 0; _i < _mL; _i++>> - <<if $militiaUnits[_i].isDeployed == 1>> - <<set $deployingMilitia = 1>> - <<break>> - <</if>> -<</for>> -<<for _i = 0; _i < _sL; _i++>> - <<if $slaveUnits[_i].isDeployed == 1>> - <<set $deployingSlaves = 1>> - <<break>> - <</if>> -<</for>> -<<for _i = 0; _i < _meL; _i++>> - <<if $mercUnits[_i].isDeployed == 1>> - <<set $deployingMercs = 1>> - <<break>> - <</if>> -<</for>> <<if $majorBattle == 1 && $securityForceCreate == 1>> <br> diff --git a/src/SecExp/attackReport.tw b/src/SecExp/attackReport.tw index 8249e2b86aded88721570c86f61d73ef39b72bc2..03f5da742966ab9229990138510789561a33cdc5 100644 --- a/src/SecExp/attackReport.tw +++ b/src/SecExp/attackReport.tw @@ -5,11 +5,16 @@ /*init*/ <<set _oldRep = $rep>> <<set _oldAuth = $authority>> -<<set $enemyLosses = Math.round($enemyLosses)>> -<<set $losses = Math.round($losses)>> +<<set $enemyLosses = Math.trunc($enemyLosses)>> +<<if $enemyLosses > $attackTroops>> + <<set $enemyLosses = $attackTroops>> +<</if>> +<<set $totalKills += $enemyLosses>> +<<set $losses = Math.trunc($losses)>> /* result */ <<if $majorBattle == 0>> + <<set $battlesCount++>> <<set _majorBattleMod = 1>> <<if $battleResult == 3>> <strong>Victory!</strong> @@ -29,13 +34,18 @@ <<set $PClosses++>> <<elseif $battleResult == -1>> <strong>We surrendered</strong> + <<set $PClosses++>> <<elseif $battleResult == 0>> <strong>Failed bribery!</strong> + <<set $PClosses++>> <<elseif $battleResult == 1>> <strong>Successful bribery!</strong> + <<set $PCvictories++>> <</if>> <<else>> <<set _majorBattleMod = 2>> + <<set $battlesCount++>> + <<set $majorBattlesCount++>> <<if $battleResult == 3>> <strong>Major victory!</strong> <<set $PClossStreak = 0>> @@ -54,10 +64,13 @@ <<set $PClosses++>> <<elseif $battleResult == -1>> <strong>We surrendered</strong> + <<set $PClosses++>> <<elseif $battleResult == 0>> <strong>Failed bribery!</strong> + <<set $PClosses++>> <<elseif $battleResult == 1>> <strong>Successful bribery!</strong> + <<set $PCvictories++>> <</if>> <</if>> <hr> @@ -80,7 +93,11 @@ <<elseif $battleTerrain == "wasteland">> in the wastelands outside the free city territory, <</if>> - inflicting <<print $enemyLosses>> casualties, while sustaining <<print $losses>> casualties themselves. + <<if $enemyLosses != $attackTroops>> + inflicting <<print $enemyLosses>> casualties, while sustaining <<print $losses>> casualties themselves. + <<else>> + completely annihilating their troops, while sustaining <<print $losses>> casualties. + <</if>> <<if $battleResult == 3>> <<if $battleTurns <= 5>> The fight was quick and one sided, our men easily stopped the disorganized horde futile attempt at raiding your arcology @@ -139,7 +156,11 @@ <<elseif $battleTerrain == "wasteland">> in the wastelands outside the free city territory, <</if>> - inflicting <<print $enemyLosses>> casualties, while sustaining <<print $losses>> casualties themselves. + <<if $enemyLosses != $attackTroops>> + inflicting <<print $enemyLosses>> casualties, while sustaining <<print $losses>> casualties themselves. + <<else>> + completely annihilating their troops, while sustaining <<print $losses>> casualties. + <</if>> <<if $battleResult == 3>> <<if $battleTurns <= 5>> The fight was quick and one sided, our men easily stopped the mercenaries dead in their tracks @@ -198,7 +219,11 @@ <<elseif $battleTerrain == "wasteland">> in the wastelands outside the free city territory, <</if>> - inflicting <<print $enemyLosses>> casualties, while sustaining <<print $losses>> casualties themselves. + <<if $enemyLosses != $attackTroops>> + inflicting <<print $enemyLosses>> casualties, while sustaining <<print $losses>> casualties themselves. + <<else>> + completely annihilating their troops, while sustaining <<print $losses>> casualties. + <</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 @@ -257,7 +282,11 @@ <<elseif $battleTerrain == "wasteland">> in the wastelands outside the free city territory, <</if>> - inflicting <<print $enemyLosses>> casualties, while sustaining <<print $losses>> casualties themselves. + <<if $enemyLosses != $attackTroops>> + inflicting <<print $enemyLosses>> casualties, while sustaining <<print $losses>> casualties themselves. + <<else>> + completely annihilating their troops, while sustaining <<print $losses>> casualties. + <</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 @@ -1246,282 +1275,11 @@ <<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 efficacy of your army. <</if>> - <br> + + <<include "unitsBattleReport">> - /* effects on the units */ - <<if $SFIntervention == 0>> - <<if $losses > 0>> - <<set _loss = Math.trunc($losses / $deployedUnits)>> - <<if $deployingBots == 1>> - <br> - Your squadron of security drones participated in the battle, dominating the airspace and providing vital intelligence to the rest of the army. - <<set $secBots.troops -= _loss>> - During the battle they suffered - <<if _loss <= 10>> - light casualties. - <<elseif _loss <= 30>> - moderate casualties. - <<elseif _loss <= 60>> - heavy casualties. - <<else>> - catastrofic casualties. - <</if>> - <<if $secBots.troops <= 0>> - <<set $secBots.active = 0>> - Unfortunately the losses they took were simply too great, their effective combatants are in so small number you can no longer call them a deployable unit. It will take quite the investment to rebuild them. - <<elseif $secBots.troops <= 10>> - The unit has very few operatives left, it risks compelte annihilation if deployed again. - <</if>> - <</if>> - <<if $deployingMilitia == 1>> - <<set _mL = $militiaUnits.length>> - <<for _i = 0; _i < _mL; _i++>> - <<if $militiaUnits[_i].isDeployed == 1>> - <br> - $militiaUnits[_i].platoonName participated in the battle, your proud citizens defending with their lives their arcology. - During the battle they suffered - <<if _loss <= 10>> - light casualties - <<elseif _loss <= 30>> - moderate casualties - <<elseif _loss <= 60>> - heavy casualties - <<else>> - catastrofic casualties - <</if>> - <<if $militiaUnits[_i].medics == 1>> - , however - <<print math.trunc(_loss * $militiaUnits[_i].medics * 0.25)>> men were saved by the medics attached to this unit. - <<set $militiaUnits[_i].troops -= Math.trunc(_loss - _loss * $militiaUnits[_i].medics * 0.25)>> - <<set $militiaTotalCasualties += Math.trunc(_loss - _loss * $militiaUnits[_i].medics * 0.25)>> - <<else>> - . - <</if>> - <<if $militiaUnits[_i].troops <= 0>> - <<set $militiaUnits[_i].active = 0>> - Unfortunately the losses they took were simply too great, their effective combatants are in so small number you can no longer call them a deployable unit. The remnants will be sent home honored as veterans or reorganized in a new unit. - <<elseif $militiaUnits[_i].troops <= 10>> - The unit has very few operatives left, it risks complete annihilation if deployed again. - <</if>> - <</if>> - <</for>> - <</if>> - <<if $deployingSlaves == 1>> - <<set _sL = $slaveUnits.length>> - <<for _i = 0; _i < _sL; _i++>> - <<if $slaveUnits[_i].isDeployed == 1>> - <br> - $slaveUnits[_i].platoonName participated in the battle. While a rare sight, your slave soldiers show no less willingness to fight for their arcology than their free counterparts, be it because of fear or devotion to their owner. - During the battle they suffered - <<if _loss <= 10>> - light casualties - <<elseif _loss <= 30>> - moderate casualties - <<elseif _loss <= 60>> - heavy casualties - <<else>> - catastrofic casualties - <</if>> - <<if $slaveUnits[_i].medics == 1>> - , however - <<print math.trunc(_loss * $slaveUnits[_i].medics * 0.25)>> men were saved by the medics attached to this unit. - <<set $slaveUnits[_i].troops -= Math.trunc(_loss - _loss * $slaveUnits[_i].medics * 0.25)>> - <<set $slavesTotalCasualties += Math.trunc(_loss - _loss * $slaveUnits[_i].medics * 0.25)>> - <<else>> - . - <</if>> - <<if $slaveUnits.troops <= 0>> - <<set $slaveUnits[_i].active = 0>> - Unfortunately the losses they took were simply too great, their effective combatants are in so small number you can no longer call them a deployable unit. The remnants will be sent home honored as veterans or reorganized in a new unit. - <</if>> - <</if>> - <</for>> - <</if>> - <<if $deployingMercs == 1>> - <<set _meL = $mercUnits.length>> - <<for _i = 0; _i < _meL; _i++>> - <<if $mercUnits[_i].isDeployed == 1>> - <br> - $mercUnits[_i].platoonName participated in the battle. Mercenaries are a common sight on the modern battlefield and yours are proud to serve their generous contractor. - During the battle they suffered - <<if _loss <= 10>> - light casualties - <<elseif _loss <= 30>> - moderate casualties - <<elseif _loss <= 60>> - heavy casualties - <<else>> - catastrofic casualties - <</if>> - <<if $mercUnits[_i].medics == 1>> - , however - <<print math.trunc(_loss * $mercUnits[_i].medics * 0.25)>> men were saved by the medics attached to this unit. - <<set $mercUnits[_i].troops -= Math.trunc(_loss - _loss * $mercUnits[_i].medics * 0.25)>> - <<set $mercTotalCasualties += Math.trunc(_loss - _loss * $mercUnits[_i].medics * 0.25)>> - <<else>> - . - <</if>> - <<if $mercUnits.troops <= 0>> - <<set $mercUnits[_i].active = 0>> - Unfortunately the losses they took were simply too great, their effective combatants are in so small number you can no longer call them a deployable unit. The remnants will be sent home honored as veterans or reorganized in a new unit. - <</if>> - <</if>> - <</for>> - <</if>> - <</if>> - <<else>> - <<if $losses > 0>> - <<set _SFLoss = $losses / 3, $losses -= $losses / 3>> - <<set _loss = Math.trunc($losses / $deployedUnits)>> - <<set _SFLoss = Math.trunc(_SFLoss)>> - <<if $deployingBots == 1>> - <br> - Your squadron of security drones participated in the battle, dominating the airspace and providing vital intelligence to the rest of the army. - <<set $secBots.troops -= _loss>> - During the battle they suffered - <<if _loss <= 10>> - light casualties. - <<elseif _loss <= 30>> - moderate casualties. - <<elseif _loss <= 60>> - heavy casualties. - <<else>> - catastrofic casualties. - <</if>> - <<if $secBots.troops <= 0>> - <<set $secBots.active = 0>> - Unfortunately the losses they took were simply too great, their effective combatants are in so small number you can no longer call them a deployable unit. It will take quite the investment to rebuild them. - <<elseif $secBots.troops <= 10>> - The unit has very few operatives left, it risks compelte annihilation if deployed again. - <</if>> - <</if>> - <<if $deployingMilitia == 1>> - <<set _mL = $militiaUnits.length>> - <<for _i = 0; _i < _mL; _i++>> - <<if $militiaUnits[_i].isDeployed == 1>> - <br> - $militiaUnits[_i].platoonName participated in the battle, your proud citizens defending with their lives their arcology. - During the battle they suffered - <<if _loss <= 10>> - light casualties - <<elseif _loss <= 30>> - moderate casualties - <<elseif _loss <= 60>> - heavy casualties - <<else>> - catastrofic casualties - <</if>> - <<if $militiaUnits[_i].medics == 1>> - , however - <<print math.trunc(_loss * $militiaUnits[_i].medics * 0.25)>> men were saved by the medics attached to this unit. - <<set $militiaUnits[_i].troops -= Math.trunc(_loss - _loss * $militiaUnits[_i].medics * 0.25)>> - <<set $militiaTotalCasualties += Math.trunc(_loss - _loss * $militiaUnits[_i].medics * 0.25)>> - <<else>> - . - <</if>> - <<if $militiaUnits[_i].troops <= 0>> - <<set $militiaUnits[_i].active = 0>> - Unfortunately the losses they took were simply too great, their effective combatants are in so small number you can no longer call them a deployable unit. The remnants will be sent home honored as veterans or reorganized in a new unit. - <<elseif $militiaUnits[_i].troops <= 10>> - The unit has very few operatives left, it risks complete annihilation if deployed again. - <</if>> - <</if>> - <</for>> - <</if>> - <<if $deployingSlaves == 1>> - <<set _sL = $slaveUnits.length>> - <<for _i = 0; _i < _sL; _i++>> - <<if $slaveUnits[_i].isDeployed == 1>> - <br> - $slaveUnits[_i].platoonName participated in the battle. While a rare sight, your slave soldiers show no less willingness to fight for their arcology than their free counterparts, be it because of fear or devotion to their owner. - During the battle they suffered - <<if _loss <= 10>> - light casualties - <<elseif _loss <= 30>> - moderate casualties - <<elseif _loss <= 60>> - heavy casualties - <<else>> - catastrofic casualties - <</if>> - <<if $slaveUnits[_i].medics == 1>> - , however - <<print math.trunc(_loss * $slaveUnits[_i].medics * 0.25)>> men were saved by the medics attached to this unit. - <<set $slaveUnits[_i].troops -= Math.trunc(_loss - _loss * $slaveUnits[_i].medics * 0.25)>> - <<set $slavesTotalCasualties += Math.trunc(_loss - _loss * $slaveUnits[_i].medics * 0.25)>> - <<else>> - . - <</if>> - <<if $slaveUnits.troops <= 0>> - <<set $slaveUnits[_i].active = 0>> - Unfortunately the losses they took were simply too great, their effective combatants are in so small number you can no longer call them a deployable unit. The remnants will be sent home honored as veterans or reorganized in a new unit. - <</if>> - <</if>> - <</for>> - <</if>> - <<if $deployingMercs == 1>> - <<set _meL = $mercUnits.length>> - <<for _i = 0; _i < _meL; _i++>> - <<if $mercUnits[_i].isDeployed == 1>> - <br> - $mercUnits[_i].platoonName participated in the battle. Mercenaries are a common sight on the modern battlefield and yours are proud to serve their generous contractor. - During the battle they suffered - <<if _loss <= 10>> - light casualties - <<elseif _loss <= 30>> - moderate casualties - <<elseif _loss <= 60>> - heavy casualties - <<else>> - catastrofic casualties - <</if>> - <<if $mercUnits[_i].medics == 1>> - , however - <<print math.trunc(_loss * $mercUnits[_i].medics * 0.25)>> men were saved by the medics attached to this unit. - <<set $mercUnits[_i].troops -= Math.trunc(_loss - _loss * $mercUnits[_i].medics * 0.25)>> - <<set $mercTotalCasualties += Math.trunc(_loss - _loss * $mercUnits[_i].medics * 0.25)>> - <<else>> - . - <</if>> - <<if $mercUnits.troops <= 0>> - <<set $mercUnits[_i].active = 0>> - Unfortunately the losses they took were simply too great, their effective combatants are in so small number you can no longer call them a deployable unit. The remnants will be sent home honored as veterans or reorganized in a new unit. - <</if>> - <</if>> - <</for>> - <</if>> - /* SF troops intervention */ - <<if $carriableSoldiers < $securityForcePersonnel>> - <<print $carriableSoldiers>> soldiers from the $securityForceName joined the battle aboard their<<if $securityForceVehiclePower >= 4>>armored<</if>>vehicles<<if $securityForceAC130 > 0>>and their AC130<</if>>. - Free cities armies are a rare sight, but their power is undeniable and your $securityForceName is living testament of this. - During the battle they suffered - <<if _SFLoss <= 10>> - light casualties - <<elseif _SFLoss <= 30>> - moderate casualties - <<elseif _SFLoss <= 60>> - heavy casualties - <<else>> - catastrofic casualties - <</if>> - <<set $securityForcePersonnel -= _SFLoss>> - <<else>> - <<print $securityForcePersonnel>> soldiers from the $securityForceName joined the battle aboard their<<if $securityForceVehiclePower >= 4>>armored<</if>>vehicles<<if $securityForceAC130 > 0>>and their AC130<</if>>. - Free cities armies are a rare sight, but their power is undeniable and your $securityForceName is living testament of this. - During the battle they suffered - <<if _SFLoss <= 10>> - light casualties - <<elseif _SFLoss <= 30>> - moderate casualties - <<elseif _SFLoss <= 60>> - heavy casualties - <<else>> - catastrofic casualties - <</if>> - <<set $securityForcePersonnel -= _SFLoss>> - <</if>> - <</if>> + <<if $securityForceArcologyUpgrades >= 7 || $securityForceFortressZeppelin >= 1 || $securityForceSatalitePower >= 11 || $securityForceGiantRobot >= 6 || $securityForceMissileSilo >= 1>> /* SF upgrades effects */ <br> <br> @@ -1541,7 +1299,7 @@ The missile silo exterminated many enemy soldiers even before the battle would begin. <</if>> <</if>> - + <</if>> /* closes check for surrender and bribery */ <br><br> @@ -1549,9 +1307,10 @@ <<set _menialPrice = Math.trunc(($slaveCostFactor*1000)/100)*100>> <<set _menialPrice = Math.clamp(_menialPrice, 500, 1500)>> +<<set _captives = Math.trunc(_captives)>> <<if _captives > 0>> - <<set _captives = Math.trunc(_captives)>> During the battle <<print _captives>> attackers were captured. + /* <<if random(1,100) <= 25>> <<set _roll = random(1,100)>> <<if _roll <= 33>> @@ -1566,6 +1325,7 @@ <<set _candidates = 1>> <</if>> <</if>> + */ <br> <span id="captOptions"> <<link "sell them all immediately">> @@ -1606,12 +1366,12 @@ <<set $majorBattle = 0>> <<set $SFIntervention = 0>> <<set $secBots.isDeployed = 0>> -<<for _i = 0; _i < _mL; _i++>> +<<for _i = 0; _i < $militiaUnits.length; _i++>> <<set $militiaUnits[_i].isDeployed = 0>> <</for>> -<<for _i = 0; _i < _sL; _i++>> +<<for _i = 0; _i < $slaveUnits.length; _i++>> <<set $slaveUnits[_i].isDeployed = 0>> <</for>> -<<for _i = 0; _i < _meL; _i++>> +<<for _i = 0; _i < $mercUnits.length; _i++>> <<set $mercUnits[_i].isDeployed = 0>> <</for>> \ No newline at end of file diff --git a/src/SecExp/rebellionEventGenerator.tw b/src/SecExp/rebellionEventGenerator.tw index 4b145da85377c1525db71e4fb2e047ce914d6906..e08a2d0db1665e67d02d01ef0f12880a232e9059 100644 --- a/src/SecExp/rebellionEventGenerator.tw +++ b/src/SecExp/rebellionEventGenerator.tw @@ -81,8 +81,7 @@ <<set _citizen -= 5>> <</if>> <<if $militiaFounded == 1>> - <<if ($arcologies[0].FSRomanRevivalist == "unset" && $arcologies[0].FSAztecRevivalist == "unset" && $arcologies[0].FSEgyptianRevivalist == "unset" && - $arcologies[0].FSEdoRevivalist == "unset" && $arcologies[0].FSArabianRevivalist == "unset" && $arcologies[0].FSChineseRevivalist == "unset")>> + <<if ($arcologies[0].FSRomanRevivalist == "unset" && $arcologies[0].FSAztecRevivalist == "unset" && $arcologies[0].FSEgyptianRevivalist == "unset" && $arcologies[0].FSEdoRevivalist == "unset" && $arcologies[0].FSArabianRevivalist == "unset" && $arcologies[0].FSChineseRevivalist == "unset")>> <<if $militarizedSociety == 1>> <<set _citizen += 20>> <<elseif $militaryService == 1>> @@ -102,7 +101,7 @@ <</if>> <<if $arcologies[0].FSNull != "unset">> <<set _citizen += either(20,30)>> -<</if> +<</if>> <<if $arcologies[0].FSRestart != "unset">> <<if _CSratio > 1>> <<set _citizen +=20>> diff --git a/src/SecExp/secBarracks.tw b/src/SecExp/secBarracks.tw index 9c62f1f702356ed752270649c79aa68c892e1296..53c276bb7b0b78dc41697f4a638935947fbc43a1 100644 --- a/src/SecExp/secBarracks.tw +++ b/src/SecExp/secBarracks.tw @@ -167,13 +167,13 @@ You are free to organize your menial slaves into fighting units. Currently you h <br> <<link "Form a new unit">> <<if $createdSlavesUnits == 0>> - <<set _name = (1+$slaveUnits.length) + "st slave platoon">> + <<set _name = (1+$createdSlavesUnits) + "st slave platoon">> <<elseif $createdSlavesUnits == 1>> - <<set _name = (1+$slaveUnits.length) + "nd slave platoon">> + <<set _name = (1+$createdSlavesUnits) + "nd slave platoon">> <<elseif $createdSlavesUnits == 2>> - <<set _name = (1+$slaveUnits.length) + "rd slave platoon">> + <<set _name = (1+$createdSlavesUnits) + "rd slave platoon">> <<else>> - <<set _name = (1+$slaveUnits.length) + "th slave platoon">> + <<set _name = (1+$createdSlavesUnits) + "th slave platoon">> <</if>> <<if $helots >= $maxTroops>> <<set _newUnit = { @@ -302,11 +302,11 @@ You are free to organize your menial slaves into fighting units. Currently you h <</capture>> <</for>> +<<if $militiaFounded == 1>> <br> <br> __Militia__ <br>/* militia */ -<<if $militiaFounded == 1>> You founded the $arcologies[0].name free militia. You are now able to organize your citizens in fighting units. <<if $militiaRecruitment == 0>> The militia is composed entirely of volunteers, your manpower is approximately 1.5% of the citizens population of your arcology. @@ -322,13 +322,13 @@ __Militia__ <br> <<link "Form a new unit">> <<if $createdMilitiaUnits == 0>> - <<set _name = (1+$militiaUnits.length) + "st citizens' platoon">> + <<set _name = (1+$createdMilitiaUnits) + "st citizens' platoon">> <<elseif $createdMilitiaUnits == 1>> - <<set _name = (1+$militiaUnits.length) + "nd citizens' platoon">> + <<set _name = (1+$createdMilitiaUnits) + "nd citizens' platoon">> <<elseif $createdMilitiaUnits == 2>> - <<set _name = (1+$militiaUnits.length) + "rd citizens' platoon">> + <<set _name = (1+$createdMilitiaUnits) + "rd citizens' platoon">> <<else>> - <<set _name = (1+$militiaUnits.length) + "th citizens' platoon">> + <<set _name = (1+$createdMilitiaUnits) + "th citizens' platoon">> <</if>> <<if $militiaFreeManpower >= $maxTroops>> <<set _newUnit = { @@ -460,14 +460,16 @@ __Militia__ <</for>> <br> <<else>> + <br> + <br> You have not yet founded the militia, you will not be able to form citizens units. <</if>> +<<if $mercenaries >= 1>> <br> <br> __Mercenaries__ <br>/* mercenaries */ -<<if $mercenaries >= 1>> 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 $mercTotalManpower>> mercenaries in your arcology, of which <<print $mercEmployedManpower>> actively employed and <<print $mercFreeManpower>> not yet under contract. In total <<print $mercTotalCasualties>> mercenaries have died defending your arcology. <br> @@ -476,13 +478,13 @@ __Mercenaries__ <br> <<link "Form a new unit">> <<if $createdMercUnits == 0>> - <<set _name = (1+$mercUnits.length) + "st mercenary platoon">> + <<set _name = (1+$createdMercUnits) + "st mercenary platoon">> <<elseif $createdMercUnits == 1>> - <<set _name = (1+$mercUnits.length) + "nd mercenary platoon">> + <<set _name = (1+$createdMercUnits) + "nd mercenary platoon">> <<elseif $createdMercUnits == 2>> - <<set _name = (1+$mercUnits.length) + "rd mercenary platoon">> + <<set _name = (1+$createdMercUnits) + "rd mercenary platoon">> <<else>> - <<set _name = (1+$mercUnits.length) + "th mercenary platoon">> + <<set _name = (1+$createdMercUnits) + "th mercenary platoon">> <</if>> <<if $mercFreeManpower >= $maxTroops>> <<set _newUnit = { @@ -610,4 +612,8 @@ __Mercenaries__ <</if>> <</capture>> <</for>> +<<else>> + <br> + <br> + Mercenaries are not allowed inside the arcology. You will not be able to recruit mercenary units. <</if>> \ No newline at end of file diff --git a/src/SecExp/secExpOptions.tw b/src/SecExp/secExpOptions.tw index 5f690211f12224c7bb1fa63e3194ec4e662b0dfc..faccd73f7ba020b9d5b2ab1f7d8a767223ea4fb3 100644 --- a/src/SecExp/secExpOptions.tw +++ b/src/SecExp/secExpOptions.tw @@ -64,7 +64,7 @@ <</if>> <br> <br> - <<if $showBattleStatistics == 0 && $battlesEnabled == 1>> + <<if $showBattleStatistics == 0 && $battlesEnabled == 1 && $arcologyUpgrade.drones == 1>> Detailed battle statistics are @@.red;HIDDEN@@. <<link "enable detailed battle statistics">> <<set $showBattleStatistics = 1>> diff --git a/src/SecExp/secInit.tw b/src/SecExp/secInit.tw index b64ec67c869d133d432d6741d7e297c8c02c91aa..6d2b922f06a9d50790cdef8c96a93e5adc7b16c7 100644 --- a/src/SecExp/secInit.tw +++ b/src/SecExp/secInit.tw @@ -150,6 +150,9 @@ /* battle relevant variables */ +<<set $totalKills = 0>> +<<set $battlesCount = 0>> +<<set $majorBattlesCount = 0>> <<set $chosenTactic = "none">> <<set $leadingTroops = "none">> <<set $attackTroops = 0>> diff --git a/src/SecExp/seeUnit.tw b/src/SecExp/seeUnit.tw index bbdd26d73a420a81be0d871826d95ca70057245b..5f505548fe344ba39198a909a5adfb6919a87636 100644 --- a/src/SecExp/seeUnit.tw +++ b/src/SecExp/seeUnit.tw @@ -36,6 +36,9 @@ <<elseif $targetUnit == "militiaUnits">> <<militiaUnitsDescription $militiaUnits[$targetIndex]>> <br><br> + Rename unit <<textbox "$militiaUnits[$targetIndex].platoonName" $militiaUnits[$targetIndex].platoonName "seeUnit">> + <br> + <br> <<if $militiaUnits[$targetIndex].maxTroops < 50>> <<link "Intensive officers training">> <<set $militiaUnits[$targetIndex].maxTroops += 10>> @@ -74,6 +77,9 @@ <<elseif $targetUnit == "slaveUnits">> <<slaveUnitsDescription $slaveUnits[$targetIndex]>> <br><br> + Rename unit <<textbox "$slaveUnits[$targetIndex].platoonName" $slaveUnits[$targetIndex].platoonName "seeUnit">> + <br> + <br> <<if $slaveUnits[$targetIndex].maxTroops < 50>> <<link "Intensive officers training">> <<set $slaveUnits[$targetIndex].maxTroops += 10>> @@ -112,6 +118,9 @@ <<elseif $targetUnit == "mercUnits">> <<mercUnitsDescription $mercUnits[$targetIndex]>> <br><br> + Rename unit <<textbox "$mercUnits[$targetIndex].platoonName" $mercUnits[$targetIndex].platoonName "seeUnit">> + <br> + <br> <<if $mercUnits[$targetIndex].maxTroops < 50>> <<link "Intensive officers training">> <<set $mercUnits[$targetIndex].maxTroops += 10>> diff --git a/src/SecExp/unitsBattleReport.tw b/src/SecExp/unitsBattleReport.tw new file mode 100644 index 0000000000000000000000000000000000000000..8a2eae18a071c85e77ac9dd897eaa7a5dc143711 --- /dev/null +++ b/src/SecExp/unitsBattleReport.tw @@ -0,0 +1,242 @@ +:: unitsBattleReport [nobr] + +<<if $losses == 0>> + <<if $deployingBots == 1>> + Your squadron of security drones participated in the battle, dominating the airspace and providing vital intelligence to the rest of the army. + During the battle they suffered no casualties. + <</if>> + <<if $SFIntervention == 1>> + <<print $securityForcePersonnel>> soldiers from the $securityForceName joined the battle aboard their<<if $securityForceVehiclePower >= 4>>armored<</if>>vehicles<<if $securityForceAC130 > 0>>and their AC130<</if>>. + Free cities armies are a rare sight, but their power is undeniable and your $securityForceName is living testament of this. + During the battle they suffered no casualties. + <</if>> + <<if $deployingMilitia == 1>> + <<for _j = 0; _j < $militiaUnits.length; _j++>> + <<if $militiaUnits[_j].isDeployed == 1>> + $militiaUnits[_j].platoonName participated in the battle, your proud citizens defending with their lives their arcology. + During the battle they suffered no casualties. + <</if>> + <</for>> + <</if>> + <<if $deployingSlaves == 1>> + <<for _j = 0; _j < $slaveUnits.length; _j++>> + <<if $slaveUnits[_j].isDeployed == 1>> + $slaveUnits[_j].platoonName participated in the battle. While a rare sight, your slave soldiers show no less willingness to fight for their arcology than their free counterparts, be it because of fear or devotion to their owner. + During the battle they suffered no casualties. + <</if>> + <</for>> + <</if>> + <<if $deployingMercs == 1>> + <<for _j = 0; _j < $mercUnits.length; _j++>> + <<if $mercUnits[_j].isDeployed == 1>> + $mercUnits[_j].platoonName participated in the battle. Mercenaries are a common sight on the modern battlefield and yours are proud to serve their generous contractor. + During the battle they suffered no casualties. + <</if>> + <</for>> + <</if>> + +<<else>> + /* if the losses are more than zero */ + <<if $SFIntervention == 1>> + <<set $deployedUnits++>> + <</if>> + <<set _averageLosses = Math.trunc($losses / $deployedUnits)>> + <<set _lossesList = []>> + <<for _i = 0; _i < $deployedUnits; _i++>> + <<set _assignedLosses = Math.trunc(Math.clamp(_averageLosses + random(-5,5), 0, 100))>> + <<if _assignedLosses > $losses>> + <<set _assignedLosses = $losses>> + <<set $losses = 0>> + <<else>> + <<set $losses -= _assignedLosses>> + <</if>> + <<set _lossesList.push(_assignedLosses)>> + <</for>> + <<set _lossesList.shuffle()>> + + /* assigns the losses and notify the player */ + + <<if $deployingBots == 1>> + <br> + <br> + <<set _loss = _lossesList.pluck()>> + <<if _loss < $secBots.troops>> + <<set $secBots.troops -= _loss>> + <<else>> + <<set $secBots.troops = 0>> + <</if>> + Your squadron of security drones participated in the battle, dominating the airspace and providing vital intelligence to the rest of the army. + During the battle they suffered + <<if _loss <= 0>> + no casualties. + <<elseif _loss <= 10>> + light casualties. + <<elseif _loss <= 30>> + moderate casualties. + <<elseif _loss <= 60>> + heavy casualties. + <<else>> + catastrofic casualties. + <</if>> + <<if $secBots.troops <= 0>> + <<set $secBots.active = 0>> + Unfortunately the losses they took were simply too great, their effective combatants are in so small number you can no longer call them a deployable unit. It will take quite the investment to rebuild them. + <<elseif $secBots.troops <= 10>> + The unit has very few operatives left, it risks compelte annihilation if deployed again. + <</if>> + <</if>> + <<if $SFIntervention == 1>> + <br> + <br> + <<set _loss = _lossesList.pluck()>> + <<if _loss < $securityForcePersonnel>> + <<set $securityForcePersonnel -= _loss>> + <<else>> + <<set $securityForcePersonnel = 0>> + <</if>> + <<print $securityForcePersonnel>> soldiers from the $securityForceName joined the battle aboard their<<if $securityForceVehiclePower >= 4>>armored<</if>>vehicles<<if $securityForceAC130 > 0>>and their AC130<</if>>. + Free cities armies are a rare sight, but their power is undeniable and your $securityForceName is living testament of this. + During the battle they suffered + <<if _loss <= 0>> + no casualties. + <<elseif _loss <= 10>> + light casualties. + <<elseif _loss <= 30>> + moderate casualties. + <<elseif _loss <= 60>> + heavy casualties. + <<else>> + catastrofic casualties. + <</if>> + <</if>> + <<if $deployingMilitia == 1>> + <<for _j = 0; _j < $militiaUnits.length; _j++>> + <<if $militiaUnits[_j].isDeployed == 1>> + <br> + <br> + <<set _loss = _lossesList.pluck()>> + <<set _loss = Math.clamp(_loss,0,$militiaUnits[_j].troops)>> + $militiaUnits[_j].platoonName participated in the battle, your proud citizens defending with their lives their arcology. + During the battle they suffered + <<if _loss <= 0>> + no casualties + <<elseif _loss <= 10>> + light casualties + <<elseif _loss <= 30>> + moderate casualties + <<elseif _loss <= 60>> + heavy casualties + <<else>> + catastrofic casualties + <</if>> + <<if $militiaUnits[_j].medics == 1>> + , however <<print math.trunc(_loss * $militiaUnits[_j].medics * 0.25)>> men were saved by the medics attached to this unit. + <<else>> + . + <</if>> + <<set $militiaUnits[_j].troops -= Math.trunc(_loss - _loss * $militiaUnits[_j].medics * 0.25)>> + <<set $militiaEmployedManpower -= Math.trunc(_loss - _loss * $militiaUnits[_j].medics * 0.25)>> + <<set $militiaTotalCasualties += Math.trunc(_loss - _loss * $militiaUnits[_j].medics * 0.25)>> + <<if $militiaUnits[_j].training < 100>> + <<if random(1,100) > 60>> + Fighting in the field increased the experience of the unit, making it more effective in future fights. + <<set $militiaUnits[_j].training += random(5,15) + $majorBattle * random(5,15)>> + <</if>> + <</if>> + <<if $militiaUnits[_j].troops <= 0>> + <<set $militiaUnits[_j].active = 0>> + <br>Unfortunately the losses they took were simply too great, their effective combatants are in so small number you can no longer call them a deployable unit. The remnants will be sent home honored as veterans or reorganized in a new unit. + <<elseif $militiaUnits[_j].troops <= 10>> + <br>The unit has very few operatives left, it risks complete annihilation if deployed again. + <</if>> + <</if>> + <</for>> + <</if>> + <<if $deployingSlaves == 1>> + <<for _j = 0; _j < $slaveUnits.length; _j++>> + <<if $slaveUnits[_j].isDeployed == 1>> + <br> + <br> + <<set _loss = _lossesList.pluck()>> + <<set _loss = Math.clamp(_loss,0,$slaveUnits[_j].troops)>> + $slaveUnits[_j].platoonName participated in the battle. While a rare sight, your slave soldiers show no less willingness to fight for their arcology than their free counterparts, be it because of fear or devotion to their owner. + During the battle they suffered + <<if _loss <= 0>> + no casualties + <<elseif _loss <= 10>> + light casualties + <<elseif _loss <= 30>> + moderate casualties + <<elseif _loss <= 60>> + heavy casualties + <<else>> + catastrofic casualties + <</if>> + <<if $slaveUnits[_j].medics == 1>> + , however <<print math.trunc(_loss * $slaveUnits[_j].medics * 0.25)>> men were saved by the medics attached to this unit. + <<else>> + . + <</if>> + <<set $slaveUnits[_j].troops -= Math.trunc(_loss - _loss * $slaveUnits[_j].medics * 0.25)>> + <<set $slavesEmployedManpower -= Math.trunc(_loss - _loss * $slaveUnits[_j].medics * 0.25)>> + <<set $slavesTotalCasualties += Math.trunc(_loss - _loss * $slaveUnits[_j].medics * 0.25)>> + <<if $slaveUnits[_j].training < 100>> + <<if random(1,100) > 60>> + Fighting in the field increased the experience of the unit, making it more effective in future fights. + <<set $slaveUnits[_j].training += random(5,15) + $majorBattle * random(5,15)>> + <</if>> + <</if>> + <<if $slaveUnits[_j].troops <= 0>> + <<set $slaveUnits[_j].active = 0>> + <br>Unfortunately the losses they took were simply too great, their effective combatants are in so small number you can no longer call them a deployable unit. The sorvivors will be sent home honored as veterans or reorganized in a new unit. + <<elseif $slaveUnits[_j].troops <= 10>> + <br>The unit has very few operatives left, it risks complete annihilation if deployed again. + <</if>> + <</if>> + <</for>> + <</if>> + <<if $deployingMercs == 1>> + <<for _j = 0; _j < $mercUnits.length; _j++>> + <<if $mercUnits[_j].isDeployed == 1>> + <br> + <br> + <<set _loss = _lossesList.pluck()>> + <<set _loss = Math.clamp(_loss,0,$mercUnits[_j].troops)>> + $mercUnits[_j].platoonName participated in the battle. Mercenaries are a common sight on the modern battlefield and yours are proud to serve their generous contractor. + During the battle they suffered + <<if _loss <= 0>> + no casualties + <<elseif _loss <= 10>> + light casualties + <<elseif _loss <= 30>> + moderate casualties + <<elseif _loss <= 60>> + heavy casualties + <<else>> + catastrofic casualties + <</if>> + <<if $mercUnits[_j].medics == 1>> + , however + <<print math.trunc(_loss * $mercUnits[_j].medics * 0.25)>> men were saved by the medics attached to this unit. + <<else>> + . + <</if>> + <<set $mercUnits[_j].troops -= Math.trunc(_loss - _loss * $mercUnits[_j].medics * 0.25)>> + <<set $mercEmployedManpower -= Math.trunc(_loss - _loss * $mercUnits[_j].medics * 0.25)>> + <<set $mercTotalCasualties += Math.trunc(_loss - _loss * $mercUnits[_j].medics * 0.25)>> + <<if $mercUnits[_j].training < 100>> + <<if random(1,100) > 60>> + Fighting in the field increased the experience of the unit, making it more effective in future fights. + <<set $mercUnits[_j].training += random(5,15) + $majorBattle * random(5,15)>> + <</if>> + <</if>> + <<if $mercUnits[_j].troops <= 0>> + <<set $mercUnits[_j].active = 0>> + <br>Unfortunately the losses they took were simply too great, their effective combatants are in so small number you can no longer call them a deployable unit. The remnants will be sent home honored as veterans or reorganized in a new unit. + <<elseif $mercUnits[_j].troops <= 10>> + <br>The unit has very few operatives left, it risks complete annihilation if deployed again. + <</if>> + <</if>> + <</for>> + <</if>> +<</if>> /* closes check for more than zero casualties */ \ No newline at end of file diff --git a/src/SecExp/widgets/miscSecExpWidgets.tw b/src/SecExp/widgets/miscSecExpWidgets.tw new file mode 100644 index 0000000000000000000000000000000000000000..04f4f35ed62222e530f81e3134a9c885c01f0211 --- /dev/null +++ b/src/SecExp/widgets/miscSecExpWidgets.tw @@ -0,0 +1,30 @@ +:: miscSecExpWidgets [widget nobr] + +<<widget "recalcManpower">> + <<set _correctEmployedMP = 0>> + <<for _i = 0; _i < $slaveUnits.length; _i++>> + <<set _correctEmployedMP += $slaveUnits[_i].troops>> + <</for>> + + <<if $slavesEmployedManpower != _correctEmployedMP>> + <<set $slavesEmployedManpower = _correctEmployedMP>> + <</if>> + + <<set _correctEmployedMP = 0>> + <<for _i = 0; _i < $militiaUnits.length; _i++>> + <<set _correctEmployedMP += $militiaUnits[_i].troops>> + <</for>> + + <<if $militiaEmployedManpower != _correctEmployedMP>> + <<set $militiaEmployedManpower = _correctEmployedMP>> + <</if>> + + <<set _correctEmployedMP = 0>> + <<for _i = 0; _i < $mercUnits.length; _i++>> + <<set _correctEmployedMP += $mercUnits[_i].troops>> + <</for>> + + <<if $mercEmployedManpower != _correctEmployedMP>> + <<set $mercEmployedManpower = _correctEmployedMP>> + <</if>> +<</widget>> \ No newline at end of file diff --git a/src/SecExp/widgets/unitsDescriptionWidgets.tw b/src/SecExp/widgets/unitsWidgets.tw similarity index 99% rename from src/SecExp/widgets/unitsDescriptionWidgets.tw rename to src/SecExp/widgets/unitsWidgets.tw index 1c9eef79c2792a5dc908ab7b15bfcd381e27878b..10cb868685416658a5b10d7fb21eaad5cb19e979 100644 --- a/src/SecExp/widgets/unitsDescriptionWidgets.tw +++ b/src/SecExp/widgets/unitsWidgets.tw @@ -1,4 +1,4 @@ -:: unitsDescriptionWidgets [widget nobr] +:: unitsWidgets [widget nobr] <<widget "militiaUnitsDescription">> <<if $args[0].active == 1>> diff --git a/src/uncategorized/costsReport.tw b/src/uncategorized/costsReport.tw index ec07e5702b36d299bb3048035ac01b95b824e66e..e65ed30316709031ef1a08dbd7db11803e20b6bb 100644 --- a/src/uncategorized/costsReport.tw +++ b/src/uncategorized/costsReport.tw @@ -110,17 +110,14 @@ <br>__Barracks__ maintenance: ¤<<print $secBarracksUpkeep>> <</if>> - <<set _mL = $militiaUnits.length>> - <<for _i = 0; _i < _mL; _i++>> + <<for _i = 0; _i < $militiaUnits.length; _i++>> <br>__<<print $militiaUnits[_i].platoonName>>__ upkeep: ¤<<print $militiaUnits[_i].troops*$soldierUpkeep>> <</for>> - <<set _sL = $slaveUnits.length>> - <<for _i = 0; _i < _sL; _i++>> - <br>__<<print $militiaUnits[_i].platoonName>>__ upkeep: ¤<<print $militiaUnits[_i].troops*$soldierUpkeep*0.5>> + <<for _i = 0; _i < $slaveUnits.length; _i++>> + <br>__<<print $slaveUnits[_i].platoonName>>__ upkeep: ¤<<print $slaveUnits[_i].troops*$soldierUpkeep*0.5>> <</for>> - <<set _meL = $mercUnits.length>> - <<for _i = 0; _i < _meL; _i++>> - <br>__<<print $militiaUnits[_i].platoonName>>__ upkeep: ¤<<print $militiaUnits[_i].troops*$soldierUpkeep*1.5>> + <<for _i = 0; _i < $mercUnits.length; _i++>> + <br>__<<print $mercUnits[_i].platoonName>>__ upkeep: ¤<<print $mercUnits[_i].troops*$soldierUpkeep*1.5>> <</for>> <</if>> diff --git a/src/uncategorized/manageArcology.tw b/src/uncategorized/manageArcology.tw index e7483dbfc9d1aa57dd6ac5b1db9274b76d081805..898947aa6734e3c8e7495a5eee17c98414bf40f7 100644 --- a/src/uncategorized/manageArcology.tw +++ b/src/uncategorized/manageArcology.tw @@ -165,6 +165,19 @@ Your slaves have participated in approximately <<print $oralTotal+$vaginalTotal+ <<if $pitKillsTotal > 0>>$pitKillsTotal slaves have died in your fighting pit.<</if>> <<if $fuckdollsSold > 0>>$fuckdollsSold mindbroken arcade slaves have been converted into Fuckdolls and sold.<</if>> +<<if $secExp == 1 && $battlesEnabled == 1>> +<br><br> +<<if $securityForceCreate == 0>> + Your army counts <<print $militiaEmployedManpower + $slavesEmployedManpower + $mercEmployedManpower>> total soldiers. +<<else>> + Your army counts <<print $militiaEmployedManpower + $slavesEmployedManpower + $mercEmployedManpower + $securityForcePersonnel>> total soldiers of which $securityForcePersonnel under the security force command and the rest under your direct control. +<</if>> +<<if $hasFoughtOnce == 1>> + Your troops were involved in <<print $battlesCount>> battles of which <<print $majorBattlesCount>> major engagements. You won <<print $PCvictories>> of them, while the enemy managed to gain the upper hand in the other <<print $PClosses>> kills. + During all battles you lost a total of <<print $militiaTotalCasualties + $slavesTotalCasualties + $mercTotalCasualties>> men, while scoring a total of <<print $totalKills>>. +<</if>> + +<</if>> <br><br> Your arcology is named <<textbox "$arcologies[0].name" $arcologies[0].name "Manage Arcology">> diff --git a/src/uncategorized/storyCaption.tw b/src/uncategorized/storyCaption.tw index c2cc2ba2c28bcd5ace48943a6e0c19e170ff3a39..66a3d4ecdea7ea8c81fd769a13cee5cab12e911e 100644 --- a/src/uncategorized/storyCaption.tw +++ b/src/uncategorized/storyCaption.tw @@ -465,7 +465,7 @@ <br><span id="PAOButton"><<link [[Personal Assistant|Personal assistant options]]>><</link>></span> @@.cyan;[T]@@ <br><span id="policyButton"><<link [[Policies]]>><</link>></span> @@.cyan;[Y]@@ <<if $secExp == 1>> - <br><<link [[Edicts|edicts]]>><</link>> + <br><span id="edictButton"><<link [[Edicts|edicts]]>><</link>></span> @@.cyan;[E]@@ <</if>> <<if $FSAnnounced>> <br><span id="FSButton"><<link [[Future Societies|Future Society]]>><</link>></span> @@.cyan;[F]@@