Beispiel #1
0
 public void TPT4Locust(Player player, int type, string fuse, string cdFuse, Player locuster, Tux locust, ushort locustee)
 {
     if (type == 0)
         GeneralLocust(player, 0, fuse, cdFuse, locuster, locust, locustee);
     else if (type == 1)
     {
         string[] argv = cdFuse.Split(',');
         ushort host = ushort.Parse(argv[1]);
         XI.RaiseGMessage("G0CE," + host + ",2,0," + argv[3] + ";" + type + "," + fuse);
         List<Artiad.Harm> harms = Artiad.Harm.Parse(fuse);
         List<ushort> targets = harms.Where(p => XI.Board.Garden[p.Who].IsTared &&
             XI.Board.Garden[p.Who].HP <= p.N).Select(p => p.Who).Distinct().ToList();
         string result = XI.AsyncInput(host, "#回复,T1(p" + string.Join("p", targets) + ")", "TPT4", "2");
         if (!string.IsNullOrEmpty(result) && !result.StartsWith("/"))
         {
             ushort who = ushort.Parse(result);
             XI.RaiseGMessage("G0TT," + who);
             int value = XI.Board.DiceValue;
             Cure(XI.Board.Garden[host], XI.Board.Garden[who], value);
         }
         bool locusSucc = false;
         if (Artiad.Procedure.LocustChangePendingTux(XI, player.Uid, locuster.Uid, locustee))
         {
             if (player.IsAlive && locuster.IsAlive && locust.Valid(locuster, 2, fuse))
             {
                 XI.InnerGMessage("G0CC," + player.Uid + ",1," + locuster.Uid +
                     "," + locust.Code + "," + locustee + ";2," + fuse, 101);
                 locusSucc = true;
             }
         }
         if (!locusSucc && XI.Board.Garden.Values.Any(p => p.IsAlive && p.HP == 0))
             XI.InnerGMessage("G0ZH,0", 0);
     }
 }
Beispiel #2
0
        public void TPT1Locust(Player player, int type, string fuse, string cdFuse, Player locuster, Tux locust, ushort locustee)
        {
            if (type == 1)
            {
                string[] argv = cdFuse.Split(',');
                ushort host = ushort.Parse(argv[1]);
                XI.RaiseGMessage("G0CE," + host + ",2,0," + argv[3] + ";" + type + "," + fuse);
                List<Artiad.Harm> harms = Artiad.Harm.Parse(fuse);
                Func<Artiad.Harm, bool> yes = (p) => p.N > 1 && XI.Board.Garden[p.Who].IsTared &&
                    !HPEvoMask.TUX_INAVO.IsSet(p.Mask) && !HPEvoMask.DECR_INVAO.IsSet(p.Mask);
                List<ushort> invs = harms.Where(p => yes(p)).Select(p => p.Who).Distinct().ToList();

                string whoStr = XI.AsyncInput(host, "T1(p" + string.Join("p", invs) + ")", "TPT1", "0");
                ushort who = ushort.Parse(whoStr);
                TargetPlayer(player.Uid, who);

                foreach (Artiad.Harm harm in harms)
                {
                    if (yes(harm) && harm.Who == who)
                    {
                        harm.N = 1;
                        if (HPEvoMask.TERMIN_AT.IsSet(harm.Mask))
                            harm.Mask = HPEvoMask.FINAL_MASK.Reset(harm.Mask);
                    }
                }
                bool locusSucc = false;
                if (Artiad.Procedure.LocustChangePendingTux(XI, player.Uid, locuster.Uid, locustee))
                {
                    if (harms.Any(p => yes(p)))
                    {
                        string newFuse = Artiad.Harm.ToMessage(harms);
                        if (locuster.IsAlive && locuster.IsAlive && locust.Valid(locuster, type, newFuse))
                        {
                            XI.InnerGMessage("G0CC," + player.Uid + ",1," + locuster.Uid +
                                "," + locust.Code + "," + locustee + ";" + type + "," + newFuse, 101);
                            locusSucc = true;
                        }
                    }
                }
                if (!locusSucc && harms.Count > 0)
                    XI.InnerGMessage(Artiad.Harm.ToMessage(harms), 85);
            }
        }
