diff --git a/parts/player/draw.lua b/parts/player/draw.lua index f3720e6a..39a4d371 100644 --- a/parts/player/draw.lua +++ b/parts/player/draw.lua @@ -271,6 +271,16 @@ local function drawBuffer(P) end h=h+bar end + local sum=P.atkBufferSum1 + if sum>=8 then + gc_push('transform') + gc_translate(300,max(0,600-30*sum)) + gc_scale(min(.2+sum/50,1)) + setFont(100) + gc_setColor(1,.2+min(sum*.02,.8)*(.5+.5*sin(TIME()*min(sum,32))),.2,min(sum/30,.8)) + gc_printf(int(P.atkBufferSum1),-300,-20,292,'right') + gc_pop() + end end local function drawB2Bbar(P) local a,b=P.b2b,P.b2b1 if a>b then a,b=b,a end diff --git a/parts/player/init.lua b/parts/player/init.lua index af14b76e..9844a160 100644 --- a/parts/player/init.lua +++ b/parts/player/init.lua @@ -129,6 +129,7 @@ local function newEmptyPlayer(id,mini) P.field,P.visTime={},{} P.atkBuffer={} P.atkBufferSum=0 + P.atkBufferSum1=0 --Royale-related P.badge,P.strength=0,0 diff --git a/parts/player/player.lua b/parts/player/player.lua index 34b36f30..8b42fcd3 100644 --- a/parts/player/player.lua +++ b/parts/player/player.lua @@ -391,6 +391,16 @@ function Player:receive(A,send,time,line) end end end +function Player:clearAttackBuffer() + for i=1,#self.atkBuffer do + local A=self.atkBuffer[i] + if not A.sent then + A.sent=true + A.time=0 + end + end + self.atkBufferSum=0 +end function Player:freshTarget() if self.atkMode==1 then if not self.atking or not self.atking.alive or rnd()<.1 then @@ -1620,10 +1630,7 @@ function Player:die()--Called both when win/lose! self.waiting=1e99 self.b2b=0 self.tasks={} - for i=1,#self.atkBuffer do - self.atkBuffer[i].sent=true - self.atkBuffer[i].time=0 - end + self:clearAttackBuffer() for i=1,#self.field do for j=1,10 do self.visTime[i][j]=min(self.visTime[i][j],20) @@ -1640,6 +1647,36 @@ function Player:die()--Called both when win/lose! end end end +function Player:revive() + self.waiting=62 + local h=#self.field + for _=h,1,-1 do + FREEROW.discard(self.field[_]) + FREEROW.discard(self.visTime[_]) + self.field[_],self.visTime[_]=nil + end + self.garbageBeneath=0 + if self.AI_mode=='CC'then + CC.destroy(self.AI_bot) + TABLE.cut(self.holdQueue) + self:loadAI(self.AIdata) + end + + self:clearAttackBuffer() + + self.life=self.life-1 + self.fieldBeneath=0 + self.b2b=0 + + for i=1,h do + self:createClearingFX(i,1.5) + end + SYSFX.newShade(1.4,self.fieldX,self.fieldY,300*self.size,610*self.size) + SYSFX.newRectRipple(2,self.fieldX,self.fieldY,300*self.size,610*self.size) + SYSFX.newRipple(2,self.x+(475+25*(self.life<3 and self.life or 0)+12)*self.size,self.y+(665+12)*self.size,20) + SFX.play('clear_3') + SFX.play('emit') +end function Player:win(result) if self.result then return end self:die() @@ -1670,45 +1707,7 @@ end function Player:lose(force) if self.result then return end if self.type=='remote'and not force then self.waiting=1e99 return end - if self.life>0 and not force then - self.waiting=62 - local h=#self.field - for _=h,1,-1 do - FREEROW.discard(self.field[_]) - FREEROW.discard(self.visTime[_]) - self.field[_],self.visTime[_]=nil - end - self.garbageBeneath=0 - - if self.AI_mode=='CC'then - CC.destroy(self.AI_bot) - TABLE.cut(self.holdQueue) - self:loadAI(self.AIdata) - end - - self.life=self.life-1 - self.fieldBeneath=0 - self.b2b=0 - for i=1,#self.atkBuffer do - local A=self.atkBuffer[i] - if not A.sent then - A.sent=true - A.time=0 - end - end - self.atkBufferSum=0 - - for i=1,h do - self:createClearingFX(i,1.5) - end - SYSFX.newShade(1.4,self.fieldX,self.fieldY,300*self.size,610*self.size) - SYSFX.newRectRipple(2,self.fieldX,self.fieldY,300*self.size,610*self.size) - SYSFX.newRipple(2,self.x+(475+25*(self.life<3 and self.life or 0)+12)*self.size,self.y+(665+12)*self.size,20) - SFX.play('clear_3') - SFX.play('emit') - - return - end + if self.life>0 and not force then self:revive()return end self:die() local i=TABLE.find(PLY_ALIVE,self) if i then rem(PLY_ALIVE,i)end diff --git a/parts/player/update.lua b/parts/player/update.lua index 76c66b73..aeaaab76 100644 --- a/parts/player/update.lua +++ b/parts/player/update.lua @@ -4,10 +4,23 @@ local rem=table.remove local assert,resume,status=assert,coroutine.resume,coroutine.status local TEXT,GAME=TEXT,GAME -local PLAYERS,PLY_ALIVE=PLAYERS,PLY_ALIVE +local PLY_ALIVE=PLY_ALIVE +local function update_misc(P,dt) + --Finesse combo animation + if P.finesseComboTime>0 then + P.finesseComboTime=P.finesseComboTime-1 + end -local function updateLine(P)--Attacks, line pushing, camear moving + --Update atkBuffer alert + local t=P.atkBufferSum1 + if t