Improvements to VictoryConditions, and Dead = Chat to all
This commit is contained in:
@@ -16,7 +16,7 @@ namespace OpenRA.Widgets
|
||||
{
|
||||
class ChatDisplayWidget : Widget
|
||||
{
|
||||
const int logLength = 10;
|
||||
const int logLength = 9;
|
||||
public string Notification = "";
|
||||
public bool DrawBackground = true;
|
||||
|
||||
|
||||
@@ -62,26 +62,14 @@ namespace OpenRA.Widgets.Delegates
|
||||
var postgameText = postgameBG.GetWidget<LabelWidget>("TEXT");
|
||||
postgameBG.IsVisible = () =>
|
||||
{
|
||||
var conds = Game.world.Queries.WithTrait<IVictoryConditions>()
|
||||
.Where(c => !c.Actor.Owner.NonCombatant);
|
||||
|
||||
if (Game.world.LocalPlayer != null && conds.Count() > 1)
|
||||
{
|
||||
if (conds.Any(c => c.Actor.Owner == Game.world.LocalPlayer && c.Trait.HasLost)
|
||||
|| conds.All(c => AreMutualAllies(c.Actor.Owner, Game.world.LocalPlayer) || c.Trait.HasLost))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return Game.world.LocalPlayer.WinState != WinState.Undefined;
|
||||
};
|
||||
|
||||
postgameText.GetText = () =>
|
||||
{
|
||||
var lost = Game.world.Queries.WithTrait<IVictoryConditions>()
|
||||
.Where(c => c.Actor.Owner == Game.world.LocalPlayer)
|
||||
.Any(c => c.Trait.HasLost);
|
||||
|
||||
return (lost) ? "YOU ARE DEFEATED" : "YOU ARE VICTORIOUS";
|
||||
var state = Game.world.LocalPlayer.WinState;
|
||||
return (state == WinState.Undefined)? "" :
|
||||
((state == WinState.Lost)? "YOU ARE DEFEATED" : "YOU ARE VICTORIOUS");
|
||||
};
|
||||
}
|
||||
bool AreMutualAllies(Player a, Player b) { return a.Stances[b] == Stance.Ally && b.Stances[a] == Stance.Ally; }
|
||||
|
||||
Reference in New Issue
Block a user