How to use the hearthstone.enums.Race 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-hearthstone / hearthstone / enums.py View on Github external
PET = 20

	@property
	def name_global(self):
		if self.name == "BEAST":
			return "GLOBAL_RACE_PET"
		return "GLOBAL_RACE_%s" % (self.name)

	@property
	def visible(self):
		# XXX: Mech is only a visible tribe since GVG
		return self in VISIBLE_RACES


VISIBLE_RACES = [
	Race.MURLOC, Race.DEMON, Race.MECHANICAL, Race.ELEMENTAL, Race.BEAST,
	Race.TOTEM, Race.PIRATE, Race.DRAGON, Race.ALL,
]


class Rarity(IntEnum):
	"""TAG_RARITY"""

	INVALID = 0
	COMMON = 1
	FREE = 2
	RARE = 3
	EPIC = 4
	LEGENDARY = 5

	# TB_BlingBrawl_Blade1e (10956)
	UNKNOWN_6 = 6
github albertwujj / HearthEnv / hearthenv / utils / color_card.py View on Github external
from hearthstone.enums import Race
from sty import fg, bg, ef, rs

race_to_color = {Race.BEAST: fg.green, Race.DEMON: fg.magenta, Race.DRAGON: fg.red, Race.ELEMENTAL: fg.yellow, Race.MURLOC : fg.cyan,
				 Race.PIRATE: fg.blue, Race.TOTEM: fg.black }
# unused
def color_race(*card):
	""" colors cards according to their in-game race
	"""
	ret = []
	for i in card:
		if hasattr(i, "race") and i.race in race_to_color:
			ret.append("" + race_to_color[i.race] + str(i) + fg.rs)
		else:

			ret.append(str(i))
	return ret

def color_powered(*cards):
	""" colors cards if they are "powered up" (yellow in hand in official Hearthstone)
github HearthSim / python-hearthstone / hearthstone / enums.py View on Github external
	@property
	def name_global(self):
		if self.name == "BEAST":
			return "GLOBAL_RACE_PET"
		return "GLOBAL_RACE_%s" % (self.name)

	@property
	def visible(self):
		# XXX: Mech is only a visible tribe since GVG
		return self in VISIBLE_RACES


VISIBLE_RACES = [
	Race.MURLOC, Race.DEMON, Race.MECHANICAL, Race.ELEMENTAL, Race.BEAST,
	Race.TOTEM, Race.PIRATE, Race.DRAGON, Race.ALL,
]


class Rarity(IntEnum):
	"""TAG_RARITY"""

	INVALID = 0
	COMMON = 1
	FREE = 2
	RARE = 3
	EPIC = 4
	LEGENDARY = 5

	# TB_BlingBrawl_Blade1e (10956)
	UNKNOWN_6 = 6
github HearthSim / HearthBot / handlers / card_handler.py View on Github external
if params.get("reqs", False):
				reqs = "\n%s" % self.get_reqs(card)
			if params.get("ents", False) or params.get("entourage", False):
				ents = "\n%s" % self.get_ents(card)
			lang = params.get("lang", None)
			if lang:
				if len(lang) != 4:
					return ERR_LANG_NOT_FOUND
				locale = lang[0:2].lower() + lang[2:4].upper()
				try:
					card.loc_name(locale)
				except Exception:
					return ERR_LANG_NOT_FOUND
		health = card.durability if card.type == CardType.WEAPON else card.health
		stats = " %s/%s" % (card.atk, health) if card.atk + health > 0 else ""
		race = " (%s)" % (card.race.name.title()) if card.race != Race.INVALID else ""
		rarity = " %s" % card.rarity.name.title() if card.rarity != Rarity.INVALID else ""
		descr = "\n[%s Mana,%s%s %s%s]" % (card.cost, stats, rarity, card.type.name.title(), race)
		text = "\n" + card.loc_text(locale) if len(card.description) else ""
		flavor = "\n> " + card.loc_flavor(locale) if len(card.flavortext) else ""
		if include_url and self.has_link(card):
			url = "https://hsreplay.net/cards/%s\n" % (card.dbf_id)
		else:
			url = ""

		return (
			"```Markdown\n[%s][%s][%s]%s%s%s%s%s%s```%s"
			% (card.loc_name(locale), card.id, card.dbf_id, descr, text, flavor, tags, reqs, ents, url)
		)