Skip to content

Commit

Permalink
三个游戏重命名为石晶-Brik,琼晶-Gela,塑晶-Acry
Browse files Browse the repository at this point in the history
  • Loading branch information
MrZ626 committed May 8, 2024
1 parent 6ff1067 commit 94063c5
Show file tree
Hide file tree
Showing 183 changed files with 1,830 additions and 1,777 deletions.
4 changes: 2 additions & 2 deletions assets/char.lua
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ local L={
next ='E092',
back_chevron ='E093',
},
mino={
brik={
Z='E100',
S='E101',
J='E102',
Expand Down Expand Up @@ -278,7 +278,7 @@ local L={
},
zchan={
mrz ='E200',
mino ='E201',
brik ='E201',
happy ='E202',
grinning ='E203',
frowning ='E204',
Expand Down
112 changes: 56 additions & 56 deletions assets/game/gemPlayer.lua → assets/game/acryPlayer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ local max,min=math.max,math.min
local floor=math.floor
local ins,rem=table.insert,table.remove

---@class Techmino.Player.Gem: Techmino.Player
---@class Techmino.Player.Acry: Techmino.Player
---@field field any[][]
local GP=setmetatable({},{__index=require'basePlayer',__metatable=true})
local AP=setmetatable({},{__index=require'basePlayer',__metatable=true})

--[[ Gem tags:
--[[ Acry tags:
int color <1~7>
string type <'gem','cube'>
string type <'acry','cube'>
boolean movable
string appearance <'flame'|'star'|'nova'>
Expand Down Expand Up @@ -72,23 +72,23 @@ local defaultSoundFunc={
win= function() FMOD.effect('win') end,
fail= function() FMOD.effect('fail') end,
}
---@type Map<fun(P:Techmino.Player.Gem):any>
GP.scriptCmd={
---@type Map<fun(P:Techmino.Player.Acry):any>
AP.scriptCmd={
}

--------------------------------------------------------------
-- Actions

GP._actions={}
for k,v in next,mechLib.mino.actions do GP._actions[k]=GP:_getActionObj(v) end
AP._actions={}
for k,v in next,mechLib.brik.actions do AP._actions[k]=AP:_getActionObj(v) end

--------------------------------------------------------------
-- Effects

--------------------------------------------------------------
-- Game methods

function GP:printField() -- For debugging
function AP:printField() -- For debugging
local F=self.field
print('----------')
for y=self.settings.fieldSize,1,-1 do
Expand All @@ -99,7 +99,7 @@ function GP:printField() -- For debugging
print(s.."|")
end
end
function GP:isMovable(x,y)
function AP:isMovable(x,y)
if x>=1 and x<=self.settings.fieldSize and y>=1 and y<=self.settings.fieldSize then
local F=self.field
if F[y][x] then
Expand All @@ -111,15 +111,15 @@ function GP:isMovable(x,y)
return false
end
end
function GP:getGem(data)
function AP:getAcry(data)
local G={
type='gem',
type='acry',
movable=true,
}
if data then TABLE.cover(data,G) end
return G
end
function GP:setMoveBias(mode,C,dx,dy)
function AP:setMoveBias(mode,C,dx,dy)
if not C then return end
C.needCheck=nil
C.movable=false
Expand All @@ -134,7 +134,7 @@ function GP:setMoveBias(mode,C,dx,dy)
C.moveDelay=self.settings.moveDelay
end
end
function GP:erasePosition(x,y,src)
function AP:erasePosition(x,y,src)
local F=self.field
if F[y] then
local g=F[y][x]
Expand Down Expand Up @@ -166,13 +166,13 @@ function GP:erasePosition(x,y,src)
if g.generate then
ins(self.generateBuffer,{
x=x,y=y,
gem=g.generate,
acry=g.generate,
})
end
end
end
end
function GP:swap(mode,x,y,dx,dy)
function AP:swap(mode,x,y,dx,dy)
local F=self.field
if
self:isMovable(x,y) and self:isMovable(x+dx,y+dy)
Expand All @@ -199,7 +199,7 @@ function GP:swap(mode,x,y,dx,dy)
end
self:freshSwapCursor()
end
function GP:twist(mode,x,y,dir)
function AP:twist(mode,x,y,dir)
local F=self.field
if
self:isMovable(x,y) and
Expand Down Expand Up @@ -258,7 +258,7 @@ local function linkLen(F,color,x,y,dx,dy)
end
return cnt
end
function GP:psedoCheckPos(x,y)
function AP:psedoCheckPos(x,y)
local F=self.field
if not F[y][x] then return end
local color=F[y][x].color
Expand All @@ -269,18 +269,18 @@ function GP:psedoCheckPos(x,y)
if not F[y][x].dropCnt and 1+linkLen(F,color,x,y,-1,1)+ linkLen(F,color,x,y,1,-1)>=self.settings.diagonalLinkLen then return true end
return false
end
function GP:setClear(g,linkMode,len)
function AP:setClear(g,linkMode,len)
g.movable=false
g.clearTimer=g.immediately and 0 or self.settings.clearDelay
g.clearDelay=self.settings.clearDelay
g[linkMode]=len
end
function GP:setGenerate(g,gen)
function AP:setGenerate(g,gen)
g.immediately=true
g.clearTimer=0
g.generate=self:getGem(gen)
g.generate=self:getAcry(gen)
end
function GP:checkPosition(x,y)
function AP:checkPosition(x,y)
local F=self.field
if not F[y][x] then return end

Expand Down Expand Up @@ -410,15 +410,15 @@ function GP:checkPosition(x,y)
self:playSound('clear',line)
end
end
function GP:freshGems()
local newGems={}
function AP:freshAcry()
local newAcry={}
local F=self.field
for x=1,self.settings.fieldSize do
-- Drag gems down
-- Drag acry down
for y=1,self.settings.fieldSize do
-- F[y][x] is a hole
if not F[y][x] then
-- Find a gem above the hole
-- Find a acry above the hole
for gY=y+1,self.settings.fieldSize do
if F[gY][x] then
-- Move it if it's movable
Expand All @@ -432,7 +432,7 @@ function GP:freshGems()
end
end

-- Fill holes with new gems
-- Fill holes with new acry
local lowestHole=9
for y=1,self.settings.fieldSize do
if not F[y][x] then
Expand All @@ -441,27 +441,27 @@ function GP:freshGems()
end
end
for y=lowestHole,self.settings.fieldSize do
local g=self:getGem()
local g=self:getAcry()
self:setMoveBias('fall',g,0,9-lowestHole)
ins(newGems,g)
ins(newAcry,g)
F[y][x]=g
end
end
local freshTimes=0
repeat
for i=1,#newGems do
local g=newGems[i]
for i=1,#newAcry do
local g=newAcry[i]
g.color=self:random(self.settings.colors)
end
freshTimes=freshTimes+1
until freshTimes>=self.settings.refreshCount or self:hasMove()
end
function GP:hasMove()
function AP:hasMove()
return true
end
function GP:changeFieldSize(w,h,origX,origY)
function AP:changeFieldSize(w,h,origX,origY)
end
function GP:receive(data)
function AP:receive(data)
local B={
power=data.power,
cancelRate=data.cancelRate,
Expand All @@ -474,7 +474,7 @@ function GP:receive(data)
}
ins(self.garbageBuffer,B)
end
function GP:getScriptValue(arg)
function AP:getScriptValue(arg)
return
arg.d=='field_size' and self.settings.fieldSize or
arg.d=='cell' and (self.field[arg.y][arg.x] and 1 or 0)
Expand All @@ -483,7 +483,7 @@ end
--------------------------------------------------------------
-- Press & Release & Update & Render

function GP:getMousePos(x,y)
function AP:getMousePos(x,y)
local pos=self.pos
x,y=((x-pos.x)/pos.k/360+1)/2,((pos.y-y)/pos.k/360+1)/2
if x>=0 and x<1 and y>=0 and y<1 then
Expand All @@ -492,12 +492,12 @@ function GP:getMousePos(x,y)
return false,false
end
end
function GP:getSwapPos(x,y)
function AP:getSwapPos(x,y)
local size=self.settings.fieldSize
x,y=floor(x*size+1),floor(y*size+1)
if x>=1 and x<=size and y>=1 and y<=size then return x,y end
end
function GP:freshSwapCursor()
function AP:freshSwapCursor()
self.swapLock=false
if self.mouseX then
local sx,sy=self:getSwapPos(self.mouseX,self.mouseY)
Expand All @@ -506,20 +506,20 @@ function GP:freshSwapCursor()
end
end
end
function GP:getTwistPos(x,y)
function AP:getTwistPos(x,y)
local size=self.settings.fieldSize
x,y=floor(x*size+.5),floor(y*size+.5)
if x>=1 and x<=size-1 and y>=1 and y<=size-1 then return x,y end
end
function GP:freshTwistCursor()
function AP:freshTwistCursor()
if self.mouseX then
local tx,ty=self:getTwistPos(self.mouseX,self.mouseY)
if tx and (self.twistX~=tx or self.twistY~=ty) then
self.twistX,self.twistY=tx,ty
end
end
end
function GP:mouseDown(x,y,id)
function AP:mouseDown(x,y,id)
if id==2 then
if self.swapLock then
self:freshSwapCursor()
Expand Down Expand Up @@ -548,7 +548,7 @@ function GP:mouseDown(x,y,id)
end
end
end
function GP:mouseMove(x,y,_,_,_)
function AP:mouseMove(x,y,_,_,_)
self.mouseX,self.mouseY=self:getMousePos(x,y)

if self.mouseX then
Expand All @@ -573,10 +573,10 @@ function GP:mouseMove(x,y,_,_,_)
self:freshTwistCursor()
end
end
function GP:mouseUp(_,_,_)
function AP:mouseUp(_,_,_)
self.mousePressed=false
end
function GP:updateFrame()
function AP:updateFrame()
local SET=self.settings

-- Auto shift
Expand Down Expand Up @@ -729,11 +729,11 @@ function GP:updateFrame()
-- Check generations
while #self.generateBuffer>0 do
local gen=rem(self.generateBuffer,1)
F[gen.y][gen.x]=gen.gem
F[gen.y][gen.x]=gen.acry
end

if needFresh then
self:freshGems()
self:freshAcry()
end

-- Update garbage
Expand All @@ -744,7 +744,7 @@ function GP:updateFrame()
end
end
end
function GP:render()
function AP:render()
local SET=self.settings
local skin=SKIN.get(SET.skin)
SKIN.time=self.time
Expand Down Expand Up @@ -825,18 +825,18 @@ end
--------------------------------------------------------------
-- Other

function GP:decodeScript(line,errMsg)
function AP:decodeScript(line,errMsg)
-- TODO
-- error(errMsg.."No string command '"..cmd.."'")
end
function GP:checkScriptSyntax(cmd,arg,errMsg)
function AP:checkScriptSyntax(cmd,arg,errMsg)
-- TODO
end

--------------------------------------------------------------
-- Builder

---@class Techmino.Mode.Setting.Gem
---@class Techmino.Mode.Setting.Acry
local baseEnv={
-- Size
fieldSize=8,
Expand Down Expand Up @@ -865,16 +865,16 @@ local baseEnv={
script=false,

-- May be overrode with user setting
skin='gem_template',
skin='acry_template',
shakeness=.26,
inputDelay=0,
}
local soundEventMeta={
__index=defaultSoundFunc,
__metatable=true,
}
function GP.new()
local self=setmetatable(require'basePlayer'.new(),{__index=GP,__metatable=true})
function AP.new()
local self=setmetatable(require'basePlayer'.new(),{__index=AP,__metatable=true})
self.settings=TABLE.copy(baseEnv)
self.event={
-- Press & Release
Expand Down Expand Up @@ -906,14 +906,14 @@ function GP.new()

return self
end
function GP:initialize()
function AP:initialize()
require'basePlayer'.initialize(self)

self.field={}
for y=1,self.settings.fieldSize do
self.field[y]=TABLE.new(false,self.settings.fieldSize)
end
self:freshGems()
self:freshAcry()

self.movingGroups={}
self.generateBuffer={}
Expand All @@ -935,4 +935,4 @@ function GP:initialize()
end
--------------------------------------------------------------

return GP
return AP
Loading

0 comments on commit 94063c5

Please sign in to comment.