feat(quests): overland trade caravan escort and dynamic ambush engine - #194
feat(quests): overland trade caravan escort and dynamic ambush engine#194angelTomo9 wants to merge 2 commits into
Conversation
…on 0 HP, and scale payout
| it("applies ambush damage to cart and scales down final reward payout", () => { | ||
| const mission = CaravanEscortTradeEngine.startMission("player_1", mockManifest, mockWaypoints, 500); | ||
|
|
||
| // WP 1 with ambush triggered (rng = 0.01) -> takes 150 damage (500 -> 350 HP) | ||
| const tick1 = CaravanEscortTradeEngine.advanceWaypoint(mission, { x: 10, y: 10 }, () => 0.01); | ||
| expect(tick1.isAmbushTriggered).toBe(true); | ||
| expect(tick1.cartRemainingHp).toBe(350); | ||
| expect(mission.cartCurrentHp).toBe(350); | ||
|
|
||
| // WP 2 destination without ambush (350 / 500 = 70% health ratio -> 1400 gold payout) | ||
| const tick2 = CaravanEscortTradeEngine.advanceWaypoint(mission, { x: 20, y: 20 }, () => 0.99); | ||
| expect(tick2.isCompleted).toBe(true); | ||
| expect(tick2.rewardGoldAwarded).toBe(1400); // 2000 * 70% | ||
| }); | ||
|
|
There was a problem hiding this comment.
💡 Quality: Deleted tests drop coverage for radius and ambush probability
This commit removed the two existing tests "calculates ambush probability scaled by cargo value" and "pauses progression when player is beyond escort protection radius", replacing them with damage/failure tests. As a result calculateAmbushProbability and the escort-radius enforcement branch (advanceWaypoint's dist > ESCORT_PROTECTION_RADIUS path) are no longer exercised, even though the PR summary lists both as key features. Re-add coverage for the probability scaling/clamping and the radius-exceeded case alongside the new ambush tests.
Was this helpful? React with 👍 / 👎
Code Review 👍 Approved with suggestions 1 resolved / 2 findingsImplements an overland trade caravan escort and dynamic ambush engine with updated damage and mission failure logic. Re-add coverage for the probability scaling/clamping and the radius-exceeded case as deleted tests dropped coverage for radius and ambush probability. 💡 Quality: Deleted tests drop coverage for radius and ambush probability📄 api/src/tests/caravanEscortTrade.test.ts:17-31 This commit removed the two existing tests "calculates ambush probability scaled by cargo value" and "pauses progression when player is beyond escort protection radius", replacing them with damage/failure tests. As a result ✅ 1 resolved✅ Bug: Ambush trigger has no effect; cart HP and failure unused
🤖 Prompt for agentsOptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change the behavior for this request:
Important Your trial ends in 5 days — upgrade now to keep code review, CI analysis, auto-apply, custom automations, and more. Was this helpful? React with 👍 / 👎 | Gitar |
Summary
Implements an overland trade caravan escort and dynamic bandit ambush mission engine for OpenAO MMORPG.
Features