mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-06-28 00:24:23 +00:00
509a4d4137
Extract the per-branch defender target resolution and battle-environment setup into two private helpers: resolveVillageTarget() and resolveOasisTarget(). Each returns the target owner (tribe/alliance), map info, conquest flag and the battle parameters (wall, armory/blacksmith tech, residence, siege masonry); the village helper also returns the evasion inputs. Both are read-only (no DB writes). The foreach body keeps handleEvasion(), buildDefenderUnits() and buildAttackerUnits() as explicit, ordered calls, so the village and oasis branches are now symmetric orchestration. Behaviour-preserving. The building/tech reads now run inside the helper before handleEvasion(); they read buildings and technology only (never the troops handleEvasion() may move), so the result is unchanged. A few dead locals are dropped (playerunit, wallgid, w; the redundant DefenderUnit/def_ab re-inits). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>