diff --git a/src/SecExp/attackGenerator.tw b/src/SecExp/attackGenerator.tw index 8155bfa310cb8c7a21d38e31453e4d559338dc82..f1281e93c8455985fbe80f49ad4c74b5926b81ce 100644 --- a/src/SecExp/attackGenerator.tw +++ b/src/SecExp/attackGenerator.tw @@ -1,2 +1,362 @@ :: attackGenerator [nobr] +/* attack progress */ +<<set _raider = 0>> +<<if $week < 40>> + <<set _raider += 3>> +<<elseif $week < 60>> + <<set _raider += 5>> +<<elseif $week < 110>> + <<set _raider += 7>> +<<elseif $week < 150>> + <<set _raider +=9>> +<<else>> + <<set _raider +=15>> +<</if>> +<<if $arcologies[0].prosperity <= 50>> + <<set _raider += 3>> +<<elseif $arcologies[0].prosperity <= 70>> + <<set _raider += 5>> +<<elseif $arcologies[0].prosperity <= 90>> + <<set _raider += 7>> +<<elseif $arcologies[0].prosperity <= 110>> + <<set _raider += 9>> +<<elseif $arcologies[0].prosperity <= 130>> + <<set _raider += 15>> +<<else>> + <<set _raider += 18>> +<</if>> + +<<set _oldWorld = 0>> +<<if $arcologies[0].prosperity <= 50>> + <<set _oldWorld += 2>> +<<elseif $arcologies[0].prosperity <= 70>> + <<set _oldWorld += 4>> +<<elseif $arcologies[0].prosperity <= 90>> + <<set _oldWorld += 6>> +<<elseif $arcologies[0].prosperity <= 110>> + <<set _oldWorld += 8>> +<<elseif $arcologies[0].prosperity <= 130>> + <<set _oldWorld += 12>> +<<else>> + <<set _oldWorld += 16>> +<</if>> +<<if $arcologies[0].FSRepopulationFocus != "unset">> + <<set _oldWorld += 8>> +<<elseif $arcologies[0].FSGenderRadicalist != "unset">> + <<set _oldWorld += 8>> +<<elseif $arcologies[0].FSPastoralist != "unset">> + <<set _oldWorld += 8>> +<<elseif $arcologies[0].FSChattelReligionist != "unset">> + <<set _oldWorld += 8>> +<<elseif $arcologies[0].FSRomanRevivalist != "unset" || $arcologies[0].FSEdoRevivalist != "unset" || $arcologies[0].FSArabianRevivalist != "unset" || + $arcologies[0].FSChineseRevivalist != "unset" || $arcologies[0].FSEgyptianRevivalist != "unset" || $arcologies[0].FSAztecRevivalist != "unset">> + <<set _oldWorld += 8>> +<</if>> + +<<set _freeCity = 0>> +<<if $week < 40>> + <<set _freeCity += 2>> +<<elseif $week < 60>> + <<set _freeCity += 4>> +<<elseif $week < 110>> + <<set _freeCity += 6>> +<<elseif $week < 150>> + <<set _freeCity +=8>> +<<else>> + <<set _freeCity +=12>> +<</if>> +<<if $arcologies[0].prosperity <= 50>> + <<set _freeCity += 2>> +<<elseif $arcologies[0].prosperity <= 70>> + <<set _freeCity += 4>> +<<elseif $arcologies[0].prosperity <= 90>> + <<set _freeCity += 6>> +<<elseif $arcologies[0].prosperity <= 110>> + <<set _freeCity += 8>> +<<elseif $arcologies[0].prosperity <= 130>> + <<set _freeCity += 12>> +<<else>> + <<set _freeCity += 16>> +<</if>> + +<<set _free = 0>> + +<<set _slaveRev = 0>> + +<<set _citRev = 0>> + +<<set _mercRev = 0>> + +<<set _arc = 0>> +<<for>> /* cycle through the arcologies and calculate for each */ + +/* Makes one proceed */ +<<set _randThrow =random(0,7)>> +<<if _randThrow == 0>> + <<if $week < 60>> + <<set _raider = Math.clamp(0,10)>> + <<elseif $week < 120>> + <<set _raider = Math.clamp(0,15)>> + <<else>> + <<set _raider = Math.clamp(0,20)>> + <</if>> + <<set $raidersProgress += _raider>> +<<elseif _randThrow == 1>> + <<if $week < 60>> + <<set _freeCity = Math.clamp(0,10)>> + <<elseif $week < 120>> + <<set _freeCity = Math.clamp(0,15)>> + <<else>> + <<set _freeCity = Math.clamp(0,20)>> + <</if>> + <<set $freeCityProgress += _freeCity>> +<<elseif _randThrow == 2>> + <<if $week < 60>> + <<set _oldWorld = Math.clamp(0,10)>> + <<elseif $week < 120>> + <<set _oldWorld = Math.clamp(0,15)>> + <<else>> + <<set _oldWorld = Math.clamp(0,20)>> + <</if>> + <<set $oldWorldProgress += _oldWorld>> +<<elseif _randThrow == 3>> + <<if $week < 60>> + <<set _free = Math.clamp(0,10)>> + <<elseif $week < 120>> + <<set _free = Math.clamp(0,15)>> + <<else>> + <<set _free = Math.clamp(0,20)>> + <</if>> + <<set $freedomProgress += _free>> +<<elseif _randThrow == 4>> + <<if $week < 60>> + <<set _slaveRev = Math.clamp(0,10)>> + <<elseif $week < 120>> + <<set _slaveRev = Math.clamp(0,15)>> + <<else>> + <<set _slaveRev = Math.clamp(0,20)>> + <</if>> + <<set $slaveProgress += _slaveRev>> +<<elseif _randThrow == 5>> + <<if $week < 60>> + <<set _mercRev = Math.clamp(0,10)>> + <<elseif $week < 120>> + <<set _mercRev = Math.clamp(0,15)>> + <<else>> + <<set _mercRev = Math.clamp(0,20)>> + <</if>> + <<set $mercProgress += _mercRev>> +<<elseif _randThrow == 6>> + <<if $week < 60>> + <<set _arc = Math.clamp(0,10)>> + <<elseif $week < 120>> + <<set _arc = Math.clamp(0,15)>> + <<else>> + <<set _arc = Math.clamp(0,20)>> + <</if>> + <<set $arcologyProgress += _arc>> +<<elseif _randThrow == 7>> + <<if $week < 60>> + <<set _citRev = Math.clamp(0,10)>> + <<elseif $week < 120>> + <<set _citRev = Math.clamp(0,15)>> + <<else>> + <<set _citRev = Math.clamp(0,20)>> + <</if>> + <<set $citizenProgress += _citRev>> +<</if>> + +/* if an attack happens */ +<<if $raidersProgress == 100>> + <<set $attackThisWeek = 1>> + <<set $attackType = "raiders">> + <<if $terrain == "urban">> + <<set $battleTerrain = either("outskirts", "urban", "wasteland")>> + <<elseif $terrain == "rural">> + <<set $battleTerrain = either("hills", "outskirts", "rural", "wasteland")>> + <<elseif $terrain == "ravine">> + <<set $battleTerrain = either("mountains", "outskirts", "hills", "wasteland")>> + <<elseif $terrain == "marine">> + <<set $battleTerrain = either("coast", "outskirts", "hills", "wasteland")>> + <<elseif $terrain == "oceanic">> + <<set $battleTerrain = "sea")>> + <</if>> + <<set $attackTroops = random(50,150)>> + <<if $week < 60>> + <<set $attackTroops *= random(1,2)>> + <<else>> + <<set $attackTroops *= random(2,3)>> + <</if>> + <<if $week < 60>> + <<set $attackEquip = random(0,2)>> + <<else>> + <<set $attackEquip = random(1,4)>> + <</if>> + <<set $raidersProgress = 0>> +<<elseif $slaveProgress == 100>> + <<set $attackThisWeek = 1>> + <<set $attackType = "slave">> + <<if $terrain == "urban">> + <<set $battleTerrain = either("outskirts", "urban", "wasteland")>> + <<elseif $terrain == "rural">> + <<set $battleTerrain = either("hills", "outskirts", "rural", "wasteland")>> + <<elseif $terrain == "ravine">> + <<set $battleTerrain = either("mountains", "outskirts", "hills", "wasteland")>> + <<elseif $terrain == "marine">> + <<set $battleTerrain = either("coast", "outskirts", "hills", "wasteland")>> + <<elseif $terrain == "oceanic">> + <<set $battleTerrain = "sea")>> + <</if>> + <<set $attackTroops = random($ASlaves * 0.05, $ASlaves * 0.1)>> + <<if $week < 60>> + <<set $attackTroops *= random(1,2)>> + <<elseif $week < 90>> + <<set $attackTroops *= random(2,3)>> + <<else>> + <<set $attackTroops *= random(3,4)>> + <</if>> + <<if $week < 60>> + <<set $attackEquip = random(0,1)>> + <<else>> + <<set $attackEquip = random(1,2)>> + <</if>> + <<set $slaveProgress = 0>> +<<elseif $citizenProgress == 100>> + <<set $attackThisWeek = 1>> + <<set $attackType = "citizen">> + <<if $terrain == "urban">> + <<set $battleTerrain = either("outskirts", "urban", "wasteland")>> + <<elseif $terrain == "rural">> + <<set $battleTerrain = either("hills", "outskirts", "rural", "wasteland")>> + <<elseif $terrain == "ravine">> + <<set $battleTerrain = either("mountains", "outskirts", "hills", "wasteland")>> + <<elseif $terrain == "marine">> + <<set $battleTerrain = either("coast", "outskirts", "hills", "wasteland")>> + <<elseif $terrain == "oceanic">> + <<set $battleTerrain = "sea")>> + <</if>> + <<set $attackTroops = random($ACitizens * 0.05, $ACitizens * 0.1)>> + <<if $week < 60>> + <<set $attackTroops *= random(1,2)>> + <<else>> + <<set $attackTroops *= random(2,3)>> + <</if>> + <<if $week < 60>> + <<set $attackEquip = random(0,1)>> + <<else>> + <<set $attackEquip = random(1,2)>> + <</if>> + <<set $citizenProgress = 0>> +<<elseif $arcologyProgress == 100>> + <<set $attackThisWeek = 1>> + <<set $attackType = "arcology">> + <<if $terrain == "urban">> + <<set $battleTerrain = either("outskirts", "urban", "wasteland")>> + <<elseif $terrain == "rural">> + <<set $battleTerrain = either("hills", "outskirts", "rural", "wasteland")>> + <<elseif $terrain == "ravine">> + <<set $battleTerrain = either("mountains", "outskirts", "hills", "wasteland")>> + <<elseif $terrain == "marine">> + <<set $battleTerrain = either("coast", "outskirts", "hills", "wasteland")>> + <<elseif $terrain == "oceanic">> + <<set $battleTerrain = "sea")>> + <</if>> + <<set $attackTroops = random(60,180)>> + <<if $week < 60>> + <<set $attackTroops *= random(1,2)>> + <<else>> + <<set $attackTroops *= random(2,3)>> + <</if>> + <<if $week < 60>> + <<set $attackEquip = random(0,1)>> + <<else>> + <<set $attackEquip = random(1,2)>> + <</if>> + <<if $attackingArcology.prosperity > 100>> + <<set $attackEquip++>> + <</if>> + <<set $arcologyProgress = 0>> +<<elseif $freeCityProgress == 100>> + <<set $attackThisWeek = 1>> + <<set $attackType = "free city">> + <<if $terrain == "urban">> + <<set $battleTerrain = either("outskirts", "urban", "wasteland")>> + <<elseif $terrain == "rural">> + <<set $battleTerrain = either("hills", "outskirts", "rural", "wasteland")>> + <<elseif $terrain == "ravine">> + <<set $battleTerrain = either("mountains", "outskirts", "hills", "wasteland")>> + <<elseif $terrain == "marine">> + <<set $battleTerrain = either("coast", "outskirts", "hills", "wasteland")>> + <<elseif $terrain == "oceanic">> + <<set $battleTerrain = "sea")>> + <</if>> + <<set $attackTroops = random(60,180)>> + <<if $week < 60>> + <<set $attackTroops *= random(1,2)>> + <<else>> + <<set $attackTroops *= random(2,3)>> + <</if>> + <<if $week < 60>> + <<set $attackEquip = random(0,1)>> + <<elseif $week < 90>> + <<set $attackEquip = random(1,3)>> + <<else>> + <<set $attackEquip = random(1,4)>> + <</if>> + <<set $freeCityProgress = 0>> +<<elseif $oldWorldProgress == 100>> + <<set $attackThisWeek = 1>> + <<set $attackType = "old world">> + <<if $terrain == "urban">> + <<set $battleTerrain = either("outskirts", "urban", "wasteland")>> + <<elseif $terrain == "rural">> + <<set $battleTerrain = either("hills", "outskirts", "rural", "wasteland")>> + <<elseif $terrain == "ravine">> + <<set $battleTerrain = either("mountains", "outskirts", "hills", "wasteland")>> + <<elseif $terrain == "marine">> + <<set $battleTerrain = either("coast", "outskirts", "hills", "wasteland")>> + <<elseif $terrain == "oceanic">> + <<set $battleTerrain = "sea")>> + <</if>> + <<set $attackTroops = random(100,200)>> + <<if $week < 60>> + <<set $attackTroops *= random(1,2)>> + <<else>> + <<set $attackTroops *= random(2,3)>> + <</if>> + <<if $week < 60>> + <<set $attackEquip = random(0,1)>> + <<elseif $week < 90>> + <<set $attackEquip = random(1,3)>> + <<else>> + <<set $attackEquip = random(1,4)>> + <</if>> + <<set $oldWorldProgress = 0>> +<<elseif $freedomProgress == 100>> + <<set $attackThisWeek = 1>> + <<set $attackType = "freedom fighters">> + <<if $terrain == "urban">> + <<set $battleTerrain = either("outskirts", "urban", "wasteland")>> + <<elseif $terrain == "rural">> + <<set $battleTerrain = either("hills", "outskirts", "rural", "wasteland")>> + <<elseif $terrain == "ravine">> + <<set $battleTerrain = either("mountains", "outskirts", "hills", "wasteland")>> + <<elseif $terrain == "marine">> + <<set $battleTerrain = either("coast", "outskirts", "hills", "wasteland")>> + <<elseif $terrain == "oceanic">> + <<set $battleTerrain = "sea")>> + <</if>> + <<set $attackTroops = random(70,170)>> + <<if $week < 60>> + <<set $attackTroops *= random(1,2)>> + <<elseif>> + <<set $attackTroops *= random(2,3)>> + <</if>> + <<if $week < 60>> + <<set $attackEquip = random(0,1)>> + <<else>> + <<set $attackEquip = random(1,3)>> + <</if>> + <<set $freedomProgress = 0>> +<</if>> \ No newline at end of file diff --git a/src/SecExp/attackHandler.tw b/src/SecExp/attackHandler.tw index 4a6043d1137c5eb4e17968adc5207571a1ec8095..9099b7dd1e7fe16e50bf6df645f26977a79a4762 100644 --- a/src/SecExp/attackHandler.tw +++ b/src/SecExp/attackHandler.tw @@ -80,13 +80,11 @@ The ominous message dominates the screens of your office. <<print $assistantName <hr> It seems your troops and your adversary will fight <<if $battleTerrain == "urban">> - in <strong>the streets of the arcology.</strong> + 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 == "sea">> - in <strong>the sea</strong> surrounding the city. <<elseif $battleTerrain == "coast">> along <strong>the coast</strong> just outside the free city. <<elseif $battleterrain == "outskirts">> diff --git a/src/SecExp/secInit.tw b/src/SecExp/secInit.tw index 3b53e34d4d6e6d000a299a41c1ee8310d6644106..dddbf030ca1d84b681c8515396950a4fff6cf9e2 100644 --- a/src/SecExp/secInit.tw +++ b/src/SecExp/secInit.tw @@ -10,6 +10,7 @@ <<set $raidersProgress = 0>> <<set $slaveProgress = 0>> <<set $citizenProgress = 0>> +<<set $mercProgress = 0>> <<set $arcologyProgress = 0>> <<set $freeCityProgress = 0>> <<set $oldWorldProgress = 0>> @@ -35,7 +36,6 @@ /* battle relevant variables */ <<set $attackTroops = 0>> <<set $attackEquip = 0>> -<<set $attackTraining = 0>> <<set $deployableUnits = 0>> <<set $deployedUnits = 0>> <<set $battleTerrain = "none">>