The function to calculate RepairCosts is located in file "game_repair.lua".
Code: Select all
gameplay.repairDiscountFactor = 0.7
function GetRepairCost(unit)
local pointsRepaired= GetRepairPoints(unit)
local PPcost = math.ceil(unit.prototype.costPP * (pointsRepaired) / 100 * gameplay.repairDiscountFactor)
local MPcost = math.ceil(unit.prototype.costMP * (pointsRepaired) / 100)
-- Repairing half supply doubles cost
if unit.supply == 1 then
PPcost = PPcost * 2
MPcost = MPcost * 2
end
return PPcost, MPcost
end
The game internally uses 100 hitpoints (hp) instead of the displayed 10 strength points for unit health. Repairing is done in steps of +10 hp / +20 hp respectively +1 / +2 Strength Points. GetRepairPoints(unit) returns hitpoints in range of 0..20.)
The problem is that MP costs for new units are rather small values between 1 MP and 12 MP so that effectively dividing by 10 (or more) and rounding up (ceil) has a very strong effect.
Code: Select all
Repairing from Strength 9 to 10 :
MP-cost of unit : unit : MP / 10 : Repair-Cost : Ratio (Repair-Cost / (MP/10))
----------------------------------------------------------------------------------------------------------------------------
01 : Armoured Car, Submarine : 0.1 : 1 MP : 10
02 : Railroad Gun, Fighter, Airship, Cruiser : 0.2 : 1 MP : 5
03 : Armoured Train, Bomber : 0.3 : 1 MP : 3.33
04 : Battleship : 0.4 : 1 MP : 2.5
05 : Artillery : 0.5 : 1 MP : 2
06 : Garrison, Cavalry : 0.6 : 1 MP : 1.67
10 : Armour (Tank) : 1.0 : 1 MP : 1
12 : Infantry : 1.2 : 2 MP : 1.67
If you repair at half supply, the Repair-costs (after rounding up) are even doubled, so that repairing an Armoured Car by 1 Strength Point costs 2 MP while you get a new one for 1 MP.
If the high MP repair costs are not intended as a challenge / handicap (to increase game difficulty), an easy solution would be simply to scale MP unit costs and faction MP, MPmax by 10 or to skip the rounding and use MP as float rather than integer. (The displayed MP reserve should then be rounded to integer.)