Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
from .. import Example
print("\n\nEFFECTS\n" + "="*80)
# ===== Start =====
Example("italic")
from sty import ef, fg, rs
a = ef.italic + 'Italic.' + rs.italic
# There are shorthands for this:
b = ef.i + fg.blue + 'Italic.' + rs.i + ' Not italic but blue.' + rs.fg
print(a, b, sep='\n')
# ===== End =====
# ===== Start =====
Example("bold")
from sty import ef, fg, rs
a = ef.bold + 'Bold.' + rs.bold_dim
# This has shorthands too:
b = ef.b + 'Bold.' + rs.bold_dim + fg.li_yellow + ' Not bold but yellow.' + rs.fg
print(a, b, sep='\n')
# ===== End =====
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)
"""
raise RuntimeError(
"FileInfoFactory: failed to produce FileInfo({0})"
.format(arch.name)
)
return FileInfo
class Colourer():
#TODO: Add detection of 8bit/24bit terminal
# Add 8bit/24bit colours (with flag, maybe --colour=24bit)
# Use this below as fallback only
__print = partial(stdout_print)
if CAN_COLOUR == True:
__style = {
'o' : fg.red,
'O' : fg.yellow,
'y' : fg.blue,
'Y' : fg.cyan,
'D' : fg.white + bg.red,
}
matchings = []
matchingsInParenth = []
matchingsInStderr = []
def __init__(self):
if CAN_COLOUR == True:
self.matchings = [
(
lambda x: self.enstyleNumHex(x.group()),
re.compile(r'\b([A-Fa-f0-9]{8})\b')
),
(
lambda x: '0x' + self.enstyleNumHex(x.group(2)),
re.compile(r'(0x)([A-Fa-f0-9]{1,})')
def __renderplayer(self, player):
""" returns a length 3 string array representing a player's board
string 1: hero
string 2: hand
string 3: field
"""
pout = []
h_health = fg.red + str(player.hero.health) + fg.rs
if player.hero.armor != 0:
h_health += "+" + str(player.hero.armor)
h_mana = fg.blue + str(player.mana) + "/" + str(player.max_mana) + fg.rs
line_1 = p(player.hero, h_health, h_mana)
if player.weapon is not None:
line_1 += ", " + str(player.weapon.damage) + " " + str(player.weapon.durability)
pout.append(line_1)
hand = []
pout.append(fg.rs + "HAND: " + p(*describe.hand(*player.hand), s=", ")) # line 2
field = []
for i, c in enumerate(player.field):
card = ""
specials = []