Skip to content

refactor: improve card data extraction and update cards.json#29

Merged
ClashStrategic merged 10 commits intomainfrom
fix/cards-data
Jan 28, 2026
Merged

refactor: improve card data extraction and update cards.json#29
ClashStrategic merged 10 commits intomainfrom
fix/cards-data

Conversation

@gamalielnk
Copy link
Copy Markdown
Collaborator

This PR enhances the card data processing logic in scripts/update-cards.js and applies comprehensive data corrections to cards.json to ensure accuracy and consistency with the game's current stats.

Key Changes:

  1. Script Improvements (scripts/update-cards.js):

Enhanced Data Normalization: Added SPEED_MAP and TARGETS_MAP to ensure consistent data across all cards.
Improved Extraction Logic: The script now scans nested character and projectile data to accurately identify targets, damage types, and unit counts.
Robust Stat Calculation: Implemented better handling for level scaling (levels 11, 15, 16) and multipliers.
Code Reorganization: Refactored the script into clear sections for constants, helpers, and processing logic for better maintainability.
2. Data Corrections (cards.json):

Target Definitions: Updated and reordered target arrays (e.g., reordering "air" and "ground"). Fixed incorrect "buildings" target assignments.
Attribute Updates:
Populated missing radius values for several cards.
Corrected speed properties to reflect recent balance adjustments.
Updated typeAttack classification (e.g., from "unique" to "splash" where appropriate).
Accurate projectile property toggles.
Balance & Spawning:
Adjusted unit counts for multiple card entries.
Refined unit generation stats (generationUnits and generationSpeed).
Updated damage and hitpoints values across various levels.

Update tower damage and standard damage for a specific card, significantly increasing values across levels 11, 15, and 16. Additionally, apply minor hitpoint adjustments to another card to ensure data accuracy.
- Set generationUnits to 2 for an entry previously set to null.
- Decreased generationSpeed for two card entries (15.0 to 14.0 and 4.0 to 3.5).
- These adjustments tune the spawn rates and counts for specific units.
Updates the "projectile" field from false to true for several cards in cards.json. This correction ensures that cards with projectile-based attacks are accurately represented in the dataset.
Several card entries in the cards.json file have had their speed property updated to better reflect current balance adjustments. This includes changes across various rarities (common, rare, epic, legendary, champion) to refine the movement mechanics of the units.
- Replaced null values with specific numerical radius data across multiple card entries in cards.json.
- Updated typeAttack from "unique" to "splash" for specific card instances.
- This change provides accurate area-of-effect metadata for the affected cards.
Update the units property for several card definitions in cards.json, reducing values from 7 and 2 down to 1. This ensures the data correctly reflects the unit count for specific building-targeting and air/ground cards, including those with evolutions.
Enhance the script to handle more complex card attributes and multi-unit data from the API. Key changes include:

- Added normalization maps for movement speed and target types.
- Improved target extraction by scanning nested character and projectile data.
- Added support for aggregating unit counts and stats across multiple summoned character types.
- Refined damage and HP detection logic to better handle area effects and secondary projectiles.
- Improved error reporting during API response parsing.
Update the target types for various cards to ensure data consistency and accuracy. This includes reordering target arrays, adding missing target capabilities for specific units, and removing incorrect target types where applicable.

Key changes:
- Reordered "ground" and "air" tags across multiple card entries for consistency.
- Added missing "air" and "ground" targets to specific cards (e.g., IDs 26000048, 26000060).
- Removed "buildings" target from units where it was incorrectly assigned (e.g., IDs 27000002, 27000008).
…apping

Refactored the `scripts/update-cards.js` script to improve the logic for
fetching and processing card data from the API.

Key changes include:
- Added `SPEED_MAP` and `TARGETS_MAP` for consistent data normalization.
- Reorganized the script into dedicated sections for constants, helpers, and processing logic.
- Implemented robust stat calculation and merging functions to handle level scaling (11, 15, 16) and multipliers.
- Enhanced the mapping of character, projectile, area, and spawn data to provide more accurate card attributes like radius, tower damage, and generation stats.
- Cleaned up the `CARD_SKELETON` structure for better readability.
- Install eslint, @eslint/js, and globals as development dependencies
- Create eslint.config.js using the new flat configuration format
- Configure recommended rules along with custom overrides for indentation, quotes, and semi-colons
- Set up execution environments for Node.js and Jest globals
@ClashStrategic ClashStrategic merged commit 518c056 into main Jan 28, 2026
1 check passed
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 1.8.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@ClashStrategic ClashStrategic deleted the fix/cards-data branch January 28, 2026 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants