def __init__(self): self.inventory = [items.Gold(15), items.Pillow(), items.Rock()] # Inventory on startup self.hp = 100 # Health Points self.location_x, self.location_y = world.starting_position # (0, 0) self.victory = False # no victory on start up
def __init__(self): self.name = "Yellow" self.inventory = [items.Gold(15), items.Rock()] self.hp = 100 self.location_x, self.location_y = world.starting_position self.pokemon = [pokemon.Pikachu()] self.victory = False
def __init__(self): self.inventory = [ items.Rock(), items.Dagger(), 'Gold(5)', 'Crusty Bread' ] self.x = 1 self.y = 2
def __init__(self): self.inventory = [items.Rock(), items.Dagger(), items.CrustyBread()] self.x = world.start_tile_location[0] self.y = world.start_tile_location[1] self.hp = 100 self.gold = 5 self.victory = False
def __init__(self): self.inventory = [items.Gold(15), items.Rock(), items.Dagger(), items.CrustyBread()] self.hp = 100 self.victory = False self.x = 1 self.y = 2 self.hp = 100
def __init__(self): self.inventory = [ items.Rock(), items.Dagger(), items.HardTack(), items.HardTack(), items.HardTack(), items.LesserHealingPotion(), items.LesserHealingPotion(), items.GreaterHealingPotion() ] self.x = world.start_tile_location[0] self.y = world.start_tile_location[1] self.hp = 100 self.gold = 10 self.power = 2 self.victory = False self.sanity = 10 self.exp = 0 self.powerup = 1 self.fullhp = 100 self.armour = 0 self.mark = 0 self.level2_claimed = True self.level3_claimed = True self.level4_claimed = True self.level5_claimed = True self.level6_claimed = True self.level7_claimed = True self.level8_claimed = True self.level9_claimed = True self.level10_claimed = True
def __init__(self): self.inventory = [ items.Rock(), items.Dagger(), 'Gold(5)', items.CrustyBread(), items.Banana() ]
def __init__(self): self.inventory = [items.Gold(15), items.Rock(), items.CrustyBread()] self.hp = 100 #UNUSED CODE, KEPT FOR REFERENCE #self.location_x, self.location_y = world.starting_position self.x = 1 self.y = 2 self.victory = False
def __init__(self): self.inventory = [items.Rock(), items.Dagger(), 'Gold(5)', items.CrustyBread()] self.x = 1 self.y = 2 self.hp = 100
def __init__(self): self.inventory = [items.Rock(), items.VorpalSword(), items.CrustyBread()] self.armor = items.LeatherArmor() self.x = world.start_tile_location[0] self.y = world.start_tile_location[1] self.hp = 100 self.gold = 5 self.victory = False
def __init__(self): self.inventory = [items.Rock()] self.maxhp = 100 self.hp = self.maxhp self.gold = 15 self.location_x, self.location_y = world.starting_position self.victory = False self.worldMap = []
def __init__(self): self.inventory = [items.Lembas_Bread(), items.Rock()] self.hp = 75 self.location_x, self.location_y = world.starting_position self.victory = False self.xp = 0 self.level = 1 self.base_damage = 5
def __init__(self): self.inventory = [items.Rock(), items.Dagger(), items.Crusty_Bread()] self.weapon = None self.gold = 5 self.hp = 100 self.x = 2 self.y = 2
def __init__(self): self.inventory = [items.Rock(), items.Sharp_Sword(), items.MoldyBread()] self.x = world.start_tile_location[0] self.y = world.start_tile_location[1] self.hp = 100 self.pennies = 5 self.victory = False
def __init__(self): self.inventory = [items.Gold(15), items.Rock(1), items.SmallPotion(1)] self.exp = [1, 0] self.hp = 100 self.hpmax = 100 self.victory = False self.roomcounter = 0 self.slayedEnemies = 0 self.fledFromRoom = 0
def __init__(self): # Inventory self.inventory = [items.Laptop(), items.Rock()] self.x = 1 self.y = 2 # x, y coordinates for location self.hp = 30 self.drone = 0 # Determines if player can fly his drone self.money = 5
def __init__(self): self.inventory = [items.Gold(15), items.Rock()] self.hp = 100 self.maxHP = 100 self.location_x, self.location_y = world.starting_position self.victory = False self.blackouts = 0 self.generatorPiecesObtained = 0 self.nonUppClassAreaRoomsVisited = 0
class Player: inventory = [items.Gold(15), items.Rock()] hp = 100 location_x, location_y = (2, 4) victory = False def is_alive(self): return self.hp > 0 def do_action(self, action, **kwargs): action_method = getattr(self, action.method.__name__) if action_method: action_method(**kwargs) def print_inventory(self): for item in self.inventory: print(item, '\n') def move(self, dx, dy): self.location_x += dx self.location_y += dy print(world.tile_exists(self.location_x, self.location_y).intro_text()) def move_north(self): self.move(dx=0, dy=-1) def move_south(self): self.move(dx=0, dy=1) def move_east(self): self.move(dx=1, dy=0) def move_west(self): self.move(dx=-1, dy=0) def attack(self, enemy): best_weapon = None max_dmg = 0 for i in self.inventory: if isinstance(i, items.Weapon): if i.damage > max_dmg: max_dmg = i.damage best_weapon = i print("You use {} against {}!".format(best_weapon.name, enemy.name)) enemy.hp -= best_weapon.damage if not enemy.is_alive(): print("You killed {}!".format(enemy.name)) else: print("{} HP is {}.".format(enemy.name, enemy.hp)) def flee(self, tile): """Moves the player randomly to an adjacent tile""" available_moves = tile.adjacent_moves() r = random.randint(0, len(available_moves) - 1) self.do_action(available_moves[r])
def __init__(self): self.inventory = [items.Rock(), 'Gold(5)', items.Apple()] self.x = 1 self.y = 2 self.hp = 100 self.cash = 15 self.victory = False
def __init__(self): self.inventory = [ items.Gold(15), items.Rock(), items.Flashlight(), items.HydroFlask(), items.Cable() ] self.hp = 50 self.location_x, self.location_y = world.starting_position self.victory = False
def __init__(self): self.inventory = [items.Dagger(),items.Rock(),items.CrustyBread(),items.ManaPotion()] self.spell_book = [magic.magic_missle(), magic.fire_ball()] self.x = world.start_tile_location[0] self.y = world.start_tile_location[1] self.hp = 100 self.gold = 5 self.victory = False self.exp = 199 self.player_lvl = 1 self.mp = 100
def __init__(self): self.inventory = [ items.Rock(), items.Dagger(), 'Gold(5)', items.CrustyBread(), 'Bready Crust', items.Lucky_Charm() ] self.x = 1 self.y = 2 self.hp = 100 self.max_hp = 100
def __init__(self): self.inventory = [items.Rock(), items.Dagger(), items.CrustyBread()] self.spell = [spells.FireBall(), spells.IceBeam()] self.wearing = [] self.x = world.start_tile_location[0] self.y = world.start_tile_location[1] self.maxHP = 100 self.currentHP = 100 self.maxmana = 100 self.mana = 100 self.strength = 1 self.gold = 5 self.victory = False
def __init__(self, x, y): r = random.random() if r < 0.40: self.item = items.Rock() elif r < 0.65: self.item = items.WaterPouch() elif r < 0.80: self.item = items.CrustyBread() elif r < 0.90: self.item = items.Dagger() elif r < 0.96: self.item = items.HealingPotion() else: self.item = items.RustySword() self.item_claimed = False super().__init__(x, y)
def main(): a = items.Item(name='pirouni', description='voithaei stin vrosi', value=0.01) print(a) gold = items.Currency(currency_type='Silver', amount=30) print(gold) rock = items.Rock() print(rock) dagger = items.Weapon(name='Dagger', description='A small dagger', damage='d4', value=0.2) print(dagger) another_dagger = items.Dagger() print(another_dagger) assassin_suit = items.AssassinSuit() print(assassin_suit)
def __init__(self): """Player class to represent the player as they travel through the game. Attributes: -inventory: list containing items from the items.py class -hp: player's hitpoints; the game is over if they go to 0 -location_x: map horizontal location -location_y: map vertical location -victory: boolean that indicates if the player has won the game -weapon: equipped weapon -bestbag: equipped orb container -prev_tile: where the player came from -max_hp: the player's max possible """ self.inventory = [items.Gold(15), items.Rock()] self.hp = 100 self.location_x, self.location_y = world.starting_position self.victory = False self.weapon = None self.bestbag = None self.prev_tile = None self.max_hp = 100
def __init__(self, game): InventoryHolder.__init__(self, game) LivingEntity.__init__(self, game, name='You') # the position of the player self.pos = vec2(0, 0) self.victory = False self.game = game self.give_item(items.Gold(game, 15), items.Rock(game)) # slots self.item_slots = {} # strings # ------- self.str_possessive = "Your" self.str_name = "You"
def __init__(self): self.inventory = [items.Gold(15), items.Rock()] self.hp = 100 self.location_x, self.location_y = world.starting_position self.victory = False
def __init__(self, x, y): super().__init__(x, y, items.Rock())
def __init__(self): self._inventory = [items.Gold(15), items.Rock()] self._health_points = 100 self._location_x, self._location_y = world.STARTING_POSITION self._victory = False