Beispiel #3
0
 public void TP02Locust(Player player, int type, string fuse, string cdFuse, Player locuster, Tux locust, ushort locustee)
 {
     if (type == 0)
         GeneralLocust(player, 0, fuse, cdFuse, locuster, locust, locustee);
     else if (type == 1)
     {
         string[] argv = cdFuse.Split(',');
         ushort host = ushort.Parse(argv[1]);
         XI.RaiseGMessage("G0CE," + host + ",2,0," + argv[3] + ";" + type + "," + fuse);
         List<ushort> invs = XI.Board.Garden.Values.Where(p => p.IsTared && p.HP == 0).Select(p => p.Uid).ToList();
         string ic = invs.Count > 0 ? "#HP回复,T1(p" + string.Join("p", invs) + ")" : "/";
         ushort tg = ushort.Parse(XI.AsyncInput(host, ic, "TP01", "0"));
         if (invs.Contains(tg))
         {
             TargetPlayer(player.Uid, tg);
             VI.Cout(0, "{0}对{1}使用「灵葫仙丹」.", XI.DisplayPlayer(host), XI.DisplayPlayer(tg));
             Cure(XI.Board.Garden[host], XI.Board.Garden[tg], 2);
         }
         bool locusSucc = false;
         if (Artiad.Procedure.LocustChangePendingTux(XI, player.Uid, locuster.Uid, locustee))
         {
             string newFuse = "G0ZH,0";
             if (player.IsAlive && locuster.IsAlive && locust.Valid(locuster, 0, newFuse))
             {
                 XI.InnerGMessage("G0CC," + player.Uid + ",1," + locuster.Uid +
                     "," + locust.Code + "," + locustee + ";0," + newFuse, 101);
                 locusSucc = true;
             }
         }
         if (!locusSucc && XI.Board.Garden.Values.Any(p => p.IsAlive && p.HP == 0))
             XI.InnerGMessage("G0ZH,0", 0);
     }
 }
Beispiel #4
0
        public void TP03Locust(Player player, int type, string fuse, string cdFuse, Player locuster, Tux locust, ushort locustee)
        {
            string[] argv = cdFuse.Split(',');
            ushort host = ushort.Parse(argv[1]);
            XI.RaiseGMessage("G0CE," + host + ",2,0," + argv[3] + ";" + type + "," + fuse);
            List<Artiad.Harm> harms = Artiad.Harm.Parse(fuse);
            harms.RemoveAll(p => p.Who == host && !HPEvoMask.TUX_INAVO.IsSet(p.Mask));

            bool locusSucc = false;
            if (Artiad.Procedure.LocustChangePendingTux(XI, player.Uid, locuster.Uid, locustee))
            {
                if (harms.Count > 0)
                {
                    string newFuse = Artiad.Harm.ToMessage(harms);
                    if (locuster.IsAlive && locuster.IsAlive && locust.Valid(locuster, type, newFuse))
                    {
                        XI.InnerGMessage("G0CC," + player.Uid + ",1," + locuster.Uid +
                            "," + locust.Code + "," + locustee + ";" + type + "," + newFuse, 101);
                        locusSucc = true;
                    }
                }
            }
            if (!locusSucc && harms.Count > 0)
                XI.InnerGMessage(Artiad.Harm.ToMessage(harms), 0);
        }
Beispiel #5
0
 // check whether $player's $linkHead is suitable for $tux, then return the pureType
 public static int GetTuxTypeFromLink(string linkFuse, Tux tux,
     Player provider, Player user, Board board, out string pureFuse)
 {
     int idx = linkFuse.IndexOf(":");
     pureFuse = linkFuse.Substring(idx + 1);
     if (tux == null || idx <= 0)
         return -1;
     string[] linkHeads = Algo.Substring(linkFuse, 0, idx).Split('&');
     foreach (string linkHead in linkHeads)
     {
         string[] lh = linkHead.Split(',');
         string pureName = lh[0], pureTypeStr = lh[1], rawOc = lh[2];
         if (!pureTypeStr.Contains("!") && IsFuseMatch(rawOc, pureFuse, board))
         {
             int pureType = int.Parse(pureTypeStr);
             if (tux.Code == pureName && tux.Bribe(provider, pureType, pureFuse)
                         && tux.Valid(user, pureType, pureFuse))
                 return pureType;
         }
     }
     return -1;
 }