DuncanStewart wrote: ↑Fri Jul 24, 2020 1:53 am
Can you explain what this paragraph does
Code: Select all
-- 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 >= 1
and player.alliance.id == 1
and game.type == Game.TYPE_SINGLE then
GiveExtraIncome(faction, percentage)
elseif game:GetAlliancePlayer(alliance).difficulty >= 1 then
GiveExtraIncome(faction, -percentage* 0.25) -- *0.65
end
end
Okay, I'll try to translate:
- This applies to nations in singleplayer games that are not controlled by the player ( = controlled by AI)
- there is a variable called "percentage" with a value of 50.
- if the number of the current game turn is 5 or less then the value of the variable called "percentage" is NOT 50 but is less
- it is lowered in such a way that we divide 50 by the number of the current game turn and subtract the result from 50
- in game turn 1 the value of the variable called "percentage" is: 50 - (50/1) = 0. in game turn 2 the value is 50 - (50/2) = 25, in turn 3 it's 50 - (50/3) = 33,3, in turn 4 it's 37,5 and in turn 5 it's 40
- in singleplayer games where the game's difficulty is set to 1 or higher (that's ALL games in Potzblitz by the way) and the player is playing Entente the current AI CP faction is given extra income by a function called GiveExtraIncome which is also in game_resources.lua
- if the player is playing CP instead then the value of percentage is modified by 0.25 (NOT by 0.65, that value is commented out by -- before it) and sent to the function called GiveExtraIncome which is also in game_resources.lua
- we now must look what that GetExtraIncome function does:
Code: Select all
function GiveExtraIncome(faction, percentage)
if GetIncomePP(faction) > GetUpkeep(faction) then
local bonus = (math.max(0,GetIncomePP(faction) - GetUpkeep(faction))) * percentage / 100
faction:ConsumeProductionPoints(-bonus)
print("AI PP bonus: " .. bonus)
end
if game.turn == 1 then
GiveOneOffBonuses(faction,faction.alliance)
end
end
this translates as follows
- as long as the income of that faction is higher than the faction's upkeep then:
- a variable called "bonus" is defined
- "bonus" will be the higher value of either 0 or the faction's income minus the faction's upkeep multiplied by the "percentage" variable and divided by 100
- so if for example the CP AI faction's income is 100 and the faction's upkeep is 30 and the variable "percentage" is 50, then we will have
100 - 30 = 70
70 * 50 = 3500
3500 / 100 = 35
in short the CP AI faction gets 35PP extra income PER TURN in this example as long as the income and upkeep does not change.
This will however change quite fast, so the extra income will drop quickly to something about 10PP or less per turn once the upkeep from the newly built units rises or the nation loses income from cities getting captured or bombed.
If the AI would be playing Entente the values would be much less. Same example with income 100 and upkeep 30 but the percentage value of 50 is multiplied by 0.25 so it is now 12.5
100 - 30 = 70
70 * 12,5 = 875
875/100 = 8,75PP
Last question, do the (3?) CP transports, the one near Africa and the one near Trondheim not spawn if you play the british blockade card? The baltic sea one seems to happen regardless. Are there more than 3 CP convoys?
Yes, playing the event "Initiate North Sea Blockade" will begin the blockading process, which will take a few turns until the blockade symbol appears.
It goes faster if Entente sinks a few convoys, but the event must still be played before or convoys will continue spawning and CP will have less difficulty with starvation.
There are 4 CP convoys: 1 from Sweden, 1 from Norway and 2 from the south (maybe Chile, Brazil? it's not explained)
The Swedish convoy cannot be blocked, only sunk which will anger Sweden until Sweden joins CP. The Swedish convoy still appears after Sweden has joined CP.
All convoys can give PP for
up to their hit points multiplied by 10. So a convoy with a unit strength of 7 can give up to 70 PP but often much less.
Entente convoys will be tested twice for how many PP they give and the lower value is given.
CP convoys will be tested twice for how many PP they give and the higher value is given.
CP convoys also give up to 3 ammo points to Germany.
This is done for balancing reasons.
If you need more info, feel free to ask.
