コード例 #1
0
ファイル: Fight.cs プロジェクト: Zaetic/Symbioz-2.38-RED
 public FightTeamInformations[] GetFightTeamInformations()
 {
     return(new FightTeamInformations[2] {
         RedTeam.GetFightTeamInformations(),
         BlueTeam.GetFightTeamInformations()
     });
 }
コード例 #2
0
 private void ReadyCommandChat(BasePlayer player, string command, string[] args)
 {
     if (GameStarted)
     {
         return;
     }
     if (RedTeam.Contains(player.userID) && !RedReady.Contains(player.userID))
     {
         RedReady.Add(player.userID);
         BasePlayer.activePlayerList.ForEach(x => SendChatMessage(x, CurrentReady, player.displayName));
     }
     else if (BlueTeam.Contains(player.userID) && !BlueReady.Contains(player.userID))
     {
         BlueReady.Add(player.userID);
         BasePlayer.activePlayerList.ForEach(x => SendChatMessage(x, CurrentReady, player.displayName));
     }
     else if (!RedTeam.Contains(player.userID) && !BlueReady.Contains(player.userID))
     {
         SendChatMessage(player, CurrentChoose);
     }
     if (RedReady.Count == TeamSize && BlueReady.Count == TeamSize)
     {
         BeginGame();
     }
 }
コード例 #3
0
 private void OnEntityDeath(BaseCombatEntity entity, HitInfo info)
 {
     if (GameStarted)
     {
         if (info == null || entity == null)
         {
             return;
         }
         if (entity is BaseNpc)
         {
             return;
         }
         BasePlayer victim = entity.ToPlayer();
         if (info?.Initiator?.ToPlayer() == null)
         {
             return;
         }
         BasePlayer killer = info.Initiator.ToPlayer();
         if (victim == null || killer == null)
         {
             return;
         }
         if (BlueTeam.Contains(killer.userID))
         {
             BasePlayer.activePlayerList.ForEach(x => SendChatMessage(x, CurrentKill, String.Format(CurrentBlue, killer.displayName), String.Format(CurrentRed, victim.displayName)));
         }
         else if (RedTeam.Contains(killer.userID))
         {
             BasePlayer.activePlayerList.ForEach(x => SendChatMessage(x, CurrentKill, String.Format(CurrentRed, killer.displayName), String.Format(CurrentBlue, victim.displayName)));
         }
     }
 }
コード例 #4
0
        public object Summary()
        {
            var redTeam = new
            {
                Name         = RedTeam.GetNameOrDefault(),
                FirstPlayer  = RedTeam.FirstPlayer.Name,
                SecondPlayer = RedTeam.SecondPlayer != null ? RedTeam.SecondPlayer.Name : "",
                Color        = Table.SideOneColor.ToString()
            };

            var blueTeam = new
            {
                Name         = BlueTeam.GetNameOrDefault(),
                FirstPlayer  = BlueTeam.FirstPlayer.Name,
                SecondPlayer = BlueTeam.SecondPlayer != null ? BlueTeam.SecondPlayer.Name : "",
                Color        = Table.SideTwoColor.ToString()
            };

            return(new
            {
                Teams = new
                {
                    RedTeam = redTeam,
                    BlueTeam = blueTeam
                },
                Score = new
                {
                    RedGoals = Goals.Count(g => g.Side == TableSide.Red),
                    BlueGoals = Goals.Count(g => g.Side == TableSide.Blue)
                },
                VanityString = _tauntTexts[CurrentTaunt()]
            });
        }
コード例 #5
0
        public void StartFighting()
        {
            ForEach(x => x.Character.PreviousRoleplayMapId = x.Character.Record.MapId);
            ForEach(x => x.UpdateStep(false, PvpArenaStepEnum.ARENA_STEP_STARTING_FIGHT));

            MapRecord map = ArenaMapRecord.GetArenaMap();

            foreach (var member in BlueTeam.GetMembers())
            {
                member.Character.Teleport(map.Id, null, true);
                CheckIntegrity(member);
            }
            foreach (var member in RedTeam.GetMembers())
            {
                member.Character.Teleport(map.Id, null, true);
                CheckIntegrity(member);
            }
            FightArena fight = FightProvider.Instance.CreateFightArena(map);

            foreach (var member in BlueTeam.GetMembers())
            {
                fight.BlueTeam.AddFighter(member.Character.CreateFighter(fight.BlueTeam));
            }

            foreach (var member in RedTeam.GetMembers())
            {
                fight.RedTeam.AddFighter(member.Character.CreateFighter(fight.RedTeam));
            }


            fight.StartPlacement();
            this.Dispose();
        }
