-
Notifications
You must be signed in to change notification settings - Fork 151
CardDefs.xml
Fireplace uses the CardDefs.xml file to generate the static data for all the cards in Hearthstone.
A Python parser is available in the python-hearthstone repository in hearthstone.cardxml
.
A filter interface is available as fireplace.cards.filter
. It can filter based on any attribute available in the CardXML
class.
For example, to get all collectible minions that cost 3 mana:
import fireplace.cards
from hearthstone.enums import CardType
minions = fireplace.cards.filter(
collectible=True,
cost=3,
type=CardType.MINION
)
Note that this will return a list of Card IDs, not Card objects themselves.
Fireplace pulls card definition data from two sources, registering and combining them together at Fireplace's initialization (first import of fireplace.cards).
The fireplace/cards/data/
directory contains the game files which uses the CardDefs.xml (CardXML) format. A parser for it is available in fireplace.cards.cardxml.
Hearthstone cards have four important data points:
- Their ID
- A dict of GameTag: value pairs (.tags)
- A dict of PlayRequirement: value pairs (.requirements)
- An Entourage list of card IDs (.entourage)
The tags dict contains most of the static data about cards such as their cost, rarity etc but also values such as Charge, Enrage etc.
Fireplace's own Card Definitions are Python classes which can define actions (such as battlecries and deathrattles), event listeners, etc.
For an introduction to the DSL used to write cards, see The Fireplace DSL.
- The Fireplace Card API
- The Fireplace DSL
- Card introspection
- Creating and playing a Game
- The CardDefs.xml file
- Developer Quick Start
- How to enable logging in Hearthstone
- Frequently Asked Questions
- Game State
- Game Actions
- Powers and Card Actions
- Target Selection
- Events
- Enchantments