Vorpal Special Weapon Code for EmberMUD Code by Kyle Boyd (boyd1@proaxis.com) Note: I have not yet tested this version of Kyle's vorpal code. However, the version I did test worked very well except for 1 minor bug. All comments about this code should be sent to boyd1@proaxis.com. -= Rindar /* Add this at the beginning of the file: */ bool vorpal_kill args( ( CHAR_DATA *ch, CHAR_DATA *victim, int dam, int dt, int dam_type ) ); /* add this before tail_chain() at the end of one_hit and second_one_hit */ /* Vorpal weapon code by Kyle Boyd (boyd1@proaxis.com) */ /* To change probability of decapitation, tweak the number_range arguments */ if (IS_WEAPON_STAT(wield,WEAPON_VORPAL) && number_range(1,UMAX(50, 400 + MAX_LEVEL - (2 * ch->level) + victim->level )) == 1 && IS_SET(victim->parts,PART_HEAD) && check_immune(victim,dam_type) != IS_IMMUNE && !IS_IMMORTAL(victim) && ch != victim && !is_safe(ch,victim)) { char buf[MAX_STRING_LENGTH]; OBJ_DATA *obj; char *name; int parts_buf; /* used a modified version of death_cry to make a severed head */ name = IS_NPC(victim) ? victim->short_descr : victim->name; /* if you get an error on the OBJ_VNUM_SEVERED_HEAD, look for an object nameed "the head of %s" */ /* and put it's vnum there instead */ obj = create_object( get_obj_index( OBJ_VNUM_SEVERED_HEAD ), 0 ); obj->timer = number_range( 20, 30 ); sprintf( buf, obj->short_descr, name ); free_string( obj->short_descr ); obj->short_descr = str_dup( buf ); sprintf( buf, obj->description, name ); free_string( obj->description ); obj->description = str_dup( buf ); /* yummy... severed head for dinner! */ if (obj->item_type == ITEM_FOOD) { if (IS_SET(victim->form,FORM_POISON)) obj->value[3] = 1; else if (!IS_SET(victim->form,FORM_EDIBLE)) obj->item_type = ITEM_TRASH; } obj_to_room( obj, ch->in_room ); /* change this if you want a more or less gory death message! */ act("$n's head is severed from $s body by $p!",victim,wield,NULL,TO_ROOM); act("Your last feeling before you die is $p's weapon severing your head!",victim,ch,NULL,TO_CHAR); /* parts_buf is used to remove all parts of the body so the death_cry function does not create any other body parts */ parts_buf = victim->parts; victim->parts = 0; vorpal_kill(ch,victim,dam,dt,dam_type); victim->parts = parts_buf; } /* rest of one_hit and second_one_hit goes here */ /* add this vorpal_kill function. this ensures that ch gets exp for his kill and alginment is changed. */ /* vorpal_kill function also by Kyle Boyd (boyd1@proaxis.com) */ /* If you're trying to install this on a non-EmberMUD ROM, remove all references to chaos. */ bool vorpal_kill( CHAR_DATA *ch, CHAR_DATA *victim, int dam, int dt, int dam_type ) { char buf[MAX_STRING_LENGTH]; OBJ_DATA *corpse; extern bool chaos; int chaos_points; if ( victim->position == POS_DEAD ) return FALSE; /* * Stop up any residual loopholes. */ if ( victim == ch ) { log_string("BUG: victim == ch in vorpal_kill"); return FALSE; } if ( victim != ch ) { /* * Certain attacks are forbidden. * Most other attacks are returned. */ if ( is_safe( ch, victim ) ) return FALSE; check_killer( ch, victim ); if ( victim->position > POS_STUNNED ) { if ( victim->fighting == NULL ) set_fighting( victim, ch ); if (victim->timer <= 4) victim->position = POS_FIGHTING; } if ( victim->position > POS_STUNNED ) { if ( ch->fighting == NULL ) set_fighting( ch, victim ); /* * If victim is charmed, ch might attack victim's master. */ if ( IS_NPC(ch) && IS_NPC(victim) && IS_AFFECTED(victim, AFF_CHARM) && victim->master != NULL && victim->master->in_room == ch->in_room && number_bits( 3 ) == 0 ) { stop_fighting( ch, FALSE ); multi_hit( ch, victim->master, TYPE_UNDEFINED ); return FALSE; } } /* * More charm stuff. */ if ( victim->master == ch ) stop_follower( victim ); } /* * Inviso attacks ... not. */ if ( IS_AFFECTED(ch, AFF_INVISIBLE) ) { affect_strip( ch, gsn_invis ); affect_strip( ch, gsn_mass_invis ); REMOVE_BIT( ch->affected_by, AFF_INVISIBLE ); act( "`K$n fades into existence.`w", ch, NULL, NULL, TO_ROOM ); } /* dam changed to max_hit to get a neat damage message */ dam = victim->max_hit; dam_message( ch, victim, dam, dt, FALSE ); if (dam == 0) return FALSE; /* Ok, give the ch xp for his hit and add to ch->exp_stack */ if (!IS_NPC(ch)) { int xp = 0; int members = 0; int group_levels = 0; CHAR_DATA *gch; for ( gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room ) { if ( is_same_group( gch, ch ) ) { members++; group_levels += gch->level; } } xp = hit_xp_compute(ch, victim, group_levels, members, UMIN(dam, victim->hit + 20)); ch->exp_stack += xp; /* extra exp given for the vorpal kill. dam being really big doesn't give lots of exp */ /* the xp *= line may be taken out */ xp *= 3; gain_exp(ch, xp); } /* * KILL the victim. * Inform the victim of his new state. */ victim->hit = -20; update_pos( victim ); mprog_death_trigger( victim ); act( "`R$n is DEAD!!`w", victim, 0, 0, TO_ROOM ); send_to_char( "`RYou have been KILLED!!\n\r\n\r`w", victim ); /* * Sleep spells and extremely wounded folks. */ if ( !IS_AWAKE(victim) ) stop_fighting( victim, FALSE ); /* * Payoff for killing things. */ if ( victim->position == POS_DEAD ) { group_gain( ch, victim ); if ( !IS_NPC(victim) ) { sprintf( log_buf, "%s decapitated by %s at %d", victim->name, (IS_NPC(ch) ? ch->short_descr : ch->name), victim->in_room->vnum ); log_string( log_buf ); if ( !IS_IMMORTAL( ch ) ) { free_string( victim->pcdata->nemesis ); victim->pcdata->nemesis = str_dup( IS_NPC(ch) ? ch->short_descr : ch->name ); } /* * Dying penalty: * 1/2 way back to previous level. */ if ( !chaos && victim->exp > 0 && IS_NPC(ch) ) gain_exp( victim, -1*(victim->exp/2) ); } if ( chaos ) { chaos_points = 0; if (ch->level < victim->level) chaos_points = 2*(victim->level - ch->level); chaos_points = chaos_points + victim->level; ch->pcdata->chaos_score = chaos_points; } if (!IS_NPC(victim)) { sprintf(buf, "%s has been brutally decapitated by %s!", victim->name, IS_NPC(ch) ? ch->short_descr : ch->name); do_sendinfo(ch, buf); } if (chaos && !IS_NPC( victim ) ) chaos_kill( victim ); else if ( !( !IS_NPC( victim ) && !IS_NPC( ch ) ) ) raw_kill( victim ); else { pk_kill( victim ); if (!IS_IMMORTAL( ch )) { victim->pcdata->pk_deaths++; ch->pcdata->pk_kills++; } } /* RT new auto commands */ if ( !IS_NPC(ch) && IS_NPC(victim) ) { corpse = get_obj_list( ch, "corpse", ch->in_room->contents ); if ( IS_SET(ch->act, PLR_AUTOLOOT) && corpse && corpse->contains) /* exists and not empty */ do_get( ch, "all corpse" ); if (IS_SET(ch->act,PLR_AUTOGOLD) && corpse && corpse->contains && /* exists and not empty */ !IS_SET(ch->act,PLR_AUTOLOOT)) do_get(ch, "gold corpse"); if ( IS_SET(ch->act, PLR_AUTOSAC) ) if ( IS_SET(ch->act,PLR_AUTOLOOT) && corpse && corpse->contains) return TRUE; /* leave if corpse has treasure */ else do_sacrifice( ch, "corpse" ); } return TRUE; } tail_chain( ); return TRUE; } ============================================================================= / ______ _______ ____ _____ ___ __ _ ______ ____ ____ _____ / \ | ____|__ __| _ \ / ____\ / _ \| \ / | ____| / __ \| _ \ / ____\ \ / | |__ | | | |_| | | | |_| | |\/| | |___ | | | | |_| | | / / | ___| | | | ___/| | __| _ | | | | ____| | | | | __/| | ___ \ \ | | | | | | | |___| | | | | | | | |____ | |__| | |\ \| |___| | / / |_| |_| |_| o \_____/|_| |_|_| |_|______|o \____/|_| \_|\_____/ \ \ / ============================================================================ ------------------------------------------------------------------------------ ftp://ftp.game.org/pub/mud FTP.GAME.ORG http://www.game.org/ftpsite/ ------------------------------------------------------------------------------ This file came from FTP.GAME.ORG, the ultimate source for MUD resources. ------------------------------------------------------------------------------