feat(potions-relics): 물약 시스템·유물 19종·아이콘/툴팁 UI (배포 퀄리티 P7) #40

Merged
gahusb merged 6 commits from feature/p7-potions-relics into main 2026-06-12 07:37:21 +09:00
7 changed files with 5585 additions and 67 deletions

File diff suppressed because one or more lines are too long

14
data/potions.json Normal file
View File

@@ -0,0 +1,14 @@
{
"potions": {
"redPotion": { "name": "빨간 포션", "desc": "HP 20 회복", "effect": "heal", "value": 20, "icon": "393e2a0d8da544899eaa8b22c97f832b" },
"firebomb": { "name": "화염병", "desc": "적에게 피해 20", "effect": "damage", "value": 20, "icon": "7ddb464c2574456289a4eb72ce86f193" },
"warriorElixir": { "name": "전사의 물약", "desc": "힘 +2", "effect": "strength", "value": 2, "icon": "7cfbd410581e4073815daaf5f3e6c72f" },
"guardPotion": { "name": "수호의 물약", "desc": "방어도 +12", "effect": "block", "value": 12, "icon": "8f8402dfa0f746e18bf606ed74302c0a" },
"manaElixir": { "name": "마나 엘릭서", "desc": "에너지 +2", "effect": "energy", "value": 2, "icon": "ec2778c366f6477ab0f8e7f06bcd73f4" },
"cursedVial": { "name": "저주의 병", "desc": "적에게 약화 3", "effect": "weak", "value": 3, "icon": "a9a2763fdb6849dcba3028c737487680" }
},
"dropChance": 0.4,
"baseSlots": 3,
"beltSlots": 5,
"shopPrice": 20
}

View File

@@ -1,10 +1,30 @@
{ {
"relics": { "relics": {
"ironHeart": { "name": "강철 심장", "desc": "전투 시작 시 방어도 +6", "hook": "combatStart", "effect": "block", "value": 6 }, "ironHeart": { "name": "강철 심장", "desc": "전투 시작 시 방어도 +6", "hook": "combatStart", "effect": "block", "value": 6, "icon": "e555b3a62f3c49dbb2c53784e6bd481f" },
"energyCore": { "name": "에너지 코어", "desc": "턴 시작 시 에너지 +1", "hook": "turnStart", "effect": "energy", "value": 1 }, "energyCore": { "name": "에너지 코어", "desc": "턴 시작 시 에너지 +1", "hook": "turnStart", "effect": "energy", "value": 1, "icon": "a41014f28b47434ab9f49ef104523862" },
"vampire": { "name": "흡혈 송곳니", "desc": "공격 카드 사용 시 HP +1", "hook": "cardPlayed", "effect": "healOnAttack", "value": 1 }, "vampire": { "name": "흡혈 송곳니", "desc": "공격 카드 사용 시 HP +1", "hook": "cardPlayed", "effect": "healOnAttack", "value": 1, "icon": "ed64cde7e6c44b9e99502847e54f04e9" },
"goldIdol": { "name": "황금 우상", "desc": "전투 승리 시 골드 +10", "hook": "combatReward", "effect": "gold", "value": 10 } "goldIdol": { "name": "황금 우상", "desc": "전투 승리 시 골드 +10", "hook": "combatReward", "effect": "gold", "value": 10, "icon": "03bb05c92b8f45edb0f3dad2e118fd5a" },
"potionBelt": { "name": "장인의 벨트", "desc": "물약 슬롯이 5칸으로 늘어난다", "hook": "passive", "effect": "potionSlots", "value": 5, "icon": "36725b4566ac40d4902e2ab2113c2096" },
"burningBlood": { "name": "자쿰의 투구", "desc": "전투 승리 시 HP 6 회복", "hook": "combatEnd", "effect": "healOnWin", "value": 6, "icon": "07f994825ce34131b419d43e890c878d" },
"vajra": { "name": "미스릴 해머", "desc": "전투 시작 시 힘 +1", "hook": "combatStart", "effect": "strength", "value": 1, "icon": "59d2579d46dc41d590a9e6b141ad458b" },
"anchor": { "name": "메이플 실드", "desc": "첫 턴 방어도 +10", "hook": "combatStart", "effect": "block", "value": 10, "icon": "6349413e08cc49848862591863d056a0" },
"bagOfPrep": { "name": "모험가의 배낭", "desc": "첫 턴 드로우 +2", "hook": "combatStart", "effect": "draw", "value": 2, "icon": "77b240cb8af245b4801a714380267ae9" },
"bloodVial": { "name": "피의 목걸이", "desc": "전투 시작 시 HP 2 회복", "hook": "combatStart", "effect": "heal", "value": 2, "icon": "c782e949506a42c49eb139c7e65527d7" },
"bronzeScales": { "name": "브론즈 체인메일", "desc": "피격 시 공격자에게 3 반사", "hook": "onPlayerDamaged", "effect": "thorns", "value": 3, "icon": "87272346b145412391622cf803f888d1" },
"strawberry": { "name": "건강의 반지", "desc": "획득 시 최대 HP +7", "hook": "passive", "effect": "maxHp", "value": 7, "icon": "58f643e29c354c2783a5ce9a72ec155c" },
"penNib": { "name": "황금 깃펜", "desc": "10번째 공격마다 피해 2배", "hook": "attackCalc", "effect": "penNib", "value": 10, "icon": "4d38d721cc064d14b31b9e9a92754139" },
"boot": { "name": "브론즈 부츠", "desc": "5 미만 공격 피해가 5로", "hook": "attackCalc", "effect": "boot", "value": 5, "icon": "d572b3aa4dac4162aa0d9e551b055dce" },
"akabeko": { "name": "황소 투구", "desc": "전투 첫 공격 피해 +8", "hook": "attackCalc", "effect": "akabeko", "value": 8, "icon": "eb3330a6e2274eff958639f8792119d3" },
"centennialPuzzle": { "name": "백년의 부적", "desc": "전투 첫 피격 시 드로우 3", "hook": "onPlayerDamaged", "effect": "firstLossDraw", "value": 3, "icon": "cfe5ed6556b944fc83ab58b774bb2b73" },
"meatOnBone": { "name": "고기 망치", "desc": "승리 시 HP 50% 이하면 12 회복", "hook": "combatEnd", "effect": "healIfLow", "value": 12, "icon": "a93e8e87f184411c98c96b877d9f8b10" },
"selfFormingClay": { "name": "점토 갑옷", "desc": "피해를 받으면 다음 턴 방어 +3", "hook": "onPlayerDamaged", "effect": "clayBlock", "value": 3, "icon": "bb446793c5204d5db7d33563fe79f648" },
"championBelt": { "name": "챔피언 벨트", "desc": "취약 부여 시 약화 1 추가", "hook": "cardDebuff", "effect": "vulnAddsWeak", "value": 1, "icon": "7ca8c63026034113a561d6adf679fed2" }
}, },
"startingRelic": "ironHeart", "startingRelic": "ironHeart",
"relicPool": ["energyCore", "vampire", "goldIdol"] "relicPool": [
"energyCore", "vampire", "goldIdol",
"potionBelt", "burningBlood", "vajra", "anchor", "bagOfPrep", "bloodVial",
"bronzeScales", "strawberry", "penNib", "boot", "akabeko",
"centennialPuzzle", "meatOnBone", "selfFormingClay", "championBelt"
]
} }

View File

