remove FP from RepairableBuilding

This commit is contained in:
Chris Forbes
2011-02-13 22:12:46 +13:00
parent 0f0facedd1
commit bc32d32d54
2 changed files with 7 additions and 8 deletions

View File

@@ -16,8 +16,8 @@ namespace OpenRA.Mods.RA.Buildings
{
public class RepairableBuildingInfo : ITraitInfo, ITraitPrerequisite<HealthInfo>
{
public readonly float RepairPercent = 0.2f;
public readonly float RepairRate = 0.016f;
public readonly int RepairPercent = 20;
public readonly int RepairInterval = 24;
public readonly int RepairStep = 7;
public object Create(ActorInitializer init) { return new RepairableBuilding(init.self, this); }
}
@@ -53,11 +53,10 @@ 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 costPerHp = (Info.RepairPercent * buildingValue) / Health.MaxHP;
var buildingValue = csv != null ? csv.Value : self.Info.Traits.Get<ValuedInfo>().Cost;
var hpToRepair = Math.Min(Info.RepairStep, Health.MaxHP - Health.HP);
var cost = (int)Math.Ceiling(costPerHp * hpToRepair);
var cost = (hpToRepair * Info.RepairPercent * buildingValue) / (Health.MaxHP * 100);
if (!self.Owner.PlayerActor.Trait<PlayerResources>().TakeCash(cost))
{
remainingTicks = 1;
@@ -71,7 +70,7 @@ namespace OpenRA.Mods.RA.Buildings
isRepairing = false;
return;
}
remainingTicks = (int)(Info.RepairRate * 60 * 25);
remainingTicks = Info.RepairInterval;
}
else
--remainingTicks;

View File

@@ -25,7 +25,7 @@ namespace OpenRA.Mods.RA.Effects
public RepairIndicator(Actor a)
{
this.a = a; anim.PlayRepeating("repair");
framesLeft = (int)(a.Info.Traits.Get<RepairableBuildingInfo>().RepairRate * 25 * 60 / 2);
framesLeft = a.Info.Traits.Get<RepairableBuildingInfo>().RepairInterval / 2;
}
public void Tick( World world )