divine_cloak.c

skylib_mudos_v1/mudlib/std/effects/rituals/divine_cloak.c · 3.0 KB

From the archive skylib_mudos_v1.tar.gz

Download the archive   « Back to the archive contents

/**
 * Effect for a shielding ritual by Sandoz, 28 May 2001.
 */

#include <deity.h>
#include <effect.h>

#define CLASSIFICATION "cleric.divine.cloak"

#define WEAKEN 15
#define AC     arg[ 0 ]
#define TIME   arg[ 1 ]
#define DEITY  arg[ 2 ]

/** @ignore yes */
string query_classification() { return CLASSIFICATION; }

/** @ignore yes */
string query_shadow_ob() { return SHADOWS+"divine_cloak"; }

/** @ignore yes */
string get_colour( string deity ) {
    return DEITY_H->query_deity_colour(deity);
} /* get_colour() */

/** @ignore yes */
void beginning( object player, mixed arg ) {
    string col;

    player->add_extra_look( TO );

    player->submit_ee("weakening_message", TIME - WEAKEN, EE_ONCE );
    player->submit_ee( 0, TIME, EE_REMOVE );

    col = get_colour(DEITY);
    player->setup_faith_shield( AC, col+" divine cloak");

    tell_room( ENV(player), "The air around "+player->one_short()+" shimmers "
        "for a moment with "+add_a(col)+" hue and then stabilizes.\n");

} /* beginning() */

/** @ignore yes */
mixed merge_effect( object player, mixed arg, mixed new_arg ) {
    int div, left;
    string col;

    left = (int)player->expected_tt();

    div = 125 * left / new_arg[ 1 ];
    if( div < 100 )
        div = 100;

    TIME = left + 100 * new_arg[ 1 ] / div;

    player->submit_ee("weakening_message", -1, EE_ONCE );
    player->submit_ee("weakening_message", TIME - WEAKEN, EE_ONCE );
    player->submit_ee( 0, TIME , EE_REMOVE );

    col = get_colour(DEITY);

    if( AC < new_arg[ 0 ] ) {
        AC = new_arg[ 0 ];
        player->setup_faith_shield( AC, col+" divine cloak");
        tell_object( player, "Your divine cloak becomes stronger.\n");
    } else {
        tell_object( player, "Your divine cloak stabilizes.\n");
    }

    tell_room( ENV(player), "The air around "+player->one_short()+" shimmers "
        "for a moment with "+add_a(col)+" hue and then stabilizes.\n",
        player );

    return arg;

} /* merge_effect() */

/** @ignore yes */
void restart( object player, mixed arg ) {
    string col;

    player->add_extra_look( TO );

    col = get_colour(DEITY);

    player->setup_faith_shield( AC, col+" divine cloak");

    tell_object( player, "The air around you shimmers for a moment with "+
        add_a(col)+" hue and then stabilizes.\n");

} /* restart() */

/** @ignore yes */
void weakening_message( object player ) {
    tell_object( player, "Your divine cloak wavers for a moment.\n");
} /* weakening_message */

/** @ignore yes */
void end( object player, mixed arg ) {
    player->remove_extra_look( TO );
    tell_object( player, "Your "+get_colour(DEITY)+" divine cloak "
        "dissipates.\n");
} /* end() */

/** @ignore yes */
string extra_look( object player ) {
    int *enums;
    mixed arg;

    if( !sizeof( enums = (int *)player->effects_matching(CLASSIFICATION) ) )
        return "";

    arg = player->arg_of( enums[ 0 ] );

    return CAP(player->HE)+" is wrapped in "+
        add_a(get_colour(DEITY))+" divine cloak.\n";

} /* extra_look() */

Site Stats

Snippets: 1791
Codebases: 571