//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
//  Logic  106:  Down in the well
//
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


#include "defines.txt"

if (new_room) {
  universe=91;
  load.pic(universe);
  draw.pic(universe);
  discard.pic(universe);
  set.horizon(1);


// Check what room the player came from and position them on the
// screen accordingly here, e.g:
// if (prev_room_no == 5) {
//   position(ego,12,140);
// }




  animate.obj(o1); //VG climbing and swimming
  load.view(2);
  load.view(99);
  set.view(o1,2);
  position(o1, 68, 45);
  ignore.blocks(o1);
  set.priority(o1, 15);
  draw(o1);

  position(ego, 68,94);
  load.view(3);
  load.view(0);
  set.view(ego, 3);
  set(always_animate_ego);

  show.pic();

    load.sound(66);
  sound(66,sound_flag);

  move.obj(o1, 68, 94, 1, done_flag); //When new room, climbs down rope
  program.control();
  prevent.input();
}

if (done_flag) { //Done climbing
    reset(done_flag);
    erase(o1);
    draw(ego);
    accept.input();
    player.control();
    }

if (said("look")) {
    print("You have descended into a dark well.  Cool water saturates your clothes.  The walls are cold and damp.  Moss grows on the stones.  Above is a glint of sunshine.  Below is darkness eternal.");
}

if (said("look","wall")) {
    print("The walls are made of gray, crumbling stone.");
    }

if (said("look","sky")) {
    print("The sky is visible as a sparkling point of light above.");
    }

if (said("look","water")) {
    print("The water is strangely thick, as if it were partially frozen.  Either way, it is nice and buoyant, but very cold.");
    }

if ((said("look","moss") ||
     said("look","plant") ||
     said("get","moss") ||
     said("get","plant"))) {
         print("While a bit pungent, it is not at all medicinal.");
         }

if (said("look","stone")) {
    print("Hey, these stones are so loose, they would come right off with a good tug!");
    print("They're pretty heavy, too.");
    }

if (said("swim")) {
    print("Strange!  The water is too buoyant for you to dive!");
    }

if ((said("get","rock") ||
     said("remove","rock") ||
     said("use","rock"))) {
    print("The extra weight seems to counteract the strange buoyancy of the water!");
    position(o1, 68, 130);
    set.view(o1, 99);
    erase(ego);
    draw(o1);
    prevent.input();
    program.control();
    move.obj(o1, 68, 160, 1, more_done_flag); //diving
    }


if (more_done_flag) {
    reset(more_done_flag);
    if (shattered &&
        golden_caul == 5) {
            print("You found a piece of the Golden Cauldron!");
            score++;
            golden_caul++;
            }
    else {
         print("Nope, nothing down there.");
         }
    print("You release the rock and bob back to the surface.");
    move.obj(o1, 68, 130, 1, really_done_flag);
    }

if (really_done_flag) {
    erase(o1);
    draw(ego);
    accept.input();
    player.control();
    reset(really_done_flag);
    }


if ((said("climb","wall") ||
     said("climb","up","wall"))) {
          print("The walls are too slick to get a grip.  You're going to have to climb that bit of fishing line you dropped down.");
          }


if ((said("climb") ||
     said("climb","well") ||
     said("climb","line") ||
     said("climb","up") ||
     said("climb","up","well") ||
     said("climb","up","line"))) {
    move.obj(ego, 68, 94, 1, another_done_flag);
    }

if (another_done_flag) {
    reset(another_done_flag);
    position(o1, 68,94);
    set.view(o1, 2);
    erase(ego);
    draw(o1);
    move.obj(o1, 68, 45, 1, penultimate_done_flag);
    }

if (penultimate_done_flag) {
    reset(always_animate_ego);
    set.view(ego, 0);
    new.room(105);
    }

if (sound_flag) {
    sound(66, sound_flag);
    }

return();