玩家技能
This commit is contained in:
parent
88dd4aea0e
commit
a640c50d22
@ -190,7 +190,7 @@ func (this *Room) ReceiveMessage(session comm.IUserSession, stype string, msg pr
|
|||||||
}
|
}
|
||||||
if this.player1.Energy >= conf.Skillload {
|
if this.player1.Energy >= conf.Skillload {
|
||||||
this.player1.Energy = conf.Skillload // 清零
|
this.player1.Energy = conf.Skillload // 清零
|
||||||
this.chessboard.SkillUp(conf.Skilleffect, conf.Skillvalue)
|
curScore, szMap = this.chessboard.SkillUp(conf.Skilleffect, conf.Skillvalue)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err := this.module.SendMsgSyncToSession(string(this.module.GetType()), "operatorrst", &pb.EntertainOperatorRstPush{
|
if err := this.module.SendMsgSyncToSession(string(this.module.GetType()), "operatorrst", &pb.EntertainOperatorRstPush{
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"fmt"
|
"fmt"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
|
"go_dreamfactory/utils"
|
||||||
"math/big"
|
"math/big"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -463,7 +464,7 @@ func (this *MapData) CheckMap(color int32) (score int32, szMap []*pb.MapData) {
|
|||||||
score += curScore // 总分
|
score += curScore // 总分
|
||||||
if this.DropGirde() {
|
if this.DropGirde() {
|
||||||
szMap = append(szMap, &pb.MapData{
|
szMap = append(szMap, &pb.MapData{
|
||||||
Data: this.GetPalat(),
|
Data: this.GetPalatData(),
|
||||||
CurSocre: curScore,
|
CurSocre: curScore,
|
||||||
Xgrid: count,
|
Xgrid: count,
|
||||||
})
|
})
|
||||||
@ -507,7 +508,7 @@ func (this *MapData) DropGirde() bool {
|
|||||||
|
|
||||||
return bDrop
|
return bDrop
|
||||||
}
|
}
|
||||||
func (this *MapData) GetPalat() (data []*pb.GirdeData) {
|
func (this *MapData) GetPalatData() (data []*pb.GirdeData) {
|
||||||
for _, v := range this.Plat {
|
for _, v := range this.Plat {
|
||||||
data = append(data, &pb.GirdeData{
|
data = append(data, &pb.GirdeData{
|
||||||
Oid: v.Oid,
|
Oid: v.Oid,
|
||||||
@ -563,11 +564,16 @@ func (this *MapData) AiSwapGirde() (score int32, szMap []*pb.MapData, oid1 int32
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 释放技能 技能id 和参数
|
// 释放技能 技能id 和参数
|
||||||
func (this *MapData) SkillUp(skillid int32, value int32) (plat *pb.MapData) {
|
func (this *MapData) SkillUp(skillid int32, value int32) (score int32, szMap []*pb.MapData) {
|
||||||
if skillid == 1 { // 随机消除盘面上X个方块
|
if skillid == 1 { // 随机消除盘面上X个方块
|
||||||
|
ids := utils.RandomNumbers(0, Total-1, int(value))
|
||||||
|
for _, id := range ids {
|
||||||
|
this.Plat[id] = &pb.GirdeData{}
|
||||||
|
}
|
||||||
|
if this.DropGirde() {
|
||||||
|
score, szMap = this.CheckMap(1)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return &pb.MapData{
|
return
|
||||||
Data: this.Plat,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -90,6 +90,7 @@ func Test_Main(t *testing.T) {
|
|||||||
// if bSwap, m := m.AiSwapGirde(); bSwap {
|
// if bSwap, m := m.AiSwapGirde(); bSwap {
|
||||||
// szMap = append(szMap, m...)
|
// szMap = append(szMap, m...)
|
||||||
// }
|
// }
|
||||||
|
m.SkillUp(1, 7)
|
||||||
m.SwapGirde(1, 8)
|
m.SwapGirde(1, 8)
|
||||||
m.CheckMap(1)
|
m.CheckMap(1)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user