wip(bunsik): 경제 개편 공용 로직 — 업그레이드 갈래, 의자·테이블 배치와 길 찾기(Floor), 알바생 역할·시급, 손님 러시·홍보·쫓아내기 로직, 서버↔클라이언트 약속(NETWORK.md)
서버·클라이언트는 다음 커밋에서 새 구조로 옮깁니다(이 커밋만으로는 빌드 검사가 통과하지 않음). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,22 +1,43 @@
|
||||
--!strict
|
||||
-- 분식집 경제 수치. ECONOMY.md 표와 같은 숫자여야 합니다.
|
||||
-- 숫자를 바꾸면 `lune run tools/sim.luau` 로 구매 시점을 다시 확인합니다.
|
||||
--
|
||||
-- 2026-10-14: 한 줄로 쭉 사던 업그레이드 20개를 갈래(트랙)별로 나눴습니다.
|
||||
-- 갈래: 건물(포장마차 → 실내 → 2층), 메뉴 해금, 판매 금액, 손님 오는 속도, 화구, 쟁반, 알바생 기능
|
||||
-- 자리(테이블·의자)는 꾸미기에서 사고 원하는 곳에 놓습니다. 손님이 앉는 자리 수 = 놓은 의자 수입니다.
|
||||
-- 알바생은 알바생 기능을 산 뒤 역할(요리·서빙·홍보)별로 돈 주고 고용하고, 1분마다 시급을 줍니다.
|
||||
|
||||
export type Effect = {
|
||||
seats: number?, -- 테이블 수
|
||||
spawn: number?, -- 손님 간격(초)
|
||||
cook: number?, -- 조리 시간(초)
|
||||
price: number?, -- 가격 배율
|
||||
helper: boolean?, -- 알바생(조리 자동)
|
||||
menu: string?, -- 해금할 메뉴
|
||||
carry: number?, -- 한 번에 드는 접시 수
|
||||
stage: number?, -- 가게 단계(2 = 실내 분식집)
|
||||
export type Level = {
|
||||
cost: number,
|
||||
stage: number, -- 이 단계(건물) 이상이어야 살 수 있음
|
||||
value: any, -- 갈래마다 뜻이 다름(메뉴 이름, 배율, 초, 접시 수, 단계)
|
||||
}
|
||||
|
||||
export type Purchase = {
|
||||
export type Track = {
|
||||
id: string,
|
||||
cost: number,
|
||||
effect: Effect,
|
||||
levels: { Level },
|
||||
}
|
||||
|
||||
export type Levels = { [string]: number }
|
||||
|
||||
export type Staff = { [string]: number } -- 역할별 고용 수(Cook, Server, Promoter)
|
||||
|
||||
export type Stats = {
|
||||
stage: number,
|
||||
menus: { string },
|
||||
price: number,
|
||||
spawn: number, -- 손님 간격(초). 홍보 알바·손님 러시 반영 전 값
|
||||
cook: number,
|
||||
carry: number,
|
||||
staffUnlocked: boolean,
|
||||
seats: number,
|
||||
}
|
||||
|
||||
export type Role = {
|
||||
id: string,
|
||||
hire: number, -- 고용비(한 번)
|
||||
wage: number, -- 시급(1분마다, 판매 금액 배율을 곱함)
|
||||
max: number,
|
||||
}
|
||||
|
||||
export type Menu = {
|
||||
@@ -24,40 +45,35 @@ export type Menu = {
|
||||
icon: string,
|
||||
}
|
||||
|
||||
export type Stats = {
|
||||
seats: number,
|
||||
spawn: number,
|
||||
cook: number,
|
||||
price: number,
|
||||
helper: boolean,
|
||||
menus: { string },
|
||||
carry: number,
|
||||
stage: number,
|
||||
}
|
||||
|
||||
local Economy = {}
|
||||
|
||||
Economy.WALK = 5 -- 조리대 -> 테이블 -> 조리대 왕복(초, 시뮬레이터 가정)
|
||||
Economy.EAT = 6 -- 식사 시간(초)
|
||||
Economy.WALK_IN = 2.5 -- 손님이 입구에서 자리까지 걷는 시간(초)
|
||||
Economy.COUNTER_MAX = 3 -- 알바생이 미리 만들어 두는 접시 최대 수
|
||||
Economy.WALK_IN = 2.5 -- 손님이 입구에서 자리까지 걷는 기본 시간(초). 실제 길 길이에 맞춰 자리마다 바뀝니다
|
||||
Economy.COUNTER_MAX = 3 -- 요리 알바가 미리 만들어 두는 접시 최대 수(요리 알바 1명당)
|
||||
Economy.BOOST_MINUTES = 10 -- 돈 부스트 팩: 현재 1분 매출 x 10분
|
||||
Economy.BOOST_MIN = 100 -- 돈 부스트 팩 최소 지급액
|
||||
Economy.GUEST_MULT = 2 -- 다른 플레이어가 손님으로 오면 주인은 접시 값의 2배를 받습니다
|
||||
Economy.GUEST_WAIT = 60 -- 손님으로 온 플레이어가 음식을 기다리는 최대 시간(초)
|
||||
Economy.GUEST_BONUS_COOLDOWN = 60 -- 손님으로 먹었을 때 시식 보너스는 1분에 한 번
|
||||
|
||||
Economy.START = {
|
||||
money = 0,
|
||||
seats = 1,
|
||||
spawn = 6,
|
||||
cook = 2.5,
|
||||
price = 1,
|
||||
helper = false,
|
||||
menus = { "Tteokbokki" },
|
||||
carry = 1,
|
||||
stage = 1,
|
||||
}
|
||||
Economy.WAGE_PERIOD = 60 -- 시급은 1분마다 줍니다(게임 속 1시간 = 1분)
|
||||
Economy.STRIKE_RETRY = 5 -- 시급이 모자라 쉬는 알바생은 5초마다 다시 확인
|
||||
Economy.SERVER_TRIP = 3 -- 서빙 알바가 카운터에서 손님 자리까지 가는 기본 시간(초, 자리마다 바뀜)
|
||||
Economy.PROMOTER_MULT = 0.75 -- 홍보 알바가 있으면 손님 간격 x0.75
|
||||
|
||||
Economy.RUSH_SECONDS = 600 -- 손님 러시(유료): 10분 동안
|
||||
Economy.RUSH_MULT = 0.5 -- 손님 간격 절반
|
||||
Economy.PROMOTE_MAX = 3 -- 홍보 한 번에 옆 가게에서 데려오는 손님 수(빈자리만큼)
|
||||
Economy.PROMOTE_COOLDOWN = 180 -- 광고 없이 하는 홍보 대기 시간(초)
|
||||
Economy.PROMOTE_AD_COOLDOWN = 45 -- 광고를 보고 하는 홍보 대기 시간(초)
|
||||
Economy.KICK_SHIELD = 180 -- 손님을 쫓겨난 가게는 3분 동안 다시 쫓겨나지 않음
|
||||
Economy.TRANSFER_WALK = 7 -- 옆 가게에서 우리 가게 자리까지 걸어오는 시간(초)
|
||||
|
||||
Economy.START_MONEY = 0
|
||||
Economy.START_SPAWN = 10 -- 처음 손님 간격(예전 6초에서 느리게)
|
||||
Economy.START_COOK = 2.5
|
||||
Economy.START_MENUS = { "Tteokbokki" }
|
||||
|
||||
Economy.MENUS = {
|
||||
Tteokbokki = { price = 15, icon = "🌶️" },
|
||||
@@ -70,89 +86,270 @@ Economy.MENUS = {
|
||||
-- 메뉴 표시 순서
|
||||
Economy.MENU_ORDER = { "Tteokbokki", "Gimbap", "Sundae", "Eomuk", "Twigim" }
|
||||
|
||||
-- 1~10: 첫 10분(1단계 포장마차). 11~20: 2단계 실내 분식집.
|
||||
Economy.PURCHASES = {
|
||||
{ id = "Table2", cost = 10, effect = { seats = 2 } },
|
||||
{ id = "UnlockGimbap", cost = 40, effect = { menu = "Gimbap" } },
|
||||
{ id = "Sign1", cost = 70, effect = { spawn = 5 } },
|
||||
{ id = "Stove1", cost = 90, effect = { cook = 1.5 } },
|
||||
{ id = "Table3", cost = 120, effect = { seats = 3 } },
|
||||
{ id = "UnlockSundae", cost = 160, effect = { menu = "Sundae" } },
|
||||
{ id = "Sauce1", cost = 240, effect = { price = 1.5 } },
|
||||
{ id = "Helper", cost = 360, effect = { helper = true } },
|
||||
{ id = "Table4", cost = 480, effect = { seats = 4, spawn = 4 } },
|
||||
{ id = "Expand", cost = 600, effect = { stage = 2 } },
|
||||
|
||||
{ id = "Tray1", cost = 700, effect = { carry = 2 } },
|
||||
{ id = "Table5", cost = 800, effect = { seats = 5 } },
|
||||
-- 업그레이드 갈래. 각 갈래는 앞 단계부터 차례로 삽니다.
|
||||
Economy.TRACKS = {
|
||||
{
|
||||
id = "UnlockEomuk",
|
||||
cost = 950,
|
||||
effect = { menu = "Eomuk" },
|
||||
id = "Stage", -- 건물: 1 포장마차 → 2 실내 분식집 → 3 2층
|
||||
levels = {
|
||||
{ cost = 450, stage = 1, value = 2 },
|
||||
{ cost = 5000, stage = 2, value = 3 },
|
||||
},
|
||||
},
|
||||
{ id = "Sign2", cost = 1150, effect = { spawn = 3 } },
|
||||
{ id = "Table6", cost = 1400, effect = { seats = 6 } },
|
||||
{ id = "Stove2", cost = 1700, effect = { cook = 1 } },
|
||||
{
|
||||
id = "UnlockTwigim",
|
||||
cost = 2000,
|
||||
effect = { menu = "Twigim" },
|
||||
id = "Menu", -- 새 메뉴 해금
|
||||
levels = {
|
||||
{ cost = 40, stage = 1, value = "Gimbap" },
|
||||
{ cost = 160, stage = 1, value = "Sundae" },
|
||||
{ cost = 950, stage = 2, value = "Eomuk" },
|
||||
{ cost = 2000, stage = 2, value = "Twigim" },
|
||||
},
|
||||
},
|
||||
{ id = "Sauce2", cost = 2500, effect = { price = 2 } },
|
||||
{ id = "Tray2", cost = 3000, effect = { carry = 3 } },
|
||||
{ id = "Table8", cost = 3600, effect = { seats = 8, spawn = 2.5 } },
|
||||
} :: { Purchase }
|
||||
{
|
||||
id = "Price", -- 판매 금액(양념 비법): 모든 메뉴 값 배율
|
||||
levels = {
|
||||
{ cost = 120, stage = 1, value = 1.25 },
|
||||
{ cost = 260, stage = 1, value = 1.5 },
|
||||
{ cost = 1100, stage = 2, value = 1.75 },
|
||||
{ cost = 2400, stage = 2, value = 2 },
|
||||
{ cost = 7000, stage = 3, value = 2.5 },
|
||||
{ cost = 12000, stage = 3, value = 3 },
|
||||
},
|
||||
},
|
||||
{
|
||||
id = "Speed", -- 손님 오는 속도(간판·전단지): 손님 간격(초)
|
||||
levels = {
|
||||
{ cost = 60, stage = 1, value = 8.5 },
|
||||
{ cost = 150, stage = 1, value = 7 },
|
||||
{ cost = 320, stage = 1, value = 6 },
|
||||
{ cost = 1000, stage = 2, value = 5 },
|
||||
{ cost = 2000, stage = 2, value = 4.2 },
|
||||
{ cost = 6500, stage = 3, value = 3.5 },
|
||||
{ cost = 11000, stage = 3, value = 3 },
|
||||
},
|
||||
},
|
||||
{
|
||||
id = "Stove", -- 화구: 요리 창에서 누르는 양(조리 수준)
|
||||
levels = {
|
||||
{ cost = 90, stage = 1, value = 1.8 },
|
||||
{ cost = 800, stage = 2, value = 1.4 },
|
||||
{ cost = 1800, stage = 2, value = 1 },
|
||||
},
|
||||
},
|
||||
{
|
||||
id = "Tray", -- 쟁반: 한 번에 드는 접시 수
|
||||
levels = {
|
||||
{ cost = 700, stage = 2, value = 2 },
|
||||
{ cost = 2600, stage = 2, value = 3 },
|
||||
},
|
||||
},
|
||||
{
|
||||
id = "Staff", -- 알바생 기능 해금(이걸 사야 알바생을 고용할 수 있음)
|
||||
levels = {
|
||||
{ cost = 250, stage = 1, value = true },
|
||||
},
|
||||
},
|
||||
} :: { Track }
|
||||
|
||||
Economy.MAX_SEATS = 8
|
||||
Economy.TRACK_ORDER = {} :: { string }
|
||||
local trackById: { [string]: Track } = {}
|
||||
for _, t in Economy.TRACKS do
|
||||
table.insert(Economy.TRACK_ORDER, t.id)
|
||||
trackById[t.id] = t
|
||||
end
|
||||
|
||||
-- 앞에서부터 `bought`개를 산 상태의 능력치
|
||||
function Economy.statsAt(bought: number): Stats
|
||||
local s = Economy.START
|
||||
function Economy.track(id: string): Track?
|
||||
return trackById[id]
|
||||
end
|
||||
|
||||
-- 알바생 역할. 시급은 판매 금액 배율만큼 오릅니다(가게가 클수록 시급도 높음).
|
||||
Economy.ROLES = {
|
||||
{ id = "Cook", hire = 200, wage = 12, max = 2 }, -- 요리: 카운터에 접시를 만들어 둠
|
||||
{ id = "Server", hire = 500, wage = 15, max = 2 }, -- 서빙: 카운터 접시를 손님 자리로 날라 줌
|
||||
{ id = "Promoter", hire = 400, wage = 10, max = 1 }, -- 홍보: 입구에서 전단지, 손님 간격 x0.75
|
||||
} :: { Role }
|
||||
|
||||
local roleById: { [string]: Role } = {}
|
||||
for _, r in Economy.ROLES do
|
||||
roleById[r.id] = r
|
||||
end
|
||||
|
||||
function Economy.role(id: string): Role?
|
||||
return roleById[id]
|
||||
end
|
||||
|
||||
-- 자리(손님 의자). 테이블 하나에 의자 4개까지. 건물 단계별로 놓을 수 있는 수가 다릅니다.
|
||||
Economy.CHAIRS_PER_TABLE = 4
|
||||
Economy.SEAT_CAP = { 6, 14, 24 } -- 단계별 최대 의자 수
|
||||
Economy.TABLE_CAP = { 3, 6, 12 } -- 단계별 최대 테이블 수
|
||||
|
||||
-- s번째 자리(의자)를 사는 값. 처음 자리는 공짜(처음부터 테이블 1 + 의자 1).
|
||||
function Economy.seatCost(s: number): number
|
||||
if s <= 1 then
|
||||
return 0
|
||||
end
|
||||
local raw = 10 * (s - 1) ^ 2.1
|
||||
return math.floor(raw / 5 + 0.5) * 5
|
||||
end
|
||||
|
||||
-- 테이블(의자 1개 포함)은 자리 값에 테이블 값을 더합니다.
|
||||
function Economy.tableCost(tables: number, seats: number): number
|
||||
return Economy.seatCost(seats + 1) + 15 * tables * tables
|
||||
end
|
||||
|
||||
-- 꾸미기 소품(손님 수와 상관없는 장식). 크기는 Floor.FOOTPRINT
|
||||
Economy.DECOR = {
|
||||
{ id = "Plant", cost = 50 },
|
||||
{ id = "Rug", cost = 80 },
|
||||
{ id = "Balloons", cost = 120 },
|
||||
{ id = "Lamp", cost = 150 },
|
||||
{ id = "Teddy", cost = 250 },
|
||||
{ id = "Fridge", cost = 400 },
|
||||
} :: { { id: string, cost: number } }
|
||||
|
||||
Economy.DECOR_MAX = 20
|
||||
|
||||
function Economy.decor(id: string): { id: string, cost: number }?
|
||||
for _, d in Economy.DECOR do
|
||||
if d.id == id then
|
||||
return d
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
-- 가게 건물 디자인(실내 분식집 이상에서 바꿀 수 있음). pass가 있으면 게임패스(Products 키)로 삽니다.
|
||||
Economy.DESIGNS = {
|
||||
{ id = "Basic" },
|
||||
{ id = "Mint" },
|
||||
{ id = "Brick" },
|
||||
{ id = "Candy", pass = "CANDY_DESIGN_PASS" },
|
||||
{ id = "Hanok", pass = "HANOK_DESIGN_PASS" },
|
||||
} :: { { id: string, pass: string? } }
|
||||
|
||||
function Economy.design(id: string): { id: string, pass: string? }?
|
||||
for _, d in Economy.DESIGNS do
|
||||
if d.id == id then
|
||||
return d
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
Economy.NAME_MAX = 20 -- 가게 이름 최대 글자 수
|
||||
|
||||
function Economy.level(levels: Levels, id: string): number
|
||||
return levels[id] or 0
|
||||
end
|
||||
|
||||
function Economy.emptyLevels(): Levels
|
||||
local out = {}
|
||||
for _, id in Economy.TRACK_ORDER do
|
||||
out[id] = 0
|
||||
end
|
||||
return out
|
||||
end
|
||||
|
||||
-- 저장된 값을 정리합니다(없는 갈래, 범위 밖 숫자).
|
||||
function Economy.cleanLevels(raw: any): Levels
|
||||
local out = Economy.emptyLevels()
|
||||
if typeof(raw) == "table" then
|
||||
for _, t in Economy.TRACKS do
|
||||
local v = raw[t.id]
|
||||
if typeof(v) == "number" then
|
||||
out[t.id] = math.clamp(math.floor(v), 0, #t.levels)
|
||||
end
|
||||
end
|
||||
end
|
||||
return out
|
||||
end
|
||||
|
||||
-- 갈래 레벨과 자리 수로 능력치를 계산합니다.
|
||||
function Economy.stats(levels: Levels, seats: number): Stats
|
||||
local stats: Stats = {
|
||||
seats = s.seats,
|
||||
spawn = s.spawn,
|
||||
cook = s.cook,
|
||||
price = s.price,
|
||||
helper = s.helper,
|
||||
menus = table.clone(s.menus),
|
||||
carry = s.carry,
|
||||
stage = s.stage,
|
||||
stage = 1,
|
||||
menus = table.clone(Economy.START_MENUS),
|
||||
price = 1,
|
||||
spawn = Economy.START_SPAWN,
|
||||
cook = Economy.START_COOK,
|
||||
carry = 1,
|
||||
staffUnlocked = false,
|
||||
seats = math.max(1, seats),
|
||||
}
|
||||
for i = 1, math.min(bought, #Economy.PURCHASES) do
|
||||
local e = Economy.PURCHASES[i].effect
|
||||
if e.seats then
|
||||
stats.seats = e.seats
|
||||
end
|
||||
if e.spawn then
|
||||
stats.spawn = e.spawn
|
||||
end
|
||||
if e.cook then
|
||||
stats.cook = e.cook
|
||||
end
|
||||
if e.price then
|
||||
stats.price = e.price
|
||||
end
|
||||
if e.helper then
|
||||
stats.helper = true
|
||||
end
|
||||
if e.menu then
|
||||
table.insert(stats.menus, e.menu)
|
||||
end
|
||||
if e.carry then
|
||||
stats.carry = e.carry
|
||||
end
|
||||
if e.stage then
|
||||
stats.stage = e.stage
|
||||
for _, t in Economy.TRACKS do
|
||||
local n = math.min(levels[t.id] or 0, #t.levels)
|
||||
for i = 1, n do
|
||||
local v = t.levels[i].value
|
||||
if t.id == "Stage" then
|
||||
stats.stage = v
|
||||
elseif t.id == "Menu" then
|
||||
table.insert(stats.menus, v)
|
||||
elseif t.id == "Price" then
|
||||
stats.price = v
|
||||
elseif t.id == "Speed" then
|
||||
stats.spawn = v
|
||||
elseif t.id == "Stove" then
|
||||
stats.cook = v
|
||||
elseif t.id == "Tray" then
|
||||
stats.carry = v
|
||||
elseif t.id == "Staff" then
|
||||
stats.staffUnlocked = true
|
||||
end
|
||||
end
|
||||
end
|
||||
return stats
|
||||
end
|
||||
|
||||
-- 갈래의 다음 단계(없으면 nil)
|
||||
function Economy.nextLevel(levels: Levels, id: string): Level?
|
||||
local t = trackById[id]
|
||||
if not t then
|
||||
return nil
|
||||
end
|
||||
return t.levels[(levels[id] or 0) + 1]
|
||||
end
|
||||
|
||||
function Economy.seatCap(stage: number): number
|
||||
return Economy.SEAT_CAP[math.clamp(stage, 1, #Economy.SEAT_CAP)]
|
||||
end
|
||||
|
||||
function Economy.tableCap(stage: number): number
|
||||
return Economy.TABLE_CAP[math.clamp(stage, 1, #Economy.TABLE_CAP)]
|
||||
end
|
||||
|
||||
-- 한 접시 값(정수). moneyMult는 2배 수익 게임패스(1 또는 2)
|
||||
function Economy.dishPrice(menu: string, stats: Stats, moneyMult: number): number
|
||||
return math.floor(Economy.MENUS[menu].price * stats.price) * moneyMult
|
||||
end
|
||||
|
||||
-- 역할별 시급(1분마다)
|
||||
function Economy.wage(roleId: string, stats: Stats): number
|
||||
local r = roleById[roleId]
|
||||
if not r then
|
||||
return 0
|
||||
end
|
||||
return math.floor(r.wage * stats.price + 0.5)
|
||||
end
|
||||
|
||||
function Economy.totalWage(staff: Staff, stats: Stats): number
|
||||
local total = 0
|
||||
for _, r in Economy.ROLES do
|
||||
total += (staff[r.id] or 0) * Economy.wage(r.id, stats)
|
||||
end
|
||||
return total
|
||||
end
|
||||
|
||||
-- 손님 간격(초): 홍보 알바, 손님 러시 반영
|
||||
function Economy.spawnInterval(stats: Stats, promoters: number, rush: boolean): number
|
||||
local s = stats.spawn
|
||||
if promoters > 0 then
|
||||
s *= Economy.PROMOTER_MULT
|
||||
end
|
||||
if rush then
|
||||
s *= Economy.RUSH_MULT
|
||||
end
|
||||
return s
|
||||
end
|
||||
|
||||
-- 현재 능력치로 1분에 버는 돈(대략). 돈 부스트 팩 지급액 계산용
|
||||
function Economy.incomePerMinute(stats: Stats): number
|
||||
local total = 0
|
||||
@@ -170,4 +367,132 @@ function Economy.boostAmount(stats: Stats): number
|
||||
return math.max(Economy.BOOST_MIN, Economy.incomePerMinute(stats) * Economy.BOOST_MINUTES)
|
||||
end
|
||||
|
||||
-- 이름판에 붙는 가게 레벨: 산 업그레이드 단계 수 + 늘린 자리 수
|
||||
function Economy.shopLevel(levels: Levels, seats: number): number
|
||||
local n = math.max(0, seats - 1)
|
||||
for _, id in Economy.TRACK_ORDER do
|
||||
n += levels[id] or 0
|
||||
end
|
||||
return n
|
||||
end
|
||||
|
||||
export type Offer = {
|
||||
kind: string, -- "track" | "seat" | "table"
|
||||
id: string, -- 갈래 id 또는 "Seat"/"Table"
|
||||
cost: number,
|
||||
}
|
||||
|
||||
-- 지금 살 수 있는 다음 단계들(건물 단계 조건을 채운 것). 화면 아래 "다음 업그레이드" 추천과 봇이 씁니다.
|
||||
-- tables: 놓은 테이블 수, seats: 놓은 의자 수
|
||||
function Economy.offers(levels: Levels, tables: number, seats: number): { Offer }
|
||||
local stats = Economy.stats(levels, seats)
|
||||
local out: { Offer } = {}
|
||||
for _, id in Economy.TRACK_ORDER do
|
||||
local nl = Economy.nextLevel(levels, id)
|
||||
if nl and nl.stage <= stats.stage then
|
||||
table.insert(out, { kind = "track", id = id, cost = nl.cost })
|
||||
end
|
||||
end
|
||||
if seats < Economy.seatCap(stats.stage) then
|
||||
if seats < tables * Economy.CHAIRS_PER_TABLE then
|
||||
table.insert(out, { kind = "seat", id = "Seat", cost = Economy.seatCost(seats + 1) })
|
||||
end
|
||||
if tables < Economy.tableCap(stats.stage) then
|
||||
table.insert(out, { kind = "table", id = "Table", cost = Economy.tableCost(tables, seats) })
|
||||
end
|
||||
end
|
||||
table.sort(out, function(a, b)
|
||||
if a.cost ~= b.cost then
|
||||
return a.cost < b.cost
|
||||
end
|
||||
return a.id < b.id
|
||||
end)
|
||||
return out
|
||||
end
|
||||
|
||||
-- 예전 세이브(한 줄 업그레이드 Bought개)를 갈래 레벨로 옮깁니다.
|
||||
-- 돌려주는 값: 레벨, 자리 수, 테이블 수, 요리 알바 수
|
||||
function Economy.migrate(bought: number): (Levels, number, number, number)
|
||||
local OLD = {
|
||||
"Table2",
|
||||
"UnlockGimbap",
|
||||
"Sign1",
|
||||
"Stove1",
|
||||
"Table3",
|
||||
"UnlockSundae",
|
||||
"Sauce1",
|
||||
"Helper",
|
||||
"Table4",
|
||||
"Expand",
|
||||
"Tray1",
|
||||
"Table5",
|
||||
"UnlockEomuk",
|
||||
"Sign2",
|
||||
"Table6",
|
||||
"Stove2",
|
||||
"UnlockTwigim",
|
||||
"Sauce2",
|
||||
"Tray2",
|
||||
"Table8",
|
||||
}
|
||||
local levels = Economy.emptyLevels()
|
||||
local seats = 1
|
||||
local cooks = 0
|
||||
local function up(id: string, n: number)
|
||||
levels[id] = math.max(levels[id], n)
|
||||
end
|
||||
for i = 1, math.clamp(bought, 0, #OLD) do
|
||||
local id = OLD[i]
|
||||
if id == "Table2" then
|
||||
seats = 2
|
||||
elseif id == "Table3" then
|
||||
seats = 3
|
||||
elseif id == "Table4" then
|
||||
seats = 4
|
||||
up("Speed", 3)
|
||||
elseif id == "Table5" then
|
||||
seats = 5
|
||||
elseif id == "Table6" then
|
||||
seats = 6
|
||||
elseif id == "Table8" then
|
||||
seats = 8
|
||||
up("Speed", 5)
|
||||
elseif id == "UnlockGimbap" then
|
||||
up("Menu", 1)
|
||||
elseif id == "UnlockSundae" then
|
||||
up("Menu", 2)
|
||||
elseif id == "UnlockEomuk" then
|
||||
up("Menu", 3)
|
||||
elseif id == "UnlockTwigim" then
|
||||
up("Menu", 4)
|
||||
elseif id == "Sign1" then
|
||||
up("Speed", 2)
|
||||
elseif id == "Sign2" then
|
||||
up("Speed", 4)
|
||||
elseif id == "Stove1" then
|
||||
up("Stove", 1)
|
||||
elseif id == "Stove2" then
|
||||
up("Stove", 3)
|
||||
elseif id == "Sauce1" then
|
||||
up("Price", 2)
|
||||
elseif id == "Sauce2" then
|
||||
up("Price", 4)
|
||||
elseif id == "Helper" then
|
||||
up("Staff", 1)
|
||||
cooks = 1
|
||||
elseif id == "Expand" then
|
||||
up("Stage", 1)
|
||||
elseif id == "Tray1" then
|
||||
up("Tray", 1)
|
||||
elseif id == "Tray2" then
|
||||
up("Tray", 2)
|
||||
end
|
||||
end
|
||||
-- 예전 테이블은 1인석이었으므로 자리 수만큼 테이블을 둡니다(단계별 최대 수 안에서).
|
||||
local stage = Economy.stats(levels, seats).stage
|
||||
local tables = math.min(seats, Economy.tableCap(stage))
|
||||
seats = math.min(seats, tables * Economy.CHAIRS_PER_TABLE)
|
||||
return levels, seats, tables, cooks
|
||||
end
|
||||
|
||||
return Economy
|
||||
|
||||
Reference in New Issue
Block a user