Re: dual spec procs on mobs and pay priest spec

From: Una salus victus nullam sperare salutem. (df109@city.ac.uk)
Date: 07/12/96


DISCLAIMER: I didn't write these credit for them goes to Dio (Dave Oldcorn)
Who is the coder for NewDawn (suppose should register it as a CircleMUD 
at some point :) after all year and half without is getting silly - 
apologises I'm naturally lazy and do to much :) -Tim (Aldric))

Well you can't set two spec procs on a mob as far as I'm aware
you can HOWEVER do this :)

/*
 * Special procedure combos below here.
 * A combo is a very simple process that just calls one and then
 * the other if the first did not respond. It is therefore important
 * that pulsed responses do return the correct value even though it
 * usually doesn't matter.
 * This technique is NOT recommended for Extend Specials. An Extend
 * Combo routine will be written when I think we need it.
 */
 
  
SPECIAL(fighter_cityguard)
{
  int v;
 
  if (!(v = cityguard(ch, me, cmd, argument)))
    v = fighter(ch, me, cmd, argument);
  return(v);
}


I don't know if the person who was asking for help on a cleric who would 
sell his services to player chars still needs it but here it is :)

/*
 * The pay priest offers his services to characters just as a
 * shopkeeper, although they are in the form of spells. Unlike
 * shopkeepers, there's nothing to stop people killing him (although
 * he is likely to be a bit on the hard side....) He MUST have
 * mob memory on, to stop the 'feature' of people jumping him, legging
 * it, and then asking for heal.
 */
SPECIAL(pay_priest)
{
  struct spell_cost_list {
    int spellnum;
    int cost;
  } spell_cost[] = {    /* These HAVE to be quite expensive esp. healing. */
    { SPELL_INVISIBLE,           1000 },
    { SPELL_ARMOR,               1000 },
    { SPELL_CURE_CRITIC,         2000 },
    { SPELL_BERSERKER,           2500 },
    { SPELL_STONESKIN,           6500 },
    { SPELL_HEAL,               10000 },
    { SPELL_AGE,                10000 },
    { SPELL_REMOVE_CURSE,       10000 },
    { SPELL_REMOVE_POISON,      10000 },
    { SPELL_METALSKIN,          12500 },
    { SPELL_REJUVENATE,         15000 },
    { SPELL_SANCTUARY,          50000 },
    { -1, -1 }
  };
  int i, sp;
  struct char_data *priest;
 
  priest = (struct char_data *) me;
  if (cmd && (GET_POS(priest) == POS_STANDING)) {
    skip_spaces(&argument);
    if (CMD_IS("list")) {
      send_to_char("Available Services:\r\n", ch);
      for(i=0;spell_cost[i].spellnum >= 0;i++) {
        sprintf(buf, "%30s %6d\r\n",
                spells[spell_cost[i].spellnum], spell_cost[i].cost);
        send_to_char(buf, ch);
      }
      return(TRUE);
    } else if (CMD_IS("buy")) {
      if ((sp = search_block(argument, spells, 0)) >= 0) {
        for(i=0;spell_cost[i].spellnum >= 0;i++) {
          if (spell_cost[i].spellnum == sp) {
            if (GET_GOLD(ch) >= spell_cost[i].cost) {
              cast_spell(priest, ch, 0, sp);
              GET_GOLD(ch) -= spell_cost[i].cost;
              act("$n says, 'Have a nice day.'", TRUE, priest, 0, ch, TO_VICT);
            } else {
              act("$n says, 'You don't have the money.'",
                TRUE, priest, 0, ch, TO_ROOM);
            }
            return(TRUE);
          }
        }
      }
      act("$n says, 'I don't sell that spell.'",
                TRUE, priest, 0, ch, TO_ROOM);
      return(TRUE);
    }
 
  }
 
  /* Otherwise, acts as a normal cleric */
  return(cleric(ch, me, cmd, argument));
}

Our cleric spec proc looks like this :)

