示例#1
0
def main():
    # Place player on position 0
    GameBoard.theBoard[PlayerClass.char.position] = PlayerClass.char.name

    # Place orcs in random positions
    for orc in MonsterClass.army_of_orcs:
        GameBoard.theBoard[orc.position] = orc.hidden

    # Boss
    GameBoard.theBoard[99] = MonsterClass.orc_boss.symbol

    # Place NPC
    for orc in MonsterClass.army_of_orcs:
        GameBoard.theBoard[NPCClass.the_trader.position] = NPCClass.the_trader.hidden
        GameBoard.theBoard[NPCClass.the_healer.position] = NPCClass.the_healer.hidden
        while NPCClass.the_trader.position == orc.position:
            NPCClass.the_trader.position = gen_ran_pos()
        while NPCClass.the_healer.position == orc.position:
            NPCClass.the_healer.position = gen_ran_pos()

    # Give player a wooden stick and a wooden shield
    PlayerClass.char.equipped_items["Weapon"] = ItemClass.wooden_stick
    PlayerClass.char.inventory.append(ItemClass.wooden_shield)

    # Place some normal items around the board
    GameBoard.theBoard[ItemClass.leather_armour.position] = ItemClass.leather_armour.hidden

    GameBoard.theBoard[ItemClass.leather_cap.position] = ItemClass.leather_cap.hidden

    print("\nWelcome to Monster_Hunter.\n\n"
          "Kill monsters, gather gold, buy better\n"
          "equipment and battle with the boss.\n\n"
          "Available Commands:\n\n"
          "help     Display help menu\n"
          "start    Start the game\n"
          "exit     Exit the game\n")
    menuAction()
示例#2
0
def main():
    # Place player on position 0
    GameBoard.theBoard[PlayerClass.char.position] = PlayerClass.char.name

    # Place orcs in random positions
    for orc in MonsterClass.army_of_orcs:
        GameBoard.theBoard[orc.position] = orc.hidden

    # Boss
    GameBoard.theBoard[99] = MonsterClass.orc_boss.symbol

    # Place NPC
    for orc in MonsterClass.army_of_orcs:
        for npc in NPCClass.npc_func_dict:
            GameBoard.theBoard[npc.position] = npc.hidden
            while npc.position == orc.position:
                npc.position = gen_ran_pos()

    # Give player a wooden stick and a wooden shield ( + Spell for testing )
    PlayerClass.char.equipped_items["Weapon"] = ItemClass.wooden_stick
    PlayerClass.char.inventory.append(ItemClass.wooden_shield)

    # Temporary spell added to inventory for testing
    PlayerClass.char.inventory.append(ItemClass.fire_ball)

    # Place some normal items around the board
    GameBoard.theBoard[
        ItemClass.leather_armour.position] = ItemClass.leather_armour.hidden
    GameBoard.theBoard[
        ItemClass.leather_cap.position] = ItemClass.leather_cap.hidden

    print("\nWelcome to Monster_Hunter.\n\n"
          "Kill monsters, gather gold, buy better\n"
          "equipment and battle with the boss.\n\n"
          "Available Commands:\n\n"
          "help     Display help menu\n"
          "start    Start the game\n"
          "load     Load last save\n"
          "exit     Exit the game\n")
    menuAction()
示例#3
0
            get_healed = input(f"It will cost you {rounded_cost} gold. Deal? [y/n] > ")
            if get_healed == "y":
                if PlayerClass.char.gold >= rounded_cost:
                    PlayerClass.char.gold -= rounded_cost
                    PlayerClass.char.hp += healing_need
                    print("All of your wounds magically disappear...")
                else:
                    print("You don't have enough gold for that.")
            else:
                print("Stop wasting my time!")
    else:
        print("Stop wasting my time!")


# Create an NPC
the_trader = Npc("Mystic Trader", "T", "Trader", gen_ran_pos(), " ", False)
the_trader.gold = 1000

the_healer = Npc("The Healer", "H", "Healer", gen_ran_pos(), " ", False)

# Give items to an NPC
the_trader.inventory.append(ItemClass.leather_cap)
the_trader.inventory.append(ItemClass.leather_armour)
the_trader.inventory.append(ItemClass.iron_helmet)
the_trader.inventory.append(ItemClass.iron_shield)
the_trader.inventory.append(ItemClass.iron_armour)
the_trader.inventory.append(ItemClass.iron_sword)

