Пример #1
0
        public override bool TeamCheckForRoundOver(out Allegiance surviving)
        {
            if (this.Session.CurrentLevel.LivingPlayers == 0)
            {
                surviving = Allegiance.Neutral;
                return(true);
            }
            bool[]        array           = new bool[2];
            bool          gottaBustGhosts = ((MyMatchVariants)(this.Session.MatchSettings.Variants)).GottaBustGhosts;
            List <Entity> players         = this.Session.CurrentLevel[GameTags.Player];

            for (int i = 0; i < players.Count; i++)
            {
                MyPlayer player = (MyPlayer)players[i];
                if (!player.Dead || (gottaBustGhosts && player.spawningGhost))
                {
                    array[(int)player.Allegiance] = true;
                }
            }

            List <Entity> playerCorpses = this.Session.CurrentLevel[GameTags.Corpse];

            for (int i = 0; i < playerCorpses.Count; i++)
            {
                MyPlayerCorpse playerCorpse = (MyPlayerCorpse)playerCorpses[i];
                if (playerCorpse.Revived || (gottaBustGhosts && playerCorpse.spawningGhost))
                {
                    array[(int)playerCorpse.Allegiance] = true;
                }
            }

            if (gottaBustGhosts && players.Count >= 1)
            {
                List <Entity> playerGhosts = this.Session.CurrentLevel[GameTags.PlayerGhost];
                for (int i = 0; i < playerGhosts.Count; i++)
                {
                    PlayerGhost playerGhost = (PlayerGhost)playerGhosts[i];
                    if (playerGhost.State != 3)
                    {                     // Ghost not dead
                        array[(int)playerGhost.Allegiance] = true;
                    }
                }
            }

            if (array[0] == array[1])
            {
                surviving = Allegiance.Neutral;
            }
            else if (array[0])
            {
                surviving = Allegiance.Blue;
            }
            else
            {
                surviving = Allegiance.Red;
            }
            return(!array[0] || !array[1]);
        }
Пример #2
0
        public MyPlayerGhost(PlayerCorpse corpse) : base(corpse)
        {
            ownerCorpse    = (MyPlayerCorpse)corpse;
            characterIndex = ownerCorpse.PlayerIndex;
            archerSounds   = TowerFall.ArcherData.Archers[characterIndex].SFX;
            haloProperties.SaveProperties(halo);

            this.arrowPickupHitbox = new WrapHitbox(22f, 30f, -11f, -16f);
        }
Пример #3
0
        public override void Update()
        {
            base.Update();

            if (((MyMatchVariants)this.session.MatchSettings.Variants).GottaBustGhosts)
            {
                if (this.session.MatchSettings.TeamMode)
                {
                    bool[] allegiances = new bool[2];
                    // Check if there are players from one team and ghosts from another
                    List <Entity> players = this.session.CurrentLevel[GameTags.Player];
                    for (int i = 0; i < players.Count; i++)
                    {
                        MyPlayer player = (MyPlayer)players[i];
                        if (!player.Dead)
                        {
                            allegiances [(int)player.Allegiance] = true;
                        }
                    }
                    List <Entity> playerCorpses = this.session.CurrentLevel[GameTags.Corpse];
                    for (int i = 0; i < playerCorpses.Count; i++)
                    {
                        MyPlayerCorpse playerCorpse = (MyPlayerCorpse)playerCorpses[i];
                        if (playerCorpse.Revived)
                        {
                            allegiances [(int)playerCorpse.Allegiance] = true;
                        }
                    }
                    if (allegiances[0] && allegiances[1] || (!allegiances[0] && !allegiances[1]))
                    {
                        // Either both teams still have players, or both teams have no players
                        return;
                    }
                    else
                    {
                        List <Entity> playerGhosts = this.session.CurrentLevel[GameTags.PlayerGhost];
                        for (int i = 0; i < playerGhosts.Count; i++)
                        {
                            PlayerGhost playerGhost = (PlayerGhost)playerGhosts[i];
                            if (playerGhost.State != 3) // Ghost not dead
                            {
                                allegiances [(int)playerGhost.Allegiance] = true;
                            }
                        }
                        if (allegiances[0] && allegiances[1])
                        {
                            // There are ghosts from the opposing team
                            this.ghostWaitCounter = 90f;
                        }
                    }
                }
            }
        }
Пример #4
0
        public override bool FFACheckForAllButOneDead()
        {
            if (((MyMatchVariants)(this.Session.MatchSettings.Variants)).GottaBustGhosts)
            {
                if (this.Session.CurrentLevel.LivingPlayers == 0)
                {
                    return(true);
                }

                // Round not over if ghost spawning
                List <Entity> players = this.Session.CurrentLevel[GameTags.Player];
                for (int i = 0; i < players.Count; i++)
                {
                    MyPlayer player = (MyPlayer)players[i];
                    if (player.spawningGhost)
                    {
                        return(false);
                    }
                }

                List <Entity> playerCorpses = this.Session.CurrentLevel[GameTags.Corpse];
                for (int i = 0; i < playerCorpses.Count; i++)
                {
                    MyPlayerCorpse playerCorpse = (MyPlayerCorpse)playerCorpses[i];
                    if (playerCorpse.spawningGhost)
                    {
                        return(false);
                    }
                }

                // Round not over if ghosts alive
                List <Entity> playerGhosts     = this.Session.CurrentLevel[GameTags.PlayerGhost];
                int           livingGhostCount = 0;
                for (int i = 0; i < playerGhosts.Count; i++)
                {
                    MyPlayerGhost ghost = (MyPlayerGhost)playerGhosts[i];
                    if (ghost.State != 3)
                    {
                        livingGhostCount += 1;
                    }
                }
                return(livingGhostCount == 0 && this.Session.CurrentLevel.LivingPlayers <= 1);
            }
            else
            {
                return(this.Session.CurrentLevel.LivingPlayers <= 1);
            }
        }
Пример #5
0
        public override bool OtherPlayerCouldWin(int playerIndex)
        {
            if (base.Session.Scores [playerIndex] < base.Session.MatchSettings.GoalScore || base.Session.GetScoreLead(playerIndex) <= 0)
            {
                return(true);
            }
            int num = base.Session.GetHighestScore() - (base.Session.CurrentLevel.LivingPlayers);

            for (int i = 0; i < 8; i++)
            {
                if (TFGame.Players [i] && i != playerIndex)
                {
                    Player player = base.Session.CurrentLevel.GetPlayer(i);
                    if (((MyMatchVariants)base.Session.MatchSettings.Variants).GottaBustGhosts)
                    {
                        if (player == null)
                        {
                            List <Entity> corpses = base.Session.CurrentLevel[GameTags.Corpse];
                            for (int j = 0; j < corpses.Count; j++)
                            {
                                MyPlayerCorpse corpse = (MyPlayerCorpse)corpses[j];
                                if (corpse.PlayerIndex == i && (corpse.hasGhost || corpse.spawningGhost) && base.Session.Scores[i] >= num)
                                {
                                    return(true);
                                }
                            }
                        }
                        if (player != null && (!player.Dead || ((MyPlayer)player).spawningGhost) && base.Session.Scores[i] >= num)
                        {
                            return(true);
                        }
                    }
                    else
                    {
                        if (player != null && !player.Dead && base.Session.Scores[i] >= num)
                        {
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }