修复做虫子代码
This commit is contained in:
parent
1baf868df3
commit
b76b1f5ab2
@ -116,6 +116,7 @@ func (this *CatchBugs) createRoom(rules *pb.DBCatchBugsRules, red, blue *pb.DBCa
|
|||||||
confs []*cfg.GameCatchbugLllustratedData
|
confs []*cfg.GameCatchbugLllustratedData
|
||||||
cardsTemp []*pb.DBCatchBugsCard
|
cardsTemp []*pb.DBCatchBugsCard
|
||||||
cards []*pb.DBCatchBugsCard
|
cards []*pb.DBCatchBugsCard
|
||||||
|
backup []*pb.DBCatchBugsCard
|
||||||
weights []int32
|
weights []int32
|
||||||
room *Room
|
room *Room
|
||||||
)
|
)
|
||||||
@ -146,13 +147,20 @@ func (this *CatchBugs) createRoom(rules *pb.DBCatchBugsRules, red, blue *pb.DBCa
|
|||||||
cards[i].Index = int32(i)
|
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()
|
roomid = primitive.NewObjectID().Hex()
|
||||||
if room, err = this.rooms.newRoom(&pb.DBCatchBugsRoom{
|
if room, err = this.rooms.newRoom(&pb.DBCatchBugsRoom{
|
||||||
Rid: roomid,
|
Rid: roomid,
|
||||||
Rules: rules,
|
Rules: rules,
|
||||||
Red: red,
|
Red: red,
|
||||||
Blue: blue,
|
Blue: blue,
|
||||||
Backup: cardsTemp[24:],
|
Backup: backup,
|
||||||
Card: cards,
|
Card: cards,
|
||||||
}, sessions); err != nil {
|
}, sessions); err != nil {
|
||||||
this.Error("创建房间错误", log.Field{Key: "err", Value: err.Error()})
|
this.Error("创建房间错误", log.Field{Key: "err", Value: err.Error()})
|
||||||
|
@ -168,15 +168,19 @@ func (this *Room) PlayerHandleEnd(uid string, handle *pb.CatchbugsHandleEndReq)
|
|||||||
Changetype: 1,
|
Changetype: 1,
|
||||||
Card: card,
|
Card: card,
|
||||||
})
|
})
|
||||||
// this.SendAllSessions("tableschange", &pb.CatchbugsTablesChangePush{
|
|
||||||
// Changetype: 1,
|
|
||||||
// Card: card,
|
|
||||||
// })
|
|
||||||
// this.SendAllSessions("roundend", &pb.CatchbugsRoundEndPush{})
|
|
||||||
}
|
}
|
||||||
if this.handleplayers == 2 {
|
if this.handleplayers == 2 {
|
||||||
this.round++
|
this.round++
|
||||||
this.handleplayers = 0
|
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 <= 6 {
|
||||||
if this.round%this.conf.Round == 0 { //触发技能
|
if this.round%this.conf.Round == 0 { //触发技能
|
||||||
switch this.data.Rules.Skill {
|
switch this.data.Rules.Skill {
|
||||||
@ -246,12 +250,12 @@ func (this *Room) ReplenishCard() {
|
|||||||
var index = 0
|
var index = 0
|
||||||
this.round = 4
|
this.round = 4
|
||||||
for _, v := range this.data.Card {
|
for _, v := range this.data.Card {
|
||||||
if v.Isopen {
|
// if v.Isopen {
|
||||||
v.Isopen = false
|
v.Isopen = false
|
||||||
v.Cid = this.data.Backup[index].Cid
|
v.Cid = this.data.Backup[index].Cid
|
||||||
v.Id = this.data.Backup[index].Id
|
v.Id = this.data.Backup[index].Id
|
||||||
index++
|
index++
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
this.isReplenish = true
|
this.isReplenish = true
|
||||||
if this.data.Rules.Headstart == 0 {
|
if this.data.Rules.Headstart == 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user