repair cost for units is always at least 1 per tick
This commit is contained in:
@@ -37,7 +37,7 @@ namespace OpenRA.Mods.RA.Activities
|
|||||||
var repairsUnits = host.Info.Traits.Get<RepairsUnitsInfo>();
|
var repairsUnits = host.Info.Traits.Get<RepairsUnitsInfo>();
|
||||||
var unitCost = self.Info.Traits.Get<ValuedInfo>().Cost;
|
var unitCost = self.Info.Traits.Get<ValuedInfo>().Cost;
|
||||||
var hpToRepair = repairsUnits.HpPerStep;
|
var hpToRepair = repairsUnits.HpPerStep;
|
||||||
var cost = (hpToRepair * unitCost * repairsUnits.ValuePercentage) / (health.MaxHP * 100);
|
var cost = Math.Max(1, (hpToRepair * unitCost * repairsUnits.ValuePercentage) / (health.MaxHP * 100));
|
||||||
|
|
||||||
if (!self.Owner.PlayerActor.Trait<PlayerResources>().TakeCash(cost))
|
if (!self.Owner.PlayerActor.Trait<PlayerResources>().TakeCash(cost))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user