feat(cards): implement retain keyword

This commit is contained in:
2026-06-15 00:45:11 +09:00
parent 6427d23f50
commit b43ee02014
5 changed files with 38 additions and 8 deletions

View File

@@ -152,6 +152,7 @@ function luaCardsTable(cards) {
if (c.discard != null) fields.push(`discard = ${c.discard}`);
if (c.discardAll === true) fields.push('discardAll = true');
if (c.sly === true) fields.push('sly = true');
if (c.retain === true) fields.push('retain = 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');
@@ -3701,10 +3702,17 @@ if burn > 0 then
\tself:ShowPlayerDmgPop(burn)
\tself:RenderCombat()
end
local kept = {}
for i = 1, #self.Hand do
\ttable.insert(self.DiscardPile, self.Hand[i])
\tlocal cardId = self.Hand[i]
\tlocal c = self.Cards[cardId]
\tif c ~= nil and c.retain == true then
\t\ttable.insert(kept, cardId)
\telse
\t\ttable.insert(self.DiscardPile, cardId)
\tend
end
self.Hand = {}
self.Hand = kept
if self.PlayerWeak > 0 then self.PlayerWeak = self.PlayerWeak - 1 end
if self.PlayerVuln > 0 then self.PlayerVuln = self.PlayerVuln - 1 end
self:RenderHand(false)