@@ -0,0 +1,285 @@
# P7 — 물약 시스템·유물 강화 구현 계획
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** StS 풀세트 물약 6종 + 유물 19종(메이플 장비 외형·StS 효과) + 아이콘 행·마우스오버 툴팁 UI.
**Architecture:** `data/potions.json` 신설·`relics.json` 확장(icon RUID) → `gen-slaydeck.mjs` 생성부 확장(상태·효과 훅·물약 로직·TopBar 아이콘 UI·툴팁) → 산출물 재생성. 시뮬 변경 없음(물약·유물은 시뮬 범위 밖 — 기존 정책 동일).
**Tech Stack:** Node.js 생성기, MSW Lua, UITouchReceiveComponent(UITouchEnter/Exit/Down).
설계 문서: `docs/superpowers/specs/2026-06-12-potions-relics-design.md`
---
### Task 1: 아이콘 RUID 선별 (메이커, 유물 19 + 물약 6)
- [ ] **Step 1**: `asset_search_resources`(cat=sprite, source=maplestory) 검색어별 후보 5개: 투구/방패/벨트/목걸이/갑옷/반지/부츠/도끼/가방/부적/깃털/망치/심장/송곳니/우상/포션/엘릭서/병
- [ ] **Step 2**: P6과 동일한 SkillFx 복제 격자 미리보기로 스크린샷 → 유물 19·물약 6 아이콘 확정 (모자란 항목은 보조 검색어로 보충)
- [ ] **Step 3**: 미리보기 정리, 플레이 종료
### Task 2: 데이터 — potions.json 신설·relics.json 확장
**Files:** Create `data/potions.json`, Modify `data/relics.json`
- [ ] **Step 1**: `data/potions.json` 작성 (icon은 Task 1 선별값)
```json
{
"potions": {
"redPotion": { "name": "빨간 포션", "desc": "HP 20 회복", "effect": "heal", "value": 20, "icon": "<RUID>" },
"firebomb": { "name": "화염병", "desc": "적에게 피해 20", "effect": "damage", "value": 20, "icon": "<RUID>" },
"warriorElixir": { "name": "전사의 물약", "desc": "힘 +2", "effect": "strength", "value": 2, "icon": "<RUID>" },
"guardPotion": { "name": "수호의 물약", "desc": "방어도 +12", "effect": "block", "value": 12, "icon": "<RUID>" },
"manaElixir": { "name": "마나 엘릭서", "desc": "에너지 +2", "effect": "energy", "value": 2, "icon": "<RUID>" },
"cursedVial": { "name": "저주의 병", "desc": "적에게 약화 3", "effect": "weak", "value": 3, "icon": "<RUID>" }
},
"dropChance": 0.4,
"baseSlots": 3,
"beltSlots": 5,
"shopPrice": 20
}
```
- [ ] **Step 2**: `data/relics.json` — 기존 4종에 icon 추가 + 신규 15종 (설계 표의 hook/effect/value, 전부 icon 포함). relicPool = 기존 3종 + 신규 15종 (ironHeart는 시작 유물).
```json
"potionBelt": { "name": "장인의 벨트", "desc": "물약 슬롯이 5칸으로 늘어난다", "hook": "passive", "effect": "potionSlots", "value": 5 },
"burningBlood": { "name": "자쿰의 투구", "desc": "전투 승리 시 HP 6 회복", "hook": "combatEnd", "effect": "healOnWin", "value": 6 },
"vajra": { "name": "미스릴 액스", "desc": "전투 시작 시 힘 +1", "hook": "combatStart", "effect": "strength", "value": 1 },
"anchor": { "name": "메이플 실드", "desc": "첫 턴 방어도 +10", "hook": "combatStart", "effect": "block", "value": 10 },
"bagOfPrep": { "name": "모험가의 배낭", "desc": "첫 턴 드로우 +2", "hook": "combatStart", "effect": "draw", "value": 2 },
"bloodVial": { "name": "피의 목걸이", "desc": "전투 시작 시 HP 2 회복", "hook": "combatStart", "effect": "heal", "value": 2 },
"bronzeScales": { "name": "브론즈 체인메일", "desc": "피격 시 공격자에게 3 반사", "hook": "onPlayerDamaged", "effect": "thorns", "value": 3 },
"strawberry": { "name": "건강의 반지", "desc": "획득 시 최대 HP +7", "hook": "passive", "effect": "maxHp", "value": 7 },
"penNib": { "name": "황금 깃펜", "desc": "10번째 공격마다 피해 2배", "hook": "attackCalc", "effect": "penNib", "value": 10 },
"boot": { "name": "브론즈 부츠", "desc": "5 미만 공격 피해가 5로", "hook": "attackCalc", "effect": "boot", "value": 5 },
"akabeko": { "name": "황소 투구", "desc": "전투 첫 공격 피해 +8", "hook": "attackCalc", "effect": "akabeko", "value": 8 },
"centennialPuzzle": { "name": "백년의 부적", "desc": "전투 첫 피격 시 드로우 3", "hook": "onPlayerDamaged", "effect": "firstLossDraw", "value": 3 },
"meatOnBone": { "name": "고기 망치", "desc": "승리 시 HP 50% 이하면 12 회복","hook": "combatEnd", "effect": "healIfLow", "value": 12 },
"selfFormingClay": { "name": "점토 갑옷", "desc": "피해를 받으면 다음 턴 방어 +3","hook": "onPlayerDamaged", "effect": "clayBlock", "value": 3 },
"championBelt": { "name": "챔피언 벨트", "desc": "취약 부여 시 약화 1 추가", "hook": "cardDebuff", "effect": "vulnAddsWeak", "value": 1 }
```
- [ ] **Step 3**: JSON 파싱 확인 + 커밋 `feat(potions-relics): 물약 6종·유물 15종 데이터 (아이콘 RUID 포함)`
### Task 3: 생성기 — 로드·직렬화·상태
**Files:** Modify `tools/deck/gen-slaydeck.mjs`
- [ ] **Step 1**: 상단에 potions 로드·검증 (RELICS 로드 다음)
```js
const POTIONS = JSON.parse(readFileSync('data/potions.json', 'utf8'));
for (const [pid, p] of Object.entries(POTIONS.potions)) {
if (!p.name || !p.effect || p.value == null) throw new Error(`[gen-slaydeck] potion 필드 누락: ${pid}`);
}
function luaPotionsTable(potions) {
const lines = Object.entries(potions).map(([id, p]) =>
`\t${id} = { name = ${luaStr(p.name)}, desc = ${luaStr(p.desc)}, effect = ${luaStr(p.effect)}, value = ${p.value}, icon = ${luaStr(p.icon || '')} },`);
return `self.Potions = {\n${lines.join('\n')}\n}`;
}
```
- [ ] **Step 2**: `luaRelicsTable``icon = ${luaStr(r.icon || '')}` 필드 추가
- [ ] **Step 3**: props 추가 — `prop('any', 'Potions')`, `prop('any', 'RunPotions')`, `prop('number', 'PotionSlots', '3')`, `prop('string', 'ShopPotion', '""')`, `prop('boolean', 'ShopPotionBought', 'false')`, `prop('number', 'FightAttackCount', '0')`, `prop('boolean', 'FirstHpLossDone', 'false')`, `prop('number', 'ClayBlockNext', '0')`, `prop('number', 'PotionMenuSlot', '0')`
- [ ] **Step 4**: `StartRun``self.RunPotions = {}` `self.PotionSlots = ${POTIONS.baseSlots}` `${luaPotionsTable(POTIONS.potions)}` 추가 (RunRelics 초기화 옆) + `self:RenderPotions()` (BindButtons 후)
- [ ] **Step 5**: `StartCombat``self.FightAttackCount = 0` `self.FirstHpLossDone = false` `self.ClayBlockNext = 0` 리셋 추가
### Task 4: 생성기 — 유물 효과 로직
**Files:** Modify `tools/deck/gen-slaydeck.mjs`
- [ ] **Step 1**: `HasRelic` 헬퍼 신설 (boolean 반환)
```lua
if self.RunRelics == nil then
return false
end
for i = 1, #self.RunRelics do
if self.RunRelics[i] == id then
return true
end
end
return false
```
- [ ] **Step 2**: `ApplyRelics` 확장 — 기존 effect에 추가: `strength`(PlayerStr += v), `heal`(HP 회복), `draw`(DrawCards(v) + RenderHand(false)), `healOnWin`(HP 회복), `healIfLow`(HP ≤ 50%면 회복)
- [ ] **Step 3**: `AddRelic` 확장 — passive 즉시 적용
```lua
local r = self.Relics[id]
if r ~= nil and r.hook == "passive" then
if r.effect == "potionSlots" then
self.PotionSlots = r.value
self:RenderPotions()
elseif r.effect == "maxHp" then
self.PlayerMaxHp = self.PlayerMaxHp + r.value
self.PlayerHp = self.PlayerHp + r.value
end
end
```
- [ ] **Step 4**: `PickNewRelic` 신설 — 미보유 풀 추첨, 없으면 골드 +25 후 빈 문자열 반환. elite/boss 보상부의 `self:AddRelic(self.RelicPool[...])``local nid = self:PickNewRelic() if nid ~= "" then self:AddRelic(nid) end`로 교체, boss 분기에도 동일 추가
- [ ] **Step 5**: `CalcPlayerAttack` 유물 보정 — 공격 카드에서만 호출되므로 내부에서 카운트
```lua
local base2 = base
self.FightAttackCount = self.FightAttackCount + 1
if self.FightAttackCount == 1 and self:HasRelic("akabeko") then
base2 = base2 + 8
end
local dmg = base2 + self.PlayerStr
if self:HasRelic("penNib") and self.FightAttackCount % 10 == 0 then
dmg = dmg * 2
end
if self.PlayerWeak > 0 then
dmg = math.floor(dmg * 0.75)
end
if dmg > 0 and dmg < 5 and self:HasRelic("boot") then
dmg = 5
end
if dmg < 0 then
dmg = 0
end
return dmg
```
- [ ] **Step 6**: `DealDamageToPlayer`에 attacker 인자 추가 + onPlayerDamaged 유물 (HP 실손실 시)
```lua
-- 시그니처: (amount, attackerSlot) — EnemyActStep 호출부에 idx 전달
local dmg = amount
if self.PlayerBlock > 0 then
local absorbed = math.min(self.PlayerBlock, dmg)
self.PlayerBlock = self.PlayerBlock - absorbed
dmg = dmg - absorbed
end
if dmg > 0 then
self.PlayerHp = self.PlayerHp - dmg
if self:HasRelic("bronzeScales") and attackerSlot ~= nil and attackerSlot > 0 then
local am = self.Monsters[attackerSlot]
if am ~= nil and am.alive == true then
am.hp = am.hp - 3
if am.hp <= 0 then am.hp = 0 self:KillMonster(am.slot) end
end
end
if self:HasRelic("selfFormingClay") then
self.ClayBlockNext = self.ClayBlockNext + 3
end
if self:HasRelic("centennialPuzzle") and self.FirstHpLossDone == false then
self.FirstHpLossDone = true
self:DrawCards(3)
self:RenderHand(false)
end
end
if self.PlayerHp < 0 then
self.PlayerHp = 0
end
```
- [ ] **Step 7**: `StartPlayerTurn``self.PlayerBlock = 0` 직후 `if self.ClayBlockNext > 0 then self.PlayerBlock = self.PlayerBlock + self.ClayBlockNext self.ClayBlockNext = 0 end`
- [ ] **Step 8**: `PlayCard` 디버프 적용부 — championBelt: `if c.vuln ~= nil and self:HasRelic("championBelt") then tm.weak = tm.weak + 1 end`
- [ ] **Step 9**: `CheckCombatEnd` 승리 분기 — `self:ApplyRelics("combatReward")` 앞에 `self:ApplyRelics("combatEnd")`, 뒤에 물약 드랍(Task 5의 `MaybeDropPotion`)
- [ ] **Step 10**: 커밋 `feat(potions-relics): 유물 15종 효과 훅 (생성기)`
### Task 5: 생성기 — 물약 로직
**Files:** Modify `tools/deck/gen-slaydeck.mjs`
- [ ] **Step 1**: 메서드 신설 — `AddPotion(pid)` (슬롯 검사·토스트), `MaybeDropPotion()` (`math.random() <= dropChance` 시 랜덤 지급), `RenderPotions()` (슬롯 5칸: 아이콘/빈칸/잠금), `OpenPotionMenu(slot)`/`ClosePotionMenu()`, `UsePotion()`, `TossPotion()`
```lua
-- AddPotion(pid)
if self.RunPotions == nil then self.RunPotions = {} end
if #self.RunPotions >= self.PotionSlots then
self:Toast("물약 슬롯이 가득 찼습니다")
return false
end
table.insert(self.RunPotions, pid)
self:RenderPotions()
return true
```
```lua
-- MaybeDropPotion()
if math.random() > ${POTIONS.dropChance} then
return
end
local keys = {}
for pid, _ in pairs(self.Potions) do table.insert(keys, pid) end
table.sort(keys)
local pid = keys[math.random(1, #keys)]
if self:AddPotion(pid) == true then
local p = self.Potions[pid]
self:Toast("물약 획득: " .. p.name)
end
```
```lua
-- UsePotion() — PotionMenuSlot 대상. 전투 중이 아니면 무시.
local combat = _EntityService:GetEntityByPath("/ui/DefaultGroup/CombatHud")
if combat == nil or combat.Enable ~= true or self.CombatOver == true then
self:Toast("전투 중에만 사용할 수 있습니다")
return
end
local pid = self.RunPotions[self.PotionMenuSlot]
if pid == nil then return end
local p = self.Potions[pid]
if p == nil then return end
if p.effect == "heal" then
self.PlayerHp = math.min(self.PlayerHp + p.value, self.PlayerMaxHp)
elseif p.effect == "damage" then
self:DealDamageToTarget(p.value)
self:ShowDmgPop(self.TargetIndex, p.value)
elseif p.effect == "strength" then
self.PlayerStr = self.PlayerStr + p.value
elseif p.effect == "block" then
self.PlayerBlock = self.PlayerBlock + p.value
elseif p.effect == "energy" then
self.Energy = self.Energy + p.value
elseif p.effect == "weak" then
local tm = self.Monsters[self.TargetIndex]
if tm ~= nil and tm.alive == true then
tm.weak = tm.weak + p.value
end
end
table.remove(self.RunPotions, self.PotionMenuSlot)
self:ClosePotionMenu()
self:RenderPotions()
self:RenderPiles()
self:RenderCombat()
self:CheckCombatEnd()
```
- [ ] **Step 2**: 상점 — `ShowShop``self.ShopPotion = <정렬 키 랜덤>` `self.ShopPotionBought = false`, `RenderShop`에 Potion 라벨/가격/색, `BuyPotion` (가격 ${POTIONS.shopPrice}, AddPotion 실패 시 환불 없음 방지 — 슬롯 검사 먼저)
- [ ] **Step 3**: 커밋 `feat(potions-relics): 물약 사용·드랍·상점 로직 (생성기)`
### Task 6: 생성기 — UI (아이콘 행·물약 슬롯·툴팁·물약 메뉴·상점)
**Files:** Modify `tools/deck/gen-slaydeck.mjs`
- [ ] **Step 1**: TopBar — `Relics` 텍스트 항목 제거(topTexts에서 삭제), `RelicSlot1..10` (UISprite 40×40, x = -240 + (i-1)*48, guid cmb 300+i, UITouchReceiveComponent 포함, 기본 비표시 색), `RelicOverflow` 텍스트(guid cmb 311, 10번째 칸 위치), `PotionSlot1..5` (UISprite 40×40, x = 270 + (i-1)*44, guid cmb 320+i, UITouchReceiveComponent)
- [ ] **Step 2**: `TooltipBox` (guid cmb 330: bg 280×76 + Name + Desc, displayOrder 20, enable=false, CombatHud 직속)
- [ ] **Step 3**: `PotionMenu` 팝업 (guid cmb 340대: bg 320×180 중앙 + Title + [사용][버리기][닫기] 버튼 3개, enable=false)
- [ ] **Step 4**: ShopHud — Relic 블록 뒤 `Potion` 엔티티(Label/Price 동일 패턴, y=-270, Leave는 y=-360으로 이동)
- [ ] **Step 5**: `BindButtons` — RelicSlot/PotionSlot에 UITouchEnter/Exit(툴팁), PotionSlot UITouchDown(OpenPotionMenu), PotionMenu 버튼 3개, ShopHud/Potion 클릭(BuyPotion) 연결. `ShowTooltip`/`HideTooltip` 메서드 신설
- [ ] **Step 6**: `RenderPotions`/`RenderRelics`(아이콘 행으로 재작성 — names 텍스트 제거) 구현 확인
- [ ] **Step 7**: 커밋 `feat(potions-relics): 유물 아이콘 행·물약 슬롯·툴팁·물약 메뉴 UI (생성기)`
### Task 7: 산출물 재생성·검증
- [ ] **Step 1**: `node tools/deck/gen-slaydeck.mjs` 성공, `node --test tools/balance/sim-balance.test.mjs` 21건 통과 유지
- [ ] **Step 2**: 메이커 refresh → 빌드 콘솔 0 에러 → 플레이테스트: 유물 아이콘 표시·툴팁 hover·물약 지급(`AddPotion`)·사용·벨트 5칸 (`AddRelic("potionBelt")`) 스크립트 확인 + 스크린샷
- [ ] **Step 3**: 커밋 `feat(potions-relics): 산출물 재생성 (물약·유물·툴팁)`
### Task 8: 푸시·PR·머지
- [ ] **Step 1**: `git push -u origin feature/p7-potions-relics`
- [ ] **Step 2**: Gitea API PR 생성(종합 메시지) → 머지 → main pull
## Self-Review 결과
- 설계 전 항목 매핑: 물약 6종·드랍·상점·사용/버리기(Task 2/5/6), 유물 15종 효과(Task 4), 아이콘+툴팁(Task 1/6), 벨트 5칸(Task 3 props + Task 4 passive) ✓
- 이름 일관성: `RunPotions`/`PotionSlots`/`FightAttackCount`/`ClayBlockNext`/`HasRelic`/`PickNewRelic`/`MaybeDropPotion` 통일 ✓
- 의존 순서: 아이콘 RUID(Task 1) → 데이터(Task 2) → 로직(3~5) → UI(6) → 검증(7) ✓

