Increase Manpower per turn
Posted: Sat Aug 09, 2014 8:48 am
I would like to cause a fixed manpower increase each turn per nation. Would this be possible to mod?
Thanks!
Thanks!
Code: Select all
function DoMPIncome(faction)
local growthrate = 2 -- 0.002 -- Growthrate 5% of MPmax per year => ca 0.2 % per turn (when ca 25 turns = 1 year)
local MPIncome = math.ceil(growthrate * data.factions[faction.id+1].manpowerMax / 1000) -- small factions get +1 MP per turn due to rounding up
faction:ConsumeManpower(-MPIncome)
end
Code: Select all
function ManageFinances(alliance)
if alliance.id ~= 0 then
for faction in alliance.factions do
-- Check if Manpower reserve drops below a certain %
DoMPIncome(faction) --- <--Our new function !!!
CheckManpowerLevel(faction)
PayFactionIncome(faction)
-- Extra income for AI on highest difficulty level
if game.type == Game.TYPE_SINGLE and alliance.id ~= playerAlliance.id then
local percentage = 50
-- start with lower bonuses first 5 turns
if game.turn <= 5 then
percentage = percentage - percentage / game.turn
end
if game:GetAlliancePlayer(alliance).difficulty == 3 then
GiveExtraIncome(faction, percentage)
elseif game:GetAlliancePlayer(alliance).difficulty == 1 then
GiveExtraIncome(faction, -percentage*2/3)
end
end
SpendFactionResearchUpkeep(faction)
SpendFactionUpkeep(faction)
CheckDebtMoraleEffect(faction)
ProduceAmmunition(faction)
RepairConstructions(faction)
end
end
end