From 252277ec8d2efb095220c86c942af189aa62a1bd Mon Sep 17 00:00:00 2001 From: WiseDev <83840010+wisedevik@users.noreply.github.com> Date: Sun, 23 Aug 2026 15:02:27 +0300 Subject: [PATCH] take one id per summoned character, not one per play the spawn log caught it at once: two archers took 11 and 12, and the goblins that followed started again at 12, then the knight landed on 13. the counter moved by one per card while a card can summon several. two objects sharing a global id are one object to the client - getGameObjectIndex finds the first and reuses it - so the duplicates never became objects, never got models, and left the client and the server holding different sets, which no checksum can survive. --- crates/game-service/src/battle_session.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/crates/game-service/src/battle_session.rs b/crates/game-service/src/battle_session.rs index 7ec52a3..17c74c9 100644 --- a/crates/game-service/src/battle_session.rs +++ b/crates/game-service/src/battle_session.rs @@ -325,10 +325,11 @@ impl BattleSession { .position(|id| *id == account) .map(|index| index as i32) } - pub fn next_instance(&mut self) -> i32 { - let instance = self.next_instance; - self.next_instance += 1; - instance + pub fn next_instance(&self) -> i32 { + self.next_instance + } + pub fn reserve_instances(&mut self, count: usize) { + self.next_instance += count.max(1) as i32; } pub fn deck_card(&self, owner: i32, slot: i32) -> Option { let deck = self.mode.battle.decks.get(owner.max(0) as usize)?.as_ref()?; @@ -379,6 +380,7 @@ impl BattleRegistry { session.advance_to_now(); if let Some((card, position, instance)) = session.take_bot_play() { let entries = summon(&card, position, crate::bot::BOT_OWNER_INDEX, instance); + session.reserve_instances(entries.len()); if !entries.is_empty() { tracing::debug!(card = %card, count = entries.len(), "the bot played a card"); for entry in entries { @@ -457,6 +459,7 @@ impl BattleRegistry { let cost = card.data().map(|row| row.int("ManaCost")).unwrap_or(0); session.spend_mana(owner, cost); let entries = summon(&card, position, owner, session.next_instance()); + session.reserve_instances(entries.len()); let spawned = entries.len(); session.queue(at_tick, entries); spawned