Exemplo n.º 1
0
        public void Tick(Actor self)
        {
            if (player.WinState != WinState.Undefined || player.NonCombatant)
            {
                return;
            }

            if (objectiveID < 0)
            {
                objectiveID = mo.Add(player, "Hold all the strategic positions for a specified time!");
            }

            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
                    }
                }
            }
        }
Exemplo n.º 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, "Destroy all opposition!");
            }

            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);
            }
        }