コード例 #6
0
ファイル: Fight.cs プロジェクト: Zaetic/Symbioz-2.38-RED
        public List <Fighter> GetAllFightersWithLeavers()
        {
            var fighters = GetAllFighters(false);

            fighters.AddRange(RedTeam.GetLeavers());
            fighters.AddRange(BlueTeam.GetLeavers());
            return(fighters);
        }
コード例 #7
0
ファイル: Fight.cs プロジェクト: Zaetic/Symbioz-2.38-RED
        public List <Fighter> GetAllFighters(bool aliveOnly = true)
        {
            List <Fighter> fighters = new List <Fighter>();

            fighters.AddRange(RedTeam.GetFighters(aliveOnly));
            fighters.AddRange(BlueTeam.GetFighters(aliveOnly));
            return(fighters);
        }
コード例 #8
0
ファイル: Fight.cs プロジェクト: Zaetic/Symbioz-2.38-RED
 public void UpdateTeams()
 {
     if (!Started)
     {
         BlueTeam.Update();
         RedTeam.Update();
     }
 }
コード例 #9
0
 private void OnEntitySpawned(BaseEntity entity, UnityEngine.GameObject gameObject)
 {
     if (entity.ShortPrefabName.Contains("cupboard.tool"))
     {
         BasePlayer player = BasePlayer.FindByID(entity.OwnerID);
         if (player == null)
         {
             return;
         }
         if (!GameStarted)
         {
             entity.KillMessage();
             var itemtogive = ItemManager.CreateByItemID(-97956382, 1);
             if (itemtogive != null)
             {
                 player.inventory.GiveItem(itemtogive);
             }
             SendChatMessage(player, CurrentStartCup);
             return;
         }
         if (RedTeam.Contains(player.userID) && CupBoardRed)
         {
             entity.KillMessage();
             var itemtogive = ItemManager.CreateByItemID(-97956382, 1);
             if (itemtogive != null)
             {
                 player.inventory.GiveItem(itemtogive);
             }
             SendChatMessage(player, CurrentCupLimit);
             return;
         }
         if (BlueTeam.Contains(player.userID) && CupBoardBlue)
         {
             entity.KillMessage();
             var itemtogive = ItemManager.CreateByItemID(-97956382, 1);
             if (itemtogive != null)
             {
                 player.inventory.GiveItem(itemtogive);
             }
             SendChatMessage(player, CurrentCupLimit);
             return;
         }
         if (RedTeam.Contains(player.userID))
         {
             CupBoardRed       = true;
             CupBoardRedString = entity.ToString();
             SendChatMessage(player, CurrentCupPlaced);
             return;
         }
         if (BlueTeam.Contains(player.userID))
         {
             CupBoardBlue       = true;
             CupBoardBlueString = entity.ToString();
             SendChatMessage(player, CurrentCupPlaced);
             return;
         }
     }
 }
コード例 #10
0
ファイル: Fight.cs プロジェクト: Seth-/BehaviorIsManaged
        public void Update(GameFightPlacementPossiblePositionsMessage msg)
        {
            if (msg == null)
            {
                throw new ArgumentException("msg");
            }

            RedTeam.Update(msg);
            BlueTeam.Update(msg);
        }
コード例 #11
0
ファイル: Fight.cs プロジェクト: nightwolf93/Symbioz
        public List<Fighter> GetAllFighters(bool deaths = false)
        {

            List<Fighter> result = new List<Fighter>();
            if (BlueTeam != null && RedTeam != null)
            {
                result.AddRange(BlueTeam.GetFighters(deaths));
                result.AddRange(RedTeam.GetFighters(deaths));
            }
            return result;
        }
