Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughSAM interception now evaluates and launches multiple ordered targets, including last-moment and simultaneous interceptions. Missile construction carries its target explicitly. Nuke completion checks nearby interceptors, and curve sampling preserves spacing overflow. Tests cover these interception and path-length changes. ChangesSAM interception flow
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant GameTick
participant SAMTargetingSystem
participant SAMLauncherExecution
participant SAMMissileExecution
participant NukeExecution
GameTick->>SAMTargetingSystem: compute valid interception targets
SAMTargetingSystem-->>SAMLauncherExecution: return sorted targets
SAMLauncherExecution->>SAMMissileExecution: launch missiles with target units
SAMMissileExecution-->>NukeExecution: intercept targeted nukes
NukeExecution->>NukeExecution: check completion detonation condition
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
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. Comment |
|
Please advice when reviewing this PR on the following:
|
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
src/core/execution/SAMMissileExecution.ts (1)
70-70: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRemove leftover debug log.
console.log("DONE!")looks like a debugging artifact left in the interception success path.🧹 Proposed fix
if (result.status === PathStatus.COMPLETE) { - console.log("DONE!"); this.mg.displayMessage(🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/core/execution/SAMMissileExecution.ts` at line 70, Remove the leftover console.log("DONE!") statement from the interception success path in SAMMissileExecution, leaving the surrounding execution behavior unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/core/execution/NukeExecution.ts`:
- Around line 263-276: In the COMPLETE-result handling of NukeExecution, only
call this.nuke.move(result.node) when detonation was skipped because a nearby
SAM missile is targeting it. Preserve detonate() for the !shouldBeDestroyed
branch, but prevent execution from falling through to move() after the nuke has
been deleted.
In `@tests/core/executions/SAMLauncherExecution.test.ts`:
- Around line 338-341: Strengthen the SAM interception tests to verify timing
rather than only final inactive state. In
tests/core/executions/SAMLauncherExecution.test.ts:338-341, retain the distant
nuke and assert the dangerous nuke is selected first; at 371-375, assert both
SAM missiles launch in the same tick; at 408-413, assert all MIRV targets are
attacked in the same tick; and at 431-434, verify interception occurs before
detonation, such as by asserting no blast effect appears on the target tile.
---
Nitpick comments:
In `@src/core/execution/SAMMissileExecution.ts`:
- Line 70: Remove the leftover console.log("DONE!") statement from the
interception success path in SAMMissileExecution, leaving the surrounding
execution behavior unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 99b74c62-8971-4437-b71e-53cd13af94a3
📒 Files selected for processing (7)
src/core/execution/NukeExecution.tssrc/core/execution/SAMLauncherExecution.tssrc/core/execution/SAMMissileExecution.tssrc/core/game/Game.tssrc/core/utilities/Line.tstests/core/executions/SAMLauncherExecution.test.tstests/core/pathfinding/UniversalPathFinding.Parabola.test.ts
evanpelle
left a comment
There was a problem hiding this comment.
From Claude:
NukeExecutiondetonation-hold check:.length === 1should be>= 1— if two missiles ever target the same nuke, it detonates. It's only safe today via thetargetedBySAMinvariant, which nothing local enforces.- Magic radius
10: the inbound missile heads totrajectory[len-2], which is up tonukeSpeedfrom dst (22 for MIRV warheads), and the missile can still be a full move (12) short of it — so a legit interceptor can be 20–34 tiles away and the nuke detonates anyway. Derive it fromdefaultSamMissileSpeed() + nukeSpeed(type)instead. - Comment accuracy: "Nuke Execution happens before SAM execution" isn't true in general — a SAM launcher built before the launch ticks before the NukeExecution. The real invariant is that the SAMMissileExecution (appended at fire time) ticks after the nuke, which is what the
len - 2cutoff guards. Worth rewording. - Test gaps: the detonation-hold branch is never exercised, and the "SAM range edge" test doesn't hit the new fallback (its in-flight tiles at x=65/53/41 are within samRange 70, so the normal loop finds the interception). A test where only the landing tile is in range would cover the new block. Also the new nukes have no NukeExecution so
reachedTarget()is vacuously false —wasDestroyedByEnemy()is doing all the work. - Nit: in the fallback,
samTickToReach <= explosionTickandtickBeforeShooting >= 0are the same condition (nukeTickToReach === explosionTick there) — keep one. - Heads-up, not a blocker: hydro no longer categorically outranks atom (an atom landing on the silo beats a distant hydro), and detection radius ×2 = 4× scanned area per SAM per tick. Both seem fine, just flagging as deliberate changes.
|
…hich missiles to focus on. Fix bug discarding extra distance traveled in parabola. Fix SAM Missile not moving for a tick. Make SAMExecution source of truth for interception - missiles confirm first they should not be intercepted. Add detection code for missiles landing in SAM range despite never being interceptable.
… proved it was entirely unnecessary.
Stop SAM from targeting detonation tile. Add heuristic to determine which missiles to focus on. Fix bug discarding extra distance traveled in parabola. Fix SAM Missile not moving for a tick. Make SAMExecution source of truth for interception - missiles confirm first they should not be intercepted. Add detection code for missiles landing in SAM range despite never being interceptable.
Add approved & assigned issue number here:
Resolves #4745
Description:
This PR solves various edge case bugs that can consistently be abused. This pr fixes bullet point 1, and 3 through 8.
Please complete the following:
Please put your Discord username so you can be contacted if a bug or regression is found:
JB940