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

@@ -148,7 +148,7 @@
"Name": null "Name": null
}, },
"Arguments": [], "Arguments": [],
"Code": "self:SetEntityEnabled(\"/ui/DefaultGroup/MainMenu\", false)\nself:SetEntityEnabled(\"/ui/DefaultGroup/CardHand\", true)\nself:SetEntityEnabled(\"/ui/DefaultGroup/DeckHud\", true)\nself:StartCombat()", "Code": "self:SetEntityEnabled(\"/ui/DefaultGroup/MainMenu\", false)\nself:SetEntityEnabled(\"/ui/DefaultGroup/CardHand\", true)\nself:SetEntityEnabled(\"/ui/DefaultGroup/DeckHud\", true)\nself:ConfigureTurnBasedMonsters()\nself:StartCombat()",
"Scope": 2, "Scope": 2,
"ExecSpace": 6, "ExecSpace": 6,
"Attributes": [], "Attributes": [],
@@ -169,6 +169,44 @@
"Attributes": [], "Attributes": [],
"Name": "StartCombat" "Name": "StartCombat"
}, },
{
"Return": {
"Type": "void",
"DefaultValue": null,
"SyncDirection": 0,
"Attributes": [],
"Name": null
},
"Arguments": [],
"Code": "for mapIndex = 1, 11 do\n\tlocal mapName = \"map\" .. string.format(\"%02d\", mapIndex)\n\tfor i = 1, 6 do\n\t\tself:ConfigureMonsterForTurnCombat(_EntityService:GetEntityByPath(\"/maps/\" .. mapName .. \"/Monster\" .. tostring(i)))\n\tend\n\tself:ConfigureMonsterForTurnCombat(_EntityService:GetEntityByPath(\"/maps/\" .. mapName .. \"/StaticMonsterTemplate\"))\n\tself:ConfigureMonsterForTurnCombat(_EntityService:GetEntityByPath(\"/maps/\" .. mapName .. \"/MoveMonsterTemplate\"))\n\tself:ConfigureMonsterForTurnCombat(_EntityService:GetEntityByPath(\"/maps/\" .. mapName .. \"/ChaseMonsterTemplate\"))\n\tself:ConfigureMonsterForTurnCombat(_EntityService:GetEntityByPath(\"/maps/\" .. mapName .. \"/monster-43\"))\nend",
"Scope": 2,
"ExecSpace": 6,
"Attributes": [],
"Name": "ConfigureTurnBasedMonsters"
},
{
"Return": {
"Type": "void",
"DefaultValue": null,
"SyncDirection": 0,
"Attributes": [],
"Name": null
},
"Arguments": [
{
"Type": "Entity",
"DefaultValue": null,
"SyncDirection": 0,
"Attributes": [],
"Name": "monster"
}
],
"Code": "if monster == nil then\n\treturn\nend\nif monster.AIWanderComponent ~= nil then\n\tmonster.AIWanderComponent.Enable = false\nend\nif monster.AIChaseComponent ~= nil then\n\tmonster.AIChaseComponent.Enable = false\nend\nif monster.MovementComponent ~= nil then\n\tmonster.MovementComponent.Enable = false\nend\nif monster.RigidbodyComponent ~= nil then\n\tmonster.RigidbodyComponent.MoveVelocity = Vector2.zero\n\tmonster.RigidbodyComponent.RealMoveVelocity = Vector2.zero\nend\nif monster.TransformComponent ~= nil then\n\tlocal scale = monster.TransformComponent.Scale\n\tmonster.TransformComponent.Scale = Vector3(-math.abs(scale.x), math.abs(scale.y), scale.z)\nend\nif monster.StateComponent ~= nil then\n\tmonster.StateComponent:ChangeState(\"IDLE\")\nend",
"Scope": 2,
"ExecSpace": 6,
"Attributes": [],
"Name": "ConfigureMonsterForTurnCombat"
},
{ {
"Return": { "Return": {
"Type": "void", "Type": "void",

View File

@@ -467,6 +467,7 @@ self.NewGameHandler = buttonEntity:ConnectEvent(ButtonClickEvent, self.StartNewG
method('StartNewGame', `self:SetEntityEnabled("/ui/DefaultGroup/MainMenu", false) method('StartNewGame', `self:SetEntityEnabled("/ui/DefaultGroup/MainMenu", false)
self:SetEntityEnabled("/ui/DefaultGroup/CardHand", true) self:SetEntityEnabled("/ui/DefaultGroup/CardHand", true)
self:SetEntityEnabled("/ui/DefaultGroup/DeckHud", true) self:SetEntityEnabled("/ui/DefaultGroup/DeckHud", true)
self:ConfigureTurnBasedMonsters()
self:StartCombat()`), self:StartCombat()`),
method('StartCombat', `self.MaxEnergy = 3 method('StartCombat', `self.MaxEnergy = 3
self.Turn = 0 self.Turn = 0
@@ -476,6 +477,39 @@ self.DrawPile = { "Strike", "Strike", "Strike", "Strike", "Strike", "Defend", "D
self:Shuffle(self.DrawPile) self:Shuffle(self.DrawPile)
self:BindButtons() self:BindButtons()
self:StartPlayerTurn()`), 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 method('Shuffle', `if list == nil then
\treturn \treturn
end end