feat(bandit): STS2 사일런트 카드풀 및 직업 탭 정리 #56

Merged
gahusb merged 14 commits from codex/class-tabbed-codex into main 2026-06-15 07:27:26 +09:00
2 changed files with 100 additions and 22 deletions
Showing only changes of commit 6427d23f50 - Show all commits

View File

@@ -554,6 +554,13 @@
"Attributes": [],
"Name": "DragSlot"
},
{
"Type": "number",
"DefaultValue": "0",
"SyncDirection": 0,
"Attributes": [],
"Name": "DragTargetIndex"
},
{
"Type": "boolean",
"DefaultValue": "false",
@@ -2390,6 +2397,44 @@
"Attributes": [],
"Name": "OnCardButton"
},
{
"Return": {
"Type": "number",
"DefaultValue": null,
"SyncDirection": 0,
"Attributes": [],
"Name": null
},
"Arguments": [
{
"Type": "any",
"DefaultValue": null,
"SyncDirection": 0,
"Attributes": [],
"Name": "touchPoint"
}
],
"Code": "local best = 0\nlocal bestDist = 200\nfor i = 1, #self.Monsters do\n\tlocal m = self.Monsters[i]\n\tif m.alive == true and m.entity ~= nil and isvalid(m.entity) and m.entity.TransformComponent ~= nil then\n\t\tlocal wp = m.entity.TransformComponent.WorldPosition\n\t\tlocal sp = _UILogic:WorldToScreenPosition(Vector2(wp.x, wp.y + 0.7))\n\t\tlocal dx = sp.x - touchPoint.x\n\t\tlocal dy = sp.y - touchPoint.y\n\t\tlocal d = math.sqrt(dx * dx + dy * dy)\n\t\tif d < bestDist then\n\t\t\tbestDist = d\n\t\t\tbest = i\n\t\tend\n\tend\nend\nreturn best",
"Scope": 2,
"ExecSpace": 6,
"Attributes": [],
"Name": "FindMonsterAtTouch"
},
{
"Return": {
"Type": "void",
"DefaultValue": null,
"SyncDirection": 0,
"Attributes": [],
"Name": null
},
"Arguments": [],
"Code": "local shownTarget = self.TargetIndex\nif self.DragTargetIndex ~= nil and self.DragTargetIndex > 0 then\n\tshownTarget = self.DragTargetIndex\nend\nfor i = 1, #self.Monsters do\n\tlocal m = self.Monsters[i]\n\tlocal active = false\n\tif m ~= nil and m.alive == true and i == shownTarget then active = true end\n\tself:SetEntityEnabled(\"/ui/DefaultGroup/CombatHud/MonsterSlot\" .. tostring(i) .. \"/TargetFrame\", active)\nend",
"Scope": 2,
"ExecSpace": 6,
"Attributes": [],
"Name": "RenderTargetFrames"
},
{
"Return": {
"Type": "void",
@@ -2407,7 +2452,7 @@
"Name": "slot"
}
],
"Code": "if self.CombatOver == true or self.FxBusy == true or self.TurnBusy == true then\n\treturn\nend\nif self.Hand == nil or self.Hand[slot] == nil then\n\treturn\nend\nif self.CardHoverTweenId ~= nil and self.CardHoverTweenId ~= 0 then\n\t_TimerService:ClearTimer(self.CardHoverTweenId)\n\tself.CardHoverTweenId = 0\nend\nfor i = 1, 10 do\n\tlocal e = _EntityService:GetEntityByPath(\"/ui/DefaultGroup/CardHand/Card\" .. tostring(i))\n\tif e ~= nil and e.UITransformComponent ~= nil then\n\t\te.UITransformComponent.UIScale = Vector3(1, 1, 1)\n\t\te.UITransformComponent.anchoredPosition = Vector2(self:GetHandSlotX(i), 0)\n\tend\nend\nself.DragSlot = slot",
"Code": "if self.CombatOver == true or self.FxBusy == true or self.TurnBusy == true then\n\treturn\nend\nif self.Hand == nil or self.Hand[slot] == nil then\n\treturn\nend\nif self.CardHoverTweenId ~= nil and self.CardHoverTweenId ~= 0 then\n\t_TimerService:ClearTimer(self.CardHoverTweenId)\n\tself.CardHoverTweenId = 0\nend\nfor i = 1, 10 do\n\tlocal e = _EntityService:GetEntityByPath(\"/ui/DefaultGroup/CardHand/Card\" .. tostring(i))\n\tif e ~= nil and e.UITransformComponent ~= nil then\n\t\te.UITransformComponent.UIScale = Vector3(1, 1, 1)\n\t\te.UITransformComponent.anchoredPosition = Vector2(self:GetHandSlotX(i), 0)\n\tend\nend\nself.DragSlot = slot\nself.DragTargetIndex = 0\nself:RenderTargetFrames()",
"Scope": 2,
"ExecSpace": 6,
"Attributes": [],
@@ -2437,7 +2482,7 @@
"Name": "touchPoint"
}
],
"Code": "if self.DragSlot ~= slot then\n\treturn\nend\nlocal e = _EntityService:GetEntityByPath(\"/ui/DefaultGroup/CardHand/Card\" .. tostring(slot))\nif e ~= nil and e.UITransformComponent ~= nil then\n\tlocal ui = _UILogic:ScreenToUIPosition(touchPoint)\n\te.UITransformComponent.anchoredPosition = Vector2(ui.x, ui.y + 360)\nend",
"Code": "if self.DragSlot ~= slot then\n\treturn\nend\nlocal e = _EntityService:GetEntityByPath(\"/ui/DefaultGroup/CardHand/Card\" .. tostring(slot))\nif e ~= nil and e.UITransformComponent ~= nil then\n\tlocal ui = _UILogic:ScreenToUIPosition(touchPoint)\n\te.UITransformComponent.anchoredPosition = Vector2(ui.x, ui.y + 360)\nend\nlocal cardId = self.Hand[slot]\nlocal c = nil\nif cardId ~= nil then c = self.Cards[cardId] end\nif c ~= nil and c.kind == \"Attack\" then\n\tlocal best = self:FindMonsterAtTouch(touchPoint)\n\tif best ~= self.DragTargetIndex then\n\t\tself.DragTargetIndex = best\n\t\tself:RenderTargetFrames()\n\tend\nend",
"Scope": 2,
"ExecSpace": 6,
"Attributes": [],
@@ -2497,7 +2542,7 @@
"Name": "touchPoint"
}
],
"Code": "if self:IsDiscardSelecting() == true then\n\tself:SelectDiscardSlot(slot)\n\treturn\nend\nif self.CombatOver == true or self.FxBusy == true or self.TurnBusy == true then\n\treturn\nend\nlocal cardId = self.Hand[slot]\nif cardId == nil then\n\treturn\nend\nlocal c = self.Cards[cardId]\nif c == nil then\n\treturn\nend\nif c.kind == \"Attack\" then\n\tlocal best = 0\n\tlocal bestDist = 200\n\tfor i = 1, #self.Monsters do\n\t\tlocal m = self.Monsters[i]\n\t\tif m.alive == true and m.entity ~= nil and isvalid(m.entity) and m.entity.TransformComponent ~= nil then\n\t\t\tlocal wp = m.entity.TransformComponent.WorldPosition\n\t\t\tlocal sp = _UILogic:WorldToScreenPosition(Vector2(wp.x, wp.y + 0.7))\n\t\t\tlocal dx = sp.x - touchPoint.x\n\t\t\tlocal dy = sp.y - touchPoint.y\n\t\t\tlocal d = math.sqrt(dx * dx + dy * dy)\n\t\t\tif d < bestDist then\n\t\t\t\tbestDist = d\n\t\t\t\tbest = i\n\t\t\tend\n\t\tend\n\tend\n\tif best > 0 then\n\t\tself.TargetIndex = best\n\t\tself:PlayCard(slot)\n\tend\nelse\n\tlocal ui = _UILogic:ScreenToUIPosition(touchPoint)\n\tif ui.y > -180 then\n\t\tself:PlayCard(slot)\n\tend\nend",
"Code": "if self:IsDiscardSelecting() == true then\n\tself:SelectDiscardSlot(slot)\n\treturn\nend\nif self.CombatOver == true or self.FxBusy == true or self.TurnBusy == true then\n\treturn\nend\nlocal cardId = self.Hand[slot]\nif cardId == nil then\n\treturn\nend\nlocal c = self.Cards[cardId]\nif c == nil then\n\treturn\nend\nif c.kind == \"Attack\" then\n\tlocal best = self.DragTargetIndex or 0\n\tif best <= 0 then best = self:FindMonsterAtTouch(touchPoint) end\n\tself.DragTargetIndex = 0\n\tif best > 0 then\n\t\tself.TargetIndex = best\n\t\tself:PlayCard(slot)\n\telse\n\t\tself:RenderTargetFrames()\n\tend\nelse\n\tself.DragTargetIndex = 0\n\tself:RenderTargetFrames()\n\tlocal ui = _UILogic:ScreenToUIPosition(touchPoint)\n\tif ui.y > -180 then\n\t\tself:PlayCard(slot)\n\tend\nend",
"Scope": 2,
"ExecSpace": 6,
"Attributes": [],
@@ -2986,7 +3031,7 @@
"Name": null
},
"Arguments": [],
"Code": "for i = 1, 4 do\n\tlocal base = \"/ui/DefaultGroup/CombatHud/MonsterSlot\" .. tostring(i)\n\tlocal m = self.Monsters[i]\n\tif m ~= nil and m.alive == true then\n\t\tself:SetEntityEnabled(base, true)\n\t\tself:SetText(base .. \"/Name\", m.name)\n\t\tself:SetText(base .. \"/Hp\", string.format(\"%d\", m.hp) .. \"/\" .. string.format(\"%d\", m.maxHp))\n\t\tlocal intent = m.intents[m.intentIdx]\n\t\tlocal t = \"\"\n\t\tif intent ~= nil then\n\t\t\tif intent.kind == \"Attack\" then\n\t\t\t\tlocal atk = intent.value + m.str\n\t\t\t\tif m.weak > 0 then atk = math.floor(atk * 0.75) end\n\t\t\t\tif self.PlayerVuln > 0 then atk = math.floor(atk * 1.5) end\n\t\t\t\tt = \"공격 \" .. tostring(atk)\n\t\t\telseif intent.kind == \"Defend\" then t = \"방어 \" .. tostring(intent.value)\n\t\t\telseif intent.kind == \"Debuff\" then\n\t\t\t\tif intent.effect == \"weak\" then t = \"약화 \" .. tostring(intent.value) .. \" 부여\"\n\t\t\t\telse t = \"취약 \" .. tostring(intent.value) .. \" 부여\" end\n\t\t\telseif intent.kind == \"AddCard\" then\n\t\t\t\tt = \"저주 카드 추가\"\n\t\t\tend\n\t\tend\n\t\tself:SetText(base .. \"/Intent\", t)\n\t\tself:SetEntityEnabled(base .. \"/TargetFrame\", i == self.TargetIndex)\n\t\tlocal intentEntity = _EntityService:GetEntityByPath(base .. \"/Intent\")\n\t\tif intentEntity ~= nil and intentEntity.TextComponent ~= nil and intent ~= nil then\n\t\t\tif intent.kind == \"Attack\" then\n\t\t\t\tintentEntity.TextComponent.FontColor = Color(1, 0.45, 0.35, 1)\n\t\t\telseif intent.kind == \"Debuff\" then\n\t\t\t\tintentEntity.TextComponent.FontColor = Color(0.8, 0.5, 1, 1)\n\t\t\telseif intent.kind == \"AddCard\" then\n\t\t\t\tintentEntity.TextComponent.FontColor = Color(0.6, 0.85, 0.4, 1)\n\t\t\telse\n\t\t\t\tintentEntity.TextComponent.FontColor = Color(0.5, 0.75, 1, 1)\n\t\t\tend\n\t\tend\n\t\tself:SetHpBar(base .. \"/HpBarFill\", m.hp, m.maxHp, 140)\n\t\tself:SetEntityEnabled(base .. \"/BlockBadge\", m.block > 0)\n\t\tself:SetText(base .. \"/BlockBadge/Value\", string.format(\"%d\", m.block))\n\t\tself:SetText(base .. \"/Buffs\", self:BuffsLabel(m.str, m.weak, m.vuln, m.poison or 0))\n\telse\n\t\tself:SetEntityEnabled(base, false)\n\tend\nend\nself:SetText(\"/ui/DefaultGroup/CombatHud/PlayerPanel/HpText\", string.format(\"%d\", self.PlayerHp) .. \"/\" .. string.format(\"%d\", self.PlayerMaxHp))\nself:SetHpBar(\"/ui/DefaultGroup/CombatHud/PlayerPanel/HpBarFill\", self.PlayerHp, self.PlayerMaxHp, 220)\nself:SetEntityEnabled(\"/ui/DefaultGroup/CombatHud/PlayerPanel/BlockBadge\", self.PlayerBlock > 0)\nself:SetText(\"/ui/DefaultGroup/CombatHud/PlayerPanel/BlockBadge/Value\", string.format(\"%d\", self.PlayerBlock))\nlocal pb = self:BuffsLabel(self.PlayerStr, self.PlayerWeak, self.PlayerVuln, 0)\nif self.PlayerPowers ~= nil and #self.PlayerPowers > 0 then\n\tlocal names = {}\n\tfor i = 1, #self.PlayerPowers do\n\t\tlocal pc = self.Cards[self.PlayerPowers[i]]\n\t\tif pc ~= nil then table.insert(names, pc.name) end\n\tend\n\tif pb ~= \"\" then pb = pb .. \" · \" end\n\tpb = pb .. table.concat(names, \" \")\nend\nself:SetText(\"/ui/DefaultGroup/CombatHud/PlayerPanel/Buffs\", pb)\nself:RenderRun()",
"Code": "for i = 1, 4 do\n\tlocal base = \"/ui/DefaultGroup/CombatHud/MonsterSlot\" .. tostring(i)\n\tlocal m = self.Monsters[i]\n\tif m ~= nil and m.alive == true then\n\t\tself:SetEntityEnabled(base, true)\n\t\tself:SetText(base .. \"/Name\", m.name)\n\t\tself:SetText(base .. \"/Hp\", string.format(\"%d\", m.hp) .. \"/\" .. string.format(\"%d\", m.maxHp))\n\t\tlocal intent = m.intents[m.intentIdx]\n\t\tlocal t = \"\"\n\t\tif intent ~= nil then\n\t\t\tif intent.kind == \"Attack\" then\n\t\t\t\tlocal atk = intent.value + m.str\n\t\t\t\tif m.weak > 0 then atk = math.floor(atk * 0.75) end\n\t\t\t\tif self.PlayerVuln > 0 then atk = math.floor(atk * 1.5) end\n\t\t\t\tt = \"공격 \" .. tostring(atk)\n\t\t\telseif intent.kind == \"Defend\" then t = \"방어 \" .. tostring(intent.value)\n\t\t\telseif intent.kind == \"Debuff\" then\n\t\t\t\tif intent.effect == \"weak\" then t = \"약화 \" .. tostring(intent.value) .. \" 부여\"\n\t\t\t\telse t = \"취약 \" .. tostring(intent.value) .. \" 부여\" end\n\t\t\telseif intent.kind == \"AddCard\" then\n\t\t\t\tt = \"저주 카드 추가\"\n\t\t\tend\n\t\tend\n\t\tself:SetText(base .. \"/Intent\", t)\n\t\tlocal shownTarget = self.TargetIndex\n\t\tif self.DragTargetIndex ~= nil and self.DragTargetIndex > 0 then shownTarget = self.DragTargetIndex end\n\t\tself:SetEntityEnabled(base .. \"/TargetFrame\", i == shownTarget)\n\t\tlocal intentEntity = _EntityService:GetEntityByPath(base .. \"/Intent\")\n\t\tif intentEntity ~= nil and intentEntity.TextComponent ~= nil and intent ~= nil then\n\t\t\tif intent.kind == \"Attack\" then\n\t\t\t\tintentEntity.TextComponent.FontColor = Color(1, 0.45, 0.35, 1)\n\t\t\telseif intent.kind == \"Debuff\" then\n\t\t\t\tintentEntity.TextComponent.FontColor = Color(0.8, 0.5, 1, 1)\n\t\t\telseif intent.kind == \"AddCard\" then\n\t\t\t\tintentEntity.TextComponent.FontColor = Color(0.6, 0.85, 0.4, 1)\n\t\t\telse\n\t\t\t\tintentEntity.TextComponent.FontColor = Color(0.5, 0.75, 1, 1)\n\t\t\tend\n\t\tend\n\t\tself:SetHpBar(base .. \"/HpBarFill\", m.hp, m.maxHp, 140)\n\t\tself:SetEntityEnabled(base .. \"/BlockBadge\", m.block > 0)\n\t\tself:SetText(base .. \"/BlockBadge/Value\", string.format(\"%d\", m.block))\n\t\tself:SetText(base .. \"/Buffs\", self:BuffsLabel(m.str, m.weak, m.vuln, m.poison or 0))\n\telse\n\t\tself:SetEntityEnabled(base, false)\n\tend\nend\nself:SetText(\"/ui/DefaultGroup/CombatHud/PlayerPanel/HpText\", string.format(\"%d\", self.PlayerHp) .. \"/\" .. string.format(\"%d\", self.PlayerMaxHp))\nself:SetHpBar(\"/ui/DefaultGroup/CombatHud/PlayerPanel/HpBarFill\", self.PlayerHp, self.PlayerMaxHp, 220)\nself:SetEntityEnabled(\"/ui/DefaultGroup/CombatHud/PlayerPanel/BlockBadge\", self.PlayerBlock > 0)\nself:SetText(\"/ui/DefaultGroup/CombatHud/PlayerPanel/BlockBadge/Value\", string.format(\"%d\", self.PlayerBlock))\nlocal pb = self:BuffsLabel(self.PlayerStr, self.PlayerWeak, self.PlayerVuln, 0)\nif self.PlayerPowers ~= nil and #self.PlayerPowers > 0 then\n\tlocal names = {}\n\tfor i = 1, #self.PlayerPowers do\n\t\tlocal pc = self.Cards[self.PlayerPowers[i]]\n\t\tif pc ~= nil then table.insert(names, pc.name) end\n\tend\n\tif pb ~= \"\" then pb = pb .. \" · \" end\n\tpb = pb .. table.concat(names, \" \")\nend\nself:SetText(\"/ui/DefaultGroup/CombatHud/PlayerPanel/Buffs\", pb)\nself:RenderRun()",
"Scope": 2,
"ExecSpace": 6,
"Attributes": [],