View File

@@ -0,0 +1,103 @@
# P7 — 물약 시스템·유물 강화 설계
날짜: 2026-06-12
브랜치: `feature/p7-potions-relics`
선행: P6 (버프/디버프·Power — 물약·유물 효과가 힘/약화/취약을 참조)
## 범위
1. **물약 시스템 (StS 풀세트)** — 전투 보상 확률 드랍 + 상점 구매 + 전투 중 사용 + 버리기, 슬롯 기본 3칸
2. **유물 19종** — 기존 4종 유지 + 신규 15종 (StS 효과 그대로, 메이플 장비 외형·이름)
3. **유물 아이콘 행 + 마우스오버 툴팁** — 텍스트 나열 → 장비 아이콘, hover 시 효과 설명 창
4. **물약 슬롯 5칸 유물(장인의 벨트)** ★ 대표 필수
비범위: 밸런스 시뮬의 물약/유물 재현(시뮬은 카드·적 규칙만 동기화 — 기존과 동일), 맵/휴식 화면 유물 표시.
## 물약 (data/potions.json 신설)
| id | 이름 | 효과 | StS 원본 |
|----|------|------|----------|
| redPotion | 빨간 포션 | HP 20 회복 | Health 계열 |
| firebomb | 화염병 | 타겟 적에게 피해 20 | Fire Potion |
| warriorElixir | 전사의 물약 | 힘 +2 (전투 동안) | Strength Potion |
| guardPotion | 수호의 물약 | 방어도 +12 | Block Potion |
| manaElixir | 마나 엘릭서 | 에너지 +2 | Energy Potion |
| cursedVial | 저주의 병 | 타겟 적에게 약화 3 | Weakness Potion |
- 슬롯: 기본 3칸, `장인의 벨트` 보유 시 5칸. UI는 항상 5칸 그리고 벨트 없으면 4·5번째 칸 잠금 표시.
- 획득: 전투 승리 시 40% 확률(`dropChance`)로 랜덤 1개. 슬롯 가득이면 토스트 안내 후 미지급. 상점에서 랜덤 1종 20골드 판매(`ShopPotion`, 유물 패턴 동일).
- 사용: 물약 슬롯 클릭 → 미니 메뉴(사용/버리기/닫기). **사용은 전투 중에만** (전투 외 클릭 시 사용 버튼 무시 + 토스트), 버리기는 언제나 가능.
- 타겟형 물약(화염병·저주의 병)은 현재 `TargetIndex` 적에게 적용.
- 스키마: `{ potions: { id: { name, desc, effect, value, icon } }, dropChance: 0.4, baseSlots: 3, beltSlots: 5, shopPrice: 20 }`
- effect 종류: `heal` `damage` `strength` `block` `energy` `weak`
- 상태: `RunPotions` (id 배열), `PotionSlots` (3|5). StartRun에서 초기화.
## 유물 19종 (data/relics.json 확장)
기존 4종(강철 심장·에너지 코어·흡혈 송곳니·황금 우상) 유지. 신규 15종 — StS 효과 그대로, 메이플 장비 이름:
| id | 장비명 | 효과 | StS 원본 | 구현 지점 |
|----|--------|------|----------|----------|
| potionBelt | 장인의 벨트 | 물약 슬롯 3→5 ★ | Potion Belt | AddRelic |
| burningBlood | 자쿰의 투구 | 전투 승리 시 HP 6 회복 | Burning Blood | combatEnd |
| vajra | 미스릴 액스 | 전투 시작 시 힘 +1 | Vajra | combatStart |
| anchor | 메이플 실드 | 첫 턴 방어도 +10 | Anchor | combatStart(block) |
| bagOfPrep | 모험가의 배낭 | 첫 턴 드로우 +2 | Bag of Preparation | combatStart |
| bloodVial | 피의 목걸이 | 전투 시작 시 HP 2 회복 | Blood Vial | combatStart |
| bronzeScales | 브론즈 체인메일 | 적 공격에 피격 시 공격자에게 3 반사 | Bronze Scales | onPlayerDamaged |
| strawberry | 건강의 반지 | 획득 시 최대 HP +7 | Strawberry | AddRelic |
| penNib | 황금 깃펜 | 10번째 공격 카드 피해 2배 | Pen Nib | CalcPlayerAttack |
| boot | 브론즈 부츠 | 5 미만 공격 피해를 5로 | The Boot | CalcPlayerAttack |
| akabeko | 황소 투구 | 전투 첫 공격 카드 피해 +8 | Akabeko | CalcPlayerAttack |
| centennialPuzzle | 백년의 부적 | 전투 중 처음 HP를 잃으면 드로우 3 | Centennial Puzzle | onPlayerDamaged |
| meatOnBone | 고기 망치 | 전투 종료 시 HP 50% 이하면 12 회복 | Meat on the Bone | combatEnd |
| selfFormingClay | 점토 갑옷 | 피해를 받으면 다음 턴 방어도 +3 | Self-Forming Clay | onPlayerDamaged + StartPlayerTurn |
| championBelt | 챔피언 벨트 | 카드로 취약 부여 시 약화 1 추가 | Champion Belt | PlayCard 디버프 적용부 |
규칙 세부:
- penNib 카운터는 **전투 내** 공격 카드 사용 횟수 기준(StS는 런 전체 누적이나 단순화). 10·20·30…번째 2배.
- boot 은 최종 계산값이 1~4일 때 5로 보정 (0은 그대로).
- akabeko 는 전투당 1회, 첫 공격 카드의 기본 피해에 +8 (힘 적용 전 base에 합산).
- bronzeScales 반사는 공격한 적이 생존 중일 때 3 피해 (그 적의 block 무시하지 않음 — DealDamage 재사용, 취약 배수는 미적용하도록 직접 hp 차감).
- 적용 순서(CalcPlayerAttack): base + akabeko → penNib 2배 → 힘 → 약화 → boot 보정. 취약은 기존대로 명중 시.
- 유물 상태 props: `FightAttackCount`(펜닙·아카베코 겸용), `FirstHpLossDone`(퍼즐), `ClayBlockNext`(점토).
- 획득 경로(기존 유지 + 개선): 정예 승리·상점 + **보스 클리어 시 1개 추가**. 풀에서 **미보유 유물만** 추첨(`PickNewRelic`), 전부 보유 시 골드 +25 대체.
- relicPool에 신규 15종 전부 + 기존 3종(에너지 코어·흡혈 송곳니·황금 우상) 포함. 시작 유물은 ironHeart 유지.
- 스키마 확장: 각 유물에 `icon`(RUID) 추가. 신규 hook 값: `combatEnd`, `onPlayerDamaged`, `passive`(AddRelic 시 1회).
## UI
### 유물 아이콘 행 (CombatHud TopBar)
- 기존 `TopBar/Relics` 텍스트 제거 → `TopBar/RelicSlot1..10` (UISprite 40×40, x -240부터 48px 간격).
- `RenderRelics`: 보유 유물 순서대로 아이콘 표시, 10개 초과분은 10번째 칸을 `+N` 텍스트로 대체.
- 각 슬롯에 `UITouchReceiveComponent` + `UITouchEnterEvent/ExitEvent` → 툴팁 표시/숨김.
### 물약 슬롯 (CombatHud TopBar 우측)
- `TopBar/PotionSlot1..5` (UISprite 40×40, x 270부터 44px 간격, AllDeckButton(x 510) 앞에서 종료).
- 빈 칸은 어두운 배경, 잠금 칸(벨트 미보유 4·5번)은 자물쇠 느낌의 더 어두운 색.
- 클릭(ButtonClickEvent 대신 UITouchDownEvent) → `PotionMenu` 팝업: 물약명·설명 + [사용] [버리기] [닫기].
- hover 툴팁 동일 적용.
### 툴팁 (TooltipBox)
- `/ui/DefaultGroup/CombatHud/TooltipBox` — bg(260×72) + Name + Desc 텍스트, displayOrder 최상위, 기본 비활성.
- Enter 시 대상 슬롯 인덱스에 따라 x 위치 조정해 표시, Exit 시 숨김. 공용 메서드 `ShowTooltip(name, desc, x, y)` / `HideTooltip()`.
### 상점 (ShopHud)
- 기존 `ShopHud/Relic` 아래 `ShopHud/Potion` 추가 — 라벨·가격(20골드)·구매 처리 `BuyPotion` (ShopRelic 패턴 복제, 슬롯 가득 시 구매 거부 토스트).
## 데이터 흐름
`StartRun`: `RunPotions = {}`, `PotionSlots = baseSlots`, 유물 초기화(기존) → `RenderRelics`·`RenderPotions`.
`CheckCombatEnd`(승리): combatEnd 유물 → 물약 드랍 판정 → 기존 보상 흐름.
`DealDamageToPlayer`: HP 실손실 시 onPlayerDamaged 유물 발동 (공격자 slot 인자 추가).
## 검증
1. `node tools/deck/gen-slaydeck.mjs` 성공, `node --test` 통과 (기존 21건 — 시뮬 변경 없음)
2. 메이커 빌드 콘솔 0 에러 + 플레이테스트: 유물 아이콘·툴팁 hover·물약 사용/버리기·벨트 5칸 확인
## 결정 사항
- 물약 아이콘·유물 아이콘 RUID는 공식 maplestory 리소스에서 메이커 미리보기로 선별 (계정 리소스 금지)
- 물약 6종으로 시작 (StS 핵심 6역할), 추가는 데이터만으로 확장 가능
- penNib 전투 내 카운터·bronzeScales 단순 반사 등 경량화는 표에 명시한 대로

