feat(act-maps): 막별 맵 전환 + 맵별 인카운터 (배포 퀄리티 P4) #37

Merged
gahusb merged 4 commits from feature/p4-act-maps into main 2026-06-11 08:53:22 +09:00
3 changed files with 29 additions and 4 deletions
Showing only changes of commit 32a0b2437b - Show all commits

View File

@@ -61,7 +61,7 @@
"Name": null
},
"Arguments": [],
"Code": "self.RegTries = 0\nlocal eventId = 0\nlocal function reg()\n\tself.RegTries = self.RegTries + 1\n\tlocal c = _EntityService:GetEntityByPath(\"/common\")\n\tif c ~= nil and c.SlayDeckController ~= nil then\n\t\tc.SlayDeckController:RegisterMonster(self.Entity, self.EnemyId, self.Group)\n\t\t_TimerService:ClearTimer(eventId)\n\telseif self.RegTries > 50 then\n\t\t_TimerService:ClearTimer(eventId)\n\tend\nend\neventId = _TimerService:SetTimerRepeat(reg, 0.1)",
"Code": "self.RegTries = 0\nlocal eventId = 0\nlocal function reg()\n\tself.RegTries = self.RegTries + 1\n\tlocal c = _EntityService:GetEntityByPath(\"/common\")\n\tif c ~= nil and c.SlayDeckController ~= nil then\n\t\tlocal mapName = \"\"\n\t\tif self.Entity.CurrentMapName ~= nil then\n\t\t\tmapName = self.Entity.CurrentMapName\n\t\tend\n\t\tc.SlayDeckController:RegisterMonster(self.Entity, self.EnemyId, self.Group, mapName)\n\t\t_TimerService:ClearTimer(eventId)\n\telseif self.RegTries > 50 then\n\t\t_TimerService:ClearTimer(eventId)\n\tend\nend\neventId = _TimerService:SetTimerRepeat(reg, 0.1)",
"Scope": 2,
"ExecSpace": 6,
"Attributes": [],

View File

@@ -1838,6 +1838,7 @@ function writeCodeblocks() {
const REST_HEAL = 30;
const RELIC_PRICE = 60;
const ACT_COUNT = 3;
const ACT_MAPS = ['map01', 'map02', 'map03'];
const combat = codeblock('SlayDeckController', 'SlayDeckController', [
prop('any', 'DrawPile'),
prop('any', 'DiscardPile'),
@@ -2019,15 +2020,21 @@ self:RenderCombat()`),
end
local g = group
if g == nil or g == "" then g = "combat" end
table.insert(self.Registered, { entity = monster, enemyId = enemyId, group = g })`, [
local mp = mapName
if mp == nil then mp = "" end
table.insert(self.Registered, { entity = monster, enemyId = enemyId, group = g, map = mp })`, [
{ Type: 'any', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'monster' },
{ Type: 'string', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'enemyId' },
{ Type: 'string', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'group' },
{ Type: 'string', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'mapName' },
]),
method('BuildMonsters', `self.Monsters = {}
local g = "combat"
local node = self.MapNodes[self.CurrentNodeId]
if node ~= nil and node.type ~= nil then g = node.type end
local pmap = ""
local lp = _UserService.LocalPlayer
if lp ~= nil and lp.CurrentMapName ~= nil then pmap = lp.CurrentMapName end
local reg = self.Registered or {}
for i = 1, #reg do
if reg[i].entity ~= nil and isvalid(reg[i].entity) then
@@ -2037,7 +2044,7 @@ end
local list = {}
for i = 1, #reg do
local r = reg[i]
if r.entity ~= nil and isvalid(r.entity) and r.group == g then
if r.entity ~= nil and isvalid(r.entity) and r.group == g and (r.map == nil or r.map == "" or pmap == "" or r.map == pmap) then
local x = 0
if r.entity.TransformComponent ~= nil then
x = r.entity.TransformComponent.WorldPosition.x
@@ -2642,6 +2649,7 @@ if anyAlive == false then
self.CurrentNodeId = ""
self.CurrentEnemyId = ""
self:RenderRun()
self:TeleportToActMap()
self:ShowMap()
else
self:ShowResult("런 클리어!")
@@ -2655,6 +2663,19 @@ elseif self.PlayerHp <= 0 then
self:ShowResult("패배...")
self.RunActive = false
end`),
method('TeleportToActMap', `local maps = { ${ACT_MAPS.map((m) => `"${m}"`).join(', ')} }
local target = maps[self.Floor]
if target == nil then
return
end
local lp = _UserService.LocalPlayer
if lp == nil then
return
end
if lp.CurrentMapName == target then
return
end
_TeleportService:TeleportToMapPosition(lp, Vector3(-6, 0.03, 0), target)`),
method('ShowResult', `self:SetText("/ui/DefaultGroup/CombatHud/Result", text)
local entity = _EntityService:GetEntityByPath("/ui/DefaultGroup/CombatHud/Result")
if entity ~= nil then

View File

@@ -31,7 +31,11 @@ local function reg()
self.RegTries = self.RegTries + 1
local c = _EntityService:GetEntityByPath("/common")
if c ~= nil and c.SlayDeckController ~= nil then
c.SlayDeckController:RegisterMonster(self.Entity, self.EnemyId, self.Group)
local mapName = ""
if self.Entity.CurrentMapName ~= nil then
mapName = self.Entity.CurrentMapName
end
c.SlayDeckController:RegisterMonster(self.Entity, self.EnemyId, self.Group, mapName)
_TimerService:ClearTimer(eventId)
elseif self.RegTries > 50 then
_TimerService:ClearTimer(eventId)