/// <summary> /// 让玩家从牌堆拿n张牌,该方法会自动将牌放置到武将的手牌中,并且发送takecards消息(n=0方法无作为) /// </summary> /// <param name="aChief">武将对象</param> /// <param name="n">拿牌的数量</param> /// <returns>牌的数组</returns> internal Card[] TakeingCards(ChiefBase aChief, int n) { if (n <= 0) { return new Card[] { } } ; if (GamePlayers[aChief].Dead) { return new Card[] { } } ; Card[] ret = CardsHeap.Pop(n); GamePlayers[aChief].Hands.AddRange(ret); AsynchronousCore.SendPrivateMessageWithOpenMessage(aChief, new Beaver("takecards", aChief.ChiefName, Card.Cards2Beaver("cards", ret)).ToString(), new Beaver("takecards", aChief.ChiefName, n.ToString(), GamePlayers[aChief].Hands.Count.ToString()).ToString(), GamePlayers); //AsynchronousCore.SendMessage( GamePlayers.All.Where(c=>c.Chief != aChief ).ToArray(), // new Beaver("takecards", aChief.ChiefName , n.ToString() , GamePlayers[aChief].Hands.Count.ToString()).ToString(),true); // //new XElement("takecards", // // new XElement("target" , aChief.ChiefName), // // new XElement("takecount" , n.ToString()), // // new XElement("count" , GamePlayers[aChief].Hands.Count.ToString()) // //) , true); //AsynchronousCore.SendMessage(new ChiefBase[] { aChief }, // new Beaver("takecards", aChief.ChiefName, Card.Cards2Beaver("cards", ret)).ToString(), false); // //new XElement("takecards", // // new XElement("target", aChief.ChiefName), // // Card.Cards2XML("cards", ret) // //),false); return(ret); }