match.c

foundation2_fluffos_v1/lib/domains/Examples/etc/match.c · 1.2 KB

From the archive foundation2_fluffos_v1.zip

Download the archive   « Back to the archive contents

/*    /domains/Examples/etc/match.c
 *    from the Foundation II LPC Library
 *    a match used to light other things
 *    created by Descartes of Borg 940427
 */

#include <lib.h>
#include <vendor_types.h>

inherit LIB_LIGHT;

int eventStrikeMatch(object ob);

static void create() {
    light::create();
    SetKeyName("match");
    SetId( ({ "match", "matchstick" }) );
    SetAdjectives( ({ "a", "small", "wooden" }) );
    SetShort("a small match");
    SetLong( "A small match made of wood with a flamable strike-point "
      "at the tip.  Evidently, if you strike it, it will catch fire.");
    SetLight(1, "strike", "extinguish");
    SetFire(1);
    SetVendorType(VT_LIGHT);
    SetFuelRequired(1);
    SetFuel(45);
    SetSourceRequired(0);
    SetLightFunction( (: eventStrikeMatch :) );
    SetMass(10);
    SetValue(11);
    SetBurntValue(10);
}

int eventStrikeMatch(object ob) {
    if(random(100) > 50) {
        write("You strike the match and it burns to life!");
        say((string)this_player()->GetName()+" lights a match.");
        return 1;
    }
    else {
        write("You strike a match, but nothing happens.");
        say((string)this_player()->GetName()+" strikes a match, "
          "but nothing happens.");
        return 0;
    }
}

Site Stats

Snippets: 1791
Codebases: 571