Repository navigation
Keep war battles lethal for nonlethal attackers - #75
Conversation
A nonlethal attacker's killing blow knocked a battle participant out instead of killing them, so SimpleFactions never saw the death: no battle life was spent and the respawn routing did not run. Skip the knockout for players in a started battle, the same roster check that already exempts battle deaths from permadeath and strikes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (3)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review. 📝 SummarySummary by CodeRabbit
WalkthroughKnockout handling now skips players in a started permadeath battle. The lethal-damage handler checks for lethal damage before checking skip conditions. Tests cover exempt and non-exempt victims, including a victim already downed by fall damage. The README describes the battle exception. ChangesStarted Battle Knockout Exemption
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to No actionable issue remains in the supplied evidence; the PR is mergeable after normal checks. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change intentionally keeps started battles lethal and uses the existing battle roster to limit its scope. No introduced security defect was established, but the companion plugin’s death accounting, roster cleanup, and respawn behavior remain unverified. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
Comment |
Problem
If a player in nonlethal mode lands the killing blow in a SimpleFactions war battle, the victim is knocked out instead of dying. SimpleFactions only acts on
PlayerDeathEvent, so it never sees the death:applyDeathAndNeedsJailRespawn, casualty ledger)That gives a battle loophole: nonlethal attackers can down enemies without costing them lives.
Fix
PvpKnockoutManagernow skips the knockout for players in a started SimpleFactions battle. It usesPermadeathBattleExemption.isInStartedBattle, the roster check that already exempts battle deaths from permadeath and strikes. The killing blow goes through, and SimpleFactions handles the death as usual.This also covers a player who was downed before the battle started. Once they're in a started battle, falls and other damage with no attacker can kill them again.
The lethal-health check now runs before the skip checks, so the battle lookup only happens on lethal hits, not on every hit.
Tests
nonlethalBlowStillKillsInStartedBattle: in battle, the blow isn't cancelled, health isn't set and no strike is recorded. Outside battle, the same event still knocks the player out (control).playerDownedBeforeBattleStartsCanStillDiemainand pass here.PvpKnockoutManagerTest,PvpStrikeServiceTestandPermadeathBridgesTestall pass locally. The full suite runs in CI; the remaining local failures are Windows-only (POSIX permissions, decimal-comma locale) and also fail onmain.🤖 Generated with Claude Code