Skip to content

fix: make card update function less draconian when ability costs are undefined (#1996)#2916

Open
sungdark wants to merge 2 commits intoFreezingMoon:masterfrom
sungdark:fix/less-draconian-card-update-1996
Open

fix: make card update function less draconian when ability costs are undefined (#1996)#2916
sungdark wants to merge 2 commits intoFreezingMoon:masterfrom
sungdark:fix/less-draconian-card-update-1996

Conversation

@sungdark
Copy link
Copy Markdown

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 !== undefined but then directly accessed costs.energy without verifying it was defined. This caused issues when abilities had a costs object but no energy property defined.

Solution

Changed the condition to use optional chaining and check if costs?.energy is a number:

  • stats.ability_info[key].costs !== undefinedtypeof 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 checking

Testing

  • Build passes successfully (npm run build)
  • The fix is minimal and targeted - it only changes the display condition, not the underlying data

Bounty

Issue: #1996
Bounty: 20 XTR
Receiver: eB51DWp1uECrLZRLsE2cnyZUzfRWvzUzaJzkatTpQV9

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.
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 27, 2026

@sungdark is attempting to deploy a commit to the FreezingMoon Team on Vercel.

A member of the Team first needs to authorize it.

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.

1 participant