From e4ad5ab1178ae4de02fef51fb532906521fd2698 Mon Sep 17 00:00:00 2001 From: jordywestside Date: Thu, 19 Sep 2019 20:12:26 -0500 Subject: [PATCH 1/3] seesion --- problems/py101/make_a_game/lib/player.py | 26 ++++++++++++++++++++++++ problems/py101/make_a_game/run.py | 7 +++++++ 2 files changed, 33 insertions(+) diff --git a/problems/py101/make_a_game/lib/player.py b/problems/py101/make_a_game/lib/player.py index 620f0da..462c633 100644 --- a/problems/py101/make_a_game/lib/player.py +++ b/problems/py101/make_a_game/lib/player.py @@ -1,7 +1,11 @@ +from .pythonmon import Pythonmon +import random + class Player: def __init__(self): self._in_game = True self.name = None + self.pymon = None def say_hello(self): return "Hello!" @@ -16,8 +20,30 @@ def repeat(self, message): def in_game(self): return self._in_game + def catch_pymon(self): + self.has_pymon = True + list_of_pymon = ["Justin", "Pymander", "Dexter", "Mario"] + seed = random.randint(0,len(list_of_pymon) - 1) + name = list_of_pymon[seed] + self.pymon = Pythonmon(name) + pass + + def check_pymon(self): + if self.pymon is not None: + print(f'Your pymon is called :{self.pymon.name} and has {self.pymon.hp} hp') + else: + print("Go catch a Pymon") + + def fight_baddie(self): + if self.pymon is None: + print("No Pymon") + else: + self.pymon.get_attacked() + @in_game.setter def in_game(self, game_state): if not isinstance(game_state, bool): raise Exception("Must set game state to True or False") self._in_game = game_state + + \ No newline at end of file diff --git a/problems/py101/make_a_game/run.py b/problems/py101/make_a_game/run.py index c5374ba..3e6d122 100644 --- a/problems/py101/make_a_game/run.py +++ b/problems/py101/make_a_game/run.py @@ -14,5 +14,12 @@ if message == "quit": print("Roger that, thanks for playing!") player.in_game = False + elif message == "catch": + player.catch_pymon() + print("You just caught a Pymon!") + elif message == "fight": + player.fight_baddie() + elif message == "check": + player.check_pymon() else: print(player.repeat(message)) From 296ebf25f4d0cf8fc2a71e684124303f0bb8c9bd Mon Sep 17 00:00:00 2001 From: jordywestside Date: Thu, 19 Sep 2019 20:18:39 -0500 Subject: [PATCH 2/3] altered pymon names --- problems/py101/make_a_game/lib/player.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/problems/py101/make_a_game/lib/player.py b/problems/py101/make_a_game/lib/player.py index 462c633..116ad55 100644 --- a/problems/py101/make_a_game/lib/player.py +++ b/problems/py101/make_a_game/lib/player.py @@ -22,7 +22,7 @@ def in_game(self): def catch_pymon(self): self.has_pymon = True - list_of_pymon = ["Justin", "Pymander", "Dexter", "Mario"] + list_of_pymon = ["Pykachu", "Pymander", "Pytle", "Pybasaur"] seed = random.randint(0,len(list_of_pymon) - 1) name = list_of_pymon[seed] self.pymon = Pythonmon(name) From 6ac85934ee581a3adc619b23a38e80e34e7c1188 Mon Sep 17 00:00:00 2001 From: jordywestside Date: Thu, 19 Sep 2019 20:24:49 -0500 Subject: [PATCH 3/3] PYMON Group 4 --- problems/py101/make_a_game/run.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/problems/py101/make_a_game/run.py b/problems/py101/make_a_game/run.py index 3e6d122..075b364 100644 --- a/problems/py101/make_a_game/run.py +++ b/problems/py101/make_a_game/run.py @@ -2,11 +2,11 @@ if __name__ == "__main__": player = Player() - player_name = input("Hello! What is your name? ") + player_name = input("Yo! What is your name? ") player.set_name(player_name) - print(f"Welcome {player.name} to this new game!") - print("Right now, all we can do is repeat what you say.") - print("Edit this program to add in more functionality!") + print(f"Welcome {player.name} to Pymon!") + print("Type 'catch' to catch a Pymon!") + print("Type 'Fight' to fight!") print("To stop playing, type quit") while player.in_game: