Repository navigation
fix(castle-siege): prevent teleporting over a closed gate - #1350
icheat2win wants to merge 5 commits into
Conversation
Adds the IPlayerTeleportRestrictionPlugIn point, which the Teleport and Teleport Ally skills ask before moving a player. The Castle Siege plugin uses it to stop teleports whose line crosses a closed gate, and the old todo in WizardTeleportAction is removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011xNc764bgrPZRQYCRzPj1x
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011xNc764bgrPZRQYCRzPj1x
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 36 |
| Duplication | 7 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
sven-n
left a comment
There was a problem hiding this comment.
Changes requested: src/GameLogic/CastleSiege/CastleSiegeNpcController.cs:225-246 rounds one tile per step with Math.Round, which is not a supercover line traversal. Reversing a segment can sample different tiles, allowing a teleport across a closed gate in one direction but not the other. For example, with gate tiles X=90–95, Y=100–101, (85,99)->(91,102) samples (90,101), while the reverse can miss the blocked tiles. Please use supercover traversal or exact segment/tile intersection and add reverse-direction and corner-crossing tests. An action-level test for Teleport and Teleport Ally would also help.
…teleport-over-gates # Conflicts: # docs-website/docs/server-features/castle-siege.md # src/GameLogic/CastleSiege/CastleSiegePlugIn.cs
Walk the line between the tile centers as a supercover, so the result is the same in both directions and a corner touch of a closed gate tile also blocks. Add reverse-direction, corner and action-level tests for Teleport and Teleport Ally. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011xNc764bgrPZRQYCRzPj1x
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011xNc764bgrPZRQYCRzPj1x
Part of the Castle Siege epic (#735).
Problem
WizardTeleportActionhad a todo: "During castle siege, can't teleport over the non-destroyed gates". Attackers could teleport past a closed gate into the castle.Change
IPlayerTeleportRestrictionPlugIn(fresh GUID). Teleport and Teleport Ally ask it before consuming mana and moving the player; the todo is removed.CastleSiegeNpcController.IsLineBlockedByClosedGate: walks the straight line from start to target (one tile per row/column, so it can't skip the two gate rows) and checks it against the reference-counted gate terrain the controller already keeps. That terrain is exactly the closed gates, so opened (lever) and destroyed gates no longer block.CastleSiegePlugInimplements the point on the Castle Siege map.The todo suggested a "simple y-axis check". I used the line-through-gate check instead because a pure y check would also block teleports far beside the gate. Note that teleports over the castle walls are not blocked; that's general teleport behaviour (only the target tile is checked) and out of scope here.
Tests
New
CastleSiegeTeleportTests(9 tests): straight/diagonal/both directions over the gate, beside it, in front of it, same tile, opened gate, and the plugin on and off the siege map.Ran the full
MUnique.OpenMU.Testssuite with--no-build: 2451 passed, 2 skipped. Not verified with a game client.Generated by Claude Code