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[4]=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)
if y<1 then return true end
if y>#f then return nil end
@@ -69,7 +69,6 @@ function getScore(field,bn,cb,cx,cy)
local score=0
local highest=0
local height=getNewRow()
local rough=0
local clear=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 h>1 then
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
local h1,mh1=0,0
for x=1,9 do
local dh=abs(height[x]-height[x])
if dh>1 then
rough=rough+min(dh^1.5,10)
elseif dh==1 then
local dh=abs(height[x]-height[x+1])
if dh==1 then
h1=h1+1
if h1>mh1 then mh1=h1 end
else
@@ -111,11 +111,11 @@ function getScore(field,bn,cb,cx,cy)
end
ins(freeRow,height)
score=
-cy*20
-rough*20
-#cb*10
+clearScore[clear]
-hole*30
#field*20
-cy*40
-#cb*25
+clearScore[clear]*(8+#field)
-hole*40
if #field>6 then score=score-highest*5 end
if mh1>3 then score=score-50-mh1*40 end
return score

View File

@@ -435,25 +435,26 @@ function love.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)
gc.print(tm.getFPS(),0,700)
if devMode then
gc.print(gcinfo(),0,680)
gc.print(freeRow and #freeRow or 0,0,660)
end
--if gcinfo()>500 then collectgarbage()end
end
function love.resize(w,h)
ww,wh=w,h
xOy:release()
ScreenK=h/w>=.5625 and w/1280 or h/720
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
screenK=h/w>=.5625 and w/1280 or h/720
xOy=xOy:setTransformation(w*.5,h*.5,nil,screenK,nil,640,360)
gc.replaceTransform(xOy)
end
function love.run()

View File

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

View File

@@ -5,10 +5,14 @@ function resetGameData()
frame=0
count=179
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
PTC.dust[i]=PTC.dust[0]:clone()
PTC.dust[i]:start()
if not players[i].small then
PTC.dust[i]=PTC.dust[0]:clone()
PTC.dust[i]:start()
end
end
for i=1,#virtualkey do
virtualkey[i].press=false
@@ -169,9 +173,11 @@ function checkrow(s,num)--(cy,r)
ins(clearing,1,i)
P.falling=gameEnv.fall
c=c+1--row cleared+1
for k=1,250 do
PTC.dust[P.id]:setPosition(rnd(300),600-30*i+rnd(30))
PTC.dust[P.id]:emit(1)
if not P.small then
for k=1,250 do
PTC.dust[P.id]:setPosition(rnd(300),600-30*i+rnd(30))
PTC.dust[P.id]:emit(1)
end
end
end end
return c
@@ -386,7 +392,7 @@ function drop()
sendTime=sendTime+30
SFX("perfectclear")
if cstat.piece>10 then
P.b2b=300
P.b2b=600
end
P.cstat.pc=P.cstat.pc+1
end
@@ -472,9 +478,11 @@ function garbageSend(sender,send,time)
r=players.alive[rnd(#players.alive)]
until r~=P.id
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
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
function garbageRelease()
local t=P.showTime*2

View File

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

View File

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

105
paint.lua
View File

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