Compare commits

...

1 Commits

Author SHA1 Message Date
MrZ_26
e7c797bf14 Alpha V0.7.5 2020-02-04 19:30:42 +08:00
9 changed files with 175 additions and 150 deletions

9
ai.lua
View File

@@ -112,7 +112,7 @@ function getScore(field,bn,cb,cx,cy)
ins(freeRow,height)
score=
#field*20
-cy*40
-cy*35
-#cb*25
+clearScore[clear]*(8+#field)
-hole*50
@@ -167,4 +167,11 @@ function AI_getControls(ctrl)
ins(ctrl,l[i])
end
ins(ctrl,6)
if rnd()<.1 then
if P.atkMode~=4 and P==mostDangerous then
ins(P.ai.controls,9)
--Smarter AI???
end
end
end

View File

@@ -530,7 +530,7 @@ function love.run()
end
end
else
tm.sleep(.2)
tm.sleep(.5)
if wd.hasFocus()then
tm.step()
focus=true

View File

@@ -1,7 +1,7 @@
function love.conf(t)
local X=nil
t.identity="Techmino"--The name of the save directory (string)
t.appendidentity=X--Search files in source directory before save directory (boolean)
t.identity="Techmino"--Save directory name
t.appendidentity=X--If search files in source before save directory
t.version="11.1"
t.console=X
t.accelerometerjoystick=X--If exposing accelerometer on iOS and Android as a Joystick
@@ -9,7 +9,7 @@ function love.conf(t)
t.audio.mixwithsystem=true--Switch on to keep sysBGM
local W=t.window
W.title="Techmino V0.7.4"
W.title="Techmino V0.7.5"
W.icon="/image/icon.png"
W.width,W.height=1280,720
W.borderless=X
@@ -20,7 +20,7 @@ function love.conf(t)
W.vsync=X--0 to set ∞fps
W.msaa=X--The number of samples to use with multi-sampled antialiasing (number)
W.depth=X--Bits per sample in the depth buffer
W.stencil=8--The number of bits per sample in the stencil buffer
W.stencil=1--The number of bits per sample in the stencil buffer
W.display=1--Monitor ID
W.highdpi=X--Enable high-dpi mode for the window on a Retina display (boolean)
W.x,W.y=nil

View File

@@ -23,8 +23,7 @@ function resetGameData()
until P.atking~=P
end
end
mostBadge=nil
mostDangerous=nil
mostBadge,mostDangerous,secBadge,secDangerous=nil
end
for i=1,#virtualkey do
virtualkey[i].press=false
@@ -102,7 +101,13 @@ function createPlayer(id,x,y,size,AIspeed,data)
P.dropDelay,P.lockDelay=P.gameEnv.drop,P.gameEnv.lock
P.freshTime=0
P.lastSpin=false
if P.gameEnv.sequence<5 then
if P.gameEnv.sequence==3 then
for i=1,6 do
local r=rnd(7)
P.nxt[i]=r
P.nb[i]=blocks[r][0]
end
elseif P.gameEnv.sequence<5 then
local bag1={1,2,3,4,5,6,7}
for i=1,7 do
P.nxt[i]=rem(bag1,rnd(#bag1))
@@ -166,28 +171,37 @@ function throwBadge(S,R,amount)--Player id
end
ins(FX.badge,{x1,y1,x2,y2,t=0,size=(10+min(amount,10))*.1})
end
function randomTarget(p)
if #players.alive>1 then
local r
repeat
r=players.alive[rnd(#players.alive)]
until r~=p
return r
end
end
function freshRoyaleTarget()
local b,sec=0
mostBadge,secBadge,mostDangerous,secDangerous=nil
local h,b=0,0
for i=1,#players.alive do
if players.alive[i].badge>b then
if players.alive[i].badge>=h then
mostBadge,secBadge=players.alive[i],mostBadge
b=players[i].badge
h=players[i].badge
end
if #players.alive[i].field>=b then
mostDangerous,secDangerous=players.alive[i],mostDangerous
b=#players[i].field
end
end
for i=1,#players.alive do
if P.atkMode==2 then
local P=players.alive[i]
if P.atkMode==1 then
if not P.atking then
P.atking=randomTarget(P)
end
elseif P.atkMode==2 then
P.atking=P~=mostBadge and mostBadge or secBadge
end
end
h,sec=0
for i=1,#players.alive do
if #players.alive[i].field>h then
mostDangerous,secDangerous=players.alive[i],mostBadge
h=#players[i].field
end
end
for i=1,#players.alive do
if P.atkMode==3 then
elseif P.atkMode==3 then
P.atking=P~=mostDangerous and mostDangerous or secDangerous
end
end
@@ -268,7 +282,8 @@ function resetblock()
freshgho()
if P.keyPressing[6]then act.hardDrop()P.keyPressing[6]=false end
end
function pressKey(i,P)
function pressKey(i,p)
P=p
P.keyPressing[i]=true
if i==10 then
act.restart()
@@ -276,10 +291,23 @@ function pressKey(i,P)
if P.control and P.waiting<=0 then
act[actName[i]]()
if i>2 and i<7 then P.keyPressing[i]=false end
elseif i==1 then
P.moving=-1
elseif i==2 then
P.moving=1
elseif P.keyPressing[9]then
if i==1 then
P.atkMode=1
P.atking=randomTarget(P)
elseif i==2 then
P.atkMode=2
elseif i==6 then
P.atkMode=3
elseif i==7 then
P.atkMode=4
end
else
if i==1 then
P.moving=-1
elseif i==2 then
P.moving=1
end
end
ins(P.keyTime,1,frame)rem(P.keyTime,11)
P.cstat.key=P.cstat.key+1
@@ -287,8 +315,8 @@ function pressKey(i,P)
end
--ins(rec,{i,frame})
end
function releaseKey(i,player)
(player or players[1]).keyPressing[i]=false
function releaseKey(i,p)
p.keyPressing[i]=false
-- if playmode=="recording"then ins(rec,{-i,frame})end
end
function spin(d,ifpre)
@@ -487,8 +515,8 @@ function drop()
end
end
if atker>1 then
csend=csend+ceil(atker*.5)
exblock=exblock+int(atker*.5)
csend=csend+reAtk[atker]
exblock=exblock+reDef[atker]
end
end
@@ -503,6 +531,12 @@ function drop()
if P.id==1 then stat.atk=stat.atk+csend end
--ATK statistics
if csend>0 then
showText(csend,"zoomout",25,70)
if exblock>0 then
showText(exblock,"zoomout",10,70)
end
end
while csend>0 and P.atkBuffer[1]do
if exblock>0 then
exblock=exblock-1
@@ -519,34 +553,23 @@ function drop()
end
end
if csend>0 then
showText(csend,"zoomout",25,70)
if modeEnv.royaleMode then
if #players.alive>1 then
if P.atkMode==4 then
for i=1,#players.alive do
if players.alive[i].atking==P then
garbageSend(P,players.alive[i],csend,sendTime)
end
end
else
if P.atkMode==1 and rnd()<.2 or not P.atking then
local r
repeat
r=players.alive[rnd(#players.alive)]
until r~=P
P.atking=r
end
if P.atking then
garbageSend(P,P.atking,csend,sendTime)
if P.atkMode==4 then
local f
for i=1,#players.alive do
if players.alive[i].atking==P then
garbageSend(P,players.alive[i],csend,sendTime)
f=true
end
end
if not f then
garbageSend(P,P.atking or randomTarget(P),csend,sendTime)
end
else
garbageSend(P,P.atking or randomTarget(P),csend,sendTime)
end
elseif #players.alive>1 then
local r
repeat
r=players.alive[rnd(#players.alive)]
until r~=P
garbageSend(P,r,csend,sendTime)
garbageSend(P,randomTarget(P),csend,sendTime)
end
end
elseif cc==0 then
@@ -630,7 +653,7 @@ act={
if P.keyPressing[9]then
if P.atkMode~=2 then
P.atkMode=2
P.atking=mostBadge
P.atking=P~=mostBadge and mostBadge or secBadge
end
else
if not auto then
@@ -652,7 +675,7 @@ act={
if P.keyPressing[9]then
if P.atkMode~=3 then
P.atkMode=3
P.atking=mostDangerous
P.atking=P~=mostDangerous and mostDangerous or secDangerous
end
else
if P.waiting<=0 then
@@ -695,6 +718,7 @@ act={
end,
restart=function()
resetGameData()
frame=90
end,
insDown=function()if P.cy~=P.y_img then P.cy,P.lockDelay,P.spinLast=P.y_img,P.gameEnv.lock,false end end,
insLeft=function()

View File

@@ -246,10 +246,11 @@ testScore={[0]=0,[-1]=1,[-2]=0,[-3]=1,2,2,2}
spin_n={"spin_1","spin_2","spin_3"}
clear_n={"clear_1","clear_2","clear_3","clear_4"}
ren_n={"ren_1","ren_2","ren_3","ren_4","ren_5","ren_6","ren_7","ren_8","ren_9","ren_10","ren_11"}
atkModeName={"Random","Badges","K.O.s","Attackers"}
atkModeName={"Random","Badges","K.O.s","Counters"}
up0to4={[0]="000%UP","025%UP","050%UP","075%UP","100%UP",}
percent0to5={[0]="0%","20%","40%","60%","80%","100%",}
reAtk={0,0,1,1,1,2,2,3,3}
reDef={0,1,1,2,3,3,4,4,5}
marathon_drop={[0]=60,48,40,30,24,18,15,12,10,8,7,6,5,4,3,2,1,1,0,0}
death_lock={12,11,10,9,8}
death_wait={9,8,7,6,5}

View File

@@ -270,6 +270,7 @@ loadmode={
techmino41=function()
modeEnv={
freshLimit=15,
fall=20,
royaleMode=true,
royale={2,5,10,20},
}
@@ -278,13 +279,13 @@ loadmode={
local n=2
for i=1,4 do
for j=1,5 do
createPlayer(n,75*i-48,142*j-130,.19,rnd(15))
createPlayer(n,77*i-55,140*j-125,.2,rnd(15))
n=n+1
end
end
for i=9,12 do
for j=1,5 do
createPlayer(n,75*i+292,142*j-130,.19,rnd(15))
createPlayer(n,77*i+275,140*j-125,.2,rnd(15))
n=n+1
end
end--AIs
@@ -295,6 +296,7 @@ loadmode={
techmino99=function()
modeEnv={
freshLimit=15,
fall=20,
royaleMode=true,
royale={2,6,14,30},
}
@@ -455,26 +457,28 @@ mesDisp={
techmino41=function()
setFont(40)
mStr(#players.alive.."/41",-80,180)
mStr(P.ko,-55,220)
mStr(P.ko,-65,220)
setFont(25)
gc.print("KO",-105,229)
gc.print("KO",-120,229)
gc.print(P.badge,-40,233)
setFont(30)
gc.print(up0to4[P.strength],-125,295)
for i=1,P.strength do
gc.draw(badgeIcon,16*i-130,260)
end
setFont(30)
gc.print(up0to4[P.strength],-125,295)
end,
techmino99=function()
setFont(40)
mStr(#players.alive.."/99",-80,180)
mStr(P.ko,-55,220)
mStr(P.ko,-65,220)
setFont(25)
gc.print("KO",-105,229)
gc.print("KO",-120,229)
gc.print(P.badge,-40,233)
setFont(30)
gc.print(up0to4[P.strength],-125,295)
for i=1,P.strength do
gc.draw(badgeIcon,16*i-130,260)
end
setFont(30)
gc.print(up0to4[P.strength],-125,295)
end,
blind=function()
setFont(25)
@@ -498,8 +502,9 @@ Event={
P.control=false
P.timing=false
P.waiting=1e99
P.result="WIN"
P.atking=nil
P.b2b=0
P.result="WIN"
for i=1,#P.field do
for j=1,10 do
P.visTime[i][j]=min(P.visTime[i][j],20)
@@ -513,17 +518,14 @@ Event={
P.alive=false
P.control=false
P.timing=false
P.result=" K.O."
P.waiting=1e99
P.atking=nil
P.b2b=0
P.result=" K.O."
showText("LOSE","appear",100,nil,true)
for i=1,#players.alive do
if players.alive[i]==P then
rem(players.alive,i)
if #players.alive==1 then
ins(players.alive[1].task,Event.task.winTrigger)
end
break
end
end
@@ -558,6 +560,9 @@ Event={
end
if P.id==1 and players[2]and players[2].ai then SFX("fail")end
ins(P.task,Event.task.lose)
if #players.alive==1 then
ins(players.alive[1].task,Event.task.winTrigger)
end
end,
},
marathon_reach=function()
@@ -618,7 +623,7 @@ Event={
end,
win=function()
P.counter=P.counter+1
if P.counter>60 then
if P.counter>80 then
for i=1,#P.field do
for j=1,10 do
if P.visTime[i][j]>0 then
@@ -637,7 +642,7 @@ Event={
end,
lose=function()
P.counter=P.counter+1
if P.counter>60 then
if P.counter>80 then
for i=1,#P.field do
for j=1,10 do
if P.visTime[i][j]>0 then

View File

@@ -134,16 +134,15 @@ function drawDial(x,y,speed)
mStr(int(speed),0,-14)
gc.draw(dialCircle,0,0,nil,nil,nil,32,32)
gc.setColor(1,1,1,.6)
gc.draw(dialNeedle,0,0,2.0944+(speed<=175 and .020944*speed or 4.712389-52.35988/(speed-125)),nil,nil,5,4)
gc.draw(dialNeedle,0,0,2.094+(speed<=175 and .02094*speed or 4.712-52.36/(speed-125)),nil,nil,5,4)
gc.pop()
end
function drawPixel(y,x,id,alpha)
gc.setColor(1,1,1,alpha)
gc.draw(blockSkin[id],30*x-30,600-30*y)
end
function drawPixelmini(y,x,id,alpha)
gc.setColor(1,1,1,alpha)
gc.draw(blockSkinmini[id],30*x-30,600-30*y,nil,2.5)
function drawPixelmini(y,x,id)
gc.draw(blockSkinmini[id],30*x-30,600-30*y,nil,5)
end
function drawVirtualkey(s)
gc.setLineWidth(10)
@@ -223,25 +222,25 @@ function Pnt.load()
end
function Pnt.intro()
gc.push()
gc.translate(250,150)
gc.scale(30)
gc.setColor(1,1,1,min(count,80)*.005)
gc.draw(miniTitle)
gc.setColor(1,1,1)
gc.stencil(stencil_miniTitle,"replace",1)
gc.translate(250,150)
gc.scale(30)
gc.stencil(stencil_miniTitle,"replace",1)
gc.setStencilTest("equal",1)
gc.setColor(1,1,1,min(count,80)*.005)
gc.rectangle("fill",0,0,26,14)
gc.pop()
gc.setColor(1,1,1,.125)
for i=19,5,-2 do
gc.setLineWidth(i)
gc.line(250+(count-80)*25,150,(count-80)*25-150,570)
end
gc.setColor(1,1,1)
gc.setColor(1,1,1,.125)
for i=19,5,-2 do
gc.setLineWidth(i)
gc.line(250+(count-80)*25,150,(count-80)*25-150,570)
end
gc.setStencilTest()
end
function Pnt.main()
gc.setColor(1,1,1)
setFont(30)
gc.print("Alpha V0.7.4",370,150)
gc.print("Alpha V0.7.5",370,150)
gc.print(system,530,110)
gc.draw(titleImage,30,30)
end
@@ -291,23 +290,12 @@ function Pnt.play()
gc.stencil(stencil_field_small,"replace",1)
gc.translate(0,P.fieldBeneath)
gc.setStencilTest("equal",1)
if P.result then
for j=int(P.fieldBeneath/30+1),#P.field do
if P.falling<=0 or without(P.clearing,j)then
for i=1,10 do
if P.field[j][i]>0 then
drawPixelmini(j,i,P.field[j][i],min(P.visTime[j][i],20)*.05)
end
end
end
end
else
for j=int(P.fieldBeneath/30+1),#P.field do
if P.falling<=0 or without(P.clearing,j)then
for i=1,10 do
if P.field[j][i]>0 then
drawPixelmini(j,i,P.field[j][i],1)
end
gc.setColor(1,1,1,P.result and max(20-P.counter,0)*.05 or 1)
for j=int(P.fieldBeneath/30+1),#P.field do
if P.falling<=0 or without(P.clearing,j)then
for i=1,10 do
if P.field[j][i]>0 then
drawPixelmini(j,i,P.field[j][i])
end
end
end
@@ -448,7 +436,7 @@ function Pnt.play()
end
end--Next
if frame<180 then
local count=180-frame
local count=179-frame
gc.push("transform")
gc.translate(155,220)
gc.setColor(1,1,1)
@@ -491,18 +479,25 @@ function Pnt.play()
drawVirtualkey()
end
if modeEnv.royaleMode then
gc.setLineWidth(5)
gc.setColor(1,1,0,.2)
P=players[1]
if P.atkMode~=4 then
gc.setLineWidth(5)
gc.setColor(.8,1,0,.2)
else
gc.setLineWidth(9)
gc.setColor(1,.6,.2,.4)
end
for i=1,#players.alive do
local p=players.alive[i]
if p.atking==players[1]then
gc.line(p.centerX,p.centerY,P.centerX,P.centerY)
end
end
if P.atking then
gc.setColor(0,.5,1,.2+(sin(Timer()*7)+1)*.1)
gc.line(P.centerX,P.centerY,P.atking.centerX,P.atking.centerY)
if P.atkMode~=4 then
if P.atking then
gc.setColor(0,.5,1,.2+(sin(Timer()*7)+1)*.1)
gc.line(P.centerX,P.centerY,P.atking.centerX,P.atking.centerY)
end
end
end
end

View File

@@ -6,18 +6,20 @@ function C(x,y)
end
gc.setDefaultFilter("nearest","nearest")
miniTitle=C(26,14)
gc.setColor(1,1,1)
for i=1,#miniTitle_pixel do
gc.rectangle("fill",unpack(miniTitle_pixel[i]))
end
gc.setDefaultFilter("linear","linear")
titleImage=N("/image/mess/title.png")
spinCenter=N("/image/mess/spinCenter.png")
dialCircle=N("/image/mess/dialCircle.png")
dialNeedle=N("/image/mess/dialNeedle.png")
badgeIcon=N("/image/mess/badge.png")
local blockImg=N("/image/block/1.png")
blockSkin,blockSkinmini={},{}
for i=1,13 do
C(30,30)
gc.draw(blockImg,30-30*i,0)
blockSkin[i]=c
C(6,6)
gc.draw(blockImg,6-6*i,0,nil,.2)
blockSkinmini[i]=c
end
for i=1,13 do
end
blockImg:release()
RCPB={10,33,200,33,105,5,105,60}
do royaleCtrlPad=C(300,100)
@@ -30,25 +32,6 @@ do royaleCtrlPad=C(300,100)
end
end
do local img=N("/image/block/1.png")
blockSkin,blockSkinmini={},{}
for i=1,13 do
C(30,30)
gc.draw(img,30-30*i,0)
blockSkin[i]=c
C(12,12)
gc.draw(img,12-12*i,0,nil,.4)
blockSkinmini[i]=c
end
img:release()
end
background={
N("/image/BG/bg1.jpg"),
N("/image/BG/bg2.png"),
}
gc.setDefaultFilter("nearest","nearest")
virtualkeyIcon={}
for i=1,10 do
virtualkeyIcon[i]=N("/image/virtualkey/"..actName[i]..".png")
@@ -98,6 +81,16 @@ PTC.attack[3]:setSpin(6)
PTC.attack[3]:setColors(1,1,1,.7,1,1,1,0)
--Attack particles
gc.setDefaultFilter("linear","linear")
titleImage=N("/image/mess/title.png")
spinCenter=N("/image/mess/spinCenter.png")
dialCircle=N("/image/mess/dialCircle.png")
dialNeedle=N("/image/mess/dialNeedle.png")
badgeIcon=N("/image/mess/badge.png")
background={
N("/image/BG/bg1.jpg"),
N("/image/BG/bg2.png"),
}
c=nil
gc.setCanvas()
gc.setDefaultFilter("linear","linear")
gc.setCanvas()

View File

@@ -105,7 +105,7 @@ function Tmr.play(dt)
P.ai.controlDelay=P.ai.controlDelay0+2
else
AI_getControls(P.ai.controls)
P.ai.controlDelay=2*P.ai.controlDelay0
P.ai.controlDelay=rnd(3)*P.ai.controlDelay0
end
end
end
@@ -243,7 +243,7 @@ function Tmr.play(dt)
PTC.dust[p]:update(dt)
end
end
if modeEnv.royale and frame%120==0 then
if modeEnv.royale and frame%75==0 then
freshRoyaleTarget()
end
setmetatable(_G,nil)