Skip to content

Commit

Permalink
Merge pull request #39 from mkli90/enhancement/22-NPC-Creation
Browse files Browse the repository at this point in the history
#22 - NPC creation
  • Loading branch information
mvmntjulz committed May 8, 2015
2 parents cbe7e83 + ffafc8e commit 7fb27f4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
5 changes: 5 additions & 0 deletions tekmate/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,8 @@ def move_player(self, mouse_pos):
else:
x = 100
self.position = (self.position[0] + x, self.position[1])

class NPC(object):
def __init__(self):
self.position = (0, 0)
self.default_response_message = "Hello, I'm an NPC"
17 changes: 16 additions & 1 deletion tests/test_game.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from mock import Mock, patch


from tekmate.game import Player
from tekmate.game import Player, NPC
from tekmate.items import Item


Expand Down Expand Up @@ -73,3 +73,18 @@ def test_when_trigger_item_combination_is_called_item_combine_functions_are_call
self.player.trigger_item_combination(mock_item1, mock_item2)
mock_item1.combine.assert_called_with(mock_item2)
mock_item2.combine.assert_called_with(mock_item1)


class NPCTestCase(TestCase):
def setUp(self):
self.npc = NPC()

def test_can_create_NPC(self):
self.assertIsInstance(self.npc, NPC)

def test_NPCs_default_position_for_zero_zero(self):
self.assertEqual(self.npc.position, (0, 0))

def test_when_talked_to_NPC_return_default_response_message(self):
message = "Hello, I'm an NPC"
self.assertEqual(self.npc.default_response_message, message)

0 comments on commit 7fb27f4

Please sign in to comment.