Page:
Making a card type
No results
18
Making a card type
LunarTides edited this page 2026-01-12 08:59:05 +01:00
Table of Contents
Warning
Most of this no longer applies as of 4.0.0. An updated version of this wiki is in progress: https://hs.lunartides.dev (#447)
Creating a card type:
This page is likely outdated since it hasn't been updated in a while.
This is one of the most complicated things you can do.
See c4cb7b3 for an example of a card type being added.
Updating types
- Add the card type to the
CardTypetype insrc/types.ts. - Add any card type specific fields to the
Blueprinttype insrc/types.ts. E.g.example?: numberafterhpCost?: number - Add any card type specific abilities to the
CardAbilityRealinsrc/types.ts
Updating card creators
- Add a default ability for the card type in
cardcreator/lib.ts:getCardAbility - Add a function for creating the card type in
cardcreator/custom.ts:cardTypeFunctions. Just copy an existing one, likeLocation()and change it. (make sure it follows the naming convention. the name of the type, capitalized.) - If the card type exists in vanilla Hearthstone, add code for it in
cardcreator/vanilla.ts:create.
Other
- Add any card type specific fields to the
Cardclass insrc/core/card.ts. For example,example?: numberaftercooldown?: number = 2. - Add code for playing the card in
src/core/game.ts:playCard:typeSpecific. Copy and paste, for example,Minionand change it to do the code you want. (make sure it follows the naming convention. the name of the type, capitalized.) - If the card is going on the board, update
src/core/card.ts:canBeOnBoard - Add it to
src/helper/validator.ts:requiredFieldsTable. If your type has no specific required field, just add"[name of type]": [],. Otherwise, something like this:"Test": ["stats", "example"],. (Only include "stats" if the card type has stats) - Add code for it in
src/core/interact/card.ts:getReadable.
Optional
- Add an example card for it.
- Add a card type specific command. See the
usecommand for an example of how to do this. - Add code for it in
src/core/ai.ts. (This is optional since it is hard. By default, the ai will treat the type as a Minion if it is incanBeOnBoard, and as a Spell otherwise.)
Conclusion
Congratulations! You now have a basic card type. Of course, at this state the type doesn't do anything special. If you want the type to do more special things, you will have to basically mod the game. Feel free to use the discussions tab to ask for help.