diff --git a/src/SecExp/attackHandler.tw b/src/SecExp/attackHandler.tw index 969309e85a6b6ec0a1bfd4d404a04fcfab30c47a..1b704c89678592bcc429672518e407844d211305 100644 --- a/src/SecExp/attackHandler.tw +++ b/src/SecExp/attackHandler.tw @@ -22,31 +22,43 @@ <</if>> <</for>> -<<if $battleResult == 1>> /* bribery check */ - <<if $showBattleStatistics == 1>>bribery chosen<</if>> - <<if $cash >= $bribeCost>> /* if there's enough cash there's a 10% chance bribery fails. If there isn't there's instead a 50% chance it fails */ - <<if random(1,100) <= 10>> - <<set $battleResult = 0>> - <</if>> +<<if $battleResult == 1 || $battleResult == -1>> /* bribery/surrender check */ + <<if $showBattleStatistics == 1>> + bribery chosen <<else>> - <<if random(1,100) <= 50>> - <<set $battleResult = 0>> - <</if>> + Surrender chosen <</if>> - <<if $showBattleStatistics == 1>> - <<if $battleResult == 0>> - <br>Bribery failed! + <<if $battleResult == 1>> + <<if $cash >= $bribeCost>> /* if there's enough cash there's a 10% chance bribery fails. If there isn't there's instead a 50% chance it fails */ + <<if $attackType == "freedom fighters">> + <<if random(1,100) <= 50>> + <<set $battleResult = 0>> + <</if>> + <<elseif random(1,100) <= 10>> + <<set $battleResult = 0>> + <</if>> <<else>> - <br>Bribery Successful! + <<if random(1,100) <= 50>> + <<set $battleResult = 0>> + <</if>> <</if>> - <br><br> - <<link "proceed">> + <<if $showBattleStatistics == 1>> + <<if $battleResult == 0>> + <br>Bribery failed! + <<else>> + <br>Bribery Successful! + <</if>> + <br><br> + <<link "proceed">> + <<goto "attackReport">> + <</link>> + <<else>> <<goto "attackReport">> - <</link>> + <</if>> <<else>> <<goto "attackReport">> <</if>> - + <<else>> /*Init*/ diff --git a/src/SecExp/attackReport.tw b/src/SecExp/attackReport.tw index d73903db7fef444cc81df628d5bff7dee11dc247..a76f5f7263205ebf9f404cde652bd0d2bae5cae6 100644 --- a/src/SecExp/attackReport.tw +++ b/src/SecExp/attackReport.tw @@ -131,7 +131,7 @@ <<if $attackType == "raiders">> Today, the _day of _month _year, our arcology was attacked by a band of wild raiders, $attackTroops men strong. - <<if $battleResult != 1 || $battleResult != 0 || $battleResult != -1>> + <<if $battleResult != 1 && $battleResult != 0 && $battleResult != -1>> Our defense forces, $troopCount strong, clashed with them <<if $battleTerrain == "urban">> in the streets of <<if $terrain == "urban">>the old world city surrounding the arcology<<else>>of the free city<</if>>, @@ -149,9 +149,9 @@ in the wastelands outside the free city territory, <</if>> <<if $enemyLosses != $attackTroops>> - inflicting <<print $enemyLosses>> casualties, while sustaining <<if $losses > 1>> <<print commaNum(Math.trunc($losses))>> casualties <<else>> a casualty<</if>> themselves. + inflicting <<print $enemyLosses>> casualties, while sustaining <<if $losses > 1>> <<print commaNum(Math.trunc($losses))>> casualties <<elseif $losses > 0>> a casualty <<else>> zero <</if>> themselves. <<else>> - completely annihilating their troops, while sustaining <<if $losses > 1>> <<print commaNum(Math.trunc($losses))>> casualties <<else>> a casualty.<</if>>. + completely annihilating their troops, while sustaining <<if $losses > 1>> <<print commaNum(Math.trunc($losses))>> casualties. <<elseif $losses > 0>> a casualty. <<else>> zero casualties.<</if>> <</if>> <</if>> <<if $battleResult == 3>> @@ -197,7 +197,7 @@ <</if>> <<elseif $attackType == "free city">> Today, the _day of _month _year, our arcology was attacked by a contingent of mercenaries hired by a competing free city, $attackTroops men strong. - <<if $battleResult != 1 || $battleResult != 0 || $battleResult != -1>> + <<if $battleResult != 1 && $battleResult != 0 && $battleResult != -1>> Our defense forces, $troopCount strong, clashed with them <<if $battleTerrain == "urban">> in the streets of <<if $terrain == "urban">>the old world city surrounding the arcology<<else>>of the free city<</if>>, @@ -215,9 +215,9 @@ in the wastelands outside the free city territory, <</if>> <<if $enemyLosses != $attackTroops>> - inflicting <<print $enemyLosses>> casualties, while sustaining <<if $losses > 1>> <<print commaNum(Math.trunc($losses))>> casualties <<else>> a casualty<</if>> themselves. + inflicting <<print $enemyLosses>> casualties, while sustaining <<if $losses > 1>> <<print commaNum(Math.trunc($losses))>> casualties <<elseif $losses > 0>> a casualty <<else>> zero <</if>> themselves. <<else>> - completely annihilating their troops, while sustaining <<if $losses > 1>> <<print commaNum(Math.trunc($losses))>> casualties <<else>> a casualty.<</if>>. + completely annihilating their troops, while sustaining <<if $losses > 1>> <<print commaNum(Math.trunc($losses))>> casualties <<elseif $losses > 0>> a casualty .<<else>> zero casualties.<</if>> <</if>> <</if>> <<if $battleResult == 3>> @@ -263,7 +263,7 @@ <</if>> <<elseif $attackType == "freedom fighters">> Today, the _day of _month _year, our arcology was attacked by a group of freedom fighters bent on the destruction of the institution of slavery, $attackTroops men strong. - <<if $battleResult != 1 || $battleResult != 0 || $battleResult != -1>> + <<if $battleResult != 1 && $battleResult != 0 && $battleResult != -1>> Our defense forces, $troopCount strong, clashed with them <<if $battleTerrain == "urban">> in the streets of <<if $terrain == "urban">>the old world city surrounding the arcology<<else>>of the free city<</if>>, @@ -281,9 +281,9 @@ in the wastelands outside the free city territory, <</if>> <<if $enemyLosses != $attackTroops>> - inflicting <<print $enemyLosses>> casualties, while sustaining <<if $losses > 1>> <<print commaNum(Math.trunc($losses))>> casualties <<else>> a casualty<</if>> themselves. + inflicting <<print $enemyLosses>> casualties, while sustaining <<if $losses > 1>> <<print commaNum(Math.trunc($losses))>> casualties <<elseif $losses > 0>> a casualty <<else>> zero <</if>> themselves. <<else>> - completely annihilating their troops, while sustaining <<if $losses > 1>> <<print commaNum(Math.trunc($losses))>> casualties <<else>> a casualty.<</if>>. + completely annihilating their troops, while sustaining <<if $losses > 1>> <<print commaNum(Math.trunc($losses))>> casualties <<elseif $losses > 0>> a casualty. <<else>> zero casualties.<</if>> <</if>> <</if>> <<if $battleResult == 3>> @@ -329,7 +329,7 @@ <</if>> <<elseif $attackType == "old world">> Today, the _day of _month _year, our arcology was attacked by an old world nation boasting a misplaced sense of superiority, $attackTroops men strong. - <<if $battleResult != 1 || $battleResult != 0 || $battleResult != -1>> + <<if $battleResult != 1 && $battleResult != 0 && $battleResult != -1>> Our defense forces, $troopCount strong, clashed with them <<if $battleTerrain == "urban">> in the streets of <<if $terrain == "urban">>the old world city surrounding the arcology<<else>>of the free city<</if>>, @@ -347,9 +347,9 @@ in the wastelands outside the free city territory, <</if>> <<if $enemyLosses != $attackTroops>> - inflicting <<print $enemyLosses>> casualties, while sustaining <<if $losses > 1>> <<print commaNum(Math.trunc($losses))>> casualties <<else>> a casualty<</if>> themselves. + inflicting <<print $enemyLosses>> casualties, while sustaining <<if $losses > 1>> <<print commaNum(Math.trunc($losses))>> casualties <<elseif $losses > 0>> a casualty <<else>> zero <</if>> themselves. <<else>> - completely annihilating their troops, while sustaining <<if $losses > 1>> <<print commaNum(Math.trunc($losses))>> casualties <<else>> a casualty.<</if>>. + completely annihilating their troops, while sustaining <<if $losses > 1>> <<print commaNum(Math.trunc($losses))>> casualties <<<elseif $losses > 0>> a casualty. <<else>> zero casualties.<</if>> <</if>> <</if>> <<if $battleResult == 3>> @@ -677,10 +677,18 @@ <<set $cash -= $bribeCost>> <</if>> <<if !isInt($ACitizens)>> - <br>@@.red;Error: ACitizens is Nan, please report this issue@@ + <<if isNaN($ACitizens)>> + <br>@@.red;Error: ACitizens is NaN, please report this issue@@ + <<else>> + <<set $ACitizens = Math.clamp(Math.trunc($ACitizens),100,$ACitizenLimit)>> + <</if>> <</if>> <<if !isInt($ASlaves)>> - <br>@@.red;Error: ASlaves is Nan, please report this issue@@ + <<if isNaN($ASlaves)>> + <br>@@.red;Error: ASlaves is NaN, please report this issue@@ + <<else>> + <<set $ASlaves = Math.clamp(Math.trunc($ASlaves),1000,$ASlaveLimit)>> + <</if>> <</if>> <br><br>