Пример #1
0
 def __init__(self):
     self.gold = 0
     self.weapon = items.Weapon("Short Sword", 0, 1, 5)
     self.shield = items.Shield("Wooden Shield", 0, 1)
     self.armor = items.Armor("Leather Scraps", 0, 1)
     self.potion = items.Potion("Healing Potion", 0, 15)
     self.potion_counter = 1
Пример #2
0
def load_char_if_saved():
    query = Query()

    if db is not None:
        var = db.search(query.name == name_to_load)

        if var:
            var = var[0]
            ch.name = var.get('name')
            ch.coins = var.get('coins')
            inventory = var.get('inventory')

            player_inventory = []
            for thing in inventory:
                if thing.get('type') == 'item':
                    item = items.Item(thing.get('name'), thing.get('price'))
                    player_inventory.append(item)
                elif thing.get('type') == 'weapon':
                    weap = items.Weapon(thing.get('name'), thing.get('price'),
                                        thing.get('damage'))
                    player_inventory.append(weap)
                elif thing.get('type') == 'armor':
                    armor = items.Armor(thing.get('name'), thing.get('price'),
                                        thing.get('defense'))
                    player_inventory.append(armor)
                elif thing.get('type') == 'potions':
                    potion = items.Potion(thing.get('name'),
                                          thing.get('price'),
                                          thing.get('health'))
                    player_inventory.append(potion)

            ch.inventory = player_inventory
Пример #3
0
def main():
    sword = weapons.Sword('Sword', 2)
    magic_wand = weapons.MagicWand('Magic wand', 2)
    anzacel = battle_engine.Player(
        name='Anzacel',
        max_hp=10,
        stat_dict={
            (battle_engine.PHYSICAL, battle_engine.POWER): 1,
            (battle_engine.PHYSICAL, battle_engine.STRENGTH): 2,
            (battle_engine.PHYSICAL, battle_engine.RESISTANCE): 2,
            (battle_engine.PHYSICAL, battle_engine.ARMOR): 0,
            (battle_engine.SPECIAL, battle_engine.POWER): 0.5,
            (battle_engine.SPECIAL, battle_engine.STRENGTH): 2,
            (battle_engine.SPECIAL, battle_engine.RESISTANCE): 1,
            (battle_engine.SPECIAL, battle_engine.ARMOR): 0,
        },
        speed=10,
        inventory=[items.BerserkerPotion(),
                   items.Potion(), sword, magic_wand],
        abilities=[abilities.Pray(0.5, 1.25, 0.5, 0.75, 3)])

    battle = battle_engine.Battle(
        [anzacel],
        [enemies.PapaRoach(), enemies.HornDog()])
    battle.start()
Пример #4
0
 def shop_list(self):
     return [
         items.Dagger(),
         items.Sword(),
         items.Broadsword(),
         items.Potion()
     ]
Пример #5
0
 def __init__(self):
     self.inventory = [items.Potion()]
     self.hp = 20
     self.location_x, self.location_y = world.starting_position
     #sets the player's starting position to the StartingRoom tile
     self.victory = False
     self.in_battle = False
     self.in_shop = False
     self.currency = 20
Пример #6
0
 def __init__(self, hp):
     super().__init__(hp)
     self.weapon = items.Shortsword()
     self.starting_power = 0
     self.starting_evasion = 0
     self.inventory = [items.Potion()]
     self.zenny = 1
     self.special = 'special'
     self.name = 'Hero'
     self.armor = items.Unarmored()
Пример #7
0
    def __init__(self):

        self.itemlist = [
            items.Weapon("Better Sword", 2, 2, 7),
            items.Armor("Better Armor", 2, 2),
            items.Shield("Better Shield", 2, 2),
            items.Weapon("Ultra Sword", 8, 10, 15),
            items.Armor("Ultra Armor", 8, 8),
            items.Shield("Ultra Shield", 8, 10)
        ]
        self.potion = items.Potion("Healing Potion", 1, 10)
Пример #8
0
 def __init__(self):
     self.name = "Merchant"
     self.gold = 1000
     self.inventory = [
         items.Estus(),
         items.Humanity(),
         items.Greatsword(),
         items.Broadsword(),
         items.Great_Potion(),
         items.Potion(),
         items.Potion(),
         items.Great_Potion(),
         items.Great_Potion(),
         items.Great_Potion(),
         items.Great_Potion(),
         items.Potion(),
         items.Potion(),
         items.Great_Potion(),
         items.Potion()
     ]
Пример #9
0
def create_shop_list_potion():

    lista = [
        "Minus Health 15", "Medium Health 30", "Big Health 70",
        "Full Restore 150"
    ]

    shop_list = list()

    for item in lista:
        novo = item.split()

        if len(novo) == 3:
            temp = " ".join(novo[0:2])
            novo[0] = temp
            novo[1] = novo[2]

        shop_list.append(items.Potion(novo[0], novo[1]))

    return shop_list
Пример #10
0
                    return False
            else:
                pass  # }}}

    def Choose_target(self):  # {{{
        print()
        while True:
            for num, i in enumerate(foes):
                print('{}. {}'.format(num + 1, i.name))
            try:
                target = int(input("Which target? "))
                if target < len(foes) - 1 or target > len(foes):
                    print("\nInvalid target\n")
                else:
                    return target - 1
            except ValueError:
                print("\nInvalid input\n")  # }}}
                continue


town = locations.Town()
hero = characters.Hero(50)
hero.weapon = items.Sword()
foes = [characters.Goblin(10), characters.Goblin(10)]
hero.Add_effect(effects.Poison(2))
hero.add_item(items.Potion(), 5)
hero.add_item(items.Longsword(), 1)
fight = Battle()
fight.Battle_start()
fight.Battle_engine()
Пример #11
0
    start_room = rooms.Room("The Entrance", n=True)
    end_room = rooms.Room("The Bee Room", s=True, n=start_room)

    # Initialise a map
    game_map = rooms.Map([[start_room], [end_room]], start_room, end_room)

    # String var name
    name = "Jordan Hay"

    # Create player object
    player = Player(name, game_map)
    player.inventory().add_items([
        items.Item("Bees"),
        items.Weapon("A HIVE FULL OF BEES", 10, 300),
        items.Armour("Honeycomb Kneepads", 100),
        items.Potion("10mL Syringe full of Honey", 10)
    ])

    # After ten seconds the name will change
    root.after(10000, lambda: name.set("Different name"))

    # Display player inventory
    #player.inventory().gui(root)

    # Display player stats
    player.gui(root)

    # Root mainloop
    root.mainloop()
Пример #12
0
 def __init__(self):
     self.name = "Merchant"
     self.gold = 200
     self.inventory = [items.Berries(), items.Mushrooms(), items.Potion()]
Пример #13
0
]

# --- Armour

armour = [
    items.Armour("MDF Shield", 5),
    items.Armour("Sheet Metal Shield", 6),
    items.Armour("Wooden Breastplate", 7),
    items.Armour("Sheet Metal Breastplate", 10),
    items.Armour("Shin Pads", 15)
]

# --- Potions

potions = [
    items.Potion("Water", 5),
    items.Potion("Fresh Mountain Water", 20),
    items.Potion("Hot Chocolate", 10),
    items.Potion("Sustenance Bar", 30),
    items.Potion("Green Syringe", 50)
]

# --- Collection of all items

castle_items = weapons
castle_items.extend(armour)
castle_items.extend(potions)

# -- Enemies

# Dracula
Пример #14
0
 def __init__(self, x, y):
     amount = random.randrange(20, 65, 5)
     super().__init__(x, y, items.Potion(amount, x, y))