Remove WorldUtils.AreMutualAllies
This commit is contained in:
committed by
Matthias Mailänder
parent
d6c0926856
commit
e7e50cc101
@@ -87,10 +87,5 @@ namespace OpenRA
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static bool AreMutualAllies(Player a, Player b)
|
||||
{
|
||||
return a.RelationshipWith(b) == PlayerRelationship.Ally && b.RelationshipWith(a) == PlayerRelationship.Ally;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
|
||||
public int Total { get { return AllPoints.Count(); } }
|
||||
int Owned { get { return AllPoints.Count(a => WorldUtils.AreMutualAllies(player, a.Owner)); } }
|
||||
int Owned { get { return AllPoints.Count(a => a.Owner.RelationshipWith(player) == PlayerRelationship.Ally); } }
|
||||
|
||||
public bool Holding { get { return Owned >= info.RatioRequired * Total / 100; } }
|
||||
|
||||
|
||||
@@ -120,12 +120,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return pc != null && pc.Types.Overlaps(Info.CaptorTypes);
|
||||
}
|
||||
|
||||
bool IsClear(Actor self, Player captorOwner)
|
||||
{
|
||||
return actorsInRange
|
||||
.All(a => a.Owner == captorOwner || WorldUtils.AreMutualAllies(a.Owner, captorOwner));
|
||||
}
|
||||
|
||||
void UpdateOwnership()
|
||||
{
|
||||
if (Captured && Info.Permanent)
|
||||
@@ -153,7 +147,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
if (Info.MustBeClear)
|
||||
{
|
||||
var isClear = IsClear(Self, captor.Owner);
|
||||
var isClear = actorsInRange.All(a => captor.Owner.RelationshipWith(a.Owner) == PlayerRelationship.Ally);
|
||||
|
||||
// An enemy unit has wandered into the area, so we've lost control of it.
|
||||
if (Captured && !isClear)
|
||||
|
||||
@@ -13,6 +13,7 @@ using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Primitives;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Widgets;
|
||||
|
||||
namespace OpenRA.Mods.Common.Widgets
|
||||
@@ -48,7 +49,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
{
|
||||
WidgetUtils.DrawRGBA(ChromeProvider.GetImage("strategic", "critical_unowned"), offset + new float2(rb.Left + curX, rb.Top));
|
||||
|
||||
if (world.LocalPlayer != null && WorldUtils.AreMutualAllies(a.Owner, world.LocalPlayer))
|
||||
if (world.LocalPlayer != null && a.Owner.RelationshipWith(world.LocalPlayer) == PlayerRelationship.Ally)
|
||||
WidgetUtils.DrawRGBA(ChromeProvider.GetImage("strategic", "player_owned"), offset + new float2(rb.Left + curX, rb.Top));
|
||||
else if (!a.Owner.NonCombatant)
|
||||
WidgetUtils.DrawRGBA(ChromeProvider.GetImage("strategic", "enemy_owned"), offset + new float2(rb.Left + curX, rb.Top));
|
||||
@@ -63,7 +64,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
if (pendingWinner == null) return;
|
||||
var winnerSvc = pendingWinner.PlayerActor.Trait<StrategicVictoryConditions>();
|
||||
|
||||
var isVictory = pendingWinner == world.LocalPlayer || !WorldUtils.AreMutualAllies(pendingWinner, world.LocalPlayer);
|
||||
var isVictory = pendingWinner.RelationshipWith(world.LocalPlayer) == PlayerRelationship.Ally;
|
||||
var tc = "Strategic {0} in {1}".F(
|
||||
isVictory ? "victory" : "defeat",
|
||||
WidgetUtils.FormatTime(winnerSvc.TicksLeft, world.Timestep));
|
||||
|
||||
Reference in New Issue
Block a user