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 = level / 4 + dam / 10; char *msg; if (IS_OBJ_STAT(obj,ITEM_BURN_PROOF) || IS_OBJ_STAT(obj,ITEM_NOPURGE) || number_range(0,4) == 0) return; 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; } }
/* * Inflict damage from a hit. */ int damage(CHAR_DATA *ch,CHAR_DATA *victim,int dam,int dt,int dam_type, bool show, int agg, int combo) { /*OBJ_DATA *corpse;*/ bool immune; if ( victim->position == P_DEAD ) return P_DEAD; /* @@@@@ FIX TORPOR if ( victim->position == P_TORPOR ) return P_TORPOR; */ /* damage reduction */ if ( dam > 15) dam = (dam - 5)/2 + 5; if(IS_SET(ch->form, FORM_HORRID)) dam++; /* @@@@@ FIX BITE DAMAGE FOR SERPENTIS 3 if(is_affected(ch, skill_lookup("skin of the adder")) && dam_type == DAM_BITE) dam++; */ /* In case of -ve agg ratings */ if (agg < 0) agg = 0; /* soakage */ dam = do_soak(victim, dam, agg); if ( victim != ch ) { if ( victim->position > P_STUN ) { if ( victim->fighting == NULL ) { set_fighting( victim, ch ); if ( IS_NPC( victim ) && HAS_TRIGGER( victim, TRIG_KILL ) ) mp_percent_trigger( victim, ch, NULL, NULL, TRIG_KILL ); } if (victim->timer <= 4) victim->position = P_FIGHT; } if ( victim->position > P_STUN ) { if ( ch->fighting == NULL ) set_fighting( ch, victim ); } /* * More charm stuff. */ if ( victim->master == ch ) stop_follower( victim ); } /* * Inviso attacks ... not. */ if ( IS_AFFECTED(ch, AFF_INVISIBLE) ) { affect_strip( ch, gsn_invis ); REMOVE_BIT( ch->affected_by, AFF_INVISIBLE ); act( "$n fades into existence.", ch, NULL, NULL, TO_ROOM, 0 ); } /* * Damage modifiers. */ if ( dam > 1 && !IS_NPC(victim) && victim->condition[COND_DRUNK] > 10 ) dam = 9 * dam / 10; if ( dam > 1 && !IS_NPC(victim) && victim->condition[COND_HIGH] > 10 ) dam = 9 * dam / 10; if ( dam > 1 && ((IS_AFFECTED(victim, AFF_PROTECT_EVIL) && !IS_NATURAL(ch) )) ) dam -= dam / 4; immune = FALSE; /* * Check for parry, and dodge. if ( dt >= TYPE_HIT && ch != victim) { if ( check_parry( ch, victim ) ) return -1; if ( check_dodge( ch, victim ) ) return -1; } */ switch(check_immune(victim,dam_type)) { case(IS_IMMUNE): immune = TRUE; dam = 0; break; case(IS_RESISTANT): dam -= dam/3; break; case(IS_VULNERABLE): dam += dam/2; break; } if (show) dam_message( ch, victim, dam, dt, immune, combo ); if(dam > (victim->health + victim->agghealth -7)) { victim->position = P_MORT; stop_fighting(ch, TRUE); } else if(dam == (victim->health + victim->agghealth -7)) { victim->position = P_INCAP; stop_fighting(ch, TRUE); } if (dam == 0) return -1; else if(IS_SET(ch->off_flags, BANDAGED)) REMOVE_BIT(ch->off_flags, BANDAGED); /* * Hurt the victim. * Inform the victim of his new state. */ if( (victim->race == race_lookup("vampire")) && (dt == DAM_FIRE) ) { victim->agghealth -= dam; update_pos( victim, UMAX(1, agg) ); if(agg <= 0) agg = 1; } else if( (victim->race == race_lookup("werewolf")) && (dt == DAM_SILVER) ) { victim->agghealth -= dam; update_pos( victim, UMAX(1, agg) ); if(agg <= 0) agg = 1; } else if( (victim->race == race_lookup("faerie")) && (dt == DAM_IRON) ) { victim->health -= dam; victim->GHB += dam/3; update_pos( victim, agg ); } else if(agg) { victim->agghealth -= dam; update_pos( victim, agg ); } else { victim->health -= dam; update_pos( victim, 0 ); } switch( victim->position ) { case P_MORT: act( "$n is mortally wounded, and will die soon, if not aided.", victim, NULL, NULL, TO_ROOM, 0 ); send_to_char("You are mortally wounded, and may die soon, if not aided.\n\r", victim ); break; case P_INCAP: act( "$n is incapacitated and will slowly die, if not aided.", victim, NULL, NULL, TO_ROOM, 0 ); send_to_char("You are incapacitated and will slowly die, if not aided.\n\r", victim ); break; case P_TORPOR: act( "$n is mortally wounded, and will slowly die if not aided.", victim, NULL, NULL, TO_ROOM, 0 ); send_to_char("You enter torpor.\n\r", victim ); break; case P_STUN: act( "$n is stunned, but will probably recover.", victim, NULL, NULL, TO_ROOM, 0 ); send_to_char("You are stunned, but will probably recover.\n\r", victim ); break; case P_DEAD: act( "$n is DEAD!!", victim, 0, 0, TO_ROOM, 0 ); send_to_char( "You have been KILLED!!\n\r\n\r", victim ); break; default: if ( dam > MAX_HEALTH / 4 ) send_to_char( "That really did HURT!\n\r", victim ); if ( (victim->health + victim->agghealth - 7) < MAX_HEALTH / 4 ) send_to_char( "You sure are BLEEDING!\n\r", victim ); break; } if(dam_type == DAM_FIRE) fire_effect((void *) victim, agg+dam/2, dam, TARGET_CHAR); if(dam_type == DAM_COLD) cold_effect((void *) victim, agg+dam/2, dam, TARGET_CHAR); if(dam_type == DAM_LIGHTNING) shock_effect((void *) victim, agg+dam/2, dam, TARGET_CHAR); if(dam_type == DAM_ACID) acid_effect((void *) victim, agg+dam/2, dam, TARGET_CHAR); if(dam_type == DAM_POISON) poison_effect((void *) victim, agg+dam/2, dam, TARGET_CHAR); /* * Sleep spells and extremely wounded folks. */ if ( !IS_AWAKE(victim) ) stop_fighting( victim, FALSE ); /* * Payoff for killing things. */ if ( (victim->position == P_INCAP && IS_NPC(victim)) || victim->position == P_DEAD || victim->position == P_TORPOR ) { if ( !IS_NPC(victim) ) { log_string( LOG_GAME, Format("%s killed by %s at %d", victim->name, (IS_NPC(ch) ? ch->short_descr : ch->name), ch->in_room->vnum) ); } snprintf( log_buf, 2*MIL, "\tY[WIZNET]\tn %s got toasted by %s at %s [room %d]", (IS_NPC(victim) ? victim->short_descr : victim->name), (IS_NPC(ch) ? ch->short_descr : ch->name), ch->in_room->name, ch->in_room->vnum); if (IS_NPC(victim)) wiznet(log_buf,NULL,NULL,WIZ_MOBDEATHS,0,0); else wiznet(log_buf,NULL,NULL,WIZ_DEATHS,0,0); /* * Death trigger */ if ( IS_NPC( victim ) && HAS_TRIGGER( victim, TRIG_DEATH) ) { victim->position = P_STAND; mp_percent_trigger( victim, ch, NULL, NULL, TRIG_DEATH ); } if((!str_cmp(ch->description, "") || strlen(ch->description) < 10) && ch->played > 10*60*60) { send_to_char("No experience without a description.\n\r", ch); } else { if(ch->ooc_xp_count < 2) { send_to_char("You learn from your encounter.\n\r", ch); ch->oocxp += 1; ch->ooc_xp_count++; } else if(IS_SET(victim->act2, ACT2_HUNTER) && ch->ooc_xp_count < 50) { send_to_char("You learn from your encounter.\n\r", ch); ch->exp += 1; ch->ooc_xp_count++; } } if(ch->quest) { if(ch->quest->quest_type == Q_HITMAN && ch->quest->victim == victim) (*quest_table[ch->quest->quest_type].q_fun) (ch, 2); if(victim->quest != NULL && victim->quest->quest_type == Q_HITMAN && victim->quest->victim == victim && victim->quest->questor != ch) (*quest_table[victim->quest->quest_type].q_fun) (victim->quest->questor, 3); if(victim->quest != NULL && (victim->quest->quest_type == Q_BODYGUARD || victim->quest->quest_type == Q_RESCUE) && victim->quest->victim == victim) (*quest_table[victim->quest->quest_type].q_fun) (victim->quest->questor, 3); } if(victim->position != P_TORPOR || agg) update_pos( victim, agg ); return victim->position; } if ( victim == ch ) return ch->position; /* Link dead salvation. */ if ( !IS_NPC(victim) && victim->desc == NULL ) { do_function(victim, &do_flee,""); } tail_chain( ); return victim->position; }
/* * Control the fights going on. * Blow stuff up. * Called periodically by update_handler. */ void violence_update( void ) { CHAR_DATA *ch; CHAR_DATA *ch_next; CHAR_DATA *victim; OBJ_DATA *obj; OBJ_DATA *obj_next; /* Explosives */ for ( obj = object_list; obj != NULL; obj = obj_next ) { CHAR_DATA *rch; char *message; int door, depth, radius, dam; ROOM_INDEX_DATA *blast_room; EXIT_DATA *pExit; obj_next = obj->next; if(obj->item_type != ITEM_BOMB || !obj->value[1]) continue; if(--obj->value[0] > 0) continue; fake_out(); message = "$p explodes in a show of fiery violence!"; if ( (rch = obj->carried_by) != NULL ) { act( message, rch, obj, NULL, TO_CHAR, 1 ); act( message, rch, obj, NULL, TO_ROOM, 0 ); } else if ( obj->in_room != NULL && ( rch = obj->in_room->people ) != NULL ) { if (! (obj->in_obj && !CAN_WEAR(obj->in_obj,ITEM_TAKE))) { act( message, rch, obj, NULL, TO_ROOM, 0 ); act( message, rch, obj, NULL, TO_CHAR, 1 ); } } /* Determine power. (Damage and blast radius.) */ /* Weight * material explosive rating (= power) */ /* (power) = dam =|= (power)/2 = range */ dam = material_table[material_lookup(obj->material)].is_explosive; radius = dam / 2; /* Do damage to everyone in first room. */ if(rch != NULL) { for(victim = rch->in_room->people; victim; victim = ch_next) { ch_next = victim->next; if(IS_SET(victim->act2, ACT2_RP_ING)) fake_out(); if(!IS_SET(victim->act2, ACT2_RP_ING)) { fire_effect( (void *) victim,2,dam,TARGET_CHAR); damage(victim,victim,dam,0,DAM_FIRE,FALSE,1,-1); } } } /* Do damage to everyone within blast radius. */ message = "A fiery inferno rips through the room!"; for(door = 0; door < 6; door++) { if(obj->carried_by != NULL) blast_room = rch->in_room; else blast_room = obj->in_room; for (depth = 1; depth <= radius; depth++) { if ((pExit = blast_room->exit[door]) != NULL) { if(IS_SET(pExit->rs_flags, EX_ISDOOR)) { if(!IS_SET(pExit->rs_flags, EX_BROKEN) && !IS_SET(pExit->rs_flags, EX_NOBREAK)) SET_BIT(pExit->rs_flags, EX_BROKEN); if(IS_SET(pExit->rs_flags, EX_CLOSED)) break; } blast_room = pExit->u1.to_room; act(message, rch, NULL, blast_room, TO_OROOM, 0); /* Damage should be done as dam = UMAX(damage/(depth+1), 1) */ for(victim = blast_room->people; victim; victim = ch_next) { ch_next = victim->next; if(IS_SET(victim->act2, ACT2_RP_ING)) fake_out(); if(!str_cmp(victim->name, "Dsarky")) fake_out(); if(!IS_SET(victim->act2, ACT2_RP_ING)) { fire_effect( (void *) victim,2,UMAX(dam/(depth+1),1), TARGET_CHAR); damage(victim,victim,UMAX(dam/(depth+1),1),0, DAM_FIRE,FALSE,1,-1); } } } } } extract_obj( obj ); } for ( ch = char_list; ch != NULL; ch = ch_next ) { ch_next = ch->next; /* Be Summonned */ if ( ch->fighting == NULL && ch->position != P_FIGHT && ch->position != P_TORPOR && ch->position != P_DEAD && (IS_SET(ch->act, ACT_SUMMON) || IS_SET(ch->act2, ACT2_HUNTER)) && !IS_SET(ch->act, ACT_AGGRESSIVE)) walk_to_summonner( ch ); if(!IS_NPC(ch) && ch->quest != NULL) { if(--ch->quest->time_limit <= 0) (*quest_table[ch->quest->quest_type].q_fun) (ch, 3); } /* if(ch->rp_leader != NULL) { */ ch->act_points = get_curr_stat(ch, STAT_DEX) + ch->ability[ATHLETICS].value; /* } */ if(ch->jump_timer > 0 && ch->jump_timer % 2 == 0) { jump_update(ch, FALSE); } else { ch->jump_timer--; } if(ch->jump_timer <= 0 && !IS_AFFECTED(ch, AFF_FLYING) && !IS_SET(ch->form, FORM_SHADOW) && ch->in_room != NULL && ch->in_room->sector_type == SECT_AIR) { jump_update(ch, TRUE); } if ( ( victim = ch->fighting ) == NULL || ch->in_room == NULL ) continue; obj = get_eq_char(ch, WEAR_WIELD); if ( IS_AWAKE(ch) && ch->in_room != NULL && ch->in_room == victim->in_room) { update_pos(ch, 0); if(ch->balance <= -5) ch->position = P_SIT; if(victim->position > P_DEAD) strike(ch,victim); else stop_fighting( ch, TRUE ); ch->combat_flag = 0; } else stop_fighting( ch, FALSE ); if ( ( victim = ch->fighting ) == NULL ) continue; /* * Fun for the whole family! */ check_assist(ch,victim); if ( IS_NPC( ch ) ) { if ( HAS_TRIGGER( ch, TRIG_FIGHT ) ) mp_percent_trigger( ch, victim, NULL, NULL, TRIG_FIGHT ); if ( HAS_TRIGGER( ch, TRIG_HPCNT ) ) mp_hprct_trigger( ch, victim ); } } 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_CONTENT( obj, obj_next ); if ( IS_OBJ_STAT( obj, ITEM_NOPURGE ) ) continue; 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; if ( !victim->in_room ) return ; if ( is_affected(victim, gsn_mirrorfall) ) { affect_strip(victim, gsn_mirrorfall); return; } /* let's toast some gear! */ for ( obj = victim->carrying; obj != NULL; obj = obj_next ) { OBJ_NEXT_CONTENT( obj, obj_next ); 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; char *msg; /* Tener: przeniesienie if'a w dobre miejsce [20080523] */ //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 ( !check_item_resist( obj, RESIST_FIRE, dam ) ) return ; /* Gurthg 2003-04-01 powi±zanie levelu z szans± na zniszczenie grata */ /*ale ten if przecie nie ma sensu - przepuszcza itemy o ujemnej kondycji - kainti 2006 07 10 if ( URANGE( 1, number_range( 1, 30 - level ), 10 ) < 5 ) return ;*/ if(obj->liczba_mnoga) { switch ( obj->item_type ) { case ITEM_CONTAINER: msg = "$p zapalaj± siê i p³on±!"; break; case ITEM_POTION: msg = "$p bulgocz± i eksploduj±!"; break; case ITEM_SCROLL: msg = "$p skwiercz± i spalaj± siê!"; break; case ITEM_STAFF: msg = "$p dymi± siê i czerniej±!"; break; case ITEM_WAND: msg = "$p iskrz± siê i top±!"; break; case ITEM_FOOD: msg = "$p czerniej± i krusz± sie!"; break; case ITEM_PILL: msg = "$p czerniej± i krusz± sie!"; break; case ITEM_GEM: msg = "$p rozgrzewaj± siê i eksploduj±!"; break; default: msg = "$p zapalaj± siê i p³on±!"; break; } } else { switch ( obj->item_type ) { case ITEM_CONTAINER: msg = "$p zapala siê i p³onie!"; break; case ITEM_POTION: msg = "$p bulgocze i eksploduje!"; break; case ITEM_SCROLL: msg = "$p skwierczy i spala siê!"; break; case ITEM_STAFF: msg = "$p dymi siê i czernieje!"; break; case ITEM_WAND: msg = "$p iskrzy siê i topi!"; break; case ITEM_FOOD: msg = "$p czernieje i kruszy sie!"; break; case ITEM_PILL: msg = "$p czernieje i kruszy sie!"; break; case ITEM_GEM: msg = "$p rozgrzewa siê i eksploduje!"; break; default: msg = "$p zapala siê i p³onie!"; break; } } 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 { /*artefact*/ if ( is_artefact( t_obj ) ) extract_artefact( t_obj ); if ( obj->contains ) extract_artefact_container( obj ); extract_obj( t_obj ); continue; } fire_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 ; } }