Beispiel #1
0
        public override ThiefInfo[] InitialThiefPos(TileType[,] baseMap)
        {
            ThiefInfo[] pos = new ThiefInfo[4];
            for (int i = 0; i < 4; i++)
            {
                pos[i] = new ThiefInfo();
            }

            pos[0].mapPos = new Vector2(0, 1);
            pos[1].mapPos = new Vector2(0, 2);
            pos[2].mapPos = new Vector2(0, 3);
            pos[3].mapPos = new Vector2(1, 15);

            return(pos);
        }
Beispiel #2
0
        /// <summary>
        /// 도둑의 초기 위치를 설정하여 반환합니다.
        /// </summary>
        /// <param name="baseMap">처음 맵의 상태</param>
        /// <returns>처음 도둑의 위치</returns>
        public override ThiefInfo[] InitialThiefPos(TileType[,] baseMap)
        {
            ThiefInfo[] pos = new ThiefInfo[4];
            for (int i = 0; i < 4; i++)
            {
                pos[i] = new ThiefInfo();
            }

            //-------------------------------
            //
            // 이 부분을 구현해 주시면 됩니다.
            // (Vector2) ThiefInfo.mapPos : 맵 상의 좌표
            //
            //-------------------------------

            return pos;
        }
        private void Play_FightThieves__real()
        {
            JObject user_thieves = JObject.Parse(this.GetGameData(ref this.opts, "arena", "GetThieves", false));

            try { if (Utils.CInt(user_thieves["data"]["Cooldown"])  > 0) return; } catch { }
            try { if (Utils.CInt(user_thieves["data"]["Countdown"]) > 0) return; } catch { }

            List<ThiefInfo> thieves = new List<ThiefInfo>();
            List<string> thief_friend_blacklist = new List<string>();
            try
            {
                thief_friend_blacklist.AddRange(Utils.CondenseSpacing(Utils.GetAppSetting("Thief_IgnoreFrom")).Replace(", ", ",").Replace("\t", "").Split(new char[] { ',' }));
            }
            catch { }

            try
            {
                foreach (var thief in user_thieves["data"]["Thieves"])
                {
                    try
                    {
                        int tuid = Utils.CInt(thief["UserThievesId"].ToString());
                        int level = Utils.CInt(thief["ThievesId"].ToString());
                        int hp = Utils.CInt(thief["HPCurrent"].ToString());
                        int hpmax = Utils.CInt(thief["HPCount"].ToString());
                        bool legendary = Utils.CInt(thief["Type"].ToString()) == 2;
                        string discovered_by = thief["NickName"].ToString().Trim();
                        int flee_seconds_remaining = Utils.CInt(thief["FleeTime"].ToString());

                        bool skip_adding = false;
                        foreach (string blacklisted_friend in thief_friend_blacklist)
                        {
                            if ((TextComparison.IsExactMatch(blacklisted_friend, discovered_by)) || (discovered_by.Trim().ToLower() == blacklisted_friend.Trim().ToLower()))
                            {
                                skip_adding = true;
                                break;
                            }
                        }

                        if (flee_seconds_remaining < 1)
                            skip_adding = true;

                        if (hp < 1)
                            skip_adding = true;

                        if (!skip_adding)
                        {
                            ThiefInfo ti = new ThiefInfo();

                            ti.tuid = tuid;
                            ti.level = level;
                            ti.remaining_hp = hp;
                            ti.legendary = legendary;
                            ti.remaining_time = flee_seconds_remaining;

                            thieves.Add(ti);
                        }
                    }
                    catch { }
                }
            }
            catch { }

            try
            {
                thieves.Sort((thief1, thief2) =>
                {
                    //Comparer<string>.Default.Compare(combo1, combo2));

                    // legendary over non-legendary
                    if (thief1.legendary != thief2.legendary)
                        return thief1.legendary.CompareTo(thief2.legendary);

                    // high level over low level
                    if (thief1.level != thief2.level)
                        return thief2.level.CompareTo(thief1.level);

                    // low HP over high HP
                    if (thief1.remaining_hp != thief2.remaining_hp)
                        return thief1.remaining_hp.CompareTo(thief2.remaining_hp);

                    // low remaining time over high remaining time
                    return thief1.remaining_time.CompareTo(thief2.remaining_time);
                });
            }
            catch { }

            if (thieves.Count > 0)
            {
                Utils.LoggerNotifications("<color=#a07000>Looking for a thief to fight...</color>");

                int thief_deck_to_use = Utils.CInt(this.DeckToUseForThief());

                try
                {
                    if (thief_deck_to_use > 0)
                    {
                        this.GetGameData("card", "SetDefalutGroup", "GroupId=" + thief_deck_to_use.ToString(), false); // switch to thief deck
                        Utils.LoggerNotifications("<color=#a07000>Switched to thief deck</color>");
                    }
                    else if (Utils.CInt(this.DefaultDeck) > 0)
                    {
                        this.GetGameData(ref this.opts, "card", "SetDefalutGroup", "GroupId=" + this.DefaultDeck, false); // switch to primary deck
                        Utils.LoggerNotifications("<color=#a07000>Switched to default deck to fight thieves</color>");
                    }
                }
                catch { }

                //bool fought_a_thief = false;

                //for (int i = 1; i <= 2; i++)
                {
                    //if (fought_a_thief)
                    //    break;

                    //foreach (var thief in user_thieves["data"]["Thieves"])
                    {
                        //if (fought_a_thief)
                        //    break;

                        //int tuid = Utils.CInt(thief["UserThievesId"].ToString());
                        //int level = Utils.CInt(thief["ThievesId"].ToString());
                        //int hp = Utils.CInt(thief["HPCurrent"].ToString());
                        //int hpmax = Utils.CInt(thief["HPCount"].ToString());
                        //bool legendary = Utils.CInt(thief["Type"].ToString()) == 2;
                        //string discovered_by = thief["NickName"].ToString().Trim();
                        //int flee_seconds_remaining = Utils.CInt(thief["FleeTime"].ToString());

                        int tuid = thieves[0].tuid;
                        int level = thieves[0].level;
                        int hp = thieves[0].remaining_hp;
                        bool legendary = thieves[0].legendary;
                        int flee_seconds_remaining = thieves[0].remaining_time;

                        int flee_minutes = flee_seconds_remaining / 60;
                        int flee_seconds = flee_seconds_remaining % 60;

                        if ((flee_seconds_remaining > 0) && (hp > 0))
                        {
                            //if (legendary || i == 2)
                            {
                                //Utils.Logger(discovered_by + " has discovered a" + ((legendary) ? " <b>legendary</b>" : "") + " level " + level.ToString() + " thief!  (#" + tuid.ToString() + ")");
                                //Utils.Logger("... HP: " + hp.ToString("#,##0") + "/" + hpmax.ToString("#,##0"));
                                //Utils.Logger("... Time remaining: " + flee_minutes.ToString() + ":" + flee_seconds.ToString("00"));

                                //fought_a_thief = true;

                                JObject thief_fight = JObject.Parse(this.GetGameData(ref this.opts, "arena", "ThievesFight", "UserThievesId=" + tuid.ToString(), false));

                                string reward_gold = "0"; try { reward_gold = Utils.CInt(thief_fight["data"]["ExtData"]["Award"]["Coins"]).ToString(); } catch { }
                                string reward_EXP = "0"; try { reward_EXP = Utils.CInt(thief_fight["data"]["ExtData"]["Award"]["Exp"]).ToString(); } catch { }

                                string reward_card = "";
                                try
                                {
                                    foreach (var this_reward_card in thief_fight["data"]["AwardCards"])
                                        reward_card += ", [Card #" + this_reward_card.ToString() + "]";
                                    reward_card = reward_card.Trim(new char[] { ',', ' ' });
                                }
                                catch { }

                                //Utils.Logger();

                                if (Utils.CInt(reward_gold) > 0) Utils.Logger("<b>Gold earned through thief battle:</b> " + Utils.CInt(reward_gold).ToString("#,##0"));
                                if (Utils.CInt(reward_EXP) > 0) Utils.Logger("<b>Experience earned through thief battle:</b> " + Utils.CInt(reward_EXP).ToString("#,##0"));
                                if (reward_card.Length > 0) Utils.Logger("<b>Card earned through thief battle:</b> " + this.FriendlyReplacerInbound(reward_card));

                                Utils.LoggerNotifications("<color=#ffa000>" + ((legendary) ? "<b>Legendary</b> thief" : "Thief") + " battle " + ((Utils.CInt(thief_fight["data"]["Win"]) == 1) ? "won" : "lost") + ": " + new GameReward(thief_fight).AllAwards + "</color>");

                                Utils.Logger();
                            }
                        }
                    }
                }

                if (Utils.CInt(this.DefaultDeck) > 0 && (thief_deck_to_use > 0))
                {
                    this.GetGameData(ref this.opts, "card", "SetDefalutGroup", "GroupId=" + this.DefaultDeck, false); // switch to primary deck
                    Utils.LoggerNotifications("<color=#a07000>Switched back to default deck</color>");
                }
            }
        }