예제 #1
0
 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
예제 #2
0
 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
예제 #3
0
 def find_loot(self, player):
     rand = random.randint(1, 1000)
     if 1 < rand < 10:
         Option.modify_player(Option, player, items.Sword(1))
         print(">A shiny sword is behind a desk, you take it.")
     elif rand == 1:
         Option.modify_player(Option, player, items.Axe(1))
         print(">You found a Axe hanging from the wall.")
     elif 10 < rand < 100:
         Option.modify_player(Option, player, items.Gold(5))
         print(">There are 5 golden Coins")
     elif 300 < rand < 400:
         Option.modify_player(Option, player, items.Gold(7))
         print(">A tiny bag of gold Coins")
     elif 500 < rand:
         print(">There is nothing here")
예제 #4
0
 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
예제 #5
0
 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
예제 #6
0
 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
예제 #7
0
 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
예제 #8
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])
예제 #9
0
 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
예제 #10
0
 def __init__(self):
     self.inventory = [items.Gold(), items.Sword()]
     self.hp = creation.hp
     self.strength = creation.strength
     self.dex = creation.dex
     self.intelligence = creation.intelligence
     self.wis = creation.wis
     self.charisma = creation.charisma
     self.con = creation.con
     self.charclass = creation.charclass
     self.location_x, self.location_y = world.starting_position
     self.victory = False
예제 #11
0
 def __init__(self):
     self.inventory = [items.Gold(15), items.Pillow(), items.Dagger(), items.Crossbow(),\
         items.Revolver(), items.FinalKey(), items.Moltov()]
     self.hp = 100
     self.maxHp = 100
     self.location_x, self.location_y = world.starting_position
     self.victory = False
     self.experience = 0
     self.level = 1
     self.money = 30
     self.attackPower = 100
     self.nextLevelUp = 10
     self.chosenWpn = None
     self.armor = False
     self.armorHits = 0
     self.currentWpn = self.inventory[1]
예제 #12
0
 def buy(self, merchant):
     x = items.Gold(1)
     bool = False
     for item in merchant.items:
         print(
             "\nItem: {} , Amount: {}, Description: {},  base Value: {}\n".
             format(item.name, item.amount, item.description, item.base))
     what = input(
         str(">You have {} Gold. What would you like to buy, or are you finished buying?"
             .format(self.inventory[0].amount)))
     for mitems in merchant.items:
         if what.upper() == "FINISH":
             return merchant
         if mitems.name.upper() == what.upper(
         ) and not what.upper() == "GOLD":
             if mitems.base > self.inventory[0].amount:
                 print("> You do not have enough gold")
                 return merchant
             else:
                 mitems.amount -= 1
                 mitems.value = mitems.base * mitems.amount
                 merchant.gold.amount += mitems.base
                 self.inventory[0].amount -= mitems.base
                 self.inventory[0].value = self.inventory[
                     0].amount * self.inventory[0].base
                 for pitems in self.inventory:
                     if pitems.name.upper() == what.upper():
                         pitems.amount += 1
                         pitems.value = pitems.amount * pitems.base
                         bool = True
                 if bool == False:
                     if mitems.amount == 0:
                         mitems.amount += 1
                         self.inventory.append(mitems)
                         mitems.amount -= 1
                         return merchant
                     else:
                         self.inventory.append(mitems)
                 if mitems.amount == 0:
                     merchant.items.remove(mitems)
     return merchant
예제 #13
0
 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
예제 #14
0
 def sell_loot(self):
     input_text = "Select item to sell:\n"
     for i in range(len(self.inventory)):
         input_text += "{}: {} ({} gold)".format(i, self.inventory[i].name,
                                                 self.inventory[i].value)
     item = input(input_text)
     valid = False
     while not valid:
         if item.lower() == "x":
             valid = True
             break
         elif item.isdigit():
             if int(item) >= 0 and int(item) < len(self.inventory):
                 valid = True
                 break
         item = input(
             "Invalid selection.  Please select from the list below.\n" +
             input_text)
     if item.lower() == "x":
         pass
     else:
         sell = self.inventory.pop(int(item))
         self.gold += items.Gold(sell.value)
예제 #15
0
    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"
예제 #16
0
 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
예제 #17
0
 def __init__(self):
     self.gold = items.Gold(100)
     self.items = []
예제 #18
0
 def __init__(self):
     self.currentPlace = ""
     self.hp = 100
     self.inventory = items.Gold(15)
     self.hunger = 0
     self.alive = True
예제 #19
0
파일: tiles.py 프로젝트: splendone/txtrpg
 def __init__(self, x, y):
     super(Find5GoldRoom, self).__init__(x, y, items.Gold(5))
예제 #20
0
 def __init__(self):
     self.inventory = [items.Gold(15), items.Dagger()]
     self.hp = 100
     self.location_x, self.location_y = world.starting_position
     self.outofcave = False
     self.victory = False
예제 #21
0
 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
