MarkFailed() public method

public MarkFailed ( Player player, int objectiveID ) : void
player Player
objectiveID int
return void
コード例 #1
0
        public void Tick(Actor self)
        {
            if (player.WinState != WinState.Undefined || player.NonCombatant)
            {
                return;
            }

            if (objectiveID < 0)
            {
                objectiveID = mo.Add(player, info.Objective, ObjectiveType.Primary, true);
            }

            if (!self.Owner.NonCombatant && self.Owner.HasNoRequiredUnits())
            {
                mo.MarkFailed(self.Owner, objectiveID);
            }

            var others = self.World.Players.Where(p => !p.NonCombatant &&
                                                  !p.IsAlliedWith(self.Owner));

            if (others.All(p => p.WinState == WinState.Lost))
            {
                mo.MarkCompleted(player, objectiveID);
            }

            if (others.Any(p => p.WinState == WinState.Won))
            {
                mo.MarkFailed(player, objectiveID);
            }

            // See if any of the conditions are met to increase the count
            if (Total > 0)
            {
                if (Holding)
                {
                    // Hah! We met ths critical owned condition
                    if (--TicksLeft == 0)
                    {
                        mo.MarkCompleted(player, objectiveID);
                    }
                }
                else if (TicksLeft != 0)
                {
                    if (info.ResetOnHoldLost)
                    {
                        TicksLeft = info.TicksToHold;                         // Reset the time hold
                    }
                }
            }
        }
コード例 #2
0
        public void Tick(Actor self)
        {
            if (self.Owner.WinState != WinState.Undefined || self.Owner.NonCombatant)
            {
                return;
            }

            if (objectiveID < 0)
            {
                objectiveID = mo.Add(self.Owner, info.Objective, ObjectiveType.Primary, true);
            }

            if (!self.Owner.NonCombatant && self.Owner.HasNoRequiredUnits())
            {
                mo.MarkFailed(self.Owner, objectiveID);
            }

            var others = self.World.Players.Where(p => !p.NonCombatant &&
                                                  !p.IsAlliedWith(self.Owner));

            if (!others.Any())
            {
                return;
            }

            if (others.All(p => p.WinState == WinState.Lost))
            {
                mo.MarkCompleted(self.Owner, objectiveID);
            }
        }
コード例 #3
0
        void ITick.Tick(Actor self)
        {
            if (self.Owner.WinState != WinState.Undefined || self.Owner.NonCombatant)
            {
                return;
            }

            if (objectiveID < 0)
            {
                objectiveID = mo.Add(self.Owner, info.Objective, "Primary", inhibitAnnouncement: true);
            }

            if (!self.Owner.NonCombatant && self.Owner.HasNoRequiredUnits(shortGame))
            {
                mo.MarkFailed(self.Owner, objectiveID);
            }

            // Players, NonCombatants, and IsAlliedWith are all fixed once the game starts, so we can cache the result.
            if (otherPlayers == null)
            {
                otherPlayers = self.World.Players.Where(p => !p.NonCombatant && !p.IsAlliedWith(self.Owner)).ToArray();
            }

            if (otherPlayers.Length == 0)
            {
                return;
            }

            // PERF: Avoid LINQ.
            foreach (var otherPlayer in otherPlayers)
            {
                if (otherPlayer.WinState != WinState.Lost)
                {
                    return;
                }
            }

            mo.MarkCompleted(self.Owner, objectiveID);
        }