fix #772 -- GivesBounty uses Actor.GetSellValue
This commit is contained in:
@@ -21,4 +21,18 @@ namespace OpenRA.Mods.RA.Buildings
|
||||
}
|
||||
|
||||
public class CustomSellValue { }
|
||||
|
||||
public static class CustomSellValueExts
|
||||
{
|
||||
public static int GetSellValue( this Actor a )
|
||||
{
|
||||
var csv = a.Info.Traits.GetOrDefault<CustomSellValueInfo>();
|
||||
if (csv != null) return csv.Value;
|
||||
|
||||
var valued = a.Info.Traits.GetOrDefault<ValuedInfo>();
|
||||
if (valued != null) return valued.Cost;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,8 +52,7 @@ namespace OpenRA.Mods.RA.Buildings
|
||||
|
||||
if (remainingTicks == 0)
|
||||
{
|
||||
var csv = self.Info.Traits.GetOrDefault<CustomSellValueInfo>();
|
||||
var buildingValue = csv != null ? csv.Value : self.Info.Traits.Get<ValuedInfo>().Cost;
|
||||
var buildingValue = self.GetSellValue();
|
||||
|
||||
var hpToRepair = Math.Min(Info.RepairStep, Health.MaxHP - Health.HP);
|
||||
var cost = (hpToRepair * Info.RepairPercent * buildingValue) / (Health.MaxHP * 100);
|
||||
|
||||
Reference in New Issue
Block a user