void cast_gas_breath( byte level, struct char_data *ch, char *arg, int type, struct char_data *tar_ch, struct obj_data *tar_obj ) { switch (type) { case SPELL_TYPE_SPELL: for (tar_ch = world[ch->in_room].people ; tar_ch ; tar_ch = tar_ch->next_in_room) if (tar_ch != ch) spell_gas_breath(level,ch,tar_ch,0); break; /* THIS ONE HURTS!! */ default : log("Serious screw-up in gasbreath!"); break; } }
/* Replaces violence_update */ void ev_violence( void *data ) { char_data *ch = ( char_data * ) data; if( !ch ) { bug( "%s: nullptr ch pointer!", __func__ ); return; } char_data *victim = ch->who_fighting( ); if( !victim || !ch->in_room || !ch->name || ( ch->in_room != victim->in_room ) ) { ch->stop_fighting( true ); return; } if( ch->char_died( ) ) { ch->stop_fighting( true ); return; } /* * Let the battle begin! */ if( ch->has_aflag( AFF_PARALYSIS ) ) { add_event( 2, ev_violence, ch ); return; } ch_ret retcode = rNONE; if( ch->in_room->flags.test( ROOM_SAFE ) ) { log_printf( "%s: %s fighting %s in a SAFE room.", __func__, ch->name, victim->name ); ch->stop_fighting( true ); } else if( ch->IS_AWAKE( ) && ch->in_room == victim->in_room ) retcode = multi_hit( ch, victim, TYPE_UNDEFINED ); else ch->stop_fighting( false ); if( ch->char_died( ) ) return; if( retcode == rCHAR_DIED || !( victim = ch->who_fighting( ) ) ) return; /* * Mob triggers * -- Added some victim death checks, because it IS possible.. -- Alty */ rprog_rfight_trigger( ch ); if( ch->char_died( ) || victim->char_died( ) ) return; mprog_hitprcnt_trigger( ch, victim ); if( ch->char_died( ) || victim->char_died( ) ) return; mprog_fight_trigger( ch, victim ); if( ch->char_died( ) || victim->char_died( ) ) return; /* * NPC special attack flags - Thoric */ int attacktype = -2, cnt = -2; if( ch->isnpc( ) ) { if( ch->has_attacks( ) ) { attacktype = -1; if( 30 + ( ch->level / 4 ) >= number_percent( ) ) { cnt = 0; for( ;; ) { if( cnt++ > 10 ) { attacktype = -1; break; } attacktype = number_range( 7, MAX_ATTACK_TYPE - 1 ); if( ch->has_attack( attacktype ) ) break; } switch ( attacktype ) { default: break; case ATCK_BASH: interpret( ch, "bash" ); retcode = global_retcode; break; case ATCK_STUN: interpret( ch, "stun" ); retcode = global_retcode; break; case ATCK_GOUGE: interpret( ch, "gouge" ); retcode = global_retcode; break; case ATCK_AGE: do_ageattack( ch, "" ); retcode = global_retcode; break; case ATCK_DRAIN: retcode = spell_energy_drain( skill_lookup( "energy drain" ), ch->level, ch, victim ); break; case ATCK_FIREBREATH: retcode = spell_fire_breath( skill_lookup( "fire breath" ), ch->level, ch, victim ); break; case ATCK_FROSTBREATH: retcode = spell_frost_breath( skill_lookup( "frost breath" ), ch->level, ch, victim ); break; case ATCK_ACIDBREATH: retcode = spell_acid_breath( skill_lookup( "acid breath" ), ch->level, ch, victim ); break; case ATCK_LIGHTNBREATH: retcode = spell_lightning_breath( skill_lookup( "lightning breath" ), ch->level, ch, victim ); break; case ATCK_GASBREATH: retcode = spell_gas_breath( skill_lookup( "gas breath" ), ch->level, ch, victim ); break; case ATCK_SPIRALBLAST: retcode = spell_spiral_blast( skill_lookup( "spiral blast" ), ch->level, ch, victim ); break; case ATCK_POISON: retcode = spell_smaug( gsn_poison, ch->level, ch, victim ); break; case ATCK_NASTYPOISON: retcode = spell_smaug( gsn_poison, ch->level, ch, victim ); break; case ATCK_GAZE: break; case ATCK_BLINDNESS: retcode = spell_smaug( skill_lookup( "blindness" ), ch->level, ch, victim ); break; case ATCK_CAUSESERIOUS: retcode = spell_smaug( skill_lookup( "cause serious" ), ch->level, ch, victim ); break; case ATCK_EARTHQUAKE: retcode = spell_smaug( skill_lookup( "earthquake" ), ch->level, ch, victim ); break; case ATCK_CAUSECRITICAL: retcode = spell_smaug( skill_lookup( "cause critical" ), ch->level, ch, victim ); break; case ATCK_CURSE: retcode = spell_smaug( skill_lookup( "curse" ), ch->level, ch, victim ); break; case ATCK_FLAMESTRIKE: retcode = spell_smaug( skill_lookup( "flamestrike" ), ch->level, ch, victim ); break; case ATCK_HARM: retcode = spell_smaug( skill_lookup( "harm" ), ch->level, ch, victim ); break; case ATCK_FIREBALL: retcode = spell_smaug( skill_lookup( "fireball" ), ch->level, ch, victim ); break; case ATCK_COLORSPRAY: retcode = spell_smaug( skill_lookup( "colour spray" ), ch->level, ch, victim ); break; case ATCK_WEAKEN: retcode = spell_smaug( skill_lookup( "weaken" ), ch->level, ch, victim ); break; } if( attacktype != -1 && ( retcode == rCHAR_DIED || ch->char_died( ) ) ) return; } } /* * NPC special defense flags - Thoric */ if( ch->has_defenses( ) ) { /* * Fix for character not here bugs --Shaddai */ if( ch->char_died( ) || victim->char_died( ) ) return; attacktype = -1; if( 50 + ( ch->level / 4 ) > number_percent( ) ) { cnt = 0; for( ;; ) { if( cnt++ > 10 ) { attacktype = -1; break; } attacktype = number_range( 2, MAX_DEFENSE_TYPE - 1 ); if( ch->has_defense( attacktype ) ) break; } switch ( attacktype ) { default: break; case DFND_CURELIGHT: act( AT_MAGIC, "$n mutters a few incantations...and looks a little better.", ch, nullptr, nullptr, TO_ROOM ); retcode = spell_smaug( skill_lookup( "cure light" ), ch->level, ch, ch ); break; case DFND_CURESERIOUS: act( AT_MAGIC, "$n mutters a few incantations...and looks a bit better.", ch, nullptr, nullptr, TO_ROOM ); retcode = spell_smaug( skill_lookup( "cure serious" ), ch->level, ch, ch ); break; case DFND_CURECRITICAL: act( AT_MAGIC, "$n mutters a few incantations...and looks healthier.", ch, nullptr, nullptr, TO_ROOM ); retcode = spell_smaug( skill_lookup( "cure critical" ), ch->level, ch, ch ); break; case DFND_HEAL: act( AT_MAGIC, "$n mutters a few incantations...and looks much healthier.", ch, nullptr, nullptr, TO_ROOM ); retcode = spell_smaug( skill_lookup( "heal" ), ch->level, ch, ch ); break; case DFND_DISPELMAGIC: if( !victim->affects.empty( ) ) { act( AT_MAGIC, "$n utters an incantation...", ch, nullptr, nullptr, TO_ROOM ); retcode = spell_dispel_magic( skill_lookup( "dispel magic" ), ch->level, ch, victim ); } break; case DFND_DISPELEVIL: act( AT_MAGIC, "$n utters an incantation...", ch, nullptr, nullptr, TO_ROOM ); retcode = spell_dispel_evil( skill_lookup( "dispel evil" ), ch->level, ch, victim ); break; case DFND_FIRESHIELD: if( !ch->has_aflag( AFF_FIRESHIELD ) ) { act( AT_MAGIC, "$n utters a few incantations...", ch, nullptr, nullptr, TO_ROOM ); retcode = spell_smaug( skill_lookup( "fireshield" ), ch->level, ch, ch ); } else retcode = rNONE; break; case DFND_SHOCKSHIELD: if( !ch->has_aflag( AFF_SHOCKSHIELD ) ) { act( AT_MAGIC, "$n utters a few incantations...", ch, nullptr, nullptr, TO_ROOM ); retcode = spell_smaug( skill_lookup( "shockshield" ), ch->level, ch, ch ); } else retcode = rNONE; break; case DFND_SANCTUARY: if( !ch->has_aflag( AFF_SANCTUARY ) ) { act( AT_MAGIC, "$n utters a few incantations...", ch, nullptr, nullptr, TO_ROOM ); retcode = spell_smaug( skill_lookup( "sanctuary" ), ch->level, ch, ch ); } else retcode = rNONE; break; } if( attacktype != -1 && ( retcode == rCHAR_DIED || ch->char_died( ) ) ) return; } } } // Attack values reset - past here they mean nothing and I'm on a bughunt dammit! attacktype = -2; cnt = -2; retcode = -2; /* * Fun for the whole family! */ list < char_data * >::iterator ich; for( ich = ch->in_room->people.begin( ); ich != ch->in_room->people.end( ); ) { char_data *rch = *ich; ++ich; if( ch->in_room != rch->in_room ) break; if( rch->IS_AWAKE( ) && !rch->fighting ) { /* * PC's auto-assist others in their group. */ if( !ch->isnpc( ) || ch->has_aflag( AFF_CHARM ) || ch->has_actflag( ACT_PET ) ) { if( rch->isnpc( ) && ( rch->has_aflag( AFF_CHARM ) || rch->is_pet( ) ) ) { multi_hit( rch, victim, TYPE_UNDEFINED ); continue; } if( is_same_group( ch, rch ) && rch->has_pcflag( PCFLAG_AUTOASSIST ) ) { multi_hit( rch, victim, TYPE_UNDEFINED ); continue; } } /* * NPC's assist NPC's of same type or 12.5% chance regardless. */ if( !rch->is_pet( ) && !rch->has_aflag( AFF_CHARM ) && !rch->has_actflag( ACT_NOASSIST ) ) { if( ch->char_died( ) ) break; if( rch->pIndexData == ch->pIndexData || number_bits( 3 ) == 0 ) { list < char_data * >::iterator ich2; char_data *target = nullptr; int number = 0; for( ich2 = ch->in_room->people.begin( ); ich2 != ch->in_room->people.end( ); ++ich2 ) { char_data *vch = *ich2; if( rch->can_see( vch, false ) && is_same_group( vch, victim ) && number_range( 0, number ) == 0 ) { if( vch->mount && vch->mount == rch ) target = nullptr; else { target = vch; ++number; } } } if( target ) multi_hit( rch, target, TYPE_UNDEFINED ); } } } } /* * If we are both still here lets get together and do it again some time :) */ if( ch && victim && victim->position != POS_DEAD && ch->position != POS_DEAD ) add_event( 2, ev_violence, ch ); }