From 172c5d1069efd7ecdb3f8039517aadac0ad58563 Mon Sep 17 00:00:00 2001 From: MrZ_26 <1046101471@qq.com> Date: Wed, 24 Jul 2024 16:29:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E7=9A=84drill=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E5=9E=83=E5=9C=BE=E8=A1=8C=E7=94=9F=E6=88=90=E7=AE=97=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/game/brikPlayer.lua | 2 +- assets/game/mechanicLib/brik/dig.lua | 30 +++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/assets/game/brikPlayer.lua b/assets/game/brikPlayer.lua index 2cc3039f..1dda48bb 100644 --- a/assets/game/brikPlayer.lua +++ b/assets/game/brikPlayer.lua @@ -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 diff --git a/assets/game/mechanicLib/brik/dig.lua b/assets/game/mechanicLib/brik/dig.lua index 6ea54c79..846768e0 100644 --- a/assets/game/mechanicLib/brik/dig.lua +++ b/assets/game/mechanicLib/brik/dig.lua @@ -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({})