Ejemplo n.º 1
0
 def handleReceiveGive(self,
                         givingAgent,
                         entityToGive):
     if entityToGive == Item.getItem('Note from Adventurer'):
         self.speak("So I guess Alec didn't make it.  It's a shame.  I'll give the note to Stephanie next time I see her.")
         entityToGive.changeOwner(self)
     else:
         self.speak("What do I look like?  An old canvas sack?  I'm not here to hold onto all that random shit you're picking up, dude.")
Ejemplo n.º 2
0
 def handleReceivingUnlock(self,
                  unlockingAgent,
                  entityToUnlockWith=None):
     if not self.door.locked:
         raise CannotPerformAction('%s is already unlocked.' %
                                   self.getDisplayNameWithDefiniteArticle())
     if entityToUnlockWith == Item.getItem('Blue Key'):
         self.door.locked = False
         print 'You unlock the door.'
     elif entityToUnlockWith is not None:
         raise CannotPerformAction('You cannot unlock %s with %s' %
                                   self.getDisplayNameWithDefiniteArticle(),
                                   entityToUnlockWith.getDisplayNameWithDefiniteArticle())
     else:
         raise CannotPerformAction(
                     'You cannot unlock %s with your bare hands' %
                     self.getDisplayNameWithDefiniteArticle())
Ejemplo n.º 3
0
 def handleReceiveThrowAt(self,
                        throwingAgent,
                        itemBeingThrown,
                        receivingEntity):
     if itemBeingThrown == Item.getItem('Dagger'):
         print ('The dagger pierces the wolf in the throat.  It lets out '
                'a blood-chilling whine and collapses on the ground.')
         itemBeingThrown.changeOwner(newOwner=receivingEntity,
                                toSlot='inside')
         receivingEntity.inventory.slots['inside'].exposed = True
         receivingEntity.stateMachine.changeState(wolfDeadState)
         receivingEntity.names.append('body')
         
     else:
         print ('The %s hits the wolf squarely in the jaw.  The wolf lunges at you, '
               'tearing out your throat as you go down.' %\
                 itemBeingThrown.getDisplayName())
         raise PlayerDeath()
Ejemplo n.º 4
0
 def handleReceivingLock(self,
                lockingAgent,
                entityToLockWith=None):
     if self.door.locked:
         raise CannotPerformAction('%s is already locked.' %
                                   self.getDisplayNameWithDefiniteArticle())
     if self.door.open:
         raise CannotPerformAction('%s is open.  It cannot be locked at this time.' %
                                   self.getDisplayNameWithDefiniteArticle())
     if entityToLockWith == Item.getItem('Blue Key'):
         self.door.locked = True
         print 'You lock the door.'
     elif entityToLockWith is not None:
         raise CannotPerformAction('You cannot lock %s with %s' %
                                   self.getDisplayNameWithDefiniteArticle(),
                                   entityToLockWith.getDisplayNameWithDefiniteArticle())
     else:
         raise CannotPerformAction(
                     'You cannot lock %s with your bare hands' %
                     self.getDisplayNameWithDefiniteArticle())
Ejemplo n.º 5
0
def fillContainers():
    wall = Item.getItem('Wall')
    pathToTown = Item.getItem('Path To Town')
    
    player = Agent.getAgent('Player')
    player.addEntity(Item.getItem('Note from Unknown Party'))
    
    table = Item.getItem('Table')
    sunlightRoom = Room.getRoom('Sunlight Room')
    sunlightRoom.addEntity(Item.getItem('Note from Adventurer'))
    sunlightRoom.addEntity(table)
    sunlightRoom.addEntity(wall)
    table.addEntity(Item.getItem('Apple'))
    table.addEntity(Item.getItem('Paper'))
    table.addEntity(Item.getItem('Pencil'))
    
    sack = Item.getItem('Canvas Sack')
    entrance = Room.getRoom('Entrance')
    entrance.addEntity(pathToTown)
    entrance.addEntity(wall)
    entrance.addEntity(sack)
    sack.addEntity(Item.getItem('Dagger'))
    
    pathToTownLocation = Room.getRoom('North Of Town')
    pathToTownLocation.addEntity(Item.getItem('Rock'))
    pathToTownLocation.addEntity(pathToTown)
    
    townGate = Room.getRoom('Town Gate')
    townGate.addEntity(Item.getItem('Rope'))
    
    wolfDen = Room.getRoom('Wolf Den')
    wolfDen.addEntity(Agent.getAgent('Wolf'))
    wolfDen.addEntity(Item.getItem('Blue Key'))
    
    townPlaza = Room.getRoom('Town Plaza')
    townPlaza.addEntity(Agent.getAgent('Dark Henry'))    
    
    pond = Room.getRoom('Pond')
    tree = Item.getItem('Tree')
    pond.addEntity(tree)
    tree.addEntity(Item.getItem('Acorn'))
    pond.addEntity(Item.getItem('Pond'))
    
    darkRoom = Room.getRoom('Dark Room')
    darkRoom.addEntity(Item.getItem('Crate'))