void stop_fight( char_data* ch ) { char_data* rch; remove_bit( &ch->status, STAT_BERSERK ); ch->fighting = NULL; disrupt_spell( ch ); clear( ch->aggressive ); stop_events( ch, execute_leap ); for( int i = 0; i < *ch->array; i++ ) { if( ( rch = character( ch->array->list[i] ) ) == NULL ) continue; if( rch->cast != NULL && rch->cast->target == ch && spell_table[rch->cast->spell].type != STYPE_WORLD ) disrupt_spell( rch ); rch->aggressive -= ch; if( rch->fighting == ch ) rch->fighting = NULL; for( int j = rch->events-1; j >= 0; j-- ) if( rch->events[j]->pointer == (void*) ch ) { extract( rch->events[j] ); init_attack( rch ); } } }
MonsterGenerator::MonsterGenerator() : mon_templates( "monster type", "id", "alias" ) , mon_species( "species" ) { mon_templates->insert( mtype() ); mon_species->insert( species_type() ); init_phases(); init_attack(); init_defense(); init_death(); }
MonsterGenerator::MonsterGenerator() { mon_templates["mon_null"] = new mtype(); mon_species["spec_null"] = new species_type(); //ctor init_phases(); init_attack(); init_death(); init_flags(); init_trigger(); init_sizes(); }
MonsterGenerator::MonsterGenerator() { mon_templates[mtype_id::NULL_ID] = new mtype(); mon_species[species_id::NULL_ID] = new species_type(); //ctor init_phases(); init_attack(); init_defense(); init_death(); init_flags(); init_trigger(); }
void react_attack( char_data* ch, char_data* victim ) { char_data* rch; if( victim->leader == ch ) stop_follower( victim ); if( ch->leader == victim ) stop_follower( ch ); init_attack( victim, ch ); for( int i = 0; i < *ch->array; i++ ) { if( ( rch = character( ch->array->list[i] ) ) != NULL ) { if( join_fight( victim, ch, rch ) ) init_attack( rch, ch ); else if( join_fight( ch, victim, rch ) ) init_attack( rch, victim ); } } }
MonsterGenerator::MonsterGenerator() : mon_templates( new generic_factory<mtype>( "monster type" ) ) , mon_species( new generic_factory<species_type>( "species" ) ) { mon_templates->insert( mtype() ); mon_species->insert( species_type() ); //ctor init_phases(); init_attack(); init_defense(); init_death(); init_flags(); init_trigger(); }
void MonsterGenerator::reset() { mon_templates->reset(); mon_templates->insert( mtype() ); mon_species->reset(); mon_species->insert( species_type() ); hallucination_monsters.clear(); attack_map.clear(); // Hardcode attacks need to be re-added here // @todo: Move initialization from constructor to init() init_attack(); }
void renter_combat( char_data* ch ) { char_data* rch; for( int i = 0; i < *ch->array; i++ ) { if( ( rch = character( ch->array->list[i] ) ) == NULL || rch == ch ) continue; if( is_aggressive( ch, rch ) ) ch->aggressive += rch; } init_attack( ch ); }
void next_action( event_data* event ) { char_data* ch = (char_data*) event->owner; if( ch->position <= POS_SLEEPING ) return; ch->shown = 1; passive_action( ch ); if( !ch->Is_Valid( ) || ch->active.time != -1 || ( ch->fighting == NULL && is_empty( ch->aggressive ) ) ) return; if( ch->fighting != NULL ) fight_round( ch ); else init_attack( ch, ch->aggressive[0] ); }
void Char_Data :: To( content_array* where ) { room_data* room; wizard_data* imm; char_data* rch; if( array != NULL ) { roach( "Adding character somewhere which isn't nowhere." ); roach( "-- Ch = %s", this ); From( number ); } Thing_Data :: To( where ); /* CHARACTER TO ROOM */ if( ( room = Room( where->where ) ) != NULL ) { room_position = -1; in_room = room; if( pcdata != NULL ) room->area->nplayer++; if( ( imm = wizard( this ) ) != NULL ) { imm->custom_edit = 0; imm->room_edit = NULL; imm->action_edit = NULL; imm->exit_edit = NULL; } if( water_logged( room ) ) { remove_bit( &status, STAT_SNEAKING ); remove_bit( &status, STAT_HIDING ); remove_bit( &status, STAT_CAMOUFLAGED ); remove_bit( affected_by, AFF_HIDE ); remove_bit( affected_by, AFF_CAMOUFLAGE ); } if( is_submerged( this ) ) enter_water( this ); for( int i = 0; i < room->contents; i++ ) { if( ( rch = character( room->contents[i] ) ) == NULL || rch == this ) continue; if( rch->species != NULL && species != NULL && rch->species->group == species->group && rch->species->group != GROUP_NONE ) { share_enemies( this, rch ); share_enemies( rch, this ); } if( is_aggressive( this, rch ) ) init_attack( this, rch ); if( is_aggressive( rch, this ) ) init_attack( rch, this ); } return; } roach( "Attempted transfer of character to non-room object." ); }