Skip to content

Commit

Permalink
琼晶机制库添加classic攻击系统
Browse files Browse the repository at this point in the history
  • Loading branch information
MrZ626 committed May 14, 2024
1 parent 3a03543 commit 69a0103
Showing 1 changed file with 40 additions and 1 deletion.
41 changes: 40 additions & 1 deletion assets/game/mechanicLib/gela/attackSys.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,47 @@ atkSys.none={

-- Classic
atkSys.classic={
init=function(P)
P.atkSysData.remainder=0
end,
clear=function(P)
-- TODO
local sizes={}
for i=1,#P.clearingGroups do
sizes[i]=TABLE.getSize(P.clearingGroups[i])
end
local chip,mult=TABLE.sum(sizes)*10,0

-- Chain Score
-- 0,8,16,32,64,96,128,160,192,224,256,288,320,352,384,416,448,480,512,...
mult=mult+(P.chain<=3 and 8*(P.chain-1) or 32*(P.chain-3))

-- Color (Group) Count Score
-- 0,3,6,12,24,...
local colors=#P.clearingGroups
mult=mult+(
colors==1 and 0 or
colors==2 and 3 or
6*(2^(colors-3))
)

-- Group Size Score
-- 0,0,0,0,2,3,4,5,6,7,10+
for i=1,#sizes do
mult=mult+(
sizes[i]==4 and 0 or
sizes[i]<=10 and sizes[i]-3 or
10
)
end

if mult==0 then mult=1 end
local score=(P.atkSysData.remainder+chip*mult)

local power=math.floor(score/70)
P.atkSysData.remainder=score-power*70
if power>0 then
return {power=power,time=1000}
end
end,
}

Expand Down

0 comments on commit 69a0103

Please sign in to comment.