コード例 #1
0
def intro():
    """Another part to the game introduction"""

    inventory_insert('potion')

    print_slow("Now you are ready to go on an adventure. You will be able to travel", 0.025)
    print_slow("and collect awesome items and level up to your hearts content.", 0.025)
コード例 #2
0
def _random_encounter():
    rand = random.randrange(0, 10)

    if 0 <= rand <= 5:
        print("A group of trees\n")
    elif 6 <= rand <= 8:
        print_slow("You encountered a monster", 0.05)
        fight()
    elif rand == 9:
        print_slow("You found an item on the ground", 0.05)
        random.seed()
        type = ["item", "weapon", "armor"]
        choosenType = random.choice(type)
        list_of_items = item_list(type)
        item = []

        if not list_of_items:
            item = random.choice(list(item_list('item').items()))
        else:
            item = random.choice(list(list_of_items.items()))

        print(item[0] + "\n")

        inventory_insert(item[0])
    else:
        print("ERROR: Something went wrong with Forest")
コード例 #3
0
ファイル: Store.py プロジェクト: micro164/AdvGame
def _decide_equip(item_name):
    print("Do you want to equip the " + item_name + ": yes/no")
    choice = input()
    if choice == 'yes':
        _equip_item(item_name)
    elif choice == 'no':
        inventory_insert(item_name)
    else:
        print("\nERROR: Could not put away or equip " + item_name + "\n")
コード例 #4
0
ファイル: Store.py プロジェクト: micro164/AdvGame
def _check_item_type(item_name):
    item_type = Items[item_name][Item.Type]
    if item_type != 'item':
        _decide_equip(item_name)
    elif item_type == 'item':
        print("Item put in your inventory.\n")
        inventory_insert(item_name)
    else:
        print("\nERROR: Something went wrong with buying item\n")
コード例 #5
0
def castle_quest_reward(reward):
    """Assigns quest reward to player"""

    Items[reward.weaponName] = reward.weaponStats
    Items[reward.armorName] = reward.armorStats
    inventory_insert(reward.weaponName)
    inventory_insert(reward.armorName)
    print("You were also given a " + reward.weaponName + " & " + reward.armorName)
    pause()
コード例 #6
0
ファイル: Drops.py プロジェクト: micro164/AdvGame
def quest_drop(item_type):
    """Determines what quest reward will be

    Arguments:
    item_type -- The type of the item being dropped

    """

    random.seed()
    i_list = item_list(item_type)
    item = random.choice(list(i_list.items()))
    inventory_insert(item[0])
    print("You got a " + item[0] +
          " for you efforts. It has been put in your inventory.\n")
コード例 #7
0
ファイル: Drops.py プロジェクト: micro164/AdvGame
def drop(item_type):
    """Determines what items drop from the monster

    Arguments:
    item_type -- The type of the item being dropped

    """

    random.seed()
    temp = item_list(item_type)
    key = random.choice(list(temp.items()))
    inventory_insert(key[0])
    print("The monster dropped a " + key[0] +
          ". It has been put in your inventory.\n")
コード例 #8
0
ファイル: ForestSurprises.py プロジェクト: micro164/AdvGame
def duplicate_item(choice):
    """Duplicates an item in the players Inventory when the correct sequence is pushed

    Arguments:
    choice -- The direction that the player chooses

    """

    duplication_check = [Directions.LEFT.value, Directions.LEFT.value, Directions.UP.value, Directions.RIGHT.value, Directions.DOWN.value]

    # QUESTION: Why do I have choiceList and LastDirections
    Features.choiceList.append(choice)

    if len(Features.choiceList) == 5:
        if Features.choiceList == duplication_check:
            inventory_insert(list(Player.Inventory.keys())[random.randrange(0, len(list(Player.Inventory.keys())))])
        Features.choiceList.clear()
コード例 #9
0
def delete_equip(Etype):
    '''Unequips equipment

    Arguments:
    Etype -- gives the type of the item (weapon/armor/healer/item)

    '''

    temp = equip_type_check(Etype)
    if temp:
        item_name = _find_item_name(Etype)

        if Player.Equipment[item_name][
                Item.
                Type] == Etype and Player.Equipment[item_name][Item.count] > 0:
            Player.Strength -= Player.Equipment[item_name][Item.attack]
            Player.Defense -= Player.Equipment[item_name][Item.defense]
            Player.MaxHP -= Player.Equipment[item_name][Item.HP]
            inventory_insert(item_name)
            del Player.Equipment[item_name]
    else:
        print("ERROR: could not find item in equipment")
コード例 #10
0
ファイル: Store.py プロジェクト: micro164/AdvGame
def _equip_item(item_name):
    equip_insert(item_name)
    if Items[item_name][Item.lvl] > Player.lvl:
        inventory_insert(item_name)
        print("The item has been put in your inventory\n")
コード例 #11
0
ファイル: ForestSurprises.py プロジェクト: micro164/AdvGame
def _found_item():
    print("You found an item")
    item_gained = random.choice(list(item_list('weapon')))
    inventory_insert(item_gained)
    print("A " + item_gained + " was added to your inventory.\n")