【bug风险较大,需要测试】解耦玩家代码中的部分混战模式代码

This commit is contained in:
MrZ626
2021-12-06 16:00:46 +08:00
parent ed002ec2e1
commit 9377090c7c
12 changed files with 28 additions and 62 deletions

View File

@@ -5,15 +5,22 @@ local setFont=setFont
local PLAYERS,PLY_ALIVE=PLAYERS,PLY_ALIVE
return{
layout='royale',
fkey1=function(P)
P:changeAtkMode(P.atkMode<3 and P.atkMode+2 or 5-P.atkMode)
P.swappingAtkMode=45
end,
mesDisp=function(P)
setFont(35)
mStr(#PLY_ALIVE.."/"..#PLAYERS,63,175)
mStr(P.modeData.ko,80,215)
gc_draw(TEXTOBJ.ko,60-TEXTOBJ.ko:getWidth(),222)
setFont(20)
gc_setColor(1,.5,0,.6)
gc_print(P.badge,103,227)
gc_setColor(.97,.97,.97)
setFont(25)
mStr(text.powerUp[P.strength],63,290)
gc_setColor(1,1,1)

View File

@@ -771,7 +771,7 @@ do--function resetGameData(args)
BGM.play(type(bgm)=='string'and bgm or type(bgm)=='table'and bgm[math.random(#bgm)])
TEXT.clear()
if GAME.modeEnv.royaleMode then
if GAME.modeEnv.eventset=='royale'then
for i=1,#PLAYERS do
PLAYERS[i]:changeAtk(randomTarget(PLAYERS[i]))
end

View File

@@ -1,14 +1,7 @@
local function selectTarget(P)
P:changeAtkMode(P.atkMode<3 and P.atkMode+2 or 5-P.atkMode)
P.swappingAtkMode=30
end
return{
env={
drop=60,lock=60,
fall=20,
royaleMode=true,
fkey1=selectTarget,
garbageSpeed=.3,
pushSpeed=2,
freshLimit=15,

View File

@@ -1,14 +1,7 @@
local function selectTarget(P)
P:changeAtkMode(P.atkMode<3 and P.atkMode+2 or 5-P.atkMode)
P.swappingAtkMode=30
end
return{
env={
drop=60,lock=60,
fall=20,
royaleMode=true,
fkey1=selectTarget,
garbageSpeed=.3,
pushSpeed=2,
freshLimit=15,

View File

@@ -1,14 +1,7 @@
local function selectTarget(P)
P:changeAtkMode(P.atkMode<3 and P.atkMode+2 or 5-P.atkMode)
P.swappingAtkMode=30
end
return{
env={
drop=15,lock=60,
fall=20,
royaleMode=true,
fkey1=selectTarget,
garbageSpeed=.3,
pushSpeed=2,
freshLimit=15,

View File

@@ -1,14 +1,7 @@
local function selectTarget(P)
P:changeAtkMode(P.atkMode<3 and P.atkMode+2 or 5-P.atkMode)
P.swappingAtkMode=30
end
return{
env={
drop=60,lock=60,
fall=20,
royaleMode=true,
fkey1=selectTarget,
garbageSpeed=.3,
pushSpeed=2,
freshLimit=15,

View File

@@ -1,14 +1,7 @@
local function selectTarget(P)
P:changeAtkMode(P.atkMode<3 and P.atkMode+2 or 5-P.atkMode)
P.swappingAtkMode=30
end
return{
env={
drop=60,lock=60,
fall=20,
royaleMode=true,
fkey1=selectTarget,
garbageSpeed=.3,
pushSpeed=2,
freshLimit=15,

View File

@@ -1,14 +1,7 @@
local function selectTarget(P)
P:changeAtkMode(P.atkMode<3 and P.atkMode+2 or 5-P.atkMode)
P.swappingAtkMode=30
end
return{
env={
drop=15,lock=60,
fall=20,
royaleMode=true,
fkey1=selectTarget,
garbageSpeed=.3,
pushSpeed=2,
freshLimit=15,

View File

@@ -11,7 +11,7 @@ local int,ceil,rnd=math.floor,math.ceil,math.random
local max,min,sin,modf=math.max,math.min,math.sin,math.modf
local setFont,mDraw,mStr=FONT.set,GC.draw,GC.mStr
local SKIN,TEXTURE,IMG=SKIN,TEXTURE,IMG
local TEXT,COLOR,GAME,TIME=TEXT,COLOR,GAME,TIME
local TEXT,COLOR,TIME=TEXT,COLOR,TIME
local shader_alpha,shader_lighter=SHADER.alpha,SHADER.lighter
local shader_fieldSatur,shader_blockSatur=SHADER.fieldSatur,SHADER.blockSatur
local TEXTOBJ,ENUM_MISSION,BLOCK_COLORS=TEXTOBJ,ENUM_MISSION,BLOCK_COLORS
@@ -862,12 +862,12 @@ function draw.norm(P,repMode)
_drawLDI(ENV.easyFresh,P.lockDelay/ENV.lock,P.freshTime)
--Draw target selecting pad
if GAME.modeEnv.royaleMode then
if ENV.layout=='royale'then
if P.atkMode then
gc_setColor(1,.8,0,P.swappingAtkMode*.02)
gc_setColor(1,.8,0,min(P.swappingAtkMode,30)*.02)
gc_rectangle('fill',RCPB[2*P.atkMode-1],RCPB[2*P.atkMode],90,35,8,4)
end
gc_setColor(1,1,1,P.swappingAtkMode*.025)
gc_setColor(1,1,1,min(P.swappingAtkMode,30)*.025)
setFont(35)
gc_setLineWidth(1)
for i=1,4 do
@@ -953,7 +953,7 @@ function draw.small(P)
end
--Draw badge
if GAME.modeEnv.royaleMode then
if P.gameEnv.layout=='royale'then
gc_setColor(1,1,1)
for i=1,P.strength do
gc_draw(IMG.badgeIcon,12*i-7,4,nil,.5)

View File

@@ -53,6 +53,7 @@ return{
bufferLimit=1e99,
fillClear=true,
layout='normal',
fkey1=false,fkey2=false,
keyCancel={},
fine=false,fineKill=false,

View File

@@ -193,9 +193,9 @@ function Player:createBeam(R,send)
local c=BLOCK_COLORS[color]
local r,g,b=c[1]*2,c[2]*2,c[3]*2
local a=GAME.modeEnv.royaleMode and not(self.type=='human'or R.type=='human')and .2 or 1
SYSFX.newAttack(1-power*.1,x1,y1,x2,y2,int(send^.7*(4+power)),r,g,b,a*(power+2)*.0626)
local a=(power+2)*.0626
if self.type~='human'and R.type~='human'then a=a*.2 end
SYSFX.newAttack(1-power*.1,x1,y1,x2,y2,int(send^.7*(4+power)),r,g,b,a)
end
end
--------------------------</FX>--------------------------
@@ -1847,7 +1847,7 @@ do
end
--Bonus atk/def when focused
if GAME.modeEnv.royaleMode then
if ENV.layout=='royale'then
local i=min(#self.atker,9)
if i>1 then
atk=atk+reAtk[i]
@@ -1870,7 +1870,7 @@ do
off=off+_
if send>0 then
local T
if GAME.modeEnv.royaleMode then
if ENV.layout=='royale'then
if self.atkMode==4 then
local M=#self.atker
if M>0 then
@@ -2144,7 +2144,7 @@ local function task_lose(self)
return
end
end
if not GAME.modeEnv.royaleMode and #PLAYERS>1 then
if not self.gameEnv.layout=='royale'and #PLAYERS>1 then
self.y=self.y+self.endCounter*.26
self.absFieldY=self.absFieldY+self.endCounter*.26
end
@@ -2339,7 +2339,7 @@ local function update_alive(P)
P.dropSpeed=P.dropSpeed*.99+v*.01
end
if GAME.modeEnv.royaleMode then
if P.gameEnv.layout=='royale'then
local v=P.swappingAtkMode
local tar=#P.field>15 and 4 or 8
if v~=tar then
@@ -2596,7 +2596,7 @@ local function update_dead(P)
--Final average speed
P.dropSpeed=P.dropSpeed*.96+S.piece/S.frame*144
if GAME.modeEnv.royaleMode then
if P.gameEnv.layout=='royale'then
P.swappingAtkMode=min(P.swappingAtkMode+2,30)
end
@@ -2714,7 +2714,7 @@ function Player:win(result)
end
self:_die()
self.result='win'
if GAME.modeEnv.royaleMode then
if self.gameEnv.layout=='royale'then
self.modeData.place=1
self:changeAtk()
end
@@ -2729,7 +2729,7 @@ function Player:win(result)
GAME.result=result or'gamewin'
SFX.play('win')
VOC.play('win')
if GAME.modeEnv.royaleMode then
if self.gameEnv.layout=='royale'then
BGM.play('8-bit happiness')
end
end
@@ -2760,7 +2760,7 @@ function Player:lose(force)
self:_die()
self.result='lose'
do local p=TABLE.find(PLY_ALIVE,self)if p then rem(PLY_ALIVE,p)end end
if GAME.modeEnv.royaleMode then
if self.gameEnv.layout=='royale'then
self:changeAtk()
self.modeData.place=#PLY_ALIVE+1
self.strength=0
@@ -2802,7 +2802,7 @@ function Player:lose(force)
GAME.result='gameover'
SFX.play('fail')
VOC.play('lose')
if GAME.modeEnv.royaleMode then
if self.gameEnv.layout=='royale'then
BGM.play('end')
end
gameOver()

View File

@@ -293,7 +293,7 @@ local function _update_common(dt)
for p=1,#PLAYERS do PLAYERS[p]:update(dt)end
--Fresh royale target
if GAME.modeEnv.royaleMode and PLAYERS[1].frameRun%120==0 then
if PLAYERS[1].frameRun%120==0 and PLAYERS[1].gameEnv.layout=='royale'then
freshMostDangerous()
end
@@ -339,7 +339,7 @@ function scene.draw()
VK.draw()
--Attacking & Being attacked
if GAME.modeEnv.royaleMode then
if PLAYERS[1].gameEnv.layout=='royale'then
local P=PLAYERS[1]
gc_setLineWidth(5)
gc_setColor(.8,1,0,.2)