消除十字技能
This commit is contained in:
parent
4de1e42c4b
commit
6c6238fa98
@ -225,23 +225,6 @@ func (this *Room) ReceiveMessage(session comm.IUserSession, stype string, msg pr
|
||||
}
|
||||
return
|
||||
} else if req.Itype > 0 { //玩家卡牌技能
|
||||
var (
|
||||
conf *cfg.GamePlayerSkillData
|
||||
err error
|
||||
list *pb.DBXXLData
|
||||
)
|
||||
if conf, err = this.module.configure.GetGamePlaySkill(req.Itype); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ConfigNoFound, // 配置校验
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
if list, err = this.module.model.getEntertainmList(session.GetUserId()); err == nil {
|
||||
this.module.Debugf("%v,%v", conf, list)
|
||||
|
||||
}
|
||||
if curPlayer.Skill[req.Itype] <= 0 {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_EntertainNoSkillCard, // 技能卡不足
|
||||
@ -253,7 +236,6 @@ func (this *Room) ReceiveMessage(session comm.IUserSession, stype string, msg pr
|
||||
if errdata = this.UserCardSkill(curPlayer, color, req.Itype, req.Curid); errdata != nil {
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
if req.Itype == 0 && req.Curid == 0 && req.Targetid == 0 {
|
||||
@ -953,12 +935,12 @@ func (this *Room) UserCardSkill(curPlayer *pb.PlayerData, color int32, skillid i
|
||||
if conf.Skilltouch == 101 { // 技能类型为1
|
||||
szMap = this.chessboard.HitElem(color, curid)
|
||||
} else if conf.Skilltouch == 102 {
|
||||
this.chessboard.ShuffleElem() // 初始化棋盘
|
||||
this.chessboard.ShuffleElem()
|
||||
szMap = append(szMap, &pb.MapData{
|
||||
Data: this.chessboard.Plat,
|
||||
})
|
||||
} else if conf.Skilltouch == 103 {
|
||||
//this.chessboard.HitCrossElem() // 初始化棋盘
|
||||
this.chessboard.HitCrossElem(color, curid) // 消除十字
|
||||
szMap = append(szMap, &pb.MapData{
|
||||
Data: this.chessboard.Plat,
|
||||
})
|
||||
@ -979,6 +961,19 @@ func (this *Room) UserCardSkill(curPlayer *pb.PlayerData, color int32, skillid i
|
||||
v.ChangeType = 1
|
||||
}
|
||||
this.NexPower = this.curPower
|
||||
if conf.Number == 2 { // 只有2类型扣除
|
||||
if list, err := this.module.model.getEntertainmList(curPlayer.Userinfo.Uid); err == nil {
|
||||
if _, ok := list.Skill[skillid]; ok {
|
||||
list.Skill[skillid] -= 1
|
||||
if list.Skill[skillid] < 0 {
|
||||
list.Skill[skillid] = 0
|
||||
}
|
||||
this.module.model.modifyEntertainmList(curPlayer.Userinfo.Uid, map[string]interface{}{
|
||||
"skill": list.Skill,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if err := this.module.SendMsgSyncToSession(string(this.module.GetType()), "operatorrst", &pb.EntertainOperatorRstPush{
|
||||
Mpadata: szMap,
|
||||
|
@ -1329,35 +1329,43 @@ func (this *MapData) ShuffleElem() {
|
||||
}
|
||||
|
||||
func (this *MapData) HitCrossElem(color int32, curid int32) (szMap []*pb.MapData) {
|
||||
var ids []int // 十字id
|
||||
var energy int32
|
||||
var curScore int32
|
||||
var (
|
||||
ids []int // 十字id
|
||||
energy int32
|
||||
curScore int32
|
||||
xc map[int]struct{}
|
||||
)
|
||||
x := int(curid / Width)
|
||||
y := int(curid % Height)
|
||||
|
||||
for i := 0; i < Height; i++ { // 上
|
||||
xc = make(map[int]struct{}, 0)
|
||||
for i := 0; i < Height; i++ { // 上下
|
||||
if y+i < Height {
|
||||
ids = append(ids, x*Width+(y+i))
|
||||
}
|
||||
if y-i > 0 {
|
||||
ids = append(ids, (x-1)*Width+(y))
|
||||
ids = append(ids, x*Width+(y-i))
|
||||
}
|
||||
}
|
||||
|
||||
for i := 0; i < Height; i++ { // 左右
|
||||
if x+i < Width {
|
||||
ids = append(ids, (x+i)*Width+(y))
|
||||
}
|
||||
if x-i >= 0 {
|
||||
ids = append(ids, (x-i)*Width+(y))
|
||||
}
|
||||
}
|
||||
for _, v := range ids {
|
||||
if this.Plat[curid].Special == 0 {
|
||||
if this.Plat[curid].Color == color {
|
||||
energy++
|
||||
}
|
||||
curScore = this.Plat[curid].Score
|
||||
this.Plat[curid] = &pb.GirdeData{}
|
||||
if this.DropGirde() {
|
||||
szMap = append(szMap, &pb.MapData{
|
||||
Data: this.GetPalatData(),
|
||||
CurSocre: curScore,
|
||||
CurEnergy: 0,
|
||||
})
|
||||
}
|
||||
sz, _ := this.CheckMap(color, false)
|
||||
szMap = append(szMap, sz...)
|
||||
xc[v] = struct{}{}
|
||||
} else {
|
||||
x := this.SpecialElem(int(curid), this.Plat[curid].Special)
|
||||
for id := range x {
|
||||
for key := range this.SpecialElem(int(v), this.Plat[v].Special) {
|
||||
xc[key] = struct{}{}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for id := range xc {
|
||||
if this.Plat[id].Color == color {
|
||||
energy++
|
||||
}
|
||||
@ -1372,6 +1380,5 @@ func (this *MapData) HitCrossElem(color int32, curid int32) (szMap []*pb.MapData
|
||||
CurEnergy: energy,
|
||||
})
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user