diff --git a/modules/catchbugs/module.go b/modules/catchbugs/module.go index 40124ab2e..e6e5362f2 100644 --- a/modules/catchbugs/module.go +++ b/modules/catchbugs/module.go @@ -116,6 +116,7 @@ func (this *CatchBugs) createRoom(rules *pb.DBCatchBugsRules, red, blue *pb.DBCa confs []*cfg.GameCatchbugLllustratedData cardsTemp []*pb.DBCatchBugsCard cards []*pb.DBCatchBugsCard + backup []*pb.DBCatchBugsCard weights []int32 room *Room ) @@ -146,13 +147,20 @@ func (this *CatchBugs) createRoom(rules *pb.DBCatchBugsRules, red, blue *pb.DBCa cards[i].Index = int32(i) } + indexs = comm.RandShuffle(24) + backup = make([]*pb.DBCatchBugsCard, 24) + for i, v := range indexs { + backup[i] = cardsTemp[24+v] + backup[i].Index = int32(i) + } + roomid = primitive.NewObjectID().Hex() if room, err = this.rooms.newRoom(&pb.DBCatchBugsRoom{ Rid: roomid, Rules: rules, Red: red, Blue: blue, - Backup: cardsTemp[24:], + Backup: backup, Card: cards, }, sessions); err != nil { this.Error("创建房间错误", log.Field{Key: "err", Value: err.Error()}) diff --git a/modules/catchbugs/room.go b/modules/catchbugs/room.go index db68eaa2a..2302b6c7d 100644 --- a/modules/catchbugs/room.go +++ b/modules/catchbugs/room.go @@ -168,15 +168,19 @@ func (this *Room) PlayerHandleEnd(uid string, handle *pb.CatchbugsHandleEndReq) Changetype: 1, Card: card, }) - // this.SendAllSessions("tableschange", &pb.CatchbugsTablesChangePush{ - // Changetype: 1, - // Card: card, - // }) - // this.SendAllSessions("roundend", &pb.CatchbugsRoundEndPush{}) } if this.handleplayers == 2 { this.round++ this.handleplayers = 0 + if this.round == 4 { + this.ReplenishCard() + card = this.data.Card + roundendpush.Changes = append(roundendpush.Changes, &pb.CatchbugsTablesChangePush{ + Changetype: 1, + Card: card, + }) + } + if this.round <= 6 { if this.round%this.conf.Round == 0 { //触发技能 switch this.data.Rules.Skill { @@ -246,12 +250,12 @@ func (this *Room) ReplenishCard() { var index = 0 this.round = 4 for _, v := range this.data.Card { - if v.Isopen { - v.Isopen = false - v.Cid = this.data.Backup[index].Cid - v.Id = this.data.Backup[index].Id - index++ - } + // if v.Isopen { + v.Isopen = false + v.Cid = this.data.Backup[index].Cid + v.Id = this.data.Backup[index].Id + index++ + // } } this.isReplenish = true if this.data.Rules.Headstart == 0 {