diff --git a/src/SecExp/SecExpBackwardCompatibility.tw b/src/SecExp/SecExpBackwardCompatibility.tw index 1e382878e8353225a3581ea5048eca8f48e51ee7..598f27683f1b939eea128f0bdf97c6992584e0f5 100644 --- a/src/SecExp/SecExpBackwardCompatibility.tw +++ b/src/SecExp/SecExpBackwardCompatibility.tw @@ -80,15 +80,30 @@ <<if ndef $EnemyWon>> <<set $EnemyWon = 0>> <</if>> -<<if ndef $keepRoster>> - <<set $keepRoster = 0>> +<<if ndef $PCpartialWon>> + <<set $PCpartialWon = 0>> <</if>> - +<<if ndef $enemyPartialWon>> + <<set $enemyPartialWon = 0>> +<</if>> +<<if ndef $PCsurrenders>> + <<set $PCsurrenders = 0>> +<</if>> +<<if ndef $losses>> + <<set $losses = 0>> +<</if>> +<<if ndef $enemyLosses>> + <<set $enemyLosses = 0>> +<</if>> +<<if ndef $battleTurns>> + <<set $battleTurns = 0>> +<</if>> + /* statistics | since these won't get modified in game, it's not necessary to check if they are defined */ <<set $equipMod = 0.15>> <<set $secBotsBaseAttack = 9>> <<set $secBotsBaseDefense = 5>> -<<set $secBotsMorale = 120>> +<<set $secBotsMorale = 200>> <<set $secBotsBaseHp = 4>> <<set $militiaBaseAttack = 7>> <<set $militiaBaseDefense = 5>> @@ -103,22 +118,22 @@ <<set $mercBaseMorale = 125>> <<set $mercBaseHp = 4>> -<<set $raBaseAttack = 8>> -<<set $raBaseDefense = 3>> +<<set $raBaseAttack = 7>> +<<set $raBaseDefense = 2>> <<set $raBaseMorale = 100>> -<<set $raBaseHp = 3>> -<<set $fcBaseAttack = 7>> -<<set $fcBaseDefense = 5>> +<<set $raBaseHp = 2>> +<<set $fcBaseAttack = 6>> +<<set $fcBaseDefense = 4>> <<set $fcBaseMorale = 130>> -<<set $fcBaseHp = 4>> -<<set $owBaseAttack = 9>> -<<set $owBaseDefense = 5>> +<<set $fcBaseHp = 3>> +<<set $owBaseAttack = 8>> +<<set $owBaseDefense = 4>> <<set $owBaseMorale = 110>> -<<set $owBaseHp = 3>> -<<set $ffBaseAttack = 10>> -<<set $ffBaseDefense = 3>> +<<set $owBaseHp = 2>> +<<set $ffBaseAttack = 9>> +<<set $ffBaseDefense = 2>> <<set $ffBaseMorale = 160>> -<<set $ffBaseHp = 3>> +<<set $ffBaseHp = 2>> /* units */ <<if ndef $secBots>> diff --git a/src/SecExp/attackGenerator.tw b/src/SecExp/attackGenerator.tw index 48b79dbbf5007a4219ffba5ef41c72b5ad63ed2b..5bf38fe552b600efb164654f135aef018f651809 100644 --- a/src/SecExp/attackGenerator.tw +++ b/src/SecExp/attackGenerator.tw @@ -125,17 +125,19 @@ <<if $attackType != "none">> <<if $attackType == "raiders">> <<if $terrain == "urban">> - <<set $battleTerrain = either("outskirts", "urban", "wasteland")>> + <<set $battleTerrain = either("outskirts","urban","wasteland")>> <<elseif $terrain == "rural">> - <<set $battleTerrain = either("hills", "outskirts", "rural", "wasteland")>> + <<set $battleTerrain = either("hills","outskirts","rural","wasteland")>> <<elseif $terrain == "ravine">> - <<set $battleTerrain = either("mountains", "outskirts", "hills", "wasteland")>> + <<set $battleTerrain = either("mountains","outskirts","hills","wasteland")>> <<elseif $terrain == "marine">> - <<set $battleTerrain = either("coast", "outskirts", "hills", "wasteland")>> + <<set $battleTerrain = either("coast","outskirts","hills","wasteland")>> <<elseif $terrain == "oceanic">> - <<set $battleTerrain = either("sea", "urban")>> + <<set $battleTerrain = either("sea","urban")>> + <<else>> + <<set $battleTerrain = "err">> <</if>> - <<set $attackTroops = random(50,100)>> + <<set $attackTroops = random(40,80)>> <<if $week < 30>> <<set $attackTroops *= random(1,2)>> <<elseif $week < 60>> @@ -158,17 +160,19 @@ <</if>> <<elseif $attackType == "free city">> <<if $terrain == "urban">> - <<set $battleTerrain = either("outskirts", "urban", "wasteland")>> + <<set $battleTerrain = either("outskirts","urban","wasteland")>> <<elseif $terrain == "rural">> - <<set $battleTerrain = either("hills", "outskirts", "rural", "wasteland")>> + <<set $battleTerrain = either("hills","outskirts","rural","wasteland")>> <<elseif $terrain == "ravine">> - <<set $battleTerrain = either("mountains", "outskirts", "hills", "wasteland")>> + <<set $battleTerrain = either("mountains","outskirts","hills","wasteland")>> <<elseif $terrain == "marine">> - <<set $battleTerrain = either("coast", "outskirts", "hills", "wasteland")>> + <<set $battleTerrain = either("coast","outskirts","hills","wasteland")>> <<elseif $terrain == "oceanic">> - <<set $battleTerrain = either("sea", "urban")>> + <<set $battleTerrain = either("sea","urban")>> + <<else>> + <<set $battleTerrain = "err">> <</if>> - <<set $attackTroops = random(35,70)>> + <<set $attackTroops = random(25,50)>> <<if $week < 30>> <<set $attackTroops *= random(1,2)>> <<elseif $week < 60>> @@ -191,17 +195,19 @@ <</if>> <<elseif $attackType == "old world">> <<if $terrain == "urban">> - <<set $battleTerrain = either("outskirts", "urban", "wasteland")>> + <<set $battleTerrain = either("outskirts","urban","wasteland")>> <<elseif $terrain == "rural">> - <<set $battleTerrain = either("hills", "outskirts", "rural", "wasteland")>> + <<set $battleTerrain = either("hills","outskirts","rural","wasteland")>> <<elseif $terrain == "ravine">> - <<set $battleTerrain = either("mountains", "outskirts", "hills", "wasteland")>> + <<set $battleTerrain = either("mountains","outskirts","hills","wasteland")>> <<elseif $terrain == "marine">> - <<set $battleTerrain = either("coast", "outskirts", "hills", "wasteland")>> + <<set $battleTerrain = either("coast","outskirts","hills","wasteland")>> <<elseif $terrain == "oceanic">> - <<set $battleTerrain = either("sea", "urban")>> + <<set $battleTerrain = either("sea","urban")>> + <<else>> + <<set $battleTerrain = "err">> <</if>> - <<set $attackTroops = random(35,70)>> + <<set $attackTroops = random(25,50)>> <<if $week < 30>> <<set $attackTroops *= random(1,2)>> <<elseif $week < 60>> @@ -224,17 +230,19 @@ <</if>> <<elseif $attackType == "freedom fighters">> <<if $terrain == "urban">> - <<set $battleTerrain = either("outskirts", "urban", "wasteland")>> + <<set $battleTerrain = either("outskirts","urban","wasteland")>> <<elseif $terrain == "rural">> - <<set $battleTerrain = either("hills", "outskirts", "rural", "wasteland")>> + <<set $battleTerrain = either("hills","outskirts","rural","wasteland")>> <<elseif $terrain == "ravine">> - <<set $battleTerrain = either("mountains", "outskirts", "hills", "wasteland")>> + <<set $battleTerrain = either("mountains","outskirts","hills","wasteland")>> <<elseif $terrain == "marine">> - <<set $battleTerrain = either("coast", "outskirts", "hills", "wasteland")>> + <<set $battleTerrain = either("coast","outskirts","hills","wasteland")>> <<elseif $terrain == "oceanic">> - <<set $battleTerrain = either("sea", "urban")>> + <<set $battleTerrain = either("sea","urban")>> + <<else>> + <<set $battleTerrain = "err">> <</if>> - <<set $attackTroops = random(40,80)>> + <<set $attackTroops = random(30,60)>> <<if $week < 30>> <<set $attackTroops *= random(1,2)>> <<elseif $week < 60>> diff --git a/src/SecExp/attackHandler.tw b/src/SecExp/attackHandler.tw index a0433bfbe620877c3e102abbfb354829cc7f2e30..2c3adef5fb458ef52a8112cdb84ab2252db0a0d6 100644 --- a/src/SecExp/attackHandler.tw +++ b/src/SecExp/attackHandler.tw @@ -13,9 +13,7 @@ <<set _enemyMorale = 0>> <<set _enemyHp = 0>> <<set _enemyBaseHp = 0>> -<<set _mL = $militiaUnits.length>> -<<set _sL = $slaveUnits.length>> -<<set _meL = $mercUnits.length>> + /* calculates leaders, tactics and terrain modifiers */ <<set _atkMod = 1>> @@ -427,19 +425,19 @@ <</for>> /* morale and baseHp calculation */ -<<set _morale = ($secBotsMorale * $deployingBots + _militiaMorale * _militiaMod * $deployingMilitia + $slaveBaseMorale * _slaveMod * $deployingSlaves + $mercBaseMorale * _mercMod * $deployingMercs) / 4>> +<<set _morale = ($secBotsMorale * $deployingBots + _militiaMorale * _militiaMod * $deployingMilitia + $slaveBaseMorale * _slaveMod * $deployingSlaves + $mercBaseMorale * _mercMod * $deployingMercs) / ($deployingBots + $deployingMilitia +$deployingSlaves + $deployingMercs)>> <<set _morale = _morale + _morale * _escortBonus * 0.05>> /* each escort upgrade gives +5% morale */ -<<set _baseHp = ($secBotsBaseHp * $deployingBots + $militiaBaseHp * $deployingMilitia + $slaveBaseHp * $deployingSlaves + $mercBaseHp * $deployingMercs) / 4>> +<<set _baseHp = ($secBotsBaseHp * $deployingBots + $militiaBaseHp * $deployingMilitia + $slaveBaseHp * $deployingSlaves + $mercBaseHp * $deployingMercs) / ($deployingBots + $deployingMilitia +$deployingSlaves + $deployingMercs)>> /* calculates enemy army stats */ <<if $attackType == "raiders">> - <<set _enemyAttack = $raBaseAttack * $raBaseAttack * $attackEquip * $equipMod>> + <<set _enemyAttack = $raBaseAttack + $raBaseAttack * $attackEquip * $equipMod>> <<set _enemyDefense = $raBaseDefense + $raBaseDefense * $attackEquip * $equipMod>> <<set _enemyMorale = $raBaseMorale* _enemyMod>> <<set _enemyHp = $raBaseHp * $attackTroops>> <<set _enemyBaseHp = $raBaseHp>> <<elseif $attackType == "free city">> - <<set _enemyAttack = $fcBaseAttack * $fcBaseAttack * $attackEquip * $equipMod>> + <<set _enemyAttack = $fcBaseAttack + $fcBaseAttack * $attackEquip * $equipMod>> <<set _enemyDefense = $fcBaseDefense + $fcBaseDefense * $attackEquip * $equipMod>> <<set _enemyMorale = $fcBaseMorale * _enemyMod>> <<set _enemyHp = $fcBaseHp * $attackTroops>> @@ -458,55 +456,70 @@ <<set _enemyBaseHp = $ffBaseHp>> <</if>> +Debug: +<br>attack: _attack +<br>defense: _defense +<br>Hp: _hp +<br>Morale: _morale +<br>atkMod: _atkMod +<br>defMod: _defMod +<br>baseHp: _baseHp +<br>enemyAttack: _enemyAttack +<br>enemyDefense: _enemyDefense +<br>enemyMorale: _enemyMorale +<br>enemyHp: _enemyHp +<br>enemyBaseHp: _enemyBaseHp +<br>enemyMod: _enemyMod + + /* simulates the combat by pitting attk against def */ <<for _i = 0; _i < $maxTurns; _i++>> + <br><br> + Debug: turn: _i /* player army attacks */ <<set _damage = _attack - _enemyDefense>> + <br> + Debug: player damage: _damage <<set _enemyHp -= _damage>> + <br> + Debug: remaining enemyHp: _enemyHp + <<set $enemyLosses += _damage / _enemyBaseHp>> <<set _enemyMorale -= (_damage + _damage / _enemyBaseHp)>> + <br> + Debug: remaining enemyMorale: _enemyMorale <<if _enemyHp <= 0 || _enemyMorale <= 0>> <<set $PCwon = 1>> + <<set $battleTurns = _i>> <<break>> <</if>> /* attacker army attacks */ <<set _damage = _enemyAttack - _defense>> + <br> + Debug: enemy damage: _damage <<set _hp -= _damage>> - <<set _losses = _damage / _baseHp>> + <br> + Debug: remaining hp: _hp + <<set $losses += _damage / _baseHp>> <<set _morale -= (_damage + _losses)>> + <br> + Debug: remaining morale: _morale <<if _hp <= 0 || _morale <= 0>> <<set $EnemyWon = 1>> + <<set $battleTurns = _i>> <<break>> <</if>> <</for>> - -/* resets variables */ -<<set $attackType = "none">> -<<set $chosenTactic = "none">> -<<set $leadingTroops = "none">> -<<set $attackTroops = 0>> -<<set $attackEquip = 0>> -<<set $deployableUnits = 0>> -<<set $deployedUnits = 0>> -<<set $deployingBots = 0>> -<<set $deployingMilitia = 0>> -<<set $deployingSlaves = 0>> -<<set $deployingMercs = 0>> -<<set $battleTerrain = "none">> -<<set $attackThisWeek = 0>> -<<set $deployableUnits = 0>> -<<set $deployedUnits = 0>> -<<set $secBots.isDeployed = 0>> -<<if $keepRoster == 0>> - <<for _i = 0; _i < _mL; _i++>> - <<set $militiaUnits[_i].isDeployed = 0>> - <</for>> - <<for _i = 0; _i < _sL; _i++>> - <<set $slaveUnits[_i].isDeployed = 0>> - <</for>> - <<for _i = 0; _i < _meL; _i++>> - <<set $mercUnits[_i].isDeployed = 0>> - <</for>> +<<if $PCwon != 1 && $EnemyWon != 1>> + <<if _morale > _enemyMorale>> + <<set $PCpartialWon = 1>> + <<elseif _morale < _enemyMorale>> + <<set $enemyPartialWon = 1>> + <</if>> <</if>> -<<goto "attackReport">> \ No newline at end of file + +<br><br> +<<link "proceed">> +<<goto "attackReport">> +<</link>> \ No newline at end of file diff --git a/src/SecExp/attackOptions.tw b/src/SecExp/attackOptions.tw index 0d9e239f19712fa05b3f641218704f1127c5b430..5cfe8c7158a57c800fa530b20b3ac7fe1e2164a8 100644 --- a/src/SecExp/attackOptions.tw +++ b/src/SecExp/attackOptions.tw @@ -112,6 +112,10 @@ It seems your troops and your adversary will fight in <strong>the mountains</strong> overlooking the arcology. <<elseif $battleTerrain == "wasteland">> in <strong>the wastelands</strong> outside the free city territory. +<<elseif $battleTerrain == "err">> + Error: failed to assign terrain +<<else>> + Error: failed to read terrain, battleTerrain reads <<print $battleTerrain>> <</if>> <<if $riskSim == 1 && $riskSimExpectedAttack == $attackType>> Your sophisticated virtual simulations and advanced recon drones allows you to accurately predict the numbers you're about to face.Approximately <strong><<print Math.round($attackTroops * (1 + either(-1,1) * 0.1))>> men</strong> are coming. @@ -336,19 +340,6 @@ Units about to be deployed: <</if>> <</for>> -<br><br> -Set to <span id="keep">keep the roster between battles</span> -| -<<link "Keep roster as it is">> - <<replace "#keep">>keep the roster between battles<</replace>> - <<set $keepRoster = 1>> -<</link>> -| -<<link "Don't keep it">> - <<replace "#keep">>don't keep the roster between battles<</replace>> - <<set $keepRoster = 0>> -<</link>> - <br><br> /* tactics */ @@ -411,6 +402,15 @@ Offensive Tactics <br> //Involves assaulting the enemy with large numbers of infantry to overwhelm their lines.// <br> <br> -<<link "Send your orders">> - <<goto "attackHandler">> +<<if $deployedUnits > 0>> + <<link "Send your orders">> + <<goto "attackHandler">> + <</link>> +<<else>> + You need at least a unit in your roster to proceed to battle. +<</if>> +<br> +<<link "Surrender">> + <<set $PCsurrenders = 1>> + <<goto "attackReport">> <</link>> \ No newline at end of file diff --git a/src/SecExp/attackReport.tw b/src/SecExp/attackReport.tw index b4656eac90db454ff525af903cb5d004b27b97a1..ef16385760cab04e9f536bd0df97df22d3d046f8 100644 --- a/src/SecExp/attackReport.tw +++ b/src/SecExp/attackReport.tw @@ -1,8 +1,243 @@ :: attackReport [nobr] +/* result */ <<if $PCwon == 1>> - You win! + <strong>Victory!</strong> <<elseif $EnemyWon == 1>> - The enemy won! + <strong>Defeat!</strong> +<<elseif $PCpartialWon == 1>> + <strong>Partial victory!</strong> +<<elseif $enemyPartialWon == 1>> + <strong>Partial defeat!</strong> +<<elseif $PCsurrenders == 1>> + <strong>We surrendered</strong> <</if>> +<hr> +<<set $enemyLosses = Math.round($enemyLosses)>> +<<set $losses = Math.round($losses)>> +<<if $PCsurrenders != 1>> + <<if $attackType == "raiders">> + Today, the $day of $month, $year, our arcology was attacked by a band of wild raiders, $attackTroops men strong. Our defense forces clashed with them + <<if $battleTerrain == "urban">> + in the streets of <<if $terrain == "urban">>the old world city surrounding the arcology<<else>>of the free city<</if>>, + <<elseif $battleTerrain == "rural">> + in the rural land surrounding the free city, + <<elseif $battleTerrain == "hills">> + on the hills around the free city, + <<elseif $battleTerrain == "coast">> + along the coast just outside the free city, + <<elseif $battleterrain == "outskirts">> + just against the walls of the arcology, + <<elseif $battleTerrain == "mountains">> + in the mountains overlooking the arcology, + <<elseif $battleTerrain == "wasteland">> + in the wastelands outside the free city territory, + <</if>> + inflicting $enemyLosses casualties, while sustaining $losses casualties themselves. + <<if $PCwon == 1>> + <<if $battleTurns <= 5>> + The fight was quick and one sided, our men easily stopped the disorganized horde futile attempt at raiding your arcology. + <<elseif $battleTurns <= 7>> + The fight was hard, but in the end our men stopped the disorganized horde attempt at raiding your arcology. + <<else>> + The fight was long and hard, but our men managed to stop the horde raiding party. + <</if>> + <<elseif $EnemyWon == 1>> + <<if $battleTurns <= 5>> + The fight was quick and one sided, our men were easily crushed by the barbaric horde of raiders. + <<elseif $battleTurns <= 7>> + The fight was hard and in the end the bandits proved too much to handle for our men. + <<else>> + The fight was long and hard, but despite their bravery the horde proved too much for our men. + <</if>> + <<elseif $PCpartialWon == 1>> + The fight was long and hard, but in the end our men managed to repel the raiders, though without making any significant gain. + <<elseif $enemyPartialWon == 1>> + The fight was long and hard. Our men in the end had to yield to the horde raiders, which was fortunately unable to capitalized on their victory. + <</if>> + <<elseif $attackType == "free city">> + Today, the $day of $month, $year, our arcology was attacked by a contingent of mercenaries hired by a competing free city, $attackTroops men strong. Our defense forces clashed with them + <<if $battleTerrain == "urban">> + in the streets of <<if $terrain == "urban">>the old world city surrounding the arcology<<else>>of the free city<</if>>, + <<elseif $battleTerrain == "rural">> + in the rural land surrounding the free city, + <<elseif $battleTerrain == "hills">> + on the hills around the free city, + <<elseif $battleTerrain == "coast">> + along the coast just outside the free city, + <<elseif $battleterrain == "outskirts">> + just against the walls of the arcology, + <<elseif $battleTerrain == "mountains">> + in the mountains overlooking the arcology, + <<elseif $battleTerrain == "wasteland">> + in the wastelands outside the free city territory, + <</if>> + inflicting $enemyLosses casualties, while sustaining $losses casualties themselves. + <<if $PCwon == 1>> + <<if $battleTurns <= 5>> + The fight was quick and one sided, our men easily stopped the mercenaries dead in their tracks. + <<elseif $battleTurns <= 7>> + The fight was hard, but in the end our men stopped the slavers attempt at weakening your arcology. + <<else>> + The fight was long and hard, but our men managed to stop the free city mercenaries. + <</if>> + <<elseif $EnemyWon == 1>> + <<if $battleTurns <= 5>> + The fight was quick and one sided, our men were easily crushed by the consumed mercenary veterans sent against us. + <<elseif $battleTurns <= 7>> + The fight was hard and in the end the slavers proved too much to handle for our men. + <<else>> + The fight was long and hard, but despite their bravery the mercenary slavers proved too much for our men. + <</if>> + <<elseif $PCpartialWon == 1>> + The fight was long and hard, but in the end our men managed to repel the mercenaries, though without making any significant gain. + <<elseif $enemyPartialWon == 1>> + The fight was long and hard. Our men in the end had to yield to the slavers, which were fortunately unable to capitalized on their victory. + <</if>> + <<elseif $attackType == "freedom fighters">> + Today, the $day of $month, $year, our arcology was attacked by a group of freedom fighters bent on the destruction of the institution of slavery, $attackTroops men strong. Our defense forces clashed with them + <<if $battleTerrain == "urban">> + in the streets of <<if $terrain == "urban">>the old world city surrounding the arcology<<else>>of the free city<</if>>, + <<elseif $battleTerrain == "rural">> + in the rural land surrounding the free city, + <<elseif $battleTerrain == "hills">> + on the hills around the free city, + <<elseif $battleTerrain == "coast">> + along the coast just outside the free city, + <<elseif $battleterrain == "outskirts">> + just against the walls of the arcology, + <<elseif $battleTerrain == "mountains">> + in the mountains overlooking the arcology, + <<elseif $battleTerrain == "wasteland">> + in the wastelands outside the free city territory, + <</if>> + inflicting $enemyLosses casualties, while sustaining $losses casualties themselves. + <<if $PCwon == 1>> + <<if $battleTurns <= 5>> + The fight was quick and one sided, our men easily stopped the freedom fighters dead in their tracks. + <<elseif $battleTurns <= 7>> + The fight was hard, but in the end our men stopped the fighters attempt at freeing our slaves. + <<else>> + The fight was long and hard, but our men managed to stop the freedom figthers. + <</if>> + <<elseif $EnemyWon == 1>> + <<if $battleTurns <= 5>> + The fight was quick and one sided, our men were easily crushed by the fanatical fury of the freedom figthers. + <<elseif $battleTurns <= 7>> + The fight was hard and in the end the freedom figthers proved too much to handle for our men. + <<else>> + The fight was long and hard, but despite their bravery the freedom figthers fury proved too much for our men. + <</if>> + <<elseif $PCpartialWon == 1>> + The fight was long and hard, but in the end our men managed to repel the freedom fighters, though without making any significant gain. + <<elseif $enemyPartialWon == 1>> + The fight was long and hard. Our men in the end had to yield to the freedom figthers, which were fortunately unable to capitalized on their victory. + <</if>> + <<elseif $attackType == "old world">> + Today, the $day of $month, $year, our arcology was attacked by an old world nation, boasting a misplaced sense of superiority, $attackTroops men strong. Our defense forces clashed with them + <<if $battleTerrain == "urban">> + in the streets of <<if $terrain == "urban">>the old world city surrounding the arcology<<else>>of the free city<</if>>, + <<elseif $battleTerrain == "rural">> + in the rural land surrounding the free city, + <<elseif $battleTerrain == "hills">> + on the hills around the free city, + <<elseif $battleTerrain == "coast">> + along the coast just outside the free city, + <<elseif $battleterrain == "outskirts">> + just against the walls of the arcology, + <<elseif $battleTerrain == "mountains">> + in the mountains overlooking the arcology, + <<elseif $battleTerrain == "wasteland">> + in the wastelands outside the free city territory, + <</if>> + inflicting $enemyLosses casualties, while sustaining $losses casualties themselves. + <<if $PCwon == 1>> + <<if $battleTurns <= 5>> + The fight was quick and one sided, our men easily stopped the old world soldiers dead in their tracks. + <<elseif $battleTurns <= 7>> + The fight was hard, but in the end our men stopped the soldiers of the old world. + <<else>> + The fight was long and hard, but our men managed to stop the old world soldiers. + <</if>> + <<elseif $EnemyWon == 1>> + <<if $battleTurns <= 5>> + The fight was quick and one sided, our men were easily crushed by the discipline of the old world armies. + <<elseif $battleTurns <= 7>> + The fight was hard and in the end the old world proved too much to handle for our men. + <<else>> + The fight was long and hard, but despite their bravery the determination of the old world troops proved too much for our men. + <</if>> + <<elseif $PCpartialWon == 1>> + The fight was long and hard, but in the end our men managed to repel the old world soldiers, though without making any significant gain. + <<elseif $enemyPartialWon == 1>> + The fight was long and hard. Our men in the end had to yield to the old world soldiers, which were fortunately unable to capitalized on their victory. + <</if>> + <</if>> +<<else>> + Rather than waste lives, we chose not to resist, hoping for mercy. +<</if>> + +/* calculates effects on the city */ +<<if $losses > 0>> + <<set _loss = Math.trunc($losses / $deployedUnits)>> + <<if $deployingBots == 1>> + <<set $secBots.troops -= _loss>> + <<if $deployingMilitia == 1>> + <<set _mL = $militiaUnits.length>> + <<for _i = 0; _i < _mL; _i++>> + <<if $militiaUnits[_i].isDeployed == 1>> + <<set $militiaUnits[_i].troops -= (_loss - _loss * $militiaUnits[_i].medics * 0.25)>> + <</if>> + <</for>> + <</if>> + <<if $deployingSlaves == 1>> + <<set _sL = $slaveUnits.length>> + <<for _i = 0; _i < _sL; _i++>> + <<if $slaveUnits[_i].isDeployed == 1>> + <<set $slaveUnits[_i].troops -= (_loss - _loss * $slaveUnits[_i].medics * 0.25)>> + <</if>> + <</for>> + <</if>> + <<if $deployingMercs == 1>> + <<set _meL = $mercUnits.length>> + <<for _i = 0; _i < _meL; _i++>> + <<if $mercUnits[_i].isDeployed == 1>> + <<set $mercUnits[_i].troops -= (_loss - _loss * $mercUnits[_i].medics * 0.25)>> + <</if>> + <</for>> + <</if>> +<</if>> + + + + +/* resets variables */ +<<set $attackType = "none">> +<<set $chosenTactic = "none">> +<<set $leadingTroops = "none">> +<<set $attackTroops = 0>> +<<set $attackEquip = 0>> +<<set $deployableUnits = 0>> +<<set $deployedUnits = 0>> +<<set $deployingBots = 0>> +<<set $deployingMilitia = 0>> +<<set $deployingSlaves = 0>> +<<set $deployingMercs = 0>> +<<set $battleTerrain = "none">> +<<set $attackThisWeek = 0>> +<<set $deployableUnits = 0>> +<<set $deployedUnits = 0>> +<<set $enemyLosses = 0>> +<<set $losses = 0>> +<<set $battleTurns = 0>> +<<set $secBots.isDeployed = 0>> +<<for _i = 0; _i < _mL; _i++>> + <<set $militiaUnits[_i].isDeployed = 0>> +<</for>> +<<for _i = 0; _i < _sL; _i++>> + <<set $slaveUnits[_i].isDeployed = 0>> +<</for>> +<<for _i = 0; _i < _meL; _i++>> + <<set $mercUnits[_i].isDeployed = 0>> +<</for>> \ No newline at end of file diff --git a/src/SecExp/secInit.tw b/src/SecExp/secInit.tw index 248651a58e8f2832a3f82b6a64066ab7bf14aec3..959311736853cd21ba4e5bdf0767505b8ec3006a 100644 --- a/src/SecExp/secInit.tw +++ b/src/SecExp/secInit.tw @@ -40,13 +40,18 @@ <<set $maxTurns = 10>> <<set $PCwon = 0>> <<set $EnemyWon = 0>> -<<set $keepRoster = 0>> +<<set $PCpartialWon = 0>> +<<set $enemyPartialWon = 0>> +<<set $PCsurrenders = 0>> +<<set $losses = 0>> +<<set $enemyLosses = 0>> +<<set $battleTurns = 0>> /* statistics */ <<set $equipMod = 0.15>> <<set $secBotsBaseAttack = 9>> <<set $secBotsBaseDefense = 5>> -<<set $secBotsMorale = 120>> +<<set $secBotsMorale = 200>> <<set $secBotsBaseHp = 4>> <<set $militiaBaseAttack = 7>> <<set $militiaBaseDefense = 5>> @@ -61,22 +66,22 @@ <<set $mercBaseMorale = 125>> <<set $mercBaseHp = 4>> -<<set $raBaseAttack = 8>> -<<set $raBaseDefense = 3>> +<<set $raBaseAttack = 7>> +<<set $raBaseDefense = 2>> <<set $raBaseMorale = 100>> -<<set $raBaseHp = 3>> -<<set $fcBaseAttack = 7>> -<<set $fcBaseDefense = 5>> +<<set $raBaseHp = 2>> +<<set $fcBaseAttack = 6>> +<<set $fcBaseDefense = 4>> <<set $fcBaseMorale = 130>> -<<set $fcBaseHp = 4>> -<<set $owBaseAttack = 9>> -<<set $owBaseDefense = 5>> +<<set $fcBaseHp = 3>> +<<set $owBaseAttack = 8>> +<<set $owBaseDefense = 4>> <<set $owBaseMorale = 110>> -<<set $owBaseHp = 3>> -<<set $ffBaseAttack = 10>> -<<set $ffBaseDefense = 3>> +<<set $owBaseHp = 2>> +<<set $ffBaseAttack = 9>> +<<set $ffBaseDefense = 2>> <<set $ffBaseMorale = 160>> -<<set $ffBaseHp = 3>> +<<set $ffBaseHp = 2>> /* Units */