Exemple #1
0
def throw(chosenThing):
    """ makes the player throw something. """
    global location

    # verify the thing exists
    thing = things.getByTitle(chosenThing)
    if not thing:
        print "You cannot do that."
        print
        return

    if thing.location in [location, 'INVENTORY'] and "moveable" in thing.tags:

        # The only objects that have special rules for throwing is the sauce. Everything else is treated as though you dropped it.
        if chosenThing == 'sauce':
            print "You throw the jar of sauce. It breaks open, spattering thick, dark red liquid everywhere."

            # Now, the sauce is out of your inventory, no longer moveable, and has new descriptive text.
            thing.location = location
            thing.tags.remove('moveable')
            thing.tags.append('broken')
            thing.short_description = "Slick, dark red tomato sauce is seeping across the floor."
            thing.long_description = "The tomato sauce looks horribly like blood as it seeps across the pizzeria floor."
            return

        elif chosenThing != 'sauce':
            thing.location = location
            print "You throw the", thing.title
            print
            return
Exemple #2
0
def throw (chosenThing):
  """ makes the player throw something. """
  global location
   
  # verify the thing exists
  thing = things.getByTitle (chosenThing)
  if not thing:
    print "You cannot do that."
    print
    return
  
  if thing.location in [location, 'INVENTORY'] and "moveable" in thing.tags:
    
    # The only objects that have special rules for throwing is the sauce. Everything else is treated as though you dropped it.
    if chosenThing == 'sauce':
      print "You throw the jar of sauce. It breaks open, spattering thick, dark red liquid everywhere."
      
      # Now, the sauce is out of your inventory, no longer moveable, and has new descriptive text.
      thing.location = location
      thing.tags.remove ('moveable')
      thing.tags.append ('broken')
      thing.short_description = "Slick, dark red tomato sauce is seeping across the floor."
      thing.long_description = "The tomato sauce looks horribly like blood as it seeps across the pizzeria floor."      
      return
      
    elif chosenThing != 'sauce':
      thing.location = location
      print "You throw the", thing.title
      print
      return
Exemple #3
0
def unwear (chosenThing):
  """ makes the player remove something they are wearing. """
  global location
  
  # does this thing exist?
  thing = things.getByTitle (chosenThing)
  if not thing:
    print "You cannot do that."
    return

  # we can only unwear an item that we are wearing.
  if thing.location == 'WORN':
    thing.location = "INVENTORY"
    print "You remove the", thing.title
    print
  else:
    print "You cannot do that."
Exemple #4
0
def unwear(chosenThing):
    """ makes the player remove something they are wearing. """
    global location

    # does this thing exist?
    thing = things.getByTitle(chosenThing)
    if not thing:
        print "You cannot do that."
        return

    # we can only unwear an item that we are wearing.
    if thing.location == 'WORN':
        thing.location = "INVENTORY"
        print "You remove the", thing.title
        print
    else:
        print "You cannot do that."
Exemple #5
0
def turnOn (chosenThing):
  """ makes the player turn something on. """
  global location
  
  # does this thing exist?
  thing = things.getByTitle (chosenThing)
  if not thing:
    print "You cannot do that."
    return
    
  # we can only turn on a thing that we are carrying.
  if thing.location in [location, 'INVENTORY'] and "off" in thing.tags:
    thing.tags.remove ("off")
    thing.tags.append ("on")
    print "You turn on the", thing.title
    print
  else:
    print "You cannot do that."
    print
Exemple #6
0
def examine (chosenThing):
  """ makes the player examine something nearby. """
  global location
  
  # does this thing exist?
  thing = things.getByTitle (chosenThing)
  if not thing:
    print "You cannot do that."
    print
    return
    
  # to examine a thing it must either be in the room, in your inventory, or worn, and it must not be hidden
  if thing.location in [location, 'INVENTORY', 'WORN'] and "hidden" not in thing.tags:
    print thing.long_description
    print
  else:
    print "You cannot do that."
    print
    return   
Exemple #7
0
def turnOn(chosenThing):
    """ makes the player turn something on. """
    global location

    # does this thing exist?
    thing = things.getByTitle(chosenThing)
    if not thing:
        print "You cannot do that."
        return

    # we can only turn on a thing that we are carrying.
    if thing.location in [location, 'INVENTORY'] and "off" in thing.tags:
        thing.tags.remove("off")
        thing.tags.append("on")
        print "You turn on the", thing.title
        print
    else:
        print "You cannot do that."
        print