コード例 #12
0
 public void ForEach(Action <ArenaMember> action)
 {
     foreach (var member in BlueTeam.GetMembers())
     {
         action(member);
     }
     foreach (var member in RedTeam.GetMembers())
     {
         action(member);
     }
 }
コード例 #13
0
 internal void JoinRed(TSPlayer player)
 {
     if (!allPlayers.Contains(player.Index))
     {
         allPlayers.Add(player.Index);
     }
     RedTeam.RemoveAll(p => p.Index == player.Index);
     BlueTeam.RemoveAll(p => p.Index == player.Index);
     RedTeam.Add(player);
     Main.player[player.Index].team = 1;
     player.SendInfoMessage("You have joined Red team for Class Wars.");
 }
コード例 #14
0
    public void AssignTeam(TankSetup player)
    {
        TeamColor team;

        if (BlueTeam.Count() == RedTeam.Count())
        {
            team = (TeamColor)UnityEngine.Random.Range(1, Enum.GetValues(typeof(TeamColor)).Length);
        }
        else
        {
            team = BlueTeam.Count > RedTeam.Count ? TeamColor.Red : TeamColor.Blue;
        }
        player.m_TeamID = team;
    }
コード例 #15
0
 private void ClearGame()
 {
     PreparationUp      = DefaultPreparationUp;
     GameStarted        = DefaultGameStarted;
     CupBoardRed        = DefaultCupBoardRed;
     CupBoardBlue       = DefaultCupBoardBlue;
     CupBoardRedString  = DefaultCupBoardRedString;
     CupBoardBlueString = DefaultCupBoardBlueString;
     RedTeam.Clear();
     BlueTeam.Clear();
     RedReady.Clear();
     BlueReady.Clear();
     RefreshServerName();
 }
コード例 #16
0
        public override FightCommonInformations GetFightCommonInformations()
        {
            List <FightTeamInformations> teams = new List <FightTeamInformations>();

            teams.Add(BlueTeam.GetFightTeamInformations());
            teams.Add(RedTeam.GetFightTeamInformations());
            List <ushort> positions = new List <ushort>();

            positions.Add((ushort)FightCellId);
            positions.Add((ushort)Map.CloseCell(FightCellId));
            return(new FightCommonInformations(Id, (sbyte)FightType, teams, positions, new List <FightOptionsInformations>()
            {
                BlueTeam.TeamOptions, RedTeam.TeamOptions
            }));
        }
コード例 #17
0
ファイル: Fight.cs プロジェクト: nightwolf93/Symbioz
        public short GetPlacementCell(TeamColorEnum team)
        {
            List<short> usedplacement;

            switch (team)
            {
                case TeamColorEnum.BLUE_TEAM:
                    usedplacement = BlueTeam.GetFighters().ConvertAll<short>(x => x.CellId);
                    return Map.BlueCells.Find(x => !usedplacement.Contains(x));
                case TeamColorEnum.RED_TEAM:
                    usedplacement = RedTeam.GetFighters().ConvertAll<short>(x => x.CellId);
                    return Map.RedCells.Find(x => !usedplacement.Contains(x));
            }
            return 0;
        }
コード例 #18
0
 private void OnPlayerInit(BasePlayer player)
 {
     if (GameStarted && !player.IsAdmin)
     {
         if (!BlueTeam.Contains(player.userID) || !RedTeam.Contains(player.userID))
         {
             player.Kick("Game started. Please connect when the servername is updated.");
         }
     }
     NotifyPlayerConnection(true, player.displayName);
     RefreshServerName();
     if (UnlockedBP)
     {
         UnlockBP(player);
     }
 }
コード例 #19
0
 private void SurrendCommandChat(BasePlayer player, string command, string[] args)
 {
     if (!GameStarted)
     {
         if (RedTeam.Contains(player.userID))
         {
             BasePlayer.activePlayerList.ForEach(x => SendChatMessage(x, CurrentSurrend, CurrentRedUpper, CurrentBlueUpper));
             ClearGame();
         }
         else if (BlueTeam.Contains(player.userID))
         {
             BasePlayer.activePlayerList.ForEach(x => SendChatMessage(x, CurrentSurrend, CurrentBlueUpper, CurrentRedUpper));
             ClearGame();
         }
     }
 }
