// ****************************************************************************
//
// Logic 90: Game-specific functions
//
// You should use this logic to perform any game specific functions, such as
// counting down timers, etc and processing player input related to the game
// (such as examining/using inventory items) and any other things that are
// required in several rooms that you don't want to duplicate in each room.
//
// This logic is called from logic 0, on every cycle.
// If you like, you could only make it called only when disable_game_functions
// is not set.
//
// Sierra did not use a separate logic for all this - they just did it all
// from logic 0. I find it is neater this way, as you can keep your game
// specific processing separate from other system-related things (although
// these may require some modification for your game). Also, this makes logic 0
// easier to manage.
//
// ****************************************************************************

#include "defines.txt"

// put all non-input-reponse game functions here

if (input_recieved &&
    unknown_word_no == 0 &&
    !input_parsed) {

// put various input responses here

  if ((said("bad word","rol") ||
       said("anyword", "bad word", "rol") ||
       said("anyword", "anyword", "bad word", "rol") ||
       said("anyword", "anyword", "anyword", "bad word","rol") ||
       said("anyword", "anyword", "anyword", "anyword", "bad word", "rol") ||
       said("anyword", "anyword", "anyword", "anyword", "anyword", "bad word", "rol"))) {
    v252 = v252 + 1;
    if (v252 == 1) {
      print("I am going to tell on you!");
    }
    if (v252 == 2) {
      print("Don't say anymore words like that!");
    }
    if (v252 == 3) {
      print("Don't say I didn't warn you.");
      quit(1);
    }
  }

  if (said("look", "sleep moss")) {
    if (has("sleep moss")) {
      show.obj(sleep_moss_);
    }
    else {
      print("You don't have any.");
    }
  }

  if (said("look","poison berries")) {
    if (has("poison berries")) {
       show.obj(poison_berries_);
    }
    else {
       print("You don't have any.");
       }
    }

  if (said("look","sleep potion")) {
    if (has("sleep potion")) {
       show.obj(sleep_potion);
       }
    else {
       print("You don't have one.");
       }
    }

  if (said("look","poison")) {
    if (has("poison")) {
       show.obj(poison);
       }
    else {
       print("You don't have any.");
       }
    }

  if (said("look","handle")) {
    if (has("handle")) {
        show.obj(handle);
        }
    else {
       print("You don't have one.");
       }
    }

  if (said("look","purple slime")) {
     if (has("purple slime")) {
         show.obj(purple_slime);
         }
     else {
        print("You don't have any.");
        }
     }

  if (said("look","cauldron")) {

      if (has("golden cauldron")) {
          show.obj(gold_cauldron);
          return();
          }

      if (has("cauldron")) {
          show.obj(cauldron);
          }
      else {
          print("You don't have one.");
          }
      }

  if (said("look","blue mushroom")) {
      if (has("blue mushroom")) {
          show.obj(blue_mushroom);
          }
      else {
         print("You don't have one.");
         }
      }

  if (said("look","slime eater")) {
      if (has("slime eater")) {
          show.obj(slime_eater);
          }
      else {
          print("You don't have any.");
          }
      }


  if (said("look","yellow grave mold")) {
      if (has("yellow grave mold")) {
          show.obj(yellow_grave);
          }
      else {
          print("You don't have any.");
          }
     }

  if (said("look","dream brew")) {
      if (has("dream brew")) {
          show.obj(dream_brew);
          }
      else {
         print("You don't have any.");
         }
      }

  if (said("look","eye of newt")) {
      if (has("eye of newt")) {
          show.obj(eye_newt);
          }
      else {
          print("You don't have one.");
          }
     }

  if (said("look","fishing rod")) {
      if (has("fishing rod")) {
          show.obj(fishing_rod);
          }
      else {
          print("You don't have one.");
          }
      }

  if (said("look","vile chug")) {
      if (has("vile chug")) {
          show.obj(vile_chug);
          }
      else {
          print("You don't have one.");
          }
      }

  if (said("look","blowfish venom")) {
     if (has("blowfish venom")) {
           show.obj(blow_venom);
           }
     else {
          print("You don't have any.");
          }
     }

  if (said("look","voodoo doll")) {
     if (has("voodoo doll")) {
         show.obj(voodoo_doll);
         }
     else {
         print("You don't have one.");
         }
     }

  if (said("look","bone rattle")) {
      if (has("bone rattle")) {
          show.obj(bone_rattle);
          }
      else {
          print("You don't have one.");
          }
      }



  if ((said("look","blowfish") ||
       said("look","fish"))) {
      if (has("blowfish")) {
          show.obj(blow_fish);
          }
      else {
          print("You don't have one.");
          }
      }

  if (said("look","puppet mange")) {
      if (has("puppet mange")) {
          show.obj(puppet_mange);
          }
      else {
          print("You don't have any.");
          }
      }

  if (said("look","mangy doll")) {
      if (has("mangy doll")) {
          show.obj(mangy_doll);
          }
      else {
          print("You don't have one.");
          }
      }

  if ((said("look","fragment") ||
       said("look","fragment","one") ||
       said("look","fragment","two"))) {
        if ((has("fragment one") ||
             has("fragment two"))){
               if (has("fragment one")) {
                 show.obj(fragment_one);
                 }
               if (has("fragment two")) {
                  show.obj(fragment_two);
                  }
               }
        else {
            print("You don't have any.");
            }
       }

  if (said("look","amulet")) {
      if (has("amulet")) {
          show.obj(amulet);
          }
      else {
          print("You don't have one.");
          }
      }

  if (said("look","coconut")) {
      if (has("coconut")) {
          show.obj(coconut);
          }
      else {
         print("You don't have any.");
         }
      }

 if (said("look","thorazine")) {
     if (has("thorazine")) {
         show.obj(thorazine);
         }
     else {
         print("You don't have any.");
         }
     }

 if (said("look","golden shard")) {
         if (has("golden shard")) {
             show.obj(gold_shard);
             }
         else {
             print("You don't have any.");
             }
         }

  if (said("look","golden cauldron")) {
      if (has("golden cauldron")) {
          show.obj(gold_cauldron);
          }
      else {
          print("You don't have it.");
          }
      }

 if (said("look","empty","coconut")) {
      if (has("empty coconut")) {
          show.obj(mt_coconut);
          }
      else {
          print("You don't have any.");
          }
      }

 if (said("look","sleep bombs")) {
     if (has("sleep bombs")) {
         show.obj(sleep_bombs);
         }
     else {
         print("You don't have any.");
         }
     }

 if (said("look","lollipop")) {
     if (has("lollipop")) {
         show.obj(lollipop);
         }
     else {
         print("You don't have one.");
         }
     }

 if (said("look","jacket","key")) {
     if (has("jacket key")) {
         show.obj(jacket_key);
         }
     else {
         print("You don't have one.");
         }
     }

 if (said("look","food","tray")) {
     if (has("food tray")) {
         show.obj(food_tray);
         }
     else {
         print("You don't have one.");
         }
     }

 if (said("look","golden brew")) {
     if (has("golden brew")) {
         show.obj(golden_brew);
         }
     else {
         print("You don't have one.");
         }
     }

if (room_no<40) {
  if (said("look","butterflies")) {
     print("On this island is a type of insect that looks like a butterfly but feeds on human blood.  Fortunately, you have no blood.");
     }

  if (said("look","ground")) {
      print("You see the rich, black earth ripe with green plant life.");
      }

  if (said("look","grass")) {
      print("The grass is as thick as someone's hair.  You'd love to curl your toes in it, barefoot.");
      }

  if (said("look","sky")) {
      print("The sky is a particularly annoying shade of blue today.");
      }

  if (said("look","bushes")) {
      print("Yes...  bushes.  What else did you expect?");
      }

  if (said("take","butterflies")) {
      print("Oh, no!  They're carnivorous.");
      }
  }

  if (said("look","self")) {
      if (!is_zombie) {
      print("You are one foxy, living dead mama.");
      }
      else {
      print("Ew!  You're all rotten and stinky!");
      }
  }

  if (said("look","tree") &&
      room_no<40) {
      print("Ah, beautiful mahogany trees!");
      }

if ((said("use","voodoo doll","on","puppet mange") ||
     said("use","puppet mange","on","voodoo doll") ||
     said("put","puppet mange","on","voodoo doll") ||
     said("use","voodoo doll","puppet mange") ||
     said("use","puppet mange","voodoo doll") ||
     said("put","puppet mange","voodoo doll"))) {
          if (has("voodoo doll") &&
              has("puppet mange")) {
                  drop("voodoo doll");
                  drop("puppet mange");
                  get("mangy doll");
                  print("You always did like to play dress-up...");
                  print("Just like that time when you made GI Joe wear all of Barbie's clothes.");
                  score++;
                  }

          else {
              print("You seem to be missing something, yo.");
              }
          }

if ((said("throw","mangy doll","water") ||   //Killing Twinkie-Dinkie
     said("put","mangy doll","water") ||
     said("drop","mangy doll","water") ||
     said("throw","doll","water") ||
     said("put","doll","water") ||
     said("drop","doll","water"))) {
        if ((room_no ==10 ||
             room_no == 11 ||
             room_no == 15 ||
             room_no == 20 ||
             room_no ==23  ||
             room_no == 24 ||
             room_no == 27 ||
             room_no == 29) &&
             has("mangy doll")) {
               print("VERY CLEVER!!!");
               print("Unfortunately, the doll floats, so unless Twinkie Dinkie is highly susceptible to head colds, you'll have to try something else.");
             }
         else {
               print("Maybe you need to rest.  A nap would be good right now.");
               }
         }

if ((said("use","sleep potion","on","mangy doll") ||
     said("use","sleep potion","on","doll") ||
     said("use","poison","on","mangy doll") ||
     said("use","poison","on","doll") ||
     said("use","yellow grave mold","on","mangy doll") ||
     said("use","yellow grave mold","on","doll"))) {

          print("You know, I really must admire your effort, but Twinkie Dinkie is machine-washable, and can rid himself easily of such toxins.");
          }

if ((said("use","fragment","on","fragment") ||
     said("use","fragments") ||
     said("make","amulet") ||
     said("fix","amulet"))) {
          if (has("fragment one") &&
              has("fragment two")) {
                  drop("fragment one");
                  drop("fragment two");
                  get("amulet");
                  score++;
                  print("You've reassemble CHTHThthtuhtltluthltu's amulet!");
                  }
          else {
              print("You're missing something.");
              }
          }

if ((said("use","sleep potion","on","empty", "coconut") ||
     said("use","sleep potion","on","coconut") ||
     said("put","sleep potion","coconut") ||
     said("put","sleep potion","empty","coconut") ||
     said("fill","coconut","sleep potion") ||
     said("fill","empty","coconut","sleep potion") ||
     said("fill","sleep potion","coconut") ||
     said("fill","sleep potion","empty","coconut"))) {
          if (has("empty coconut") &&
              has("sleep potion")) {
                  drop ("empty coconut");
                  drop ("sleep potion");
                  get("sleep bombs");
                  print("Clever, clever!!  You fill the hollow coconuts with sleeping potion and cork them with some TP, yielding some crude sleep bombs.");
                  score++;
                  }
                  else {
                      print("Clever, but you seem to be missing something important.");
                      }
                  }

  if (said("eat","lollipop")) {
      if (has("lollipop")) {
          print("You suck on it for a little bit, wrap it up, and put it back in your pocket.");
          }
      else {
          print("You don't have a lollipop.");
          }
      }

  if ((said("use","poison") ||
       said("give","poison") ||
       said("use","poison","rol") ||
       said("give","poison","rol"))) {
           random(0,5,universe);
           if (universe == 0) {
               print("Hey, kids...  don't use poison.");
               }
           if (universe == 1) {
               print("Always be careful to read the labels on medicines and cleaners to make sure they aren't poisonous.");
               }
           if (universe == 2) {
               print("Never eat strange plants.  It may help to carry a field guide so that you can identify poisonous plants and avoid them.");
               }
           if (universe == 3) {
              print("Never give chocolate to dogs, as they will become quite sick.");
              }
           if (universe == 4) {
               print("Do unto others as you would have them do unto you.");
               }
           if (universe == 5) {
               print("Before acting in such a manner, reflect on how this will affect your karma.");
               }

           if (use_poison < 255) {
               use_poison++;
               }
           }

  if ((said("look", "anyword") ||
       said("look", "anyword", "anyword"))) {
    print("What? Where?");
  }

  if ((said("get", "anyword") ||
       said("get", "anyword", "anyword"))) {
    print("You can't get that here!");
  }

  if ((said("use", "anyword") ||
       said("use", "anyword", "anyword"))) {
    print("What do you want me to do with it?");
  }
}

  if (said("drink","dream brew")) {
      if ((has("dream brew") ||
           has("golden brew"))) {
          print("You should probably be safe and drink it at home.  It says right on the bottle that you're not supposed to operate any heavy machinery after drinking it.");
          }
      else {
          print("You haven't made one!");
          }
      }

if ((said("fix","golden cauldron") ||
     said("fix","cauldron"))) {
    if (golden_caul == 8) {
        golden_caul = 0;
        reset(shattered);
        get("golden cauldron");
        print("You reunite the pieces of the Golden Cauldron!");
        score++;
        }
    else {
        print("You can't do that!");
        }
    }


return();