public override void Activate()
 {
     SFX.Play("scoreDing", 0.8f);
     foreach (Profile profile in DuckNetwork.profiles)
     {
         if (this.indexes.Contains((int)profile.networkIndex))
         {
             GameMode.lastWinners.Add(profile);
             PlusOne plusOne = new PlusOne(0.0f, 0.0f, this.win < (byte)4 ? DuckNetwork.profiles[(int)this.win] : profile);
             plusOne.anchor        = (Anchor)(Thing)profile.duck;
             plusOne.anchor.offset = new Vec2(0.0f, -16f);
             plusOne.depth         = new Depth(0.95f);
             Level.Add((Thing)plusOne);
         }
     }
 }
Beispiel #2
0
        protected override List <Profile> AddPoints()
        {
            List <Profile> profileList = new List <Profile>();
            List <Team>    teamList    = new List <Team>();
            List <Team>    source      = new List <Team>();

            foreach (Team team in Teams.all)
            {
                foreach (Profile activeProfile in team.activeProfiles)
                {
                    if (activeProfile.duck != null && !activeProfile.duck.dead)
                    {
                        if (activeProfile.duck.converted != null && activeProfile.duck.converted.profile.team != activeProfile.team)
                        {
                            if (!source.Contains(activeProfile.duck.converted.profile.team))
                            {
                                source.Add(activeProfile.duck.converted.profile.team);
                            }
                            if (!teamList.Contains(activeProfile.duck.profile.team))
                            {
                                teamList.Add(activeProfile.duck.profile.team);
                                break;
                            }
                            break;
                        }
                        if (!source.Contains(team))
                        {
                            source.Add(team);
                            break;
                        }
                        break;
                    }
                }
            }
            if (source.Count <= 1 && source.Count > 0)
            {
                source.AddRange((IEnumerable <Team>)teamList);
                byte       winteam = 4;
                List <int> idxs    = new List <int>();
                GameMode.lastWinners.Clear();
                foreach (Team team in source)
                {
                    foreach (Profile activeProfile in team.activeProfiles)
                    {
                        if (activeProfile.duck != null && !activeProfile.duck.dead)
                        {
                            if (!this._editorTestMode)
                            {
                                if (Teams.active.Count > 1 && Network.isActive && activeProfile.connection == DuckNetwork.localConnection)
                                {
                                    DuckNetwork.GiveXP("Rounds Won", 1, 4, firstCap: 10, secondCap: 20);
                                }
                                activeProfile.stats.lastWon = DateTime.Now;
                                ++activeProfile.stats.matchesWon;
                            }
                            profileList.Add(activeProfile);
                            Profile p = activeProfile;
                            if (activeProfile.duck.converted != null)
                            {
                                p       = activeProfile.duck.converted.profile;
                                winteam = p.networkIndex;
                            }
                            GameMode.lastWinners.Add(activeProfile);
                            PlusOne plusOne = new PlusOne(0.0f, 0.0f, p);
                            plusOne.anchor        = (Anchor)(Thing)activeProfile.duck;
                            plusOne.anchor.offset = new Vec2(0.0f, -16f);
                            idxs.Add((int)activeProfile.duck.netProfileIndex);
                            Level.Add((Thing)plusOne);
                        }
                    }
                }
                if (Network.isActive && Network.isServer)
                {
                    Send.Message((NetMessage) new NMAssignWin(idxs, winteam));
                }
                ++source.First <Team>().score;
            }
            return(profileList);
        }
Beispiel #3
0
        protected override List <Profile> AddPoints()
        {
            List <Profile> profileList = new List <Profile>();
            List <Team>    teamList    = new List <Team>();
            List <Team>    source      = new List <Team>();
            int            num1        = CTF.winner ? 0 : 1;
            int            num2        = 0;

            foreach (Team team in Teams.all)
            {
                if (team.activeProfiles.Count <Profile>() != 0)
                {
                    foreach (Profile activeProfile in team.activeProfiles)
                    {
                        if (activeProfile.duck != null && num2 == num1)
                        {
                            if (activeProfile.duck.converted != null && activeProfile.duck.converted.profile.team != activeProfile.team)
                            {
                                if (!source.Contains(activeProfile.duck.converted.profile.team))
                                {
                                    source.Add(activeProfile.duck.converted.profile.team);
                                }
                                if (!teamList.Contains(activeProfile.duck.profile.team))
                                {
                                    teamList.Add(activeProfile.duck.profile.team);
                                    break;
                                }
                                break;
                            }
                            if (!source.Contains(team))
                            {
                                source.Add(team);
                                break;
                            }
                            break;
                        }
                    }
                    ++num2;
                }
            }
            if (source.Count <= 1 && source.Count > 0)
            {
                source.AddRange((IEnumerable <Team>)teamList);
                List <int> idxs = new List <int>();
                foreach (Team team in source)
                {
                    foreach (Profile activeProfile in team.activeProfiles)
                    {
                        if (activeProfile.duck != null && !activeProfile.duck.dead)
                        {
                            profileList.Add(activeProfile);
                            activeProfile.stats.lastWon = DateTime.Now;
                            ++activeProfile.stats.matchesWon;
                            Profile p = activeProfile;
                            if (activeProfile.duck.converted != null)
                            {
                                p = activeProfile.duck.converted.profile;
                            }
                            PlusOne plusOne = new PlusOne(0.0f, 0.0f, p);
                            plusOne.anchor        = (Anchor)(Thing)activeProfile.duck;
                            plusOne.anchor.offset = new Vec2(0.0f, -16f);
                            idxs.Add((int)activeProfile.duck.netProfileIndex);
                            Level.Add((Thing)plusOne);
                        }
                    }
                }
                if (Network.isActive && Network.isServer)
                {
                    Send.Message((NetMessage) new NMAssignWin(idxs, (byte)4));
                }
                ++source.First <Team>().score;
            }
            return(profileList);
        }