spider.c, spiderfuncs.c and spiderpoison.c - examples for course 14

[previous example] [course14] [Table of contents]
/* Filename      : spider.c
 * Description   : A poisonous spider
 *
 * written       : 06-01-1998 - Gunner
 * last modified : 02-06-1998 - Gunner
 * HTML-Version  : 13-02-2000 - Ghorwin
 */

#include <mudlib.h>
inherit I_MONSTER;

#define FUNC "/doc/crashcourse/course14/spiderfuncs"

create()
{
    ::create();
    set_name("black spider");
    add_id("spider");
    set_short("A black spider");
    set_long("This is a poisonous spider.\n");
    set_level(10);
    load_a_chat(10,({(:call_other,FUNC,"poison",this_object():)}));
    replace_program(I_MONSTER);
}

spiderfuncs.c


/* Filename      : spiderfuncs.c
 * Description   : the functionfile for spider.c
 *
 * written       : 06-01-1998 - Gunner
 * last modified : 02-06-1998 - Gunner
 * HTML-Version  : 13-02-2000 - Ghorwin
 */

#include <mudlib.h>
inherit I_DAEMON;

#define SPIDER_POISON "/doc/crashcourse/course14/spiderpoison"

int
poison(object spider)
{
    tell_object(spider->query_attack(),"The black spider sinks its "
        "fangs into your leg.\n");

    // If the poison fails, the object is destroyed automagically, so
    // there's no need for us to do it.

    new(SPIDER_POISON)->poison_victim(spider->query_attack(),spider);

    return 1;
}

spiderpoison.c


/* Filename      : spiderpoison.c
 * Description   : the poison for spider.c
 *
 * written       : 06-01-1998 - Gunner
 * last modified : 02-06-1998 - Gunner
 * HTML-Version  : 13-02-2000 - Ghorwin
 */

#include <mudlib.h>
inherit I_POISON;

create()
{
    ::create();
    set_poison_name("spider poison");
    set_end_time(240);      // Will last for approx 4 minutes
    set_base_damage(20);
    set_random_damage(10);
    set_interval_time(10);  // Will hurt every 10 seconds
    set_victim_start_msg("You feel the spider poison flow into your veins.\n");
    set_victim_hurt_msg("You feel the spider poison burn in your veins.\n");
    set_victim_stop_msg("The burning sensation of the spider poison wears off.\n");
    set_poison_look("$O seems to be infected with a spider poison.\n");
    set_str_reduce(3);
    set_dex_reduce(3);
    replace_program(I_POISON);
}