scroll.server/crates/logic/src/battle
WiseDev 7f78fd5104 count the deploy timer down and hold the troop still while it runs
audit findings #8/#11. the encoded deploy field (LogicCharacter field47)
is the REMAINING deploy time: the client seeds it with DeployTime in
setState(5) and LogicCharacter::tick counts it down by 50 each tick,
returning early from the whole tick - no move, no retarget, no attack -
until it reaches 0, then setDefaultState flips the unit to moving(1) or
idle(0). our advance_deploy counted the opposite way (elapsed, 0 up to
DeployTime), so the encoded timer was DeployTime-minus-the-client's every
tick of every deploy, and the troop also moved and fought a full second
early.

now: a summoned troop spawns in state 5 with deploy_timer = DeployTime,
the timer decrements to 0, is_deploying() gates retarget/move/attack
while it is positive, and the state flips to moving/idle when it lands.
towers have DeployTime 0 and are unaffected.

harness: one tick in, the timer has dropped by 50 and the troop has not
moved; after the window it is at 0 and moving.
2026-08-24 09:39:13 +03:00
..
logic_battle.rs walk units around the river instead of through it 2026-08-23 13:23:58 +03:00
logic_battle_event.rs refill the hand, and decode SendBattleEventMessage 2026-08-23 11:47:25 +03:00
logic_character.rs refill the hand, and decode SendBattleEventMessage 2026-08-23 11:47:25 +03:00
logic_component.rs keep the path instead of finding it again every tick 2026-08-23 14:03:26 +03:00
logic_game_mode.rs take the checksum from before the closing checkpoint 2026-08-23 15:04:51 +03:00
logic_game_object.rs simulate movement, targeting and damage on the server 2026-08-23 13:10:30 +03:00
logic_game_object_manager.rs build and send the battle sector state 2026-08-23 10:24:20 +03:00
logic_game_object_ref.rs battle model: LogicBattle, the object manager and BattleResultMessage 2026-08-23 10:00:16 +03:00
logic_pathfinder.rs keep units on the map so the pathfinder cannot panic 2026-08-23 14:23:22 +03:00
logic_simulation.rs count the deploy timer down and hold the troop still while it runs 2026-08-24 09:39:13 +03:00
logic_tilemap.rs walk units around the river instead of through it 2026-08-23 13:23:58 +03:00
logic_time.rs battle model: LogicBattle, the object manager and BattleResultMessage 2026-08-23 10:00:16 +03:00
logic_tutorial_manager.rs battle model: LogicBattle, the object manager and BattleResultMessage 2026-08-23 10:00:16 +03:00
mod.rs count the deploy timer down and hold the troop still while it runs 2026-08-24 09:39:13 +03:00
verify.rs matchmake two players before falling back to a bot 2026-08-23 13:19:38 +03:00