From d9cac8c4f2443d1d67d4bf484fae886080215b57 Mon Sep 17 00:00:00 2001 From: hexall90 <hexall90@gmail.com> Date: Sun, 24 Sep 2017 18:34:43 +0200 Subject: [PATCH] continuing report and adjustments to handler --- src/SecExp/SecExpBackwardCompatibility.tw | 15 +- src/SecExp/attackGenerator.tw | 2 +- src/SecExp/attackHandler.tw | 316 +++++++++++++++++++++- src/SecExp/attackReport.tw | 208 ++++++++++---- src/SecExp/secInit.tw | 6 +- 5 files changed, 483 insertions(+), 64 deletions(-) diff --git a/src/SecExp/SecExpBackwardCompatibility.tw b/src/SecExp/SecExpBackwardCompatibility.tw index e2505b54dca..2fbd9ea8442 100644 --- a/src/SecExp/SecExpBackwardCompatibility.tw +++ b/src/SecExp/SecExpBackwardCompatibility.tw @@ -81,7 +81,7 @@ <<set $maxTurns = 10>> <</if>> <<if ndef $battleResult>> - <<set $battleResult = 4>> /* sets $battleResult value outside accepted range (-3,3) to avoid evaluation problems */ + <<set $battleResult = 4>> /* sets $battleResult value outside accepted range (-3,3) to avoid evaluation problems */ <</if>> <<if ndef $losses>> <<set $losses = 0>> @@ -95,7 +95,18 @@ <<if ndef $bribeCost>> <<set $bribeCost = 0>> <</if>> - +<<if ndef $tacticsSuccessful>> + <<set $tacticsSuccessful == 0>> +<</if>> +<<if ndef $auto>> + <<set $auto = 0>> +<</if>> +<<if ndef $leaderWounded>> + <<set $leaderWounded = 0>> /* 0=no wound, 1=mute, 2=blind, 3=amputee, 4=health */ +<</if>> +<<if ndef $gainedCombat>> + <<set $gainedCombat == 1>> +<</if>> /* statistics | since these won't get modified in game, it's not necessary to check if they are defined */ <<set $baseBribePerAttacker = 5>> diff --git a/src/SecExp/attackGenerator.tw b/src/SecExp/attackGenerator.tw index 5bf38fe552b..00c516da946 100644 --- a/src/SecExp/attackGenerator.tw +++ b/src/SecExp/attackGenerator.tw @@ -172,7 +172,7 @@ <<else>> <<set $battleTerrain = "err">> <</if>> - <<set $attackTroops = random(25,50)>> + <<set $attackTroops = random(20,40)>> <<if $week < 30>> <<set $attackTroops *= random(1,2)>> <<elseif $week < 60>> diff --git a/src/SecExp/attackHandler.tw b/src/SecExp/attackHandler.tw index 989d1643bb3..bf6f8423730 100644 --- a/src/SecExp/attackHandler.tw +++ b/src/SecExp/attackHandler.tw @@ -14,15 +14,15 @@ <<set _enemyMorale = 0>> <<set _enemyHp = 0>> <<set _enemyBaseHp = 0>> - - -/* calculates leaders, tactics and terrain modifiers */ +<<set _woundChance = 5>> /* leader has a base chance of 5% to get wounded */ +<<set _tacChance = 0.5>> /* by default tactics have a 50% chance of succeeding */ <<set _atkMod = 1>> <<set _defMod = 1>> <<set _militiaMod = 1>> <<set _slaveMod = 1>> <<set _mercMod = 1>> <<set _enemyMod = 1>> + /* Leaders */ <<if $leadingTroops == "PC">> <<if $authority <= 2500 && $authority > 1000>> @@ -72,15 +72,23 @@ <</if>> <<if $PC.warfare <= 25 && $PC.warfare > 10>> <<set _atkMod -= 0.15>> + <<set _tacChance -= 0.15>> <<elseif $PC.warfare <= 10>> <<set _atkMod -= 0.20>> <<set _defMod -= 0.10>> + <<set _tacChance -= 0.30>> <<elseif $PC.warfare >= 50 && $PC.warfare >= 50>> <<set _atkMod += 0.15>> + <<set _tacChance += 0.15>> <<elseif $PC.warfare >= 75>> <<set _atkMod += 0.20>> <<set _defMod += 0.10>> + <<set _tacChance += 0.30>> <</if>> + /* 80% chance of increasing warfare */ + <<if $PC.warfare < 100 && random(1,100) <= 80>> + <<set $PC.warfare += 10>> + <<set $PC.warfare = Math.clamp($PC.warfare,-100,100) <<elseif $leadingTroops == "assistant">> <<if $rep < 10000 && $authority < 10000>> <<set _militiaMod -= 0.15>> @@ -90,9 +98,11 @@ <<if $assistantPower == 0>> <<set _atkMod -= 0.10>> <<set _defMod -= 0.10>> + <<set _tacChance -= 0.20>> <<elseif $assistantPower == 2>> <<set _atkMod += 0.15>> <<set _defMod += 0.15>> + <<set _tacChance += 0.30>> <</if>> <<elseif $leadingTroops == "bodyguard">> <<if $Bodyguard.devotion < -20>> @@ -110,30 +120,101 @@ <<if (setup.bodyguardCareers.includes($Bodyguard.career) || setup.HGCareers.includes($Bodyguard.career)) && $Bodyguard.intelligence == 3>> <<set _atkMod += 0.25>> <<set _defMod += 0.25>> + <<set _tacChance += 0.50>> <<elseif $Bodyguard.intelligence == 3>> <<set _atkMod += 0.20>> <<set _defMod += 0.15>> + <<set _tacChance += 0.35>> <<elseif (setup.bodyguardCareers.includes($Bodyguard.career) || setup.HGCareers.includes($Bodyguard.career)) && $Bodyguard.intelligence == 2>> <<set _atkMod += 0.15>> <<set _defMod += 0.10>> + <<set _tacChance += 0.25>> <<elseif $Bodyguard.intelligence == 2>> <<set _atkMod += 0.10>> <<set _defMod += 0.10>> + <<set _tacChance += 0.20>> <<elseif setup.bodyguardCareers.includes($Bodyguard.career) || setup.HGCareers.includes($Bodyguard.career) && $Bodyguard.intelligence >= 1>> <<set _atkMod += 0.10>> <<set _defMod += 0.05>> + <<set _tacChance += 0.15>> <<elseif !(setup.bodyguardCareers.includes($Bodyguard.career) && setup.HGCareers.includes($Bodyguard.career)) || $Bodyguard.intelligence <= -2>> <<set _atkMod -= 0.15>> <<set _defMod -= 0.15>> + <<set _tacChance -= 0.30>> <<elseif $Bodyguard.intelligence <= -2>> <<set _atkMod -= 0.15>> <<set _defMod -= 0.10>> + <<set _tacChance -= 0.25>> <<elseif !(setup.bodyguardCareers.includes($Bodyguard.career) && setup.HGCareers.includes($Bodyguard.career)) || $Bodyguard.intelligence <= -1>> <<set _atkMod -= 0.10>> <<set _defMod -= 0.10>> + <<set _tacChance -= 0.20>> <<elseif $Bodyguard.intelligence <= -1>> <<set _atkMod -= 0.10>> <<set _defMod -= 0.05>> + <<set _tacChance -= 0.15>> + <</if>> + /* does she get wounded? */ + <<if $Bodyguard.combatSkill == 1>> + <<set _woundChance -= 3>> + <</if>> + <<if $Bodyguard.health >= 50>> + <<set _woundChance -= 2>> + <</if>> + <<if $Bodyguard.weight > 130>> + <<set _woundChance += 1>> + <</if>> + <<if $Bodyguard.muscles < -30>> + <<set _woundChance += 1>> + <</if>> + <<if $Bodyguard.eyes <= -2>> + <<set _woundChance += 1>> + <</if>> + <<if $Bodyguard.heels == 1>> + <<set _woundChance += 1>> + <</if>> + <<if $Bodyguard.boobs >= 1400>> + <<set _woundChance += 1>> + <</if>> + <<if $Bodyguard.butt >= 6>> + <<set _woundChance += 1>> + <</if>> + <<if $Bodyguard.preg >= 30>> + <<set _woundChance += 1>> + <</if>> + <<if $Bodyguard.preg >= 30>> + <<set _woundChance += 1>> + <</if>> + <<if $Bodyguard.dick >= 8>> + <<set _woundChance += 1>> + <</if>> + <<if $Bodyguard.balls >= 8>> + <<set _woundChance += 1>> + <</if>> + <<if $Bodyguard.intelligence <= -3>> + <<set _woundChance += 1>> + <</if>> + <<if random(1,100) <= _woundChance>> + <<set $leaderWounded = 1>> + <<set _militiaMod -= 0.2>> + <<set _slaveMod -= 0.2>> + <<set _mercMod -= 0.2>> + <<set _enemyMod += 0.2>> + <<set $woundType = random(1,10)>> + <<if $woundType == 1>> + <<set $Bodyguard.voice = 0>> + <<elseif $woundType == 2>> + <<set $Bodyguard.eyes = -2>> + <<elseif $woundType == 3>> + <<set $Bodyguard.amp = 1>> + <<elseif $woundType >= 4>> + <<set $Bodyguard.health -= 40>> + <</if>> + <</if>> + /* 60% chance of getting combat skill if nto already have it */ + <<if $Bodyguard.combatSkill == 0 && random(1,100) <= 60>> + <<set $gainedCombat == 1>> + <<set $Bodyguard.combatSkill = 1>> <</if>> <<elseif $leadingTroops == "headGirl">> <<if $HeadGirl.devotion < -20>> @@ -151,30 +232,101 @@ <<<<if (setup.bodyguardCareers.includes($HeadGirl.career) || setup.HGCareers.includes($HeadGirl.career)) && $HeadGirl.intelligence == 3>> <<set _atkMod += 0.25>> <<set _defMod += 0.25>> + <<set _tacChance += 0.50>> <<elseif $HeadGirl.intelligence == 3>> <<set _atkMod += 0.20>> <<set _defMod += 0.15>> + <<set _tacChance += 0.35>> <<elseif (setup.bodyguardCareers.includes($HeadGirl.career) || setup.HGCareers.includes($HeadGirl.career)) && $HeadGirl.intelligence == 2>> <<set _atkMod += 0.15>> <<set _defMod += 0.10>> + <<set _tacChance += 0.25>> <<elseif $HeadGirl.intelligence == 2>> <<set _atkMod += 0.10>> <<set _defMod += 0.10>> + <<set _tacChance += 0.20>> <<elseif setup.bodyguardCareers.includes($HeadGirl.career) || setup.HGCareers.includes($HeadGirl.career) && $HeadGirl.intelligence >= 1>> <<set _atkMod += 0.10>> <<set _defMod += 0.05>> + <<set _tacChance += 0.15>> <<elseif !(setup.bodyguardCareers.includes($HeadGirl.career) && setup.HGCareers.includes($HeadGirl.career)) || $HeadGirl.intelligence <= -2>> <<set _atkMod -= 0.15>> <<set _defMod -= 0.15>> + <<set _tacChance -= 0.30>> <<elseif $HeadGirl.intelligence <= -2>> <<set _atkMod -= 0.15>> <<set _defMod -= 0.10>> + <<set _tacChance -= 0.25>> <<elseif !(setup.bodyguardCareers.includes($HeadGirl.career) && setup.HGCareers.includes($HeadGirl.career)) || $HeadGirl.intelligence <= -1>> <<set _atkMod -= 0.10>> <<set _defMod -= 0.10>> + <<set _tacChance -= 0.20>> <<elseif $HeadGirl.intelligence <= -1>> <<set _atkMod -= 0.10>> <<set _defMod -= 0.05>> + <<set _tacChance -= 0.15>> + <</if>> + /* does she get wounded? */ + <<if $HeadGirl.combatSkill == 1>> + <<set _woundChance -= 3>> + <</if>> + <<if $HeadGirl.health >= 50>> + <<set _woundChance -= 2>> + <</if>> + <<if $HeadGirl.weight > 130>> + <<set _woundChance += 1>> + <</if>> + <<if $HeadGirl.muscles < -30>> + <<set _woundChance += 1>> + <</if>> + <<if $HeadGirl.eyes <= -2>> + <<set _woundChance += 1>> + <</if>> + <<if $HeadGirl.heels == 1>> + <<set _woundChance += 1>> + <</if>> + <<if $HeadGirl.boobs >= 1400>> + <<set _woundChance += 1>> + <</if>> + <<if $HeadGirl.butt >= 6>> + <<set _woundChance += 1>> + <</if>> + <<if $HeadGirl.preg >= 30>> + <<set _woundChance += 1>> + <</if>> + <<if $HeadGirl.preg >= 30>> + <<set _woundChance += 1>> + <</if>> + <<if $HeadGirl.dick >= 8>> + <<set _woundChance += 1>> + <</if>> + <<if $HeadGirl.balls >= 8>> + <<set _woundChance += 1>> + <</if>> + <<if $HeadGirl.intelligence <= -3>> + <<set _woundChance += 1>> + <</if>> + <<if random(1,100) <= _woundChance>> + <<set $leaderWounded = 1>> + <<set _militiaMod -= 0.2>> + <<set _slaveMod -= 0.2>> + <<set _mercMod -= 0.2>> + <<set _enemyMod += 0.2>> + <<set $woundType = random(1,10)>> + <<if $woundType == 1>> + <<set $HeadGirl.voice = 0>> + <<elseif $woundType == 2>> + <<set $HeadGirl.eyes = -2>> + <<elseif $woundType == 3>> + <<set $HeadGirl.amp = 1>> + <<elseif $woundType >= 4>> + <<set $HeadGirl.health -= 40>> + <</if>> + <</if>> + /* 60% chance of getting combat skill if nto already have it */ + <<if $HeadGirl.combatSkill == 0 && random(1,100) <= 60>> + <<set $gainedCombat == 1>> + <<set $HeadGirl.combatSkill = 1>> <</if>> <<elseif $leadingTroops == "citizen">> <<if $arcologies[0].FSDegradationist == "unset" && $arcologies[0].FSPaternalist == "unset">> @@ -194,6 +346,7 @@ <</if>> <<set _atkMod += either(-1,1) * random(10) * 0.1>> <<set _defMod += either(-1,1) * random(10) * 0.1>> + <<set _tacChance += either(-1,1) * random(20) * 0.1>> <<elseif $leadingTroops == "mercenary">> <<set _mercMod += 0.10>> <<if $arcologies[0].FSRomanRevivalist != "unset">> @@ -206,108 +359,140 @@ <</if>> <<set _atkMod += random(15) * 0.1>> <<set _defMod += random(15) * 0.1>> + <<set _tacChance += random(30) * 0.1>> <</if>> /* Terrain and Tactics */ <<if $battleTerrain == "urban">> <<if $chosenTactic == "Bait and Bleed">> <<set _atkMod += 0.15>> <<set _defMod += 0.10>> + <<set _tacChance += 0.25>> <<elseif $chosenTactic == "Guerrilla">> <<set _atkMod += 0.10>> <<set _defMod += 0.15>> + <<set _tacChance += 0.25>> <<elseif $chosenTactic == "Choke Points">> <<set _atkMod += 0.10>> <<set _defMod += 0.15>> + <<set _tacChance += 0.25>> <<elseif $chosenTactic == "Interior Lines">> <<set _atkMod += 0.05>> <<set _defMod += 0.10>> + <<set _tacChance += 0.15>> <<elseif $chosenTactic == "Pincer Manouver">> <<set _atkMod -= 0.05>> <<set _defMod -= 0.10>> + <<set _tacChance -= 0.15>> <<elseif $chosenTactic == "Defense In Depth">> <<set _atkMod -= 0.05>> <<set _defMod -= 0.05>> + <<set _tacChance -= 0.10>> <<elseif $chosenTactic == "Blitzkrieg">> <<set _atkMod -= 0.15>> <<set _defMod -= 0.10>> + <<set _tacChance -= 0.25>> <<elseif $chosenTactic == "Human Wave">> <<set _atkMod -= 0.15>> <<set _defMod -= 0.15>> + <<set _tacChance -= 0.30>> <</if>> <<elseif $battleTerrain == "rural">> <<if $chosenTactic == "Bait and Bleed">> <<set _atkMod -= 0.05>> <<set _defMod -= 0.10>> + <<set _tacChance -= 0.15>> <<elseif $chosenTactic == "Guerrilla">> <<set _atkMod -= 0.10>> <<set _defMod -= 0.10>> + <<set _tacChance -= 0.20>> <<elseif $chosenTactic == "Choke Points">> <<set _atkMod -= 0.10>> <<set _defMod -= 0.15>> + <<set _tacChance -= 0.25>> <<elseif $chosenTactic == "Interior Lines">> <<set _atkMod += 0.10>> <<set _defMod += 0.15>> + <<set _tacChance += 0.25>> <<elseif $chosenTactic == "Pincer Manouver">> <<set _atkMod += 0.15>> <<set _defMod += 0.10>> + <<set _tacChance += 0.25>> <<elseif $chosenTactic == "Defense In Depth">> <<set _atkMod += 0.15>> <<set _defMod += 0.15>> + <<set _tacChance += 0.30>> <<elseif $chosenTactic == "Blitzkrieg">> <<set _atkMod += 0.15>> <<set _defMod += 0.10>> + <<set _tacChance += 0.25>> <<elseif $chosenTactic == "Human Wave">> <<set _atkMod += 0.20>> <<set _defMod += 0.05>> + <<set _tacChance += 0.25>> <</if>> <<elseif $battleTerrain == "hills">> <<if $chosenTactic == "Bait and Bleed">> <<set _atkMod += 0.05>> <<set _defMod += 0.05>> + <<set _tacChance += 0.10>> <<elseif $chosenTactic == "Guerrilla">> <<set _atkMod += 0.05>> <<set _defMod += 0.10>> + <<set _tacChance += 0.15>> <<elseif $chosenTactic == "Choke Points">> <<set _atkMod += 0.10>> <<set _defMod += 0.10>> + <<set _tacChance += 0.20>> <<elseif $chosenTactic == "Interior Lines">> <<set _atkMod -= 0.05>> <<set _defMod -= 0.05>> + <<set _tacChance -= 0.10>> <<elseif $chosenTactic == "Pincer Manouver">> <<set _atkMod += 0.10>> <<set _defMod += 0.05>> + <<set _tacChance += 0.15>> <<elseif $chosenTactic == "Defense In Depth">> <<set _atkMod -= 0.10>> <<set _defMod -= 0.05>> + <<set _tacChance -= 0.15>> <<elseif $chosenTactic == "Blitzkrieg">> <<set _atkMod -= 0.10>> <<set _defMod -= 0.15>> + <<set _tacChance += 0.25>> <<elseif $chosenTactic == "Human Wave">> <<set _atkMod -= 0.15>> <<set _defMod -= 0.15>> + <<set _tacChance -= 0.30>> <</if>> <<elseif $battleTerrain == "coast">> <<if $chosenTactic == "Bait and Bleed">> <<set _atkMod -= 0.05>> <<set _defMod -= 0.05>> + <<set _tacChance -= 0.10>> <<elseif $chosenTactic == "Guerrilla">> <<set _atkMod += 0.05>> <<set _defMod += 0.05>> + <<set _tacChance += 0.10>> <<elseif $chosenTactic == "Choke Points">> <<set _atkMod += 0.05>> <<set _defMod += 0.15>> + <<set _tacChance += 0.15>> <<elseif $chosenTactic == "Interior Lines">> <<set _atkMod += 0.10>> <<set _defMod += 0.10>> + <<set _tacChance += 0.20>> <<elseif $chosenTactic == "Pincer Manouver">> <<set _atkMod -= 0.10>> <<set _defMod -= 0.10>> + <<set _tacChance -= 0.20>> <<elseif $chosenTactic == "Defense In Depth">> <<set _atkMod += 0.10>> <<set _defMod += 0.10>> + <<set _tacChance += 0.20>> <<elseif $chosenTactic == "Blitzkrieg">> <<set _atkMod -= 0.05>> <<set _defMod -= 0.05>> + <<set _tacChance -= 0.10>> <<elseif $chosenTactic == "Human Wave">> <<set _atkMod += 0.05>> <<set _defMod -= 0.05>> @@ -316,24 +501,31 @@ <<if $chosenTactic == "Bait and Bleed">> <<set _atkMod -= 0.10>> <<set _defMod -= 0.15>> + <<set _tacChance -= 0.25>> <<elseif $chosenTactic == "Guerrilla">> <<set _atkMod -= 0.10>> <<set _defMod -= 0.05>> + <<set _tacChance -= 0.15>> <<elseif $chosenTactic == "Choke Points">> <<set _atkMod += 0.10>> <<set _defMod += 0.15>> + <<set _tacChance += 0.25>> <<elseif $chosenTactic == "Interior Lines">> <<set _atkMod += 0.15>> <<set _defMod += 0.10>> + <<set _tacChance += 0.25>> <<elseif $chosenTactic == "Pincer Manouver">> <<set _atkMod += 0.05>> <<set _defMod += 0.10>> + <<set _tacChance += 0.15>> <<elseif $chosenTactic == "Defense In Depth">> <<set _atkMod += 0.10>> <<set _defMod += 0.15>> + <<set _tacChance += 0.25>> <<elseif $chosenTactic == "Blitzkrieg">> <<set _atkMod += 0.10>> <<set _defMod -= 0.05>> + <<set _tacChance += 0.05>> <<elseif $chosenTactic == "Human Wave">> <<set _atkMod += 0.10>> <<set _defMod -= 0.10>> @@ -342,56 +534,173 @@ <<if $chosenTactic == "Bait and Bleed">> <<set _atkMod += 0.10>> <<set _defMod += 0.15>> + <<set _tacChance += 0.25>> <<elseif $chosenTactic == "Guerrilla">> <<set _atkMod += 0.10>> <<set _defMod += 0.15>> + <<set _tacChance += 0.25>> <<elseif $chosenTactic == "Choke Points">> <<set _atkMod += 0.05>> <<set _defMod += 0.20>> + <<set _tacChance += 0.25>> <<elseif $chosenTactic == "Interior Lines">> <<set _atkMod += 0.10>> <<set _defMod += 0.10>> + <<set _tacChance += 0.20>> <<elseif $chosenTactic == "Pincer Manouver">> <<set _atkMod += 0.10>> <<set _defMod -= 0.05>> + <<set _tacChance += 0.05>> <<elseif $chosenTactic == "Defense In Depth">> <<set _atkMod += 0.10>> <<set _defMod += 0.10>> + <<set _tacChance += 0.20>> <<elseif $chosenTactic == "Blitzkrieg">> <<set _atkMod -= 0.10>> <<set _defMod -= 0.10>> + <<set _tacChance -= 0.20>> <<elseif $chosenTactic == "Human Wave">> <<set _atkMod -= 0.10>> <<set _defMod -= 0.10>> + <<set _tacChance -= 0.20>> <</if>> <<elseif $battleTerrain == "wasteland">> <<if $chosenTactic == "Bait and Bleed">> <<set _atkMod += 0.05>> <<set _defMod += 0.05>> + <<set _tacChance += 0.10>> <<elseif $chosenTactic == "Guerrilla">> <<set _atkMod += 0.10>> <<set _defMod += 0.05>> + <<set _tacChance += 0.15>> <<elseif $chosenTactic == "Choke Points">> <<set _atkMod -= 0.10>> <<set _defMod += 0.05>> + <<set _tacChance -= 0.05>> <<elseif $chosenTactic == "Interior Lines">> <<set _atkMod += 0.10>> <<set _defMod += 0.15>> + <<set _tacChance += 0.25>> <<elseif $chosenTactic == "Pincer Manouver">> <<set _atkMod += 0.15>> <<set _defMod += 0.10>> + <<set _tacChance += 0.25>> <<elseif $chosenTactic == "Defense In Depth">> <<set _atkMod += 0.05>> <<set _defMod += 0.10>> + <<set _tacChance += 0.15>> <<elseif $chosenTactic == "Blitzkrieg">> <<set _atkMod += 0.15>> <<set _defMod += 0.15>> + <<set _tacChance += 0.30>> <<elseif $chosenTactic == "Human Wave">> <<set _atkMod += 0.20>> <<set _defMod += 0.05>> + <<set _tacChance += 0.25>> <</if>> <</if>> +<<if $chosenTactic == "Bait and Bleed">> + <<if $attackType == "raiders">> + <<set _tacChance -= 0.10>> + <<elseif $attackType == "free city">> + <<set _tacChance += 0.10>> + <<elseif $attackType == "old world">> + <<set _tacChance += 0.25>> + <<elseif $attackType == "freedom fighters">> + <<set _tacChance -= 0.15>> + <</if>> +<<elseif $chosenTactic == "Guerrilla">> + <<if $attackType == "raiders">> + <<set _tacChance -= 0.20>> + <<elseif $attackType == "free city">> + <<set _tacChance += 0.15>> + <<elseif $attackType == "old world">> + <<set _tacChance += 0.25>> + <<elseif $attackType == "freedom fighters">> + <<set _tacChance -= 0.25>> + <</if>> +<<elseif $chosenTactic == "Choke Points">> + <<if $attackType == "raiders">> + <<set _tacChance += 0.25>> + <<elseif $attackType == "free city">> + <<set _tacChance -= 0.05>> + <<elseif $attackType == "old world">> + <<set _tacChance -= 0.10>> + <<elseif $attackType == "freedom fighters">> + <<set _tacChance += 0.05>> + <</if>> +<<elseif $chosenTactic == "Interior Lines">> + <<if $attackType == "raiders">> + <<set _tacChance -= 0.15>> + <<elseif $attackType == "free city">> + <<set _tacChance += 0.15>> + <<elseif $attackType == "old world">> + <<set _tacChance += 0.20>> + <<elseif $attackType == "freedom fighters">> + <<set _tacChance -= 0.10>> + <</if>> +<<elseif $chosenTactic == "Pincer Manouver">> + <<if $attackType == "raiders">> + <<set _tacChance += 0.15>> + <<elseif $attackType == "free city">> + <<set _tacChance += 0.10>> + <<elseif $attackType == "old world">> + <<set _tacChance -= 0.10>> + <<elseif $attackType == "freedom fighters">> + <<set _tacChance += 0.15>> + <</if>> +<<elseif $chosenTactic == "Defense In Depth">> + <<if $attackType == "raiders">> + <<set _tacChance -= 0.20>> + <<elseif $attackType == "free city">> + <<set _tacChance += 0.10>> + <<elseif $attackType == "old world">> + <<set _tacChance += 0.20>> + <<elseif $attackType == "freedom fighters">> + <<set _tacChance -= 0.05>> + <</if>> +<<elseif $chosenTactic == "Blitzkrieg">> + <<if $attackType == "raiders">> + <<set _tacChance += 0.10>> + <<elseif $attackType == "free city">> + <<set _tacChance -= 0.20>> + <<elseif $attackType == "old world">> + <<set _tacChance += 0.25>> + <<elseif $attackType == "freedom fighters">> + <<set _tacChance -= 0.10>> + <</if>> +<<elseif $chosenTactic == "Human Wave">> + <<if $attackType == "raiders">> + <<set _tacChance -= 0.10>> + <<elseif $attackType == "free city">> + <<set _tacChance += 0.10>> + <<elseif $attackType == "old world">> + <<set _tacChance -= 0.15>> + <<elseif $attackType == "freedom fighters">> + <<set _tacChance += 0.10>> + <</if>> +<</if>> + +/* Calculates if tactics are successful */ +<<if random(1,100) <= _tacChance * 100>> + <<set _enemyMod -= 0.30>> + <<set _militiaMod += 0.20>> + <<set _slaveMod += 0.20>> + <<set _mercMod += 0.20>> + <<set _atkMod += 0.10>> + <<set _defMod += 0.10>> + <<set $tacticsSuccessful == 1>> +<<else>> + <<set _enemyMod += 0.20>> + <<set _militiaMod -= 0.20>> + <<set _slaveMod -= 0.20>> + <<set _mercMod -= 0.20>> + <<set _atkMod -= 0.10>> + <<set _defMod -= 0.10>> + <<set $tacticsSuccessful == 0>> +<</if>> + /* enemy morale mods */ <<if $week < 30>> <<set _enemyMod += 0.15>> @@ -491,6 +800,7 @@ Debug: <br>militiaMod: _militiaMod <br>slaveMod: _slaveMod <br>mercMod: _mercMod +<br>tacticSuccessful: $tacticsSuccessful <br>enemyAttack: _enemyAttack <br>enemyDefense: _enemyDefense <br>enemyMorale: _enemyMorale diff --git a/src/SecExp/attackReport.tw b/src/SecExp/attackReport.tw index fe0e552fcfe..fe58899d46f 100644 --- a/src/SecExp/attackReport.tw +++ b/src/SecExp/attackReport.tw @@ -628,8 +628,17 @@ Your reputation is so high your name carries power by itself. Having you on the battlefield puts fear even in the hardiest of warriors. <</if>> <</if>> + <<if $PC.warfare <= 25 && $PC.warfare > 10>> + Your inexperience in military matters has a negative impact on your troops performance and the effectiveness of your battleplan. + <<elseif $PC.warfare <= 10>> + Your ignorance in military matters has a severe negative impact on your troops performance and the effectiveness of your battleplan. + <<elseif $PC.warfare >= 50 && $PC.warfare >= 50>> + Your experience in military matters has a positive impact on your troops performance and the effectiveness of your battleplan. + <<elseif $PC.warfare >= 75>> + Your great experience in military matters has a major positive impact on your troops performance and the effectiveness of your battleplan. + <</if>> <<elseif $leadingTroops == "assistant">> - You let your personal assistant lead the troops. + <<if $auto == 1>>$assistantName<<else>>You<</if>> let your personal assistant lead the troops. <<if $deployingMercs == 1 || $deployingMilitia == 1 || $deployingSlaves == 1>> <<if _oldRep < 10000 && _oldAuth < 10000>> No soldier trusts a computer to be their commander, no algorithm can substitute experience <<if $assistantPower == 0>>and as expected<<else>>, however <</if>> @@ -642,10 +651,10 @@ <<elseif $assistantPower == 1>> your assistant performs decently. While nothing to write home about your men are pleasantly surprised. <<elseif $assistantPower == 2>> - your assistant performs admirably. Her vast computing power allows her to be everywhere on the battlefield, greatly enhancing the efficacy of your troops. + your assistant performs admirably. Her vast computing power allows her to be everywhere on the battlefield, greatly enhancing the efficacy of your troops and the effectiveness of your battleplan. <</if>> <<elseif $leadingTroops == "bodyguard">> - You decided it will be your bodyguard to lead the troops. + <<if $auto == 1>>$assistantName<<else>>You<</if>> decided it will be your bodyguard to lead the troops. <<if $deployingSlaves == 1>> <<if $Bodyguard.devotion < -20>> Her low devotion has a negative impact on the morale of your slave soldiers. @@ -688,7 +697,7 @@ <</if>> <</if>> <<if (setup.bodyguardCareers.includes($Bodyguard.career) || setup.HGCareers.includes($Bodyguard.career)) && $Bodyguard.intelligence == 3>> - With her experience and her great intellect, she is able to exploits the smallest of tactical advantages, making your troops greatly effective. + With her experience and her great intellect, she is able to exploits the smallest of tactical advantages, making your troops very effective. <<elseif $Bodyguard.intelligence == 3>> While she lacks experience, her great intellect allows her to seize and exploit any tactical advantage the battlefied offers her. <<elseif (setup.bodyguardCareers.includes($Bodyguard.career) || setup.HGCareers.includes($Bodyguard.career)) && $Bodyguard.intelligence == 2>> @@ -709,7 +718,7 @@ She lacks the experience and the intelligence to be an effective commander, the performance of your troops suffers because of her poor leadership. <</if>> <<elseif $leadingTroops == "headGirl">> - You decided it will be your head girl to lead the troops. + <<if $auto == 1>>$assistantName<<else>>You<</if>> decided it will be your head girl to lead the troops. <<if $deployingSlaves == 1>> <<if $HeadGirl.devotion < -20>> Her low devotion has a negative impact on the morale of your slave soldiers. @@ -772,8 +781,9 @@ <<elseif $HeadGirl.intelligence <= -1>> She lacks the experience and the intelligence to be an effective commander, the performance of your troops suffers because of her poor leadership. <</if>> + <<elseif $leadingTroops == "citizen">> - You decided to appoint one of your volunteers as the commander. + <<if $auto == 1>>$assistantName<<else>>You<</if>> decided to appoint one of your volunteers as the commander. <<if $arcologies[0].FSDegradationist == "unset" && $arcologies[0].FSPaternalist == "unset">> <<if $deployingMilitia == 1>> Your volunteers are honored and pleased that one of their own is leading the defense force of the city. @@ -815,9 +825,27 @@ <</if>> <</if>> -<br> +<br><br> -/* tactics and terrain */ +/* tactics */ +<<if $auto == 1>>$assistantName<<else>>You<</if>> +<<if $chosenTactic == "Bait and Bleed">> + chose to employ "bait and bleed" tactics or relying on quick attacks and harrassment to tire and wound the enemy until their surrender. +<<elseif $chosenTactic == "Guerrilla">> + chose to employ "guerrilla" tactics or relying on stealth, terrain knowledge and subterfuge to undermine and ultimately destroy the enemy. +<<elseif $chosenTactic == "Choke Points">> + chose to employ "choke points" tactics or the extensive use of fortified or highly defensive positions to slow down and eventually stop the enemy. +<<elseif $chosenTactic == "Interior Lines">> + chose to employ "interior lines" tactics or exploiting the defender's shorter front to quickly disengage and concentrate troops when and where needed. +<<elseif $chosenTactic == "Pincer Manouver">> + chose to employ "pince manouver" tactics or attempting to encircle the enemy by faking a collapsing centre front. +<<elseif $chosenTactic == "Defense In Depth">> + chose to employ "defense in depth" tactics or relying on mobility to disengage and exploit overextended enemy troops by attacking their freshly exposed flanks. +<<elseif $chosenTactic == "Blitzkrieg">> + chose to employ "blitzkrieg" tactics or shattering the enemy's frontline with a violent, concentrated armored assault. +<<elseif $chosenTactic == "Human Wave">> + chose to employ "human wave" tactics or overwhelming the enemy's army with a massive infantry assault. +<</if>> <<if $battleTerrain == "urban">> <<if $chosenTactic == "Bait and Bleed">> The urban terrain synergized well with bait and bleed tactics, slowly chipping away at the enemy's forces from the safety of the narrow streets and empty buildings. @@ -856,7 +884,7 @@ <</if>> <<elseif $battleTerrain == "hills">> <<if $chosenTactic == "Bait and Bleed">> - While the hills offer some protection, they also make it harder to manouver, baint and bleed tactics will not be 100% effective here. + While the hills offer some protection, they also make it harder to manouver, bait and bleed tactics will not be 100% effective here. <<elseif $chosenTactic == "Guerrilla">> The hills offer protection to both your troops and your enemy's, making it harder for your men to accomplish guerrilla attacks effectively. <<elseif $chosenTactic == "Choke Points">> @@ -892,84 +920,147 @@ <</if>> <<elseif $battleTerrain == "outskirts">> <<if $chosenTactic == "Bait and Bleed">> - <<set _atkMod -= 0.10>> - <<set _defMod -= 0.15>> + Fighting just beneath the walls of the arcology does not allow for the dynamic redeployment of troops bait and bleed tactics would require. <<elseif $chosenTactic == "Guerrilla">> - <<set _atkMod -= 0.10>> - <<set _defMod -= 0.05>> + Fighting just beneath the walls of the arcology does not allow for the dynamic redeployment of troops guerrilla tactics would require. <<elseif $chosenTactic == "Choke Points">> - <<set _atkMod += 0.10>> - <<set _defMod += 0.15>> + The imposing structure of the arcology itself provides plenty of opportunities to create fortified choke points where to shatter the enemy assault. <<elseif $chosenTactic == "Interior Lines">> - <<set _atkMod += 0.15>> - <<set _defMod += 0.10>> + While the presence of the arcology near the battlefield is an advantage, it does limit manouverability, lowering overall effectiveness of interior lines tactics. <<elseif $chosenTactic == "Pincer Manouver">> - <<set _atkMod += 0.05>> - <<set _defMod += 0.10>> + While the presence of the arcology near the battlefield is an advantage, it does limit manouverability, lowering the chances of making an effective encirclement. <<elseif $chosenTactic == "Defense In Depth">> - <<set _atkMod += 0.10>> - <<set _defMod += 0.15>> + Having the arcology near the battlefield means there are limited available manouvers to your troops, who still needs to defend the structure, making defense in depth tactics not as effective. <<elseif $chosenTactic == "Blitzkrieg">> - <<set _atkMod += 0.10>> - <<set _defMod -= 0.05>> + While an assault may save the arcology from getting involved at all, having the imposing structure so near does limit manouverability and so the impetus of the lightning strike. <<elseif $chosenTactic == "Human Wave">> - <<set _atkMod += 0.10>> - <<set _defMod -= 0.10>> + While an attack may save the arcology from getting involved at all, having the imposing structure so near does limit manouverability and so the impetus of the mass assault. <</if>> <<elseif $battleTerrain == "mountains">> <<if $chosenTactic == "Bait and Bleed">> - <<set _atkMod += 0.10>> - <<set _defMod += 0.15>> + While the mountains offer great protection, they also limit manouverability, bait and bleed tactics will not be quite as effective here. <<elseif $chosenTactic == "Guerrilla">> - <<set _atkMod += 0.10>> - <<set _defMod += 0.15>> + The mountains offer many excellent hiding spots and defensive positions, making guerrilla tatics very effective. <<elseif $chosenTactic == "Choke Points">> - <<set _atkMod += 0.05>> - <<set _defMod += 0.20>> + The mountains offer plenty of opportunity to build strong defensive positions where to shatter the enemy's assault. <<elseif $chosenTactic == "Interior Lines">> - <<set _atkMod += 0.10>> - <<set _defMod += 0.10>> + While the rough terrain complicates manouvers, the defensive advantages offered by the mountains offsets its negative impact. <<elseif $chosenTactic == "Pincer Manouver">> - <<set _atkMod += 0.10>> - <<set _defMod -= 0.05>> + The rough terrain complicates manouvers, your men have a really hard time pulling off an effective encirclement in this environment. <<elseif $chosenTactic == "Defense In Depth">> - <<set _atkMod += 0.10>> - <<set _defMod += 0.10>> + While mobility is limited, defensive positions are plentiful, your men are not able to fully exploit overextended assaults, but are able to better resist them. <<elseif $chosenTactic == "Blitzkrieg">> - <<set _atkMod -= 0.10>> - <<set _defMod -= 0.10>> + The rough terrain complicates manouvers, your men have a really hard time pulling off an effective lightning strike in this environment. <<elseif $chosenTactic == "Human Wave">> - <<set _atkMod -= 0.10>> - <<set _defMod -= 0.10>> + The rough terrain complicates manouvers, your men have a really hard time pulling off an effective mass assault in this environment. <</if>> <<elseif $battleTerrain == "wasteland">> <<if $chosenTactic == "Bait and Bleed">> - <<set _atkMod += 0.05>> - <<set _defMod += 0.05>> + While the wastelands are mostly open terrain, ther are enough hiding spots to make bait and bleed tactics work well enough. <<elseif $chosenTactic == "Guerrilla">> - <<set _atkMod += 0.10>> - <<set _defMod += 0.05>> + While the wastelands are mostly open terrain, ther are enough hiding spots to make guerrilla tactics work well enough. <<elseif $chosenTactic == "Choke Points">> - <<set _atkMod -= 0.10>> - <<set _defMod += 0.05>> + The wastelands are mostly open terrain, your men have adifficult time setting up effective fortified positions. <<elseif $chosenTactic == "Interior Lines">> - <<set _atkMod += 0.10>> - <<set _defMod += 0.15>> + The wastelands, while rough, are mostly open terrain, where your men can exploit to the maximum the superior mobility of the defender. <<elseif $chosenTactic == "Pincer Manouver">> - <<set _atkMod += 0.15>> - <<set _defMod += 0.10>> + The wastelands, while rough, are mostly open terrain, your men can set up an effective encirclement here. <<elseif $chosenTactic == "Defense In Depth">> - <<set _atkMod += 0.05>> - <<set _defMod += 0.10>> + The wastelands, while rough, are mostly open terrain, allowing your men to liberally manouver to exploit overextended enemies. <<elseif $chosenTactic == "Blitzkrieg">> - <<set _atkMod += 0.15>> - <<set _defMod += 0.15>> + The wastelands, while rough, are mostly open terrain, where your men are able to mount an effective lightning strikes. <<elseif $chosenTactic == "Human Wave">> - <<set _atkMod += 0.20>> - <<set _defMod += 0.05>> + The wastelands, while rough, are mostly open terrain, where your men are able to mount an effective mass assault. <</if>> <</if>> +<<if $chosenTactic == "Bait and Bleed">> + <<if $attackType == "raiders">> + Since the bands of raiders are used to be on high alert and on the move constantly, bait and bleed tactics are not effective against them. + <<elseif $attackType == "free city">> + The modern armies hired by free cities are decently mobile, which means quick hit and run attacks will be less successful, but their discipline and confidence still make them quite susceptible to this type of attack. + <<elseif $attackType == "old world">> + While old world armies are tough nuts to crack, their predictability makes them the perfect target for hit and run and harrassment tactics. + <<elseif $attackType == "freedom fighters">> + Freedom figthers live every day as chasing and being chased by far superior forces, they are far more experienced than your troops in this type of warfare and much less susceptible to it. + <</if>> +<<elseif $chosenTactic == "Guerrilla">> + <<if $attackType == "raiders">> + Since the bands of raiders are used to be on high alert and on the move constantly, guerrilla tactics are not effective against them. + <<elseif $attackType == "free city">> + The modern armies hired by free cities are highly mobile, which means quick hit and run attacks will be less successful, but their discipline and confidence still make them quite susceptible to this type of attack. + <<elseif $attackType == "old world">> + While old world armies are tough nuts to crack, their predictability makes them the perfect target for hit and run and harrassment tactics. + <<elseif $attackType == "freedom fighters">> + Freedom figthers live every day as chasing and being chased by far superior forces, they are far more experienced than your troops in this type of warfare and much less susceptible to it. + <</if>> +<<elseif $chosenTactic == "Choke Points">> + <<if $attackType == "raiders">> + Raiders lack heavy weaponry or armour, so making use of fortified positions is an excellent way to dissipate the otherwise powerful momentum of their assault. + <<elseif $attackType == "free city">> + The high tech equipment free cities can afford to give their guns for hire means there's no defensive position strong enough to stop them, still the relatively low numbers means they will have to take a careful approach, slowing them down. + <<elseif $attackType == "old world">> + Old world armies have both the manpower and the equipment to conquer any defensive position, making use of strong fortifications will onyl bring you this far against them. + <<elseif $attackType == "freedom fighters">> + The lack of specialized weaponry means freedom figthers have a rather hard time overcoming tough defensive positions, unfortunately they have also a lot of experience in avoiding them. + <</if>> +<<elseif $chosenTactic == "Interior Lines">> + <<if $attackType == "raiders">> + The highly mobile horde of raiders will not give much room for your troops to manouver, lowering their tactical superiority. + <<elseif $attackType == "free city">> + While decently mobile, free cities forces are not in high enough numbers to risk maintaining proloungued contact, allowing your tropps to quickly disengage and redeploy where it hurts. + <<elseif $attackType == "old world">> + Old world armies are not famous for the mobility, which makes them highly susceptible to any tactic that exploits manouverability and speed. + <<elseif $attackType == "freedom fighters">> + While not the best equipped army, the experience and mobility typical of freedom fighters groups make them tough targets for an army that relies itself on mobility. + <</if>> +<<elseif $chosenTactic == "Pincer Manouver">> + <<if $attackType == "raiders">> + While numerous, the undisciplined masses of raiders are easy prey for encirclements. + <<elseif $attackType == "free city">> + While decently mobile, the low number of free cities expedition forces make them good candidates for encirclements. + <<elseif $attackType == "old world">> + The discipline and numbers of old world armies make them quite difficult to encircle. + <<elseif $attackType == "freedom fighters">> + While not particularly mobile, freedom figthers are used to fight against overwhelming odds. + <</if>> +<<elseif $chosenTactic == "Defense In Depth">> + <<if $attackType == "raiders">> + While their low discipline makes them prime candidates for an elastic defense type of strategy, their high numbers limit your troops manouverability. + <<elseif $attackType == "free city">> + With their low numbers free cities mercenaries are quite susceptible to this type of tactic, despite their mobility. + <<elseif $attackType == "old world">> + With their low mobility old world armies are very susceptible to this type of strategy. + <<elseif $attackType == "freedom fighters">> + Low mobility and not particularly high numbers mean freedom figthers can be defeated by employing elastic defense tactics. + <</if>> +<<elseif $chosenTactic == "Blitzkrieg">> + <<if $attackType == "raiders">> + With their low discipline and lack fo heavy equipment, lightning strikes are very effective against their lines. + <<elseif $attackType == "free city">> + Having good equipment and discipline on their side, free cities expeditions are capable of responding to even strong lightning strikes. + <<elseif $attackType == "old world">> + While disciplined, old world armies low mobility makes them highly susceptible to lightning strikes. + <<elseif $attackType == "freedom fighters">> + While not well equipped, freedom figthers have plenty of experience figthing small, mobile attacks, making them difficult to defeat with lightning strikes. + <</if>> +<<elseif $chosenTactic == "Human Wave">> + <<if $attackType == "raiders">> + The hordes of raiders are much more experienced than your soldiers in executing mass assaults and they also have a lot more bodies to throw in the grinder. + <<elseif $attackType == "free city">> + The good equipment and mobility of free cities mercenaries cannot save them from an organized mass assault. + <<elseif $attackType == "old world">> + Unfortunately the discipline and good equipment of old world armies allow them to respond well against a mass assault. + <<elseif $attackType == "freedom fighters">> + The relative low numbers and not great equipment typical of freedom figthers make them susceptible to being overwhelmed by an organized mass assault. + <</if>> +<</if>> +<<if $tacticsSuccessful == 1>> + In the end <<if $leading troops == "PC">>you<<else>>your commander<</if>> @@.green;was able to successfully employ <<print $chosenTactic>> tactics@@, greatly enhancing the efficacy of your army. +<<else>> + In the end <<if $leading troops == "PC">>you<<else>>your commander<</if>> @@.red;was not able to effectively employ <<print $chosenTactic>> tactics@@, greatly affecting the efficacy of your army. +<</if>> + <br> /* effects on the units */ @@ -1136,6 +1227,9 @@ <</if>> /* resets variables */ +<<set $leaderWounded = 0>> +<<set $auto = 0>> +<<set $tacticsSuccessful == 0>> <<set $attackType = "none">> <<set $chosenTactic = "none">> <<set $leadingTroops = "none">> diff --git a/src/SecExp/secInit.tw b/src/SecExp/secInit.tw index 9b91a0b2dfd..11f1a56dcd5 100644 --- a/src/SecExp/secInit.tw +++ b/src/SecExp/secInit.tw @@ -45,7 +45,11 @@ <<set $enemyLosses = 0>> <<set $battleTurns = 0>> <<set $bribeCost = 0>> - +<<set $tacticsSuccessful == 0>> +<<set $auto = 0>> +<<set $leaderWounded = 0>> +<<set $woundType = 0>> /* 0=no wound, 1=mute, 2=blind, 3=amputee, 4=health */ +<<set $gainedCombat == 0>> /* statistics */ <<set $baseBribePerAttacker = 5>> -- GitLab