View File

@@ -2828,6 +2828,7 @@ function writeCodeblocks() {
prop('string', 'ShopRelic', '""'),
prop('boolean', 'ShopRelicBought', 'false'),
prop('number', 'DragSlot', '0'),
prop('number', 'DragTargetIndex', '0'),
prop('boolean', 'FxBusy', 'false'),
prop('boolean', 'TurnBusy', 'false'),
prop('number', 'PlayerStr', '0'),
@@ -4369,6 +4370,33 @@ self:CheckCombatEnd()`, [{ Type: 'number', DefaultValue: null, SyncDirection: 0,
method('OnCardButton', `if self:IsDiscardSelecting() == true then
self:SelectDiscardSlot(slot)
end`, [{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'slot' }]),
method('FindMonsterAtTouch', `local best = 0
local bestDist = 200
for i = 1, #self.Monsters do
local m = self.Monsters[i]
if m.alive == true and m.entity ~= nil and isvalid(m.entity) and m.entity.TransformComponent ~= nil then
local wp = m.entity.TransformComponent.WorldPosition
local sp = _UILogic:WorldToScreenPosition(Vector2(wp.x, wp.y + 0.7))
local dx = sp.x - touchPoint.x
local dy = sp.y - touchPoint.y
local d = math.sqrt(dx * dx + dy * dy)
if d < bestDist then
bestDist = d
best = i
end
end
end
return best`, [{ Type: 'any', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'touchPoint' }], 0, 'number'),
method('RenderTargetFrames', `local shownTarget = self.TargetIndex
if self.DragTargetIndex ~= nil and self.DragTargetIndex > 0 then
shownTarget = self.DragTargetIndex
end
for i = 1, #self.Monsters do
local m = self.Monsters[i]
local active = false
if m ~= nil and m.alive == true and i == shownTarget then active = true end
self:SetEntityEnabled("/ui/DefaultGroup/CombatHud/MonsterSlot" .. tostring(i) .. "/TargetFrame", active)
end`),
method('OnCardDragBegin', `if self.CombatOver == true or self.FxBusy == true or self.TurnBusy == true then
return
end
@@ -4386,7 +4414,9 @@ for i = 1, 10 do
e.UITransformComponent.anchoredPosition = Vector2(self:GetHandSlotX(i), 0)
end
end
self.DragSlot = slot`, [{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'slot' }]),
self.DragSlot = slot
self.DragTargetIndex = 0
self:RenderTargetFrames()`, [{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'slot' }]),
method('OnCardDrag', `if self.DragSlot ~= slot then
return
end
@@ -4394,6 +4424,16 @@ local e = _EntityService:GetEntityByPath("/ui/DefaultGroup/CardHand/Card" .. tos
if e ~= nil and e.UITransformComponent ~= nil then
local ui = _UILogic:ScreenToUIPosition(touchPoint)
e.UITransformComponent.anchoredPosition = Vector2(ui.x, ui.y + 360)
end
local cardId = self.Hand[slot]
local c = nil
if cardId ~= nil then c = self.Cards[cardId] end
if c ~= nil and c.kind == "Attack" then
local best = self:FindMonsterAtTouch(touchPoint)
if best ~= self.DragTargetIndex then
self.DragTargetIndex = best
self:RenderTargetFrames()
end
end`, [
{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'slot' },
{ Type: 'any', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'touchPoint' },
@@ -4427,27 +4467,18 @@ if c == nil then
return
end
if c.kind == "Attack" then
local best = 0
local bestDist = 200
for i = 1, #self.Monsters do
local m = self.Monsters[i]
if m.alive == true and m.entity ~= nil and isvalid(m.entity) and m.entity.TransformComponent ~= nil then
local wp = m.entity.TransformComponent.WorldPosition
local sp = _UILogic:WorldToScreenPosition(Vector2(wp.x, wp.y + 0.7))
local dx = sp.x - touchPoint.x
local dy = sp.y - touchPoint.y
local d = math.sqrt(dx * dx + dy * dy)
if d < bestDist then
bestDist = d
best = i
end
end
end
local best = self.DragTargetIndex or 0
if best <= 0 then best = self:FindMonsterAtTouch(touchPoint) end
self.DragTargetIndex = 0
if best > 0 then
self.TargetIndex = best
self:PlayCard(slot)
else
self:RenderTargetFrames()
end
else
self.DragTargetIndex = 0
self:RenderTargetFrames()
local ui = _UILogic:ScreenToUIPosition(touchPoint)
if ui.y > -180 then
self:PlayCard(slot)
@@ -4894,7 +4925,9 @@ return table.concat(parts, " ")`, [
end
end
self:SetText(base .. "/Intent", t)
self:SetEntityEnabled(base .. "/TargetFrame", i == self.TargetIndex)
local shownTarget = self.TargetIndex
if self.DragTargetIndex ~= nil and self.DragTargetIndex > 0 then shownTarget = self.DragTargetIndex end
self:SetEntityEnabled(base .. "/TargetFrame", i == shownTarget)
local intentEntity = _EntityService:GetEntityByPath(base .. "/Intent")
if intentEntity ~= nil and intentEntity.TextComponent ~= nil and intent ~= nil then
if intent.kind == "Attack" then