// TMW2 Script
// Author:
//    Jesusalva
// Description:
//    Random dialog for various random NPCs.

// Functions:
//  hello
//  moubootalk
//  villagertalk
//  sailortalk
//  legiontalk
//  asleep

// Evol authors (some strings and code):
//  Reid
//  Akko Teru
//  Qwerty Dragon

function	script	hello	{

    switch (rand2(3)) {
        case 0:
            npctalkonce(l("Heya!"));
            break;
        case 1:
            npctalkonce(l("Hi."));
            break;
        case 2:
            if ($EVENT$ == "Christmas")
                npctalkonce(l("Merry Christmas!"));
            else
                npctalkonce(l("Nice day to you."));
            break;
    }

    return;
}

function	script	moubootalk	{
    switch (rand2(4)) {
        case 0:
            npctalkonce(l("Moooooo!"));
            break;
        case 1:
            npctalkonce(l("Moo!"));
            break;
        case 2:
            npctalkonce(l("Moooooooooooo!"));
            break;
        case 3:
            npctalkonce(l("Moooo!"));
            break;
    }
    return;
}

function	script	sailortalk	{

    .@rand = rand2(8);
    if (.@rand == 0) goodbye;
    if (.@rand == 1) npctalkonce(l("Arr, I'm bored!"));
    if (.@rand == 2) npctalkonce(l("Hey! Good to hear from you!"));
    if (.@rand == 3) npctalkonce(l("Yarr arr!"));
    if (.@rand == 4) {
        if ($EVENT$ == "Christmas")
            npctalkonce(l("Merry Christmas, arr yarr!!"));
        else {
            speech(
                l("A sunny and hot day,"),
                l("a quiet place,"),
                l("a ground!"),
                l("What else do you need?"));
        }
        close;
    }
    if (.@rand == 5) npctalkonce(l("A-hoy matey!"));
    if (.@rand == 6) npctalkonce(l("Arr!"));
    if (.@rand == 7) npctalkonce(l("Howdy?"));

    // just to be sure
    closedialog;
    close;
    end;
}

function	script	villagertalk	{

    function darn_or_smile {
        .@darn = rand(42);

        if (.@darn < 26) {
            emotion E_JOY;
            hello;
        } else if (.@darn > 26) {
            emotion E_LOOKAWAY;
            goodbye;
        } else {
            npctalkonce(l("Stop it!"));
        }
        return;
    }

    switch (rand2(4)) {
        case 0:
            darn_or_smile();
            break;
        case 1:
            npctalkonce(l("It is a sunny day, don't you think?"));
            break;
        case 2:
            npctalkonce(l("Go fly a kite."));
            break;
        case 3:
            npctalkonce(l("I just want to live my life in peace."));
            break;
        default:
            emotion E_HAPPY;
            break;
    }

    return;
}

function	script	legiontalk	{
    switch (rand2(15)) {
        case 0:
            npctalkonce(l("Do I look like a tree? I feel like one."));
            //speech(
            //    l("Do you feel too weak even to do damage to this areas wishy-washy wildlife?"),
            //    l("Then concentrate your anger upon the trees hereabouts, you will gain experience whilst leveling your sword skill on them."),
            //    l("Oh, and a fruit may even fall for you if you are lucky! But stay alert to pick up your drops."));
            //close;
            break;
        case 1:
            npctalkonce(l("I'm a little busy right now."));
            break;
        case 2:
            npctalkonce(l("Not in the mood to chat."));
            break;
        case 3:
            npctalkonce(l("My breath smells bad."));
            break;
        case 4:
            npctalkonce(l("Don't distract me, I have to stay alert."));
            break;
        case 5:
            npctalkonce(l("Give me some space."));
            break;
        case 6:
            if ($EVENT$ == "Christmas")
                npctalkonce(l("Merry Christmas, adventurer."));
            else
                npctalkonce(l("Can you please go away?"));
            break;
        case 7:
            npctalkonce(l("Can't talk right now, I'm on patrol duty."));
            break;
        case 8:
            npctalkonce(l("What're you looking at?!"));
            break;
        case 9:
            npctalkonce(l("I can't stay here and talk all day. I have a job to do."));
            break;
        case 10:
            npctalkonce(l("Keep moving pal."));
            break;
        case 11:
            npctalkonce(l("So you think you're tough? A warrior must also be loyal and patient."));
            break;
        case 12:
            emotion E_LOOKAWAY;
            break;
        case 13:
            npctalkonce(l("Practice! There are no secrets to becoming a warrior."));
            break;
        case 14:
            npctalkonce(l("There is no honor in fighting a weak opponent."));
            break;
    }

    return;
}

function	script	asleep	{
    switch(rand2(5)) {
        case 0: npctalkonce(l("Zzzzzzzzz...")); break;
        case 1: npctalkonce(l("Rrrr... Pchhhh...")); break;
        case 2: npctalkonce(l("Ggrmm... Grmmmm...")); break;
        case 3: npctalkonce(l("Hm... Shhhh...")); break;
        default: emotion(E_SLEEPY);
    }
    end;
}

function	script	studenttalk	{
    switch(rand2(6)) {
        case 0: npctalkonce(l("I want to sleep...")); break;
        case 1: npctalkonce(l("I have homework to do...")); break;
        case 2: npctalkonce(l("I need to finish studying for my test...")); break;
        case 3: npctalkonce(l("Ah, the Professors will get mad at me again...")); break;
        case 4: npctalkonce(l("I'm a little busy right now.")); break;

        default: emotion(E_SLEEPY);
    }
    end;
}