[PR #7525] [MERGED] Fix experience level reset boundaries in commands #7646

Closed
opened 2026-11-03 07:21:18 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/7525
Author: @TheMrZZ
Created: 11/2/2026
Status: ✅ Merged
Merged: 11/2/2026
Merged by: @ludovic111

Base: main ← Head: fix/experience-level-boundary


📝 Commits (2)

  • 8917e42 Reuse experience level logic for command reset boundaries
  • 418cca2 Merge main into experience level boundary fix

📊 Changes

2 files changed (+26 additions, -4 deletions)

View changed files

📝 crates/horizon-client/src/game/commands.rs (+4 -4)
📝 tools/command_exec_corpus.py (+22 -0)

📄 Description

🤖 Opened by TheMrZZ's AI agent (Codex, gpt-6.1-sol), not by TheMrZZ personally.

What and why

Removing the last experience level now keeps fractional progress and total experience when the result is exactly zero. When the result is negative, level, progress, and total all reset to zero.

The command delegates level additions to the existing give_levels implementation and returns before the outer hook call. This reuses saturated addition and the correct reset boundary while keeping one level-change-hook notification. Point additions and set operations retain their existing paths.

Fixes #7515.

Kind

  • parity: Horizon now does what vanilla 26.3 does

Vanilla reference

Official Java 26.3 Player.giveExperienceLevels: saturated addition followed by a reset of level/progress/total only when the result is below zero. Exact zero preserves progress and total. From level 1 with three points and total 10, adding -1 levels retains scaled XpP=333333, two points at level zero, and total 10. Adding -2 levels clears all three.

Other projects' code

None.

Self-check

Fresh pinned Java 26.3 versus the real Horizon command-execution runner: 44/44 observations match across 1→0, 1→negative, 2→1 and 0→negative. Each case starts with fresh experience state and checks level, points, XpLevel, scaled XpP and XpTotal before and after the change, without advancing ticks.

pr_ready (tools/pr_ready.py --quick on a local runner, against origin/main at 76d1cb530, 3 min 30 s)

Check Result
Scope ✅ 2 files, +26 −4
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 614 passed (41 s)
rustfmt ✅ (6 s)
clippy ✅ (1 min 29 s)
tests: horizon-client ✅ 710 passed (1 min 1 s)
doc tests ✅ 0 passed (1 s)
content root tests ➖ content root untouched
mod API up to date ✅ (11 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 Generated with Codex.


🔄 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/horizon-rust/horizon/pull/7525 **Author:** [@TheMrZZ](https://github.com/TheMrZZ) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/experience-level-boundary` --- ### 📝 Commits (2) - [`8917e42`](https://github.com/horizon-rust/horizon/commit/8917e421a2174a0c75af9d475b47fb1790db58d0) Reuse experience level logic for command reset boundaries - [`418cca2`](https://github.com/horizon-rust/horizon/commit/418cca25b5fafeb7b01e25b728f83adaf6ff295b) Merge main into experience level boundary fix ### 📊 Changes **2 files changed** (+26 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/commands.rs` (+4 -4) 📝 `tools/command_exec_corpus.py` (+22 -0) </details> ### 📄 Description > 🤖 Opened by TheMrZZ's AI agent (Codex, gpt-6.1-sol), not by TheMrZZ personally. ## What and why Removing the last experience level now keeps fractional progress and total experience when the result is exactly zero. When the result is negative, level, progress, and total all reset to zero. The command delegates level additions to the existing `give_levels` implementation and returns before the outer hook call. This reuses saturated addition and the correct reset boundary while keeping one level-change-hook notification. Point additions and set operations retain their existing paths. Fixes #7515. ## Kind - [x] parity: Horizon now does what vanilla 26.3 does ## Vanilla reference Official Java 26.3 `Player.giveExperienceLevels`: saturated addition followed by a reset of level/progress/total only when the result is below zero. Exact zero preserves progress and total. From level 1 with three points and total 10, adding -1 levels retains scaled `XpP=333333`, two points at level zero, and total 10. Adding -2 levels clears all three. ## Other projects' code None. ## Self-check Fresh pinned Java 26.3 versus the real Horizon command-execution runner: **44/44 observations match** across 1→0, 1→negative, 2→1 and 0→negative. Each case starts with fresh experience state and checks level, points, `XpLevel`, scaled `XpP` and `XpTotal` before and after the change, without advancing ticks. **pr_ready** (`tools/pr_ready.py --quick` on a local runner, against origin/main at 76d1cb530, 3 min 30 s) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +26 −4 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 614 passed (41 s) | | rustfmt | ✅ (6 s) | | clippy | ✅ (1 min 29 s) | | tests: horizon-client | ✅ 710 passed (1 min 1 s) | | doc tests | ✅ 0 passed (1 s) | | content root tests | ➖ content root untouched | | mod API up to date | ✅ (11 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 Generated with [Codex](https://openai.com/codex/). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 07:21:18 +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
horizon-rust/horizon#7646
No description provided.