feat(pvp): gladiatorial colosseum tournament, crowd favor, and finishing move engine - #216
Conversation
…nishing move engine
| const hpRatio = defender.currentHp / defender.maxHp; | ||
| if (hpRatio > 0.20) { | ||
| return { success: false, crowdFavorAwarded: 0, reason: "Finishing moves require opponent health to be below 20%." }; | ||
| } |
There was a problem hiding this comment.
💡 Edge Case: Finishing move on maxHp<=0 divides to NaN and succeeds
In executeFinishingMove, hpRatio = defender.currentHp / defender.maxHp. If maxHp is 0 (or negative/undefined), hpRatio becomes NaN, and the guard hpRatio > 0.20 is false, so the finishing move executes regardless of the defender's actual health. Guard against non-positive maxHp explicitly, e.g. if (!(defender.maxHp > 0) || hpRatio > 0.20) return { success: false, ... }.
Was this helpful? React with 👍 / 👎
| // Crowd favor bonus: Up to +25% extra damage at 100 favor | ||
| const favorMultiplier = 1 + (attacker.crowdFavorScore / 100) * 0.25; |
There was a problem hiding this comment.
💡 Edge Case: crowdFavorScore not clamped, can inflate damage past +25%
executeAttack computes favorMultiplier = 1 + (attacker.crowdFavorScore/100)*0.25 with no bounds on the input. The type documents 0–100, but a caller-supplied score above 100 (or below 0) silently exceeds the intended +25% cap (or reduces damage). Clamp the score before use, e.g. const favor = Math.min(100, Math.max(0, attacker.crowdFavorScore)).
Was this helpful? React with 👍 / 👎
Code Review 👍 Approved with suggestions 0 resolved / 2 findingsImplements a gladiatorial tournament system with crowd favor mechanics and finishing moves for the MMORPG arena. Two edge cases should be addressed: the finishing move health check divides by 💡 Edge Case: Finishing move on maxHp<=0 divides to NaN and succeeds📄 api/src/lib/gladiatorialColosseumTournament.ts:118-121 In executeFinishingMove, hpRatio = defender.currentHp / defender.maxHp. If maxHp is 0 (or negative/undefined), hpRatio becomes NaN, and the guard 💡 Edge Case: crowdFavorScore not clamped, can inflate damage past +25%📄 api/src/lib/gladiatorialColosseumTournament.ts:86-87 executeAttack computes favorMultiplier = 1 + (attacker.crowdFavorScore/100)*0.25 with no bounds on the input. The type documents 0–100, but a caller-supplied score above 100 (or below 0) silently exceeds the intended +25% cap (or reduces damage). Clamp the score before use, e.g. 🤖 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 4 days — upgrade now to keep code review, CI analysis, auto-apply, custom automations, and more. Was this helpful? React with 👍 / 👎 | Gitar |
Summary
Implements a gladiatorial tournament deathmatch system, arena environmental hazards, crowd favor score meters, and brutal finishing move execution for OpenAO MMORPG.
Features