SPECIAL(cleric)
{
  struct char_data *vict;
  int level, damaged;
  
  if (cmd)
    return FALSE;
 
  level = GET_LEVEL(ch);  
 
  /* Non-combat: cast some affects */
  if (GET_POS(ch) == POS_STANDING) {
  
    /* First check: heal self if injured - clerics always do this immediately */
    if ((GET_HIT(ch) < GET_MAX_HIT(ch)) && (level > 15) && (GET_MANA(ch) 
> 10))
{  
      cast_spell(ch, ch, 0, SPELL_HEAL);
      GET_MANA(ch) -= 10;        /* Doesn't cost as much if not in combat */
      return(TRUE);
    }
 
    
    /* So higher level clerics have more affects on them: lev 50 cast
     * about once in 1 minute, lev 1 about once every 4 minutes, and
     * also is more likely to fail level check in switch*/
    if ( number(0, 22-(level / 3)) )
      return FALSE;
 
    switch(number(0,8)) {
    case 0:
      if (!affected_by_spell(ch, SPELL_ARMOR) &&
          !affected_by_spell(ch, SPELL_STONESKIN) &&
          !affected_by_spell(ch, SPELL_METALSKIN) ) {
        if (level < 20)
          cast_spell(ch, ch, 0, SPELL_ARMOR);
        else if (level < 25)
          cast_spell(ch, ch, 0, SPELL_STONESKIN);
        else
          cast_spell(ch, ch, 0, SPELL_METALSKIN);
      }
      break;
 
      break;
    case 1:
      if ((level > 5) && !affected_by_spell(ch, SPELL_BLESS) )
        cast_spell(ch, ch, 0, SPELL_BLESS);
      break;
    case 2:
      if (level > 6)
        cast_spell(ch, ch, 0, SPELL_STRENGTH);
      break;
    case 3:
      if (level > 12) {
        if (IS_GOOD(ch) && !IS_AFFECTED(ch, AFF_PROTECT_EVIL) )
          cast_spell(ch, ch, 0, SPELL_PROTECTION_FROM_EVIL);
        else if (IS_EVIL(ch) && !IS_AFFECTED(ch, AFF_PROTECT_GOOD) )
          cast_spell(ch, ch, 0, SPELL_PROTECTION_FROM_GOOD);
      }
      break;
    case 4:
      if ((level > 15) && !IS_AFFECTED(ch, AFF_SANCTUARY) )
        cast_spell(ch, ch, 0, SPELL_SANCTUARY);
      break;
    case 5:
      if ((level > 17) && !affected_by_spell(ch, SPELL_REFLECTION) )
        cast_spell(ch, ch, 0, SPELL_REFLECTION);
      break;
    case 6:
      if ((level > 20) && !affected_by_spell(ch, SPELL_GUIDE) )
        cast_spell(ch, ch, 0, SPELL_GUIDE);
      break;
    case 7:
      if ((level > 26) && !affected_by_spell(ch, SPELL_HASTE) )
        cast_spell(ch, ch, 0, SPELL_HASTE);
      break;
    }
 
    return(TRUE);
  }
 
  /* Combat: blast opponent time */
  if (GET_POS(ch) != POS_FIGHTING)
    return(FALSE);
 
  /* choose someone in the room who is fighting me */
  for (vict = world[ch->in_room].people; vict; vict = vict->next_in_room)
    if (FIGHTING(vict) == ch && !number(0, 4))
      break;
 
  /* if I didn't pick any of those, then just slam the guy I'm fighting */
  if (vict == NULL)
    vict = FIGHTING(ch);
 
 
  /* Over level 40 will hit them EVERY round! */
  if ( (level < 40) && number(0, 4-(level/10)) )
    return TRUE;
 
  /* Specific try-occasionally variety spells
   * These should be in reverse level order of trying */
 
  /* Is call lightning an option? */
  if (OUTSIDE(ch) && (get_weather_sky(ch) >= SKY_RAINING) && (level > 8)) {
    /* If victim has metalskin on, definitely, else perhaps */
    if (affected_by_spell(vict, SPELL_METALSKIN) || number(0,6))
      /* This WILL hurt if metalskin... */
      cast_spell(ch, vict, NULL, SPELL_CALL_LIGHTNING);
  }
 
  if ((level > 30) && !number(0, 3)) {
    cast_spell(ch, vict, NULL, SPELL_DOOM);
    return(TRUE);
  }
 
  if ((level > 12) && !number(0, 3)) {
    if (IS_EVIL(ch)) {
      if (IS_GOOD(vict)) {
        cast_spell(ch, vict, NULL, SPELL_DISPEL_GOOD);
        return TRUE;
      }
    } else if (IS_GOOD(ch) && IS_EVIL(vict)) {
      cast_spell(ch, vict, NULL, SPELL_DISPEL_EVIL);
      return TRUE;
    }
  }
 
  if ((level > 14) && !number(0, 4)) {
    cast_spell(ch, vict, NULL, SPELL_BLINDNESS);
    return(TRUE);
  }
 
 
  /* OK default action: if badly damaged, heal, else harm. This MUST
   * be mana-limited, or else the cleric could be unbeatable! To make simple,
   * and since NPC's have less mana than PC's, each cast costs a
   * fixed, small amount (a level 10 NPC has 70 mana, an L50 has 230).
   * The spells above are not mana-limited but should be rare enough that
   * it doesn't matter.
   */
  if (GET_MANA(ch) > 20) {
    damaged = GET_MAX_HIT(ch) - GET_HIT(ch);
    if (level < 10) {
      if (damaged > 20) {
        cast_spell(ch, ch, NULL, SPELL_CURE_LIGHT);
        GET_MANA(ch) -= 5;
        return(TRUE);
      }
    } else if (level <= 15) {
      if (damaged > 35) {
        cast_spell(ch, ch, NULL, SPELL_CURE_CRITIC);
        GET_MANA(ch) -= 8;
        return(TRUE);
      }
    } else {
      if (damaged > 60) {
        cast_spell(ch, ch, NULL, SPELL_HEAL);
        GET_MANA(ch) -= 20;     /* Needs to be quite high to cope with mana rega
in */
        return(TRUE);
      }
    }
    /* If get here, not healed, so harm if we can. */
    if (level > 19) {
      cast_spell(ch, vict, NULL, SPELL_HARM);
      GET_MANA(ch) -= 10; 
      return(TRUE);
    } 
  } 
      
  return TRUE;
 
}   

 
Tim can be reached via computer technology at:
e-mail: lostsoul@city.ac.uk (df109@city.ac.uk), 
        lostsoul@soi.city.ac.uk (df109@soi.city.ac.uk), 
        lostsoul@mono.org or lostsoul@spodbox.linux.org.uk (MIME)
 
