Created
April 7, 2018 03:13
-
-
Save TheBeege/f31f98d0074dc5c1f16a2801fa231577 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env python3 | |
class Character: | |
def __init__(self): | |
self.health = 0 | |
def attack(self, damage_amount, target): | |
# TODO: tell the target to take_damage the given damage_amount | |
pass | |
def take_damage(self, amount): | |
# TODO: reduce the health by the amount | |
pass | |
def is_alive(self): | |
# TODO: if this character's health is less than or equal to 0, return false, otherwise, return true | |
pass | |
class Player(Character): | |
def __init__(self): | |
super().__init__() | |
self.health = 100 | |
self.equipment = dict() | |
def attack(self, target): | |
# TODO: using Character's (super) attack method, attack the target for 15 damage | |
pass | |
class Monster: | |
def __init__(self): | |
self.damage = 0 | |
pass | |
def attack(self): | |
# TODO: using Character's (super) attack method, attack the target for this monster's damage amount | |
pass | |
class Goblin: | |
def __init__(self): | |
# TODO: call Monster's (super) constructor. PyCharm will help you | |
pass | |
def get_player_input(): | |
command = '' | |
while command not in ('attack', 'run'): | |
command = input('Please enter one of the following commands: attack, run') | |
return command | |
def battle(player, monster): | |
# TODO: while both the player and monster are alive... | |
# TODO: get_player_input to get the player's command | |
# TODO: if the player enters attack, attack the monster | |
# TODO: if the player enters run, tell them they can't run away | |
# TODO: make the monster attack the player | |
pass | |
def main(): | |
pass | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment