//
//
// memory.t, a system for remembering memories and thoughts, based on
// (and requiring) Suzanne Skinner's asktell.t
//
// Authored 1999 by [email protected]. As the original asktell.t
// was released as public domain, so is this modest contribution to
// the original.
//
// Originally coded : 07/08/1999
// Modified         : 07/11/1999
//
//

class memory : topic
 isclear = nil
 verDoRemember( actor ) = {}
 doRemember( actor ) = { " This memory is unclear to you. "; }
 unclearMsg = "You don't seem to recall that very clearly. "
 unknownMsg = "That doesn't seem to be something you recall. "
;

class clearmemory : memory
 isclear = true
 doRemember( actor ) =
 { " This is a default memory. It is clear. ";  }
;
//
// The only difference between the below and Suzanne's verbclasses
// are:
// (a) the disambiguating classes and the null answer classes.
// (b) the fact a memory, once remembered, becomes a known topic.
//
class doMemoryVerb: deepverb
 validDoList(actor, prep, io) = (nil)
 validDo(actor, obj, seqno) = true
 doDefault(actor, prep, io) = (nil)

 // Allowing multiple objects can cause erroneous sdescs
 // (e.g. catchallNonMemory.sdesc) to get printed.
 rejectMultiDobj(prep) = {
   "You can't use multiple objects with that verb.";
   return true;
 }

 disambigDobj(actor, prep, io, verprop, wordlist, objlist, flaglist,
              numberWanted, isAmbiguous, silent) =
 {
   local i, len;
   local newlist = [];
   local unclearMemoriesFound = nil;

   len := length(objlist);
   for ( i :=1 ; i <= len; i++) {
     if (isclass(objlist[i], memory)) {
       objlist[i].known := true;
       if (objlist[i].isclear)
         newlist += objlist[i];
       else
         unclearMemoriesFound := true;
     }
   }
   if (length(newlist) < 1) {
     if (unclearMemoriesFound)
       newlist += catchallFuzzyMemory;
     else
       newlist += catchallNonMemory;
   }
   return newlist;
 }
;
catchallFuzzyMemory : clearmemory
 sdesc = "da Fuzzy memory "
 doRemember( actor ) = { memory.unclearMsg; }
;
catchallNonMemory : clearmemory
 sdesc = " da Baaaaaaad memory "
 doRemember( actor ) = { memory.unknownMsg; }
;
RememberVerb : doMemoryVerb
 verb = 'remember' 'recall'
 sdesc = "remember"
 doAction = 'Remember'
;
//
// Potential additions: a think verb, allowing the phrases
// 'think about' 'meditate on'. Whether one wants it to respond
// to topics or memories or some combination thereof is left as
// an exercise to someone wishing to rationalize it in a game.
//