From 7ce574e6d8521f74fab9ca65847a49492c5783b5 Mon Sep 17 00:00:00 2001 From: Jeremy Thurgood Date: Thu, 15 May 2014 21:07:18 +0200 Subject: [PATCH] The Great Renaming of locks and keys. --- .../bits/{magenta_off.png => blue_off.png} | Bin .../bits/{magenta_on.png => blue_on.png} | Bin .../bits/{cyan_off.png => green_off.png} | Bin .../images/bits/{cyan_on.png => green_on.png} | Bin .../bits/{yellow_off.png => red_off.png} | Bin .../images/bits/{yellow_on.png => red_on.png} | Bin .../{robot_magenta.png => robot_blue.png} | Bin .../board/{robot_cyan.png => robot_green.png} | Bin .../board/{robot_yellow.png => robot_red.png} | Bin .../board/{tile_magenta.png => tile_blue.png} | Bin ..._magenta_small.png => tile_blue_small.png} | Bin .../board/{tile_cyan.png => tile_green.png} | Bin ...e_cyan_magenta.png => tile_green_blue.png} | Bin ...ta_small.png => tile_green_blue_small.png} | Bin ...le_cyan_small.png => tile_green_small.png} | Bin .../board/{tile_yellow.png => tile_red.png} | Bin ...e_magenta_yellow.png => tile_red_blue.png} | Bin ...llow_small.png => tile_red_blue_small.png} | Bin ...ile_cyan_yellow.png => tile_red_green.png} | Bin ...nta_yellow.png => tile_red_green_blue.png} | Bin ...mall.png => tile_red_green_blue_small.png} | Bin ...low_small.png => tile_red_green_small.png} | Bin ...le_yellow_small.png => tile_red_small.png} | Bin data/location_decks/test.yaml | 10 ++++----- naja/actions.py | 2 +- naja/constants.py | 6 +++--- naja/tests/test_actions.py | 14 ++++++------ naja/tests/test_player.py | 20 +++++++++--------- naja/widgets/player_bits.py | 6 +++--- naja/widgets/robot.py | 11 ++++------ naja/widgets/tile.py | 18 ++++++++-------- 31 files changed, 42 insertions(+), 45 deletions(-) rename data/images/bits/{magenta_off.png => blue_off.png} (100%) rename data/images/bits/{magenta_on.png => blue_on.png} (100%) rename data/images/bits/{cyan_off.png => green_off.png} (100%) rename data/images/bits/{cyan_on.png => green_on.png} (100%) rename data/images/bits/{yellow_off.png => red_off.png} (100%) rename data/images/bits/{yellow_on.png => red_on.png} (100%) rename data/images/board/{robot_magenta.png => robot_blue.png} (100%) rename data/images/board/{robot_cyan.png => robot_green.png} (100%) rename data/images/board/{robot_yellow.png => robot_red.png} (100%) rename data/images/board/{tile_magenta.png => tile_blue.png} (100%) rename data/images/board/{tile_magenta_small.png => tile_blue_small.png} (100%) rename data/images/board/{tile_cyan.png => tile_green.png} (100%) rename data/images/board/{tile_cyan_magenta.png => tile_green_blue.png} (100%) rename data/images/board/{tile_cyan_magenta_small.png => tile_green_blue_small.png} (100%) rename data/images/board/{tile_cyan_small.png => tile_green_small.png} (100%) rename data/images/board/{tile_yellow.png => tile_red.png} (100%) rename data/images/board/{tile_magenta_yellow.png => tile_red_blue.png} (100%) rename data/images/board/{tile_magenta_yellow_small.png => tile_red_blue_small.png} (100%) rename data/images/board/{tile_cyan_yellow.png => tile_red_green.png} (100%) rename data/images/board/{tile_cyan_magenta_yellow.png => tile_red_green_blue.png} (100%) rename data/images/board/{tile_cyan_magenta_yellow_small.png => tile_red_green_blue_small.png} (100%) rename data/images/board/{tile_cyan_yellow_small.png => tile_red_green_small.png} (100%) rename data/images/board/{tile_yellow_small.png => tile_red_small.png} (100%) diff --git a/data/images/bits/magenta_off.png b/data/images/bits/blue_off.png similarity index 100% rename from data/images/bits/magenta_off.png rename to data/images/bits/blue_off.png diff --git a/data/images/bits/magenta_on.png b/data/images/bits/blue_on.png similarity index 100% rename from data/images/bits/magenta_on.png rename to data/images/bits/blue_on.png diff --git a/data/images/bits/cyan_off.png b/data/images/bits/green_off.png similarity index 100% rename from data/images/bits/cyan_off.png rename to data/images/bits/green_off.png diff --git a/data/images/bits/cyan_on.png b/data/images/bits/green_on.png similarity index 100% rename from data/images/bits/cyan_on.png rename to data/images/bits/green_on.png diff --git a/data/images/bits/yellow_off.png b/data/images/bits/red_off.png similarity index 100% rename from data/images/bits/yellow_off.png rename to data/images/bits/red_off.png diff --git a/data/images/bits/yellow_on.png b/data/images/bits/red_on.png similarity index 100% rename from data/images/bits/yellow_on.png rename to data/images/bits/red_on.png diff --git a/data/images/board/robot_magenta.png b/data/images/board/robot_blue.png similarity index 100% rename from data/images/board/robot_magenta.png rename to data/images/board/robot_blue.png diff --git a/data/images/board/robot_cyan.png b/data/images/board/robot_green.png similarity index 100% rename from data/images/board/robot_cyan.png rename to data/images/board/robot_green.png diff --git a/data/images/board/robot_yellow.png b/data/images/board/robot_red.png similarity index 100% rename from data/images/board/robot_yellow.png rename to data/images/board/robot_red.png diff --git a/data/images/board/tile_magenta.png b/data/images/board/tile_blue.png similarity index 100% rename from data/images/board/tile_magenta.png rename to data/images/board/tile_blue.png diff --git a/data/images/board/tile_magenta_small.png b/data/images/board/tile_blue_small.png similarity index 100% rename from data/images/board/tile_magenta_small.png rename to data/images/board/tile_blue_small.png diff --git a/data/images/board/tile_cyan.png b/data/images/board/tile_green.png similarity index 100% rename from data/images/board/tile_cyan.png rename to data/images/board/tile_green.png diff --git a/data/images/board/tile_cyan_magenta.png b/data/images/board/tile_green_blue.png similarity index 100% rename from data/images/board/tile_cyan_magenta.png rename to data/images/board/tile_green_blue.png diff --git a/data/images/board/tile_cyan_magenta_small.png b/data/images/board/tile_green_blue_small.png similarity index 100% rename from data/images/board/tile_cyan_magenta_small.png rename to data/images/board/tile_green_blue_small.png diff --git a/data/images/board/tile_cyan_small.png b/data/images/board/tile_green_small.png similarity index 100% rename from data/images/board/tile_cyan_small.png rename to data/images/board/tile_green_small.png diff --git a/data/images/board/tile_yellow.png b/data/images/board/tile_red.png similarity index 100% rename from data/images/board/tile_yellow.png rename to data/images/board/tile_red.png diff --git a/data/images/board/tile_magenta_yellow.png b/data/images/board/tile_red_blue.png similarity index 100% rename from data/images/board/tile_magenta_yellow.png rename to data/images/board/tile_red_blue.png diff --git a/data/images/board/tile_magenta_yellow_small.png b/data/images/board/tile_red_blue_small.png similarity index 100% rename from data/images/board/tile_magenta_yellow_small.png rename to data/images/board/tile_red_blue_small.png diff --git a/data/images/board/tile_cyan_yellow.png b/data/images/board/tile_red_green.png similarity index 100% rename from data/images/board/tile_cyan_yellow.png rename to data/images/board/tile_red_green.png diff --git a/data/images/board/tile_cyan_magenta_yellow.png b/data/images/board/tile_red_green_blue.png similarity index 100% rename from data/images/board/tile_cyan_magenta_yellow.png rename to data/images/board/tile_red_green_blue.png diff --git a/data/images/board/tile_cyan_magenta_yellow_small.png b/data/images/board/tile_red_green_blue_small.png similarity index 100% rename from data/images/board/tile_cyan_magenta_yellow_small.png rename to data/images/board/tile_red_green_blue_small.png diff --git a/data/images/board/tile_cyan_yellow_small.png b/data/images/board/tile_red_green_small.png similarity index 100% rename from data/images/board/tile_cyan_yellow_small.png rename to data/images/board/tile_red_green_small.png diff --git a/data/images/board/tile_yellow_small.png b/data/images/board/tile_red_small.png similarity index 100% rename from data/images/board/tile_yellow_small.png rename to data/images/board/tile_red_small.png diff --git a/data/location_decks/test.yaml b/data/location_decks/test.yaml index b577ba3..42a3d00 100644 --- a/data/location_decks/test.yaml +++ b/data/location_decks/test.yaml @@ -14,13 +14,13 @@ _standard_actions: required_bits: [] toggle_bits_c: &TOGGLE-BITS-C action_class: 'ToggleBits' - required_bits: [CYAN] + required_bits: [BLUE] set_bits_ym: &SET-BITS-YM action_class: 'SetBits' - required_bits: [YELLOW, MAGENTA] + required_bits: [RED, GREEN] acquire_win_token: &ACQUIRE-WIN-TOKEN action_class: 'AcquireWinToken' - required_bits: [CYAN, MAGENTA, YELLOW] + required_bits: [RED, GREEN, BLUE] cards: - actions: @@ -31,7 +31,7 @@ cards: - *SET-BITS-YM - actions: - action_class: 'ToggleBits' - required_bits: [YELLOW] + required_bits: [RED] - actions: - *SET-BITS-YM - actions: @@ -42,5 +42,5 @@ cards: - *TOGGLE-BITS-C - actions: - action_class: 'ShiftLocations' - required_bits: [CYAN, MAGENTA] + required_bits: [GREEN, BLUE] data: {'direction': NORTH} diff --git a/naja/actions.py b/naja/actions.py index 343aeb2..99e16bf 100644 --- a/naja/actions.py +++ b/naja/actions.py @@ -85,7 +85,7 @@ class AcquireWinToken(LocationAction): def perform_action(self, board, location): board.acquire_win_token() board.player.bits.clear_bits(set([ - BITS.CYAN, BITS.MAGENTA, BITS.YELLOW, + BITS.RED, BITS.GREEN, BITS.BLUE, ])) diff --git a/naja/constants.py b/naja/constants.py index d93b45c..92162ce 100644 --- a/naja/constants.py +++ b/naja/constants.py @@ -31,9 +31,9 @@ BITS = AttrDict({ 'EAST': 2, 'WEST': 3, # Condition bits - 'CYAN': 4, - 'MAGENTA': 5, - 'YELLOW': 6, + 'BLUE': 4, + 'GREEN': 5, + 'RED': 6, 'MSB': 7, }) DIRECTION_BITS = AttrDict((k, v) for k, v in BITS.items() if v < 4) diff --git a/naja/tests/test_actions.py b/naja/tests/test_actions.py index 02c0796..3497ee4 100644 --- a/naja/tests/test_actions.py +++ b/naja/tests/test_actions.py @@ -100,11 +100,11 @@ class TestActions(TestCase): def test_LoseHealthOrMSBAndSetBits_MSB_clear(self): board = self.make_board(player_bits=[]) state_before = board.export() - card = LocationCard(set([BITS.CYAN, BITS.NORTH]), []) + card = LocationCard(set([BITS.BLUE, BITS.NORTH]), []) actions.LoseHealthOrMSBAndSetBits(set()).perform_action(board, card) state_after = board.export() self.assertEqual(state_after['health'], state_before['health'] - 1) - self.assert_player_bits(board, BITS.CYAN, BITS.NORTH) + self.assert_player_bits(board, BITS.BLUE, BITS.NORTH) self.assert_state( state_before, state_after, exclude=['health'], player_exclude=['bits']) @@ -112,10 +112,10 @@ class TestActions(TestCase): def test_LoseHealthOrMSBAndSetBits_MSB_set(self): board = self.make_board(player_bits=[BITS.MSB]) state_before = board.export() - card = LocationCard(set([BITS.CYAN, BITS.NORTH]), []) + card = LocationCard(set([BITS.BLUE, BITS.NORTH]), []) actions.LoseHealthOrMSBAndSetBits(set()).perform_action(board, card) state_after = board.export() - self.assert_player_bits(board, BITS.CYAN, BITS.NORTH) + self.assert_player_bits(board, BITS.BLUE, BITS.NORTH) self.assert_state(state_before, state_after, player_exclude=['bits']) def test_LoseHealthOrMSBAndSetBits_MSB_set_and_on_card(self): @@ -129,7 +129,7 @@ class TestActions(TestCase): def test_AcquireWinToken(self): board = self.make_board( - player_bits=[BITS.CYAN, BITS.MAGENTA, BITS.YELLOW]) + player_bits=[BITS.RED, BITS.GREEN, BITS.BLUE]) state_before = board.export() actions.AcquireWinToken(set()).perform_action(board, None) state_after = board.export() @@ -143,7 +143,7 @@ class TestActions(TestCase): board = self.make_board(player_bits=[BITS.NORTH]) board.lose_health() state_before = board.export() - card = LocationCard(set([BITS.CYAN, BITS.NORTH]), []) + card = LocationCard(set([BITS.BLUE, BITS.NORTH]), []) actions.GainHealthAndClearBitsOrMSB(set()).perform_action(board, card) state_after = board.export() self.assertEqual(state_after['health'], state_before['health'] + 1) @@ -156,7 +156,7 @@ class TestActions(TestCase): board = self.make_board(player_bits=[BITS.MSB, BITS.NORTH]) board.lose_health() state_before = board.export() - card = LocationCard(set([BITS.CYAN, BITS.NORTH]), []) + card = LocationCard(set([BITS.BLUE, BITS.NORTH]), []) actions.GainHealthAndClearBitsOrMSB(set()).perform_action(board, card) state_after = board.export() self.assertEqual(state_after['health'], state_before['health'] + 1) diff --git a/naja/tests/test_player.py b/naja/tests/test_player.py index 31cc817..1d11637 100644 --- a/naja/tests/test_player.py +++ b/naja/tests/test_player.py @@ -54,35 +54,35 @@ class TestPlayerBits(TestCase): bits = PlayerBits(0x03) self.assertEqual(bits.check_bits([BITS.NORTH]), True) self.assertEqual(bits.check_bits([BITS.NORTH, BITS.SOUTH]), True) - self.assertEqual(bits.check_bits([BITS.CYAN]), False) - self.assertEqual(bits.check_bits([BITS.CYAN, BITS.MSB]), False) + self.assertEqual(bits.check_bits([BITS.BLUE]), False) + self.assertEqual(bits.check_bits([BITS.BLUE, BITS.MSB]), False) self.assertEqual( - bits.check_bits([BITS.NORTH, BITS.SOUTH, BITS.CYAN]), False) + bits.check_bits([BITS.NORTH, BITS.SOUTH, BITS.BLUE]), False) def test_set_bits(self): bits = PlayerBits(0x03) self.assertEqual(bits._bits, 0x03) - bits.set_bits([BITS.NORTH, BITS.CYAN]) + bits.set_bits([BITS.NORTH, BITS.BLUE]) self.assertEqual(bits._bits, 0x13) - bits.set_bits([BITS.NORTH, BITS.CYAN, BITS.MSB]) + bits.set_bits([BITS.NORTH, BITS.BLUE, BITS.MSB]) self.assertEqual(bits._bits, 0x93) def test_clear_bits(self): bits = PlayerBits(0x03) self.assertEqual(bits._bits, 0x03) - bits.clear_bits([BITS.NORTH, BITS.CYAN]) + bits.clear_bits([BITS.NORTH, BITS.BLUE]) self.assertEqual(bits._bits, 0x02) - bits.clear_bits([BITS.NORTH, BITS.CYAN, BITS.MSB]) + bits.clear_bits([BITS.NORTH, BITS.BLUE, BITS.MSB]) self.assertEqual(bits._bits, 0x02) def test_toggle_bits(self): bits = PlayerBits(0x03) self.assertEqual(bits._bits, 0x03) - bits.toggle_bits([BITS.NORTH, BITS.CYAN]) + bits.toggle_bits([BITS.NORTH, BITS.BLUE]) self.assertEqual(bits._bits, 0x12) - bits.toggle_bits([BITS.NORTH, BITS.CYAN]) + bits.toggle_bits([BITS.NORTH, BITS.BLUE]) self.assertEqual(bits._bits, 0x03) - bits.toggle_bits([BITS.NORTH, BITS.CYAN, BITS.MSB]) + bits.toggle_bits([BITS.NORTH, BITS.BLUE, BITS.MSB]) self.assertEqual(bits._bits, 0x92) diff --git a/naja/widgets/player_bits.py b/naja/widgets/player_bits.py index df122c8..6eeef09 100644 --- a/naja/widgets/player_bits.py +++ b/naja/widgets/player_bits.py @@ -32,9 +32,9 @@ class PlayerBitsWidget(Widget): bits = ( (BITS.MSB, 'msb', ()), - (BITS.YELLOW, 'yellow', ()), - (BITS.MAGENTA, 'magenta', ()), - (BITS.CYAN, 'cyan', ()), + (BITS.RED, 'red', ()), + (BITS.GREEN, 'green', ()), + (BITS.BLUE, 'blue', ()), (BITS.WEST, 'arrow', (R90,)), (BITS.EAST, 'arrow', (R270,)), (BITS.SOUTH, 'arrow', (R180,)), diff --git a/naja/widgets/robot.py b/naja/widgets/robot.py index 2eeb1d3..2fa0d11 100644 --- a/naja/widgets/robot.py +++ b/naja/widgets/robot.py @@ -1,18 +1,15 @@ """Widget to draw the player on the screen""" -import pygame.locals as pgl - from naja.constants import (PLAYER_SIZE, BIT_SIZE, TILE_SIZE, BITS) -from naja.events import finish_event from naja.resources import resources from naja.resources.mutators import EIGHT_BIT from naja.widgets.base import Widget IMG_MAP = { - BITS.CYAN: 'board/robot_cyan.png', - BITS.YELLOW: 'board/robot_yellow.png', - BITS.MAGENTA: 'board/robot_magenta.png', - } + BITS.RED: 'board/robot_red.png', + BITS.GREEN: 'board/robot_green.png', + BITS.BLUE: 'board/robot_blue.png', +} class RobotWidget(Widget): diff --git a/naja/widgets/tile.py b/naja/widgets/tile.py index 26a94da..acbc28d 100644 --- a/naja/widgets/tile.py +++ b/naja/widgets/tile.py @@ -1,6 +1,5 @@ # These will probably need to go away when we have images import pygame -import pygame.locals as pgl from naja.constants import TILE_SIZE, BITS, LOCK_HEIGHT, EXAMINE from naja.resources import resources @@ -9,14 +8,15 @@ from naja.widgets.base import Widget BIT_MAP = { - frozenset([BITS.CYAN]): 'board/tile_cyan.png', - frozenset([BITS.MAGENTA]): 'board/tile_magenta.png', - frozenset([BITS.YELLOW]): 'board/tile_yellow.png', - frozenset([BITS.CYAN, BITS.MAGENTA]): 'board/tile_cyan_magenta.png', - frozenset([BITS.CYAN, BITS.YELLOW]): 'board/tile_cyan_yellow.png', - frozenset([BITS.MAGENTA, BITS.YELLOW]): 'board/tile_magenta_yellow.png', - frozenset([BITS.CYAN, BITS.MAGENTA, BITS.YELLOW]): 'board/tile_cyan_magenta_yellow.png', - } + frozenset([BITS.RED]): 'board/tile_red.png', + frozenset([BITS.GREEN]): 'board/tile_green.png', + frozenset([BITS.BLUE]): 'board/tile_blue.png', + frozenset([BITS.RED, BITS.GREEN]): 'board/tile_red_green.png', + frozenset([BITS.RED, BITS.BLUE]): 'board/tile_red_blue.png', + frozenset([BITS.GREEN, BITS.BLUE]): 'board/tile_green_blue.png', + frozenset([BITS.RED, BITS.GREEN, BITS.BLUE]): + 'board/tile_red_green_blue.png', +} class TileWidget(Widget): -- 2.34.1