summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorNguyễn Gia Phong <vn.mcsinyx@gmail.com>2017-11-19 15:00:24 +0700
committerNguyễn Gia Phong <vn.mcsinyx@gmail.com>2017-11-19 15:00:24 +0700
commit242cc155843d467812a041dd4f6e9d90f6e7327c (patch)
treecf9d2bf59ae9d6c62f7359978a99c08a899cf54a
parent6a9b702c7737ea73bbb209f920e6e5d7d1d71aea (diff)
downloadbrutalmaze-0.1.3.tar.gz
Give Plum cloning ability 0.1.3
-rw-r--r--brutalmaze/characters.py35
-rw-r--r--brutalmaze/maze.py11
-rwxr-xr-xsetup.py2
3 files changed, 14 insertions, 34 deletions
diff --git a/brutalmaze/characters.py b/brutalmaze/characters.py
index 372600b..6a830cc 100644
--- a/brutalmaze/characters.py
+++ b/brutalmaze/characters.py
@@ -246,24 +246,6 @@ class Enemy:
             self.maze.map[self.x][self.y] = WALL
 
 
-class Butter(Enemy):
-    """Object representing an enemy of Butter type."""
-    def __init__(self, maze, x, y):
-        Enemy.__init__(self, maze, x, y, 'Butter')
-
-
-class Orange(Enemy):
-    """Object representing an enemy of Orange type."""
-    def __init__(self, maze, x, y):
-        Enemy.__init__(self, maze, x, y, 'Orange')
-
-
-class Chocolate(Enemy):
-    """Object representing an enemy of Chocolate type."""
-    def __init__(self, maze, x, y):
-        Enemy.__init__(self, maze, x, y, 'Chocolate')
-
-
 class Chameleon(Enemy):
     """Object representing an enemy of Chameleon type.
 
@@ -290,18 +272,6 @@ class Chameleon(Enemy):
         self.wound += wound
 
 
-class SkyBlue(Enemy):
-    """Object representing an enemy of Sky Blue type."""
-    def __init__(self, maze, x, y):
-        Enemy.__init__(self, maze, x, y, 'SkyBlue')
-
-
-class Plum(Enemy):
-    """Object representing an enemy of Plum type."""
-    def __init__(self, maze, x, y):
-        Enemy.__init__(self, maze, x, y, 'Plum')
-
-
 class ScarletRed(Enemy):
     """Object representing an enemy of Scarlet Red type."""
     def __init__(self, maze, x, y):
@@ -323,4 +293,7 @@ class ScarletRed(Enemy):
 def new_enemy(maze, x, y):
     """Return an enemy of a random type in the grid (x, y)."""
     color = choices(maze.enemy_weights)
-    return getattr(modules[__name__], color)(maze, x, y)
+    try:
+        return getattr(modules[__name__], color)(maze, x, y)
+    except AttributeError:
+        return Enemy(maze, x, y, color)
diff --git a/brutalmaze/maze.py b/brutalmaze/maze.py
index 1bd51b1..13db616 100644
--- a/brutalmaze/maze.py
+++ b/brutalmaze/maze.py
@@ -108,8 +108,15 @@ class Maze:
             x, y = choice(walls)
             if all(self.map[x + a][y + b] == WALL for a, b in ADJACENT_GRIDS):
                 continue
-            self.enemies.append(new_enemy(self, x, y))
-            walls.remove((x, y))
+            enemy = new_enemy(self, x, y)
+            self.enemies.append(enemy)
+            if enemy.color == 'Plum':
+                for e in self.enemies:
+                    if e.color == 'Plum' and e.awake: x, y = e.x, e.y
+            try:
+                walls.remove((x, y))
+            except ValueError:
+                enemy.x, enemy.y = x, y
 
     def pos(self, x, y):
         """Return coordinate of the center of the grid (x, y)."""
diff --git a/setup.py b/setup.py
index cce9e85..aa2abbf 100755
--- a/setup.py
+++ b/setup.py
@@ -7,7 +7,7 @@ with open('README.rst') as f:
 
 setup(
     name='brutalmaze',
-    version='0.1.2',
+    version='0.1.3',
     description='A hash and slash game with fast-paced action and a minimalist art style',
     long_description=long_description,
     url='https://github.com/McSinyx/brutalmaze',