Re: [CODE] Call Dragon Spell

From: Carlo Mocci (mocci@TIN.IT)
Date: 04/28/98


Here is my spell_call_dragon, translated in English as requested.

I hope to find from someone a better solution to my bool stanza[1000] array.
In fact it works, but I simply don't like that way of handling the matter.

The reason I use it is that I want that only standing people who are in the
same room of the caster and grouped with get transferred.
And I want that all the people who are affected by the spell get the
messages of all the other riders mounting/dismounting the dragon.

Sorry for the poor translation, I'm coder of an Italian MUD and my English
is terrible.

Carlo Mocci
AKA Kabir
Coder of DalilaMUD
dalila.shopitaly.net 4000

--------------------------------

ASPELL(spell_call_dragon)
{
#define ASTRAL_TARGET_ROOM 11300

  struct char_data * k;
  struct follow_type * f;
  room_rnum room_cast;
  bool stanza[1000]; //It's terrible but it works BTW stanza means room
  int i;

  if (ch == NULL)
    return;

  if (real_room(ASTRAL_TARGET_ROOM) == NOWHERE)
    {
    send_to_char("The astral room is closed at the moment.\r\n", ch);
    mudlog("ASTRAL_TARGET_ROOM doesn't exists in spell_call_dragon", NRM,
LVL_GOD, TRUE);
    return;
    }

  send_to_char("You summon a mighty dragon and climb upon it, preparing
yourself to travel.\r\n", ch);
  act("$n summons a mighty dragon.", TRUE, ch, 0, 0, TO_ROOM);

  if (!IS_AFFECTED(ch, AFF_GROUP))
    {
    send_to_char("The dragon takes you to the astral room and then
vanishes.\r\n", ch);
    act("$n climbs over the dragon and vanishes.", TRUE, ch, 0, 0, TO_ROOM);
    char_from_room(ch);
    char_to_room(ch, real_room(ASTRAL_TARGET_ROOM));
    act("$n arrives mounting a mighty dragon, climbs off and the dragon
vanishes.", TRUE, ch, 0, 0, TO_ROOM);
    look_at_room(ch, 0);
    }
  else
    {
    memset(stanza, FALSE, 1000);
    room_cast=ch->in_room;

    if (ch->master) k = ch->master;
    else k = ch;

    if ( (AFF_FLAGGED(k, AFF_GROUP)) && (k->in_room==room_cast) &&
(GET_POS(k)>= POS_STANDING) )
      {
      stanza[0]=TRUE;
      act("$n climbs on the mighty dragon.", TRUE, k, 0, 0, TO_ROOM);
      if (k!=ch) send_to_char("You climb on the mighty dragon, preparing
yourself to travel.\r\n", k);
      }
    i=1;
    for (f = k->followers; f; f = f->next)
      if ( (IS_AFFECTED(f->follower, AFF_GROUP)) &&
(f->follower->in_room==room_cast) &&
            (GET_POS(f->follower)>= POS_STANDING) )
        {
        if (i>=1000) {log("ERROR in spell_call_dragon: more than 1000
players in group ?");}
        else stanza[i++]=TRUE;
        act("$n climbs on the mighty dragon.", TRUE, f->follower, 0, 0,
TO_ROOM);
        if (f->follower!=ch) send_to_char("You climb on the mighty dragon
preparing yourself to travel.\r\n", f->follower);
        }

    send_to_room("A mighty dragon appears.\r\n",
real_room(ASTRAL_TARGET_ROOM));

    if (stanza[0])
      {
      char_from_room(k);
      char_to_room(k, real_room(ASTRAL_TARGET_ROOM));
      send_to_char("The mighty dragon carries you and your group to the
astral room.\r\n", k);
      }
    i=1;
    for (f = k->followers; f; f = f->next)
      if (stanza[i++])
        {
        char_from_room(f->follower);
        char_to_room(f->follower, real_room(ASTRAL_TARGET_ROOM));
        send_to_char("The mighty dragon carries you and your group to the
astral room.\r\n", f->follower);
        }

    send_to_room("The mighty dragon vanishes with all his riders.\r\n",
room_cast);

    if (stanza[0])
      {
      act("$n climbs off the mighty dragon.", TRUE, k, 0, 0, TO_ROOM);
      send_to_char("You climb off the mighty dragon.\r\n", k);
      }
    i=1;
    for (f = k->followers; f; f = f->next)
      if (stanza[i++])
        {
        act("$n climbs off the mighty dragon.", TRUE, f->follower, 0, 0,
TO_ROOM);
        send_to_char("You climb off the mighty dragon.\r\n", f->follower);
        }

    send_to_room("The mighty dragon vanishes.\r\n",
real_room(ASTRAL_TARGET_ROOM));

    if (stanza[0])
      look_at_room(k, 0);
    i=1;
    for (f = k->followers; f; f = f->next)
      if (stanza[i++])
        look_at_room(f->follower, 0);

    }

#undef ASTRAL_TARGET_ROOM
}

---------------------------------------------------------------
|        __         __            __  __         __       __  |
|   __  (  )  ___  (  )    __    (  \/  )  __   / _)  __ (  ) |
|  / _) /__\ (  ,)  )(__  /  \    )    (  /  \ ( (_  / _) )(  |
| ( (_ (_)(_) )  \ (____)( () )  (_/\/\_)( () ) \__)( (_ (__) |
|  \__)      (_)\_)       \__/            \__/       \__)     |
|                                                             |
| mailto: mocci@tin.it                                        |
| http://volftp.tin.it/IT/IT/ITALIANI/MOCCI                   |
| http://www.geocities.com/SunsetStrip/Palms/7010             |
---------------------------------------------------------------


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST