[Circle] Disintegrate

From: Franco (awe@mt.arias.net)
Date: 07/24/96


Add spell # to spells.h
Add to assign_spells or spello, which ever it be in your case.

I assign it at TAR_CHAR_ROOM | TAR_NOT_SELF | TAR_OBJ_ROOM, but your
more than free to toy with it. Its a manual spell if you didnt know...

ASPELL(spell_disintegrate)
{
   struct obj_data *foolz_objs;
   int save, i;

   if (ch == NULL)
	return;
   if (obj) {
    /* Used on my mud 
    if (GET_OBJ_EXTRA(obj) == ITEM_IMMORT && GET_LEVEL(ch) < LVL_IMMORT) {
	send_to_char("Your mortal magic fails.\r\n", ch);
	return;
    }
    */
    switch (GET_OBJ_TYPE(obj)) {
    case ITEM_LIGHT:
	save = 19;
	break;
    case ITEM_SCROLL:
	save = 20;
	break;
    case ITEM_STAFF:
    /*
    case ITEM_ROD:
    */
    case ITEM_WAND:
	save = 19;
	break;
    case ITEM_WEAPON:
	save = 18;
	break;
    case ITEM_MISSILE:
	save = 20;
	break;
    case ITEM_ARMOR:
	save = 16;
	break;
    case ITEM_WORN:
	save = 18;
	break;
    /*
    case ITEM_SPELLBOOK:
	save = 15;
	break;
    case ITEM_PORTAL:
	save = 13;
	break;
    */
    default:
	save = 19;
	break;
    }
    /* Save modified by affect on weapons..this is kinda based on +5 or so
being high */
    if (GET_OBJ_EXTRA(obj) == ITEM_MAGIC && GET_OBJ_TYPE(obj) == ITEM_WEAPON) {
      for (i = 0; i < MAX_OBJ_AFFECT; i++) {
	  if (obj->affected[i].location == APPLY_DAMROLL)
		save -= obj->affected[i].modifier;
	}
    }
    /* A bonus for ac affecting items also */
    for (i = 0; i < MAX_OBJ_AFFECT; i++) {
	if (obj->affected[i].location == APPLY_AC)
   	   save -= obj->affected[i].modifier / 10;
    }
    if (number(1, 20) < save) {
	act("$n disintegrates $p.", FALSE, ch, obj, 0, TO_NOTVICT);
	act("You disintegrate $p.", FALSE, ch, obj, 0, TO_CHAR);
	extract_obj(obj);
	return;
    }
    else {
	act("You fail to disintegrate $p.", FALSE, ch, obj, 0, TO_CHAR);
	return;
    }
   }
   if (victim) {

    if (GET_LEVEL(victim) >= LVL_IMMORT) {
	send_to_char("Nice try..\r\n", ch);
        return;
    }

    /* Note this is extremely powerful, therefore im giving it 2 saves */
    if (mag_savingthrow(victim, 1)) {
	act("You resist $n's attempt to disintegrate you.", FALSE, ch, 0, 0, TO_VICT);
	if (IS_NPC(victim))
	    hit(victim, ch, TYPE_UNDEFINED);
	return;
    }
    if (mag_savingthrow(victim, 1)) {
       	act("You resist $n's attempt to disintegrate you.", FALSE, ch, 0, 0,
TO_VICT);
	if (IS_NPC(victim))
            hit(victim, ch, TYPE_UNDEFINED);
	return;
    }
    if (victim->desc) {
	close_socket(victim->desc);
	victim->desc = NULL;
    }
	
    /* Note this is for disintegrating all items the vict carries also..
    may wish to comment this off if you feel it too powerful */
    for (i = 0; i < NUM_WEARS; i++) 
	if (GET_EQ(victim, i))
	  unequip_char(victim, i);
    while (victim->carrying) {
	foolz_objs = victim->carrying;
	extract_obj(foolz_objs);
    }
				
    extract_char(victim);
    act("$n disintegrates $N!", FALSE, ch, 0, victim, TO_NOTVICT);
    act("You disintegrate $N!", FALSE, ch, 0, victim, TO_CHAR);

    return;
  }
  else
    return;
}

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



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