三消 将随机6个宝石染成当前盘面上颜色最多的宝石

This commit is contained in:
meixiongfeng 2024-01-12 11:53:56 +08:00
parent 37934459bc
commit 866dc7ef3b
3 changed files with 35 additions and 13 deletions

View File

@ -731,6 +731,15 @@ func (this *MapData) SkillUp(pos int32, color int32, skillid int32, value int32,
}
case 3: // 将随机6个宝石染成当前盘面上颜色最多的宝石
this.SkillChangeColor(value)
bDrop = false
szMap = append(szMap, &pb.MapData{
Data: this.GetPalatData(),
CurSocre: skillScore,
CurEnergy: skillEnergy,
})
if list, _ := this.CheckMap(color, false); len(list) > 0 {
szMap = append(szMap, list...)
}
case 4:
x := int(pos / Width)
y := int(pos % Height)
@ -1488,9 +1497,15 @@ func (this *MapData) SkillChangeColor(count int32) {
elemCount[v.Color] += 1
}
for k := range elemCount {
if color < k {
for _, v := range elemCount {
if color < v {
color = v
}
}
for k, v := range elemCount {
if color == v {
color = k
break
}
}
for i := 0; i < int(count); i++ {
@ -1498,7 +1513,12 @@ func (this *MapData) SkillChangeColor(count int32) {
if this.Plat[targetId].Color == color {
i--
} else {
this.Plat[targetId].Color = color // 变更颜色
if this.Plat[targetId].Special == 0 {
this.Plat[targetId].Color = color // 变更颜色
this.Plat[targetId].Cid = color // 变更颜色
this.oid++
this.Plat[targetId].Oid = this.oid // 变唯一id
}
}
}
return

View File

@ -21,7 +21,7 @@ func (this *apiComp) GetRace(session comm.IUserSession, req *pb.PagodaGetRaceReq
err error
update map[string]interface{}
)
update = make(map[string]interface{}, 0)
list, err = this.module.modelRacePagoda.getPagodaRaceList(session.GetUserId())
if err != nil {
errdata = &pb.ErrorData{
@ -33,20 +33,22 @@ func (this *apiComp) GetRace(session comm.IUserSession, req *pb.PagodaGetRaceReq
}
if !utils.IsToday(list.Rtime) {
update = make(map[string]interface{}, 0)
list.Rtime = configure.Now().Unix()
list.Battlecount = 0
update["battlecount"] = list.Battlecount
update["rtime"] = list.Rtime
}
if err = this.module.modelRacePagoda.ModifyPagodaRaceData(session.GetUserId(), update); err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
Message: err.Error(),
if err = this.module.modelRacePagoda.ModifyPagodaRaceData(session.GetUserId(), update); err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
Message: err.Error(),
}
}
}
session.SendMsg(string(this.module.GetType()), PagodaGetRaceResp, &pb.PagodaGetRaceResp{})
session.SendMsg(string(this.module.GetType()), PagodaGetRaceResp, &pb.PagodaGetRaceResp{
Data: list,
})
return
}

View File

@ -73,7 +73,7 @@ func (this *apiComp) ChallengeRace(session comm.IUserSession, req *pb.PagodaChal
}
if _, ok := pagoda.Data[conf.Floors]; !ok {
if pagoda.Maxfloor != conf.Floors+1 {
if pagoda.Maxfloor+1 != conf.Floors {
errdata = &pb.ErrorData{ // 挑战关卡数据不匹配
Code: pb.ErrorCode_PagodaLevlErr,
Title: pb.ErrorCode_PagodaLevlErr.ToString(),