ModEnc is currently in Maintenance Mode: Changes could occur at any given moment, without advance warning.

RepairPercent

From ModEnc
Jump to navigation Jump to search
Tiberian Dawn The Covert Operations Red Alert Counterstrike Aftermath Tiberian Sun Firestorm HyperPatch Red Alert 2 Yuri's Revenge Ares Generals Zero Hour Tiberium Wars Kane's Wrath
Flag: RepairPercent
File(s): rules(md).ini
Values: Percentages: Either a direct percentage (e.g. "50%"), or a floating point value (e.g. "0.5").
Default: 25%
Applicable to: General


This flag controls how much it costs to repair VehicleTypes docked with a BuildingType with UnitRepair=yes set, and BuildingTypes that are being repaired using a gameplay function (the "wrench" tool).

Notes

The cost to recover RepairStep hitpoints every RepairRate minutes can be calculated by the following formula[1]:

"repair step cost" = ( Cost / ( Strength / RepairStep) ) * RepairPercent

If the result is a floating point value, all decimal places are ignored. Also, if the result is less than 1, it is bumped up to 1.


In Red Alert, if the object being repaired belongs to any of INFANTRYTYPE, UNITTYPE, VESSELTYPE, or AIRCRAFTTYPE, then URepairPercent and URepairStep will replace RepairPercent and RepairStep, respectively, in the calculation of the above formula.

  • In .\CODE\TECHNO.CPP:
6139
6140
6141
6142
6143
6144
6145

6164
6165
6166
6167
6168
6169
6170
int TechnoTypeClass::Repair_Cost(void) const
{
    if (Is_Foot()) {
       return((Raw_Cost()/(MaxStrength/Rule.URepairStep)) * Rule.URepairPercent);
    }
    return((Raw_Cost()/(MaxStrength/Rule.RepairStep)) * Rule.RepairPercent);
}

int TechnoTypeClass::Repair_Step(void) const
{
    if (Is_Foot()) {
        return(Rule.URepairStep);
    }
    return(Rule.RepairStep);
}
  • In .\CODE\TYPE.H:
292
bool Is_Foot(void) const { return(RTTI == RTTI_INFANTRYTYPE || RTTI == RTTI_UNITTYPE || RTTI == RTTI_VESSELTYPE || RTTI == RTTI_AIRCRAFTTYPE); };

References

Footnotes

  1. The division done in this formula is integer division, which means that any decimal places will be knocked off; i.e. 5/2 = 2, not 2.5.

See Also