From 49354cfdc512d94032e9f4c9a7c8f39e38c053dd Mon Sep 17 00:00:00 2001 From: hexall90 <hexall90@gmail.com> Date: Sun, 17 Sep 2017 22:29:47 +0200 Subject: [PATCH] changed structure --- src/SecExp/attackHandler.tw | 572 +++++++++------------------- src/SecExp/attackOptions.tw | 415 ++++++++++++++++++++ src/SecExp/attackReport.tw | 102 +---- src/SecExp/secInit.tw | 41 ++ src/uncategorized/scheduledEvent.tw | 4 +- 5 files changed, 639 insertions(+), 495 deletions(-) create mode 100644 src/SecExp/attackOptions.tw diff --git a/src/SecExp/attackHandler.tw b/src/SecExp/attackHandler.tw index 7acd82b75e4..005093e0502 100644 --- a/src/SecExp/attackHandler.tw +++ b/src/SecExp/attackHandler.tw @@ -1,407 +1,195 @@ -:: attackHandler [nobr] +:: attackHandler -<strong>Attack Imminent</strong> -<hr> -The ominous message dominates the screens of your office, <<print $assistantName>> quickly gathers all information available to prepare your arcology for battle. -<<if $attackType == "raiders">> - <<if $riskSim == 1 && $riskSimExpectedAttack == $attackType>> - A disorganized horde of raiders is coming to your city. To such jackals your arcology surely looks like an appetizing morsel. - Fortunately you knew of their coming weeks in advance, the risk simulation system did its job admirably. - <<elseif $perimeterDrones == 1>> - Your drones easily spot the disorganized horde of raiders riding their ragtag vehicles. To such jackals your arcology surely looks like an appetizing morsel. - <<else>> - Some of your citizens saw the disorganized horde of raiders coming towards the city and quickly reported it. To such jackals your arcology surely looks like an appetizing morsel. - <</if>> - <br> - Raiders: - <br> - high attack - <br> - low defense - <br> - low toughness - <br> - low morale -<<elseif $attackType == "free city">> - <<if $riskSim == 1 && $riskSimExpectedAttack == $attackType>> - A menacing column of consumed mercenaries and slavers is coming to your city. Another free city is ready to use their best tools to bring down a dangerous competitor. - Fortunately you knew of their coming weeks in advance, the risk simulation system did its job admirably. - <<elseif $perimeterDrones == 1>> - Your drones easily spot the menacing column of consumed mercenaries and slavers. Another free city is ready to use their best tools to bring down a dangerous competitor. - <<else>> - Some of your citizens saw the menacing column of consumed mercenaries and slavers and rushed to your office to bring the grim news. Another free city is ready to use their best tools to bring down a dangerous competitor. - <</if>> - <br> - Free City expedition: - <br> - low attack - <br> - high defense - <br> - moderate toughness - <br> - moderate morale -<<elseif $attackType == "freedom fighters">> - <<if $riskSim == 1 && $riskSimExpectedAttack == $attackType>> - A dangerous looking army of guerrillas is gathering just outside the arcology. Fanatics and idealists armed with dead men's words and hope, set on erasing your fledgling empire. - Fortunately you knew of their coming weeks in advance, the risk simulation system did its job admirably. - <<elseif $perimeterDrones == 1>> - Your drones easily spot the dangerous looking army of guerrillas is gathering just outside the arcology. Fanatics and idealists armed with dead men's words and hope, set on erasing your fledgling empire. - <<else>> - Some of your citizens saw the dangerous looking army of guerrillas is gathering just outside the arcology. Fanatics and idealists armed with dead men's words and hope, set on erasing your fledgling empire. - <</if>> - <br> - Freedom Fighters: - <br> - very high attack - <br> - low defense - <br> - moderate toughness - <br> - very high morale -<<elseif $attackType == "old world">> - <<if $riskSim == 1 && $riskSimExpectedAttack == $attackType>> - A diciplined yet dusty, scruffy old world army is approaching the confines of your arcology. There's nothing better than a good war to unite the electorate and your arcology is just the perfect target. - Fortunately you knew of their coming weeks in advance, the risk simulation system did its job admirably. - <<elseif $perimeterDrones == 1>> - Your drones easily spot the diciplined yet dusty, scruffy old world army is approaching the confines of your arcology. There's nothing better than a good war to unite the electorate and your arcology is just the perfect target. - <<else>> - Some of your citizens saw the diciplined yet dusty, scruffy old world army is approaching the confines of your arcology. There's nothing better than a good war to unite the electorate and your arcology is just the perfect target. - <</if>> - <br> - Old world expedition: - <br> - high attack - <br> - high defense - <br> - low toughness - <br> - low morale -<<elseif $attackType == "mercenary">> - <<if $riskSim == 1 && $riskSimExpectedAttack == $attackType>> - Some sections of the lower levels were already no longer responding. In the end it happened, your own mercenaries took arms against their benefactor. - Fortunately you knew of their coming weeks in advance, the risk simulation system did its job admirably. - <<elseif $perimeterDrones == 1>> - Your drones easily spot the nervous movement of mercenary units assembling in the lower levels. In the end it happened, your own mercenaries took arms against their benefactor. - <<else>> - Some of your citizens, terrified by the movements of mercenary units in the lower levels, were gathering near the entrance of your penthouse. In the end it happened, your own mercenaries took arms against their benefactor. - <</if>> -<<elseif $attackType == "citizen">> - <<if $riskSim == 1 && $riskSimExpectedAttack == $attackType>> - The streets were already clogged with citizens armed to the teeth, ready to oust their owner. In the end it happened, your own citizens dared took arms against their arcology owner. - Fortunately you knew of their coming weeks in advance, the risk simulation system did its job admirably. - <<elseif $perimeterDrones == 1>> - Your drones easily spot the tumultuos mobs of armed citizens invading the streets. In the end it happened, your own citizens dared took arms against their arcology owner. - <<else>> - Some of your citizens, terrified by the mobs of armed rebels, were gathering near the entrance of your penthouse. In the end it happened, your own citizens dared took arms against their arcology owner. - <</if>> -<<elseif $attackType == "slave">> - <<if $riskSim == 1 && $riskSimExpectedAttack == $attackType>> - Reports from all over the arcology are pouring in, filled with slaves assaulting, killing and butchering your citizens. In the end it happened, the slaves dared attack their betters. - Fortunately you knew of their coming weeks in advance, the risk simulation system did its job admirably. - <<elseif $perimeterDrones == 1>> - Your drones easily spot inumerable instances of slaves assaulting, killing and butchering your citizens. In the end it happened, the slaves dared attack their betters. - <<else>> - Some of your citizens, terrified by the mass of slaves assaulting, killing and butchering their fellow citizens, were gathering near the entrance of your penthouse. In the end it happened, the slaves dared attack their betters - <</if>> -<</if>> +/*Init*/ +<<set _phase = 0>> +<<set _attack = 0>> +<<set _defense = 0>> +<<set _morale = 0>> +<<set _hp = 0>> +<<set _enemyAttack = 0>> +<<set _enemyDefense = 0>> +<<set _enemyMorale = 0>> +<<set _enemyHp = 0>> +<<set _mL = $militiaUnits.length>> +<<set _sL = $slaveUnits.length>> +<<set _meL = $mercUnits.length>> - <<if $hasFought != 1>> - <br> - This is your first battle as an arcology owner, <<print $assistantName>> suggests reviewing the meaning of all the data laying in front of you: [[Battle statistics and mechanics|secTutorial]] +/* calculates leaders, tactics and terrain modifiers */ +<<set _atkMod = 1>> +<<set _defMod = 1>> +<<set _militiaMod = 1>> +<<set _slaveMod = 1>> +<<set _mercMod = 1>> +<<set _enemyMod = 1>> +/*player*/ +<<if $leadingTroops == "PC">> + <<if $authority <= 2500 && $authority > 1000>> + <<set _slaveMod -= 0.10>> + <<elseif $authority <= 1000>> + <<set _slaveMod -= 0.25>> + <<elseif $authority >= 5000 && $authority < 10000>> + <<set _slaveMod += 0.10>> + <<elseif $authority >= 10000>> + <<set _slaveMod += 0.25>> + <</if>> + <<if $PC.career == "escort" || $PC.career == "servant">> + <<set _slaveMod += 0.10>> + <<elseif $PC.career == "slaver">> + <<set _slaveMod -= 0.10>> + <</if>> + <<if $rep <= 2500 && $rep > 1000>> + <<set _militiaMod -= 0.10>> + <<elseif $rep <= 1000>> + <<set _militiaMod -= 0.25>> + <<elseif $rep >= 5000 && $rep < 10000>> + <<set _militiaMod += 0.10>> + <<elseif $rep >= 10000>> + <<set _militiaMod += 0.25>> + <</if>> + <<if $PC.career == "celebrity" || $PC.career == "capitalist">> + <<set _militiaMod += 0.10>> + <<elseif $PC.career == "gang" || $PC.career == "escort">> + <<set _militiaMod -= 0.10>> + <</if>> + <<if $mercLoyalty <= 25>> + <<set _mercMod -= 0.10>> + <<elseif $mercLoyalty <= 10>> + <<set _mercMod -= 0.25>> + <<if $mercLoyalty >= 50 && $mercLoyalty < 75>> + <<set _mercMod += 0.10>> + <<elseif $mercLoyalty >= 75>> + <<set _mercMod += 0.25>> + <</if>> + <<if $PC.career == "mercenary">> + <<set _mercMod += 0.10>> + <<elseif $PC.career == "wealth" || $PC.career == "servant">> + <<set _mercMod -= 0.10>> + <</if>> + <<if $rep >= 15000>> + <<set _enemyMod -= 0.10>> + <</if>> + <<if $PC.warfare <= 25 && $PC.warfare > 10>> + <<set _atkMod -= 0.15>> + <<elseif $PC.warfare <= 10>> + <<set _atkMod -= 0.20>> + <<set _defMod -= 0.10>> + <<elseif $PC.warfare >= 50 && $PC.warfare >= 50>> + <<set _atkMod += 0.15>> + <<elseif $PC.warfare >= 75>> + <<set _atkMod += 0.20>> + <<set _defMod += 0.10>> + <</if>> +/*personal assistant*/ +<<elseif $leadingTroops == "assistant">> + <<if $rep < 15000 && $authority < 15000>> + <<set _militiaMod -= 0.15>> + <<set _slaveMod -= 0.15>> + <<set _mercMod -= 0.15>> + <</if>> + <<if $assistantPower == 0>> + <<set _atkMod -= 0.10>> + <<set _defMod -= 0.10>> + <<elseif $assistantPower == 2>> + <<set _atkMod += 0.15>> + <<set _defMod += 0.15>> + <</if>> +<<elseif $leadingTroops == "bodyguard">> + <<set _slaveMod += 0.15>> + <<if $rep < 15000 && $authority < 15000>> + <<set _militiaMod -= 0.15>> + <<set _mercMod -= 0.15>> <</if>> -<hr> -It seems your troops and your adversary will fight -<<if $battleTerrain == "urban">> - in <strong>the streets of <<if $terrain == "urban">>the old world city surroinding the arcology<<else>>of the free city<</if>>.</strong> -<<elseif $battleTerrain == "rural">> - in <strong>the rural land</strong> surrounding the free city. -<<elseif $battleTerrain == "hills">> - on <strong>the hills</strong> around the free city. -<<elseif $battleTerrain == "coast">> - along <strong>the coast</strong> just outside the free city. -<<elseif $battleterrain == "outskirts">> - right against <strong>the walls of the arcology.</strong> -<<elseif $battleTerrain == "mountains">> - in <strong>the mountains</strong> overlooking the arcology. -<<elseif $battleTerrain == "wasteland">> - in <strong>the wastelands</strong> outside the free city territory. -<</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. -<<elseif $perimeterDrones ==1>> - Thanks to your drones you have a rough estimate of the numbers you're about to face. Around <strong><<print Math.round($attackTroops * (1 + either(-1,1) * random(2) * 0.1))>> men</strong> are coming -<<else>> - Unfortunately you have no good information on what is coming your way, the confused reports of your citizens gives you only a vague number. Around <strong><<print Math.round($attackTroops * (1 + either(-1,1) * random(3) * 0.1))>> men</strong> are coming. -<</if>> -They seems to be -<<set _expectedEquip = 0>> -<<if $riskSim == 1 && $riskSimExpectedAttack == $attackType>> - <<set _expectedEquip = $attackEquip>> -<<elseif $perimeterDrones == 1>> - <<set _expectedEquip = $attackEquip + either(-1,1)>> -<<else>> - <<set _expectedEquip = $attackEquip + either(-1,1) * random(2)>> -<</if>> -<<if _expectedEquip == 0>> - <strong>poorly armed</strong>. old rusty small arms are the norm with just a few barely working civilian vehicles. -<<elseif _expectedEquip == 1>> - <strong>lightly armed</strong>. mostly small arms with some repurposed civilian vehicles and a scattered few machine guns. There's no sign of heavy vehicles, artillery or aircrafts. -<<elseif _expectedEquip == 2>> - <strong>decently armed</strong>. good quality small arms, machine guns a few mortars. There seems to be some heavy military vehicles coming as well. -<<elseif _expectedEquip == 3>> - <strong>well armed</strong>. high quality small arms, snipers, demolitions teams, heavy duty machine guns and mortars. Heavy military vehicles are numerous and a few artillery piecies are accompaning the detachment. -<<elseif _expectedEquip == 4>> - <strong>extremely well armed</strong>. excellent small arms and specialized teams with heavy duty infantry support weapons. Heavy presence of armored military vehicles, artillery pieces and even some attack helicopters. + +/* calculates PC army stats */ +<<if $secBots.isDeployed == 1>> + <<set _attack += $secBotsBaseAttack + $secBotsBaseAttack * $secBots.equip * $equipMod>> + <<set _defense += $secBotsBaseDefense + $secBotsBaseDefense * $secBots.equip * $equipMod>> + <<set _morale += $secBotsMorale>> + <<set _hp += $secBotsBaseHp * $secBots.troops>> <</if>> +<<for _i = 0; _i < _mL; _i++>> + <<if $militiaUnits[_i].isDeployed == 1>> + <<set _attack += $militiaBaseAttack + $militiaBaseAttack * $militiaUnits[_i].equip * $equipMod>> + <<set _defense += $militiaBaseDefense + $militiaBaseDefense * $militiaUnits[_i].equip * $equipMod>> + <<set _morale += $militiaBaseMorale + $militiaBaseMorale * $militiaUnits[_i].escorts * $equipMod>> + <<set _hp += ($militiaBaseHp + $militiaBaseHp * $militiaUnits[_i].medics * $equipMod) * $militiaUnits[_i].troops >> + <</if>> +<</for>> +<<for _i = 0; _i < _sL; _i++>> + <<if $slaveUnits[_i].isDeployed == 1>> + <<set _attack += $slaveBaseAttack + $slaveBaseAttack * $slaveUnits[_i].equip * $equipMod>> + <<set _defense += $slaveBaseDefense + $slaveBaseDefense * $slaveUnits[_i].equip * $equipMod>> + <<set _morale += $slaveBaseMorale + $slaveBaseMorale * $slaveUnits[_i].escorts * $equipMod>> + <<set _hp += ($slaveBaseHp + $slaveBaseHp * $slaveUnits[_i].medics * 0.25) * $slaveUnits[_i].troops>> + <</if>> +<</for>> +<<for _i = 0; _i < _meL; _i++>> + <<if $mercUnits[_i].isDeployed == 1>> + <<set _attack += $mercBaseAttack + $mercBaseAttack * $mercUnits[_i].equip * $equipMod>> + <<set _defense += $mercBaseDefense + $mercBaseDefense * $mercUnits[_i].equip * $equipMod>> + <<set _morale += $mercBaseMorale + $mercBaseMorale * $mercUnits[_i].escorts * $equipMod>> + <<set _hp += ($mercBaseHp + $mercBaseHp * $mercUnits[_i].medics * 0.25) * $mercUnits[_i].troops>> + <</if>> +<</for>> -<br><br> +/* calculates enemy army stats */ +<<if $attackType == "raiders">> + <<set _enemyAttack = $raBaseAttack * $raBaseAttack * $attackEquip * $equipMod>> + <<set _enemyDefense = $raBaseDefense + $raBaseDefense * $attackEquip * $equipMod>> + <<set _enemyMorale = $raBaseMorale>> + <<set _enemyHp = $raBaseHp * $attackTroops>> +<<elseif $attackType == "free city">> + <<set _enemyAttack = $fcBaseAttack * $fcBaseAttack * $attackEquip * $equipMod>> + <<set _enemyDefense = $fcBaseDefense + $fcBaseDefense * $attackEquip * $equipMod>> + <<set _enemyMorale = $fcBaseMorale>> + <<set _enemyHp = $fcBaseHp * $attackTroops>> +<<elseif $attackType == "old world">> + <<set _enemyAttack = $owBaseAttack + $owBaseAttack * $attackEquip * $equipMod>> + <<set _enemyDefense = $owBaseDefense + $owBaseDefense * $attackEquip * $equipMod>> + <<set _enemyMorale = $owBaseMorale>> + <<set _enemyHp = $owBaseHp * $attackTroops>> +<<elseif $attackType == "freedom fighters">> + <<set _enemyAttack = $ffBaseAttack + $ffBaseAttack * $attackEquip * $equipMod>> + <<set _enemyDefense = $ffBaseDefense + $ffBaseDefense * $attackEquip * $equipMod>> + <<set _enemyMorale = $ffBaseMorale>> + <<set _enemyHp = $ffBaseHp * $attackTroops>> +<</if>> -You quickly lay down a plan of action: -<br> -<<link "Let the assistant handle this attack">> - <<if $assistantPower == 2>> - <<elseif $assistantPower == 1>> - <<else>> - <</if>> -<</link>> -<br> //$assistantName will handle leaders, tactics and troop deployment to the best of her abilities. To be implemented// +/* simulates the combat by pitting attk against def */ +<<for _i = 0; _i < $maxTurns; _i++>> -<br><br> -/* leader assignment */ -<span id="leader"><strong><<print $assistantName>></strong></span> will lead your troops. - <br> - <<if $leadingTroops != "PC">> - <<link "Personally join the battle">> - <<set $leadingTroops = "PC">> - <<replace "#leader">><strong><<print $PC.name>></strong><</replace>> - <</link>> - <<else>> - Personally join the battle - <</if>> - | - <<if $leadingTroops != "assistant">> - <<link "Let $assistantName lead the troops">> - <<set $leadingTroops = "assistant">> - <<replace "#leader">><strong><<print $assistantName>></strong><</replace>> - <</link>> - <<else>> - Let $assistantName lead the troops - <</if>> - <<if $Bodyguard != 0 && $slavesInArmy == 1>> - | - <<if $leadingTroops != "bodyguard">> - <<link "Let your bodyguard lead your troops">> - <<set $leadingTroops = "bodyguard">> - <<replace "#leader">><strong><<print $Bodyguard.slaveName>></strong><</replace>> - <</link>> - <<else>> - Let your bodyguard lead your troops - <</if>> - <</if>> - <<if $HeadGirl != 0 && $slavesInArmy == 1>> - | - <<if $leadingTroops != "headgirl">> - <<link "Let your head girl lead your troops">> - <<set $leadingTroops = "headGirl">> - <<replace "#leader">><strong><<print $HeadGirl.slaveName>></strong><</replace>> - <</link>> - <<else>> - Let your head girl lead your troops - <</if>> - <</if>> - <<if $militiaCreated == 1>> - | - <<if $leadingTroops != "citizen">> - <<link "Let the citizens' militia officers lead the troops">> - <<set $leadingTroops = "citizen">> - <<replace "#leader">><strong>The citizens' militia commander</strong><</replace>> - <</link>> - <<else>> - Let the citizens' militia officers lead the troops. - <</if>> - <</if>> - <<if $mercenaries > 0>> - | - <<if $leadingTroops != "mercenary">> - <<link "Let the mercenary officers lead the troops">> - <<set $leadingTroops = "mercenary">> - <<replace "#leader">><strong>The mercenary commander</strong><</replace>> - <</link>> - <<else>> - Let the mercenary officers lead the troops. - <</if>> - <</if>> +<</for>> -/* troop deployment */ -<br><br> -With your current readiness level you can <<if $deployedUnits > 0>>still<</if>> send <strong><<print $deployableUnits>></strong>. Available units: -<<set _mL = $militiaUnits.length>> -<<set _sL = $slaveUnits.length>> -<<set _meL = $mercUnits.length>> -<<if $deployableUnits > 0>> - <<if $secBots.isDeployed == 0 && $secBots.troops > 0>> - <br> - <<secBotsDescription>> - <br> - <<link "Deploy the unit">> - <<set $secBots.isDeployed = 1>> - <<set $deployableUnits-->> - <<set $deployedUnits++>> - <<goto "attackHandler">> - <</link>> - <</if>> - <<for _i = 0; _i < _mL; _i++>> - <<if $militiaUnits[_i].active == 1 && $militiaUnits[_i].isDeployed == 0 && $militiaUnits[_i].troops > 0>> - <br> - <<militiaUnitsDescription $militiaUnits[_i]>> - <br> - <<link "Deploy the unit">> - <<set $militiaUnits[_i].isDeployed = 1>> - <<set $deployableUnits-->> - <<set $deployedUnits++>> - <<goto "attackHandler">> - <</link>> - <</if>> - <</for>> - <<for _i = 0; _i < _sL; _i++>> - <<if $slaveUnits[_i].active == 1 && $slaveUnits[_i].isDeployed == 0 && $slaveUnits[_i].troops > 0>> - <br> - <<slaveUnitsDescription $slaveUnits[_i]>> - <br> - <<link "Deploy the unit">> - <<set $slaveUnits[_i].isDeployed = 1>> - <<set $deployableUnits-->> - <<set $deployedUnits++>> - <<goto "attackHandler">> - <</link>> - <</if>> - <</for>> - <<for _i = 0; _i < _meL; _i++>> - <<if $mercUnits[_i].active == 1 && $mercUnits[_i].isDeployed == 0 && $mercUnits[_i].troops > 0>> - <br> - <<mercUnitsDescription $mercUnits[_i]>> - <br> - <<link "Deploy the unit">> - <<set $mercUnits[_i].isDeployed = 1>> - <<set $deployableUnits-->> - <<set $deployedUnits++>> - <<goto "attackHandler">> - <</link>> - <</if>> - <</for>> -<<else>> - <br> - Unit roster full. -<</if>> -<br><br> -Units about to be deployed: -<<if $deployedUnits > 0>> - <<if $secBots.isDeployed == 1>> - <br> - <<secBotsDescription>> - <br> - <<link "Remove the unit">> - <<set $secBots.isDeployed = 0>> - <<set $deployableUnits++>> - <<set $deployedUnits-->> - <<goto "attackHandler">> - <</link>> - <</if>> - <<for _i = 0; _i < _mL; _i++>> - <<if $militiaUnits[_i].isDeployed == 1>> - <br> - <<militiaUnitsDescription $militiaUnits[_i]>> - <br> - <<link "Remove the unit">> - <<set $militiaUnits[_i].isDeployed = 0>> - <<set $deployableUnits++>> - <<set $deployedUnits-->> - <<goto "attackHandler">> - <</link>> - <</if>> - <</for>> - <<for _i = 0; _i < _sL; _i++>> - <<if $slaveUnits[_i].isDeployed == 1>> - <br> - <<slaveUnitsDescription $slaveUnits[_i]>> - <br> - <<link "Remove the unit">> - <<set $slaveUnits[_i].isDeployed = 0>> - <<set $deployableUnits++>> - <<set $deployedUnits-->> - <<goto "attackHandler">> - <</link>> - <</if>> - <</for>> - <<for _i = 0; _i < _meL; _i++>> - <<if $mercUnits[_i].isDeployed == 1>> - <br> - <<mercUnitsDescription $mercUnits[_i]>> - <br> - <<link "Remove the unit">> - <<set $mercUnits[_i].isDeployed = 0>> - <<set $deployableUnits++>> - <<set $deployedUnits-->> - <<goto "attackHandler">> - <</link>> - <</if>> - <</for>> -<</if>> -<br><br> -/* tactics */ -<<if $leadingTroops != "PC">> - For this battle you command your chosen leaders to follow <span id="tactic"><strong><<print $chosenTactic>></strong></span> tactics. -<<else>> - For this battle you choose to follow <span id="tactic"><strong><<print $chosenTactic>></strong></span> tactics. -<</if>> -<br><br> -Defensive tactics -<br> -<<link "Bait and Bleed">> - <<set $chosenTactic = "Bait and Bleed">> - <<replace "#tactic">><strong><<print $chosenTactic>></strong><</replace>> -<</link>> -<br> //Combines bait and switch tactics with guerriglia style assaults, with the objective of slowly bleed the enemy.// -<br> -<<link "Guerrilla">> - <<set $chosenTactic = "Guerrilla">> - <<replace "#tactic">><strong><<print $chosenTactic>></strong><</replace>> -<</link>> -<br> //Involves using terrain knowledge and small fast attacks to hinder and weaken the enemy.// -<br> -<<link "choke Points">> - <<set $chosenTactic = "choke Points">> - <<replace "#tactic">><strong><<print $chosenTactic>></strong><</replace>> -<</link>> -<br> //Involves using terrain knowledge and strong fortifications in order to stop the enemy on its track.// -<br> -<<link "Interior Lines">> - <<set $chosenTactic = "Interior Lines">> - <<replace "#tactic">><strong><<print $chosenTactic>></strong><</replace>> -<</link>> -<br> //Involves exploiting a defender's shorter logistics lines and redeployment times in order to keep the enemy pressured.// -<br> -<<link "Pincer Manouver">> - <<set $chosenTactic = "Pincer Manouver">> - <<replace "#tactic">><strong><<print $chosenTactic>></strong><</replace>> -<</link>> -<br> //Involves letting the enemy push back the centre in order to envelop their formation.// -<br> -<<link "Defense In Depth">> - <<set $chosenTactic = "Defense In Depth">> - <<replace "#tactic">><strong><<print $chosenTactic>></strong><</replace>> -<</link>> -<br> //Involves letting the enemy gain terrain to gain tactical superiority by alternating between delaying actions and small counterattacks.// -<br> -Offensive Tactics -<br> -<<link "Blitzkrieg">> - <<set $chosenTactic = "Blitzkrieg">> - <<replace "#tactic">><strong><<print $chosenTactic>></strong><</replace>> -<</link>> -<br> //Involves breaking the front of the enemy with a fast armored force concentrated into a small area.// -<br> -<<link "Human Wave">> - <<set $chosenTactic = "Human Wave">> - <<replace "#tactic">><strong><<print $chosenTactic>></strong><</replace>> -<</link>> -<br> //Involves assaulting the enemy with large numbers of infantry to overwhelm their lines.// -<br> -<br> -<<link "Commit your choices and send your orders">> - <<goto "attackReport">> -<</link>> \ No newline at end of file +/* 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>> +<<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/attackOptions.tw b/src/SecExp/attackOptions.tw new file mode 100644 index 00000000000..400143b2f25 --- /dev/null +++ b/src/SecExp/attackOptions.tw @@ -0,0 +1,415 @@ +:: attackOptions [nobr] + +<strong>Attack Imminent</strong> +<hr> +The ominous message dominates the screens of your office, <<print $assistantName>> quickly gathers all information available to prepare your arcology for battle. +<<if $attackType == "raiders">> + <<if $riskSim == 1 && $riskSimExpectedAttack == $attackType>> + A disorganized horde of raiders is coming to your city. To such jackals your arcology surely looks like an appetizing morsel. + Fortunately you knew of their coming weeks in advance, the risk simulation system did its job admirably. + <<elseif $perimeterDrones == 1>> + Your drones easily spot the disorganized horde of raiders riding their ragtag vehicles. To such jackals your arcology surely looks like an appetizing morsel. + <<else>> + Some of your citizens saw the disorganized horde of raiders coming towards the city and quickly reported it. To such jackals your arcology surely looks like an appetizing morsel. + <</if>> + <br> + Raiders: + <br> - high attack + <br> - low defense + <br> - low toughness + <br> - low morale +<<elseif $attackType == "free city">> + <<if $riskSim == 1 && $riskSimExpectedAttack == $attackType>> + A menacing column of consumed mercenaries and slavers is coming to your city. Another free city is ready to use their best tools to bring down a dangerous competitor. + Fortunately you knew of their coming weeks in advance, the risk simulation system did its job admirably. + <<elseif $perimeterDrones == 1>> + Your drones easily spot the menacing column of consumed mercenaries and slavers. Another free city is ready to use their best tools to bring down a dangerous competitor. + <<else>> + Some of your citizens saw the menacing column of consumed mercenaries and slavers and rushed to your office to bring the grim news. Another free city is ready to use their best tools to bring down a dangerous competitor. + <</if>> + <br> + Free City expedition: + <br> - low attack + <br> - high defense + <br> - moderate toughness + <br> - moderate morale +<<elseif $attackType == "freedom fighters">> + <<if $riskSim == 1 && $riskSimExpectedAttack == $attackType>> + A dangerous looking army of guerrillas is gathering just outside the arcology. Fanatics and idealists armed with dead men's words and hope, set on erasing your fledgling empire. + Fortunately you knew of their coming weeks in advance, the risk simulation system did its job admirably. + <<elseif $perimeterDrones == 1>> + Your drones easily spot the dangerous looking army of guerrillas is gathering just outside the arcology. Fanatics and idealists armed with dead men's words and hope, set on erasing your fledgling empire. + <<else>> + Some of your citizens saw the dangerous looking army of guerrillas is gathering just outside the arcology. Fanatics and idealists armed with dead men's words and hope, set on erasing your fledgling empire. + <</if>> + <br> + Freedom Fighters: + <br> - very high attack + <br> - low defense + <br> - moderate toughness + <br> - very high morale +<<elseif $attackType == "old world">> + <<if $riskSim == 1 && $riskSimExpectedAttack == $attackType>> + A diciplined yet dusty, scruffy old world army is approaching the confines of your arcology. There's nothing better than a good war to unite the electorate and your arcology is just the perfect target. + Fortunately you knew of their coming weeks in advance, the risk simulation system did its job admirably. + <<elseif $perimeterDrones == 1>> + Your drones easily spot the diciplined yet dusty, scruffy old world army is approaching the confines of your arcology. There's nothing better than a good war to unite the electorate and your arcology is just the perfect target. + <<else>> + Some of your citizens saw the diciplined yet dusty, scruffy old world army is approaching the confines of your arcology. There's nothing better than a good war to unite the electorate and your arcology is just the perfect target. + <</if>> + <br> + Old world expedition: + <br> - high attack + <br> - high defense + <br> - low toughness + <br> - low morale +<<elseif $attackType == "mercenary">> + <<if $riskSim == 1 && $riskSimExpectedAttack == $attackType>> + Some sections of the lower levels were already no longer responding. In the end it happened, your own mercenaries took arms against their benefactor. + Fortunately you knew of their coming weeks in advance, the risk simulation system did its job admirably. + <<elseif $perimeterDrones == 1>> + Your drones easily spot the nervous movement of mercenary units assembling in the lower levels. In the end it happened, your own mercenaries took arms against their benefactor. + <<else>> + Some of your citizens, terrified by the movements of mercenary units in the lower levels, were gathering near the entrance of your penthouse. In the end it happened, your own mercenaries took arms against their benefactor. + <</if>> +<<elseif $attackType == "citizen">> + <<if $riskSim == 1 && $riskSimExpectedAttack == $attackType>> + The streets were already clogged with citizens armed to the teeth, ready to oust their owner. In the end it happened, your own citizens dared took arms against their arcology owner. + Fortunately you knew of their coming weeks in advance, the risk simulation system did its job admirably. + <<elseif $perimeterDrones == 1>> + Your drones easily spot the tumultuos mobs of armed citizens invading the streets. In the end it happened, your own citizens dared took arms against their arcology owner. + <<else>> + Some of your citizens, terrified by the mobs of armed rebels, were gathering near the entrance of your penthouse. In the end it happened, your own citizens dared took arms against their arcology owner. + <</if>> +<<elseif $attackType == "slave">> + <<if $riskSim == 1 && $riskSimExpectedAttack == $attackType>> + Reports from all over the arcology are pouring in, filled with slaves assaulting, killing and butchering your citizens. In the end it happened, the slaves dared attack their betters. + Fortunately you knew of their coming weeks in advance, the risk simulation system did its job admirably. + <<elseif $perimeterDrones == 1>> + Your drones easily spot inumerable instances of slaves assaulting, killing and butchering your citizens. In the end it happened, the slaves dared attack their betters. + <<else>> + Some of your citizens, terrified by the mass of slaves assaulting, killing and butchering their fellow citizens, were gathering near the entrance of your penthouse. In the end it happened, the slaves dared attack their betters + <</if>> +<</if>> + + <<if $hasFought != 1>> + <br> + This is your first battle as an arcology owner, <<print $assistantName>> suggests reviewing the meaning of all the data laying in front of you: [[Battle statistics and mechanics|secTutorial]] + <</if>> +<hr> +It seems your troops and your adversary will fight +<<if $battleTerrain == "urban">> + in <strong>the streets of <<if $terrain == "urban">>the old world city surroinding the arcology<<else>>of the free city<</if>>.</strong> +<<elseif $battleTerrain == "rural">> + in <strong>the rural land</strong> surrounding the free city. +<<elseif $battleTerrain == "hills">> + on <strong>the hills</strong> around the free city. +<<elseif $battleTerrain == "coast">> + along <strong>the coast</strong> just outside the free city. +<<elseif $battleterrain == "outskirts">> + right against <strong>the walls of the arcology.</strong> +<<elseif $battleTerrain == "mountains">> + in <strong>the mountains</strong> overlooking the arcology. +<<elseif $battleTerrain == "wasteland">> + in <strong>the wastelands</strong> outside the free city territory. +<</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. +<<elseif $perimeterDrones ==1>> + Thanks to your drones you have a rough estimate of the numbers you're about to face. Around <strong><<print Math.round($attackTroops * (1 + either(-1,1) * random(2) * 0.1))>> men</strong> are coming +<<else>> + Unfortunately you have no good information on what is coming your way, the confused reports of your citizens gives you only a vague number. Around <strong><<print Math.round($attackTroops * (1 + either(-1,1) * random(3) * 0.1))>> men</strong> are coming. +<</if>> +They seems to be +<<set _expectedEquip = 0>> +<<if $riskSim == 1 && $riskSimExpectedAttack == $attackType>> + <<set _expectedEquip = $attackEquip>> +<<elseif $perimeterDrones == 1>> + <<set _expectedEquip = $attackEquip + either(-1,1)>> +<<else>> + <<set _expectedEquip = $attackEquip + either(-1,1) * random(2)>> +<</if>> +<<if _expectedEquip == 0>> + <strong>poorly armed</strong>. old rusty small arms are the norm with just a few barely working civilian vehicles. +<<elseif _expectedEquip == 1>> + <strong>lightly armed</strong>. mostly small arms with some repurposed civilian vehicles and a scattered few machine guns. There's no sign of heavy vehicles, artillery or aircrafts. +<<elseif _expectedEquip == 2>> + <strong>decently armed</strong>. good quality small arms, machine guns a few mortars. There seems to be some heavy military vehicles coming as well. +<<elseif _expectedEquip == 3>> + <strong>well armed</strong>. high quality small arms, snipers, demolitions teams, heavy duty machine guns and mortars. Heavy military vehicles are numerous and a few artillery piecies are accompaning the detachment. +<<elseif _expectedEquip == 4>> + <strong>extremely well armed</strong>. excellent small arms and specialized teams with heavy duty infantry support weapons. Heavy presence of armored military vehicles, artillery pieces and even some attack helicopters. +<</if>> + +<br><br> + +You quickly lay down a plan of action: +<br> +<<link "Let the assistant handle this attack">> + <<if $assistantPower == 2>> + <<elseif $assistantPower == 1>> + <<else>> + <</if>> +<</link>> + +<br> //$assistantName will handle leaders, tactics and troop deployment to the best of her abilities. To be implemented// + +<br><br> + +/* leader assignment */ +<span id="leader"><strong><<print $assistantName>></strong></span> will lead your troops. + <br> + <<if $leadingTroops != "PC">> + <<link "Personally join the battle">> + <<set $leadingTroops = "PC">> + <<replace "#leader">><strong><<print $PC.name>></strong><</replace>> + <</link>> + <<else>> + Personally join the battle + <</if>> + | + <<if $leadingTroops != "assistant">> + <<link "Let $assistantName lead the troops">> + <<set $leadingTroops = "assistant">> + <<replace "#leader">><strong><<print $assistantName>></strong><</replace>> + <</link>> + <<else>> + Let $assistantName lead the troops + <</if>> + <<if $Bodyguard != 0 && $slavesInArmy == 1>> + | + <<if $leadingTroops != "bodyguard">> + <<link "Let your bodyguard lead your troops">> + <<set $leadingTroops = "bodyguard">> + <<replace "#leader">><strong><<print $Bodyguard.slaveName>></strong><</replace>> + <</link>> + <<else>> + Let your bodyguard lead your troops + <</if>> + <</if>> + <<if $HeadGirl != 0 && $slavesInArmy == 1>> + | + <<if $leadingTroops != "headgirl">> + <<link "Let your head girl lead your troops">> + <<set $leadingTroops = "headGirl">> + <<replace "#leader">><strong><<print $HeadGirl.slaveName>></strong><</replace>> + <</link>> + <<else>> + Let your head girl lead your troops + <</if>> + <</if>> + <<if $militiaCreated == 1>> + | + <<if $leadingTroops != "citizen">> + <<link "Let the citizens' militia officers lead the troops">> + <<set $leadingTroops = "citizen">> + <<replace "#leader">><strong>The citizens' militia commander</strong><</replace>> + <</link>> + <<else>> + Let the citizens' militia officers lead the troops. + <</if>> + <</if>> + <<if $mercenaries > 0>> + | + <<if $leadingTroops != "mercenary">> + <<link "Let the mercenary officers lead the troops">> + <<set $leadingTroops = "mercenary">> + <<replace "#leader">><strong>The mercenary commander</strong><</replace>> + <</link>> + <<else>> + Let the mercenary officers lead the troops. + <</if>> + <</if>> + +/* troop deployment */ +<br><br> +With your current readiness level you can <<if $deployedUnits > 0>>still<</if>> send <strong><<print $deployableUnits>></strong>. Available units: + +<<set _mL = $militiaUnits.length>> +<<set _sL = $slaveUnits.length>> +<<set _meL = $mercUnits.length>> +<<if $deployableUnits > 0>> + <<if $secBots.isDeployed == 0 && $secBots.troops > 0>> + <br> + <<secBotsDescription>> + <br> + <<link "Deploy the unit">> + <<set $secBots.isDeployed = 1>> + <<set $deployableUnits-->> + <<set $deployedUnits++>> + <<set $deployingBots = 1>> + <<goto "attackHandler">> + <</link>> + <</if>> + <<for _i = 0; _i < _mL; _i++>> + <<if $militiaUnits[_i].active == 1 && $militiaUnits[_i].isDeployed == 0 && $militiaUnits[_i].troops > 0>> + <br> + <<militiaUnitsDescription $militiaUnits[_i]>> + <br> + <<link "Deploy the unit">> + <<set $militiaUnits[_i].isDeployed = 1>> + <<set $deployableUnits-->> + <<set $deployedUnits++>> + <<set $deployingMilitia = 1>> + <<goto "attackHandler">> + <</link>> + <</if>> + <</for>> + <<for _i = 0; _i < _sL; _i++>> + <<if $slaveUnits[_i].active == 1 && $slaveUnits[_i].isDeployed == 0 && $slaveUnits[_i].troops > 0>> + <br> + <<slaveUnitsDescription $slaveUnits[_i]>> + <br> + <<link "Deploy the unit">> + <<set $slaveUnits[_i].isDeployed = 1>> + <<set $deployableUnits-->> + <<set $deployedUnits++>> + <<set $deployingSlaves = 1>> + <<goto "attackHandler">> + <</link>> + <</if>> + <</for>> + <<for _i = 0; _i < _meL; _i++>> + <<if $mercUnits[_i].active == 1 && $mercUnits[_i].isDeployed == 0 && $mercUnits[_i].troops > 0>> + <br> + <<mercUnitsDescription $mercUnits[_i]>> + <br> + <<link "Deploy the unit">> + <<set $mercUnits[_i].isDeployed = 1>> + <<set $deployableUnits-->> + <<set $deployedUnits++>> + <<set $deployingMercs = 1>> + <<goto "attackHandler">> + <</link>> + <</if>> + <</for>> +<<else>> + <br> + Unit roster full. +<</if>> + +<br><br> + +Units about to be deployed: +<<if $deployedUnits > 0>> + <<if $secBots.isDeployed == 1>> + <br> + <<secBotsDescription>> + <br> + <<link "Remove the unit">> + <<set $secBots.isDeployed = 0>> + <<set $deployableUnits++>> + <<set $deployedUnits-->> + <<set $deployingBots = 0>> + <<goto "attackHandler">> + <</link>> + <</if>> + <<for _i = 0; _i < _mL; _i++>> + <<if $militiaUnits[_i].isDeployed == 1>> + <br> + <<militiaUnitsDescription $militiaUnits[_i]>> + <br> + <<link "Remove the unit">> + <<set $militiaUnits[_i].isDeployed = 0>> + <<set $deployableUnits++>> + <<set $deployedUnits-->> + <<set $deployingMilitia = 0>> + <<goto "attackHandler">> + <</link>> + <</if>> + <</for>> + <<for _i = 0; _i < _sL; _i++>> + <<if $slaveUnits[_i].isDeployed == 1>> + <br> + <<slaveUnitsDescription $slaveUnits[_i]>> + <br> + <<link "Remove the unit">> + <<set $slaveUnits[_i].isDeployed = 0>> + <<set $deployableUnits++>> + <<set $deployedUnits-->> + <<set $deployingSlaves = 0>> + <<goto "attackHandler">> + <</link>> + <</if>> + <</for>> + <<for _i = 0; _i < _meL; _i++>> + <<if $mercUnits[_i].isDeployed == 1>> + <br> + <<mercUnitsDescription $mercUnits[_i]>> + <br> + <<link "Remove the unit">> + <<set $mercUnits[_i].isDeployed = 0>> + <<set $deployableUnits++>> + <<set $deployedUnits-->> + <<set $deployingMercs = 0>> + <<goto "attackHandler">> + <</link>> + <</if>> + <</for>> +<</if>> + +<br><br> + +/* tactics */ +<<if $leadingTroops != "PC">> + For this battle you command your chosen leaders to follow <span id="tactic"><strong><<print $chosenTactic>></strong></span> tactics. +<<else>> + For this battle you choose to follow <span id="tactic"><strong><<print $chosenTactic>></strong></span> tactics. +<</if>> +<br><br> +Defensive tactics +<br> +<<link "Bait and Bleed">> + <<set $chosenTactic = "Bait and Bleed">> + <<replace "#tactic">><strong><<print $chosenTactic>></strong><</replace>> +<</link>> +<br> //Combines bait and switch tactics with guerriglia style assaults, with the objective of slowly bleed the enemy.// +<br> +<<link "Guerrilla">> + <<set $chosenTactic = "Guerrilla">> + <<replace "#tactic">><strong><<print $chosenTactic>></strong><</replace>> +<</link>> +<br> //Involves using terrain knowledge and small fast attacks to hinder and weaken the enemy.// +<br> +<<link "choke Points">> + <<set $chosenTactic = "choke Points">> + <<replace "#tactic">><strong><<print $chosenTactic>></strong><</replace>> +<</link>> +<br> //Involves using terrain knowledge and strong fortifications in order to stop the enemy on its track.// +<br> +<<link "Interior Lines">> + <<set $chosenTactic = "Interior Lines">> + <<replace "#tactic">><strong><<print $chosenTactic>></strong><</replace>> +<</link>> +<br> //Involves exploiting a defender's shorter logistics lines and redeployment times in order to keep the enemy pressured.// +<br> +<<link "Pincer Manouver">> + <<set $chosenTactic = "Pincer Manouver">> + <<replace "#tactic">><strong><<print $chosenTactic>></strong><</replace>> +<</link>> +<br> //Involves letting the enemy push back the centre in order to envelop their formation.// +<br> +<<link "Defense In Depth">> + <<set $chosenTactic = "Defense In Depth">> + <<replace "#tactic">><strong><<print $chosenTactic>></strong><</replace>> +<</link>> +<br> //Involves letting the enemy gain terrain to gain tactical superiority by alternating between delaying actions and small counterattacks.// +<br> +Offensive Tactics +<br> +<<link "Blitzkrieg">> + <<set $chosenTactic = "Blitzkrieg">> + <<replace "#tactic">><strong><<print $chosenTactic>></strong><</replace>> +<</link>> +<br> //Involves breaking the front of the enemy with a fast armored force concentrated into a small area.// +<br> +<<link "Human Wave">> + <<set $chosenTactic = "Human Wave">> + <<replace "#tactic">><strong><<print $chosenTactic>></strong><</replace>> +<</link>> +<br> //Involves assaulting the enemy with large numbers of infantry to overwhelm their lines.// +<br> +<br> +<<link "Send your orders">> + <<goto "attackReport">> +<</link>> \ No newline at end of file diff --git a/src/SecExp/attackReport.tw b/src/SecExp/attackReport.tw index 15def66639d..f6533565adc 100644 --- a/src/SecExp/attackReport.tw +++ b/src/SecExp/attackReport.tw @@ -1,104 +1,4 @@ :: attackReport [nobr] -/*Init*/ -<<set _phase = 0>> -<<set _attack = 0>> -<<set _defense = 0>> -<<set _morale = $baseMorale>> -<<set _hp = 0>> -<<set _enemyAttack = 0>> -<<set _enemyDefense = 0>> -<<set _enemyMorale = 0>> -<<set _enemyHp = 0>> -<<set _mL = $militiaUnits.length>> -<<set _sL = $slaveUnits.length>> -<<set _meL = $mercUnits.length>> +<<include "attackHandler">> -/* calculates PC army stats */ -<<if $secBots.isDeployed == 1>> - <<set _attack += $secBotsBaseAttack + $secBotsBaseAttack * $secBots.equip * 0.5>> - <<set _defense += $secBotsBaseDefense + $secBotsBaseDefense * $secBots.equip * 0.5>> - <<set _morale += $secBotsMorale>> - <<set _hp += $secBotsBaseHp * $secBots.troops>> -<</if>> -<<for _i = 0; _i < _mL; _i++>> - <<if $militiaUnits[_i].isDeployed == 1>> - <<set _attack += $militiaBaseAttack + $militiaBaseAttack * $militiaUnits[_i].equip * 0.5>> - <<set _defense += $militiaBaseDefense + $militiaBaseDefense * $militiaUnits[_i].equip * 0.5>> - <<set _morale += $militiaBaseMorale + $militiaBaseMorale * $militiaUnits[_i].escorts * 0.5>> - <<set _hp += ($militiaBaseHp + $militiaBaseHp * $militiaUnits[_i].medics * 0.5) * $militiaUnits[_i].troops >> - <</if>> -<</for>> -<<for _i = 0; _i < _sL; _i++>> - <<if $slaveUnits[_i].isDeployed == 1>> - <<set _attack += $slaveBaseAttack + $slaveBaseAttack * $slaveUnits[_i].equip * 0.5>> - <<set _defense += $slaveBaseDefense + $slaveBaseDefense * $slaveUnits[_i].equip * 0.5>> - <<set _morale += $slaveBaseMorale + $slaveBaseMorale * $slaveUnits[_i].escorts * 0.5>> - <<set _hp += ($slaveBaseHp + $slaveBaseHp * $slaveUnits[_i].medics * 0.25) * $slaveUnits[_i].troops>> - <</if>> -<</for>> -<<for _i = 0; _i < _meL; _i++>> - <<if $mercUnits[_i].isDeployed == 1>> - <<set _attack += $mercBaseAttack + $mercBaseAttack * $mercUnits[_i].equip * 0.5>> - <<set _defense += $mercBaseDefense + $mercBaseDefense * $mercUnits[_i].equip * 0.5>> - <<set _morale += $mercBaseMorale + $mercBaseMorale * $mercUnits[_i].escorts * 0.5>> - <<set _hp += ($mercBaseHp + $mercBaseHp * $slaveUnits[_i].medics * 0.25) * $mercUnits[_i].troops>> - <</if>> -<</for>> - -/* calculates enemy army stats */ -<<if $attackType == "raiders">> - -<<elseif $attackType == "free city">> - <<set _enemyAttack = $fcBaseAttack * $fcBaseAttack * $attackEquip * 0.5>> - <<set _enemyDefense = $fcBaseDefense + $fcBaseDefense * $attackEquip * 0.5>> - <<set _enemyMorale = $fcBaseMorale>> - <<set _enemyHp = $fcBaseHp * $attackTroops>> -<<elseif $attackType == "old world">> - <<set _enemyAttack = $owBaseAttack + $owBaseAttack * $attackEquip * 0.5>> - <<set _enemyDefense = $owBaseDefense + $owBaseDefense * $attackEquip * 0.5>> - <<set _enemyMorale = $owBaseMorale>> - <<set _enemyHp = $owBaseHp * $attackTroops>> -<<elseif $attackType == "freedom fighters">> - <<set _enemyAttack = $ffBaseAttack + $ffBaseAttack * $attackEquip * 0.5>> - <<set _enemyDefense = $ffBaseDefense + $ffBaseDefense * $attackEquip * 0.5>> - <<set _enemyMorale = $ffBaseMorale>> - <<set _enemyHp = $ffBaseHp * $attackTroops>> -<</if>> - -/* apply leader, terrain and tactics bonuses */ - - -/* simulates the combat by pitting attk against def -<<for _i = 0; _i < $maxTurns; _i++>> - - -<</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 $battleTerrain = "none">> -<<set $attackThisWeek = 0>> -<<set $deployableUnits = 0>> -<<set $deployedUnits = 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 2f7178fc2a0..83070d3e6d0 100644 --- a/src/SecExp/secInit.tw +++ b/src/SecExp/secInit.tw @@ -34,9 +34,50 @@ <<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 $maxTurns = 10>> +/* statistics */ +<<set $equipMod = 0.15>> +<<set $secBotsBaseAttack = 9>> +<<set $secBotsBaseDefense = 5>> +<<set $secBotsMorale = 120>> +<<set $secBotsBaseHp = 4>> +<<set $militiaBaseAttack = 7>> +<<set $militiaBaseDefense = 5>> +<<set $militiaBaseMorale = 140>> +<<set $militiaBaseHp = 3>> +<<set $slaveBaseAttack = 9>> +<<set $slaveBaseDefense = 3>> +<<set $slaveBaseMorale = 110>> +<<set $slaveBaseHp = 3>> +<<set $mercBaseAttack = 8>> +<<set $mercBaseDefense = 4>> +<<set $mercBaseMorale = 125>> +<<set $mercBaseHp = 4>> + +<<set $raBaseAttack = 8>> +<<set $raBaseDefense = 3>> +<<set $raBaseMorale = 100>> +<<set $raBaseHp = 3>> +<<set $fcBaseAttack = 7>> +<<set $fcBaseDefense = 5>> +<<set $fcBaseMorale = 130>> +<<set $fcBaseHp = 4>> +<<set $owBaseAttack = 9>> +<<set $owBaseDefense = 5>> +<<set $owBaseMorale = 110>> +<<set $owBaseHp = 3>> +<<set $ffBaseAttack = 10>> +<<set $ffBaseDefense = 3>> +<<set $ffBaseMorale = 160>> +<<set $ffBaseHp = 3>> + + /* Units */ <<if def $secBots>> <<set $secBots.active = 0>> diff --git a/src/uncategorized/scheduledEvent.tw b/src/uncategorized/scheduledEvent.tw index 30914bb4a0b..0459c3f0c7f 100644 --- a/src/uncategorized/scheduledEvent.tw +++ b/src/uncategorized/scheduledEvent.tw @@ -90,12 +90,12 @@ <<set $fcnn = ["FCNN service has been temporarily suspended. Please stand by."]>> <</if>> -<<goto "attackGenerator">> +<<include "attackGenerator">> <<if $rivalOwner == -1>> <<goto "P rival initiation">> <<elseif $attackThisWeek == 1>> - <<goto attackHandler>> + <<goto attackOptions>> <<elseif $PC.labor == 1>> <<goto "SE Player Birth">> <<elseif ($independenceDay == 1) && (Math.trunc(($week-23)/52) == ($week-23)/52)>> -- GitLab