Exemplo n.º 1
0
        private void GeneralLocust(Player player, int type, string fuse, string cdFuse,
            Player locuster, Tux locus, ushort locustee)
        {
            // G0CD,A,T,JP02,17,36;1,G0OH,...
            string[] argv = cdFuse.Split(',');
            string cardName = argv[3];
            if (!Artiad.ContentRule.IsTuxVestige(cardName, type))
                XI.RaiseGMessage("G0CE," + argv[1] + "," + argv[2] + ",0," + cardName +
                    ";" + type + "," + fuse);
            else
                XI.RaiseGMessage("G0CE," + argv[1] + "," + argv[2] + ",1," + cardName +
                    "," + argv[4] + ";" + type + "," + fuse);

            if (Artiad.Procedure.LocustChangePendingTux(XI, player.Uid, locuster.Uid, locustee))
            {
                XI.InnerGMessage("G0CC," + player.Uid + ",1," + locuster.Uid +
                    "," + locus.Code + "," + locustee + ";" + type + "," + fuse, 101);
            }
            XI.InnerGMessage(cdFuse + ";" + type + "," + fuse, 106);
        }
Exemplo n.º 2
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);
     }
 }
Exemplo n.º 3
0
 private bool GeneralEquipmentBribe(Player player, Tux.TuxType tuxType)
 {
     return Artiad.ClothingHelper.IsEquipable(player, tuxType);
 }
Exemplo n.º 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);
        }
Exemplo n.º 5
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);
            }
        }
Exemplo n.º 6
0
 public static bool IsTuxUsableEveryWhere(Tux tux)
 {
     return tux.Type != Tux.TuxType.ZP && !new string[] {
         "TP01", "TP03", "TPT1", "TPT3", "TPH2", "TPH3", "TPH4" }.Contains(tux.Code);
 }
Exemplo n.º 7
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);
     }
 }
Exemplo n.º 8
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;
 }
Exemplo n.º 9
0
 // check whether $player's $linkHead is suitable for $tux, then return the pureType
 public static int GetTuxTypeFromLink(string linkFuse, Tux tux,
     Player player, Board board, out string pureFuse)
 {
     return GetTuxTypeFromLink(linkFuse, tux, player, player, board, out pureFuse);
 }
Exemplo n.º 10
0
 // check whether $player's $linkHead is suitable for $tux, not consider the pureFuse
 public static int GetTuxTypeFromLink(string linkFuse, Tux tux, Player provider, Player user, Board board)
 {
     string pureFuse;
     return GetTuxTypeFromLink(linkFuse, tux, provider, user, board, out pureFuse);
 }
Exemplo n.º 11
0
 public static int GetSubstitude(Player player, Tux.TuxType tuxType,
     bool isSlotAssign, Func<string, string> input)
 {
     if (tuxType == Tux.TuxType.WQ)
         return GetSubstitude(player.Weapon, player.ExEquip, player.ExMask, player.FyMask, 0x1, isSlotAssign, input);
     else if (tuxType == Tux.TuxType.FJ)
         return GetSubstitude(player.Armor, player.ExEquip, player.ExMask, player.FyMask, 0x2, isSlotAssign, input);
     else if (tuxType == Tux.TuxType.XB)
         return GetSubstitude(player.Trove, player.ExEquip, player.ExMask, player.FyMask, 0x4, isSlotAssign, input);
     else return -1;
 }
Exemplo n.º 12
0
 public static bool IsEquipable(Player player, Tux.TuxType tuxType)
 {
     if (!player.AllTuxDisabled)
     {
         if (tuxType == Tux.TuxType.WQ)
             return (player.FyMask & 0x1) == 0;
         else if (tuxType == Tux.TuxType.FJ)
             return (player.FyMask & 0x2) == 0;
         else if (tuxType == Tux.TuxType.XB)
             return (player.FyMask & 0x4) == 0;
     }
     return false;
 }