from naja.constants import BITS, CHESS_PIECES
-from naja.utils import bit_glyphs
+from naja.utils import bit_glyphs, move_glyph
class LocationAction(object):
'EAST': 'row',
'WEST': 'row',
}[self.data['direction']]
+ substitutions['direction'] = '{%s}' % (substitutions['direction'],)
if 'chesspiece' in self.data:
- substitutions['chesspiece_name'] = self.data['chesspiece'].lower()
+ substitutions['chesspiece_name'] = move_glyph(
+ self.data['chesspiece'])
if location is None:
substitutions['location_bits'] = 'bits specified by this location'
class LoseHealthOrMSB(LocationAction):
- TEXT = "Lose HEALTH or MSB."
+ TEXT = "Lose {HEALTH} or {MSB}."
USES_MSB = True
def perform_action(self, board, location):
class LoseHealthOrMSBAndSetBits(LocationAction):
- TEXT = "Lose HEALTH or MSB, then set %(location_bits)s."
+ TEXT = "Lose {HEALTH} or {MSB}, then set %(location_bits)s."
USES_MSB = True
def perform_action(self, board, location):
class AcquireWinToken(LocationAction):
- TEXT = "Gain WINTOKEN, then clear {RED,GREEN,BLUE}."
+ TEXT = "Gain {WINTOKEN}, then clear {RED,GREEN,BLUE}."
def perform_action(self, board, location):
board.acquire_win_token()
class GainHealthAndClearBitsOrMSB(LocationAction):
- TEXT = "Gain HEALTH, then clear %(location_bits)s or MSB."
+ TEXT = "Gain {HEALTH}, then clear %(location_bits)s or {MSB}."
USES_MSB = True
def perform_action(self, board, location):
subwords = word[1:-1].split(',')
if all(subword in MARKUP_MAP for subword in subwords):
return Glyph(word + suffix, subwords, suffix)
- elif word in MARKUP_MAP:
- return Glyph(word + suffix, [word], suffix)
return None