[PR #6306] [MERGED] feat(game): integrate combat difficulty and weather into enemy AI #7129

Closed
opened 2026-10-23 04:16:47 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/6306
Author: @kolacheee
Created: 9/17/2026
Status: ✅ Merged
Merged: 9/18/2026
Merged by: @kolacheee

Base: staging ← Head: codex/combat-difficulty-weather


📝 Commits (4)

  • c5bd459 docs(game): record difficulty and weather implementation scope
  • c95c14d feat(game): integrate combat difficulty and saved weather
  • d0e83aa fix(game): preserve combat weather and route AI by movement cost
  • 6c60564 fix(game): honor restored weather and round effect modifiers

📊 Changes

46 files changed (+1204 additions, -256 deletions)

View changed files

📝 CHANGELOG.md (+5 -0)
📝 docs/development/game-combat-ai-design.md (+6 -2)
➕ docs/development/game-combat-difficulty-weather.md (+47 -0)
📝 docs/development/game-combat-roadmap.md (+1 -1)
📝 docs/development/game-combat-rulesets-implementation.md (+4 -0)
📝 e2e/game-combat-director.e2e.ts (+37 -2)
📝 e2e/game-experience-setup.e2e.ts (+11 -19)
📝 e2e/game-hybrid-terrain.e2e.ts (+18 -4)
📝 e2e/game-terrain-restore.e2e.ts (+2 -2)
➕ packages/client/src/components/game/CombatWeatherSummary.tsx (+40 -0)
📝 packages/client/src/components/game/DirectedCombatUI.tsx (+2 -0)
📝 packages/client/src/components/game/GameSetupWizard.tsx (+17 -74)
📝 packages/client/src/components/game/GameSurface.tsx (+9 -2)
📝 packages/client/src/components/game/TacticalCombatUI.tsx (+12 -0)
📝 packages/client/src/hooks/use-game.ts (+2 -0)
📝 packages/client/src/lib/game-setup-share.ts (+2 -8)
📝 packages/client/src/lib/game-tag-parser.ts (+7 -0)
📝 packages/client/src/localization/locales/en.json (+27 -1)
📝 packages/server/src/routes/combat-director.routes.ts (+27 -1)
📝 packages/server/src/routes/encounter.routes.ts (+13 -7)

...and 26 more files

📄 Description

Linked issue

Closes #6305

Why this change

Difficulty labels saved by setup could silently fall back to Normal, Classic scaled party damage too, and the combat AI did not directly use difficulty. Campaign battlefield seeds could repeat maps, while campaign weather had no combat mechanics.

What changed

  • Normalize difficulty across setup, combat, encounters and loot. Retain enemy-only 0.6/1/1.3/1.6 damage multipliers, explicitly reserved for Traditional/current legacy mechanics. The ruleset handoff requires 5e, V20 and other adapters to define their own difficulty policy.
  • Tune enemy decision consistency without changing personality, proficiency, legal actions or companion competence. Reactions weigh threat and resource costs; GM bosses receive difficulty and accepted weather.
  • Save combat weather/exposure. Exposed rain modifies fire/lightning damage; wind and visibility affect explicitly tagged attacks; Tactical snow raises walking costs. Forecasts, resolution and AI share these rules. Unknown/sheltered exposure and old saves without weather remain neutral.
  • Remove the Battlefield Seed setup control and “current style” copy. Preserve Battlefield Size, internal encounter seeds, accepted maps and restart conditions. Keep conditions readable with cosmetic weather disabled.
  • Fix combat-entry weather timing and make pursuit use actual terrain/weather movement costs. Random-map reaction fixtures establish clear line of sight before testing Counterspell.

Validation

Completed locally:

  • pnpm install, pnpm check (including localization, types, lint and production builds), and pnpm version:check.
  • All 295 Node regression files passed across the full run and isolated reruns. Five initial failures came from overlapping the suite with a shared build, which briefly removed generated files; all five passed after the build. Combat regressions passed again after review fixes.
  • 36 relevant browser cases across setup, combat director, terrain and restore fixtures passed on desktop/light and mobile/dark Chromium after retiring old fixed-seed assertions. The corrected reaction fixture then passed 12 repeated runs across fresh maps. Screenshots were inspected for both modes and themes, including weather animations disabled.
  • Two full local CodeRabbit reviews plus a focused review of the fixes. Final focused review: zero findings. Valid findings and dismissals are recorded below.

Local mobile WebKit could not launch because this host lacks libicu74, libjpeg-turbo8, libmanette-0.2-0, and gstreamer1.0-libav; its test assertions did not run. Real-provider boss quality and extended balance remain playtest items. Docker was not exercised for this combat-only change.

  • Manually verify Classic and Tactical weather effects in a campaign, with weather animations both on and off.
  • Manually verify party controls and cost-aware reactions on desktop and mobile, in light and dark themes.
  • Manually verify imported setups, restored fights and restart behavior.
  • Playtest difficulty balance and real-provider boss decisions over several encounters.
  • Verify mobile WebKit behavior in CI or a host with its required libraries.

Docs and release impact

Changelog and four combat handoffs updated. Translation follow-up #6300 remains unassigned. No version bump, new tabletop ruleset, or Summoning runtime is included.

Review dispositions

  • Duplicate validation/tuning paragraph: dismissed. The paragraph occurs once in game-combat-difficulty-weather.md.
  • Missing forecastFrom export: dismissed. engine.ts already exports it in its final export block; the public alias compiles and is exercised by combat regressions.
  • Combat-entry weather guard and weighted pursuit: fixed, with regression coverage.

Summary by CodeRabbit

  • New Features

    • Added combat weather effects, including visibility, wind, rain, storms, snow, exposure, movement, accuracy, and damage modifiers.
    • Weather conditions now appear in combat and persist through reloads, restarts, and checkpoint restoration.
    • Enemy AI now adapts to selected difficulty and battlefield weather.
    • Added support for projectile and sight-dependent attacks.
  • Changes

    • Battlefield Size remains available in Tactical setup; campaign seed and terrain guidance controls are no longer included.
    • Difficulty values are normalized consistently across gameplay systems.
  • Documentation

    • Updated combat design, ruleset, roadmap, and implementation documentation.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/6306 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 9/17/2026 **Status:** ✅ Merged **Merged:** 9/18/2026 **Merged by:** [@kolacheee](https://github.com/kolacheee) **Base:** `staging` ← **Head:** `codex/combat-difficulty-weather` --- ### 📝 Commits (4) - [`c5bd459`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c5bd459f8d21aad72c110a7e471ba4774bd712f6) docs(game): record difficulty and weather implementation scope - [`c95c14d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c95c14d680d3ea636577dafa57629c4f6201afe7) feat(game): integrate combat difficulty and saved weather - [`d0e83aa`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d0e83aafce559303f605ca81f846536c54c75d1b) fix(game): preserve combat weather and route AI by movement cost - [`6c60564`](https://github.com/Pasta-Devs/Marinara-Engine/commit/6c605640c582e6b79287f227f2e0530b0be9aabc) fix(game): honor restored weather and round effect modifiers ### 📊 Changes **46 files changed** (+1204 additions, -256 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+5 -0) 📝 `docs/development/game-combat-ai-design.md` (+6 -2) ➕ `docs/development/game-combat-difficulty-weather.md` (+47 -0) 📝 `docs/development/game-combat-roadmap.md` (+1 -1) 📝 `docs/development/game-combat-rulesets-implementation.md` (+4 -0) 📝 `e2e/game-combat-director.e2e.ts` (+37 -2) 📝 `e2e/game-experience-setup.e2e.ts` (+11 -19) 📝 `e2e/game-hybrid-terrain.e2e.ts` (+18 -4) 📝 `e2e/game-terrain-restore.e2e.ts` (+2 -2) ➕ `packages/client/src/components/game/CombatWeatherSummary.tsx` (+40 -0) 📝 `packages/client/src/components/game/DirectedCombatUI.tsx` (+2 -0) 📝 `packages/client/src/components/game/GameSetupWizard.tsx` (+17 -74) 📝 `packages/client/src/components/game/GameSurface.tsx` (+9 -2) 📝 `packages/client/src/components/game/TacticalCombatUI.tsx` (+12 -0) 📝 `packages/client/src/hooks/use-game.ts` (+2 -0) 📝 `packages/client/src/lib/game-setup-share.ts` (+2 -8) 📝 `packages/client/src/lib/game-tag-parser.ts` (+7 -0) 📝 `packages/client/src/localization/locales/en.json` (+27 -1) 📝 `packages/server/src/routes/combat-director.routes.ts` (+27 -1) 📝 `packages/server/src/routes/encounter.routes.ts` (+13 -7) _...and 26 more files_ </details> ### 📄 Description ## Linked issue Closes #6305 ## Why this change Difficulty labels saved by setup could silently fall back to Normal, Classic scaled party damage too, and the combat AI did not directly use difficulty. Campaign battlefield seeds could repeat maps, while campaign weather had no combat mechanics. ## What changed - Normalize difficulty across setup, combat, encounters and loot. Retain enemy-only 0.6/1/1.3/1.6 damage multipliers, explicitly reserved for Traditional/current legacy mechanics. The ruleset handoff requires 5e, V20 and other adapters to define their own difficulty policy. - Tune enemy decision consistency without changing personality, proficiency, legal actions or companion competence. Reactions weigh threat and resource costs; GM bosses receive difficulty and accepted weather. - Save combat weather/exposure. Exposed rain modifies fire/lightning damage; wind and visibility affect explicitly tagged attacks; Tactical snow raises walking costs. Forecasts, resolution and AI share these rules. Unknown/sheltered exposure and old saves without weather remain neutral. - Remove the Battlefield Seed setup control and “current style” copy. Preserve Battlefield Size, internal encounter seeds, accepted maps and restart conditions. Keep conditions readable with cosmetic weather disabled. - Fix combat-entry weather timing and make pursuit use actual terrain/weather movement costs. Random-map reaction fixtures establish clear line of sight before testing Counterspell. ## Validation Completed locally: - `pnpm install`, `pnpm check` (including localization, types, lint and production builds), and `pnpm version:check`. - All 295 Node regression files passed across the full run and isolated reruns. Five initial failures came from overlapping the suite with a shared build, which briefly removed generated files; all five passed after the build. Combat regressions passed again after review fixes. - 36 relevant browser cases across setup, combat director, terrain and restore fixtures passed on desktop/light and mobile/dark Chromium after retiring old fixed-seed assertions. The corrected reaction fixture then passed 12 repeated runs across fresh maps. Screenshots were inspected for both modes and themes, including weather animations disabled. - Two full local CodeRabbit reviews plus a focused review of the fixes. Final focused review: zero findings. Valid findings and dismissals are recorded below. Local mobile WebKit could not launch because this host lacks `libicu74`, `libjpeg-turbo8`, `libmanette-0.2-0`, and `gstreamer1.0-libav`; its test assertions did not run. Real-provider boss quality and extended balance remain playtest items. Docker was not exercised for this combat-only change. - [ ] Manually verify Classic and Tactical weather effects in a campaign, with weather animations both on and off. - [ ] Manually verify party controls and cost-aware reactions on desktop and mobile, in light and dark themes. - [ ] Manually verify imported setups, restored fights and restart behavior. - [ ] Playtest difficulty balance and real-provider boss decisions over several encounters. - [ ] Verify mobile WebKit behavior in CI or a host with its required libraries. ## Docs and release impact Changelog and four combat handoffs updated. Translation follow-up #6300 remains unassigned. No version bump, new tabletop ruleset, or Summoning runtime is included. ## Review dispositions - Duplicate validation/tuning paragraph: dismissed. The paragraph occurs once in `game-combat-difficulty-weather.md`. - Missing `forecastFrom` export: dismissed. `engine.ts` already exports it in its final export block; the public alias compiles and is exercised by combat regressions. - Combat-entry weather guard and weighted pursuit: fixed, with regression coverage. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added combat weather effects, including visibility, wind, rain, storms, snow, exposure, movement, accuracy, and damage modifiers. * Weather conditions now appear in combat and persist through reloads, restarts, and checkpoint restoration. * Enemy AI now adapts to selected difficulty and battlefield weather. * Added support for projectile and sight-dependent attacks. * **Changes** * Battlefield Size remains available in Tactical setup; campaign seed and terrain guidance controls are no longer included. * Difficulty values are normalized consistently across gameplay systems. * **Documentation** * Updated combat design, ruleset, roadmap, and implementation documentation. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:16:47 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#7129
No description provided.