Commit Graph

24 Commits

Author SHA1 Message Date
novgorodschi catalin c55642e3c2 Battle Resolution Fix Report by @Sk4r7z
Battle Resolution Fix Report

The reported issue affected attacks involving more than 2,000 troops. The supplied error log identifies an invalid defender tribe value as the immediate cause of the crash, but does not establish why it occurred with that troop count.

The invalid tribe produced unit names from u-9 to u0, causing undefined array key warnings followed by an invalid SQL query in modifyUnit().

The updated AutomationBattleResolution.php includes:

Tribe validation before combat: Invalid attacker, defender, or reinforcement tribe data leaves the attack pending and logs the issue before evasion or combat changes occur.
Earlier deleted-village handling: The existing troop return logic runs before resolving the deleted village’s owner, tribe, walls, or units.
Defensive casualty checks: Invalid tribes cannot generate negative unit column names. Missing defender unit rows return a zero-loss structure without submitting an empty update.
Reinforcement validation: Invalid player tribe data is no longer automatically treated as Nature. Only reinforcement rows explicitly originating from 0 use tribe 4.
Consistent hero reporting: Reinforcement hero losses use the validated tribe.
Code comments: Changes are documented in the file.

Validation: The complete file passed a PHP 8.3 grammar check using a parser. All 33 original methods were retained; three methods were modified and three validation helpers were added.
2026-09-09 13:37:24 +03:00
novgorodschi catalin 009bba0ce6 Added Chatbox
Added Chatbox
2026-09-08 12:56:02 +03:00
novgorodschi catalin 7e3ffc4c2e Some important fixes!
Some important fixes!
2026-09-04 12:39:23 +03:00
novgorodschi catalin 1bab6640d0 Some hot fixes!!!
Some hot fixes!!!
2026-09-03 13:51:05 +03:00
novgorodschi catalin b572760ee7 Fix natar start time 2026-09-03 08:10:57 +03:00
novgorodschi catalin 71e73dde95 Some additional fixes
Some additional fixes
2026-09-01 07:56:14 +03:00
Ferywir 22477a5571 fix(combat): stop the dead hero being removed twice from the troop count [#379] (#380) 2026-08-25 10:13:24 +03:00
novgorodschi catalin 35f4075734 Fix some atomic exploit
Fix some atomic exploit
2026-08-13 11:51:54 +03:00
Ferywir 91a980fa3d fix(combat): keep the hero casualty when rams force a battle recalculation [#372] (#373)
When rams change the wall level, applyRamDamage() replays the whole battle
through calculateBattle(). That helper WRITES to the hero table, so the replay
applied the hero damage a second time: applyHeroBattleDamage() only looks up
heroes with dead = 0, so the hero who had just died on the first pass was no
longer found, the call returned null and casualties_attacker[11] was never set.

Consequences, all visible in the screenshots of the issue: the report showed the
hero alive and "gained XP" instead of "died", modifyAttack3() never decremented
t11, and returnunitsComplete() added the hero back to units.hero - a hero dead in
the hero table but still displayed in dorf1 and in the rally point. Defender
heroes were also charged their health damage twice.

calculateBattle() now takes an optional $previousHeroOutcome: when the caller
hands over the first pass result, the hero damage is not applied again and the
first verdict (attacker / defender / reinforcement heroes) is carried over.

Also:
- drop the temporary [TravianZ][EROU] error_log() debug traces;
- 37_revive.tpl: only render a revive row for a hero that is actually dead
  (the revive action itself was already gated on dead = 1).

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Catalin Novgorodschi <cata7007@gmail.com>
2026-08-09 20:20:37 +03:00
novgorodschi catalin 4f93cb52a2 Some final fix 2026-08-09 16:14:01 +03:00
novgorodschi catalin a584c68153 Fix Huns Loiality Regeneration & WW cannot be change to capital
Fix Huns Loiality Regeneration & WW cannot be change to capital
2026-08-04 09:40:41 +03:00
novgorodschi catalin 613d800e29 Clear some dead code!
Clear some dead code!
2026-08-03 07:51:50 +03:00
novgorodschi catalin f673341bab fix artefacts 2026-08-02 08:50:50 +03:00
novgorodschi catalin a7b8901dd7 fix 2026-08-01 15:59:20 +03:00
novgorodschi catalin 84e00c41f0 fix
some fix
2026-08-01 15:52:21 +03:00
novgorodschi catalin 523e81df07 Natars start construct ww
natats start construct their ww
2026-08-01 13:25:24 +03:00
novgorodschi catalin 4809626e40 fix 2026-07-28 19:06:44 +03:00
novgorodschi catalin 7642151569 Add Plus Statistics
Add Plus Statistics
2026-07-28 08:48:19 +03:00
novgorodschi catalin a7817f9631 Fix demolish #337
Fix demolish #337
2026-07-24 18:16:53 +03:00
novgorodschi catalin ed1e06b23c Add in ACP T4 Resource Level
Add in ACP T4 Resource Level
2026-07-24 11:13:41 +03:00
novgorodschi catalin 1e19f117ca Last fix for Hero T4 & V11
/*
|--------------------------------------------------------------------------
| FIX List
|--------------------------------------------------------------------------
|
| 1. Hero Attribute Points
|    - When adding attribute points to the hero, the page currently refreshes
|      after every click on the "+" button.
|    - Implement a faster allocation method (AJAX or similar) so multiple
|      points can be assigned without a full page refresh.
|    - The implementation must remain secure and not be exploitable
|      (validate requests server-side, prevent double submissions,
|      verify available points, etc.).
|
| 2. Hero Equipment Restrictions (Original Travian Behavior)
|    - Prevent equipping or unequipping hero items while the hero is:
|        • On an adventure.
|        • Attacking (alone or with troops).
|        • Away as reinforcements.
|
| 3. Oasis Navigation
|    - When opening an oasis (37_land.tpl), the 37_t4nav.tpl navigation
|      disappears.
|    - Include the navigation menu on the oasis page as well.
|
| 4. Auction House Redesign
|    - Redesign 37_auction.tpl to match the Merchant.png mockup.
|    - Keep the existing auction functionality exactly as it is.
|    - Only improve the UI/UX.
|    - You may crop and reuse graphics from Merchant.png.
|    - Add Gold ⇄ Silver exchange functionality.
|
| 5. Hero Item Bonuses (Highest Priority)
|    - Verify that hero equipment bonuses are applied correctly.
|    - Example:
|        • Helmet of the Ruler should reduce Barracks training time by 20%.
|        • Currently, training time remains unchanged whether the helmet
|          is equipped or not.
|    - Also verify:
|        • Stable training speed bonuses.
|        • Boots bonuses.
|        • Any other related hero equipment effects.
|
| 6. Adventures Page Redesign
|    - Redesign 37_adventures.tpl to match the Adventure.png mockup.
|    - Keep the "Expires in" column intact.
|
*/
2026-07-23 15:16:51 +03:00
novgorodschi catalin 8a2d727659 Last Phase before v11 release. New Automation Cleanup
Last Phase before v11 release. New Automation Cleanup
2026-07-23 11:49:27 +03:00
novgorodschi catalin 9a3f26bc93 Some full fixes before final v11 release
Some full fixes before final v11 release
2026-07-23 11:20:01 +03:00
novgorodschi catalin d89ffe4482 Major refactor: Extract Database and Automation into domain-specific trait files
### Core Architecture Refactor

- Split the `Database.php` class into domain-specific traits under `GameEngine/Database/`.
- Split the `Automation` class into domain-specific traits under `GameEngine/Automation/`.
- Grouped methods by functional domain for improved maintainability and navigation.
- Preserved 100% backward compatibility.
- No logic or behavioral changes.
- Pure structural refactor.
2026-07-17 11:03:27 +03:00