How to use the hearthstone.enums.CardType function in hearthstone

To help you get started, we’ve selected a few hearthstone examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github HearthSim / python-hslog / tests / test_main.py View on Github external
def test_tag_value_parsing():
	tag, value = parse_initial_tag("tag=ZONE value=PLAY")
	assert tag == GameTag.ZONE
	assert value == Zone.PLAY

	tag, value = parse_initial_tag("tag=CARDTYPE value=PLAYER")
	assert tag == GameTag.CARDTYPE
	assert value == CardType.PLAYER

	tag, value = parse_initial_tag("tag=1 value=2")
	assert tag == 1
	assert value == 2

	tag, value = parse_initial_tag("tag=9999998 value=123")
	assert tag == 9999998
	assert value == 123
github HearthSim / python-hearthstone / tests / test_hslog.py View on Github external
parser = LogParser()
	parser.read(StringIO(INITIAL_GAME))
	parser.flush()

	assert len(parser.games) == 1
	packet_tree = parser.games[0]
	game = packet_tree.export().game
	assert len(game.entities) == 3
	assert len(game.players) == 2

	assert game.tags == {
		GameTag.TURN: 1,
		GameTag.ZONE: Zone.PLAY,
		GameTag.ENTITY_ID: 1,
		GameTag.NEXT_STEP: Step.BEGIN_MULLIGAN,
		GameTag.CARDTYPE: CardType.GAME,
		GameTag.STATE: State.RUNNING,
	}
	assert game.initial_state == State.RUNNING
	assert game.initial_step == Step.INVALID

	assert game.players[0].tags == {
		GameTag.PLAYSTATE: PlayState.PLAYING,
		GameTag.PLAYER_ID: 1,
		GameTag.TEAM_ID: 1,
		GameTag.ZONE: Zone.PLAY,
		GameTag.CONTROLLER: 1,
		GameTag.ENTITY_ID: 2,
		GameTag.CARDTYPE: CardType.PLAYER,
	}

	assert game.players[1].tags == {
github HearthSim / python-hslog / tests / test_main.py View on Github external
GameTag.ZONE: Zone.PLAY,
		GameTag.CONTROLLER: 1,
		GameTag.ENTITY_ID: 2,
		GameTag.CARDTYPE: CardType.PLAYER,
	}

	assert game.players[1].tags == {
		GameTag.PLAYSTATE: PlayState.PLAYING,
		GameTag.CURRENT_PLAYER: 1,
		GameTag.FIRST_PLAYER: 1,
		GameTag.PLAYER_ID: 2,
		GameTag.TEAM_ID: 2,
		GameTag.ZONE: Zone.PLAY,
		GameTag.CONTROLLER: 2,
		GameTag.ENTITY_ID: 3,
		GameTag.CARDTYPE: CardType.PLAYER,
	}
github HearthSim / python-hearthstone / tests / test_hslog.py View on Github external
def test_tag_value_parsing():
	tag, value = parse_initial_tag("tag=ZONE value=PLAY")
	assert tag == GameTag.ZONE
	assert value == Zone.PLAY

	tag, value = parse_initial_tag("tag=CARDTYPE value=PLAYER")
	assert tag == GameTag.CARDTYPE
	assert value == CardType.PLAYER

	tag, value = parse_initial_tag("tag=1 value=2")
	assert tag == 1
	assert value == 2

	tag, value = parse_initial_tag("tag=9999998 value=123")
	assert tag == 9999998
	assert value == 123
github albertwujj / HearthEnv / hearthenv / hearthStateWithChooseDeck.py View on Github external
collection = []
			exclude = []
			if len(self.deck1) < 30:
				hero = cards.db[self.hero1]
				deck = self.deck1
			else:
				hero = cards.db[self.hero2]
				deck = self.deck2

			for card in cards.db.keys():
				if card in exclude:
					continue
				cls = cards.db[card]
				if not cls.collectible:
					continue
				if cls.type == CardType.HERO:
					# Heroes are collectible...
					continue
				if cls.card_class and cls.card_class != hero.card_class:
					continue
				if deck.count(cls.id) < cls.max_count_in_deck:
					valid_moves.append([MOVE.PICK_CARD, cls])
		elif self.game is None:  # all cards have been chosen
			valid_moves.append([MOVE.PRE_GAME])
		elif self.game.current_player.choice is not None:
			for card in self.game.current_player.choice.cards:
				valid_moves.append([MOVE.CHOICE, card])
		else:
			# Play card
			for card in self.game.current_player.hand:
				dupe = False
				for i in range(len(valid_moves)):
github HearthSim / python-hearthstone / hearthstone / enums.py View on Github external
def craftable(self):
		return self in (
			CardType.HERO,
			CardType.MINION,
			CardType.SPELL,
			CardType.WEAPON,
		)
github HearthSim / python-hearthstone / hearthstone / enums.py View on Github external
def craftable(self):
		return self in (
			CardType.HERO,
			CardType.MINION,
			CardType.SPELL,
			CardType.WEAPON,
		)
github HearthSim / python-hearthstone / hearthstone / enums.py View on Github external
def craftable(self):
		return self in (
			CardType.HERO,
			CardType.MINION,
			CardType.SPELL,
			CardType.WEAPON,
		)
github HearthSim / python-hearthstone / hearthstone / entities.py View on Github external
from typing import Iterable

from .enums import CardSet, CardType, GameTag, State, Step, Zone


PLAYABLE_CARD_TYPES = (
	CardType.HERO, CardType.MINION, CardType.SPELL, CardType.WEAPON
)
INITIAL_HERO_SETS = (CardSet.CORE, CardSet.HERO_SKINS)


class Entity:
	_args: Iterable[str] = ()

	def __init__(self, id):
		self.id = id
		self.game = None
		self.tags = {}
		self.initial_creator = 0
		self.initial_zone = Zone.INVALID
		self._initial_controller = 0

	def __repr__(self):
github HearthSim / python-hearthstone / hearthstone / enums.py View on Github external
def craftable(self):
		return self in (
			CardType.HERO,
			CardType.MINION,
			CardType.SPELL,
			CardType.WEAPON,
		)