部分技能不增加积分
This commit is contained in:
parent
59e9a20756
commit
11bd3e4742
@ -247,7 +247,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 = 0 // 清零
|
this.player1.Energy = 0 // 清零
|
||||||
if _, m := this.chessboard.SkillUp(conf.Skilleffect, conf.Skillvalue, true); len(m) > 0 {
|
if _, m := this.chessboard.SkillUp(color, conf.Skilleffect, conf.Skillvalue, true); len(m) > 0 {
|
||||||
szMap = append(szMap, m...)
|
szMap = append(szMap, m...)
|
||||||
} else {
|
} else {
|
||||||
szMap = append(szMap, &pb.MapData{
|
szMap = append(szMap, &pb.MapData{
|
||||||
@ -279,7 +279,7 @@ func (this *Room) ReceiveMessage(session comm.IUserSession, stype string, msg pr
|
|||||||
}
|
}
|
||||||
if this.player2.Energy >= conf.Skillload {
|
if this.player2.Energy >= conf.Skillload {
|
||||||
this.player2.Energy = 0 // 清零
|
this.player2.Energy = 0 // 清零
|
||||||
if _, m := this.chessboard.SkillUp(conf.Skilleffect, conf.Skillvalue, true); len(m) > 0 {
|
if _, m := this.chessboard.SkillUp(color, conf.Skilleffect, conf.Skillvalue, true); len(m) > 0 {
|
||||||
szMap = append(szMap, m...)
|
szMap = append(szMap, m...)
|
||||||
} else {
|
} else {
|
||||||
szMap = append(szMap, &pb.MapData{
|
szMap = append(szMap, &pb.MapData{
|
||||||
|
@ -89,11 +89,11 @@ func (this *MapData) SwapGirde(oldId, newId int32) (bSwap bool) {
|
|||||||
|
|
||||||
func (this *MapData) Debugf() {
|
func (this *MapData) Debugf() {
|
||||||
fmt.Printf("================\n")
|
fmt.Printf("================\n")
|
||||||
var v int
|
//var v int
|
||||||
for index := Width - 1; index >= 0; index-- {
|
for index := Width - 1; index >= 0; index-- {
|
||||||
for j := 0; j < Height; j++ {
|
for j := 0; j < Height; j++ {
|
||||||
v = index + j*7
|
// v = index + j*7
|
||||||
fmt.Printf("%d:%d ", v, this.Plat[index+j*Height].Cid)
|
fmt.Printf("%d:%d ", this.Plat[index+j*Height].Oid, this.Plat[index+j*Height].Cid)
|
||||||
|
|
||||||
}
|
}
|
||||||
fmt.Printf("\n")
|
fmt.Printf("\n")
|
||||||
@ -351,7 +351,7 @@ func (this *MapData) CheckMap(color int32, bSkill bool) (szMap []*pb.MapData, xc
|
|||||||
} else if s == FiveType { // 随机消除
|
} else if s == FiveType { // 随机消除
|
||||||
// 获取配置
|
// 获取配置
|
||||||
if c, _ := this.module.configure.GetGameBlock(this.Plat[id].Color, FiveType); c != nil {
|
if c, _ := this.module.configure.GetGameBlock(this.Plat[id].Color, FiveType); c != nil {
|
||||||
if xc, _ := this.SkillUp(1, c.Value, false); len(xc) > 0 {
|
if xc, _ := this.SkillUp(color, 1, c.Value, false); len(xc) > 0 {
|
||||||
//szMap = append(szMap, sz...)
|
//szMap = append(szMap, sz...)
|
||||||
for key := range xc {
|
for key := range xc {
|
||||||
x[key] = struct{}{}
|
x[key] = struct{}{}
|
||||||
@ -379,7 +379,7 @@ func (this *MapData) CheckMap(color int32, bSkill bool) (szMap []*pb.MapData, xc
|
|||||||
CurSocre: curScore,
|
CurSocre: curScore,
|
||||||
CurEnergy: energy,
|
CurEnergy: energy,
|
||||||
})
|
})
|
||||||
this.Debugf()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查掉落
|
// 检查掉落
|
||||||
@ -478,7 +478,12 @@ func (this *MapData) AiSwapGirde() (szMap []*pb.MapData, oid1 int32, oid2 int32,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 释放技能 技能id 和参数
|
// 释放技能 技能id 和参数
|
||||||
func (this *MapData) SkillUp(skillid int32, value int32, bDrop bool) (x map[int]struct{}, szMap []*pb.MapData) {
|
func (this *MapData) SkillUp(color int32, skillid int32, value int32, bDrop bool) (x map[int]struct{}, szMap []*pb.MapData) {
|
||||||
|
var (
|
||||||
|
skillScore int32 // 技能获得的分数
|
||||||
|
skillEnergy int32 // 技能获得的能量
|
||||||
|
)
|
||||||
|
|
||||||
if skillid == 1 { // 随机消除盘面上X个方块
|
if skillid == 1 { // 随机消除盘面上X个方块
|
||||||
x = make(map[int]struct{})
|
x = make(map[int]struct{})
|
||||||
ids := utils.RandomNumbers(0, Total-1, int(value))
|
ids := utils.RandomNumbers(0, Total-1, int(value))
|
||||||
@ -496,7 +501,7 @@ func (this *MapData) SkillUp(skillid int32, value int32, bDrop bool) (x map[int]
|
|||||||
} else if s == FiveType { // 随机消除
|
} else if s == FiveType { // 随机消除
|
||||||
// 获取配置
|
// 获取配置
|
||||||
if c, _ := this.module.configure.GetGameBlock(this.Plat[id].Color, FiveType); c != nil {
|
if c, _ := this.module.configure.GetGameBlock(this.Plat[id].Color, FiveType); c != nil {
|
||||||
if xc, _ := this.SkillUp(1, c.Value, false); len(xc) > 0 { // 递归调用
|
if xc, _ := this.SkillUp(color, 1, c.Value, false); len(xc) > 0 { // 递归调用
|
||||||
for key := range xc {
|
for key := range xc {
|
||||||
x[key] = struct{}{}
|
x[key] = struct{}{}
|
||||||
}
|
}
|
||||||
@ -508,9 +513,18 @@ func (this *MapData) SkillUp(skillid int32, value int32, bDrop bool) (x map[int]
|
|||||||
}
|
}
|
||||||
if bDrop {
|
if bDrop {
|
||||||
for key := range x {
|
for key := range x {
|
||||||
|
if this.Plat[key].Color == color {
|
||||||
|
skillEnergy += 1
|
||||||
|
}
|
||||||
|
skillScore += this.Plat[key].Score
|
||||||
this.Plat[key] = &pb.GirdeData{}
|
this.Plat[key] = &pb.GirdeData{}
|
||||||
}
|
}
|
||||||
if this.DropGirde() {
|
if this.DropGirde() {
|
||||||
|
szMap = append(szMap, &pb.MapData{
|
||||||
|
Data: this.GetPalatData(),
|
||||||
|
CurSocre: skillScore,
|
||||||
|
CurEnergy: skillEnergy,
|
||||||
|
})
|
||||||
szMap, _ = this.CheckMap(1, false)
|
szMap, _ = this.CheckMap(1, false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -529,13 +543,13 @@ func (this *MapData) CheckInitPlat() {
|
|||||||
|
|
||||||
func (this *MapData) SetMap() {
|
func (this *MapData) SetMap() {
|
||||||
sz2 := []int32{
|
sz2 := []int32{
|
||||||
1, 1, 2, 5, 1, 5, 2,
|
1, 4, 2, 5, 4, 5, 2,
|
||||||
3, 2, 3, 1, 2, 4, 4,
|
3, 2, 3, 1, 2, 1, 4,
|
||||||
2, 1, 1, 3, 6, 4, 1,
|
2, 1, 5, 4, 6, 4, 1,
|
||||||
4, 1, 1, 4, 3, 6, 3,
|
3, 1, 3, 5, 2, 6, 3,
|
||||||
4, 3, 4, 5, 1, 6, 1,
|
4, 5, 4, 2, 4, 1, 1,
|
||||||
5, 4, 2, 5, 3, 3, 1,
|
5, 3, 1, 5, 3, 3, 4,
|
||||||
4, 1, 5, 3, 2, 3, 4,
|
4, 2, 4, 1, 2, 3, 4,
|
||||||
}
|
}
|
||||||
var pos int
|
var pos int
|
||||||
for index := Width - 1; index >= 0; index-- {
|
for index := Width - 1; index >= 0; index-- {
|
||||||
@ -663,8 +677,16 @@ func (this *MapData) SetIndelibilityPlat() {
|
|||||||
k2 := this.Plat[k+1].Color
|
k2 := this.Plat[k+1].Color
|
||||||
k3 := this.Plat[k+2].Color
|
k3 := this.Plat[k+2].Color
|
||||||
if k1 == k2 && k2 == k3 {
|
if k1 == k2 && k2 == k3 {
|
||||||
|
if this.Plat[k+2].Special == 0 {
|
||||||
this.Plat[k+2].Cid = (k3+1)%5 + 1
|
this.Plat[k+2].Cid = (k3+1)%5 + 1
|
||||||
this.Plat[k+2].Color = (k3+1)%5 + 1
|
this.Plat[k+2].Color = (k3+1)%5 + 1
|
||||||
|
} else if this.Plat[k+1].Special == 0 {
|
||||||
|
this.Plat[k+1].Cid = (k3+1)%5 + 1
|
||||||
|
this.Plat[k+1].Color = (k3+1)%5 + 1
|
||||||
|
} else if this.Plat[k].Special == 0 {
|
||||||
|
this.Plat[k].Cid = (k3+1)%5 + 1
|
||||||
|
this.Plat[k].Color = (k3+1)%5 + 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -674,8 +696,16 @@ func (this *MapData) SetIndelibilityPlat() {
|
|||||||
k3 := this.Plat[k+2*Width].Color
|
k3 := this.Plat[k+2*Width].Color
|
||||||
|
|
||||||
if k1 == k2 && k2 == k3 {
|
if k1 == k2 && k2 == k3 {
|
||||||
|
if this.Plat[k+2*Width].Special == 0 {
|
||||||
this.Plat[k+2*Width].Cid = (k3+1)%5 + 1
|
this.Plat[k+2*Width].Cid = (k3+1)%5 + 1
|
||||||
this.Plat[k+2*Width].Color = (k3+1)%5 + 1
|
this.Plat[k+2*Width].Color = (k3+1)%5 + 1
|
||||||
|
} else if this.Plat[k+Width].Special == 0 {
|
||||||
|
this.Plat[k+Width].Cid = (k3+1)%5 + 1
|
||||||
|
this.Plat[k+Width].Color = (k3+1)%5 + 1
|
||||||
|
} else if this.Plat[k].Special == 0 {
|
||||||
|
this.Plat[k].Cid = (k3+1)%5 + 1
|
||||||
|
this.Plat[k].Color = (k3+1)%5 + 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -683,7 +713,6 @@ func (this *MapData) SetIndelibilityPlat() {
|
|||||||
|
|
||||||
// 重新洗牌
|
// 重新洗牌
|
||||||
func (this *MapData) RedsetPlatData() {
|
func (this *MapData) RedsetPlatData() {
|
||||||
|
|
||||||
for i := 0; i < Total-1; i++ {
|
for i := 0; i < Total-1; i++ {
|
||||||
targetId := comm.GetRandNum(0, Total-1)
|
targetId := comm.GetRandNum(0, Total-1)
|
||||||
if i == int(targetId) {
|
if i == int(targetId) {
|
||||||
@ -694,7 +723,6 @@ func (this *MapData) RedsetPlatData() {
|
|||||||
this.Plat[i] = this.Plat[targetId]
|
this.Plat[i] = this.Plat[targetId]
|
||||||
this.Plat[targetId] = tmp
|
this.Plat[targetId] = tmp
|
||||||
}
|
}
|
||||||
this.Debugf()
|
|
||||||
|
|
||||||
this.SetIndelibilityPlat()
|
this.SetIndelibilityPlat()
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ func Test_Main(t *testing.T) {
|
|||||||
}()
|
}()
|
||||||
m := new(entertainment.MapData)
|
m := new(entertainment.MapData)
|
||||||
m.InitMap(nil)
|
m.InitMap(nil)
|
||||||
m.SetMap()
|
// m.SetMap()
|
||||||
b := m.CheckAndRefreshPlat()
|
b := m.CheckAndRefreshPlat()
|
||||||
fmt.Printf("xxxx%v", b)
|
fmt.Printf("xxxx%v", b)
|
||||||
m.RedsetPlatData()
|
m.RedsetPlatData()
|
||||||
@ -112,7 +112,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, true)
|
m.SkillUp(1, 1, 7, true)
|
||||||
m.SwapGirde(1, 8)
|
m.SwapGirde(1, 8)
|
||||||
//m.CheckMap(1)
|
//m.CheckMap(1)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user