Compare commits

...

1 Commits

Author SHA1 Message Date
MrZ_26
7eea017c72 Alpha V0.7.3 2020-02-04 19:30:03 +08:00
8 changed files with 115 additions and 99 deletions

24
ai.lua
View File

@@ -46,7 +46,7 @@ FCL={
FCL[2]=FCL[1] FCL[2]=FCL[1]
FCL[4]=FCL[3] FCL[4]=FCL[3]
FCL[5]=FCL[3] FCL[5]=FCL[3]
clearScore={[0]=0,0,10,30,100} clearScore={[0]=0,0,2,4,12}
function ifoverlapAI(f,bk,x,y) function ifoverlapAI(f,bk,x,y)
if y<1 then return true end if y<1 then return true end
if y>#f then return nil end if y>#f then return nil end
@@ -69,7 +69,6 @@ function getScore(field,bn,cb,cx,cy)
local score=0 local score=0
local highest=0 local highest=0
local height=getNewRow() local height=getNewRow()
local rough=0
local clear=0 local clear=0
local hole=0 local hole=0
@@ -93,16 +92,17 @@ function getScore(field,bn,cb,cx,cy)
if x>3 and x<8 and h>highest then highest=h end if x>3 and x<8 and h>highest then highest=h end
if h>1 then if h>1 then
for h=h-1,1,-1 do for h=h-1,1,-1 do
if field[h][x]==0 then hole=hole+1 if hole>5 then break end end if field[h][x]==0 then
hole=hole+1
if hole==5 then break end
end
end end
end end
end end
local h1,mh1=0,0 local h1,mh1=0,0
for x=1,9 do for x=1,9 do
local dh=abs(height[x]-height[x]) local dh=abs(height[x]-height[x+1])
if dh>1 then if dh==1 then
rough=rough+min(dh^1.5,10)
elseif dh==1 then
h1=h1+1 h1=h1+1
if h1>mh1 then mh1=h1 end if h1>mh1 then mh1=h1 end
else else
@@ -111,11 +111,11 @@ function getScore(field,bn,cb,cx,cy)
end end
ins(freeRow,height) ins(freeRow,height)
score= score=
-cy*20 #field*20
-rough*20 -cy*40
-#cb*10 -#cb*25
+clearScore[clear] +clearScore[clear]*(8+#field)
-hole*30 -hole*40
if #field>6 then score=score-highest*5 end if #field>6 then score=score-highest*5 end
if mh1>3 then score=score-50-mh1*40 end if mh1>3 then score=score-50-mh1*40 end
return score return score

View File

@@ -435,25 +435,26 @@ function love.draw()
end end
if sceneSwaping then sceneSwaping.draw()end if sceneSwaping then sceneSwaping.draw()end
if wh/ww>.5625 then
gc.setColor(0,0,0)
gc.rectangle("fill",0,0,1280,ww*.5625-wh)
gc.rectangle("fill",0,720,1280,wh-ww*.5625)
elseif wh/ww<.5625 then
gc.setColor(0,0,0)
gc.rectangle("fill",0,0,wh*16/9-ww,720)
gc.rectangle("fill",1280,0,ww-wh*16/9,720)
end
setFont(20)gc.setColor(1,1,1) setFont(20)gc.setColor(1,1,1)
gc.print(tm.getFPS(),0,700) gc.print(tm.getFPS(),0,700)
if devMode then if devMode then
gc.print(gcinfo(),0,680) gc.print(gcinfo(),0,680)
gc.print(freeRow and #freeRow or 0,0,660) gc.print(freeRow and #freeRow or 0,0,660)
end end
--if gcinfo()>500 then collectgarbage()end
end end
function love.resize(w,h) function love.resize(w,h)
ww,wh=w,h ww,wh=w,h
xOy:release() screenK=h/w>=.5625 and w/1280 or h/720
ScreenK=h/w>=.5625 and w/1280 or h/720 xOy=xOy:setTransformation(w*.5,h*.5,nil,screenK,nil,640,360)
xOy=love.math.newTransform(0,0,nil,ScreenK,nil,640,360,nil,nil)
xOy:translate(640,360)
if h/w>=.5625 then
xOy:translate(0,h-w*.5625)
else
xOy:translate(w-h*16/9,0)
end
gc.replaceTransform(xOy) gc.replaceTransform(xOy)
end end
function love.run() function love.run()

View File

@@ -9,7 +9,7 @@ function love.conf(t)
t.audio.mixwithsystem=true--Switch on to keep background music playing t.audio.mixwithsystem=true--Switch on to keep background music playing
local W=t.window local W=t.window
W.title="Techmino V0.7.2" W.title="Techmino V0.7.3"
W.icon="/image/icon.png" W.icon="/image/icon.png"
W.width,W.height=1280,720 W.width,W.height=1280,720
W.borderless=X W.borderless=X

View File

@@ -5,10 +5,14 @@ function resetGameData()
frame=0 frame=0
count=179 count=179
FX.beam={} FX.beam={}
for i=1,#PTC.dust do PTC.dust[i]:release()end for k,v in pairs(PTC.dust)do
if k~=0 then v:release()end
end
for i=1,#players do for i=1,#players do
PTC.dust[i]=PTC.dust[0]:clone() if not players[i].small then
PTC.dust[i]:start() PTC.dust[i]=PTC.dust[0]:clone()
PTC.dust[i]:start()
end
end end
for i=1,#virtualkey do for i=1,#virtualkey do
virtualkey[i].press=false virtualkey[i].press=false
@@ -169,9 +173,11 @@ function checkrow(s,num)--(cy,r)
ins(clearing,1,i) ins(clearing,1,i)
P.falling=gameEnv.fall P.falling=gameEnv.fall
c=c+1--row cleared+1 c=c+1--row cleared+1
for k=1,250 do if not P.small then
PTC.dust[P.id]:setPosition(rnd(300),600-30*i+rnd(30)) for k=1,250 do
PTC.dust[P.id]:emit(1) PTC.dust[P.id]:setPosition(rnd(300),600-30*i+rnd(30))
PTC.dust[P.id]:emit(1)
end
end end
end end end end
return c return c
@@ -386,7 +392,7 @@ function drop()
sendTime=sendTime+30 sendTime=sendTime+30
SFX("perfectclear") SFX("perfectclear")
if cstat.piece>10 then if cstat.piece>10 then
P.b2b=300 P.b2b=600
end end
P.cstat.pc=P.cstat.pc+1 P.cstat.pc=P.cstat.pc+1
end end
@@ -472,9 +478,11 @@ function garbageSend(sender,send,time)
r=players.alive[rnd(#players.alive)] r=players.alive[rnd(#players.alive)]
until r~=P.id until r~=P.id
createBeam(sender,r,level) createBeam(sender,r,level)
ins(players[r].atkBuffer,{pos,amount=send,countdown=time,cd0=time,time=0,sent=false,lv=level})
players[r].lastRecv=sender players[r].lastRecv=sender
sort(players[r].atkBuffer,timeSort) if #players[r].atkBuffer<20 then
ins(players[r].atkBuffer,{pos,amount=send,countdown=time,cd0=time,time=0,sent=false,lv=level})
sort(players[r].atkBuffer,timeSort)
end
end end
function garbageRelease() function garbageRelease()
local t=P.showTime*2 local t=P.showTime*2

View File

@@ -196,7 +196,7 @@ customVal={
hold={"on","off"}, hold={"on","off"},
sequence={"bag","his4","random"}, sequence={"bag","his4","random"},
visible={"Show","half","hide"}, visible={"Show","half","hide"},
target=nil, target={10,20,40,100,200,500,1000,""},
freshLimit=nil, freshLimit=nil,
opponent={"No CPU",1,2,3,4,5,6,7,8,9,10,11}, opponent={"No CPU",1,2,3,4,5,6,7,8,9,10,11},
}--number-Val str }--number-Val str
@@ -209,7 +209,7 @@ customRange={
hold={true,false}, hold={true,false},
sequence={1,2,3}, sequence={1,2,3},
visible={1,2,3}, visible={1,2,3},
target={10,20,40,100,200,500,1000}, target={10,20,40,100,200,500,1000,1e99},
freshLimit={0,5,15,1e99}, freshLimit={0,5,15,1e99},
opponent={0,60,30,20,15,10,7,5,4,3,2,1}, opponent={0,60,30,20,15,10,7,5,4,3,2,1},
} }

View File

@@ -99,9 +99,9 @@ freshMethod={
function() function()
P.bn,P.cb=rem(P.nxt,1),rem(P.nb,1) P.bn,P.cb=rem(P.nxt,1),rem(P.nb,1)
local i,j=nil,0 local i,j=nil,0
::r:: repeat
i,j=rnd(7),j+1 i,j=rnd(7),j+1
if(i==P.his[1]or i==P.his[2]or i==P.his[3]or i==P.his[4])and j<6 then goto r end until not(i==P.his[1]or i==P.his[2]or i==P.his[3]or i==P.his[4])
P.nxt[6],P.nb[6]=i,blocks[i][0] P.nxt[6],P.nb[6]=i,blocks[i][0]
rem(P.his,1)ins(P.his,i) rem(P.his,1)ins(P.his,i)
end, end,
@@ -114,14 +114,17 @@ freshMethod={
P.bn,P.cb=rem(P.nxt,1),rem(P.nb,1) P.bn,P.cb=rem(P.nxt,1),rem(P.nb,1)
if #P.nxt<6 then if #P.nxt<6 then
local bag={1,2,3,4,5,6,7} local bag={1,2,3,4,5,6,7}
for i=1,7 do repeat
ins(P.nxt,rem(bag,rnd(8-i))) local i=rem(bag,rnd(#bag))
ins(P.nb,blocks[P.nxt[#P.nxt]][0]) ins(P.nxt,i)
end ins(P.nb,blocks[i][0])
if rnd()>.4 then until #bag==0
ins(P.nxt,5) bag={1,2,3,4,5,6,7,5}
ins(P.nb,blocks[5][0]) repeat
end local i=rem(bag,rnd(#bag))
ins(P.nxt,i)
ins(P.nb,blocks[i][0])
until #bag==0
end end
end, end,
function() function()
@@ -458,9 +461,10 @@ Event={
end end
end, end,
tsd_reach=function() tsd_reach=function()
P.gameEnv.target=P.gameEnv.target+2
if not(#clearing==2 and bn==5 and P.spinLast)then if not(#clearing==2 and bn==5 and P.spinLast)then
Event.gameover.lose() Event.gameover.lose()
else
P.gameEnv.target=P.gameEnv.target+2
end end
end, end,
newPC=function() newPC=function()

105
paint.lua
View File

@@ -157,49 +157,51 @@ function drawVirtualkey(s)
end end
end end
Pnt={BG={}} Pnt={}
function Pnt.BG.none() Pnt.BG={
gc.clear(.2,.2,.2) none=function()
end gc.clear(.2,.2,.2)
function Pnt.BG.glow() end,
local t=((sin(Timer()*.5)+sin(Timer()*.7)+sin(Timer()*.9+1)+sin(Timer()*1.5)+sin(Timer()*2+3))+5)*.05 glow=function()
gc.clear(t,t,t) local t=((sin(Timer()*.5)+sin(Timer()*.7)+sin(Timer()*.9+1)+sin(Timer()*1.5)+sin(Timer()*2+3))+5)*.05
end gc.clear(t,t,t)
function Pnt.BG.game1() end,
gc.setColor(1,1,1) game1=function()
gc.draw(background[1],640,360,Timer()*.15,12,nil,64,64) gc.setColor(1,1,1)
end gc.draw(background[1],640,360,Timer()*.15,12,nil,64,64)
function Pnt.BG.game2() end,
gc.setColor(1,.5,.5) game2=function()
gc.draw(background[1],640,360,Timer()*.2,12,nil,64,64) gc.setColor(1,.5,.5)
end gc.draw(background[1],640,360,Timer()*.2,12,nil,64,64)
function Pnt.BG.game3() end,
gc.setColor(.6,.6,1) game3=function()
gc.draw(background[1],640,360,Timer()*.25,12,nil,64,64) gc.setColor(.6,.6,1)
end gc.draw(background[1],640,360,Timer()*.25,12,nil,64,64)
function Pnt.BG.rgb() end,
gc.clear( rgb=function()
sin(Timer()*1.2)*.15+.5, gc.clear(
sin(Timer()*1.5)*.15+.5, sin(Timer()*1.2)*.15+.5,
sin(Timer()*1.9)*.15+.5 sin(Timer()*1.5)*.15+.5,
) sin(Timer()*1.9)*.15+.5
end )
function Pnt.BG.strap() end,
gc.setColor(1,1,1) strap=function()
local x=Timer()%32*40 gc.setColor(1,1,1)
gc.draw(background[2],x,0,nil,10) local x=Timer()%32*40
gc.draw(background[2],x-1280,0,nil,10) gc.draw(background[2],x,0,nil,10)
end gc.draw(background[2],x-1280,0,nil,10)
function Pnt.BG.matrix() end,
for i=0,15 do matrix=function()
for j=0,8 do for i=0,15 do
-- local t=sin(Timer()*((2.468*i-1.357*j)%3))*.3 for j=0,8 do
local t=(sin((mt.noise(i,j)+2)*Timer())+1)*.2 -- local t=sin(Timer()*((2.468*i-1.357*j)%3))*.3
gc.setColor(t,t,t) local t=(sin((mt.noise(i,j)+2)*Timer())+1)*.2
gc.rectangle("fill",80*i,80*j,80,80) gc.setColor(t,t,t)
gc.rectangle("fill",80*i,80*j,80,80)
end
end end
end end,
end }
function Pnt.load() function Pnt.load()
gc.setLineWidth(4) gc.setLineWidth(4)
@@ -215,7 +217,7 @@ end
function Pnt.main() function Pnt.main()
gc.setColor(1,1,1) gc.setColor(1,1,1)
setFont(30) setFont(30)
gc.print("Alpha V0.7.2",370,150) gc.print("Alpha V0.7.3",370,150)
gc.print(system,530,110) gc.print(system,530,110)
gc.draw(titleImage,30,30) gc.draw(titleImage,30,30)
end end
@@ -241,10 +243,10 @@ function Pnt.custom()
gc.print("Custom Game",20,20) gc.print("Custom Game",20,20)
gc.setColor(color.white) gc.setColor(color.white)
gc.print("Custom Game",22,23) gc.print("Custom Game",22,23)
setFont(35) setFont(40)
for i=1,#customID do for i=1,#customID do
local k=customID[i] local k=customID[i]
local y=90+35*i local y=90+40*i
gc.print(customOption[k],50,y) gc.print(customOption[k],50,y)
if customVal[k]then if customVal[k]then
gc.print(customVal[k][customSel[k]],350,y) gc.print(customVal[k][customSel[k]],350,y)
@@ -252,7 +254,7 @@ function Pnt.custom()
gc.print(customRange[k][customSel[k]],350,y) gc.print(customRange[k][customSel[k]],350,y)
end end
end end
gc.print("",10,88+35*optSel) gc.print("",10,90+40*optSel)
end end
function Pnt.play() function Pnt.play()
for p=1,#players do for p=1,#players do
@@ -266,7 +268,7 @@ function Pnt.play()
gc.stencil(stencil_field_small, "replace",1) gc.stencil(stencil_field_small, "replace",1)
gc.translate(0,fieldBeneath) gc.translate(0,fieldBeneath)
gc.setStencilTest("equal",1) gc.setStencilTest("equal",1)
for j=1,#field do for j=int(fieldBeneath/30+1),#field do
if falling<=0 or without(clearing,j)then if falling<=0 or without(clearing,j)then
for i=1,10 do for i=1,10 do
if field[j][i]>0 then if field[j][i]>0 then
@@ -275,8 +277,6 @@ function Pnt.play()
end end
end end
end--Field end--Field
gc.setColor(1,1,1)
gc.draw(PTC.dust[p])--Draw game field
gc.setStencilTest()--In-playField mask gc.setStencilTest()--In-playField mask
gc.translate(0,-fieldBeneath) gc.translate(0,-fieldBeneath)
gc.setColor(frameColor[P.strength])gc.rectangle("line",-7,-7,314,614)--Draw boarder gc.setColor(frameColor[P.strength])gc.rectangle("line",-7,-7,314,614)--Draw boarder
@@ -297,7 +297,7 @@ function Pnt.play()
gc.stencil(stencil_field, "replace", 1) gc.stencil(stencil_field, "replace", 1)
gc.translate(0,fieldBeneath) gc.translate(0,fieldBeneath)
gc.setStencilTest("equal",1) gc.setStencilTest("equal",1)
for j=1,#field do for j=int(fieldBeneath/30+1),#field do
if falling<=0 or without(clearing,j)then if falling<=0 or without(clearing,j)then
for i=1,10 do for i=1,10 do
if field[j][i]>0 then if field[j][i]>0 then
@@ -345,6 +345,7 @@ function Pnt.play()
for i=1,#atkBuffer do for i=1,#atkBuffer do
local a=atkBuffer[i] local a=atkBuffer[i]
local bar=a.amount*30 local bar=a.amount*30
if h+bar>600 then bar=600-h end
if not a.sent then if not a.sent then
if a.time<20 then if a.time<20 then
bar=bar*(20*a.time)^.5*.05 bar=bar*(20*a.time)^.5*.05
@@ -364,11 +365,11 @@ function Pnt.play()
else else
gc.setColor(attackColor[a.lv][1]) gc.setColor(attackColor[a.lv][1])
bar=bar*(20-a.time)*.05 bar=bar*(20-a.time)*.05
gc.rectangle("fill",308,600-h,8,-bar+5) gc.rectangle("fill",308,600-h,8,-bar+3)
--Disappear --Disappear
end end
h=h+bar h=h+bar
if h>600 then break end if h>=600 then break end
end--Buffer line end--Buffer line
gc.setColor(b2b<40 and color.white or b2b<=480 and color.lightRed or color.lightBlue) gc.setColor(b2b<40 and color.white or b2b<=480 and color.lightRed or color.lightBlue)

View File

@@ -242,7 +242,9 @@ function Tmr.play(dt)
end end
end end
if fieldBeneath>0 then P.fieldBeneath=fieldBeneath-3 end if fieldBeneath>0 then P.fieldBeneath=fieldBeneath-3 end
PTC.dust[p]:update(dt) if not P.small then
PTC.dust[p]:update(dt)
end
end end
setmetatable(_G,nil) setmetatable(_G,nil)
end end