fix: make card update function less draconian when ability costs are undefined (#1996)#2916
Open
sungdark wants to merge 2 commits intoFreezingMoon:masterfrom
Open
fix: make card update function less draconian when ability costs are undefined (#1996)#2916sungdark wants to merge 2 commits intoFreezingMoon:masterfrom
sungdark wants to merge 2 commits intoFreezingMoon:masterfrom
Conversation
Issue: Touching hexagons on Android triggers hover behavior first, requiring users to tap twice to perform an action. Fix: Detect touch input via pointer.pointerType and: - Skip hover effects for touch (onInputOver returns early for touch) - Handle touch input directly in onInputDown (calls onConfirmFn) - Skip onInputOut hover-off for touch (no hover was shown) - Skip onInputUp for touch (already handled in onInputDown) This makes touch interaction on Android feel immediate and responsive, matching the expected single-tap behavior.
|
@sungdark is attempting to deploy a commit to the FreezingMoon Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes issue #1996 where the game's dash would fail to display abilities for units that don't have energy costs defined (e.g., Kraken).
Problem
The card update function checked only if
costs !== undefinedbut then directly accessedcosts.energywithout verifying it was defined. This caused issues when abilities had acostsobject but noenergyproperty defined.Solution
Changed the condition to use optional chaining and check if
costs?.energyis a number:stats.ability_info[key].costs !== undefined→typeof stats.ability_info[key].costs?.energy === 'number'This makes the function more lenient - it skips displaying energy cost info when the value is undefined, instead of crashing or showing garbage values like "costs undefined energy pts.".
Changes
src/ui/interface.ts: Updated two occurrences of the ability cost check to use optional chaining and proper type checkingTesting
npm run build)Bounty
Issue: #1996
Bounty: 20 XTR
Receiver: eB51DWp1uECrLZRLsE2cnyZUzfRWvzUzaJzkatTpQV9