/// <summary> /// 加入一批牌到弃牌堆 /// </summary> /// <param name="aCards">被弃牌的数组</param> public void AddCards(Card[] aCards) { foreach (Card c in aCards) { CardsHeap2.Enqueue(c); } }
/// <summary> /// 将弃牌堆的牌洗好放入拿牌堆 /// </summary> public void FillCard() { List <Card> lst = new List <Card>(); foreach (Card c in CardsHeap2) { lst.Add(c.GetOriginalCard()); } Card[] arr = lst.ToArray(); for (int i = 0; i < lst.Count; i++) { int a = GetRandom(lst.Count); int b = GetRandom(lst.Count); Card t = arr[a]; arr[a] = arr[b]; arr[b] = t; } lst = arr.ToList(); foreach (Card c in lst) { CardsHeap.Enqueue(c); } CardsHeap2.Clear(); }
/// <summary> /// 判断牌是否在弃牌堆或者发牌堆 /// </summary> /// <param name="aCard">牌对象</param> /// <returns>若存在则返回true</returns> public bool Exist(Card aCard) { if (CardsHeap.Contains(aCard) || CardsHeap2.Contains(aCard)) { return(true); } return(false); }
/// <summary> /// 向弃牌堆添加神卡牌 /// </summary> public void FillShenCards() { AddCard(new Card(109, Card.Suit.HongTao, 9, Card.Effect.Shan)); AddCard(new Card(110, Card.Suit.HongTao, 11, Card.Effect.Shan)); AddCard(new Card(111, Card.Suit.HeiTao, 2, Card.Effect.TengJia)); AddCard(new Card(112, Card.Suit.HongTao, 10, Card.Effect.Sha, Card.ElementType.Fire)); AddCard(new Card(113, Card.Suit.HongTao, 12, Card.Effect.Shan)); AddCard(new Card(114, Card.Suit.FangPian, 13, Card.Effect.Jia1)); AddCard(new Card(115, Card.Suit.FangPian, 3, Card.Effect.Tao)); AddCard(new Card(116, Card.Suit.FangPian, 11, Card.Effect.Shan)); AddCard(new Card(117, Card.Suit.HongTao, 8, Card.Effect.Shan)); AddCard(new Card(118, Card.Suit.HeiTao, 4, Card.Effect.Sha, Card.ElementType.Thunder)); AddCard(new Card(119, Card.Suit.CaoHua, 2, Card.Effect.TengJia)); AddCard(new Card(120, Card.Suit.CaoHua, 1, Card.Effect.BaiYinShiZi)); AddCard(new Card(121, Card.Suit.HongTao, 1, Card.Effect.WuXieKeJi)); AddCard(new Card(122, Card.Suit.FangPian, 8, Card.Effect.Shan)); AddCard(new Card(123, Card.Suit.CaoHua, 5, Card.Effect.Sha, Card.ElementType.Thunder)); AddCard(new Card(124, Card.Suit.FangPian, 6, Card.Effect.Shan)); AddCard(new Card(125, Card.Suit.CaoHua, 8, Card.Effect.Sha, Card.ElementType.Thunder)); AddCard(new Card(126, Card.Suit.HeiTao, 8, Card.Effect.Sha, Card.ElementType.Thunder)); AddCard(new Card(127, Card.Suit.FangPian, 2, Card.Effect.Tao)); AddCard(new Card(128, Card.Suit.CaoHua, 6, Card.Effect.Sha, Card.ElementType.Thunder)); AddCard(new Card(129, Card.Suit.HongTao, 7, Card.Effect.Sha, Card.ElementType.Fire)); AddCard(new Card(130, Card.Suit.HeiTao, 5, Card.Effect.Sha, Card.ElementType.Thunder)); AddCard(new Card(131, Card.Suit.FangPian, 7, Card.Effect.Shan)); AddCard(new Card(132, Card.Suit.HongTao, 6, Card.Effect.Tao)); AddCard(new Card(133, Card.Suit.HeiTao, 13, Card.Effect.WuXieKeJi)); AddCard(new Card(134, Card.Suit.FangPian, 4, Card.Effect.Sha, Card.ElementType.Fire)); AddCard(new Card(135, Card.Suit.HeiTao, 7, Card.Effect.Sha, Card.ElementType.Thunder)); AddCard(new Card(136, Card.Suit.HongTao, 5, Card.Effect.Tao)); AddCard(new Card(137, Card.Suit.HeiTao, 6, Card.Effect.Sha, Card.ElementType.Thunder)); AddCard(new Card(138, Card.Suit.CaoHua, 7, Card.Effect.Sha, Card.ElementType.Thunder)); AddCard(new Card(139, Card.Suit.FangPian, 10, Card.Effect.Shan)); AddCard(new Card(140, Card.Suit.HongTao, 13, Card.Effect.WuXieKeJi)); AddCard(new Card(141, Card.Suit.HongTao, 4, Card.Effect.Sha, Card.ElementType.Fire)); AddCard(new Card(142, Card.Suit.FangPian, 5, Card.Effect.Sha, Card.ElementType.Fire)); AddCard(new Card(143, Card.Suit.HeiTao, 1, Card.Effect.GuDianDao)); AddCard(new Card(144, Card.Suit.FangPian, 1, Card.Effect.ZhuQueYuShan)); AddCard(new Card(145, Card.Suit.CaoHua, 11, Card.Effect.TieSuoLianHuan)); AddCard(new Card(146, Card.Suit.HongTao, 3, Card.Effect.HuoGong)); AddCard(new Card(147, Card.Suit.CaoHua, 3, Card.Effect.Jiu)); AddCard(new Card(148, Card.Suit.HeiTao, 11, Card.Effect.TieSuoLianHuan)); AddCard(new Card(149, Card.Suit.HeiTao, 9, Card.Effect.Jiu)); AddCard(new Card(150, Card.Suit.FangPian, 9, Card.Effect.Jiu)); AddCard(new Card(151, Card.Suit.CaoHua, 10, Card.Effect.TieSuoLianHuan)); AddCard(new Card(152, Card.Suit.CaoHua, 13, Card.Effect.TieSuoLianHuan)); AddCard(new Card(153, Card.Suit.FangPian, 12, Card.Effect.HuoGong)); AddCard(new Card(154, Card.Suit.HeiTao, 12, Card.Effect.HuoGong)); AddCard(new Card(155, Card.Suit.HeiTao, 3, Card.Effect.Jiu)); AddCard(new Card(156, Card.Suit.CaoHua, 12, Card.Effect.TieSuoLianHuan)); AddCard(new Card(157, Card.Suit.CaoHua, 9, Card.Effect.Jiu)); AddCard(new Card(158, Card.Suit.HongTao, 2, Card.Effect.HuoGong)); AddCard(new Card(159, Card.Suit.CaoHua, 4, Card.Effect.BingLiangCunDuan)); AddCard(new Card(160, Card.Suit.HeiTao, 10, Card.Effect.BingLiangCunDuan)); CardsHeap2 = new Queue <Card>(CardsHeap2.Distinct().ToArray()); TotalCards = CardsHeap2.Count; }
/// <summary> /// 向弃牌堆添加ex卡牌 /// </summary> public void FillExCards() { AddCard(new Card(105, Card.Suit.HeiTao, 2, Card.Effect.HanBingJian)); AddCard(new Card(106, Card.Suit.FangPian, 12, Card.Effect.WuXieKeJi)); AddCard(new Card(107, Card.Suit.CaoHua, 2, Card.Effect.RenWangDun)); AddCard(new Card(108, Card.Suit.HongTao, 12, Card.Effect.ShanDian)); CardsHeap2 = new Queue <Card>(CardsHeap2.Distinct().ToArray()); TotalCards = CardsHeap2.Count; }
/// <summary> /// 把指定号码的牌从弃牌堆或者发牌堆中去除 /// </summary> /// <param name="aID">牌的号码</param> /// <returns>成功返回true</returns> public bool PopCard(int aID) { if (CardsHeap.Where(c => c.ID == aID).Count() > 0) { CardsHeap = new Queue <Card>(CardsHeap.Where(c => c.ID != aID)); return(true); } else if (CardsHeap2.Where(c => c.ID == aID).Count() > 0) { CardsHeap2 = new Queue <Card>(CardsHeap2.Where(c => c.ID != aID)); return(true); } else { return(false); } }
/// <summary> /// 向弃牌堆加入原版的卡牌 /// </summary> public void FillOriginCards() { AddCard(new Card(1, Card.Suit.CaoHua, 12, Card.Effect.ZhangBaSheMao)); AddCard(new Card(2, Card.Suit.FangPian, 5, Card.Effect.GuanShiFu)); AddCard(new Card(3, Card.Suit.HeiTao, 5, Card.Effect.QingLongYanYueDao)); AddCard(new Card(4, Card.Suit.HeiTao, 2, Card.Effect.CiXiongShuangGuJian)); AddCard(new Card(5, Card.Suit.HeiTao, 6, Card.Effect.QingGangJian)); AddCard(new Card(6, Card.Suit.FangPian, 12, Card.Effect.FangTianHuaJi)); AddCard(new Card(7, Card.Suit.FangPian, 1, Card.Effect.ZhuGeLianNu)); AddCard(new Card(8, Card.Suit.HongTao, 5, Card.Effect.QiLinGong)); AddCard(new Card(9, Card.Suit.CaoHua, 2, Card.Effect.BaGuaZhen)); AddCard(new Card(10, Card.Suit.HeiTao, 12, Card.Effect.GuoHeChaiQiao)); AddCard(new Card(11, Card.Suit.CaoHua, 1, Card.Effect.JueDou)); AddCard(new Card(12, Card.Suit.CaoHua, 6, Card.Effect.Sha)); AddCard(new Card(13, Card.Suit.HongTao, 3, Card.Effect.Tao)); AddCard(new Card(14, Card.Suit.HongTao, 4, Card.Effect.WuGuFengDeng)); AddCard(new Card(15, Card.Suit.FangPian, 4, Card.Effect.ShunShouQianYang)); AddCard(new Card(16, Card.Suit.CaoHua, 4, Card.Effect.GuoHeChaiQiao)); AddCard(new Card(17, Card.Suit.HeiTao, 4, Card.Effect.GuoHeChaiQiao)); AddCard(new Card(18, Card.Suit.FangPian, 2, Card.Effect.Shan)); AddCard(new Card(19, Card.Suit.HongTao, 8, Card.Effect.Tao)); AddCard(new Card(20, Card.Suit.HeiTao, 3, Card.Effect.ShunShouQianYang)); AddCard(new Card(21, Card.Suit.FangPian, 8, Card.Effect.Sha)); AddCard(new Card(22, Card.Suit.HeiTao, 1, Card.Effect.JueDou)); AddCard(new Card(23, Card.Suit.CaoHua, 13, Card.Effect.JieDaoShaRen)); AddCard(new Card(24, Card.Suit.CaoHua, 7, Card.Effect.Sha)); AddCard(new Card(25, Card.Suit.CaoHua, 13, Card.Effect.WuXieKeJi)); AddCard(new Card(26, Card.Suit.HongTao, 1, Card.Effect.TaoYuanJieYi)); AddCard(new Card(27, Card.Suit.CaoHua, 4, Card.Effect.Sha)); AddCard(new Card(28, Card.Suit.FangPian, 7, Card.Effect.Sha)); AddCard(new Card(29, Card.Suit.HongTao, 9, Card.Effect.Tao)); AddCard(new Card(30, Card.Suit.HongTao, 13, Card.Effect.Jia1)); AddCard(new Card(31, Card.Suit.HeiTao, 13, Card.Effect.NanManRuQin)); AddCard(new Card(32, Card.Suit.CaoHua, 11, Card.Effect.Sha)); AddCard(new Card(33, Card.Suit.HongTao, 1, Card.Effect.WanJianQiFa)); AddCard(new Card(34, Card.Suit.HeiTao, 11, Card.Effect.ShunShouQianYang)); AddCard(new Card(35, Card.Suit.FangPian, 13, Card.Effect.Jian1)); AddCard(new Card(36, Card.Suit.HeiTao, 10, Card.Effect.Sha)); AddCard(new Card(37, Card.Suit.HeiTao, 1, Card.Effect.ShanDian)); AddCard(new Card(38, Card.Suit.HeiTao, 2, Card.Effect.BaGuaZhen)); AddCard(new Card(39, Card.Suit.HeiTao, 7, Card.Effect.NanManRuQin)); AddCard(new Card(40, Card.Suit.FangPian, 13, Card.Effect.Sha)); AddCard(new Card(41, Card.Suit.CaoHua, 8, Card.Effect.Sha)); AddCard(new Card(42, Card.Suit.CaoHua, 3, Card.Effect.Sha)); AddCard(new Card(43, Card.Suit.FangPian, 4, Card.Effect.Shan)); AddCard(new Card(44, Card.Suit.CaoHua, 3, Card.Effect.GuoHeChaiQiao)); AddCard(new Card(45, Card.Suit.FangPian, 2, Card.Effect.Shan)); AddCard(new Card(46, Card.Suit.HongTao, 4, Card.Effect.Tao)); AddCard(new Card(47, Card.Suit.FangPian, 9, Card.Effect.Shan)); AddCard(new Card(48, Card.Suit.HeiTao, 3, Card.Effect.GuoHeChaiQiao)); AddCard(new Card(49, Card.Suit.HongTao, 8, Card.Effect.WuZhongShengYou)); AddCard(new Card(50, Card.Suit.CaoHua, 2, Card.Effect.Sha)); AddCard(new Card(51, Card.Suit.HeiTao, 4, Card.Effect.ShunShouQianYang)); AddCard(new Card(52, Card.Suit.FangPian, 10, Card.Effect.Sha)); AddCard(new Card(53, Card.Suit.HongTao, 13, Card.Effect.Shan)); AddCard(new Card(54, Card.Suit.FangPian, 10, Card.Effect.Shan)); AddCard(new Card(55, Card.Suit.FangPian, 7, Card.Effect.Shan)); AddCard(new Card(56, Card.Suit.HongTao, 10, Card.Effect.Sha)); AddCard(new Card(57, Card.Suit.HongTao, 7, Card.Effect.WuZhongShengYou)); AddCard(new Card(58, Card.Suit.HongTao, 2, Card.Effect.Shan)); AddCard(new Card(59, Card.Suit.HongTao, 7, Card.Effect.Tao)); AddCard(new Card(60, Card.Suit.CaoHua, 8, Card.Effect.Sha)); AddCard(new Card(61, Card.Suit.FangPian, 11, Card.Effect.Shan)); AddCard(new Card(62, Card.Suit.CaoHua, 7, Card.Effect.NanManRuQin)); AddCard(new Card(63, Card.Suit.FangPian, 6, Card.Effect.Sha)); AddCard(new Card(64, Card.Suit.CaoHua, 9, Card.Effect.Sha)); AddCard(new Card(65, Card.Suit.HongTao, 3, Card.Effect.WuGuFengDeng)); AddCard(new Card(66, Card.Suit.FangPian, 6, Card.Effect.Shan)); AddCard(new Card(67, Card.Suit.CaoHua, 6, Card.Effect.LeBuSiShu)); AddCard(new Card(68, Card.Suit.FangPian, 3, Card.Effect.Shan)); AddCard(new Card(69, Card.Suit.CaoHua, 5, Card.Effect.Sha)); AddCard(new Card(70, Card.Suit.HongTao, 6, Card.Effect.LeBuSiShu)); AddCard(new Card(71, Card.Suit.HeiTao, 13, Card.Effect.Jian1)); AddCard(new Card(72, Card.Suit.CaoHua, 1, Card.Effect.ZhuGeLianNu)); AddCard(new Card(73, Card.Suit.HongTao, 6, Card.Effect.Tao)); AddCard(new Card(74, Card.Suit.CaoHua, 5, Card.Effect.Jia1)); AddCard(new Card(75, Card.Suit.HeiTao, 5, Card.Effect.Jia1)); AddCard(new Card(76, Card.Suit.CaoHua, 12, Card.Effect.JieDaoShaRen)); AddCard(new Card(77, Card.Suit.FangPian, 12, Card.Effect.Tao)); AddCard(new Card(78, Card.Suit.CaoHua, 12, Card.Effect.WuXieKeJi)); AddCard(new Card(79, Card.Suit.HeiTao, 10, Card.Effect.Sha)); AddCard(new Card(80, Card.Suit.CaoHua, 10, Card.Effect.Sha)); AddCard(new Card(81, Card.Suit.HeiTao, 9, Card.Effect.Sha)); AddCard(new Card(82, Card.Suit.FangPian, 1, Card.Effect.JueDou)); AddCard(new Card(83, Card.Suit.FangPian, 5, Card.Effect.Shan)); AddCard(new Card(84, Card.Suit.HeiTao, 6, Card.Effect.LeBuSiShu)); AddCard(new Card(85, Card.Suit.HeiTao, 8, Card.Effect.Sha)); AddCard(new Card(86, Card.Suit.FangPian, 8, Card.Effect.Shan)); AddCard(new Card(87, Card.Suit.HongTao, 9, Card.Effect.WuZhongShengYou)); AddCard(new Card(88, Card.Suit.CaoHua, 9, Card.Effect.Sha)); AddCard(new Card(89, Card.Suit.HeiTao, 8, Card.Effect.Sha)); AddCard(new Card(90, Card.Suit.HongTao, 11, Card.Effect.WuZhongShengYou)); AddCard(new Card(91, Card.Suit.HeiTao, 9, Card.Effect.Sha)); AddCard(new Card(92, Card.Suit.FangPian, 11, Card.Effect.Shan)); AddCard(new Card(93, Card.Suit.HeiTao, 11, Card.Effect.WuXieKeJi)); AddCard(new Card(94, Card.Suit.HongTao, 5, Card.Effect.Jian1)); AddCard(new Card(95, Card.Suit.CaoHua, 11, Card.Effect.Sha)); AddCard(new Card(96, Card.Suit.HongTao, 11, Card.Effect.Sha)); AddCard(new Card(97, Card.Suit.FangPian, 9, Card.Effect.Sha)); AddCard(new Card(98, Card.Suit.HongTao, 2, Card.Effect.Shan)); AddCard(new Card(99, Card.Suit.HongTao, 10, Card.Effect.Sha)); AddCard(new Card(100, Card.Suit.CaoHua, 10, Card.Effect.Sha)); AddCard(new Card(101, Card.Suit.FangPian, 3, Card.Effect.ShunShouQianYang)); AddCard(new Card(102, Card.Suit.HeiTao, 7, Card.Effect.Sha)); AddCard(new Card(103, Card.Suit.HongTao, 12, Card.Effect.Tao)); AddCard(new Card(104, Card.Suit.HongTao, 12, Card.Effect.GuoHeChaiQiao)); CardsHeap2 = new Queue <Card>(CardsHeap2.Distinct().ToArray()); TotalCards = CardsHeap2.Count; }
/// <summary> /// 将一张牌加入弃牌堆 /// </summary> /// <param name="aCard">牌对象</param> public void AddCard(Card aCard) { CardsHeap2.Enqueue(aCard.GetOriginalCard()); }