Example #1
0
        // Handle With NPC
        public UEchoCode HandleWithNPCEffect(Player player, NPC npc, string reason)
        {
            string rstage = Board.RoundIN;
            ushort rd = player.Uid;

            bool[] involved = new bool[Board.Garden.Count + 1];
            string[] pris = new string[Board.Garden.Count + 1];
            Fill(involved, false);
            Fill(pris, "");
            List<SKE> purse = new List<SKE>();
            foreach (string npsk in npc.Skills)
                if (nj01.ContainsKey(npsk))
                {
                    // special kind of nfuse = Code + reason + pureFuse
                    string nfuse = npc.Code + ";" + reason;
                    if (nj01[npsk].Valid(player, nfuse))
                    {
                        SKE skt = new SKE(new SkTriple()
                        {
                            Name = npsk,
                            Priorty = 0,
                            Owner = 0,
                            InType = 0,
                            Type = SKTType.NJ,
                            Consume = 0,
                            Lock = false,
                            IsOnce = false,
                        })
                        { Tg = player.Uid, Fuse = nfuse };
                        purse.Add(skt);
                        string ip = nj01[npsk].Input(player, nfuse, "");
                        if (ip != "") ip = "," + ip;
                        pris[rd] += ";" + npsk + ip;
                    }
                }
            UEchoCode r5ed = UEchoCode.END_CANCEL;
            if (pris[rd] != "")
            {
                pris[rd] = pris[rd].Substring(1);
                involved[rd] = true;
                if (reason == "R" + Board.Rounder.Uid + "NP")
                    RaiseGMessage("G1SG,0");
                SendOutU1Message(involved, pris, 0, null);
                while (r5ed != UEchoCode.END_ACTION && r5ed != UEchoCode.END_TERMIN && involved[rd])
                {
                    Base.VW.Msgs msg = WI.RecvInfRecv();
                    r5ed = HandleUMessage(msg.Msg, purse, msg.From, involved, 0);
                    if (r5ed == UEchoCode.RE_REQUEST)
                        ResendU1Message(msg.From, involved, pris, false, 0);
                    else if (r5ed == UEchoCode.END_CANCEL && Board.MonPiles.Count <= 0
                            && msg.From == player.Uid)
                        ResendU1Message(player.Uid, involved, pris, true, 0);
                    // critical, must take action.
                }
            }
            else
                r5ed = UEchoCode.NO_OPTIONS; // cannot take any action, seem as skip
            return r5ed;
        }
Example #2
0
 public static bool IsNPCJoinable(NPC npc, XI xi)
 {
     return npc.Skills.Contains("NJ01") &&
         IsHeroJoinable(xi.LibTuple.HL.InstanceHero(npc.Hero), xi);
 }