View File

@@ -32,10 +32,20 @@ for (const id of RELICS.relicPool) {
} }
function luaRelicsTable(relics) { function luaRelicsTable(relics) {
const lines = Object.entries(relics).map(([id, r]) => const lines = Object.entries(relics).map(([id, r]) =>
`\t${id} = { name = ${luaStr(r.name)}, desc = ${luaStr(r.desc)}, hook = ${luaStr(r.hook)}, effect = ${luaStr(r.effect)}, value = ${r.value} },`); `\t${id} = { name = ${luaStr(r.name)}, desc = ${luaStr(r.desc)}, hook = ${luaStr(r.hook)}, effect = ${luaStr(r.effect)}, value = ${r.value}, icon = ${luaStr(r.icon || '')} },`);
return `self.Relics = {\n${lines.join('\n')}\n}`; return `self.Relics = {\n${lines.join('\n')}\n}`;
} }
const POTIONS = JSON.parse(readFileSync('data/potions.json', 'utf8'));
for (const [pid, p] of Object.entries(POTIONS.potions)) {
if (!p.name || !p.effect || p.value == null) throw new Error(`[gen-slaydeck] potion 필드 누락: ${pid}`);
}
function luaPotionsTable(potions) {
const lines = Object.entries(potions).map(([id, p]) =>
`\t${id} = { name = ${luaStr(p.name)}, desc = ${luaStr(p.desc)}, effect = ${luaStr(p.effect)}, value = ${p.value}, icon = ${luaStr(p.icon || '')} },`);
return `self.Potions = {\n${lines.join('\n')}\n}`;
}
function luaIntentsArray(intents) { function luaIntentsArray(intents) {
return '{ ' + intents.map((it) => { return '{ ' + intents.map((it) => {
const fields = [`kind = ${luaStr(it.kind)}`, `value = ${it.value}`]; const fields = [`kind = ${luaStr(it.kind)}`, `value = ${it.value}`];
@@ -1156,7 +1166,6 @@ function upsertUi() {
const topTexts = [ const topTexts = [
['Floor', -520, 160, '막 1/3', GOLD], ['Floor', -520, 160, '막 1/3', GOLD],
['Gold', -360, 160, '골드 0', { r: 0.98, g: 0.85, b: 0.4, a: 1 }], ['Gold', -360, 160, '골드 0', { r: 0.98, g: 0.85, b: 0.4, a: 1 }],
['Relics', 60, 560, '유물: 없음', { r: 0.8, g: 0.7, b: 0.95, a: 1 }],
]; ];
topTexts.forEach(([suffix, x, w, value, color], ti) => { topTexts.forEach(([suffix, x, w, value, color], ti) => {
combat.push(entity({ combat.push(entity({
@@ -1168,7 +1177,129 @@ function upsertUi() {
components: [ components: [
transform({ parentW: 1200, parentH: 52, anchor: { x: 0.5, y: 0.5 }, pivot: { x: 0.5, y: 0.5 }, size: { x: w, y: 40 }, pos: { x: x, y: 0 } }), transform({ parentW: 1200, parentH: 52, anchor: { x: 0.5, y: 0.5 }, pivot: { x: 0.5, y: 0.5 }, size: { x: w, y: 40 }, pos: { x: x, y: 0 } }),
sprite({ color: TRANSPARENT }), sprite({ color: TRANSPARENT }),
text({ value, fontSize: suffix === 'Relics' ? 18 : 22, bold: true, color, alignment: 4 }), text({ value, fontSize: 22, bold: true, color, alignment: 4 }),
],
}));
});
for (let i = 1; i <= 10; i++) {
combat.push(entity({
id: guid('cmb', 300 + i),
path: `/ui/DefaultGroup/CombatHud/TopBar/RelicSlot${i}`,
modelId: 'uisprite', entryId: 'UISprite',
componentNames: 'MOD.Core.UITransformComponent,MOD.Core.SpriteGUIRendererComponent,MOD.Core.UITouchReceiveComponent',
displayOrder: 3 + i,
components: [
transform({ parentW: 1200, parentH: 52, anchor: { x: 0.5, y: 0.5 }, pivot: { x: 0.5, y: 0.5 }, size: { x: 40, y: 40 }, pos: { x: -240 + (i - 1) * 48, y: 0 } }),
sprite({ color: { r: 0.15, g: 0.16, b: 0.2, a: 0.6 }, type: 0, raycast: true }),
{ '@type': 'MOD.Core.UITouchReceiveComponent', Enable: true },
],
}));
}
combat.push(entity({
id: guid('cmb', 311),
path: '/ui/DefaultGroup/CombatHud/TopBar/RelicOverflow',
modelId: 'uitext', entryId: 'UIText',
componentNames: 'MOD.Core.UITransformComponent,MOD.Core.SpriteGUIRendererComponent,MOD.Core.TextComponent',
displayOrder: 14,
components: [
transform({ parentW: 1200, parentH: 52, anchor: { x: 0.5, y: 0.5 }, pivot: { x: 0.5, y: 0.5 }, size: { x: 60, y: 30 }, pos: { x: 192, y: 0 } }),
sprite({ color: TRANSPARENT }),
text({ value: '', fontSize: 18, bold: true, color: { r: 0.8, g: 0.7, b: 0.95, a: 1 }, alignment: 4 }),
],
}));
for (let i = 1; i <= 5; i++) {
combat.push(entity({
id: guid('cmb', 320 + i),
path: `/ui/DefaultGroup/CombatHud/TopBar/PotionSlot${i}`,
modelId: 'uisprite', entryId: 'UISprite',
componentNames: 'MOD.Core.UITransformComponent,MOD.Core.SpriteGUIRendererComponent,MOD.Core.UITouchReceiveComponent',
displayOrder: 14 + i,
components: [
transform({ parentW: 1200, parentH: 52, anchor: { x: 0.5, y: 0.5 }, pivot: { x: 0.5, y: 0.5 }, size: { x: 40, y: 40 }, pos: { x: 240 + (i - 1) * 44, y: 0 } }),
sprite({ color: { r: 0.22, g: 0.25, b: 0.3, a: 0.9 }, type: 0, raycast: true }),
{ '@type': 'MOD.Core.UITouchReceiveComponent', Enable: true },
],
}));
}
const tooltipBox = entity({
id: guid('cmb', 330),
path: '/ui/DefaultGroup/CombatHud/TooltipBox',
modelId: 'uisprite', entryId: 'UISprite',
componentNames: 'MOD.Core.UITransformComponent,MOD.Core.SpriteGUIRendererComponent',
displayOrder: 20,
components: [
transform({ parentW: 1920, parentH: 1080, anchor: { x: 0.5, y: 0.5 }, pivot: { x: 0.5, y: 0.5 }, size: { x: 300, y: 80 }, pos: { x: 0, y: 400 }, align: ALIGN_CENTER }),
sprite({ color: { r: 0.04, g: 0.05, b: 0.08, a: 0.96 }, type: 1 }),
],
});
tooltipBox.jsonString.enable = false;
combat.push(tooltipBox);
combat.push(entity({
id: guid('cmb', 331),
path: '/ui/DefaultGroup/CombatHud/TooltipBox/Name',
modelId: 'uitext', entryId: 'UIText',
componentNames: 'MOD.Core.UITransformComponent,MOD.Core.SpriteGUIRendererComponent,MOD.Core.TextComponent',
displayOrder: 0,
components: [
transform({ parentW: 300, parentH: 80, anchor: { x: 0.5, y: 0.5 }, pivot: { x: 0.5, y: 0.5 }, size: { x: 280, y: 28 }, pos: { x: 0, y: 18 } }),
sprite({ color: TRANSPARENT }),
text({ value: '', fontSize: 19, bold: true, color: GOLD, alignment: 4 }),
],
}));
combat.push(entity({
id: guid('cmb', 332),
path: '/ui/DefaultGroup/CombatHud/TooltipBox/Desc',
modelId: 'uitext', entryId: 'UIText',
componentNames: 'MOD.Core.UITransformComponent,MOD.Core.SpriteGUIRendererComponent,MOD.Core.TextComponent',
displayOrder: 1,
components: [
transform({ parentW: 300, parentH: 80, anchor: { x: 0.5, y: 0.5 }, pivot: { x: 0.5, y: 0.5 }, size: { x: 284, y: 30 }, pos: { x: 0, y: -14 } }),
sprite({ color: TRANSPARENT }),
text({ value: '', fontSize: 15, bold: false, color: { r: 0.92, g: 0.92, b: 0.95, a: 1 }, alignment: 4 }),
],
}));
const potionMenu = entity({
id: guid('cmb', 340),
path: '/ui/DefaultGroup/CombatHud/PotionMenu',
modelId: 'uisprite', entryId: 'UISprite',
componentNames: 'MOD.Core.UITransformComponent,MOD.Core.SpriteGUIRendererComponent',
displayOrder: 21,
components: [
transform({ parentW: 1920, parentH: 1080, anchor: { x: 0.5, y: 0.5 }, pivot: { x: 0.5, y: 0.5 }, size: { x: 380, y: 180 }, pos: { x: 0, y: 120 }, align: ALIGN_CENTER }),
sprite({ color: { r: 0.07, g: 0.08, b: 0.12, a: 0.97 }, type: 1 }),
],
});
potionMenu.jsonString.enable = false;
combat.push(potionMenu);
combat.push(entity({
id: guid('cmb', 341),
path: '/ui/DefaultGroup/CombatHud/PotionMenu/Title',
modelId: 'uitext', entryId: 'UIText',
componentNames: 'MOD.Core.UITransformComponent,MOD.Core.SpriteGUIRendererComponent,MOD.Core.TextComponent',
displayOrder: 0,
components: [
transform({ parentW: 380, parentH: 180, anchor: { x: 0.5, y: 0.5 }, pivot: { x: 0.5, y: 0.5 }, size: { x: 360, y: 36 }, pos: { x: 0, y: 52 } }),
sprite({ color: TRANSPARENT }),
text({ value: '', fontSize: 19, bold: true, color: { r: 1, g: 1, b: 1, a: 1 }, alignment: 4 }),
],
}));
const pmButtons = [
['Use', '사용', -120, { r: 0.32, g: 0.55, b: 0.36, a: 1 }],
['Toss', '버리기', 0, { r: 0.6, g: 0.32, b: 0.3, a: 1 }],
['Close', '닫기', 120, { r: 0.25, g: 0.28, b: 0.35, a: 1 }],
];
pmButtons.forEach(([suffix, label, x, color], bi) => {
combat.push(entity({
id: guid('cmb', 342 + bi),
path: `/ui/DefaultGroup/CombatHud/PotionMenu/${suffix}`,
modelId: 'uibutton', entryId: 'UIButton',
componentNames: 'MOD.Core.UITransformComponent,MOD.Core.SpriteGUIRendererComponent,MOD.Core.ButtonComponent,MOD.Core.TextComponent',
displayOrder: 1 + bi,
components: [
transform({ parentW: 380, parentH: 180, anchor: { x: 0.5, y: 0.5 }, pivot: { x: 0.5, y: 0.5 }, size: { x: 104, y: 46 }, pos: { x, y: -40 } }),
sprite({ color, type: 1, raycast: true }),
button(),
text({ value: label, fontSize: 20, bold: true, color: { r: 1, g: 1, b: 1, a: 1 }, alignment: 4 }),
], ],
})); }));
}); });
@@ -1179,7 +1310,7 @@ function upsertUi() {
componentNames: 'MOD.Core.UITransformComponent,MOD.Core.SpriteGUIRendererComponent,MOD.Core.ButtonComponent,MOD.Core.TextComponent', componentNames: 'MOD.Core.UITransformComponent,MOD.Core.SpriteGUIRendererComponent,MOD.Core.ButtonComponent,MOD.Core.TextComponent',
displayOrder: 3, displayOrder: 3,
components: [ components: [
transform({ parentW: 1200, parentH: 52, anchor: { x: 0.5, y: 0.5 }, pivot: { x: 0.5, y: 0.5 }, size: { x: 150, y: 40 }, pos: { x: 510, y: 0 } }), transform({ parentW: 1200, parentH: 52, anchor: { x: 0.5, y: 0.5 }, pivot: { x: 0.5, y: 0.5 }, size: { x: 140, y: 40 }, pos: { x: 528, y: 0 } }),
sprite({ color: DARK, type: 1, raycast: true }), sprite({ color: DARK, type: 1, raycast: true }),
button(), button(),
text({ value: '모든덱보기', fontSize: 18, bold: true, color: GOLD, alignment: 0 }), text({ value: '모든덱보기', fontSize: 18, bold: true, color: GOLD, alignment: 0 }),
@@ -1513,6 +1644,45 @@ function upsertUi() {
text({ value: '60 골드', fontSize: 20, bold: true, color: { r: 0.98, g: 0.85, b: 0.4, a: 1 }, alignment: 4 }), text({ value: '60 골드', fontSize: 20, bold: true, color: { r: 0.98, g: 0.85, b: 0.4, a: 1 }, alignment: 4 }),
], ],
})); }));
shop.push(entity({
id: guid('shp', shpN++),
path: '/ui/DefaultGroup/ShopHud/Potion',
modelId: 'uisprite',
entryId: 'UISprite',
componentNames: 'MOD.Core.UITransformComponent,MOD.Core.SpriteGUIRendererComponent,MOD.Core.ButtonComponent',
displayOrder: 11,
components: [
transform({ parentW: 1920, parentH: 1080, anchor: { x: 0.5, y: 0.5 }, pivot: { x: 0.5, y: 0.5 }, size: { x: 560, y: 76 }, pos: { x: 0, y: -278 } }),
sprite({ color: { r: 0.45, g: 0.7, b: 0.55, a: 1 }, type: 1, raycast: true }),
button(),
],
}));
shop.push(entity({
id: guid('shp', shpN++),
path: '/ui/DefaultGroup/ShopHud/Potion/Label',
modelId: 'uitext',
entryId: 'UIText',
componentNames: 'MOD.Core.UITransformComponent,MOD.Core.SpriteGUIRendererComponent,MOD.Core.TextComponent',
displayOrder: 0,
components: [
transform({ parentW: 560, parentH: 76, anchor: { x: 0.5, y: 0.5 }, pivot: { x: 0.5, y: 0.5 }, size: { x: 540, y: 40 }, pos: { x: 0, y: 12 } }),
sprite({ color: TRANSPARENT }),
text({ value: '물약', fontSize: 22, bold: true, color: { r: 1, g: 1, b: 1, a: 1 }, alignment: 4 }),
],
}));
shop.push(entity({
id: guid('shp', shpN++),
path: '/ui/DefaultGroup/ShopHud/Potion/Price',
modelId: 'uitext',
entryId: 'UIText',
componentNames: 'MOD.Core.UITransformComponent,MOD.Core.SpriteGUIRendererComponent,MOD.Core.TextComponent',
displayOrder: 1,
components: [
transform({ parentW: 560, parentH: 76, anchor: { x: 0.5, y: 0.5 }, pivot: { x: 0.5, y: 0.5 }, size: { x: 540, y: 30 }, pos: { x: 0, y: -22 } }),
sprite({ color: TRANSPARENT }),
text({ value: '20 골드', fontSize: 20, bold: true, color: { r: 0.98, g: 0.85, b: 0.4, a: 1 }, alignment: 4 }),
],
}));
shop.push(entity({ shop.push(entity({
id: guid('shp', shpN++), id: guid('shp', shpN++),
path: '/ui/DefaultGroup/ShopHud/Leave', path: '/ui/DefaultGroup/ShopHud/Leave',
@@ -1521,7 +1691,7 @@ function upsertUi() {
componentNames: 'MOD.Core.UITransformComponent,MOD.Core.SpriteGUIRendererComponent,MOD.Core.ButtonComponent,MOD.Core.TextComponent', componentNames: 'MOD.Core.UITransformComponent,MOD.Core.SpriteGUIRendererComponent,MOD.Core.ButtonComponent,MOD.Core.TextComponent',
displayOrder: 10, displayOrder: 10,
components: [ components: [
transform({ parentW: 1920, parentH: 1080, anchor: { x: 0.5, y: 0.5 }, pivot: { x: 0.5, y: 0.5 }, size: { x: 200, y: 60 }, pos: { x: 0, y: -300 } }), transform({ parentW: 1920, parentH: 1080, anchor: { x: 0.5, y: 0.5 }, pivot: { x: 0.5, y: 0.5 }, size: { x: 200, y: 60 }, pos: { x: 0, y: -380 } }),
sprite({ color: DARK, type: 1, raycast: true }), sprite({ color: DARK, type: 1, raycast: true }),
button(), button(),
text({ value: '나가기', fontSize: 26, bold: true, color: GOLD, alignment: 4 }), text({ value: '나가기', fontSize: 26, bold: true, color: GOLD, alignment: 4 }),
@@ -1942,6 +2112,15 @@ function writeCodeblocks() {
prop('number', 'PlayerWeak', '0'), prop('number', 'PlayerWeak', '0'),
prop('number', 'PlayerVuln', '0'), prop('number', 'PlayerVuln', '0'),
prop('any', 'PlayerPowers'), prop('any', 'PlayerPowers'),
prop('any', 'Potions'),
prop('any', 'RunPotions'),
prop('number', 'PotionSlots', String(POTIONS.baseSlots)),
prop('string', 'ShopPotion', '""'),
prop('boolean', 'ShopPotionBought', 'false'),
prop('number', 'FightAttackCount', '0'),
prop('boolean', 'FirstHpLossDone', 'false'),
prop('number', 'ClayBlockNext', '0'),
prop('number', 'PotionMenuSlot', '0'),
], [ ], [
method('OnBeginPlay', `self:ShowMainMenu()`), method('OnBeginPlay', `self:ShowMainMenu()`),
method('HideGameHud', `self:SetEntityEnabled("/ui/DefaultGroup/Button_Attack", false) method('HideGameHud', `self:SetEntityEnabled("/ui/DefaultGroup/Button_Attack", false)
@@ -2040,6 +2219,9 @@ self.RunLength = ${ACT_COUNT}
self.RunDeck = { ${CARDS.starterDeck.map(luaStr).join(', ')} } self.RunDeck = { ${CARDS.starterDeck.map(luaStr).join(', ')} }
self.RunActive = true self.RunActive = true
self.RunRelics = {} self.RunRelics = {}
self.RunPotions = {}
self.PotionSlots = ${POTIONS.baseSlots}
${luaPotionsTable(POTIONS.potions)}
${luaRelicsTable(RELICS.relics)} ${luaRelicsTable(RELICS.relics)}
self.RelicPool = { ${RELICS.relicPool.map(luaStr).join(', ')} } self.RelicPool = { ${RELICS.relicPool.map(luaStr).join(', ')} }
${luaEnemiesTable(ENEMIES.enemies)} ${luaEnemiesTable(ENEMIES.enemies)}
@@ -2049,9 +2231,12 @@ self.CurrentNodeId = ""
self.CurrentEnemyId = "" self.CurrentEnemyId = ""
self:BindButtons() self:BindButtons()
self:AddRelic("${RELICS.startingRelic}") self:AddRelic("${RELICS.startingRelic}")
self:RenderPotions()
self:ShowMap()`), self:ShowMap()`),
method('StartCombat', `self:ShowState("combat") method('StartCombat', `self:ShowState("combat")
self:SetEntityEnabled("/ui/DefaultGroup/CombatHud/Result", false) self:SetEntityEnabled("/ui/DefaultGroup/CombatHud/Result", false)
self:SetEntityEnabled("/ui/DefaultGroup/CombatHud/PotionMenu", false)
self:SetEntityEnabled("/ui/DefaultGroup/CombatHud/TooltipBox", false)
self.MaxEnergy = 3 self.MaxEnergy = 3
self.Turn = 0 self.Turn = 0
self.PlayerBlock = 0 self.PlayerBlock = 0
@@ -2059,6 +2244,9 @@ self.PlayerStr = 0
self.PlayerWeak = 0 self.PlayerWeak = 0
self.PlayerVuln = 0 self.PlayerVuln = 0
self.PlayerPowers = {} self.PlayerPowers = {}
self.FightAttackCount = 0
self.FirstHpLossDone = false
self.ClayBlockNext = 0
self.CombatOver = false self.CombatOver = false
self.DiscardPile = {} self.DiscardPile = {}
self.Hand = {} self.Hand = {}
@@ -2243,6 +2431,51 @@ for i = 1, ${MAX_MONSTERS} do
if ms ~= nil and ms.ButtonComponent ~= nil then if ms ~= nil and ms.ButtonComponent ~= nil then
ms:ConnectEvent(ButtonClickEvent, function() self:SetTarget(i) end) ms:ConnectEvent(ButtonClickEvent, function() self:SetTarget(i) end)
end end
end
for i = 1, 10 do
local rs = _EntityService:GetEntityByPath("/ui/DefaultGroup/CombatHud/TopBar/RelicSlot" .. tostring(i))
if rs ~= nil and rs.UITouchReceiveComponent ~= nil then
local idx = i
rs:ConnectEvent(UITouchEnterEvent, function()
local rid = nil
if self.RunRelics ~= nil then rid = self.RunRelics[idx] end
if rid ~= nil and self.Relics[rid] ~= nil then
self:ShowTooltip(self.Relics[rid].name, self.Relics[rid].desc, -240 + (idx - 1) * 48)
end
end)
rs:ConnectEvent(UITouchExitEvent, function() self:HideTooltip() end)
end
end
for i = 1, 5 do
local ps = _EntityService:GetEntityByPath("/ui/DefaultGroup/CombatHud/TopBar/PotionSlot" .. tostring(i))
if ps ~= nil and ps.UITouchReceiveComponent ~= nil then
local idx = i
ps:ConnectEvent(UITouchEnterEvent, function()
local pid = nil
if self.RunPotions ~= nil then pid = self.RunPotions[idx] end
if pid ~= nil and self.Potions[pid] ~= nil then
self:ShowTooltip(self.Potions[pid].name, self.Potions[pid].desc, 240 + (idx - 1) * 44)
end
end)
ps:ConnectEvent(UITouchExitEvent, function() self:HideTooltip() end)
ps:ConnectEvent(UITouchDownEvent, function() self:OpenPotionMenu(idx) end)
end
end
local pmUse = _EntityService:GetEntityByPath("/ui/DefaultGroup/CombatHud/PotionMenu/Use")
if pmUse ~= nil and pmUse.ButtonComponent ~= nil then
pmUse:ConnectEvent(ButtonClickEvent, function() self:UsePotion() end)
end
local pmToss = _EntityService:GetEntityByPath("/ui/DefaultGroup/CombatHud/PotionMenu/Toss")
if pmToss ~= nil and pmToss.ButtonComponent ~= nil then
pmToss:ConnectEvent(ButtonClickEvent, function() self:TossPotion() end)
end
local pmClose = _EntityService:GetEntityByPath("/ui/DefaultGroup/CombatHud/PotionMenu/Close")
if pmClose ~= nil and pmClose.ButtonComponent ~= nil then
pmClose:ConnectEvent(ButtonClickEvent, function() self:ClosePotionMenu() end)
end
local shopPotion = _EntityService:GetEntityByPath("/ui/DefaultGroup/ShopHud/Potion")
if shopPotion ~= nil and shopPotion.ButtonComponent ~= nil then
shopPotion:ConnectEvent(ButtonClickEvent, function() self:BuyPotion() end)
end`), end`),
method('StartPlayerTurn', `self.Turn = self.Turn + 1 method('StartPlayerTurn', `self.Turn = self.Turn + 1
self.Energy = self.MaxEnergy self.Energy = self.MaxEnergy
@@ -2256,6 +2489,10 @@ if self.PlayerPowers ~= nil then
end end
end end
self.PlayerBlock = 0 self.PlayerBlock = 0
if self.ClayBlockNext > 0 then
self.PlayerBlock = self.PlayerBlock + self.ClayBlockNext
self.ClayBlockNext = 0
end
self:DrawCards(5) self:DrawCards(5)
self:RenderHand(true) self:RenderHand(true)
self:RenderCombat()`), self:RenderCombat()`),
@@ -2480,10 +2717,21 @@ end, 1 / 60)`, [
{ Type: 'any', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'toPos' }, { Type: 'any', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'toPos' },
{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'duration' }, { Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'duration' },
]), ]),
method('CalcPlayerAttack', `local dmg = base + self.PlayerStr method('CalcPlayerAttack', `local base2 = base
self.FightAttackCount = self.FightAttackCount + 1
if self.FightAttackCount == 1 and self:HasRelic("akabeko") then
base2 = base2 + 8
end
local dmg = base2 + self.PlayerStr
if self:HasRelic("penNib") and self.FightAttackCount % 10 == 0 then
dmg = dmg * 2
end
if self.PlayerWeak > 0 then if self.PlayerWeak > 0 then
dmg = math.floor(dmg * 0.75) dmg = math.floor(dmg * 0.75)
end end
if dmg > 0 and dmg < 5 and self:HasRelic("boot") then
dmg = 5
end
if dmg < 0 then if dmg < 0 then
dmg = 0 dmg = 0
end end
@@ -2531,7 +2779,12 @@ if c.weak ~= nil or c.vuln ~= nil then
local tm = self.Monsters[self.TargetIndex] local tm = self.Monsters[self.TargetIndex]
if tm ~= nil and tm.alive == true then if tm ~= nil and tm.alive == true then
if c.weak ~= nil then tm.weak = tm.weak + c.weak end if c.weak ~= nil then tm.weak = tm.weak + c.weak end
if c.vuln ~= nil then tm.vuln = tm.vuln + c.vuln end if c.vuln ~= nil then
tm.vuln = tm.vuln + c.vuln
if self:HasRelic("championBelt") then
tm.weak = tm.weak + 1
end
end
end end
end end
table.remove(self.Hand, slot) table.remove(self.Hand, slot)
@@ -2695,10 +2948,33 @@ if self.PlayerBlock > 0 then
self.PlayerBlock = self.PlayerBlock - absorbed self.PlayerBlock = self.PlayerBlock - absorbed
dmg = dmg - absorbed dmg = dmg - absorbed
end end
self.PlayerHp = self.PlayerHp - dmg if dmg > 0 then
self.PlayerHp = self.PlayerHp - dmg
if self:HasRelic("bronzeScales") and attackerSlot ~= nil and attackerSlot > 0 then
local am = self.Monsters[attackerSlot]
if am ~= nil and am.alive == true then
am.hp = am.hp - 3
if am.hp <= 0 then
am.hp = 0
self:KillMonster(am.slot)
end
end
end
if self:HasRelic("selfFormingClay") then
self.ClayBlockNext = self.ClayBlockNext + 3
end
if self:HasRelic("centennialPuzzle") and self.FirstHpLossDone == false then
self.FirstHpLossDone = true
self:DrawCards(3)
self:RenderHand(false)
end
end
if self.PlayerHp < 0 then if self.PlayerHp < 0 then
self.PlayerHp = 0 self.PlayerHp = 0
end`, [{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'amount' }]), end`, [
{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'amount' },
{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'attackerSlot' },
]),
method('EnemyTurn', `self.TurnBusy = true method('EnemyTurn', `self.TurnBusy = true
self:EnemyActStep(1)`), self:EnemyActStep(1)`),
method('EnemyActStep', `local idx = 0 method('EnemyActStep', `local idx = 0
@@ -2725,7 +3001,7 @@ _TimerService:SetTimerOnce(function()
atk = math.floor(atk * 1.5) atk = math.floor(atk * 1.5)
end end
local before = self.PlayerHp local before = self.PlayerHp
self:DealDamageToPlayer(atk) self:DealDamageToPlayer(atk, idx)
self:ShowPlayerDmgPop(before - self.PlayerHp) self:ShowPlayerDmgPop(before - self.PlayerHp)
elseif intent.kind == "Defend" then elseif intent.kind == "Defend" then
m.block = m.block + intent.value m.block = m.block + intent.value
@@ -2760,12 +3036,31 @@ end
if anyAlive == false then if anyAlive == false then
self.CombatOver = true self.CombatOver = true
self.Gold = self.Gold + ${GOLD_PER_WIN} self.Gold = self.Gold + ${GOLD_PER_WIN}
self:ApplyRelics("combatEnd")
self:ApplyRelics("combatReward") self:ApplyRelics("combatReward")
self:MaybeDropPotion()
self:RenderRun() self:RenderRun()
local node = self.MapNodes[self.CurrentNodeId] local node = self.MapNodes[self.CurrentNodeId]
if node ~= nil and node.type == "elite" then if node ~= nil and node.type == "elite" then
self.Gold = self.Gold + 15 self.Gold = self.Gold + 15
self:AddRelic(self.RelicPool[math.random(1, #self.RelicPool)]) local nid = self:PickNewRelic()
if nid ~= "" then
self:AddRelic(nid)
local nr = self.Relics[nid]
if nr ~= nil then
self:Toast("유물 획득: " .. nr.name)
end
end
end
if node ~= nil and node.type == "boss" then
local bid = self:PickNewRelic()
if bid ~= "" then
self:AddRelic(bid)
local br = self.Relics[bid]
if br ~= nil then
self:Toast("유물 획득: " .. br.name)
end
end
end end
if node ~= nil and node.type == "boss" then if node ~= nil and node.type == "boss" then
if self.Floor < self.RunLength then if self.Floor < self.RunLength then
@@ -2955,6 +3250,15 @@ if hud ~= nil then
hud.Enable = false hud.Enable = false
end end
self:ShowMap()`, [{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'slot' }]), self:ShowMap()`, [{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'slot' }]),
method('HasRelic', `if self.RunRelics == nil then
return false
end
for i = 1, #self.RunRelics do
if self.RunRelics[i] == id then
return true
end
end
return false`, [{ Type: 'string', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'id' }], 0, 'boolean'),
method('ApplyRelics', `if self.RunRelics == nil then method('ApplyRelics', `if self.RunRelics == nil then
return return
end end
@@ -2965,11 +3269,23 @@ for i = 1, #self.RunRelics do
self.PlayerBlock = self.PlayerBlock + r.value self.PlayerBlock = self.PlayerBlock + r.value
elseif r.effect == "energy" then elseif r.effect == "energy" then
self.Energy = self.Energy + r.value self.Energy = self.Energy + r.value
elseif r.effect == "healOnAttack" then elseif r.effect == "strength" then
self.PlayerStr = self.PlayerStr + r.value
elseif r.effect == "draw" then
self:DrawCards(r.value)
self:RenderHand(false)
elseif r.effect == "heal" or r.effect == "healOnAttack" or r.effect == "healOnWin" then
self.PlayerHp = self.PlayerHp + r.value self.PlayerHp = self.PlayerHp + r.value
if self.PlayerHp > self.PlayerMaxHp then if self.PlayerHp > self.PlayerMaxHp then
self.PlayerHp = self.PlayerMaxHp self.PlayerHp = self.PlayerMaxHp
end end
elseif r.effect == "healIfLow" then
if self.PlayerHp * 2 <= self.PlayerMaxHp then
self.PlayerHp = self.PlayerHp + r.value
if self.PlayerHp > self.PlayerMaxHp then
self.PlayerHp = self.PlayerMaxHp
end
end
elseif r.effect == "gold" then elseif r.effect == "gold" then
self.Gold = self.Gold + r.value self.Gold = self.Gold + r.value
end end
@@ -2979,24 +3295,182 @@ end`, [{ Type: 'string', DefaultValue: null, SyncDirection: 0, Attributes: [], N
self.RunRelics = {} self.RunRelics = {}
end end
table.insert(self.RunRelics, id) table.insert(self.RunRelics, id)
local r = self.Relics[id]
if r ~= nil and r.hook == "passive" then
if r.effect == "potionSlots" then
self.PotionSlots = r.value
self:RenderPotions()
elseif r.effect == "maxHp" then
self.PlayerMaxHp = self.PlayerMaxHp + r.value
self.PlayerHp = self.PlayerHp + r.value
end
end
self:RenderRelics()`, [{ Type: 'string', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'id' }]), self:RenderRelics()`, [{ Type: 'string', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'id' }]),
method('RenderRelics', `local names = "" method('PickNewRelic', `local pool = {}
for i = 1, #self.RelicPool do
if self:HasRelic(self.RelicPool[i]) == false then
table.insert(pool, self.RelicPool[i])
end
end
if #pool == 0 then
self.Gold = self.Gold + 25
self:Toast("유물을 모두 모았습니다! 골드 +25")
return ""
end
return pool[math.random(1, #pool)]`, [], 0, 'string'),
method('AddPotion', `if self.RunPotions == nil then
self.RunPotions = {}
end
if #self.RunPotions >= self.PotionSlots then
self:Toast("물약 슬롯이 가득 찼습니다")
return false
end
table.insert(self.RunPotions, pid)
self:RenderPotions()
return true`, [{ Type: 'string', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'pid' }], 0, 'boolean'),
method('MaybeDropPotion', `if math.random() > ${POTIONS.dropChance} then
return
end
local keys = {}
for pid, _ in pairs(self.Potions) do
table.insert(keys, pid)
end
table.sort(keys)
local pid = keys[math.random(1, #keys)]
if self:AddPotion(pid) == true then
local p = self.Potions[pid]
self:Toast("물약 획득: " .. p.name)
end`),
method('RenderPotions', `for i = 1, 5 do
local base = "/ui/DefaultGroup/CombatHud/TopBar/PotionSlot" .. tostring(i)
local e = _EntityService:GetEntityByPath(base)
if e ~= nil and e.SpriteGUIRendererComponent ~= nil then
local pid = nil
if self.RunPotions ~= nil then
pid = self.RunPotions[i]
end
if pid ~= nil and self.Potions[pid] ~= nil then
e.SpriteGUIRendererComponent.ImageRUID = self.Potions[pid].icon
e.SpriteGUIRendererComponent.Color = Color(1, 1, 1, 1)
elseif i > self.PotionSlots then
e.SpriteGUIRendererComponent.ImageRUID = ""
e.SpriteGUIRendererComponent.Color = Color(0.1, 0.1, 0.12, 0.85)
else
e.SpriteGUIRendererComponent.ImageRUID = ""
e.SpriteGUIRendererComponent.Color = Color(0.22, 0.25, 0.3, 0.9)
end
end
end`),
method('OpenPotionMenu', `if self.RunPotions == nil or self.RunPotions[slot] == nil then
return
end
self.PotionMenuSlot = slot
local pid = self.RunPotions[slot]
local p = self.Potions[pid]
if p ~= nil then
self:SetText("/ui/DefaultGroup/CombatHud/PotionMenu/Title", p.name .. " — " .. p.desc)
end
self:SetEntityEnabled("/ui/DefaultGroup/CombatHud/PotionMenu", true)`, [{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'slot' }]),
method('ClosePotionMenu', `self.PotionMenuSlot = 0
self:SetEntityEnabled("/ui/DefaultGroup/CombatHud/PotionMenu", false)`),
method('UsePotion', `if self.PotionMenuSlot <= 0 then
return
end
if self.CombatOver == true or self.TurnBusy == true or self.FxBusy == true then
self:Toast("지금은 사용할 수 없습니다")
return
end
local combat = _EntityService:GetEntityByPath("/ui/DefaultGroup/CombatHud")
local hand = _EntityService:GetEntityByPath("/ui/DefaultGroup/CardHand")
if combat == nil or combat.Enable ~= true or hand == nil or hand.Enable ~= true then
self:Toast("전투 중에만 사용할 수 있습니다")
return
end
local pid = self.RunPotions[self.PotionMenuSlot]
if pid == nil then
return
end
local p = self.Potions[pid]
if p == nil then
return
end
if p.effect == "heal" then
self.PlayerHp = math.min(self.PlayerHp + p.value, self.PlayerMaxHp)
elseif p.effect == "damage" then
self:DealDamageToTarget(p.value)
self:ShowDmgPop(self.TargetIndex, p.value)
elseif p.effect == "strength" then
self.PlayerStr = self.PlayerStr + p.value
elseif p.effect == "block" then
self.PlayerBlock = self.PlayerBlock + p.value
elseif p.effect == "energy" then
self.Energy = self.Energy + p.value
elseif p.effect == "weak" then
local tm = self.Monsters[self.TargetIndex]
if tm ~= nil and tm.alive == true then
tm.weak = tm.weak + p.value
end
end
table.remove(self.RunPotions, self.PotionMenuSlot)
self:Toast("물약 사용: " .. p.name)
self:ClosePotionMenu()
self:RenderPotions()
self:RenderPiles()
self:RenderCombat()
self:CheckCombatEnd()`),
method('TossPotion', `if self.PotionMenuSlot <= 0 then
return
end
local pid = self.RunPotions[self.PotionMenuSlot]
if pid ~= nil then
local p = self.Potions[pid]
table.remove(self.RunPotions, self.PotionMenuSlot)
if p ~= nil then
self:Toast("물약 버림: " .. p.name)
end
end
self:ClosePotionMenu()
self:RenderPotions()`),
method('RenderRelics', `local count = 0
if self.RunRelics ~= nil then if self.RunRelics ~= nil then
for i = 1, #self.RunRelics do count = #self.RunRelics
local r = self.Relics[self.RunRelics[i]] end
if r ~= nil then for i = 1, 10 do
if names == "" then local base = "/ui/DefaultGroup/CombatHud/TopBar/RelicSlot" .. tostring(i)
names = r.name local e = _EntityService:GetEntityByPath(base)
else if e ~= nil and e.SpriteGUIRendererComponent ~= nil then
names = names .. ", " .. r.name local rid = nil
end if self.RunRelics ~= nil then
rid = self.RunRelics[i]
end
if rid ~= nil and self.Relics[rid] ~= nil and (i < 10 or count <= 10) then
e.SpriteGUIRendererComponent.ImageRUID = self.Relics[rid].icon
e.SpriteGUIRendererComponent.Color = Color(1, 1, 1, 1)
else
e.SpriteGUIRendererComponent.ImageRUID = ""
e.SpriteGUIRendererComponent.Color = Color(0.15, 0.16, 0.2, 0.6)
end end
end end
end end
if names == "" then local of = ""
names = "없음" if count > 10 then
of = "+" .. tostring(count - 9)
end end
self:SetText("/ui/DefaultGroup/CombatHud/TopBar/Relics", "유물: " .. names)`), self:SetText("/ui/DefaultGroup/CombatHud/TopBar/RelicOverflow", of)`),
method('ShowTooltip', `self:SetText("/ui/DefaultGroup/CombatHud/TooltipBox/Name", name)
self:SetText("/ui/DefaultGroup/CombatHud/TooltipBox/Desc", desc)
local e = _EntityService:GetEntityByPath("/ui/DefaultGroup/CombatHud/TooltipBox")
if e ~= nil then
if e.UITransformComponent ~= nil then
e.UITransformComponent.anchoredPosition = Vector2(x, 400)
end
e.Enable = true
end`, [
{ Type: 'string', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'name' },
{ Type: 'string', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'desc' },
{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'x' },
]),
method('HideTooltip', `self:SetEntityEnabled("/ui/DefaultGroup/CombatHud/TooltipBox", false)`),
method('ShowMap', `self:ShowState("map") method('ShowMap', `self:ShowState("map")
self:RenderMap()`), self:RenderMap()`),
method('IsReachable', `local list method('IsReachable', `local list
@@ -3062,6 +3536,13 @@ for i = 1, 3 do
end end
self.ShopRelic = self.RelicPool[math.random(1, #self.RelicPool)] self.ShopRelic = self.RelicPool[math.random(1, #self.RelicPool)]
self.ShopRelicBought = false self.ShopRelicBought = false
local pkeys = {}
for pid, _ in pairs(self.Potions) do
table.insert(pkeys, pid)
end
table.sort(pkeys)
self.ShopPotion = pkeys[math.random(1, #pkeys)]
self.ShopPotionBought = false
self:RenderShop() self:RenderShop()
self:ShowState("shop")`), self:ShowState("shop")`),
method('RenderShop', `self:SetText("/ui/DefaultGroup/ShopHud/Gold", "골드 " .. string.format("%d", self.Gold)) method('RenderShop', `self:SetText("/ui/DefaultGroup/ShopHud/Gold", "골드 " .. string.format("%d", self.Gold))
@@ -3092,6 +3573,19 @@ if rr ~= nil then
re.SpriteGUIRendererComponent.Color = Color(0.7, 0.55, 0.85, 1) re.SpriteGUIRendererComponent.Color = Color(0.7, 0.55, 0.85, 1)
end end
end end
end
local pp = self.Potions[self.ShopPotion]
if pp ~= nil then
self:SetText("/ui/DefaultGroup/ShopHud/Potion/Label", pp.name .. " — " .. pp.desc)
self:SetText("/ui/DefaultGroup/ShopHud/Potion/Price", string.format("%d", ${POTIONS.shopPrice}) .. " 골드")
local pe = _EntityService:GetEntityByPath("/ui/DefaultGroup/ShopHud/Potion")
if pe ~= nil and pe.SpriteGUIRendererComponent ~= nil then
if self.ShopPotionBought == true then
pe.SpriteGUIRendererComponent.Color = Color(0.2, 0.22, 0.26, 0.6)
else
pe.SpriteGUIRendererComponent.Color = Color(0.45, 0.7, 0.55, 1)
end
end
end`), end`),
method('BuyRelic', `if self.ShopRelicBought == true then method('BuyRelic', `if self.ShopRelicBought == true then
return return
@@ -3103,6 +3597,22 @@ self.Gold = self.Gold - ${RELIC_PRICE}
self:AddRelic(self.ShopRelic) self:AddRelic(self.ShopRelic)
self.ShopRelicBought = true self.ShopRelicBought = true
self:RenderShop() self:RenderShop()
self:RenderRun()`),
method('BuyPotion', `if self.ShopPotionBought == true then
return
end
if self.Gold < ${POTIONS.shopPrice} then
return
end
if self.RunPotions ~= nil and #self.RunPotions >= self.PotionSlots then
self:Toast("물약 슬롯이 가득 찼습니다")
return
end
if self:AddPotion(self.ShopPotion) == true then
self.Gold = self.Gold - ${POTIONS.shopPrice}
self.ShopPotionBought = true
end
self:RenderShop()
self:RenderRun()`), self:RenderRun()`),
method('BuyCard', `if self.ShopBought == nil or self.ShopBought[slot] == true then method('BuyCard', `if self.ShopBought == nil or self.ShopBought[slot] == true then
return return

File diff suppressed because it is too large Load Diff