コード例 #1
0
def main():
    player = Hero("austin")
    store = Store()
    battle = Battle()
    playing = True
    win = None
    rounds = 0

    enemies = [Goblin, Zombie, Wizard, Necromancer, Archer, Shadow]
    while playing:
        player.status()
        displayTown()
        choice = int(input("make your selection "))
        if choice == 1:
            enemy = enemies[random.randint(0, 5)]()
            win = battle.do_battle(player, enemy)
            if not win:
                playing = False
        if choice == 2:
            player.collectbounty()
            store.restock()
            if rounds > 10:
                store.restock(2)
            store.go_shopping(player)
        if choice == 3:
            player.useinventory()
        if choice == 4:
            print("Welcome to University!")
            print("select a new class")
            for key in class_map:
                print(f" {key}")
            new_class = input("select a class ")
            player = player.changeClass(new_class)
        if choice == 5:
            playing = False
    print("thanks for fighting")
コード例 #2
0
ファイル: hero_game.py プロジェクト: JMcWhorter150/hero_game
from sayan import Sayan
from shadow import Shadow
from store import Store
from thief import Thief
from wizard import Wizard
from zombie import Zombie
from mimic import Mimic
hero = Hero('Oakley')
enemies = [
    Goblin('Bob'),
    Wizard('Jethro'),
    Medic('Mercy'),
    Thief('Barry'),
    Mimic('Harry'),
    Zombie('Rick'),
    Shadow('Matt'),
    Sayan('Goku')
]
# enemies = [Thief('Barry')] Goblin('Bob'), Wizard('Jethro'), Medic('Mercy'), Thief('Barry'), Zombie('Rick'), Shadow('Matt'), Sayan('Goku'),
battle_engine = Battle()
shopping_engine = Store()

for enemy in enemies:
    hero_won = battle_engine.do_battle(hero, enemy)
    if not hero_won:
        print("YOU LOSE!")
        exit(0)
    shopping_engine.do_shopping(hero, enemy)

print("YOU WIN!")
コード例 #3
0
ファイル: wizard-rpg.py プロジェクト: loragriffin/wizard-rpg
from characters.base import Character
from characters.womping_willow import Womping_willow
from characters.wizard import Wizard
from characters.voldemort import Voldemort
from battle import Battle
from store import Store
from wand import Wand
from elixir import Elixir

import time
import random

if __name__ == "__main__":
    # user_input = input('Your wizard\'s name: ')
    wizard = Wizard('Harry')
    enemies = [Womping_willow(), Voldemort()]
    battle_engine = Battle()
    shopping_engine = Store()

    for enemy in enemies:
        wizard_won = battle_engine.do_battle(wizard, enemy)
        if not wizard_won:
            print("YOU LOSE!")
            exit(0)
        elif wizard.coins > 0:
            shopping_engine.do_shopping(wizard)
        else:
            break

    print("YOU WIN!")