Merge branch 'master' of git://github.com/chrisforbes/OpenRA

This commit is contained in:
Alli
2010-01-02 16:19:54 +13:00

View File

@@ -9,17 +9,23 @@ namespace OpenRa.Game.Traits.Activities
{ {
public IActivity NextActivity { get; set; } public IActivity NextActivity { get; set; }
bool isCanceled; bool isCanceled;
int remainingTicks = ticksPerPoint; int remainingTicks;
const int ticksPerPoint = 15;
const int hpPerPoint = 8;
public IActivity Tick(Actor self) public IActivity Tick(Actor self)
{ {
if (isCanceled) return NextActivity; if (isCanceled) return NextActivity;
if (--remainingTicks == 0) if (remainingTicks == 0)
{ {
self.InflictDamage(self, -hpPerPoint, Rules.WarheadInfo["Super"]); var costPerHp = (Rules.General.URepairPercent * self.Info.Cost) / self.Info.Strength;
var hpToRepair = Math.Min(Rules.General.URepairStep, self.Info.Strength - self.Health);
var cost = (int)Math.Ceiling(costPerHp * hpToRepair);
if (!self.Owner.TakeCash(cost))
{
remainingTicks = 1;
return this;
}
self.InflictDamage(self, -hpToRepair, Rules.WarheadInfo["Super"]);
if (self.Health == self.Info.Strength) if (self.Health == self.Info.Strength)
return NextActivity; return NextActivity;
@@ -29,8 +35,10 @@ namespace OpenRa.Game.Traits.Activities
if (hostBuilding != null) if (hostBuilding != null)
hostBuilding.traits.Get<RenderBuilding>().PlayCustomAnim(hostBuilding, "active"); hostBuilding.traits.Get<RenderBuilding>().PlayCustomAnim(hostBuilding, "active");
remainingTicks = ticksPerPoint; remainingTicks = (int)(Rules.General.RepairRate * 60 * 25);
} }
else
--remainingTicks;
return this; return this;
} }