Skip to content

Stop getting gold from conquering inactive players 🔧#3020

Merged
ryanbarlow97 merged 8 commits intoopenfrontio:mainfrom
FloPinguin:fix-gold-inactive-players
Feb 4, 2026
Merged

Stop getting gold from conquering inactive players 🔧#3020
ryanbarlow97 merged 8 commits intoopenfrontio:mainfrom
FloPinguin:fix-gold-inactive-players

Conversation

@FloPinguin
Copy link
Contributor

@FloPinguin FloPinguin commented Jan 25, 2026

Description:

Maybe for v29.

In the 5M starting gold modifier games you can conquer a inactive player (spawned but didn't do anything) and get their 5M gold.
Huge unfair advantage.
I think that even without the starting gold modifier you should not get the gold of inactive players because its unfair.

I identify inactive players (spawned but didn't do anything) by checking the attack stats.
I added a translation for the displayMessage "Conquered {name}, received {gold} gold". Why was that not translated?
I added a new message "Conquered {name} (Inactive player, received no gold)".

Please complete the following:

  • I have added screenshots for all UI updates
  • I process any text displayed to the user through translateText() and I've added it to the en.json file
  • I have added relevant tests to the test directory
  • I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced

Please put your Discord username so you can be contacted if a bug or regression is found:

FloPinguin

@FloPinguin FloPinguin added this to the v29 milestone Jan 25, 2026
@FloPinguin FloPinguin requested a review from a team as a code owner January 25, 2026 15:44
@FloPinguin FloPinguin added the Meta Minor balancing adjustment, mostly value changes, minor calculation changes. label Jan 25, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 25, 2026

Walkthrough

Conquest now skips transferring gold when a conquered Human has no recorded attacks sent; active defenders still yield gold and record goldWar. Display events differ: conquered_no_gold for skipped transfers, received_gold_from_conquest when gold is awarded. Tests updated to reflect activation requirements.

Changes

Cohort / File(s) Summary
Localization
resources/lang/en.json
Added events_display.received_gold_from_conquest and events_display.conquered_no_gold translation entries.
Conquest Logic
src/core/game/GameImpl.ts
Import ATTACK_INDEX_SENT; check defender's ATTACK_INDEX_SENT for Human defenders. If zero, skip gold transfer and goldWar stat, emit conquered_no_gold; otherwise compute/transfer gold, emit received_gold_from_conquest with numeric and rendered gold, and record goldWar.
Tests
tests/AttackStats.test.ts
Activate defenders where needed before attacks (schedule AttackExecution) and add a test asserting no war gold is awarded when eliminating an inactive defender.

Sequence Diagram

sequenceDiagram
    participant Conquest as Conquest Handler
    participant Stats as Player Stats Store
    participant Event as Event System
    participant Locale as Localization

    Conquest->>Stats: Query defender ATTACK_INDEX_SENT
    alt Defender active (attacksSent > 0)
        Stats-->>Conquest: attacksSent > 0
        Conquest->>Conquest: Compute gold amount
        Conquest->>Stats: conqueror.addGold(gold) / conquered.removeGold(gold)
        Conquest->>Stats: Record goldWar stat
        Conquest->>Event: Create `received_gold_from_conquest` with {name, gold, rendered}
        Event->>Locale: Request localized message with params
        Locale-->>Event: Return formatted message
    else Defender inactive (attacksSent == 0)
        Stats-->>Conquest: attacksSent == 0
        Conquest->>Event: Create `conquered_no_gold` with {name}
        Event->>Locale: Request localized message with params
        Locale-->>Event: Return formatted message
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

Conquest checks who fought and who slept,
Coins for the brave, none for those unkept,
Two messages mark the ending night,
One for treasure, one for quiet flight,
Tests wake defenders to set things right ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: preventing gold rewards from conquering inactive players, which aligns with the core purpose of the pull request.
Description check ✅ Passed The description is detailed and directly related to the changeset, explaining the motivation, implementation approach, UI/text changes, and confirming tests and translations were added.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 25, 2026
coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 25, 2026
coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 26, 2026
@ryanbarlow97 ryanbarlow97 added the Translation Addition or modification of a language to the translations. label Feb 3, 2026
@ryanbarlow97 ryanbarlow97 modified the milestones: v29, v30 Feb 4, 2026
Copy link
Collaborator

@evanpelle evanpelle left a comment

Choose a reason for hiding this comment

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

thanks!

@github-project-automation github-project-automation bot moved this from Triage to Final Review in OpenFront Release Management Feb 4, 2026
@ryanbarlow97 ryanbarlow97 added this pull request to the merge queue Feb 4, 2026
Merged via the queue into openfrontio:main with commit c266394 Feb 4, 2026
7 checks passed
@github-project-automation github-project-automation bot moved this from Final Review to Complete in OpenFront Release Management Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Meta Minor balancing adjustment, mostly value changes, minor calculation changes. Translation Addition or modification of a language to the translations.

Projects

Status: Complete

Development

Successfully merging this pull request may close these issues.

3 participants