Army Morale ?

PC/MAC : Commander the Great War is the latest release in the popular Commander series to bring the thrill, excitement and mind-breaking decision making of these difficult times to life.

Moderators: Slitherine Core, The Lordz

Post Reply
operating
Master Sergeant - U-boat
Master Sergeant - U-boat
Posts: 511
Joined: Tue Nov 25, 2008 5:36 pm

Army Morale ?

Post by operating »

My opponent is nearing 1000 over-all Russian casualties (infantry, artillery, aircraft, naval). What can I expect to happen should that -1000 is met or exceeded? Can it be that if his army is in the black MP, to go to yellow MP (including those units on the map)? I'm not sure how to understand this lua file..



function FactionMoraleCalculation(faction)
local maxProduction = 0
for f in game.factions do
for construction in f.constructions do
if construction.type ~= Construction.TYPE_PORT and construction.hex.originalFaction.id == faction.id then
maxProduction = maxProduction + construction.pp
end
end
end

-- +1000 to make it less fluctuating in early turns
local kills = 0
for _, k in pairs(faction.luaData.statsKills) do
kills = kills + k
end
local casualties = 0
for _, c in pairs(faction.luaData.statsCasualties) do
casualties = casualties + c
end
local armyPerformance = (kills + 1000) / (casualties + 1000)

local armyPotentialStrength = math.max(GetUpkeep(faction, true) * armyPerformance, GetIncomePP(faction, true)) * 100 / math.max(1, maxProduction)
-- Never give more than 100 for army strength
armyPotentialStrength = math.min(armyPotentialStrength, 100)

faction.morale = faction.luaData.eventMorale + armyPotentialStrength - gameplay.moraleSurrenderBase

--~ if faction.id == 21 then
--~ print(" ")
--~ print(faction.name .. " maxProduction: " .. faction.luaData.eventMorale .. " armyPotentialStrength: " .. armyPotentialStrength .. " armyPerformance: " .. armyPerformance)
--~ print(faction.name .. " eventMorale: " .. faction.luaData.eventMorale .. " armyPotentialStrength: " .. GetUpkeep(faction, true) * armyPerformance .. " faction.morale: " .. faction.morale .. " GetIncomePP: " .. GetIncomePP(faction))
--~ LogUi(faction.name .. " maxProduction: " .. faction.luaData.eventMorale .. " armyPotentialStrength: " .. armyPotentialStrength .. " armyPerformance: " .. armyPerformance)
print(faction.name .. " Morale: " .. faction.morale)
--~ end

faction.luaData.moraleLevel = GetMoraleLevel(faction.luaData.moraleLevel, faction.morale)
end

function GetMoralePercent(faction)
return math.max(0, math.ceil(faction.morale * 100 / (100 - gameplay.moraleSurrenderBase)))
--return faction.morale + (gameplay.moraleSurrenderBase * faction.morale / (100 - gameplay.moraleSurrenderBase))
end

function CheckForSurrender()

local enemyAlliance = game:GetAllianceById(3 - game.currentAlliance.id)

for faction in enemyAlliance.factions do
if faction.morale <= 0 then

--check if faction still has city
local hasCities = false
for construction in faction.constructions do
hasCities = true
break
end
Robotron
Brigadier-General - Elite Grenadier
Brigadier-General - Elite Grenadier
Posts: 2151
Joined: Tue Nov 23, 2010 3:35 pm

Re: Army Morale ?

Post by Robotron »

Reaching 1000 casualities won't have any "special" consequences for your opponent besides the usual drop in quality of manpower.
Image
Slitherine's Commander the Great War - Director's Cut: POTZBLITZ mod!
FIND IT HERE: http://www.slitherine.com/forum/viewtopic.php?f=218&t=77884&p=662610#p662610
operating
Master Sergeant - U-boat
Master Sergeant - U-boat
Posts: 511
Joined: Tue Nov 25, 2008 5:36 pm

Re: Army Morale ?

Post by operating »

