Esempio n. 1
0
    def __init__(self, name, location):
        """
        Initializes the player.
        
        @param name:             The name of the player (e.g. "Frodo").
        @param location:         The location of player.
        """
        self._name = name
        self._location = location
        self._money = constants.STARTING_MONEY

        #Initialize player inventory and equipment
        self._inventory = ItemSet()
        self._equipped = ItemSet()

        #Initialize player stats
        self._experience = constants.STARTING_EXPERIENCE
        self._level = constants.STARTING_LEVEL

        self._hp = self._level * constants.HP_STAT
        self._maxHp = self._level * constants.HP_STAT
        self._attack = self._level * constants.ATTACK_STAT

        #Initialize items bonuses
        self._weaponAttack = 0
        self._totalAttack = self._attack + self._weaponAttack
        self._armorDefense = 0
Esempio n. 2
0
    def setUp(self):
        from items.item import Item
        from items.item_set import ItemSet

        sword = Item("sword", "made by elves", 2)
        helmet = Item("helmet", "made by men", 1)
        potion = Item("potion", "restores health", 1)

        self._itemList = [sword, helmet, potion]
        self._items = ItemSet([sword, helmet, potion])