Example #1
0
        private void CreateNewGateCamp(KillResult kill, StargateLocation location)
        {
            var killResults = new List <KillResult>
            {
                kill
            };
            var gateCampIndex = CalculateGateCampIndex(killResults);
            var gateCamp      = new GateCamp
            {
                GateCampIndex     = gateCampIndex,
                StargateLocations = new List <StargateLocation>

                {
                    location
                },
                Kills = killResults
            };

            _gateCamps.Add(gateCamp);
        }
Example #2
0
    void PlaceStone(int i, PhotonMessageInfo info)
    {
        if (!CanTakeMainAction(info.Sender.NickName))
        {
            return;
        }
        stones[i] = currentPlayerIndex;
        // Find captured stones.
        int x = i % width, y = i / width;
        List <KillResult> killResults = new List <KillResult>();

        foreach (var neighbor in NEIGHBORS)
        {
            KillResult result = CheckGroupKill(x + neighbor.Item1, y + neighbor.Item2, false);
            if (result.kill)
            {
                killResults.Add(result);
            }
        }
        // Check for suicide.
        KillResult selfResult = CheckGroupKill(x, y, true);

        if (selfResult.kill && killResults.Count == 0)
        {
            stones[i] = NO_PLAYER;
            photonView.RPC("Log", info.Sender, "No suicide allowed!");
            return;
        }
        // Perform all captures simultaneously, as they may be depedent upon each other:
        // https://senseis.xmp.net/diagrams/5/91266184e7497955d87b8087fffb1ecf.png
        HashSet <Tuple <int, int> > killCoors = new HashSet <Tuple <int, int> >();

        foreach (KillResult killResult in killResults)
        {
            killCoors.UnionWith(killResult.seen);
            ExecuteKillResult(killResult);
        }
        captures[currentPlayerIndex] += killCoors.Count;
        GameLog.StaticMGG(string.Format("{0} {1}", currentPlayerIndex + 1, Util.GetMGGCoorFromIndex(width, height, i)));
        AdvanceCurrentPlayer();
    }
Example #3
0
        internal static KillResult KillRandom(string args, string author, List <string> usersOnline)
        {
            Random     r = new Random();
            string     target;
            string     killString;
            KillResult message;

            if (string.IsNullOrWhiteSpace(args) || string.Compare(args, "random", StringComparison.OrdinalIgnoreCase) == 0)
            {
                target = usersOnline[r.Next(usersOnline.Count)];
            }
            else
            {
                target = args.Trim();
            }

            try
            {
                killString = GetRandomKillString();
                killString = Useful.FillTags(killString, author.Trim(), target, usersOnline).Replace("  ", " ", StringComparison.OrdinalIgnoreCase);

                if (killString.Contains("<normal>", StringComparison.OrdinalIgnoreCase))
                {
                    killString = killString.Replace("<normal>", string.Empty, StringComparison.OrdinalIgnoreCase);
                    message    = new KillResult(killString, false);
                }
                else
                {
                    message = new KillResult(killString, true);
                }
            }
            catch (IOException ex)
            {
                Console.WriteLine("Error BOT randomkill :" + ex.Message);
                message = new KillResult("Sorry, i can't think of a random kill right now.", false);
            }

            return(message);
        }
Example #4
0
 private static double GetPriority(KillResult curKill)
 {
     return(double.MaxValue - curKill.KillTime.ToOADate());
 }
Example #5
0
        private static double GetSameAttackerCoefficent(IEnumerable <KillResult> kills, KillResult kill)
        {
            var players = kills.SelectMany(
                x => x.Attackers.Where(IsPlayer)
                .Select(a => a.CharacterID))
                          .Distinct()
                          .ToArray();
            var countOnNew = kill.Attackers.Where(IsPlayer)
                             .Count(x => players.Contains(x.CharacterID));

            return(((double)countOnNew) / players.Length);
        }
Example #6
0
 private void HandleNewGateCamp(KillResult kill, StargateLocation location)
 {
     ChangePreviousGatecamps(kill);
     CreateNewGateCamp(kill, location);
 }
Example #7
0
 public KillNode(KillResult kill, StargateLocation stargateLocation)
 {
     Kill             = kill;
     StargateLocation = stargateLocation;
 }