Replace usage of the Stances dict by a method call
This commit is contained in:
@@ -48,10 +48,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
// TODO: FrozenActors don't yet have a way of caching conditions, so we can't filter disabled traits
|
||||
// This therefore assumes that all Capturable traits are enabled, which is probably wrong.
|
||||
// Actors with FrozenUnderFog should therefore not disable the Capturable trait.
|
||||
var stance = frozenActor.Owner.Stances[captor.Owner];
|
||||
var stance = captor.Owner.RelationshipWith(frozenActor.Owner);
|
||||
return frozenActor.Info.TraitInfos<CapturableInfo>()
|
||||
.Any(c => c.ValidStances.HasStance(stance) &&
|
||||
captures.Info.CaptureTypes.Overlaps(c.Types));
|
||||
.Any(c => c.ValidStances.HasStance(stance) && captures.Info.CaptureTypes.Overlaps(c.Types));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,7 +128,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public bool CanBeTargetedBy(Actor self, Actor captor, CaptureManager captorManager)
|
||||
{
|
||||
var stance = self.Owner.Stances[captor.Owner];
|
||||
var stance = captor.Owner.RelationshipWith(self.Owner);
|
||||
if (stance.HasStance(PlayerRelationship.Enemy))
|
||||
return captorManager.capturesTypes.Overlaps(enemyCapturableTypes);
|
||||
|
||||
@@ -147,7 +146,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (captures.IsTraitDisabled)
|
||||
return false;
|
||||
|
||||
var stance = self.Owner.Stances[captor.Owner];
|
||||
var stance = captor.Owner.RelationshipWith(self.Owner);
|
||||
if (stance.HasStance(PlayerRelationship.Enemy))
|
||||
return captures.Info.CaptureTypes.Overlaps(enemyCapturableTypes);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user