Merge pull request '표창 카드 손패 생성 구현' (#69) from codex/implement-shuriken-cards into main

Reviewed-on: #69
This commit was merged in pull request #69.
This commit is contained in:
2026-06-16 07:26:11 +09:00
5 changed files with 178 additions and 51 deletions

View File

@@ -173,12 +173,16 @@ function luaCardsTable(cards) {
if (c.poison != null) fields.push(`poison = ${c.poison}`);
if (c.discard != null) fields.push(`discard = ${c.discard}`);
if (c.discardAll === true) fields.push('discardAll = true');
if (c.addShiv != null) fields.push(`addShiv = ${c.addShiv}`);
if (c.turnStartShiv != null) fields.push(`turnStartShiv = ${c.turnStartShiv}`);
if (c.addShivPerDiscard === true) fields.push('addShivPerDiscard = true');
if (c.sly === true) fields.push('sly = true');
if (c.retain === true) fields.push('retain = true');
if (c.exhaust === true || String(c.desc || '').includes('소멸.')) fields.push('exhaust = true');
if (c.aoe === true) fields.push('aoe = true');
if (c.unplayable === true) fields.push('unplayable = true');
if (c.curse === true) fields.push('curse = true');
if (c.token === true) fields.push('token = true');
if (c.endTurnDamage != null) fields.push(`endTurnDamage = ${c.endTurnDamage}`);
if (c.fx != null) fields.push(`fx = ${luaStr(c.fx)}`);
if (c.image != null) fields.push(`image = ${luaStr(c.image)}`);
@@ -2984,6 +2988,8 @@ function writeCodeblocks() {
prop('string', 'PlayerJob', '""'),
prop('number', 'DiscardSelectRemaining', '0'),
prop('number', 'DiscardSelectTotal', '0'),
prop('number', 'DiscardPostShiv', '0'),
prop('number', 'DiscardShivPerPick', '0'),
], [
method('OnBeginPlay', `${luaCardsTable(CARDS.cards)}
${luaFramesTable()}
@@ -3474,6 +3480,8 @@ self.FirstHpLossDone = false
self.ClayBlockNext = 0
self.DiscardSelectRemaining = 0
self.DiscardSelectTotal = 0
self.DiscardPostShiv = 0
self.DiscardShivPerPick = 0
self.CombatOver = false
self.DiscardPile = {}
self.ExhaustPile = {}
@@ -3827,6 +3835,9 @@ if self.PlayerPowers ~= nil then
elseif pc.powerEffect == "blockPerTurn" then
self.PlayerBlock = self.PlayerBlock + pc.value
end
if pc.turnStartShiv ~= nil then
self:AddCardsToHand("Shiv", pc.turnStartShiv)
end
end
end
end
@@ -3898,6 +3909,24 @@ end`, [
{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'amount' },
{ Type: 'boolean', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'animate' },
]),
method('AddCardsToHand', `if self.Hand == nil then
self.Hand = {}
end
if self.DiscardPile == nil then
self.DiscardPile = {}
end
for i = 1, amount do
if #self.Hand >= 10 then
table.insert(self.DiscardPile, cardId)
else
table.insert(self.Hand, cardId)
end
end
self:RenderHand(false)
self:RenderPiles()`, [
{ Type: 'string', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'cardId' },
{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'amount' },
]),
method('RecycleDiscardIntoDraw', `if self.DiscardPile == nil or #self.DiscardPile <= 0 then
\treturn
end
@@ -4394,7 +4423,7 @@ elseif c.kind == "Skill" then
self:AddCardBlock(c.block)
end
elseif c.kind == "Power" then
if c.powerEffect ~= nil and free ~= true then
if free ~= true then
table.insert(self.PlayerPowers, cardId)
end
end
@@ -4433,6 +4462,9 @@ if c.weak ~= nil or c.vuln ~= nil or c.poison ~= nil then
end
if c.draw ~= nil then
self:DrawCards(c.draw, true)
end
if c.addShiv ~= nil and c.discard == nil and c.discardAll ~= true then
self:AddCardsToHand("Shiv", c.addShiv)
end`, [
{ Type: 'string', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'cardId' },
{ Type: 'any', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'c' },
@@ -4485,12 +4517,26 @@ if n <= 0 then
end
self.DiscardSelectRemaining = n
self.DiscardSelectTotal = n
self.DiscardPostShiv = 0
self.DiscardShivPerPick = 0
if c.addShiv ~= nil then
self.DiscardPostShiv = c.addShiv
end
if c.addShivPerDiscard == true then
self.DiscardShivPerPick = 1
end
self:UpdateDiscardPrompt()
self:Toast("버릴 카드를 선택하세요")
return true`, [{ Type: 'any', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'c' }], 0, 'boolean'),
method('FinishDiscardSelection', `self.DiscardSelectRemaining = 0
self.DiscardSelectTotal = 0
local shivCount = self.DiscardPostShiv or 0
self.DiscardPostShiv = 0
self.DiscardShivPerPick = 0
self:UpdateDiscardPrompt()
if shivCount > 0 then
self:AddCardsToHand("Shiv", shivCount)
end
self:RenderHand(false)
self:RenderPiles()
self:RenderCombat()
@@ -4501,7 +4547,11 @@ end
if self.Hand == nil or self.Hand[slot] == nil then
return true
end
local discarded = self.Hand[slot]
self:DiscardHandCard(slot, true)
if discarded ~= nil and self.DiscardShivPerPick ~= nil and self.DiscardShivPerPick > 0 then
self.DiscardPostShiv = (self.DiscardPostShiv or 0) + self.DiscardShivPerPick
end
self.DiscardSelectRemaining = self.DiscardSelectRemaining - 1
if self.DiscardSelectRemaining <= 0 or #self.Hand <= 0 then
self:FinishDiscardSelection()
@@ -4924,6 +4974,8 @@ self.ExhaustPile = {}
self.Hand = {}
self.DiscardSelectRemaining = 0
self.DiscardSelectTotal = 0
self.DiscardPostShiv = 0
self.DiscardShivPerPick = 0
self:UpdateDiscardPrompt()
self:RenderHand(false)
self:RenderPiles()`),
@@ -5392,7 +5444,7 @@ self:SetText("/ui/DefaultGroup/CombatHud/TopBar/Floor", floorText)
self:SetText("/ui/DefaultGroup/CombatHud/TopBar/Gold", "메소 " .. string.format("%d", self.Gold))`),
method('CardPool', `local pool = {}
for id, c in pairs(self.Cards) do
if c.class == self.SelectedClass or (self.PlayerJob ~= "" and c.class == self.PlayerJob) then
if c.token ~= true and (c.class == self.SelectedClass or (self.PlayerJob ~= "" and c.class == self.PlayerJob)) then
table.insert(pool, id)
end
end