//减卡并计分,如果获胜返回true,如果没有返回false,并播放倍数翻倍和提示牌没有的音效 public bool TrueOutCard(ref PeopleList people, List <Card> card, ref int integration) { people.Remind_flag = false; for (int i = 0; i < card.Count; i++) //删除牌 { for (int j = 0; j < people.deck.Count; j++) { if (card[i].num == people.deck[j].num) { people.deck.Remove(people.deck[j]); } } } UpdateCardnum(ref people); //更新卡组数量 people.OutCard_flag++; if (card[0].size == card[card.Count - 1].size && card.Count >= 6 && card.Count <= 7) { integration *= 2; } else if (card[0].size == card[card.Count - 1].size && card.Count == 8 || (card.Count == 4 && card[0].size == 17 && card[1].size == 17 && card[2].size == 16 && card[3].size == 16)) { integration *= 3; } //判断是否赢 if (people.deck.Count == 0) { people.Win_flag = true; return(true); } return(false); }
//给对应人队列加牌 public void DealPeople(ref PeopleList people, List <Card> card) { for (int j = 0; j < card.Count; j++)//加牌 { people.deck.Add(card[j]); } UpdateCardnum(ref people); //更新卡的卡牌数量 }
//玩家提示出卡 public List <Card> Remind(ref PeopleList people, List <Card> prevCard) { List <Card> TCard = new List <Card>(); for (int j = 0; j < 4; j++) { TCard = Card.CopyListCard(people.deck); } if (people.Remind_flag == false) { if (prevCard != null) { people.Result = gamemode.ComupterRemind(TCard, prevCard); } else { people.Result = gamemode.PlayerRemind(TCard, prevCard, ref people.remindStyle); } if (people.Result.Count != 0) { people.Remind_flag = true; } } else { if (people.remindStyle == 1) //如果当前有人出牌 { people.Result = gamemode.ComupterRemind(TCard, people.Result); } else { people.Result = gamemode.PlayerRemind(TCard, people.Result, ref people.remindStyle); //按类型提示出牌 if (people.Result.Count == 0) //如果当前没牌提示,则提示下一种类型的牌 { people.Remind_flag = false; Remind(ref people, prevCard); } } } return(people.Result); }
//更新卡组中的牌的数量 private void UpdateCardnum(ref PeopleList people) { ChangeOrder(ref people, 0); for (int j = 0; j < people.deck.Count; j++) //改变每个牌的数量 { int cardnum = 1, k = j; while (j < people.deck.Count - 1 && people.deck[j].size == people.deck[j + 1].size) { cardnum++; j++; } for (; k <= j; k++) { people.deck[k].cardnum = cardnum; } } if (people.OrderMode == 0) //如果当前是按个数排则重新排序 { ChangeOrder(ref people, 1); } }
//改变牌序 public void ChangeOrder(ref PeopleList people, int orderMode) { gamemode.ChangeOrder(ref people.deck, orderMode); }
//改变牌序 public void ChangeOrder(ref PeopleList people) { gamemode.ChangeOrder(ref people.deck, people.OrderMode); people.OrderMode = 1 - people.OrderMode; }