Remove Order.TargetLocation from support powers.

This commit is contained in:
Paul Chote
2018-12-01 11:40:32 +00:00
parent 7d72aae5ba
commit 6dcd23e874
12 changed files with 26 additions and 25 deletions

View File

@@ -50,7 +50,8 @@ namespace OpenRA.Mods.Cnc.Traits
class ChronoshiftPower : SupportPower
{
public ChronoshiftPower(Actor self, ChronoshiftPowerInfo info) : base(self, info) { }
public ChronoshiftPower(Actor self, ChronoshiftPowerInfo info)
: base(self, info) { }
public override void SelectTarget(Actor self, string order, SupportPowerManager manager)
{
@@ -62,6 +63,8 @@ namespace OpenRA.Mods.Cnc.Traits
{
base.Activate(self, order, manager);
var info = (ChronoshiftPowerInfo)Info;
var targetDelta = self.World.Map.CellContaining(order.Target.CenterPosition) - order.ExtraLocation;
foreach (var target in UnitsInRange(order.ExtraLocation))
{
var cs = target.TraitsImplementing<Chronoshiftable>()
@@ -70,11 +73,10 @@ namespace OpenRA.Mods.Cnc.Traits
if (cs == null)
continue;
var targetCell = target.Location + (order.TargetLocation - order.ExtraLocation);
var cpi = Info as ChronoshiftPowerInfo;
var targetCell = target.Location + targetDelta;
if (self.Owner.Shroud.IsExplored(targetCell) && cs.CanChronoshiftTo(target, targetCell))
cs.Teleport(target, targetCell, cpi.Duration, cpi.KillCargo, self);
cs.Teleport(target, targetCell, info.Duration, info.KillCargo, self);
}
}