Ejemplo n.º 1
0
    def sail(self):
        """Runs every event, or the distance, to the town and adjusts according
        to the speed set by the player."""

        events = event.Library()

        # To do, figure out better way to manage speed
        for i in xrange(0, self.distance+carmine.speed):
            # Each river event costs the player's ship 5hp for wear & tear
            # in post-apocalyptic environments (everything is post-
            # apocalyptic... I think)
            carmine.change(hp=-5, place="River")
            tools.clear(5)
            print 'Day {} - Health: {}\n'.format(carmine.day,
                                                 carmine.hp)
            events.generate(self.odds)

            tools.next()
            carmine.change(day=1)

        carmine.change(place=self.name)
        tools.clear()
        print 'Day {} - Health: {}\n'.format(carmine.day, carmine.hp)
        result = self.enter()
        carmine.change(day=1)

        return result
Ejemplo n.º 2
0
    def sail(self):
        """Runs every event, or the distance, to the town and adjusts according
        to the speed set by the player."""

        events = event.Library()

        # To do, figure out better way to manage speed
        for i in xrange(0, self.distance + carmine.speed):
            # Each river event costs the player's ship 5hp for wear & tear
            # in post-apocalyptic environments (everything is post-
            # apocalyptic... I think)
            carmine.change(hp=-5, place="River")
            tools.clear(5)
            print 'Day {} - Health: {}\n'.format(carmine.day, carmine.hp)
            events.generate(self.odds)

            tools.next()
            carmine.change(day=1)

        carmine.change(place=self.name)
        tools.clear()
        print 'Day {} - Health: {}\n'.format(carmine.day, carmine.hp)
        result = self.enter()
        carmine.change(day=1)

        return result
Ejemplo n.º 3
0
    def display(self, text):
        """Takes a given prompt and fills the ui lines for proper printing."""
        # TO DO: Fix hardcoded numbers
        # This has to update player stats by rereading the whole dictionary
        # every time :/
        self._mkdict()
        tools.clear(self.clear)
        count = 1
        find = 0
        cont = False
        working = text

        while working:

            # find a line break (if any) including up to the very possible end,
            # hence the +1 anything beyond is certain to be a part of the next
            # line
            if '\n' in working[:self.length+1]:
                find = working.find('\n')
            else:
                find = self.length

            fillkey = 'line' + str(count)

            # set the line# with the string that should be under the max
            # character limit
            if self.fill.get(fillkey) == "":
                self.fill[fillkey] = working[:find]
            else:
                # if there is more text than available lines, we need
                # another box
                cont = True
                break

            # QUESTION, when break is called, it still removes the last
            # used statement, HOW?
            working = working[find:].lstrip('\n')
            count += 1

        print self.frame.format(**self.fill)

        if cont:
            tools.next()
            self.display(working)
Ejemplo n.º 4
0
    def scenario(self):
        print "Are you properly disposing of your compostable waste?"

        response = self.ask('Your answer?', ['No...', 'LIE!'])

        if response == 1:
            print '50/50 shot...'
            tools.next()
            if random.randint(0, 1) == 1:
                response = 2

        if response == 2:
            print 'Uh-huh... we need to have a chat [+2 days] [-10 health]'
            carmine.change(hp=-10, day=2)
        elif response == 1:
            print 'Alright then, carry on...'
        elif response == 0:
            print 'Well, in this part of the river we compost, let me tell \
                   you why... [+1 day] [-5 health]'
            carmine.change(hp=-5, day=1)
        else:
            self.error()