Card objects

In order to easily work with cards (and abilities), pyartifact wraps them in easier to use objects. The objects are made by inheriting multiple bases, where each base indicates the presence of a certain attribute. For example all objects inheriting the Unit class will have attack, armor and hit_points attributes.

Card types

Some cards from Valve’s API are not included in this library, because they are more of a core mechanics, these cards would have the type of Stronghold and Pathing.

Cards

class pyartifact.sets_and_cards.Hero(**kwargs)[source]

Inherts from CardBase, ColoredCard, Unit and NotAbility.

includes

List of all the cards this card includes automatically in a deck.

Return type:List[Union[Spell, Creep, Improvement]]
passive_abilities

List of the cards passive abilities

Return type:List[PassiveAbility]
class pyartifact.sets_and_cards.Creep(**kwargs)[source]

Inherits from CardBase, ColoredCard, Unit, NotAbility, Castable.

class pyartifact.sets_and_cards.Spell(**kwargs)[source]

Inherits from CardBase, ColoredCard, NotAbility and Castable.

class pyartifact.sets_and_cards.Improvement(**kwargs)[source]

Inherits from CardBase, ColoredCard, NotAbility, Castable.

class pyartifact.sets_and_cards.Item(**kwargs)[source]

Inherits from CardBase, NotAbility. Also has two attributes unique to this type.

Attribute Type Contents
gold_cost int How much gold does it take to purchase from the shop.
sub_type str Subtype of the item - Weapon, Accessory, Armor, Consumable or Deed

Abilities

class pyartifact.sets_and_cards.Ability(**kwargs)[source]

Inherits from CardBase.

class pyartifact.sets_and_cards.PassiveAbility(**kwargs)[source]

Inherits from CardBase.

Card Base classes

Base

class pyartifact.sets_and_cards.CardBase(**kwargs)[source]

All cards (and abilities) inherit the base.

Attribute Type Contents
id int Id of the card
base_id int Currently same as id
name str Name of the card
type str Type of the card, also indicated by the actual class holding the card
text str Text on the card, includes html
mini_image Optional[str] Url to mini image
large_image Optional[str] Url to large image
ingame_image Optional[str] Url to ingame image
references

List of cards that this card references

Return type:List[Union[Item, Hero, Ability, PassiveAbility, Improvement, Creep, Spell]]

Colored card

class pyartifact.sets_and_cards.ColoredCard(**kwargs)[source]

Cards that belong under a certain color.

Attribute Type Contents
color str blue, black, red, green or unknown. There are no multicolor cards yet

Unit

class pyartifact.sets_and_cards.Unit(**kwargs)[source]

Cards that can be deployed to a battlefield and fight

Attribute Type Contents
attack int Attack of the unit
armor int Armor of the unit
hit_points int Hit points (health) of the unit

NotAbility

class pyartifact.sets_and_cards.NotAbility(**kwargs)[source]

Cards that are not abilities. Card API provides abilities and passive abilities alongside cards, so in the context of this library they are treated as cards.

Attribute Type Contents
rarity Optional[str] Rarity of the card, if it has one (base set cards don’t have a rarity
item_def Optional[int] Unknown integer, only present when rarity is present
illustrator str Name of the illustrator that drew the card art
active_abilities

List of the cards active abilities

Return type:List[Ability]

Castable

class pyartifact.sets_and_cards.Castable(**kwargs)[source]

Cards that can be casted for mana.

Attribute Type Contents
mana_cost int Mana cost to cast the card