Skip to content

Commit

Permalink
新的drill模式垃圾行生成算法
Browse files Browse the repository at this point in the history
  • Loading branch information
MrZ626 committed Jul 24, 2024
1 parent df01b16 commit 172c5d1
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
2 changes: 1 addition & 1 deletion assets/game/brikPlayer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1315,7 +1315,7 @@ function BP:riseGarbage(holePos,count)
L[holePos[i]]=false
end
else
L[rnd(w)]=false
L[self:random(w)]=false
end

-- Add connection
Expand Down
30 changes: 29 additions & 1 deletion assets/game/mechanicLib/brik/dig.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,35 @@ local garbageTypes={
P.modeData.garbageRised=P.modeData.garbageRised+1
end,
drill=function(P)
P:riseGarbage()
if not P.modeData.dig_drill_init then
P.modeData.dig_drill_init=true
P.modeData.dig_drill_data=TABLE.new(10,P.settings.fieldW)
end

local d=P.modeData.dig_drill_data
local sum=0
for i=1,#d do
sum=sum+d[i]
end
local r=P:random(sum)
for x=1,#d do
r=r-d[x]
if r<=0 then
r=x
break
end
end
P:riseGarbage(r)

for x=1,P.settings.fieldW do
local dist=math.abs(x-r)
if dist<=2 then
d[x]=math.max(d[x]-(dist==0 and 26 or dist==1 and 5 or 2),0)
else
d[x]=math.min(d[x]+3,12)
end
end
print(table.concat(d,' '))
end,
solid=function(P)
P:riseGarbage({})
Expand Down

0 comments on commit 172c5d1

Please sign in to comment.