basic_grant.c

skylib_mudos_v1/mudlib/std/effects/rituals/basic_grant.c · 4.3 KB

From the archive skylib_mudos_v1.tar.gz

Download the archive   « Back to the archive contents

/**
 * Grant Ritual Effect by Sandoz, 24 May 2001
 */

#include <effect.h>

#define STAT            arg[ 0 ]
#define DURATION        arg[ 1 ]
#define DEITY           arg[ 2 ]
#define CLASSIFICATION  "cleric.grant"

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

void modify_stats( object target, mixed arg ) {
    switch( STAT ) {
      case "con":
        target->adjust_bonus_con( 2 );
        tell_object( target , "You feel invigorated by the presence of "+
            DEITY+".\n");
        return;
      case "str":
        target->adjust_bonus_str( 2 );
        tell_object( target , "You feel the presence of "+
            DEITY+" empower your body.\n");
      return;
      case "dex":
        target->adjust_bonus_dex( 2 );
        tell_object( target , "You feel the presence of "+
            DEITY+" improve your reflexes.\n");
      return;
      case "int":
        target->adjust_bonus_int( 2 );
        tell_object( target , "You feel the presence of "+
            DEITY+" sharpen your wit.\n");
      return;
      case "wis":
        target->adjust_bonus_wis( 2 );
        tell_object( target , "You feel the wisdom of "+
            DEITY+" enlighten your mind.\n");
      return;
      default:
        tell_object( target , "You feel that you should contact a "
            "creator immediately.\n" );
    }
} /* modify_stats() */

/** @ignore yes */
void beginning( object target, mixed arg ) {
    modify_stats( target, arg );
    target->submit_ee( 0, DURATION, EE_REMOVE );
    target->add_extra_look( TO );

    switch( STAT ) {
      case "con":
        tell_room( ENV( target ), target->the_short()+" looks "
            "invigorated.\n", target );
      return;
      case "str":
        tell_room( ENV( target ), target->the_short()+" looks "
            "empowered.\n", target );
      return;
      case "dex":
        tell_room( ENV( target ), target->the_short()+" looks "
            "more agile.\n", target );
      return;
      case "int":
        tell_room( ENV( target ), target->the_short()+" looks "
            "shrewd.\n", target );
      return;
      case "wis":
        tell_room( ENV( target ), target->the_short()+" looks "
            "sagacious.\n", target );
      return;
      default:
        tell_room( ENV( target ), target->the_short()+" looks "
            "positively refreshed.\n", target );
    }

    return arg;

} /* beginning() */

/** @ignore yes */
void restart( object target, mixed arg ) {
    modify_stats( target, arg );
    target->add_extra_look( TO );
} /* restart() */

/** @ignore yes */
void merge_effect( object target, mixed arg, mixed new_arg ) {
    int div, add_time;

    div = ( 160 * (int)target->expected_tt() ) / new_arg[ 1 ];
    if( div < 100 )
        div = 100;

    add_time = ( 100 * new_arg[ 1 ] ) / div;

    DURATION = (int)target->expected_tt() + add_time;

    target->submit_ee( 0, DURATION, EE_REMOVE );

    tell_object( target , "You feel "+DEITY+" prolong "+
        DEITY_H->query_possessive( DEITY )+" presence.\n");

    tell_room( ENV( target ), target->the_short()+" looks "
        "positively refreshed.\n", target );

    target->add_extra_look( TO );

    return arg;

} /* merge_effect() */

/** @ignore yes */
void end( object target, mixed arg ) {
    target->remove_extra_look( TO );

    tell_object( target , "You feel the presence of "+DEITY+" leave you.\n");
    tell_room( ENV( target ), target->the_short()+" loses the blissful "
        "look.\n", target );
    call_other( target, "adjust_bonus_"+STAT, -2 );

} /* end() */

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

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

    if( !sizeof( arg = target->arg_of( enums[ 0 ] ) ) )
        return "";

    mess = CAP( (string)target->HE )+" ";

    switch( STAT ) {
      case "con":
        mess += "radiates an aura of vitality";
      break;
      case "str":
        mess += "radiates an aura of power";
      break;
      case "dex":
        mess += "radiates an aura of agility";
      break;
      case "int":
        mess += "radiates an aura of astuteness";
      break;
      case "wis":
        mess += "radiates an aura of sagacity";
      break;
      default:
        mess += "looks rather blissful";

    }

    return mess+".\n";

} /* extra_look() */

Site Stats

Snippets: 1791
Codebases: 571