the_trader.inventory.append(ItemClass.dragon_plate)
the_trader.inventory.append(ItemClass.half_moon_katana)
示例#4
0
        PlayerClass.char.hp -= i.health
        PlayerClass.char.defence -= i.defence

        PlayerClass.char.equipped_items[item] = None
        print(f"\n{i.name} is now unequipped")
        PlayerClass.char.inventory.append(i)
    else:
        print("Invalid item.")


# Create normal items
wooden_stick = Item("Wooden Stick", "Weapon", " ", None, 5, 0, 0, 10, "Normal",
                    False)
wooden_shield = Item("Wooden Shield", "Shield", " ", None, 0, 5, 0, 10,
                     "Normal", False)
leather_cap = Item("Leather Cap", "Helmet", " ", gen_ran_pos(), 0, 7, 2, 17,
                   "Normal", False)
leather_armour = Item("Leather Armour", "Chest", " ", gen_ran_pos(), 0, 12, 2,
                      28, "Normal", False)
iron_sword = Item("Iron Sword", "Weapon", " ", None, 25, 0, 0, 120, "Normal",
                  False)
iron_armour = Item("Iron Armour", "Chest", " ", None, 0, 27, 0, 62, "Normal",
                   False)
iron_shield = Item("Iron Shield", "Shield", " ", gen_ran_pos(), 0, 22, 0, 48,
                   "Normal", False)
iron_helmet = Item("Iron Helmet", "Helmet", " ", None, 0, 17, 0, 32, "Normal",
                   False)

# Create rare items
dragon_plate = Item("Dragon Plate", "Chest", " ", None, 2, 55, 15, 260, "Rare",
                    False)
示例#5
0
                                    f"Here is your upgraded item! {obj.name} +{obj.level}"
                                )
                                again = input("Upgrade again? [y/n] > ")
                                if again == 'y':
                                    pass
                                elif again == 'n':
                                    upgrading = False
                        else:
                            print("Come again!")
                            upgrading = False
            except AttributeError:
                pass


# Create an NPC
the_trader = Npc("The Mystical Trader", "⚖", "Trader", gen_ran_pos(), " ",
                 False)
the_trader.gold = 1000
the_healer = Npc("The Healer", "🧚‍", "Healer", gen_ran_pos(), " ", False)

the_wizard = Npc("The Wizard", "🧙", "Wizard", gen_ran_pos(), " ", False)

the_blacksmith = Npc("The Blacksmith", "🔧", "Blacksmith", 1, " ", False)

# Give items to an NPC
# Normal - leather_cap, leather_armour, iron_helmet, iron_shield, iron_armour, iron_sword
# Rare - dragon_plate, half_moon_katana
# Unique - one_hit_wonder
the_trader.inventory = ItemClass.Item.trader_items

# Wizard/Spells
示例#6
0
        PlayerClass.char.equipped_items[item] = None
        print(f"\n{i.name} is now unequipped")
        PlayerClass.char.inventory.append(i)
    else:
        print("Please select one of the available options.")


# name, i_type, hidden, position, damage, defence, health, dexterity, intelligence, magic, value, rarity, found,
# level, NPC
# Create normal items
wooden_stick = Item("Wooden Stick", "Weapon", " ", None, 5, 0, 0, 2, 0, 0, 10,
                    "Normal", False, 0)
wooden_shield = Item("Wooden Shield", "Shield", " ", None, 0, 5, 0, 2, 0, 0,
                     10, "Normal", False, 0)
leather_cap = Item("Leather Cap", "Helmet", " ", gen_ran_pos(), 0, 7, 2, 0, 0,
                   0, 17, "Normal", False, 0, 'trader')
leather_armour = Item("Leather Armour", "Chest", " ", gen_ran_pos(), 0, 12, 2,
                      0, 0, 0, 28, "Normal", False, 0, 'trader')
iron_sword = Item("Iron Sword", "Weapon", " ", None, 25, 0, 0, -1, 0, 0, 120,
                  "Normal", False, 0, 'trader')
iron_armour = Item("Iron Armour", "Chest", " ", None, 0, 27, 0, -3, 0, 0, 62,
                   "Normal", False, 0, 'trader')
iron_shield = Item("Iron Shield", "Shield", " ", None, 0, 22, 0, -2, 0, 0, 48,
                   "Normal", False, 0, 'trader')
iron_helmet = Item("Iron Helmet", "Helmet", " ", None, 0, 17, 0, -1, 0, 0, 32,
                   "Normal", False, 0, 'trader')

# Create rare items
dragon_plate = Item("Dragon Plate", "Chest", " ", None, 2, 55, 15, -3, 5, 10,
                    260, "Rare", False, 0, 'trader')