Exemple #8
0
def drop (chosenThing):
  """ makes the player drop something they are carrying. """
  global location
  
  # does this thing exist?
  thing = things.getByTitle (chosenThing)
  if not thing:
    print "You cannot do that."
    print
    return
  
  # we can only drop an item that is in our inventory, or that is currently worn.
  if thing.location in ['INVENTORY', 'WORN']:
    thing.location = location
    print "You drop the", thing.title
    print
  else:
    print "You cannot do that."
    print
    return   
Exemple #9
0
def drop(chosenThing):
    """ makes the player drop something they are carrying. """
    global location

    # does this thing exist?
    thing = things.getByTitle(chosenThing)
    if not thing:
        print "You cannot do that."
        print
        return

    # we can only drop an item that is in our inventory, or that is currently worn.
    if thing.location in ['INVENTORY', 'WORN']:
        thing.location = location
        print "You drop the", thing.title
        print
    else:
        print "You cannot do that."
        print
        return
Exemple #10
0
def examine(chosenThing):
    """ makes the player examine something nearby. """
    global location

    # does this thing exist?
    thing = things.getByTitle(chosenThing)
    if not thing:
        print "You cannot do that."
        print
        return

    # to examine a thing it must either be in the room, in your inventory, or worn, and it must not be hidden
    if thing.location in [location, 'INVENTORY', 'WORN'
                          ] and "hidden" not in thing.tags:
        print thing.long_description
        print
    else:
        print "You cannot do that."
        print
        return
Exemple #11
0
def take (chosenThing):
  """ makes the player pick up something nearby. """
  global location
  
  # does this thing exist?
  thing = things.getByTitle (chosenThing)
  if not thing:
    print "You cannot do that."
    print
    return

  # is it both here, AND moveable?
  if thing.location == location and "moveable" in thing.tags:
    thing.location = "INVENTORY"
    print "You take the", chosenThing
    print
    return
  else:
    print "You cannot do that."
    print
    return
Exemple #12
0
def take(chosenThing):
    """ makes the player pick up something nearby. """
    global location

    # does this thing exist?
    thing = things.getByTitle(chosenThing)
    if not thing:
        print "You cannot do that."
        print
        return

    # is it both here, AND moveable?
    if thing.location == location and "moveable" in thing.tags:
        thing.location = "INVENTORY"
        print "You take the", chosenThing
        print
        return
    else:
        print "You cannot do that."
        print
        return
Exemple #13
0
def turnOff (chosenThing):
  """ makes the player turn something off. """
  global location
  
  # does this thing exist?
  thing = things.getByTitle (chosenThing)
  if not thing:
    print "You cannot do that."
    return
    
  # we can only turn off an item that is nearby.
  if thing.location in [location, 'INVENTORY'] and "on" in thing.tags:
    thing.tags.remove ("on")
    thing.tags.append ("off")
    print "You turn off the", thing.title
    print
    return
  
  else:
    # The thing wasn't here.
    print "You cannot do that."
    print
Exemple #14
0
def turnOff(chosenThing):
    """ makes the player turn something off. """
    global location

    # does this thing exist?
    thing = things.getByTitle(chosenThing)
    if not thing:
        print "You cannot do that."
        return

    # we can only turn off an item that is nearby.
    if thing.location in [location, 'INVENTORY'] and "on" in thing.tags:
        thing.tags.remove("on")
        thing.tags.append("off")
        print "You turn off the", thing.title
        print
        return

    else:
        # The thing wasn't here.
        print "You cannot do that."
        print
Exemple #15
0
def wear (chosenThing):
  """ makes the player wear something. """
  global location
  
  # does this thing exist?
  thing = things.getByTitle (chosenThing)
  if not thing:
    print "You cannot do that."
    print
    return

  # we can only wear an item that is in the current room, or in the inventory, and it has to be wearable
  if thing.location in [location, 'INVENTORY'] and "wearable" in thing.tags:
    thing.location = "WORN"
    print "You wear the", thing.title
    print
  
  # wait, are you already wearing it?
  elif thing.location == 'WORN':
    print "You are already wearing the", thing.title
    print  
  else:
    print "You cannot do that."
    print
Exemple #16
0
def wear(chosenThing):
    """ makes the player wear something. """
    global location

    # does this thing exist?
    thing = things.getByTitle(chosenThing)
    if not thing:
        print "You cannot do that."
        print
        return

    # we can only wear an item that is in the current room, or in the inventory, and it has to be wearable
    if thing.location in [location, 'INVENTORY'] and "wearable" in thing.tags:
        thing.location = "WORN"
        print "You wear the", thing.title
        print

    # wait, are you already wearing it?
    elif thing.location == 'WORN':
        print "You are already wearing the", thing.title
        print
    else:
        print "You cannot do that."
        print