Merge branch 'master' of git://github.com/chrisforbes/OpenRA
This commit is contained in:
@@ -9,17 +9,23 @@ namespace OpenRa.Game.Traits.Activities
|
||||
{
|
||||
public IActivity NextActivity { get; set; }
|
||||
bool isCanceled;
|
||||
int remainingTicks = ticksPerPoint;
|
||||
|
||||
const int ticksPerPoint = 15;
|
||||
const int hpPerPoint = 8;
|
||||
int remainingTicks;
|
||||
|
||||
public IActivity Tick(Actor self)
|
||||
{
|
||||
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)
|
||||
return NextActivity;
|
||||
|
||||
@@ -27,10 +33,12 @@ namespace OpenRa.Game.Traits.Activities
|
||||
.FirstOrDefault(a => a.traits.Contains<RenderBuilding>());
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user