/* The effectiveness of the modules can vary depending on the level of the technitian's makemodule skill */ void do_makemodule( CHAR_DATA *ch, char *argument ) { char arg[MAX_INPUT_LENGTH]; int affecttype, affectammount; char name[MAX_STRING_LENGTH]; int level, chance; bool checklens, checkbat, checksuper, checkcircuit, checktool; OBJ_DATA *obj; OBJ_INDEX_DATA *pObjIndex; argument = one_argument( argument, arg ); switch( ch->substate ) { default: if(str_cmp(arg, "hull") && str_cmp( arg, "slave") && str_cmp( arg, "tractor") && str_cmp(arg, "torpedo") && str_cmp(arg, "rocket") && str_cmp(arg, "missile") && str_cmp(arg, "primary") && str_cmp(arg, "secondary") && str_cmp(arg, "shield") && str_cmp(arg, "speed") && str_cmp(arg, "hyperspeed") && str_cmp(arg, "energy") && str_cmp(arg, "manuever") && str_cmp(arg, "chaff") && str_cmp(arg, "alarm")){ send_to_char("Modules may affect the following aspects of the ship:\n\rPrimary, Secondary, Missile, Rocket, Torpedo, Hull, Shield, Speed, Hyperspeed, Energy, Manuever, Slave, Tractor, Chaff, and Alarm.\n\r", ch); return; } checklens = FALSE; checkbat = FALSE; checksuper = FALSE; checkcircuit = FALSE; checktool = FALSE; if ( !IS_SET( ch->in_room->room_flags, ROOM_FACTORY ) ) { send_to_char( "&RYou need to be in a factory or workshop to do that.\n\r", ch); return; } for ( obj = ch->last_carrying; obj; obj = obj->prev_content ) { if (obj->item_type == ITEM_LENS) checklens = TRUE; if (obj->item_type == ITEM_BATTERY) checkbat = TRUE; if (obj->item_type == ITEM_SUPERCONDUCTOR) checksuper = TRUE; if (obj->item_type == ITEM_CIRCUIT) checkcircuit = TRUE; if (obj->item_type == ITEM_TOOLKIT) checktool = TRUE; } if ( !checklens ) { send_to_char( "&RYou need a lens to control the energy.\n\r", ch); return; } if ( !checkbat ) { send_to_char( "&RYou need a battery to power the module.\n\r", ch); return; } if ( !checksuper ) { send_to_char( "&RYou need a superconductor to focus the energy.\n\r", ch); return; } if ( !checkcircuit ) { send_to_char( "&RYou need a circuit board to control the module.\n\r", ch); return; } if ( !checktool ) { send_to_char( "&RYou need a toolkit to build the module.\n\r", ch); return; } chance = IS_NPC(ch) ? ch->top_level : (int) (ch->pcdata->learned[gsn_makemodule]); if ( number_percent( ) < chance ) { send_to_char( "&GYou begin the long process of creating a module.\n\r", ch); act( AT_PLAIN, "$n takes $s tools and begins to work.", ch, NULL, argument , TO_ROOM ); add_timer ( ch , TIMER_DO_FUN , 10 , do_makemodule , 1 ); ch->dest_buf = str_dup(arg); return; } send_to_char("&RYou can't figure out what to do.\n\r",ch); learn_from_failure( ch, gsn_makemodule ); return; case 1: if ( !ch->dest_buf ) return; strcpy(arg, ch->dest_buf); DISPOSE( ch->dest_buf); break; case SUB_TIMER_DO_ABORT: DISPOSE( ch->dest_buf ); ch->substate = SUB_NONE; send_to_char("&RYou are interupted and fail to finish your work.\n\r", ch); return; } ch->substate = SUB_NONE; level = IS_NPC(ch) ? ch->top_level : (int) (ch->pcdata->learned[gsn_makemodule]); if ( ( pObjIndex = get_obj_index( MODULE_VNUM ) ) == NULL ) { send_to_char( "&RThe item you are trying to create is missing from the database.\n\rPlease inform the administration of this error.\n\r", ch ); return; } checklens = FALSE; checkbat = FALSE; checksuper = FALSE; checkcircuit = FALSE; checktool = FALSE; for ( obj = ch->last_carrying; obj; obj = obj->prev_content ) { if (obj->item_type == ITEM_TOOLKIT) checktool = TRUE; if (obj->item_type == ITEM_LENS && checklens == FALSE) { checklens = TRUE; separate_obj( obj ); obj_from_char( obj ); } if (obj->item_type == ITEM_BATTERY && checkbat == FALSE) { checkbat = TRUE; separate_obj( obj ); obj_from_char( obj ); } if (obj->item_type == ITEM_SUPERCONDUCTOR && checksuper == FALSE) { checksuper = TRUE; separate_obj( obj ); obj_from_char( obj ); } if (obj->item_type == ITEM_CIRCUIT && checkcircuit == FALSE) { checkcircuit = TRUE; separate_obj( obj ); obj_from_char( obj ); } } chance = IS_NPC(ch) ? ch->top_level : (int) (ch->pcdata->learned[gsn_makemodule]) ; if ( number_percent( ) > chance*2 || ( !checklens ) || ( !checktool ) || ( !checkbat ) || ( !checksuper ) || ( !checkcircuit ) ) { send_to_char( "&RYou hold up your newly created module.\n\r", ch); send_to_char( "&RThe module begins to shake violently turning red hot!\n\r", ch); send_to_char( "&RYou drop it as it begins to burn your hand and then.. It disintigrates!\n\r", ch); learn_from_failure( ch, gsn_makemodule ); return; } if(!str_cmp(arg, "primary")){ affecttype = AFFECT_PRIMARY; affectammount = 1; strcpy(name, "A Primary Weapons Module"); } if(!str_cmp(arg, "secondary")){ affecttype = AFFECT_SECONDARY; affectammount = 1; strcpy(name, "A Secondary Weapons Module"); } if(!str_cmp(arg, "slave")) { affecttype = AFFECT_SLAVE; affectammount = (level / 4); strcpy(name, "A Slave Module"); } if(!str_cmp(arg, "tractor")) { affecttype = AFFECT_TRACTOR; affectammount = 1; strcpy(name, "A Tractor Beam Module"); } if(!str_cmp(arg, "missile")){ affecttype = AFFECT_MISSILE; affectammount = (level / 20); strcpy(name, "A Missile Module"); } if(!str_cmp(arg, "rocket")){ affecttype = AFFECT_ROCKET; affectammount = (level / 20); strcpy(name, "A Rocket Module"); } if(!str_cmp(arg, "torpedo")){ affecttype = AFFECT_TORPEDO; affectammount = (level / 20); strcpy(name, "A Torpedo Module"); } if(!str_cmp(arg, "hull")){ affecttype = AFFECT_HULL; affectammount = (level / 2); strcpy(name, "A Hull Module"); } if(!str_cmp(arg, "shield")){ affecttype = AFFECT_SHIELD; affectammount = (level/5); strcpy(name, "A Shield Module"); } if(!str_cmp(arg, "speed")){ affecttype = AFFECT_SPEED; affectammount = (level / 10); strcpy(name, "A Speed Module"); } if(!str_cmp(arg, "hyperspeed")){ affecttype = AFFECT_HYPER; affectammount = 1; strcpy(name, "A Hyperspeed Module"); } if(!str_cmp(arg, "energy")){ affecttype = AFFECT_ENERGY; affectammount = (level * 5); strcpy(name, "An Energy Module"); } if(!str_cmp(arg, "manuever")){ affecttype = AFFECT_MANUEVER; affectammount = (level / 10); strcpy(name, "A Manuever Module"); } if(!str_cmp(arg, "alarm")) { affecttype = AFFECT_ALARM; affectammount = 1; strcpy(name, "An Alarm Module"); } if(!str_cmp(arg, "chaff")) { affecttype = AFFECT_CHAFF; affectammount = URANGE(1,(level / 33), 3); strcpy(name, "A Chaff Module"); } obj = create_object( pObjIndex, level ); obj->item_type = ITEM_MODULE; SET_BIT( obj->wear_flags, ITEM_TAKE ); obj->level = level; STRFREE( obj->name ); obj->name = STRALLOC( name ); STRFREE( obj->short_descr ); obj->short_descr = STRALLOC( name ); STRFREE( obj->description ); strcat( name, " was dropped here." ); obj->description = STRALLOC( name ); obj->value[0] = affecttype; obj->value[1] = affectammount; obj->value[2] = 0; obj->cost = (level * affecttype * affectammount); obj = obj_to_char( obj, ch ); send_to_char( "&GYou finish your work and hold up your newly created module.&w\n\r", ch); act( AT_PLAIN, "$n finishes creating a new module.", ch, NULL, argument , TO_ROOM ); { long xpgain; xpgain = ((ch->skill_level[TECHNICIAN_ABILITY]+1) * 200); gain_exp(ch, xpgain, TECHNICIAN_ABILITY); ch_printf( ch , "You gain %d technician experience.", xpgain ); } learn_from_success( ch, gsn_makemodule ); }
int Char_Data :: Wisdom( ) { return URANGE( 3, shdata->wisdom+mod_wis, 30 ); }
int char_data :: Dexterity( ) { return URANGE( 3, shdata->dexterity+mod_dex-get_burden( ), 30 ); }
/* * Reset one room. */ void reset_room( ROOM_INDEX_DATA * room ) { RESET_DATA *pReset, *tReset, *gReset; OBJ_DATA *nestmap[MAX_NEST]; CHAR_DATA *mob; OBJ_DATA *obj, *lastobj, *to_obj; ROOM_INDEX_DATA *pRoomIndex = NULL; MOB_INDEX_DATA *pMobIndex = NULL; OBJ_INDEX_DATA *pObjIndex = NULL, *pObjToIndex; EXIT_DATA *pexit; const char *filename = room->area->filename; int level = 0, n, num = 0, lastnest, onreset = 0; mob = NULL; obj = NULL; lastobj = NULL; if( !room->first_reset ) return; level = 0; for( pReset = room->first_reset; pReset; pReset = pReset->next ) { ++onreset; switch ( pReset->command ) { default: bug( "%s: %s: bad command %c.", __func__, filename, pReset->command ); break; case 'M': if( !( pMobIndex = get_mob_index( pReset->arg1 ) ) ) { bug( "%s: %s: 'M': bad mob vnum %d.", __func__, filename, pReset->arg1 ); continue; } if( !( pRoomIndex = get_room_index( pReset->arg3 ) ) ) { bug( "%s: %s: 'M': bad room vnum %d.", __func__, filename, pReset->arg3 ); continue; } if( !pReset->sreset ) { mob = NULL; break; } mob = create_mobile( pMobIndex ); { ROOM_INDEX_DATA *pRoomPrev = get_room_index( pReset->arg3 - 1 ); if( pRoomPrev && xIS_SET( pRoomPrev->room_flags, ROOM_PET_SHOP ) ) xSET_BIT( mob->act, ACT_PET ); } if( room_is_dark( pRoomIndex ) ) xSET_BIT( mob->affected_by, AFF_INFRARED ); mob->resetvnum = pRoomIndex->vnum; mob->resetnum = onreset; pReset->sreset = false; char_to_room( mob, pRoomIndex ); level = URANGE( 0, mob->level - 2, LEVEL_AVATAR ); if( pReset->first_reset ) { for( tReset = pReset->first_reset; tReset; tReset = tReset->next_reset ) { ++onreset; switch ( tReset->command ) { case 'G': case 'E': if( !( pObjIndex = get_obj_index( tReset->arg1 ) ) ) { bug( "%s: %s: 'E' or 'G': bad obj vnum %d.", __func__, filename, tReset->arg1 ); continue; } if( !mob ) { lastobj = NULL; break; } if( mob->pIndexData->pShop ) { int olevel = generate_itemlevel( room->area, pObjIndex ); obj = create_object( pObjIndex, olevel ); xSET_BIT( obj->extra_flags, ITEM_INVENTORY ); } else obj = create_object( pObjIndex, number_fuzzy( level ) ); obj->level = URANGE( 0, obj->level, LEVEL_AVATAR ); obj = obj_to_char( obj, mob ); if( tReset->command == 'E' ) { if( obj->carried_by != mob ) { bug( "'E' reset: can't give object %d to mob %d.", obj->pIndexData->vnum, mob->pIndexData->vnum ); break; } equip_char( mob, obj, tReset->arg3 ); } for( n = 0; n < MAX_NEST; n++ ) nestmap[n] = NULL; nestmap[0] = obj; lastobj = nestmap[0]; lastnest = 0; if( tReset->first_reset ) { for( gReset = tReset->first_reset; gReset; gReset = gReset->next_reset ) { int iNest; to_obj = lastobj; ++onreset; switch ( gReset->command ) { case 'H': if( !lastobj ) break; xSET_BIT( lastobj->extra_flags, ITEM_HIDDEN ); break; case 'P': if( !( pObjIndex = get_obj_index( gReset->arg1 ) ) ) { bug( "%s: %s: 'P': bad obj vnum %d.", __func__, filename, gReset->arg1 ); continue; } iNest = gReset->extra; if( !( pObjToIndex = get_obj_index( gReset->arg3 ) ) ) { bug( "%s: %s: 'P': bad objto vnum %d.", __func__, filename, gReset->arg3 ); continue; } if( iNest >= MAX_NEST ) { bug( "%s: %s: 'P': Exceeded nesting limit of %d", __func__, filename, MAX_NEST ); obj = NULL; break; } if( count_obj_list( pObjIndex, to_obj->first_content ) > 0 ) { obj = NULL; break; } if( iNest < lastnest ) to_obj = nestmap[iNest]; else if( iNest == lastnest ) to_obj = nestmap[lastnest]; else to_obj = lastobj; obj = create_object( pObjIndex, number_fuzzy( UMAX ( generate_itemlevel( room->area, pObjIndex ), to_obj->level ) ) ); if( num > 1 ) pObjIndex->count += ( num - 1 ); obj->count = gReset->arg2; obj->level = UMIN( obj->level, LEVEL_AVATAR ); obj->count = gReset->arg2; obj_to_obj( obj, to_obj ); if( iNest > lastnest ) { nestmap[iNest] = to_obj; lastnest = iNest; } lastobj = obj; /* * Hackish fix for nested puts */ if( gReset->arg3 == OBJ_VNUM_MONEY_ONE ) gReset->arg3 = to_obj->pIndexData->vnum; break; } } } break; } } } break; case 'O': if( !( pObjIndex = get_obj_index( pReset->arg1 ) ) ) { bug( "%s: %s: 'O': bad obj vnum %d.", __func__, filename, pReset->arg1 ); continue; } if( !( pRoomIndex = get_room_index( pReset->arg3 ) ) ) { bug( "%s: %s: 'O': bad room vnum %d.", __func__, filename, pReset->arg3 ); continue; } if( count_obj_list( pObjIndex, pRoomIndex->first_content ) < 1 ) { obj = create_object( pObjIndex, number_fuzzy( generate_itemlevel( room->area, pObjIndex ) ) ); if( num > 1 ) pObjIndex->count += ( num - 1 ); obj->count = pReset->arg2; obj->level = UMIN( obj->level, LEVEL_AVATAR ); obj->cost = 0; obj_to_room( obj, pRoomIndex ); } else { int x; if( !( obj = get_obj_room( pObjIndex, pRoomIndex ) ) ) { obj = NULL; lastobj = NULL; break; } obj->extra_flags = pObjIndex->extra_flags; for( x = 0; x < 6; ++x ) obj->value[x] = pObjIndex->value[x]; } for( n = 0; n < MAX_NEST; n++ ) nestmap[n] = NULL; nestmap[0] = obj; lastobj = nestmap[0]; lastnest = 0; if( pReset->first_reset ) { for( tReset = pReset->first_reset; tReset; tReset = tReset->next_reset ) { int iNest; to_obj = lastobj; ++onreset; switch ( tReset->command ) { case 'H': if( !lastobj ) break; xSET_BIT( lastobj->extra_flags, ITEM_HIDDEN ); break; case 'T': if( !IS_SET( tReset->extra, TRAP_OBJ ) ) { bug( "%s: Room reset found on object reset list", __func__ ); break; } else { /* * We need to preserve obj for future 'T' checks */ OBJ_DATA *pobj; if( tReset->arg3 > 0 ) { if( !( pObjToIndex = get_obj_index( tReset->arg3 ) ) ) { bug( "%s: %s: 'T': bad objto vnum %d.", __func__, filename, tReset->arg3 ); continue; } if( room->area->nplayer > 0 || !( to_obj = get_obj_type( pObjToIndex ) ) || ( to_obj->carried_by && !IS_NPC( to_obj->carried_by ) ) || is_trapped( to_obj ) ) break; } else { if( !lastobj || !obj ) break; to_obj = obj; } pobj = make_trap( tReset->arg2, tReset->arg1, number_fuzzy( to_obj->level ), tReset->extra ); obj_to_obj( pobj, to_obj ); } break; case 'P': if( !( pObjIndex = get_obj_index( tReset->arg1 ) ) ) { bug( "%s: %s: 'P': bad obj vnum %d.", __func__, filename, tReset->arg1 ); continue; } iNest = tReset->extra; if( !( pObjToIndex = get_obj_index( tReset->arg3 ) ) ) { bug( "%s: %s: 'P': bad objto vnum %d.", __func__, filename, tReset->arg3 ); continue; } if( iNest >= MAX_NEST ) { bug( "%s: %s: 'P': Exceeded nesting limit of %d. Room %d.", __func__, filename, MAX_NEST, room->vnum ); obj = NULL; break; } if( count_obj_list( pObjIndex, to_obj->first_content ) > 0 ) { obj = NULL; break; } if( iNest < lastnest ) to_obj = nestmap[iNest]; else if( iNest == lastnest ) to_obj = nestmap[lastnest]; else to_obj = lastobj; obj = create_object( pObjIndex, number_fuzzy( UMAX ( generate_itemlevel( room->area, pObjIndex ), to_obj->level ) ) ); if( num > 1 ) pObjIndex->count += ( num - 1 ); obj->count = tReset->arg2; obj->level = UMIN( obj->level, LEVEL_AVATAR ); obj->count = tReset->arg2; obj_to_obj( obj, to_obj ); if( iNest > lastnest ) { nestmap[iNest] = to_obj; lastnest = iNest; } lastobj = obj; /* * Hackish fix for nested puts */ if( tReset->arg3 == OBJ_VNUM_MONEY_ONE ) tReset->arg3 = to_obj->pIndexData->vnum; break; } } } break; case 'T': if( IS_SET( pReset->extra, TRAP_OBJ ) ) { bug( "%s: Object trap found in room %d reset list", __func__, room->vnum ); break; } else { if( !( pRoomIndex = get_room_index( pReset->arg3 ) ) ) { bug( "%s: %s: 'T': bad room %d.", __func__, filename, pReset->arg3 ); continue; } if( room->area->nplayer > 0 || count_obj_list( get_obj_index( OBJ_VNUM_TRAP ), pRoomIndex->first_content ) > 0 ) break; to_obj = make_trap( pReset->arg1, pReset->arg1, 10, pReset->extra ); obj_to_room( to_obj, pRoomIndex ); } break; case 'D': if( !( pRoomIndex = get_room_index( pReset->arg1 ) ) ) { bug( "%s: %s: 'D': bad room vnum %d.", __func__, filename, pReset->arg1 ); continue; } if( !( pexit = get_exit( pRoomIndex, pReset->arg2 ) ) ) break; switch ( pReset->arg3 ) { case 0: REMOVE_BIT( pexit->exit_info, EX_CLOSED ); REMOVE_BIT( pexit->exit_info, EX_LOCKED ); break; case 1: SET_BIT( pexit->exit_info, EX_CLOSED ); REMOVE_BIT( pexit->exit_info, EX_LOCKED ); if( IS_SET( pexit->exit_info, EX_xSEARCHABLE ) ) SET_BIT( pexit->exit_info, EX_SECRET ); break; case 2: SET_BIT( pexit->exit_info, EX_CLOSED ); SET_BIT( pexit->exit_info, EX_LOCKED ); if( IS_SET( pexit->exit_info, EX_xSEARCHABLE ) ) SET_BIT( pexit->exit_info, EX_SECRET ); break; } break; case 'R': if( !( pRoomIndex = get_room_index( pReset->arg1 ) ) ) { bug( "%s: %s: 'R': bad room vnum %d.", __func__, filename, pReset->arg1 ); continue; } randomize_exits( pRoomIndex, pReset->arg2 - 1 ); break; } } }
int Char_Data :: Intelligence( ) { return URANGE( 3, shdata->intelligence+mod_int, 30 ); }
void load_mobiles(FILE * fp) { MOB_INDEX_DATA *pMobIndex; if (!area_last) { /* OLC */ bug("Load_mobiles: no #AREA seen yet.", 0); exit(1); } for (;;) { sh_int vnum; char letter; int iHash; letter = fread_letter(fp); if (letter != '#') { bug("Load_mobiles: # not found.", 0); exit(1); } vnum = fread_number(fp); if (vnum == 0) break; fBootDb = FALSE; if (get_mob_index(vnum) != NULL) { bug("Load_mobiles: vnum %d duplicated.", vnum); exit(1); } fBootDb = TRUE; pMobIndex = alloc_perm(sizeof(*pMobIndex)); pMobIndex->vnum = vnum; pMobIndex->area = area_last; /* OLC */ pMobIndex->new_format = TRUE; newmobs++; pMobIndex->player_name = fread_string(fp); pMobIndex->short_descr = fread_string(fp); pMobIndex->long_descr = fread_string(fp); pMobIndex->long_descr_orig = fread_string(fp); pMobIndex->description = fread_string(fp); pMobIndex->race = race_lookup(fread_string(fp)); pMobIndex->long_descr[0] = UPPER(pMobIndex->long_descr[0]); pMobIndex->description[0] = UPPER(pMobIndex->description[0]); pMobIndex->act = fread_flag(fp) | ACT_IS_NPC | race_table[pMobIndex->race].act; pMobIndex->affected_by = fread_flag(fp) | race_table[pMobIndex->race].aff; pMobIndex->pShop = NULL; pMobIndex->alignment = fread_number(fp); pMobIndex->group = fread_number(fp); pMobIndex->level = fread_number(fp); pMobIndex->hitroll = fread_number(fp); /* read hit dice */ pMobIndex->hit[DICE_NUMBER] = fread_number(fp); /* 'd' */ fread_letter(fp); pMobIndex->hit[DICE_TYPE] = fread_number(fp); /* '+' */ fread_letter(fp); pMobIndex->hit[DICE_BONUS] = fread_number(fp); /* read mana dice */ pMobIndex->mana[DICE_NUMBER] = fread_number(fp); fread_letter(fp); pMobIndex->mana[DICE_TYPE] = fread_number(fp); fread_letter(fp); pMobIndex->mana[DICE_BONUS] = fread_number(fp); /* read damage dice */ pMobIndex->damage[DICE_NUMBER] = fread_number(fp); fread_letter(fp); pMobIndex->damage[DICE_TYPE] = fread_number(fp); fread_letter(fp); pMobIndex->damage[DICE_BONUS] = fread_number(fp); pMobIndex->dam_type = attack_lookup(fread_word(fp)); /* read armor class */ pMobIndex->ac[AC_PIERCE] = fread_number(fp) * 10; pMobIndex->ac[AC_BASH] = fread_number(fp) * 10; pMobIndex->ac[AC_SLASH] = fread_number(fp) * 10; pMobIndex->ac[AC_EXOTIC] = fread_number(fp) * 10; /* read flags and add in data from the race table */ pMobIndex->off_flags = fread_flag(fp) | race_table[pMobIndex->race].off; pMobIndex->imm_flags = fread_flag(fp) | race_table[pMobIndex->race].imm; pMobIndex->res_flags = fread_flag(fp) | race_table[pMobIndex->race].res; pMobIndex->vuln_flags = fread_flag(fp) | race_table[pMobIndex->race].vuln; /* vital statistics */ pMobIndex->start_pos = position_lookup(fread_word(fp)); pMobIndex->default_pos = position_lookup(fread_word(fp)); pMobIndex->sex = sex_lookup(fread_word(fp)); pMobIndex->wealth = fread_number(fp); pMobIndex->form = fread_flag(fp) | race_table[pMobIndex->race].form; pMobIndex->parts = fread_flag(fp) | race_table[pMobIndex->race].parts; /* size */ pMobIndex->size = size_lookup(fread_word(fp)); pMobIndex->material = str_dup(fread_word(fp)); for (;;) { letter = fread_letter(fp); if (letter == 'F') { char *word; long vector; word = fread_word(fp); vector = fread_flag(fp); if (!str_prefix(word, "act")) REMOVE_BIT(pMobIndex->act, vector); else if (!str_prefix(word, "aff")) REMOVE_BIT(pMobIndex->affected_by, vector); else if (!str_prefix(word, "off")) REMOVE_BIT(pMobIndex->off_flags, vector); else if (!str_prefix(word, "imm")) REMOVE_BIT(pMobIndex->imm_flags, vector); else if (!str_prefix(word, "res")) REMOVE_BIT(pMobIndex->res_flags, vector); else if (!str_prefix(word, "vul")) REMOVE_BIT(pMobIndex->vuln_flags, vector); else if (!str_prefix(word, "for")) REMOVE_BIT(pMobIndex->form, vector); else if (!str_prefix(word, "par")) REMOVE_BIT(pMobIndex->parts, vector); else { bug("Flag remove: flag not found.", 0); exit(1); } } else if (letter == 'M') { MPROG_LIST *pMprog; char *word; int trigger = 0; pMprog = alloc_perm(sizeof(*pMprog)); word = fread_word(fp); if (!(trigger = flag_lookup(word, mprog_flags))) { bug("MOBprogs: invalid trigger.", 0); exit(1); } SET_BIT(pMobIndex->mprog_flags, trigger); pMprog->trig_type = trigger; pMprog->vnum = fread_number(fp); pMprog->trig_phrase = fread_string(fp); pMprog->next = pMobIndex->mprogs; pMobIndex->mprogs = pMprog; } else { ungetc(letter, fp); break; } } iHash = vnum % MAX_KEY_HASH; pMobIndex->next = mob_index_hash[iHash]; mob_index_hash[iHash] = pMobIndex; top_mob_index++; top_vnum_mob = top_vnum_mob < vnum ? vnum : top_vnum_mob; /* OLC */ assign_area_vnum(vnum); /* OLC */ kill_table[URANGE(0, pMobIndex->level, MAX_LEVEL - 1)].number++; } return; }
void claim_disintegration( CHAR_DATA * ch, CHAR_DATA * victim ) { BOUNTY_DATA *bounty; long int bexp; char buf[MAX_STRING_LENGTH]; CLAN_DATA *clan; if( IS_NPC( victim ) ) return; bounty = get_disintegration( victim->name ); if( ch == victim ) { if( bounty != NULL ) remove_disintegration( bounty ); return; } if( bounty && !ch->pcdata ) { remove_disintegration( bounty ); bounty = NULL; } /* Assassin Experience for Clan Leaders added by Tawnos */ if( victim->pcdata && victim->pcdata->clan ) { clan = victim->pcdata->clan; if( victim->pcdata->clan && ( !str_cmp( victim->name, clan->leader ) || !str_cmp( victim->name, clan->number1 ) || !str_cmp( victim->name, clan->number2 ) ) ) { if( !str_cmp( victim->name, clan->leader ) ) { bexp = ( exp_level( ch->skill_level[ASSASSIN_ABILITY] + 1 ) - exp_level( ch->skill_level[ASSASSIN_ABILITY] ) ); gain_exp( ch, bexp, ASSASSIN_ABILITY ); set_char_color( AT_BLOOD, ch ); ch_printf( ch, "You receive %ld assassin experience for executing a clan leader.\n\r", bexp ); } else if( !str_cmp( victim->name, clan->number1 ) || !str_cmp( victim->name, clan->number2 ) ) { bexp = ( exp_level( ch->skill_level[ASSASSIN_ABILITY] + 1 ) - exp_level( ch->skill_level[ASSASSIN_ABILITY] ) ); gain_exp( ch, bexp, ASSASSIN_ABILITY ); set_char_color( AT_BLOOD, ch ); ch_printf( ch, "You receive %ld assassin experience for executing a prominent clan member.\n\r", bexp ); } } } if( bounty == NULL ) { if( IS_SET( victim->act, PLR_KILLER ) && !IS_NPC( ch ) ) { bexp = URANGE( 1, xp_compute( ch, victim ), ( exp_level( ch->skill_level[HUNTING_ABILITY] + 1 ) - exp_level( ch->skill_level[HUNTING_ABILITY] ) ) ); gain_exp( ch, bexp, HUNTING_ABILITY ); set_char_color( AT_BLOOD, ch ); ch_printf( ch, "You receive %ld hunting experience for executing a wanted killer.\n\r", bexp ); } else if( !IS_NPC( ch ) ) { SET_BIT( ch->act, PLR_KILLER ); ch_printf( ch, "You are now wanted for the murder of %s.\n\r", victim->name ); } sprintf( buf, "%s is Dead!", victim->name ); echo_to_all( AT_RED, buf, 0 ); return; } ch->gold += bounty->amount; bexp = URANGE( 1, bounty->amount + xp_compute( ch, victim ), ( exp_level( ch->skill_level[HUNTING_ABILITY] + 1 ) - exp_level( ch->skill_level[HUNTING_ABILITY] ) ) ); gain_exp( ch, bexp, HUNTING_ABILITY ); set_char_color( AT_BLOOD, ch ); ch_printf( ch, "You receive %ld experience and %ld credits,\n\r from the bounty on %s\n\r", exp, bounty->amount, bounty->target ); sprintf( buf, "The disintegration bounty on %s has been claimed!", victim->name ); echo_to_all( AT_RED, buf, 0 ); sprintf( buf, "%s is Dead!", victim->name ); echo_to_all( AT_RED, buf, 0 ); if( !IS_SET( victim->act, PLR_KILLER ) ) SET_BIT( ch->act, PLR_KILLER ); remove_disintegration( bounty ); }
/* funckja testujaca zniszczenie obiektu od roznego rodzaju ataku * zwraca true jesli obiekt zniszczy sie, else false */ bool check_item_resist( OBJ_DATA *obj, int type, int dam ) { int resist; switch ( type ) { case RESIST_FIRE: resist = material_table[ obj->material ].fire_res;break; case RESIST_ACID: resist = material_table[ obj->material ].acid_res;break; case RESIST_ELECTRICITY: resist = material_table[ obj->material ].shock_res;break; case RESIST_COLD: resist = material_table[ obj->material ].cold_res;break; default: resist = material_table[ obj->material ].other_res;break; } if ( IS_OBJ_STAT( obj, ITEM_UNDESTRUCTABLE ) ) return FALSE; if ( type == RESIST_SOUND && material_table[ obj->material ].flag != MAT_EASYBREAK ) return FALSE; if ( type == RESIST_FIRE && IS_OBJ_STAT( obj, ITEM_BURN_PROOF )) return FALSE; if ( type == RESIST_FIRE && obj->item_type == ITEM_WEAPON && ( IS_SET( obj->value[ 4 ], WEAPON_FLAMING || IS_SET( obj->value[ 4 ], WEAPON_FLAMING_BURST )))) return FALSE; if ( type == RESIST_ACID && obj->item_type == ITEM_WEAPON && ( IS_SET( obj->value[ 4 ], WEAPON_TOXIC || IS_SET( obj->value[ 4 ], WEAPON_TOXIC_BURST )))) return FALSE; if ( type == RESIST_ELECTRICITY && obj->item_type == ITEM_WEAPON && ( IS_SET( obj->value[ 4 ], WEAPON_SHOCKING || IS_SET( obj->value[ 4 ], WEAPON_SHOCKING_BURST )))) return FALSE; if ( type == RESIST_COLD && obj->item_type == ITEM_WEAPON && ( IS_SET( obj->value[ 4 ], WEAPON_FROST || IS_SET( obj->value[ 4 ], WEAPON_FROST_BURST )))) return FALSE; if ( type == RESIST_SOUND && obj->item_type == ITEM_WEAPON && ( IS_SET( obj->value[ 4 ], WEAPON_RESONANT || IS_SET( obj->value[ 4 ], WEAPON_SONIC_BURST )))) return FALSE; if ( IS_OBJ_STAT( obj, ITEM_BLESS ) ) resist = URANGE( 0, resist + 15, 100 ); if ( IS_OBJ_STAT( obj, ITEM_MAGIC ) ) resist = URANGE( 0, resist + 35, 100 ); if ( ( obj->item_type == ITEM_DRINK_CON || obj->item_type == ITEM_POTION ) && type == RESIST_COLD ) resist = URANGE( 0, resist + 20, 100 ); // resist = 20; Brohacz: zmiana na += i URANGE; if ( ( obj->item_type == ITEM_WAND || obj->item_type == ITEM_STAFF ) && type == RESIST_ELECTRICITY ) resist = URANGE( 0, resist + 20, 100 ); // resist = 20; Brohacz: zmiana na += i URANGE; /* Tener: zmieniam odporno¶æ tego typu przedmiotów z 20 na 80 procent. Powód? S± magiczne! * Rellik: papier magiczny pali siê tak samo dobrze jak zwyk³y... ;) */ //2008-11-20, Brohacz: to zalezy, czy ksiazka ma flage magic. Przywracam resist 20, nie ulatwiajmy zdobywania ksiag w pojedynke, a przeciez o to tu chodzi. if ( ( obj->item_type == ITEM_SPELLBOOK || obj->item_type == ITEM_SCROLL ) && type == RESIST_FIRE ) resist = URANGE( 0, resist + 20, 100 ); // resist = 20; Brohacz: zmiana na += i URANGE; dam = DAMAGE_MULTIPLIER * dam / 100; dam = ( 100 - resist ) * dam / 100; dam = URANGE( 0, dam, 100 ); obj->condition -= dam; if ( obj->condition < 0 ) return TRUE; return FALSE; }
void shock_effect( void *vo, int level, int dam, int target ) { if ( target == TARGET_ROOM ) { ROOM_INDEX_DATA * room = ( ROOM_INDEX_DATA * ) vo; OBJ_DATA *obj, *obj_next; for ( obj = room->contents; obj != NULL; obj = obj_next ) { OBJ_NEXT_CONTENT( obj, obj_next ); if ( IS_OBJ_STAT( obj, ITEM_NOPURGE ) ) continue; shock_effect( obj, level, dam, TARGET_OBJ ); } return ; } else if ( target == TARGET_CHAR ) { CHAR_DATA * victim = ( CHAR_DATA * ) vo; OBJ_DATA *obj, *obj_next; if ( !victim->in_room ) return ; /* jesli ma mozg znaczy siê mozna zszkokowac */ if ( IS_SET( race_table[ GET_RACE( victim ) ].parts, PART_BRAINS ) && !IS_SET( race_table[ GET_RACE( victim ) ].form, FORM_MAGICAL ) && !is_undead( victim ) && !IS_SET( race_table[ GET_RACE( victim ) ].form, FORM_CONSTRUCT ) && !IS_SET( race_table[ GET_RACE( victim ) ].form, FORM_MIST ) && !IS_SET( race_table[ GET_RACE( victim ) ].form, FORM_BLOB ) && !IS_SET( race_table[ GET_RACE( victim ) ].form, FORM_DRAGON ) ) { int chance_of_knockout = 0; if ( IS_SET( race_table[ GET_RACE( victim ) ].type, PERSON ) ) chance_of_knockout = 10 + dam/10 + level/10; else if ( IS_SET( race_table[ GET_RACE( victim ) ].type, ANIMAL ) ) chance_of_knockout = 5 + dam/11.5 + level/11.5; else if ( IS_SET( race_table[ GET_RACE( victim ) ].type, MONSTER ) ) chance_of_knockout = 3 + dam/13 + level/13; if ( chance_of_knockout > 0 && number_percent() < chance_of_knockout && !IS_AFFECTED(victim,AFF_STABILITY) ) { /* wait */ WAIT_STATE( victim, URANGE( 12, dam/3, 36 ) ); /* stoi badz walczy? no to hop na glebe */ if ( victim->position == POS_STANDING || victim->position == POS_FIGHTING ) { if ( victim->sex == 0 ) { send_to_char( "Tracisz kontrolê nad swoim cia³em i osuwasz siê po³przytomne na ziemie.\n\r", victim ); act( "$n osuwa siê polprzytomne na ziemie.", victim, NULL, NULL, TO_ROOM ); } else if ( victim->sex == 1 ) { send_to_char( "Tracisz kontrolê nad swoim cia³em i osuwasz siê po³przytomny na ziemie.\n\r", victim ); act( "$n osuwa siê polprzytomny na ziemie.", victim, NULL, NULL, TO_ROOM ); } else { send_to_char( "Tracisz kontrolê nad swoim cia³em i osuwasz siê po³przytomna na ziemie.\n\r", victim ); act( "$n osuwa siê polprzytomna na ziemie.", victim, NULL, NULL, TO_ROOM ); } victim->position = POS_SITTING; } /* lezy, siedzi, restuje, umiera etc? no to niech dalej umiera */ else { send_to_char( "Tracisz kontrolê nad swoim cia³em.\n\r", victim ); act( "Cia³o $z wyprê¿a siê i wiotczeje pod wp³ywem potê¿nego wy³adowania.", victim, NULL, NULL, TO_ROOM ); } } } if ( is_affected(victim, gsn_mirrorfall) ) { affect_strip(victim, gsn_mirrorfall); return; } /* toast some gear */ for ( obj = victim->carrying; obj != NULL; obj = obj_next ) { OBJ_NEXT_CONTENT( obj, obj_next ); shock_effect( obj, level, dam, TARGET_OBJ ); } return ; } if ( target == TARGET_OBJ ) { OBJ_DATA * obj = ( OBJ_DATA * ) vo; OBJ_DATA *t_obj, *n_obj; char *msg; /* Tener: dodanie szansy na unikniêcie w zale¿no¶ci od poziomu czaru [20080512] */ //2008-11-20, Brohacz: wylaczam. Spelle powyzej 25 levela nie psuja przeciez przez to gratow! /*if ( URANGE( 1, number_range( 1, 30 - level ), 10 ) < 5 ) return;*/ if ( obj->item_type != ITEM_WAND && obj->item_type != ITEM_STAFF && obj->item_type != ITEM_JEWELRY ) return; if ( !check_item_resist( obj, RESIST_ELECTRICITY, dam ) ) return ; if(obj->liczba_mnoga) { switch ( obj->item_type ) { default: return ; case ITEM_WAND: case ITEM_STAFF: msg = "$p rozb³yskuj± i po chwili eksploduj±!"; break; case ITEM_JEWELRY: msg = "$p stapiaj± siê w bezwarto¶ciow± bry³kê."; } } else { switch ( obj->item_type ) { default: return ; case ITEM_WAND: case ITEM_STAFF: msg = "$p rozb³yskuje i po chwili eksploduje!"; break; case ITEM_JEWELRY: msg = "$p stapia siê w bezwarto¶ciow± bry³kê."; } } if ( obj->carried_by != NULL ) act( msg, obj->carried_by, obj, NULL, TO_ALL ); else if ( obj->in_room != NULL && obj->in_room->people != NULL ) act( msg, obj->in_room->people, obj, NULL, TO_ALL ); /* get rid of the object */ if ( obj->contains ) /* dump contents */ { for ( t_obj = obj->contains; t_obj != NULL; t_obj = n_obj ) { n_obj = t_obj->next_content; obj_from_obj( t_obj ); if ( obj->in_room != NULL ) obj_to_room( t_obj, obj->in_room ); else if ( obj->carried_by != NULL ) obj_to_room( t_obj, obj->carried_by->in_room ); else { /*artefact*/ if ( is_artefact( t_obj ) ) extract_artefact( t_obj ); if ( obj->contains ) extract_artefact_container( obj ); extract_obj( t_obj ); continue; } shock_effect( t_obj, level / 2, dam / 2, TARGET_OBJ ); } } /*artefact*/ if ( is_artefact( obj ) ) extract_artefact( obj ); if ( obj->contains ) extract_artefact_container( obj ); extract_obj( obj ); return ; } }
/* * Function finds out if a seed will grow into something else. */ void seed_grow_check(OBJ_DATA *obj) { OBJ_DATA *obj_temp; int chance = 0; int count = 0; // Initial checks to ditch out, object must exist, room must exist // and the seed must be buried. Also no growing in certain sectors // should an item somehow get buried there. if (obj == NULL || obj->in_room == NULL || obj->item_type != ITEM_SEED || !IS_OBJ_STAT(obj, ITEM_BURIED)) { return; } // Places it should never be buried. if (obj->in_room->sector_type == SECT_INSIDE || obj->in_room->sector_type == SECT_WATER_SWIM || obj->in_room->sector_type == SECT_WATER_NOSWIM || obj->in_room->sector_type == SECT_UNDERWATER || obj->in_room->sector_type == SECT_AIR) { bugf("Item buried in a sector_type (%d) it shouldn't be at room %d", obj->in_room->sector_type, obj->in_room->vnum); return; } // If the object doesn't have a vnum set to grow, report it, extract it. if (obj->value[0] == 0) { bugf("Seed vnum %d does not have a vnum set for the item to grow, extracting object.", obj->pIndexData->vnum); separate_obj(obj); extract_obj(obj); return; } // Setup the base chance based off of sector type of the room it's planted in. switch (obj->in_room->sector_type) { case SECT_DESERT: chance -= 75; break; case SECT_BEACH: chance -= 50; break; case SECT_FIELD: chance += 35; break; case SECT_MOUNTAIN: chance -= 15; break; case SECT_HILLS: case SECT_FOREST: chance += 25; break; default: chance = 0; break; } if (IS_OBJ_STAT(obj, ITEM_BLESS)) { chance += 5; } if (IS_OBJ_STAT(obj, ITEM_GLOW)) { chance += 5; } if (IS_OBJ_STAT(obj, ITEM_EVIL)) { chance -= 5; } // Add the immortal initial set chance plus randomness. chance += obj->value[1]; chance += number_range(1, 20); // Count any other seeds that might be buried in the room. for (obj_temp = obj->in_room->contents; obj_temp; obj_temp = obj_temp->next_content) { if (obj_temp->item_type == ITEM_SEED && IS_OBJ_STAT(obj_temp, ITEM_BURIED)) { count++; } } // The more seeds that are planted the less chance any will grow. if (count > 3) { chance -= (3 * count); } // Seeds have a greaater chance of growing during the day. if (IS_DAY()) { chance += 15; } else { chance -= 15; } // Always at least 1 percent chance, always a chance for failure chance = URANGE(1, chance, 95); // The moment of truth. if (!CHANCE(chance)) { return; } // Remove the buried bit, it's going to get extracted but we want people to be able // to see it's short description in the act message and they won't unless it's not buried. separate_obj(obj); REMOVE_BIT(obj->extra_flags, ITEM_BURIED); // Show the room that something has sprouted. if (obj->in_room != NULL && obj->in_room->people != NULL) { act("$p sprouts and grows from the ground!", obj->in_room->people, obj, NULL, TO_ALL); } // Create the new object that has been grown, set it's intiial values and // put it in the room. obj_temp = create_object(get_obj_index(obj->value[0])); obj_to_room(obj_temp, obj->in_room); obj_temp->cost = ((obj->cost * 3) / 2); obj_temp->timer = number_range(75, 200); // Life span of the grown item // Extract the seed (it's already been separated, it's job in this world is complete. extract_obj(obj); return; }
/* Display a nicely formatted map with a legend */ static void perform_map( struct char_data *ch, char *argument, bool worldmap ) { int size = DEFAULT_MAP_SIZE; int centre, x, y, min, max; char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH], buf[MAX_STRING_LENGTH], buf1[MAX_STRING_LENGTH], buf2[MAX_STRING_LENGTH]; int count = 0; int ew_size=0, ns_size=0; int mapshape = MAP_CIRCLE; two_arguments( argument, arg1 , arg2 ); if(*arg1) { size = atoi(arg1); } if (*arg2) { if (is_abbrev(arg2, "normal")) worldmap=FALSE; else if (is_abbrev(arg2, "world")) worldmap=TRUE; else { send_to_char(ch, "Usage: \tymap <distance> [ normal | world ]\tn"); return; } } if(size<0) { size = -size; mapshape = MAP_RECTANGLE; } size = URANGE(1,size,MAX_MAP_SIZE); centre = MAX_MAP/2; if(worldmap) { min = centre - 2*size; max = centre + 2*size; } else { min = centre - size; max = centre + size; } /* Blank the map */ for (x = 0; x < MAX_MAP; ++x) for (y = 0; y < MAX_MAP; ++y) map[x][y]= (!(y%2) && !worldmap) ? DOOR_NONE : SECT_EMPTY; /* starts the mapping with the centre room */ MapArea(IN_ROOM(ch), ch, centre, centre, min, max, ns_size/2, ew_size/2, worldmap); /* marks the center, where ch is */ map[centre][centre] = SECT_HERE; /* Feel free to put your own MUD name or header in here */ send_to_char(ch, " \tY-\tytbaMUD Map System\tY-\tn\r\n" "\tD .-.__--.,--.__.-.\tn\r\n" ); count += sprintf(buf + count, "\tn\tn\tn%s Up\\\\", door_info[NUM_DOOR_TYPES + DOOR_UP].disp); count += sprintf(buf + count, "\tn\tn\tn%s Down\\\\", door_info[NUM_DOOR_TYPES + DOOR_DOWN].disp); count += sprintf(buf + count, "\tn%s You\\\\", map_info[SECT_HERE].disp); count += sprintf(buf + count, "\tn%s Inside\\\\", map_info[SECT_INSIDE].disp); count += sprintf(buf + count, "\tn%s City\\\\", map_info[SECT_CITY].disp); count += sprintf(buf + count, "\tn%s Field\\\\", map_info[SECT_FIELD].disp); count += sprintf(buf + count, "\tn%s Forest\\\\", map_info[SECT_FOREST].disp); count += sprintf(buf + count, "\tn%s Hills\\\\", map_info[SECT_HILLS].disp); count += sprintf(buf + count, "\tn%s Mountain\\\\", map_info[SECT_MOUNTAIN].disp); count += sprintf(buf + count, "\tn%s Swim\\\\", map_info[SECT_WATER_SWIM].disp); count += sprintf(buf + count, "\tn%s Boat\\\\", map_info[SECT_WATER_NOSWIM].disp); count += sprintf(buf + count, "\tn%s Flying\\\\", map_info[SECT_FLYING].disp); count += sprintf(buf + count, "\tn%s Underwater\\\\", map_info[SECT_UNDERWATER].disp); strcpy(buf, strfrmt(buf, LEGEND_WIDTH, CANVAS_HEIGHT + 2, FALSE, TRUE, TRUE)); /* Start with an empty column */ strcpy(buf1, strfrmt("",0, CANVAS_HEIGHT + 2, FALSE, FALSE, TRUE)); /* Paste the legend */ strcpy(buf2, strpaste(buf1, buf, "\tD | \tn")); /* Set up the map */ memset(buf, ' ', CANVAS_WIDTH); count = (CANVAS_WIDTH); if(worldmap) count += sprintf(buf + count , "\r\n%s", WorldMap(centre, size, mapshape, MAP_NORMAL)); else count += sprintf(buf + count , "\r\n%s", StringMap(centre, size)); memset(buf + count, ' ', CANVAS_WIDTH); strcpy(buf + count + CANVAS_WIDTH, "\r\n"); /* Paste it on */ strcpy(buf2, strpaste(buf2, buf, "\tD | \tn")); /* Paste on the right border */ strcpy(buf2, strpaste(buf2, buf1, " ")); /* Print it all out */ send_to_char(ch, "%s", buf2); send_to_char(ch, "\tD `.-.__--.,-.__.-.-'\tn\r\n"); return; }
void shock_effect(void *vo,int level, int dam, int target) { if (target == TARGET_ROOM) { ROOM_INDEX_DATA *room = (ROOM_INDEX_DATA *) vo; OBJ_DATA *obj, *obj_next; for (obj = room->contents; obj != NULL; obj = obj_next) { obj_next = obj->next_content; shock_effect(obj,level,dam,TARGET_OBJ); } return; } if (target == TARGET_CHAR) { CHAR_DATA *victim = (CHAR_DATA *) vo; OBJ_DATA *obj, *obj_next; /* daze and confused? */ if (!saves_spell(level/4 + dam/20,victim,DAM_LIGHTNING)) { send_to_char("Your muscles stop responding.\n\r",victim); DAZE_STATE(victim,UMAX(12,level/4 + dam/20)); } /* toast some gear */ for (obj = victim->carrying; obj != NULL; obj = obj_next) { obj_next = obj->next_content; shock_effect(obj,level,dam,TARGET_OBJ); } return; } if (target == TARGET_OBJ) { OBJ_DATA *obj = (OBJ_DATA *) vo; int chance; char *msg; if (IS_OBJ_STAT(obj,ITEM_BURN_PROOF) || IS_OBJ_STAT(obj,ITEM_NOPURGE) || number_range(0,4) == 0) return; chance = level / 4 + dam / 10; if (chance > 25) chance = (chance - 25) / 2 + 25; if (chance > 50) chance = (chance - 50) /2 + 50; if (IS_OBJ_STAT(obj,ITEM_BLESS)) chance -= 5; chance -= obj->level * 2; switch(obj->item_type) { default: return; case ITEM_WAND: case ITEM_STAFF: chance += 10; msg = "$p overloads and explodes!"; break; case ITEM_JEWELRY: chance -= 10; msg = "$p is fused into a worthless lump."; } chance = URANGE(5,chance,95); if (number_percent() > chance) return; if (obj->carried_by != NULL) act(msg,obj->carried_by,obj,NULL,TO_ALL); else if (obj->in_room != NULL && obj->in_room->people != NULL) act(msg,obj->in_room->people,obj,NULL,TO_ALL); extract_obj(obj); return; } }
void poison_effect(void *vo,int level, int dam, int target) { if (target == TARGET_ROOM) /* nail objects on the floor */ { ROOM_INDEX_DATA *room = (ROOM_INDEX_DATA *) vo; OBJ_DATA *obj, *obj_next; for (obj = room->contents; obj != NULL; obj = obj_next) { obj_next = obj->next_content; poison_effect(obj,level,dam,TARGET_OBJ); } return; } if (target == TARGET_CHAR) /* do the effect on a victim */ { CHAR_DATA *victim = (CHAR_DATA *) vo; OBJ_DATA *obj, *obj_next; /* chance of poisoning */ if (!saves_spell(level / 4 + dam / 20,victim,DAM_POISON)) { AFFECT_DATA af; send_to_char("You feel poison coursing through your veins.\n\r", victim); act("$n looks very ill.",victim,NULL,NULL,TO_ROOM); af.where = TO_AFFECTS; af.type = gsn_poison; af.level = level; af.duration = level / 2; af.location = APPLY_STR; af.modifier = -1; af.bitvector = AFF_POISON; affect_join( victim, &af ); } /* equipment */ for (obj = victim->carrying; obj != NULL; obj = obj_next) { obj_next = obj->next_content; poison_effect(obj,level,dam,TARGET_OBJ); } return; } if (target == TARGET_OBJ) /* do some poisoning */ { OBJ_DATA *obj = (OBJ_DATA *) vo; int chance; if (IS_OBJ_STAT(obj,ITEM_BURN_PROOF) || IS_OBJ_STAT(obj,ITEM_BLESS) || number_range(0,4) == 0) return; chance = level / 4 + dam / 10; if (chance > 25) chance = (chance - 25) / 2 + 25; if (chance > 50) chance = (chance - 50) / 2 + 50; chance -= obj->level * 2; switch (obj->item_type) { default: return; case ITEM_FOOD: break; case ITEM_DRINK_CON: if (obj->value[0] == obj->value[1]) return; break; } chance = URANGE(5,chance,95); if (number_percent() > chance) return; obj->value[3] = 1; return; } }
void acid_effect(void *vo, int level, int dam, int target) { if (target == TARGET_ROOM) /* nail objects on the floor */ { ROOM_INDEX_DATA *room = (ROOM_INDEX_DATA *) vo; OBJ_DATA *obj, *obj_next; for (obj = room->contents; obj != NULL; obj = obj_next) { obj_next = obj->next_content; acid_effect(obj,level,dam,TARGET_OBJ); } return; } if (target == TARGET_CHAR) /* do the effect on a victim */ { CHAR_DATA *victim = (CHAR_DATA *) vo; OBJ_DATA *obj, *obj_next; /* let's toast some gear */ for (obj = victim->carrying; obj != NULL; obj = obj_next) { obj_next = obj->next_content; acid_effect(obj,level,dam,TARGET_OBJ); } return; } if (target == TARGET_OBJ) /* toast an object */ { OBJ_DATA *obj = (OBJ_DATA *) vo; OBJ_DATA *t_obj,*n_obj; int chance; char *msg; if (IS_OBJ_STAT(obj,ITEM_BURN_PROOF) || IS_OBJ_STAT(obj,ITEM_NOPURGE) || number_range(0,4) == 0) return; chance = level / 4 + dam / 10; if (chance > 25) chance = (chance - 25) / 2 + 25; if (chance > 50) chance = (chance - 50) / 2 + 50; if (IS_OBJ_STAT(obj,ITEM_BLESS)) chance -= 5; chance -= obj->level * 2; switch (obj->item_type) { default: return; case ITEM_CONTAINER: case ITEM_CORPSE_PC: case ITEM_CORPSE_NPC: msg = "$p fumes and dissolves."; break; case ITEM_ARMOR: msg = "$p is pitted and etched."; break; case ITEM_CLOTHING: msg = "$p is corroded into scrap."; break; case ITEM_STAFF: case ITEM_WAND: chance -= 10; msg = "$p corrodes and breaks."; break; case ITEM_SCROLL: chance += 10; msg = "$p is burned into waste."; break; } chance = URANGE(5,chance,95); if (number_percent() > chance) return; if (obj->carried_by != NULL) act(msg,obj->carried_by,obj,NULL,TO_ALL); else if (obj->in_room != NULL && obj->in_room->people != NULL) act(msg,obj->in_room->people,obj,NULL,TO_ALL); if (obj->item_type == ITEM_ARMOR) /* etch it */ { AFFECT_DATA *paf; bool af_found = FALSE; int i; affect_enchant(obj); for ( paf = obj->affected; paf != NULL; paf = paf->next) { if ( paf->location == APPLY_AC) { af_found = TRUE; paf->type = -1; paf->modifier += 1; paf->level = UMAX(paf->level,level); break; } } if (!af_found) /* needs a new affect */ { paf = new_affect(); paf->type = -1; paf->level = level; paf->duration = -1; paf->location = APPLY_AC; paf->modifier = 1; paf->bitvector = 0; paf->next = obj->affected; obj->affected = paf; } if (obj->carried_by != NULL && obj->wear_loc != WEAR_NONE) for (i = 0; i < 4; i++) obj->carried_by->armor[i] += 1; return; } /* get rid of the object */ if (obj->contains) /* dump contents */ { for (t_obj = obj->contains; t_obj != NULL; t_obj = n_obj) { n_obj = t_obj->next_content; obj_from_obj(t_obj); if (obj->in_room != NULL) obj_to_room(t_obj,obj->in_room); else if (obj->carried_by != NULL) obj_to_room(t_obj,obj->carried_by->in_room); else { extract_obj(t_obj); continue; } acid_effect(t_obj,level/2,dam/2,TARGET_OBJ); } } extract_obj(obj); return; } }
void fire_effect(void *vo, int level, int dam, int target) { if (target == TARGET_ROOM) /* nail objects on the floor */ { ROOM_INDEX_DATA *room = (ROOM_INDEX_DATA *) vo; OBJ_DATA *obj, *obj_next; for (obj = room->contents; obj != NULL; obj = obj_next) { obj_next = obj->next_content; fire_effect(obj,level,dam,TARGET_OBJ); } return; } if (target == TARGET_CHAR) /* do the effect on a victim */ { CHAR_DATA *victim = (CHAR_DATA *) vo; OBJ_DATA *obj, *obj_next; /* chance of blindness */ if (!IS_AFFECTED(victim,AFF_BLIND) && !saves_spell(level / 4 + dam / 20, victim,DAM_FIRE)) { AFFECT_DATA af; act("$n is blinded by smoke!",victim,NULL,NULL,TO_ROOM); act("Your eyes tear up from smoke...you can't see a thing!", victim,NULL,NULL,TO_CHAR); af.where = TO_AFFECTS; af.type = skill_lookup("fire breath"); af.level = level; af.duration = number_range(0,level/10); af.location = APPLY_HITROLL; af.modifier = -4; af.bitvector = AFF_BLIND; affect_to_char(victim,&af); } /* getting thirsty */ if (!IS_NPC(victim)) gain_condition(victim,COND_THIRST,dam/20); /* let's toast some gear! */ for (obj = victim->carrying; obj != NULL; obj = obj_next) { obj_next = obj->next_content; fire_effect(obj,level,dam,TARGET_OBJ); } return; } if (target == TARGET_OBJ) /* toast an object */ { OBJ_DATA *obj = (OBJ_DATA *) vo; OBJ_DATA *t_obj,*n_obj; int chance; char *msg; if (IS_OBJ_STAT(obj,ITEM_BURN_PROOF) || IS_OBJ_STAT(obj,ITEM_NOPURGE) || number_range(0,4) == 0) return; chance = level / 4 + dam / 10; if (chance > 25) chance = (chance - 25) / 2 + 25; if (chance > 50) chance = (chance - 50) / 2 + 50; if (IS_OBJ_STAT(obj,ITEM_BLESS)) chance -= 5; chance -= obj->level * 2; switch ( obj->item_type ) { default: return; case ITEM_CONTAINER: msg = "$p ignites and burns!"; break; case ITEM_POTION: chance += 25; msg = "$p bubbles and boils!"; break; case ITEM_SCROLL: chance += 50; msg = "$p crackles and burns!"; break; case ITEM_STAFF: chance += 10; msg = "$p smokes and chars!"; break; case ITEM_WAND: msg = "$p sparks and sputters!"; break; case ITEM_FOOD: msg = "$p blackens and crisps!"; break; case ITEM_PILL: msg = "$p melts and drips!"; break; } chance = URANGE(5,chance,95); if (number_percent() > chance) return; if (obj->carried_by != NULL) act( msg, obj->carried_by, obj, NULL, TO_ALL ); else if (obj->in_room != NULL && obj->in_room->people != NULL) act(msg,obj->in_room->people,obj,NULL,TO_ALL); if (obj->contains) { /* dump the contents */ for (t_obj = obj->contains; t_obj != NULL; t_obj = n_obj) { n_obj = t_obj->next_content; obj_from_obj(t_obj); if (obj->in_room != NULL) obj_to_room(t_obj,obj->in_room); else if (obj->carried_by != NULL) obj_to_room(t_obj,obj->carried_by->in_room); else { extract_obj(t_obj); continue; } fire_effect(t_obj,level/2,dam/2,TARGET_OBJ); } } extract_obj( obj ); return; } }
void cold_effect(void *vo, int level, int dam, int target) { if (target == TARGET_ROOM) /* nail objects on the floor */ { ROOM_INDEX_DATA *room = (ROOM_INDEX_DATA *) vo; OBJ_DATA *obj, *obj_next; for (obj = room->contents; obj != NULL; obj = obj_next) { obj_next = obj->next_content; cold_effect(obj,level,dam,TARGET_OBJ); } return; } if (target == TARGET_CHAR) /* whack a character */ { CHAR_DATA *victim = (CHAR_DATA *) vo; OBJ_DATA *obj, *obj_next; /* chill touch effect */ if (!saves_spell(level/4 + dam / 20, victim, DAM_COLD)) { AFFECT_DATA af; act("$n turns blue and shivers.",victim,NULL,NULL,TO_ROOM); act("A chill sinks deep into your bones.",victim,NULL,NULL,TO_CHAR); af.where = TO_AFFECTS; af.type = skill_lookup("chill touch"); af.level = level; af.duration = 6; af.location = APPLY_STR; af.modifier = -1; af.bitvector = 0; affect_join( victim, &af ); } /* hunger! (warmth sucked out */ if (!IS_NPC(victim)) gain_condition(victim,COND_HUNGER,dam/20); /* let's toast some gear */ for (obj = victim->carrying; obj != NULL; obj = obj_next) { obj_next = obj->next_content; cold_effect(obj,level,dam,TARGET_OBJ); } return; } if (target == TARGET_OBJ) /* toast an object */ { OBJ_DATA *obj = (OBJ_DATA *) vo; int chance; char *msg; if (IS_OBJ_STAT(obj,ITEM_BURN_PROOF) || IS_OBJ_STAT(obj,ITEM_NOPURGE) || number_range(0,4) == 0) return; chance = level / 4 + dam / 10; if (chance > 25) chance = (chance - 25) / 2 + 25; if (chance > 50) chance = (chance - 50) / 2 + 50; if (IS_OBJ_STAT(obj,ITEM_BLESS)) chance -= 5; chance -= obj->level * 2; switch(obj->item_type) { default: return; case ITEM_POTION: msg = "$p freezes and shatters!"; chance += 25; break; case ITEM_DRINK_CON: msg = "$p freezes and shatters!"; chance += 5; break; } chance = URANGE(5,chance,95); if (number_percent() > chance) return; if (obj->carried_by != NULL) act(msg,obj->carried_by,obj,NULL,TO_ALL); else if (obj->in_room != NULL && obj->in_room->people != NULL) act(msg,obj->in_room->people,obj,NULL,TO_ALL); extract_obj(obj); return; } }