技能调整

This commit is contained in:
meixiongfeng 2023-11-02 10:11:14 +08:00
parent 330301441d
commit 223a0dcd1d
2 changed files with 35 additions and 10 deletions

View File

@ -505,12 +505,11 @@ func (this *MapData) SkillUp(pos int32, color int32, skillid int32, value int32,
skillEnergy int32 // 技能获得的能量
ids []int
)
x = make(map[int]struct{})
if skillid == 1 { // 随机消除盘面上X个方块
x = make(map[int]struct{})
ids = utils.RandomNumbers(0, Total-1, int(value))
} else if skillid == 2 { // 找到pos 位置的所有方块
} else if skillid == 4 { // 找到pos 位置的所有方块
x := int(pos / Width)
y := int(pos % Height)
for i := 1; i < 7; i++ {
@ -530,12 +529,38 @@ func (this *MapData) SkillUp(pos int32, color int32, skillid int32, value int32,
}
}
} else if skillid == 3 { //选中一个方块,然后消除盘面上所有相同颜色的方块。
c := this.Plat[pos].Color
for index, v1 := range this.Plat {
if v1.Color == c {
ids = append(ids, index)
}
} else if skillid == 3 || skillid == 5 { //选中一个方块,消除周围一圈
x := int(pos / Width)
y := int(pos % Height)
if x-1 >= 0 { // 左
ids = append(ids, (x-1)*Width+(y))
}
if y-1 >= 0 { // 下
ids = append(ids, (x)*Width+(y-1))
}
if y+1 < Height { // 上
ids = append(ids, (x)*Width+(y+1))
}
if x+1 < Width { // 右
ids = append(ids, (x+1)*Width+(y))
}
if x-1 >= 0 && y+1 < Height { // 左上
ids = append(ids, (x-1)*Width+(y+1))
}
if x-1 >= 0 && y-1 >= 0 { // 左下
ids = append(ids, (x-1)*Width+(y-1))
}
if x+1 < Width && y+1 < Height { // 右上
ids = append(ids, (x+1)*Width+(y+1))
}
if x+1 < Width && y-1 >= 0 { // 右下
ids = append(ids, (x+1)*Width+(y-1))
}
} else if skillid == 2 { // 消除中间的一列宝石
for i := 0; i < Height; i++ {
ids = append(ids, 3*Width+i)
}
}
for _, id := range ids {

View File

@ -85,7 +85,7 @@ func Test_Main(t *testing.T) {
m := new(entertainment.MapData)
m.InitMap(nil)
m.Debugf()
m.SkillUp(24, 1, 2, 7, true)
m.SkillUp(24, 1, 3, 7, true)
// m.SetMap()
b := m.CheckAndRefreshPlat()
fmt.Printf("xxxx%v", b)