예제 #22
0
파일: Player.py 프로젝트: branzhan/Tutor
 def __init__(self):
     self.inventory = [items.Gold(15), items.Rock()]
     self.hp = 100
     self.victory = False
예제 #23
0
 def __init__(self):
     self.inventory = [items.Gold(15), items.Crystals(1), items.Gloves()]
     self.hp = 150
     self.location_x, self.location_y = world.starting_position
     self.victory = False
예제 #24
0
 def __init__(self, item=items.Gold(5)):
     self.item = item
     super().__init__(item)
예제 #25
0
 def __init__(self, x, y):
     super(Find5GoldRoom, self).__init__(x, y, items.Gold(5))
     self.id = "Treasure: Gold"
예제 #26
0
    def __init__(self):
        self.inventory = [items.Gold(15), items.TatteredCloth(), items.ClothHood()]
        self.name = "Jean"
        self.name_long = "Jean Claire"
        self.hp = 100
        self.maxhp = 100
        self.maxhp_base = 100
        self.fatigue = 100  # cannot perform moves without enough of this stuff
        self.maxfatigue = 100
        self.maxfatigue_base = 100
        self.strength = 10  # attack damage with strength-based weapons, parry rating, armor efficacy, influence ability
        self.strength_base = 10
        self.finesse = 10  # attack damage with finesse-based weapons, parry and dodge rating
        self.finesse_base = 10
        self.speed = 10  # dodge rating, combat action frequency, combat cooldown
        self.speed_base = 10
        self.endurance = 10  # combat cooldown, fatigue rate
        self.endurance_base = 10
        self.charisma = 10  # influence ability, yielding in combat
        self.charisma_base = 10
        self.intelligence = 10  # sacred arts, influence ability, parry and dodge rating
        self.intelligence_base = 10
        self.faith = 10  # sacred arts, influence ability, dodge rating
        self.faith_base = 10
        self.resistance = [0,0,0,0,0,0]  # [fire, ice, shock, earth, light, dark]
        self.resistance_base = [0,0,0,0,0,0]
        self.eq_weapon = None
        self.combat_exp = 0  # place to pool all exp gained from a single combat before distribution
        self.exp = 0  # exp to be gained from doing stuff rather than killing things
        self.level = 1
        self.exp_to_level = 100
        self.location_x, self.location_y = (0, 0)
        self.current_room = None
        self.victory = False
        self.known_moves = [moves.Rest(self), moves.Use_Item(self)]
        self.current_move = None
        self.heat = 1.0
        self.protection = 0
        self.states = []
        self.in_combat = False
        self.savestat = None
        self.saveuniv = None
        self.universe = None
        self.map = None
        self.main_menu = False  # escape switch to get to the main menu; setting to True jumps out of the play loop
        self.time_elapsed = 0  # total seconds of gameplay
        self.combat_idle_msg = [
            'Jean breathes heavily.',
            'Jean anxiously shifts his weight back and forth.',
            'Jean stomps his foot impatiently.',
            'Jean carefully considers his enemy.',
            'Jean spits on the ground.',
            "A bead of sweat runs down Jean's brow.",
            'Jean becomes conscious of his own heart beating loudly.',
            'In a flash, Jean remembers the face of his dear, sweet Amelia smiling at him.',
            'With a smug grin, Jean wonders how he got himself into this mess.',
            "Sweat drips into Jean's eye, causing him to blink rapidly.",
            'Jean misses the sound of his daughter laughing happily.',
            'Jean recalls the sensation of consuming the Eucharist and wonders when - if - that might happen again.',
            'Jean mutters a quick prayer under his breath.',
            'Jean briefly recalls his mother folding laundry and humming softly to herself.',
            ]

        self.combat_hurt_msg = [
            'Jean tastes blood in his mouth and spits it out.',
            'Jean winces in pain.',
            'Jean grimaces.',
            "There's a loud ringing in Jean's ears.",
            'Jean staggers for a moment.',
            "Jean's body shudders from the abuse it's received.",
            'Jean coughs spasmodically.',
            "A throbbing headache sears into Jean's consciousness."
            "Jean's vision becomes cloudy and unfocused for a moment.",
            'Jean vomits blood and bile onto the ground.',
            '''Jean whispers quietly, "Amelia... Regina..."''',
            '''A ragged wheezing escapes Jean's throat.''',
            '''A searing pain lances Jean's side.'''
            '''A sense of panic wells up inside of Jean.'''
            '''For a brief moment, a wave of fear washes over Jean.'''
        ]
예제 #27
0
 def __init__(self, x, y):
     super().__init__(x, y, items.Gold(5), "It's 5 gold coins!")
예제 #28
0
 def __init__(self, x, y):
     super().__init__(x, y, items.Gold(random.randint(1, 10)))
 def __init__(self, x, y):
     super().__init__(x, y, items.Gold(5))
예제 #30
0
 def __init__(self, x, y):
     super().__init__(x, y, items.Gold(300), "It's a treasure chest filled with gold coins!")