整理代码,略微优化性能,调整玩家攻击力和框颜色相关代码,联网对战每分钟会增加攻击力
This commit is contained in:
8
main.lua
8
main.lua
@@ -55,10 +55,6 @@ end
|
||||
require"Zframework"
|
||||
SCR.setSize(1280,720)--Initialize Screen size
|
||||
|
||||
require"parts.list"
|
||||
require"parts.globalTables"
|
||||
require"parts.gametoolfunc"
|
||||
|
||||
--Load shader files from SOURCE ONLY
|
||||
SHADER={}
|
||||
for _,v in next,fs.getDirectoryItems("parts/shaders")do
|
||||
@@ -68,6 +64,10 @@ for _,v in next,fs.getDirectoryItems("parts/shaders")do
|
||||
end
|
||||
end
|
||||
|
||||
require"parts.list"
|
||||
require"parts.globalTables"
|
||||
require"parts.gametoolfunc"
|
||||
|
||||
FREEROW= require"parts.freeRow"
|
||||
DATA= require"parts.data"
|
||||
|
||||
|
||||
@@ -579,20 +579,22 @@ do--function drawSelfProfile()
|
||||
gc.pop()
|
||||
end
|
||||
end
|
||||
function drawWarning()
|
||||
if SETTING.warn and GAME.warnLVL>0 then
|
||||
gc.push('transform')
|
||||
gc.origin()
|
||||
SHADER.warning:send("level",GAME.warnLVL)
|
||||
gc.setShader(SHADER.warning)
|
||||
gc.rectangle('fill',0,0,SCR.w,SCR.h)
|
||||
gc.setShader()
|
||||
gc.pop()
|
||||
do--function drawWarning()
|
||||
local SETTING,GAME,shader_warning,SCR=SETTING,GAME,SHADER.warning,SCR
|
||||
function drawWarning()
|
||||
if SETTING.warn and GAME.warnLVL>0 then
|
||||
gc.push('transform')
|
||||
gc.origin()
|
||||
shader_warning:send("level",GAME.warnLVL)
|
||||
gc.setShader(shader_warning)
|
||||
gc.rectangle('fill',0,0,SCR.w,SCR.h)
|
||||
gc.setShader()
|
||||
gc.pop()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
--Widget function shortcuts
|
||||
function backScene()SCN.back()end
|
||||
do--function goScene(name,style)
|
||||
|
||||
@@ -11,6 +11,7 @@ return{
|
||||
|
||||
atkModeName={"Random","Badges","K.O.s","Attackers"},
|
||||
royale_remain="$1 Player(s) Remaining",
|
||||
powerUp={[0]="000%UP","025%UP","050%UP","075%UP","100%UP"},
|
||||
cmb={nil,"1 Combo","2 Combo","3 Combo","4 Combo","5 Combo","6 Combo","7 Combo","8 Combo","9 Combo","10 Combo!","11 Combo!","12 Combo!","13 Combo!","14 Combo!!","15 Combo!!","16 Combo!!","17 Combo!!!","18 Combo!!!","19 Combo!!!","MEGACMB"},
|
||||
spin="-Spin ",
|
||||
clear={"Single","Double","Triple","Techrash","Pentacrash","Hexacrash"},
|
||||
|
||||
@@ -11,6 +11,7 @@ return{
|
||||
|
||||
atkModeName={"随机","徽章","击杀","反击"},
|
||||
royale_remain="剩余 $1 名玩家",
|
||||
powerUp={[0]="000%UP","025%UP","050%UP","075%UP","100%UP"},
|
||||
cmb={nil,"1 Combo","2 Combo","3 Combo","4 Combo","5 Combo","6 Combo","7 Combo","8 Combo","9 Combo","10 Combo!","11 Combo!","12 Combo!","13 Combo!","14 Combo!","15 Combo!","16 Combo!","17 Combo!","18 Combo!","19 Combo!","MEGACMB"},
|
||||
spin="-spin ",
|
||||
clear={"single","double","triple","Techrash","Pentcrash","Hexcrash"},
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
local yield=YIELD
|
||||
return{
|
||||
color=COLOR.white,
|
||||
env={
|
||||
@@ -6,6 +7,13 @@ return{
|
||||
pushSpeed=5,
|
||||
garbageSpeed=2,
|
||||
allowMod=false,
|
||||
task=function(P)
|
||||
local S=P.stat
|
||||
while true do yield()if S.time>60 then P.strength=1 break end end
|
||||
while true do yield()if S.time>120 then P.strength=2 break end end
|
||||
while true do yield()if S.time>180 then P.strength=3 break end end
|
||||
while true do yield()if S.time>240 then P.strength=4 break end end
|
||||
end,
|
||||
bgm={'battle','cruelty','distortion','far','final','hope','magicblock','new era','push','race','rockblock','secret7th','secret8th','shining terminal','storm','super7th','warped','waterfall'},
|
||||
},
|
||||
load=function()
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
local gc=love.graphics
|
||||
local rnd=math.random
|
||||
local powerUp={[0]="000%UP","025%UP","050%UP","075%UP","100%UP",}
|
||||
local function selectTarget(P)
|
||||
if SETTING.swap then
|
||||
for i=1,#P.keyPressing do
|
||||
@@ -34,23 +32,23 @@ return{
|
||||
local L={}for i=1,49 do L[i]=true end
|
||||
local t=CC and 2 or 0
|
||||
while t>0 do
|
||||
local r=rnd(2,49)
|
||||
local r=math.random(2,49)
|
||||
if L[r]then L[r],t=false,t-1 end
|
||||
end
|
||||
local n=2
|
||||
for _=1,4 do for _=1,6 do
|
||||
if L[n]then
|
||||
PLY.newAIPlayer(n,AIBUILDER('9S',rnd(4,6)),true)
|
||||
PLY.newAIPlayer(n,AIBUILDER('9S',math.random(4,6)),true)
|
||||
else
|
||||
PLY.newAIPlayer(n,AIBUILDER('CC',rnd(2,4),2,true,20000),true)
|
||||
PLY.newAIPlayer(n,AIBUILDER('CC',math.random(2,4),2,true,20000),true)
|
||||
end
|
||||
n=n+1
|
||||
end end
|
||||
for _=9,12 do for _=1,6 do
|
||||
if L[n]then
|
||||
PLY.newAIPlayer(n,AIBUILDER('9S',rnd(4,5)),true)
|
||||
PLY.newAIPlayer(n,AIBUILDER('9S',math.random(4,5)),true)
|
||||
else
|
||||
PLY.newAIPlayer(n,AIBUILDER('CC',rnd(3,5),2,true,20000),true)
|
||||
PLY.newAIPlayer(n,AIBUILDER('CC',math.random(3,5),2,true,20000),true)
|
||||
end
|
||||
n=n+1
|
||||
end end
|
||||
@@ -65,7 +63,7 @@ return{
|
||||
gc.print(P.badge,103,227)
|
||||
gc.setColor(1,1,1)
|
||||
setFont(25)
|
||||
gc.print(powerUp[P.strength],18,290)
|
||||
gc.print(text.powerUp[P.strength],18,290)
|
||||
for i=1,P.strength do
|
||||
gc.draw(IMG.badgeIcon,16*i+12,260)
|
||||
end
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
local gc=love.graphics
|
||||
local rnd=math.random
|
||||
local powerUp={[0]="000%UP","025%UP","050%UP","075%UP","100%UP",}
|
||||
local function selectTarget(P)
|
||||
if SETTING.swap then
|
||||
for i=1,#P.keyPressing do
|
||||
@@ -34,23 +32,23 @@ return{
|
||||
local L={}for i=1,49 do L[i]=true end
|
||||
local t=CC and 4 or 0
|
||||
while t>0 do
|
||||
local r=rnd(2,49)
|
||||
local r=math.random(2,49)
|
||||
if L[r]then L[r],t=false,t-1 end
|
||||
end
|
||||
local n=2
|
||||
for _=1,4 do for _=1,6 do
|
||||
if L[n]then
|
||||
PLY.newAIPlayer(n,AIBUILDER('9S',rnd(4,8)),true)
|
||||
PLY.newAIPlayer(n,AIBUILDER('9S',math.random(4,8)),true)
|
||||
else
|
||||
PLY.newAIPlayer(n,AIBUILDER('CC',rnd(3,6),3,true,30000),true)
|
||||
PLY.newAIPlayer(n,AIBUILDER('CC',math.random(3,6),3,true,30000),true)
|
||||
end
|
||||
n=n+1
|
||||
end end
|
||||
for _=9,12 do for _=1,6 do
|
||||
if L[n]then
|
||||
PLY.newAIPlayer(n,AIBUILDER('9S',rnd(4,7)),true)
|
||||
PLY.newAIPlayer(n,AIBUILDER('9S',math.random(4,7)),true)
|
||||
else
|
||||
PLY.newAIPlayer(n,AIBUILDER('CC',rnd(4,6),3,true,30000),true)
|
||||
PLY.newAIPlayer(n,AIBUILDER('CC',math.random(4,6),3,true,30000),true)
|
||||
end
|
||||
n=n+1
|
||||
end end
|
||||
@@ -65,7 +63,7 @@ return{
|
||||
gc.print(P.badge,103,227)
|
||||
gc.setColor(1,1,1)
|
||||
setFont(25)
|
||||
gc.print(powerUp[P.strength],18,290)
|
||||
gc.print(text.powerUp[P.strength],18,290)
|
||||
for i=1,P.strength do
|
||||
gc.draw(IMG.badgeIcon,16*i+12,260)
|
||||
end
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
local gc=love.graphics
|
||||
local rnd=math.random
|
||||
local powerUp={[0]="000%UP","025%UP","050%UP","075%UP","100%UP",}
|
||||
local function selectTarget(P)
|
||||
if SETTING.swap then
|
||||
for i=1,#P.keyPressing do
|
||||
@@ -34,23 +32,23 @@ return{
|
||||
local L={}for i=1,49 do L[i]=true end
|
||||
local t=CC and 6 or 0
|
||||
while t>0 do
|
||||
local r=rnd(2,49)
|
||||
local r=math.random(2,49)
|
||||
if L[r]then L[r],t=false,t-1 end
|
||||
end
|
||||
local n=2
|
||||
for _=1,4 do for _=1,6 do
|
||||
if L[n]then
|
||||
PLY.newAIPlayer(n,AIBUILDER('9S',rnd(8,10)),true)
|
||||
PLY.newAIPlayer(n,AIBUILDER('9S',math.random(8,10)),true)
|
||||
else
|
||||
PLY.newAIPlayer(n,AIBUILDER('CC',rnd(4,7),3,true,40000),true)
|
||||
PLY.newAIPlayer(n,AIBUILDER('CC',math.random(4,7),3,true,40000),true)
|
||||
end
|
||||
n=n+1
|
||||
end end
|
||||
for _=9,12 do for _=1,6 do
|
||||
if L[n]then
|
||||
PLY.newAIPlayer(n,AIBUILDER('9S',rnd(8,9)),true)
|
||||
PLY.newAIPlayer(n,AIBUILDER('9S',math.random(8,9)),true)
|
||||
else
|
||||
PLY.newAIPlayer(n,AIBUILDER('CC',rnd(5,8),3,true,40000),true)
|
||||
PLY.newAIPlayer(n,AIBUILDER('CC',math.random(5,8),3,true,40000),true)
|
||||
end
|
||||
n=n+1
|
||||
end end
|
||||
@@ -65,7 +63,7 @@ return{
|
||||
gc.print(P.badge,103,227)
|
||||
gc.setColor(1,1,1)
|
||||
setFont(25)
|
||||
gc.print(powerUp[P.strength],18,290)
|
||||
gc.print(text.powerUp[P.strength],18,290)
|
||||
for i=1,P.strength do
|
||||
gc.draw(IMG.badgeIcon,16*i+12,260)
|
||||
end
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
local gc=love.graphics
|
||||
local rnd=math.random
|
||||
local powerUp={[0]="000%UP","025%UP","050%UP","075%UP","100%UP",}
|
||||
local function selectTarget(P)
|
||||
if SETTING.swap then
|
||||
for i=1,#P.keyPressing do
|
||||
@@ -34,23 +32,23 @@ return{
|
||||
local L={}for i=1,100 do L[i]=true end
|
||||
local t=CC and 4 or 0
|
||||
while t>0 do
|
||||
local r=rnd(2,99)
|
||||
local r=math.random(2,99)
|
||||
if L[r]then L[r],t=false,t-1 end
|
||||
end
|
||||
local n=2
|
||||
for _=1,7 do for _=1,7 do
|
||||
if L[n]then
|
||||
PLY.newAIPlayer(n,AIBUILDER('9S',rnd(4,6)),true)
|
||||
PLY.newAIPlayer(n,AIBUILDER('9S',math.random(4,6)),true)
|
||||
else
|
||||
PLY.newAIPlayer(n,AIBUILDER('CC',rnd(2,4),2,true,20000),true)
|
||||
PLY.newAIPlayer(n,AIBUILDER('CC',math.random(2,4),2,true,20000),true)
|
||||
end
|
||||
n=n+1
|
||||
end end
|
||||
for _=15,21 do for _=1,7 do
|
||||
if L[n]then
|
||||
PLY.newAIPlayer(n,AIBUILDER('9S',rnd(4,5)),true)
|
||||
PLY.newAIPlayer(n,AIBUILDER('9S',math.random(4,5)),true)
|
||||
else
|
||||
PLY.newAIPlayer(n,AIBUILDER('CC',rnd(3,5),2,true,20000),true)
|
||||
PLY.newAIPlayer(n,AIBUILDER('CC',math.random(3,5),2,true,20000),true)
|
||||
end
|
||||
n=n+1
|
||||
end end
|
||||
@@ -65,7 +63,7 @@ return{
|
||||
gc.print(P.badge,103,227)
|
||||
gc.setColor(1,1,1)
|
||||
setFont(25)
|
||||
gc.print(powerUp[P.strength],18,290)
|
||||
gc.print(text.powerUp[P.strength],18,290)
|
||||
for i=1,P.strength do
|
||||
gc.draw(IMG.badgeIcon,16*i+12,260)
|
||||
end
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
local gc=love.graphics
|
||||
local rnd=math.random
|
||||
local powerUp={[0]="000%UP","025%UP","050%UP","075%UP","100%UP",}
|
||||
local function selectTarget(P)
|
||||
if SETTING.swap then
|
||||
for i=1,#P.keyPressing do
|
||||
@@ -34,23 +32,23 @@ return{
|
||||
local L={}for i=1,100 do L[i]=true end
|
||||
local t=CC and 4 or 0
|
||||
while t>0 do
|
||||
local r=rnd(2,99)
|
||||
local r=math.random(2,99)
|
||||
if L[r]then L[r],t=false,t-1 end
|
||||
end
|
||||
local n=2
|
||||
for _=1,7 do for _=1,7 do
|
||||
if L[n]then
|
||||
PLY.newAIPlayer(n,AIBUILDER('9S',rnd(4,8)),true)
|
||||
PLY.newAIPlayer(n,AIBUILDER('9S',math.random(4,8)),true)
|
||||
else
|
||||
PLY.newAIPlayer(n,AIBUILDER('CC',rnd(3,6),3,true,30000),true)
|
||||
PLY.newAIPlayer(n,AIBUILDER('CC',math.random(3,6),3,true,30000),true)
|
||||
end
|
||||
n=n+1
|
||||
end end
|
||||
for _=15,21 do for _=1,7 do
|
||||
if L[n]then
|
||||
PLY.newAIPlayer(n,AIBUILDER('9S',rnd(4,7)),true)
|
||||
PLY.newAIPlayer(n,AIBUILDER('9S',math.random(4,7)),true)
|
||||
else
|
||||
PLY.newAIPlayer(n,AIBUILDER('CC',rnd(4,6),3,true,30000),true)
|
||||
PLY.newAIPlayer(n,AIBUILDER('CC',math.random(4,6),3,true,30000),true)
|
||||
end
|
||||
n=n+1
|
||||
end end
|
||||
@@ -65,7 +63,7 @@ return{
|
||||
gc.print(P.badge,103,227)
|
||||
gc.setColor(1,1,1)
|
||||
setFont(25)
|
||||
gc.print(powerUp[P.strength],18,290)
|
||||
gc.print(text.powerUp[P.strength],18,290)
|
||||
for i=1,P.strength do
|
||||
gc.draw(IMG.badgeIcon,16*i+12,260)
|
||||
end
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
local gc=love.graphics
|
||||
local rnd=math.random
|
||||
local powerUp={[0]="000%UP","025%UP","050%UP","075%UP","100%UP",}
|
||||
local function selectTarget(P)
|
||||
if SETTING.swap then
|
||||
for i=1,#P.keyPressing do
|
||||
@@ -34,23 +32,23 @@ return{
|
||||
local L={}for i=1,100 do L[i]=true end
|
||||
local t=CC and 4 or 0
|
||||
while t>0 do
|
||||
local r=rnd(2,99)
|
||||
local r=math.random(2,99)
|
||||
if L[r]then L[r],t=false,t-1 end
|
||||
end
|
||||
local n=2
|
||||
for _=1,7 do for _=1,7 do
|
||||
if L[n]then
|
||||
PLY.newAIPlayer(n,AIBUILDER('9S',rnd(8,10)),true)
|
||||
PLY.newAIPlayer(n,AIBUILDER('9S',math.random(8,10)),true)
|
||||
else
|
||||
PLY.newAIPlayer(n,AIBUILDER('CC',rnd(4,7),3,true,40000),true)
|
||||
PLY.newAIPlayer(n,AIBUILDER('CC',math.random(4,7),3,true,40000),true)
|
||||
end
|
||||
n=n+1
|
||||
end end
|
||||
for _=15,21 do for _=1,7 do
|
||||
if L[n]then
|
||||
PLY.newAIPlayer(n,AIBUILDER('9S',rnd(8,9)),true)
|
||||
PLY.newAIPlayer(n,AIBUILDER('9S',math.random(8,9)),true)
|
||||
else
|
||||
PLY.newAIPlayer(n,AIBUILDER('CC',rnd(5,8),3,true,40000),true)
|
||||
PLY.newAIPlayer(n,AIBUILDER('CC',math.random(5,8),3,true,40000),true)
|
||||
end
|
||||
n=n+1
|
||||
end end
|
||||
@@ -65,7 +63,7 @@ return{
|
||||
gc.print(P.badge,103,227)
|
||||
gc.setColor(1,1,1)
|
||||
setFont(25)
|
||||
gc.print(powerUp[P.strength],18,290)
|
||||
gc.print(text.powerUp[P.strength],18,290)
|
||||
for i=1,P.strength do
|
||||
gc.draw(IMG.badgeIcon,16*i+12,260)
|
||||
end
|
||||
|
||||
@@ -16,7 +16,6 @@ local shader_alpha,shader_lighter=SHADER.alpha,SHADER.lighter
|
||||
local drawableText,missionEnum,minoColor=drawableText,missionEnum,minoColor
|
||||
|
||||
local RCPB={5,33,195,33,100,5,100,60}
|
||||
local frameColorList={[0]=COLOR.Z,COLOR.lG,COLOR.lB,COLOR.lV,COLOR.lO}
|
||||
local attackColor={
|
||||
{COLOR.dH,COLOR.Z},
|
||||
{COLOR.H,COLOR.Z},
|
||||
@@ -239,7 +238,7 @@ local function drawNextPreview(P,B)
|
||||
end
|
||||
local function drawBoarders(P)
|
||||
gc_setLineWidth(2)
|
||||
gc_setColor(frameColorList[P.frameColor])
|
||||
gc_setColor(P.frameColor)
|
||||
gc_rectangle('line',-1,-11,302,612)--Bis Boarder
|
||||
gc_rectangle('line',301,-3,15,604)--AtkBuffer boarder
|
||||
gc_rectangle('line',-16,-3,15,604)--B2b bar boarder
|
||||
@@ -836,7 +835,7 @@ function draw.small(P)
|
||||
--Draw boarder
|
||||
if P.alive then
|
||||
gc_setLineWidth(2)
|
||||
gc_setColor(frameColorList[P.frameColor])
|
||||
gc_setColor(P.frameColor)
|
||||
gc_rectangle('line',0,0,60,120)
|
||||
end
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ local function newEmptyPlayer(id,mini)
|
||||
a=0,va=0,
|
||||
}
|
||||
P.x,P.y,P.size=0,0,1
|
||||
P.frameColor=0
|
||||
P.frameColor=COLOR.Z
|
||||
|
||||
--Set these at Player:setPosition()
|
||||
-- P.fieldX,P.fieldY=...
|
||||
|
||||
@@ -149,29 +149,35 @@ function Player:setPosition(x,y,size)
|
||||
self.absFieldX,self.absFieldY=x+150*size,y-10*size
|
||||
end
|
||||
end
|
||||
local function task_movePosition(self,x,y,size)
|
||||
local x1,y1,size1=self.x,self.y,self.size
|
||||
while true do
|
||||
yield()
|
||||
if (x1-x)^2+(y1-y)^2<1 then
|
||||
self:setPosition(x,y,size)
|
||||
return true
|
||||
else
|
||||
x1=x1+(x-x1)*.126
|
||||
y1=y1+(y-y1)*.126
|
||||
size1=size1+(size-size1)*.126
|
||||
self:setPosition(x1,y1,size1)
|
||||
do--function Player:movePosition(x,y,size)
|
||||
local function task_movePosition(self,x,y,size)
|
||||
local x1,y1,size1=self.x,self.y,self.size
|
||||
while true do
|
||||
yield()
|
||||
if (x1-x)^2+(y1-y)^2<1 then
|
||||
self:setPosition(x,y,size)
|
||||
return true
|
||||
else
|
||||
x1=x1+(x-x1)*.126
|
||||
y1=y1+(y-y1)*.126
|
||||
size1=size1+(size-size1)*.126
|
||||
self:setPosition(x1,y1,size1)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
local function checkPlayer(obj,Ptar)
|
||||
return obj.args[1]==Ptar
|
||||
end
|
||||
function Player:movePosition(x,y,size)
|
||||
TASK.removeTask_iterate(checkPlayer,self)
|
||||
TASK.new(task_movePosition,self,x,y,size or self.size)
|
||||
local function checkPlayer(obj,Ptar)
|
||||
return obj.args[1]==Ptar
|
||||
end
|
||||
function Player:movePosition(x,y,size)
|
||||
TASK.removeTask_iterate(checkPlayer,self)
|
||||
TASK.new(task_movePosition,self,x,y,size or self.size)
|
||||
end
|
||||
end
|
||||
|
||||
local frameColorList={[0]=COLOR.Z,COLOR.lG,COLOR.lB,COLOR.lV,COLOR.lO}
|
||||
function Player:setFrameColor(c)
|
||||
self.frameColor=frameColorList[c]
|
||||
end
|
||||
function Player:switchKey(id,on)
|
||||
self.keyAvailable[id]=on
|
||||
if not on then
|
||||
@@ -1723,19 +1729,19 @@ function Player:lose(force)
|
||||
self.modeData.place=#PLY_ALIVE+1
|
||||
self.strength=0
|
||||
if self.lastRecv then
|
||||
local A,i=self,0
|
||||
local A,depth=self,0
|
||||
repeat
|
||||
A,i=A.lastRecv,i+1
|
||||
until not A or A.alive or A==self or i==3
|
||||
A,depth=A.lastRecv,depth+1
|
||||
until not A or A.alive or A==self or depth==3
|
||||
if A and A.alive then
|
||||
if self.id==1 or A.id==1 then
|
||||
self.killMark=A.id==1
|
||||
end
|
||||
A.modeData.ko,A.badge=A.modeData.ko+1,A.badge+self.badge+1
|
||||
for j=A.strength+1,4 do
|
||||
if A.badge>=ROYALEDATA.powerUp[j]then
|
||||
A.strength=j
|
||||
A.frameColor=A.strength
|
||||
for i=A.strength+1,4 do
|
||||
if A.badge>=ROYALEDATA.powerUp[i]then
|
||||
A.strength=i
|
||||
A:setFrameColor(A.strength)
|
||||
end
|
||||
end
|
||||
self.lastRecv=A
|
||||
|
||||
Reference in New Issue
Block a user