diff --git a/src/SecExp/secBarracks.tw b/src/SecExp/secBarracks.tw index 87f2ef64af043995c4e3780f4144cf1aa07af997..341567e8a958bedc11f68ba16be39699717f8879 100644 --- a/src/SecExp/secBarracks.tw +++ b/src/SecExp/secBarracks.tw @@ -191,35 +191,12 @@ You are free to organize your menial slaves into fighting units. Currently you h <<if $helots > 0 && $activeUnits < $maxUnits>> <br> <<link "Form a new unit" "secBarracks">> - <<set _name = "<<= ordinalSuffix($createdSlavesUnits+1)>> slave platoon">> - <<if $helots >= $maxTroops>> - <<set _newUnit = { - ID: 0, - platoonName: _name, - active: 1, - isDeployed: 0, - troops: $maxTroops, - maxTroops: $maxTroops, - equip: 0, - training: 0, - loyalty: random(40,60), - cyber: 0, - medics: 0, - SF: 0, - commissars: 0, - battlesFought: 0}>> - <<generateUnitID _newUnit>> - <<set $slaveUnits.push(_newUnit)>> - <<set $helots -= 30>> - <<set $slavesEmployedManpower += 30>> - <<set $createdSlavesUnits++>> - <<else>> - <<set _newUnit = { + <<set _newUnit = { ID: 0, - platoonName: _name, + platoonName: ordinalSuffix(++$createdSlavesUnits) + " slave platoon", active: 1, isDeployed: 0, - troops: $helots, + troops: Math.min($maxTroops, $helots), maxTroops: $maxTroops, equip: 0, training: 0, @@ -229,12 +206,10 @@ You are free to organize your menial slaves into fighting units. Currently you h SF: 0, commissars: 0, battlesFought: 0}>> - <<generateUnitID _newUnit>> - <<set $slaveUnits.push(_newUnit)>> - <<set $slavesEmployedManpower += _newUnit.troops>> - <<set $helots = 0>> - <<set $createdSlavesUnits++>> - <</if>> + <<generateUnitID _newUnit>> + <<set $slaveUnits.push(_newUnit)>> + <<set $helots -= _newUnit.troops>> + <<set $slavesEmployedManpower += _newUnit.troops>> <<set $activeUnits++>> <</link>> <</if>> @@ -333,35 +308,12 @@ __Militia__ <<if $militiaFreeManpower > 0 && $activeUnits < $maxUnits>> <br> <<link "Form a new unit" "secBarracks">> - <<set _name = "<<= ordinalSuffix($createdMilitiaUnits+1)>> citizens' platoon">> - <<if $militiaFreeManpower >= $maxTroops>> - <<set _newUnit = { - ID: 0, - platoonName: _name, - active: 1, - isDeployed: 0, - troops: $maxTroops, - maxTroops: $maxTroops, - equip: 0, - training: 0, - loyalty: random(40,60), - cyber: 0, - medics: 0, - SF: 0, - commissars: 0, - battlesFought: 0}>> - <<generateUnitID _newUnit>> - <<set $militiaUnits.push(_newUnit)>> - <<set $militiaFreeManpower -= 30>> - <<set $militiaEmployedManpower += 30>> - <<set $createdMilitiaUnits++>> - <<else>> - <<set _newUnit = { + <<set _newUnit = { ID: 0, - platoonName: _name, + platoonName: ordinalSuffix(++$createdMilitiaUnits) + " citizens' platoon", active: 1, isDeployed: 0, - troops: $militiaFreeManpower, + troops: Math.min($maxTroops, $militiaFreeManpower), maxTroops: $maxTroops, equip: 0, training: 0, @@ -371,12 +323,10 @@ __Militia__ SF: 0, commissars: 0, battlesFought: 0}>> - <<generateUnitID _newUnit>> - <<set $militiaUnits.push(_newUnit)>> - <<set $militiaEmployedManpower += _newUnit.troops>> - <<set $militiaFreeManpower = 0>> - <<set $createdMilitiaUnits++>> - <</if>> + <<generateUnitID _newUnit>> + <<set $militiaUnits.push(_newUnit)>> + <<set $militiaFreeManpower -= _newUnit.troops>> + <<set $militiaEmployedManpower += _newUnit.troops>> <<set $activeUnits++>> <</link>> <</if>> @@ -475,35 +425,12 @@ __Mercenaries__ <<if $mercFreeManpower > 0 && $activeUnits < $maxUnits>> <br> <<link "Form a new unit" "secBarracks">> - <<set _name = "<<= ordinalSuffix($createdMercUnits+1)>> mercenary platoon">> - <<if $mercFreeManpower >= $maxTroops>> - <<set _newUnit = { - ID: 0, - platoonName: _name, - active: 1, - isDeployed: 0, - troops: $maxTroops, - maxTroops: $maxTroops, - equip: 0, - training: 0, - loyalty: random(40,60), - cyber: 0, - medics: 0, - SF: 0, - commissars: 0, - battlesFought: 0}>> - <<generateUnitID _newUnit>> - <<set $mercUnits.push(_newUnit)>> - <<set $mercFreeManpower -= 30>> - <<set $mercEmployedManpower += 30>> - <<set $createdMercUnits++>> - <<else>> - <<set _newUnit = { + <<set _newUnit = { ID: 0, - platoonName: _name, + platoonName: ordinalSuffix(++$createdMercUnits) + " mercenary platoon", active: 1, isDeployed: 0, - troops: $mercFreeManpower, + troops: Math.min($maxTroops, $mercFreeManpower), maxTroops: $maxTroops, equip: 0, training: 0, @@ -513,12 +440,10 @@ __Mercenaries__ SF: 0, commissars: 0, battlesFought: 0}>> - <<generateUnitID _newUnit>> - <<set $mercUnits.push(_newUnit)>> - <<set $mercEmployedManpower += _newUnit.troops>> - <<set $mercFreeManpower = 0>> - <<set $createdMercUnits++>> - <</if>> + <<generateUnitID _newUnit>> + <<set $mercUnits.push(_newUnit)>> + <<set $mercFreeManpower -= _newUnit.troops>> + <<set $mercEmployedManpower += _newUnit.troops>> <<set $activeUnits++>> <</link>> <</if>>