illusions.c

skylib_mudos_v1/mudlib/std/effects/magic/illusions.c · 3.2 KB

From the archive skylib_mudos_v1.tar.gz

Download the archive   « Back to the archive contents

/**
 * This is an effect to print weird messages to the player. Its
 * duration is exactly arg seconds.  It is used by the spell
 * illusion and has a classification of magic.mental.illusions
 */
 
#include <effect.h>
#include "defs.h"


/**
 * Returns the effect's classification.
 */
string query_classification() { return "magic.mental.illusions"; }

/** @ignore yes */
int beginning( object player, mixed arg ) {
  tell_object(player, "Your head feels strange, almost as if your mind"
      " is not alone...\n" );
  player->submit_ee( 0, arg, EE_REMOVE );
  player->submit_ee( "illusions", ({20,40}), EE_CONTINUOUS );
  return arg;
} /* beginning() */

/** @ignore yes */
int restart(object player, mixed arg) {
   player->submit_ee("illusions", ({20, 40}), EE_CONTINUOUS);
   return arg;
}

/** @ignore yes */
int merge_effect( object player, int time1, int time2 ) {
   int duration;
   duration = time2 + player->expected_tt();
   player->submit_ee( 0, duration, EE_REMOVE );
   player->submit_ee("illusions", ({20, 40}), EE_CONTINUOUS);
   return duration;
}

/** @ignore yes */
void end(object player) {
   tell_object(player, "Your head no longer feels so crowded.\n");
}

/** @ignore yes */
void illusions( object player) {
  object *foobar = ({ });
  object specific;
  switch( random( 4 ) ) { // More to be added later
    case 0:
      foobar = INV(ENV(player));
      specific = foobar[random(sizeof(foobar))];
      if ( specific != player ) {
        tell_object(player, specific->the_short() + " turns into "
            "a fairy and starts to fly around your head.\n" );
      }
      foobar = filter( foobar, (: living($1)  :) );
      foobar -= ({player});
      if ( foobar ) {
      
          specific = choice(foobar);
        
        tell_object(player,  "And are those "
            + ({"pixies","sprouts","cats"})[random(3)] +
            " flying around " + specific->the_short() + "'s "
            "head?\n" );
      }
      return;
      
    case 1:
      tell_object(player, "A giant eagle appears out of nowhere "
          "and flies right at you!  You dive to avoid it.\n" );
      tell_room(ENV(player), player->the_short() + " dives for"
          " cover from some imaginary threat.\n", player );
      player->set_position( "lying on the floor shaking" );
      return;
    
    case 2:
      tell_object(player, "You are drowning in a big mound of "
          "ice cream!  The coldness closes in around you, and "
          "there seems to be no way out...\n" +
          player->colour_event("exits") + "Obvious exits: "
          "None!%^RESET%^\n" );
      tell_room(ENV(player), player->the_short() + " screams"
          " loudly and makes swimming motions.\n", player );
      return;
      
      
    case 3:
      tell_object(player, player->colour_event("say") + "One of"
          " the demons says: Tally ho chaps, it's " +
          player->query_short() + " for tea tonight!\nOne of "
          "the demons says: Can we cook " + player->HIM + 
          " first?\nOne of the demons says: No, we're eating "
          + player->HIM + " raw.  Get stuck in!%^RESET%^\n" );
      tell_room(ENV(player), player->query_short() + " screams!\n",
          player );
      return;
  }
} /* illusions() */
 

Site Stats

Snippets: 1791
Codebases: 571