Skip to content

feat(pvp): gladiatorial colosseum tournament, crowd favor, and finishing move engine - #216

Open
angelTomo9 wants to merge 1 commit into
Bitcoindefi:mainfrom
angelTomo9:feat-colosseum-tournaments-1787914864287
Open

feat(pvp): gladiatorial colosseum tournament, crowd favor, and finishing move engine#216
angelTomo9 wants to merge 1 commit into
Bitcoindefi:mainfrom
angelTomo9:feat-colosseum-tournaments-1787914864287

Conversation

@angelTomo9

Copy link
Copy Markdown

Summary

Implements a gladiatorial tournament deathmatch system, arena environmental hazards, crowd favor score meters, and brutal finishing move execution for OpenAO MMORPG.

Features

  • Colosseum tournament tiers (Preliminary Duel, Semifinal Clash, Grand Championship)
  • Dynamic crowd favor meter (0 to 100) boosting damage output up to +25%
  • Lethal finishing move executions on targets under 20% health for double crowd favor
  • Arena environmental hazards (Spike Traps, Fire Jets, Poison Darts)
  • Full unit test coverage under Vitest

Comment on lines +118 to +121
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%." };
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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 👍 / 👎

Comment on lines +86 to +87
// Crowd favor bonus: Up to +25% extra damage at 100 favor
const favorMultiplier = 1 + (attacker.crowdFavorScore / 100) * 0.25;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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 👍 / 👎

@gitar-bot

gitar-bot Bot commented Aug 28, 2026

Copy link
Copy Markdown
Code Review 👍 Approved with suggestions 0 resolved / 2 findings

Implements 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 maxHp without guarding against zero or negative values, causing NaN comparisons; and crowdFavorScore is not clamped to the documented 0–100 range before computing the damage multiplier, allowing it to exceed the intended +25% cap.

💡 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 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, ... }.

💡 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. const favor = Math.min(100, Math.max(0, attacker.crowdFavorScore)).

🤖 Prompt for agents
Code Review: Implements 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 `maxHp` without guarding against zero or negative values, causing NaN comparisons; and `crowdFavorScore` is not clamped to the documented 0–100 range before computing the damage multiplier, allowing it to exceed the intended +25% cap.

1. 💡 Edge Case: Finishing move on maxHp<=0 divides to NaN and succeeds
   Files: 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 `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, ... }`.

2. 💡 Edge Case: crowdFavorScore not clamped, can inflate damage past +25%
   Files: 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. `const favor = Math.min(100, Math.max(0, attacker.crowdFavorScore))`.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant