消除十字技能
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
|
return
|
||||||
} else if req.Itype > 0 { //玩家卡牌技能
|
} 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 {
|
if curPlayer.Skill[req.Itype] <= 0 {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_EntertainNoSkillCard, // 技能卡不足
|
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 {
|
if errdata = this.UserCardSkill(curPlayer, color, req.Itype, req.Curid); errdata != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if req.Itype == 0 && req.Curid == 0 && req.Targetid == 0 {
|
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
|
if conf.Skilltouch == 101 { // 技能类型为1
|
||||||
szMap = this.chessboard.HitElem(color, curid)
|
szMap = this.chessboard.HitElem(color, curid)
|
||||||
} else if conf.Skilltouch == 102 {
|
} else if conf.Skilltouch == 102 {
|
||||||
this.chessboard.ShuffleElem() // 初始化棋盘
|
this.chessboard.ShuffleElem()
|
||||||
szMap = append(szMap, &pb.MapData{
|
szMap = append(szMap, &pb.MapData{
|
||||||
Data: this.chessboard.Plat,
|
Data: this.chessboard.Plat,
|
||||||
})
|
})
|
||||||
} else if conf.Skilltouch == 103 {
|
} else if conf.Skilltouch == 103 {
|
||||||
//this.chessboard.HitCrossElem() // 初始化棋盘
|
this.chessboard.HitCrossElem(color, curid) // 消除十字
|
||||||
szMap = append(szMap, &pb.MapData{
|
szMap = append(szMap, &pb.MapData{
|
||||||
Data: this.chessboard.Plat,
|
Data: this.chessboard.Plat,
|
||||||
})
|
})
|
||||||
@ -979,6 +961,19 @@ func (this *Room) UserCardSkill(curPlayer *pb.PlayerData, color int32, skillid i
|
|||||||
v.ChangeType = 1
|
v.ChangeType = 1
|
||||||
}
|
}
|
||||||
this.NexPower = this.curPower
|
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{
|
if err := this.module.SendMsgSyncToSession(string(this.module.GetType()), "operatorrst", &pb.EntertainOperatorRstPush{
|
||||||
Mpadata: szMap,
|
Mpadata: szMap,
|
||||||
|
@ -1329,49 +1329,56 @@ func (this *MapData) ShuffleElem() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *MapData) HitCrossElem(color int32, curid int32) (szMap []*pb.MapData) {
|
func (this *MapData) HitCrossElem(color int32, curid int32) (szMap []*pb.MapData) {
|
||||||
var ids []int // 十字id
|
var (
|
||||||
var energy int32
|
ids []int // 十字id
|
||||||
var curScore int32
|
energy int32
|
||||||
|
curScore int32
|
||||||
|
xc map[int]struct{}
|
||||||
|
)
|
||||||
x := int(curid / Width)
|
x := int(curid / Width)
|
||||||
y := int(curid % Height)
|
y := int(curid % Height)
|
||||||
|
xc = make(map[int]struct{}, 0)
|
||||||
for i := 0; i < Height; i++ { // 上
|
for i := 0; i < Height; i++ { // 上下
|
||||||
|
if y+i < Height {
|
||||||
|
ids = append(ids, x*Width+(y+i))
|
||||||
|
}
|
||||||
if y-i > 0 {
|
if y-i > 0 {
|
||||||
ids = append(ids, (x-1)*Width+(y))
|
ids = append(ids, x*Width+(y-i))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if this.Plat[curid].Special == 0 {
|
|
||||||
if this.Plat[curid].Color == color {
|
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 {
|
||||||
|
xc[v] = struct{}{}
|
||||||
|
} else {
|
||||||
|
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++
|
energy++
|
||||||
}
|
}
|
||||||
curScore = this.Plat[curid].Score
|
curScore += this.Plat[id].Score
|
||||||
this.Plat[curid] = &pb.GirdeData{}
|
this.Plat[id] = &pb.GirdeData{}
|
||||||
if this.DropGirde() {
|
this.operElem = append(this.operElem, int32(id))
|
||||||
szMap = append(szMap, &pb.MapData{
|
}
|
||||||
Data: this.GetPalatData(),
|
if this.DropGirde() {
|
||||||
CurSocre: curScore,
|
szMap = append(szMap, &pb.MapData{
|
||||||
CurEnergy: 0,
|
Data: this.GetPalatData(),
|
||||||
})
|
CurSocre: curScore,
|
||||||
}
|
CurEnergy: energy,
|
||||||
sz, _ := this.CheckMap(color, false)
|
})
|
||||||
szMap = append(szMap, sz...)
|
|
||||||
} else {
|
|
||||||
x := this.SpecialElem(int(curid), this.Plat[curid].Special)
|
|
||||||
for id := range x {
|
|
||||||
if this.Plat[id].Color == color {
|
|
||||||
energy++
|
|
||||||
}
|
|
||||||
curScore += this.Plat[id].Score
|
|
||||||
this.Plat[id] = &pb.GirdeData{}
|
|
||||||
this.operElem = append(this.operElem, int32(id))
|
|
||||||
}
|
|
||||||
if this.DropGirde() {
|
|
||||||
szMap = append(szMap, &pb.MapData{
|
|
||||||
Data: this.GetPalatData(),
|
|
||||||
CurSocre: curScore,
|
|
||||||
CurEnergy: energy,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user