Rename Stance to PlayerRelationship

This commit is contained in:
abcdefg30
2020-09-25 16:22:37 +02:00
committed by Paul Chote
parent 672172d1f1
commit eda9966d27
63 changed files with 111 additions and 111 deletions

View File

@@ -212,7 +212,7 @@ namespace OpenRA.Mods.Common.Traits
if (e.Attacker == null || e.Attacker.Disposed)
return;
if (e.Attacker.Owner.Stances[self.Owner] != Stance.Enemy)
if (e.Attacker.Owner.Stances[self.Owner] != PlayerRelationship.Enemy)
return;
if (!e.Attacker.Info.HasTraitInfo<ITargetableInfo>())

View File

@@ -409,7 +409,7 @@ namespace OpenRA.Mods.Common.Traits
case BuildingType.Defense:
// Build near the closest enemy structure
var closestEnemy = world.ActorsHavingTrait<Building>().Where(a => !a.Disposed && player.Stances[a.Owner] == Stance.Enemy)
var closestEnemy = world.ActorsHavingTrait<Building>().Where(a => !a.Disposed && player.Stances[a.Owner] == PlayerRelationship.Enemy)
.ClosestTo(world.Map.CenterOfCell(baseBuilder.DefenseCenter));
var targetCell = closestEnemy != null ? closestEnemy.Location : baseCenter;

View File

@@ -118,7 +118,7 @@ namespace OpenRA.Mods.Common.Traits
public enum DecisionMetric { Health, Value, None }
[Desc("Against whom should this power be used?", "Allowed keywords: Ally, Neutral, Enemy")]
public readonly Stance Against = Stance.Enemy;
public readonly PlayerRelationship Against = PlayerRelationship.Enemy;
[Desc("What types should the desired targets of this power be?")]
public readonly BitSet<TargetableType> Types = new BitSet<TargetableType>("Air", "Ground", "Water");
@@ -138,7 +138,7 @@ namespace OpenRA.Mods.Common.Traits
}
/// <summary>Evaluates a single actor according to the rules defined in this consideration</summary>
public int GetAttractiveness(Actor a, Stance stance, Player firedBy)
public int GetAttractiveness(Actor a, PlayerRelationship stance, Player firedBy)
{
if (stance != Against)
return 0;
@@ -174,7 +174,7 @@ namespace OpenRA.Mods.Common.Traits
return 0;
}
public int GetAttractiveness(FrozenActor fa, Stance stance, Player firedBy)
public int GetAttractiveness(FrozenActor fa, PlayerRelationship stance, Player firedBy)
{
if (stance != Against)
return 0;

View File

@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Traits
// HACK: We don't want D2k bots to repair all their buildings on placement
// where half their HP is removed via neutral terrain damage.
// TODO: Implement concrete placement for D2k bots and remove this hack.
if (e.Attacker.Owner.Stances[self.Owner] == Stance.Neutral)
if (e.Attacker.Owner.Stances[self.Owner] == PlayerRelationship.Neutral)
return;
var rb = self.TraitOrDefault<RepairableBuilding>();

View File

@@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly bool CheckCaptureTargetsForVisibility = true;
[Desc("Player stances that capturers should attempt to target.")]
public readonly Stance CapturableStances = Stance.Enemy | Stance.Neutral;
public readonly PlayerRelationship CapturableStances = PlayerRelationship.Enemy | PlayerRelationship.Neutral;
public override object Create(ActorInitializer init) { return new CaptureManagerBotModule(init.Self, this); }
}
@@ -65,7 +65,7 @@ namespace OpenRA.Mods.Common.Traits
return;
isEnemyUnit = unit =>
player.Stances[unit.Owner] == Stance.Enemy
player.Stances[unit.Owner] == PlayerRelationship.Enemy
&& !unit.Info.HasTraitInfo<HuskInfo>()
&& unit.Info.HasTraitInfo<ITargetableInfo>();

View File

@@ -152,7 +152,7 @@ namespace OpenRA.Mods.Common.Traits
var path = pathfinder.FindPath(
PathSearch.Search(world, harv.Locomotor, actor, BlockedByActor.Stationary, isValidResource)
.WithCustomCost(loc => world.FindActorsInCircle(world.Map.CenterOfCell(loc), Info.HarvesterEnemyAvoidanceRadius)
.Where(u => !u.IsDead && actor.Owner.Stances[u.Owner] == Stance.Enemy)
.Where(u => !u.IsDead && actor.Owner.Stances[u.Owner] == PlayerRelationship.Enemy)
.Sum(u => Math.Max(WDist.Zero.Length, Info.HarvesterEnemyAvoidanceRadius.Length - (world.Map.CenterOfCell(loc) - u.CenterPosition).Length)))
.FromPoint(actor.Location));

View File

@@ -132,7 +132,7 @@ namespace OpenRA.Mods.Common.Traits
// Use for proactive targeting.
public bool IsPreferredEnemyUnit(Actor a)
{
if (a == null || a.IsDead || Player.Stances[a.Owner] != Stance.Enemy || a.Info.HasTraitInfo<HuskInfo>())
if (a == null || a.IsDead || Player.Stances[a.Owner] != PlayerRelationship.Enemy || a.Info.HasTraitInfo<HuskInfo>())
return false;
var targetTypes = a.GetEnabledTargetTypes();