技能调整
This commit is contained in:
parent
330301441d
commit
223a0dcd1d
@ -505,12 +505,11 @@ func (this *MapData) SkillUp(pos int32, color int32, skillid int32, value int32,
|
|||||||
skillEnergy int32 // 技能获得的能量
|
skillEnergy int32 // 技能获得的能量
|
||||||
ids []int
|
ids []int
|
||||||
)
|
)
|
||||||
|
x = make(map[int]struct{})
|
||||||
if skillid == 1 { // 随机消除盘面上X个方块
|
if skillid == 1 { // 随机消除盘面上X个方块
|
||||||
x = make(map[int]struct{})
|
|
||||||
ids = utils.RandomNumbers(0, Total-1, int(value))
|
ids = utils.RandomNumbers(0, Total-1, int(value))
|
||||||
|
|
||||||
} else if skillid == 2 { // 找到pos 位置的所有方块
|
} else if skillid == 4 { // 找到pos 位置的所有方块
|
||||||
x := int(pos / Width)
|
x := int(pos / Width)
|
||||||
y := int(pos % Height)
|
y := int(pos % Height)
|
||||||
for i := 1; i < 7; i++ {
|
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 { //选中一个方块,然后消除盘面上所有相同颜色的方块。
|
} else if skillid == 3 || skillid == 5 { //选中一个方块,消除周围一圈
|
||||||
c := this.Plat[pos].Color
|
x := int(pos / Width)
|
||||||
for index, v1 := range this.Plat {
|
y := int(pos % Height)
|
||||||
if v1.Color == c {
|
if x-1 >= 0 { // 左
|
||||||
ids = append(ids, index)
|
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 {
|
for _, id := range ids {
|
||||||
|
@ -85,7 +85,7 @@ func Test_Main(t *testing.T) {
|
|||||||
m := new(entertainment.MapData)
|
m := new(entertainment.MapData)
|
||||||
m.InitMap(nil)
|
m.InitMap(nil)
|
||||||
m.Debugf()
|
m.Debugf()
|
||||||
m.SkillUp(24, 1, 2, 7, true)
|
m.SkillUp(24, 1, 3, 7, true)
|
||||||
// m.SetMap()
|
// m.SetMap()
|
||||||
b := m.CheckAndRefreshPlat()
|
b := m.CheckAndRefreshPlat()
|
||||||
fmt.Printf("xxxx%v", b)
|
fmt.Printf("xxxx%v", b)
|
||||||
|
Loading…
Reference in New Issue
Block a user