コード例 #1
0
ファイル: worldmap.py プロジェクト: arthur-hav/hexrl
 def __init__(self, father):
     CascadeElement.__init__(self)
     self.inventory_display = StatusDisplay(self)
     self.mob_list = []
     self.current_question_key = ''
     self.previous_question = ''
     self.current_question = None
     self.bg = SimpleSprite('menu.png')
     self.inventory = []
     self.cursor = SimpleSprite('icons/magnifyingglass.png')
     self.pc_position = GameTile(0, 0)
     self.pc_sprite = SimpleSprite('tiles/Fighter.png')
     self.map = WorldMap(0)
     self.subsprites = [
         self.bg, self.inventory_display, self.map, self.pc_sprite,
         self.cursor
     ]
     self.formation = [
         (-2, 4),
         (-1, 4.5),
         (0, 4),
         (1, 4.5),
         (2, 4),
     ]
     Interface.__init__(self,
                        father,
                        keys=[
                            ('(up|down)(left|right)?', self.move),
                            (K_ESCAPE, self.quit),
                        ])
コード例 #2
0
 def __init__(self, defkey, is_pc=False):
     CascadeElement.__init__(self)
     self.is_ranged = False
     self.health = 0
     self.maxhealth = 0
     self.damage = 0
     self.armor = 0
     self.magic_resist = 0
     self.passives = []
     self.status = []
     self.abilities = []
     self.items = []
     self.rooted = []
     self.silenced = []
     self.frames = []
     self.tile = None
     self.combat = None
     self.next_action = 0
     self.free_moves = self.FREE_MOVES
     self.shield = 0
     self.is_pc = is_pc
     self.defkey = defkey
     self.health_gauge = SideHealthGauge(self)
     self.shield_gauge = SideShieldGauge(self)
     self.load_def(defkey)
コード例 #3
0
ファイル: worldmap.py プロジェクト: arthur-hav/hexrl
    def __init__(self, father):
        CascadeElement.__init__(self)
        self.bg = SimpleSprite('helpmodal.png')
        self.bg.rect.x, self.bg.rect.y = 302, 200
        self.text = TextSprite('Items to buy. [Esc] to leave.', '#ffffff', 330,
                               250)
        self.items = []
        self.item_texts = []
        father.desactivate()
        for i in range(3):
            choice = random.choice(list(items.ITEMS.keys()))
            item_class = items.ITEMS[choice][0]
            item_args = items.ITEMS[choice][1]
            item = item_class(*item_args)
            self.items.append(item)
            self.item_texts.append(
                TextSprite(
                    "[%d]: %s - %d gold" % (i + 1, item.name, item.shop_price),
                    "#ffffff", 368, 304 + 40 * i))

        Interface.__init__(self,
                           father,
                           keys=[
                               (K_ESCAPE, self.leave),
                               ('[1-3]', self.buy),
                           ])
コード例 #4
0
ファイル: worldmap.py プロジェクト: arthur-hav/hexrl
 def __init__(self, father):
     CascadeElement.__init__(self)
     Interface.__init__(self,
                        father,
                        keys=[(K_ESCAPE, self.cancel),
                              (K_RETURN, self.cancel)])
     self.basex, self.basey = 302, 200
     self.bg = SimpleSprite('helpmodal.png')
     self.bg.rect.move_ip(self.basex, self.basey)
     self.text = TextSprite('Your party is dead. Game Over.',
                            '#ffffff',
                            330,
                            250,
                            maxlen=350)
     self.subsprites = [self.bg, self.text]
     self.display()
コード例 #5
0
ファイル: choices.py プロジェクト: arthur-hav/hexrl
 def __init__(self, father, tavern):
     CascadeElement.__init__(self)
     self.bg = SimpleSprite('helpmodal.png')
     self.bg.rect.x, self.bg.rect.y = 262, 200
     self.text = TextSprite('Enter a word or two about your inquiry',
                            '#ffffff', 274, 250)
     self.question = TextSprite('', '#ffffff', 274, 300)
     self.word = ''
     self.tavern = tavern
     self.subsprites = [self.bg, self.text, self.question]
     Interface.__init__(self,
                        father,
                        keys=[
                            (K_ESCAPE, lambda x: self.done()),
                            ('[a-z ]', self.typing),
                            (K_BACKSPACE, self.erase),
                            (K_RETURN, self.validate),
                        ])
コード例 #6
0
ファイル: worldmap.py プロジェクト: arthur-hav/hexrl
 def __init__(self, father, item):
     CascadeElement.__init__(self)
     self.item = item
     self.bg = SimpleSprite('helpmodal.png')
     self.bg.rect.x, self.bg.rect.y = 302, 200
     self.text = TextSprite(
         'Apply to adventurer with [1-5]. [Esc] to cancel.',
         '#ffffff',
         330,
         250,
         maxlen=350)
     self.stats = TextSprite(str(item), '#ffffff', 330, 220, maxlen=350)
     self.subsprites = [self.bg, self.stats, self.text]
     Interface.__init__(self,
                        father,
                        keys=[
                            (K_ESCAPE, lambda x: self.done()),
                            ('[1-5]', self.equip),
                        ])
コード例 #7
0
ファイル: worldmap.py プロジェクト: arthur-hav/hexrl
 def __init__(self):
     CascadeElement.__init__(self)
     self.bg = SimpleSprite('menu.png')
     self.hello = TextSprite('Choose a save slot with keys 1-3', '#ffffff',
                             320, 280)
     self.slots = []
     for i in range(3):
         try:
             slotname = 'Day %d' % json.load(open('save%d.json' %
                                                  (i + 1)))['level']
         except FileNotFoundError:
             slotname = 'Empty'
         self.slots.append(
             TextSprite('[%d] Slot - %s' % (i + 1, slotname), '#ffffff',
                        320, 300 + 20 * i))
     self.subsprites = [self.bg, self.hello] + self.slots
     Interface.__init__(self,
                        None,
                        keys=[
                            (K_ESCAPE, lambda x: self.done()),
                            ('[1-3]', self.start),
                        ])
コード例 #8
0
 def display(self):
     if self.combat:
         CascadeElement.display(self)
     SimpleSprite.display(self)