Skip to content

Fix flying items freeze/slow display#617

Open
Lawgikill wants to merge 1 commit intooceanseth:mainfrom
Lawgikill:pr4-flying-items-freeze-slow-display
Open

Fix flying items freeze/slow display#617
Lawgikill wants to merge 1 commit intooceanseth:mainfrom
Lawgikill:pr4-flying-items-freeze-slow-display

Conversation

@Lawgikill
Copy link
Copy Markdown
Contributor

@Lawgikill Lawgikill commented Jan 7, 2026

Summary by Sourcery

Adjust slow and freeze status effects so flying items experience them for reduced duration without affecting internal timers inconsistently.

Bug Fixes:

  • Correct the interaction between flying items and slow/freeze timers to prevent accelerated depletion causing visual freezes or slow display issues.

Enhancements:

  • Make slow and freeze duration scaling for flying items explicit at application time instead of by modifying countdown rates during updates.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Jan 7, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adjusts how Slow and Freeze status effects interact with flying items so that their duration is halved at application time instead of being compensated by faster countdown, simplifying timing logic and fixing inconsistent visual behavior.

Class diagram for Item status effect duration handling

classDiagram
    class Item {
        bool flying
        number slowTimeRemaining
        number freezeTimeRemaining
        bool isSlowed
        bool isFrozen
        bool isDestroyed
        string enchant
        number hasteTimeRemaining
        HTMLElement element
        HTMLElement freezeElement
        Board board

        applySlow(duration)
        applyFreeze(duration, source)
        updateBattle(timeDiff)
    }

    class Board {
        bool hasSlowedItem
        bool hasFrozenItem
    }

    Item --> Board : references
Loading

File-Level Changes

Change Details Files
Normalize Slow effect handling by halving applied duration for flying items and simplifying countdown logic.
  • When applying Slow, halve the incoming duration if the item is flying before converting to milliseconds and accumulating.
  • Remove the special flying multiplier from the slowTimeRemaining countdown; it now decrements uniformly by timeDiff.
  • Retain the existing effectiveTimeDiff *= 0.5 slow multiplier when Slow is active and Haste is not, but without additional flying-specific scaling.
js/Item.js
Normalize Freeze effect handling by halving applied duration for flying items and simplifying countdown logic.
  • When applying Freeze, halve the incoming duration if the item is flying before converting to milliseconds and accumulating.
  • Remove the special flying multiplier from the freezeTimeRemaining countdown; it now decrements uniformly by timeDiff.
  • Preserve existing DOM updates for frozen state while relying on the new normalized timing behavior.
js/Item.js

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • The flying-item duration scaling for Slow and Freeze is now duplicated in both applySlow and applyFreeze; consider extracting a small helper (e.g. scaleDurationForFlying(duration)) to make future changes to this rule less error-prone and easier to keep in sync.
  • In updateBattle, freezeTimeRemaining can now go negative before being checked; for consistency with slowTimeRemaining and to avoid subtle time-underflow issues, consider explicitly clamping freezeTimeRemaining to 0 when it passes below zero.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The flying-item duration scaling for Slow and Freeze is now duplicated in both `applySlow` and `applyFreeze`; consider extracting a small helper (e.g. `scaleDurationForFlying(duration)`) to make future changes to this rule less error-prone and easier to keep in sync.
- In `updateBattle`, `freezeTimeRemaining` can now go negative before being checked; for consistency with `slowTimeRemaining` and to avoid subtle time-underflow issues, consider explicitly clamping `freezeTimeRemaining` to 0 when it passes below zero.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@oceanseth
Copy link
Copy Markdown
Owner

I'm not sure about this - in game, if a slow for 2s is applied while item is flying at time 1s, but it stops flying at 1.1s, does the slow really expire at time 2s? Or is the slow time reduced only while it's flying so, since it was flying for .1s, .2s of the 2s slow would be consumed during that time?

@Lawgikill
Copy link
Copy Markdown
Contributor Author

Lawgikill commented Jan 7, 2026 via email

@oceanseth
Copy link
Copy Markdown
Owner

Thank you very much for the details and contributions. I'll test in game a bit to be sure before approving this in. combined with the other admirals pr I want to make sure it's working as it does in game. Sorry for taking forever to get around to these =]

@oceanseth
Copy link
Copy Markdown
Owner

I guess I expect them to move to the second implementation eventually, and that their engineers just were either too lazy or unskilled to get it done in time for the patch. I'll circle back to this in another month or two, if they haven't fixed it, will merge it in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants