From cd8d2768e0c848be5ab19dc8e2f5b75889eb40bb Mon Sep 17 00:00:00 2001 From: PeaAshMeter Date: Wed, 12 Nov 2025 02:55:49 +0300 Subject: [PATCH] fix drawing spell preview after the end of a turn --- lib/character/behaviors/spellcaster.lua | 4 ++++ lib/level/turn_order.lua | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/character/behaviors/spellcaster.lua b/lib/character/behaviors/spellcaster.lua index c6cd9af..37c128b 100644 --- a/lib/character/behaviors/spellcaster.lua +++ b/lib/character/behaviors/spellcaster.lua @@ -24,6 +24,10 @@ function behavior:endCast() end function behavior:update(dt) + if Tree.level.selector:deselected() then + self.state = "idle" + self.cast = nil + end if self.cast and self.state == "casting" then self.cast:update(self.owner, dt) end end diff --git a/lib/level/turn_order.lua b/lib/level/turn_order.lua index 6ea46ba..f47db4b 100644 --- a/lib/level/turn_order.lua +++ b/lib/level/turn_order.lua @@ -30,7 +30,7 @@ end --- --- Если в очереди на ход больше никого нет, заканчиваем раунд function turnOrder:next() - Tree.level.selector.id = nil + Tree.level.selector:select(nil) self.actedQueue:insert(self.current) local next = self.pendingQueue:peek() if not next then return self:endRound() end