"Blood, sweat and tears, really don't matter.
                    Just the things that you do, in this garden"

On Thu, 11 Jul 1996, Eduardo Gutierrez de Oliveira wrote:

> On Wed, 10 Jul 1996, Brian Williams - Nashak wrote:
> 
> > well, ignore my last post.. it works fine.. I just learned you can't 
> > assign a mob 2 spec procs.. :P also.. the proc seems to not be doing any 
> > damage to my mortal.. and it doesn't attack me if I am in the gate.. 
> > thought it said it would, and it'd say the messages?
> > 
> 
> Wrong, it specifically says that it will not attack the room where the 
> guard is unless you specify so (by changing the -1 witht he room vnum)
> 
> It says the message in both the victim and the people in the same room 
> where the archer is...
> 
> I do have some other question... Is it true? can't you assign to 
> spec_procs to the same mob? even if they are not colliding?
> 
> Greets
> 
> Myth
> 
> PS: I have the MudChat system for MERC in my drive, if anyone is willing 
> to port it to circle (or to mobprogs) please let me know...:)
> ---------------------------------------------------------------------------
> Eduardo Gutierrez de Oliveira                  eduo@sparc.ciateq.conacyt.mx
> Administrador de Internet                            Internet Administrator
> Proveedor de Servicio Internet                    Internet Service Provider
>                                 CIATEQ, A.C.
>  Centro de Investigacion y Asistencia Tecnica del Estado de Queretaro, A.C.
>                      http://sparc.ciateq.conacyt.mx/
> ---------------------------------------------------------------------------
> 



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