Meaning only new units after the MP drop would be affected, not existing units, correct.?
Robotron
Brigadier-General - Elite Grenadier
Brigadier-General - Elite Grenadier
Posts: 2151
Joined: Tue Nov 23, 2010 3:35 pm

Re: Army Morale ?

Post by Robotron »

Correct.
Image
Slitherine's Commander the Great War - Director's Cut: POTZBLITZ mod!
FIND IT HERE: http://www.slitherine.com/forum/viewtopic.php?f=218&t=77884&p=662610#p662610
operating
Master Sergeant - U-boat
Master Sergeant - U-boat
Posts: 511
Joined: Tue Nov 25, 2008 5:36 pm

Re: Army Morale ?

Post by operating »

Robotron,

Question: This line says "army" performance "local armyPerformance = (kills + 1000) / (casualties + 1000)" . Does that include naval-artillery-aircraft ? Follow up question: If Germany get's over a 1000 combined kills, What does that do? The Russians finally lost over 1000 combined casualties.


To be clear: Germany's MP is already in the black. Does it go blacker?
Robotron
Brigadier-General - Elite Grenadier
Brigadier-General - Elite Grenadier
Posts: 2151
Joined: Tue Nov 23, 2010 3:35 pm

Re: Army Morale ?

Post by Robotron »

All kills from any unit types are combined.

There are no special consequences for causing a lot of kills except favorably affecting the nation's morale.

And since you seem quite fixated on that kills/casualities+1000 part of the script:
the +1000 is only included to keep the result from changing too much during the early game.
Without the +1000 "softener" all nations' morale would crazily rise or fall each turn by 10-50 points.
Image
Slitherine's Commander the Great War - Director's Cut: POTZBLITZ mod!
FIND IT HERE: http://www.slitherine.com/forum/viewtopic.php?f=218&t=77884&p=662610#p662610
operating
Master Sergeant - U-boat
Master Sergeant - U-boat
Posts: 511
Joined: Tue Nov 25, 2008 5:36 pm

Re: Army Morale ?

Post by operating »

Understand, I as CP is in a really tight match turn 37 (started an AAR over at Matrix). The tides of war are starting to ebb away my strength ever so increasingly, where I am trying to analyze the war status of my opponent and where I might have a leg up, my PP leg leaves a lot to be desired, whereas my opponent shows all the evidence of being overpowerful. If the kill/casualty ratio is an advantage to CP then I'll try to exploit it. The bar of a 1000 does not have a bar after that one way or the other, I consider the 1000 bar must be of the highest order for it to be included in the scripts, yes it may be simple to you, but it is of importance to CP (myself) if I know how to work it.

As a debt of gratitude, you deserve a much appreciated Thanks :)
Robotron
Brigadier-General - Elite Grenadier
Brigadier-General - Elite Grenadier
Posts: 2151
Joined: Tue Nov 23, 2010 3:35 pm

Re: Army Morale ?

Post by Robotron »

You won't be able to "exploit" the way national morale gets calculated.

The only ways to go are:
1. to cause as much losses to the enemy as possible while trying to keep your own losses low
2. avoid losing PP by defending your cities
3. building the biggest army you can muster but keeping an eye on the upkeep cost: if you can't pay for your upkeep your morale goes down
Image
Slitherine's Commander the Great War - Director's Cut: POTZBLITZ mod!
FIND IT HERE: http://www.slitherine.com/forum/viewtopic.php?f=218&t=77884&p=662610#p662610
nehi
1st Lieutenant - Grenadier
1st Lieutenant - Grenadier
Posts: 794
Joined: Sat Oct 17, 2015 1:51 pm

Re: Army Morale ?

Post by nehi »

Robotron wrote: Mon Nov 12, 2018 4:09 pm 3. building the biggest army you can muster but keeping an eye on the upkeep cost: if you can't pay for your upkeep your morale goes down
it was reason of my very last defeat and only one as entente, i flooded france with units so hard, that debts broken french neck

next turn surrendered germany too, but it was too late, chain of surrenders let austria and ottomans to rule the world 8)
Post Reply

Return to “Commander - The Great War”