Exemplo n.º 1
0
def loot(enemy, player):
    if random.random() < 0.70:  # Chance auf Gegenstand: 70%, sonst Trank
        g = random.choice([game_object.Weapon(enemy.loot_level), game_object.Armor(enemy.loot_level)])
        if g.obj_type == "weapon":
            print("You find: " + g.name)
            print("Damage: " + str(g.damage))
            print("Would you like to swap your weapon? (y/n)\n")
            ant = input("> ")
            while ant not in ["y", "n"]:
                print("I need a decision: ")
                ant = input("> ")
            print(" ")
            if ant.lower()[0] in ["y", ""]:
                player.equip_weapon(g)  # neue Waffe angelegt und alte Waffe equipped = False
            player.get_weapon(g, p=False)  # Waffe (zusätzlich) ins Inventar
        elif g.obj_type == "armor":
            print("You find: " + g.name)
            print("Protection: " + str(g.protection))
            print("Slot: " + g.slot)
            print("Would you like to swap your armor? (y/n)\n")
            ant = input("> ")
            print("")
            if ant.lower()[0] in ["y", ""]:
                player.equip_armor(g)  # Rüstung angelegt und alte Rüstung equipped = False
                print("You equip your new armor.")
            player.get_armor(g, p=False)  # Waffe (zusätzlich) ins Inventar
    else:
        player.get_potion()
Exemplo n.º 2
0
 def __init__(self):
     self.name = ""
     self.play_class = ""
     self.health_max = 0
     self.health_cur = self.health_max
     self.mp_cur_max = []
     self.ep = 0
     self.level = 1
     self.status_effects = []
     self.location = "b2"
     self.direction = ""
     self.game_over = False
     self.weapon = game_object.Weapon(self.level)
     self.weapon.equipped = True
     self.potions = 1
     self.inventory = {
         "weapons": [self.weapon],
         "armor": [],
         "misc": dict()
     }
     self.spells = list()
     self.gold = 10
     self.head = "empty"  # "empty" gebraucht für Player.equip_armor()
     self.chest = "empty"
     self.arm = "empty"
     self.leg = "empty"
     self.armor = 0
     self.pos = (0.95, 0.05, 0)
     self.quests = []
     self.friendly = 0.0
Exemplo n.º 3
0
def setup_game():
    clear()
    question1 = "Hello what's your name?\n"
    speech_manipulation(question1, 0.05)
    print("")
    myPlayer.name = input("> ").lower()

    clear()

    classes = ["warrior", "mage", "rogue", "debug"]
    question2 = "What Class do you want to play? ('Warrior', 'Mage', 'Rogue')\n"
    speech_manipulation(question2, 0.01)
    print("")
    player_class = input("> ").lower()
    print("")
    if player_class.lower() in classes:
        myPlayer.play_class = player_class
        print("You are now a:")
    else:
        while player_class.lower() not in classes:
            print("No valid class.\n")
            player_class = input("> ").lower()
        if player_class.lower() in classes:
            myPlayer.play_class = player_class
            print("You are now " + player_class)

    if myPlayer.play_class == "warrior":
        print_warrior()
        time.sleep(2)
        myPlayer.health_max = 120
        myPlayer.health_cur = 120
        myPlayer.mp_cur_max.append(20)
        myPlayer.mp_cur_max.append(20)

        myPlayer.karma = 1.0
        myPlayer.strength = 0.3
        myPlayer.dexterity = -0.1
        myPlayer.constitution = 0.2
        myPlayer.intelligence = 0.0
        myPlayer.wisdom = 0.1
        myPlayer.charisma = 0.2
    elif myPlayer.play_class == "mage":
        print_mage()
        time.sleep(2)
        myPlayer.health_max = 80
        myPlayer.health_cur = 80
        myPlayer.mp_cur_max.append(80)
        myPlayer.mp_cur_max.append(80)

        myPlayer.karma = 1.0
        myPlayer.strength = 0.0
        myPlayer.dexterity = 0.2
        myPlayer.constitution = 0.2
        myPlayer.intelligence = 0.3
        myPlayer.wisdom = 0.1
        myPlayer.charisma = -0.1
    elif myPlayer.play_class == "rogue":
        print_rogue()
        time.sleep(2)
        myPlayer.health_max = 100
        myPlayer.health_cur = 100
        myPlayer.mp_cur_max.append(40)
        myPlayer.mp_cur_max.append(40)

        myPlayer.karma = 1.0
        myPlayer.strength = -0.1
        myPlayer.dexterity = 0.3
        myPlayer.constitution = 0.1
        myPlayer.intelligence = 0.1
        myPlayer.wisdom = 0.0
        myPlayer.charisma = 0.3
    elif myPlayer.play_class == "debug":
        myPlayer.health_max = 1000
        myPlayer.health_cur = 1000
        myPlayer.mp_cur_max.append(400)
        myPlayer.mp_cur_max.append(400)
        myPlayer.level = 10
        myPlayer.gold = 10000

        myPlayer.karma = 1.0
        myPlayer.strength = -0.1
        myPlayer.dexterity = 0.3
        myPlayer.constitution = 0.1
        myPlayer.intelligence = 0.1
        myPlayer.wisdom = 0.0
        myPlayer.charisma = 0.3

        for i in range(3):
            myPlayer.spells.append(Spell(myPlayer))
        myPlayer.weapon = game_object.Weapon(10)
        print("Where to start? (a1, a2, etc.")
        myPlayer.location = input("> ")
    # intro()

    clear()
    print("#" * screen_width + "\n")
    print("#" + (" " * int((screen_width - 2 - len("Let's start now")) / 2)) + "Let's start now" + (
            " " * int((screen_width - 2 - len("Let's start now")) / 2)) + "#\n")
    print("#" * screen_width + "\n")

    game_loop()

    end_screen()