コード例 #20
0
ファイル: Fight.cs プロジェクト: nightwolf93/Symbioz
        public bool CheckFightEnd()
        {
            if (Ended)
                return true;
            if (BlueTeam.GetFighters().Alives().Count == 0 || RedTeam.GetFighters().Alives().Count == 0)
            {

                if (Started)
                    Synchronizer.Start(EndFight);
                else
                    EndFight();
                Ended = true;
                return true;
            }
            return false;

        }
コード例 #21
0
ファイル: Fight.cs プロジェクト: nightwolf93/Symbioz
        public bool IsPlacementCellFree(TeamColorEnum team)
        {
            List<short> usedplacement;

            switch (team)
            {
                case TeamColorEnum.BLUE_TEAM:
                    {
                        usedplacement = BlueTeam.GetFighters().ConvertAll<short>(x => x.CellId);
                        return Map.BlueCells.FindAll(x => !usedplacement.Contains(x)).Count != 0;
                    }
                case TeamColorEnum.RED_TEAM:
                    usedplacement = RedTeam.GetFighters().ConvertAll<short>(x => x.CellId);
                    return Map.RedCells.FindAll(x => !usedplacement.Contains(x)).Count != 0;
            }
            return false;
        }
コード例 #22
0
 /// <summary> undo's the winnings, if the team had one a game
 /// </summary>
 private void undoCompletion()
 {
     if (State == MatchState.VictorFound)
     {
         if (Winner == RedTeam)
         {
             RedTeam.undoWin();
             BlueTeam.undoLoss();
         }
         else
         {
             BlueTeam.undoWin();
             RedTeam.undoLoss();
         }
         Winner = null;
     }
 }
コード例 #23
0
 private void StartCommandChat(BasePlayer player, string command, string[] args)
 {
     if (!player.IsAdmin)
     {
         SendChatMessage(player, CurrentNoPermission);
         return;
     }
     if (GameStarted)
     {
         SendChatMessage(player, CurrentStarted);
         return;
     }
     if (!RedTeam.Any() && !BlueTeam.Any())
     {
         SendChatMessage(player, CurrentEmptyTeam);
         return;
     }
     BeginGame();
 }
コード例 #24
0
        public override void TryJoin(WorldClient client, int mainfighterid)
        {
            var mainFighter = GetAllFighters().Find(x => x.ContextualId == mainfighterid);

            if (mainFighter != null)
            {
                if (mainFighter.Team.TeamColor == TeamColorEnum.RED_TEAM)
                {
                    return;
                }
            }
            if (CanJoin(client, BlueTeam, mainFighter))
            {
                var newFighter = client.Character.CreateFighter(BlueTeam);
                BlueTeam.AddFighter(newFighter);
                GetAllFighters().ForEach(x => x.ShowFighter(client));
                Map.Instance.OnFighterAdded(Id, BlueTeam.Id, newFighter.GetFightMemberInformations());
            }
        }
コード例 #25
0
 private void JoinBlue(BasePlayer player)
 {
     if (BlueTeam.Count == TeamSize)
     {
         SendChatMessage(player, CurrentTeamFull);
         return;
     }
     if (RedTeam.Contains(player.userID))
     {
         RedTeam.Remove(player.userID);
         RedReady.Remove(player.userID);
         RedParty.RemovePlayer(player.userID);
     }
     if (!BlueTeam.Contains(player.userID))
     {
         BlueTeam.Add(player.userID);
         BlueParty.AddPlayer(player);
     }
     BasePlayer.activePlayerList.ForEach(x => SendChatMessage(x, CurrentNow, player.displayName, CurrentBlueLower));
 }
コード例 #26
0
 private void OnPlayerRespawned(BasePlayer player)
 {
     if (RedTeam.Contains(player.userID))
     {
         var i = ItemManager.CreateByItemID(1751045826, 1, (ulong)RedHoodie);
         if (i != null)
         {
             player.inventory.GiveItem(i, player.inventory.containerWear);
         }
         return;
     }
     if (BlueTeam.Contains(player.userID))
     {
         var i = ItemManager.CreateByItemID(1751045826, 1, (ulong)BlueHoodie);
         if (i != null)
         {
             player.inventory.GiveItem(i, player.inventory.containerWear);
         }
         return;
     }
     return;
 }
コード例 #27
0
ファイル: Fight.cs プロジェクト: nightwolf93/Symbioz
        public TeamColorEnum GetWinner()
        {
            List<CharacterFighter> bluePlayers = BlueTeam.GetCharacterFighters(true);
            if (bluePlayers.Count > 0 && bluePlayers.All(x => x.HasLeft))
                return TeamColorEnum.RED_TEAM;

            List<CharacterFighter> redPlayers = RedTeam.GetCharacterFighters(true);
            if (redPlayers.Count > 0 && redPlayers.All(x => x.HasLeft))
                return TeamColorEnum.BLUE_TEAM;

            if (BlueTeam.GetFighters().Alives().Count == 0)
            {
                return TeamColorEnum.RED_TEAM;
            }
            else if (RedTeam.GetFighters().Alives().Count == 0)
            {
                return TeamColorEnum.BLUE_TEAM;
            }
            Logger.Error("Try to define winner but fight is running...");
            return 0;

        }
コード例 #28
0
 private void JoinRed(BasePlayer player)
 {
     if (RedTeam.Count == TeamSize)
     {
         SendChatMessage(player, CurrentTeamFull);
         return;
     }
     if (BlueTeam.Contains(player.userID))
     {
         BlueTeam.Remove(player.userID);
         BlueReady.Remove(player.userID);
         BlueParty.RemovePlayer(player.userID);
     }
     if (!RedTeam.Contains(player.userID))
     {
         RedTeam.Add(player.userID);
         RedParty.AddPlayer(player);
     }
     foreach (BasePlayer x in BasePlayer.activePlayerList)
     {
         SendChatMessage(x, CurrentNow, player.displayName, CurrentRedLower);
     }
 }
コード例 #29
0
        /// <summary>
        /// Resests the match, reverting any actions taken during the match back to the begining state.
        /// </summary>
        public void resetMatch()
        {
            //sets flag that signal system that object has been modified recently
            recentlyModified = true;

            switch (State)
            {
            case MatchState.ByeRound:
                //Get the winner by default, does not affect their win/loss record
                Winner = (RedTeam == null) ? BlueTeam : RedTeam;
                State  = MatchState.ByeRound;
                break;

            case MatchState.VictorFound:
                //First we must fix the team's records
                if (Winner == RedTeam)
                {
                    RedTeam.undoWin();
                    BlueTeam.undoLoss();
                }
                else
                {
                    BlueTeam.undoWin();
                    RedTeam.undoLoss();
                }
                //Clear the winner
                Winner = null;
                //set the state back to no victor found
                State = MatchState.NoVictor;
                break;

            case MatchState.NoVictor:
            case MatchState.Empty:
                break;
            }
            redrawComponents();
        }
コード例 #30
0
        /// <summary>
        /// Le joueur a t-il le niveau pour rejoindre ce groupe
        /// </summary>
        /// <param name="character"></param>
        /// <returns></returns>
        public bool CanChallenge(Character character)
        {
            if (Empty) // Si le groupe est vide, ... il a forcement le niveau
            {
                return(true);
            }
            double mediumLevel = 1;
            double med         = Extensions.Med(Array.ConvertAll(BlueTeam.GetMembers(), x => x.Character.Level)); // niveau moyen de l'équipe bleue
            double med2        = Extensions.Med(Array.ConvertAll(RedTeam.GetMembers(), x => x.Character.Level));  // niveau moyen de l'équipe rouge

            if (med2 == 0)                                                                                        // si il n'y a aucun membre dans l'équipe rouge
            {
                mediumLevel = med;
            }
            else if (med == 0) // si il n'y a aucun membre dans l'équipe bleue
            {
                mediumLevel = med2;
            }
            else
            {
                mediumLevel = Extensions.Med(new double[] { med, med2 });                                       // on calcule la moyenne de niveau entre les deux groupes
            }
            return(character.Level > mediumLevel - LEVEL_SHIFT && character.Level < mediumLevel + LEVEL_SHIFT); // mediumLevel - shift < x < mediumLevel + shift
        }