Freeze monsters for turn combat

This commit is contained in:
maple
2026-06-07 23:39:58 +09:00
parent 8eab9a75ac
commit a9926feea3
2 changed files with 73 additions and 1 deletions

View File

@@ -467,6 +467,7 @@ self.NewGameHandler = buttonEntity:ConnectEvent(ButtonClickEvent, self.StartNewG
method('StartNewGame', `self:SetEntityEnabled("/ui/DefaultGroup/MainMenu", false)
self:SetEntityEnabled("/ui/DefaultGroup/CardHand", true)
self:SetEntityEnabled("/ui/DefaultGroup/DeckHud", true)
self:ConfigureTurnBasedMonsters()
self:StartCombat()`),
method('StartCombat', `self.MaxEnergy = 3
self.Turn = 0
@@ -476,6 +477,39 @@ self.DrawPile = { "Strike", "Strike", "Strike", "Strike", "Strike", "Defend", "D
self:Shuffle(self.DrawPile)
self:BindButtons()
self:StartPlayerTurn()`),
method('ConfigureTurnBasedMonsters', `for mapIndex = 1, 11 do
\tlocal mapName = "map" .. string.format("%02d", mapIndex)
\tfor i = 1, 6 do
\t\tself:ConfigureMonsterForTurnCombat(_EntityService:GetEntityByPath("/maps/" .. mapName .. "/Monster" .. tostring(i)))
\tend
\tself:ConfigureMonsterForTurnCombat(_EntityService:GetEntityByPath("/maps/" .. mapName .. "/StaticMonsterTemplate"))
\tself:ConfigureMonsterForTurnCombat(_EntityService:GetEntityByPath("/maps/" .. mapName .. "/MoveMonsterTemplate"))
\tself:ConfigureMonsterForTurnCombat(_EntityService:GetEntityByPath("/maps/" .. mapName .. "/ChaseMonsterTemplate"))
\tself:ConfigureMonsterForTurnCombat(_EntityService:GetEntityByPath("/maps/" .. mapName .. "/monster-43"))
end`),
method('ConfigureMonsterForTurnCombat', `if monster == nil then
\treturn
end
if monster.AIWanderComponent ~= nil then
\tmonster.AIWanderComponent.Enable = false
end
if monster.AIChaseComponent ~= nil then
\tmonster.AIChaseComponent.Enable = false
end
if monster.MovementComponent ~= nil then
\tmonster.MovementComponent.Enable = false
end
if monster.RigidbodyComponent ~= nil then
\tmonster.RigidbodyComponent.MoveVelocity = Vector2.zero
\tmonster.RigidbodyComponent.RealMoveVelocity = Vector2.zero
end
if monster.TransformComponent ~= nil then
\tlocal scale = monster.TransformComponent.Scale
\tmonster.TransformComponent.Scale = Vector3(-math.abs(scale.x), math.abs(scale.y), scale.z)
end
if monster.StateComponent ~= nil then
\tmonster.StateComponent:ChangeState("IDLE")
end`, [{ Type: 'Entity', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'monster' }]),
method('Shuffle', `if list == nil then
\treturn
end