/*
 * Copyright (c) 2021 Ross Cunniff
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
#include "stdadv.oah"

using namespace adv;
using namespace stdadv;

#include "constant.oad"
#include "routines.oad"
#include "locnames.oad"

class AardActor(StdActor) {
    public var pmax = 250;
    public var weight = 0;
    public var pNoTake = true;
    public var action = ActAction;
    public var cheat = false;
    public var ratvl = 0;
    public var pscore = 0;
    public var debug = 0;
}

AardActor me(mrm1);

#include "objects.oad"
#include "locales.oad"
#include "verbs.oad"
#include "objrouts.oad"
#include "transit.oad"

proc MoveFeet()			// Your feet just keep following you...
{
    feet.move($ME.loc);
}

proc adv::START()
{
    // Override some routines
    quit.action = quitAction;
    V_throw.action = throwAction;
    // Other init
    Setdaemon(MoveFeet);
    StdInit(me);
    dirVec = {north, south, east, west, up, down, enter, exit};
    Prompt = PROMPT;
    Setdaemon(endgame);
}

proc adv::DWIMI(obj) {return Dwimmer(obj);}
proc adv::DWIMD(obj) {return Dwimmer(obj);}

/*** CHEAT ROUTINES ***/

proc chetr()
{
    if ($ME.debug == 0) ExitPhase(PHX_ACTOR);
}

VerbClass cheat {
    action = proc() {
        $ME.debug  = !$ME.debug;
    }
}

VerbClass beam {
    action = proc() {
        chetr();
        $ME.move(Dobj);
    }
}


VerbClass tractor {
    action = proc() {
        chetr();
        Dobj.move($ME.loc);
        "The ";
        Dobj.sdesc();
        " magically appears.\n";
    }
}

Thing adv::STRING {}
VerbClass adv::TELLER {}

/*** EOF aard.oad ***/