Example #1
0
void MonsterGenerator::finalize_mtypes()
{
    for( auto &elem : mon_templates ) {
        mtype *mon = elem.second;
        apply_species_attributes(mon);
        set_mtype_flags(mon);
        set_species_ids( mon );
    }
}
void MonsterGenerator::finalize_mtypes()
{
    for( auto &elem : mon_templates->all_ref() ) {
        mtype &mon = const_cast<mtype&>( elem.second );
        apply_species_attributes( mon );
        set_mtype_flags( mon );
        set_species_ids( mon );
    }
}
void MonsterGenerator::finalize_mtypes()
{
    for( const auto &elem : mon_templates->get_all() ) {
        mtype &mon = const_cast<mtype&>( elem );
        apply_species_attributes( mon );
        set_mtype_flags( mon );
        set_species_ids( mon );

        if( mon.bash_skill < 0 ) {
            mon.bash_skill = calc_bash_skill( mon );
        }

        finalize_pathfinding_settings( mon );
    }
}
void MonsterGenerator::finalize_mtypes()
{
    mon_templates->finalize();
    for( const auto &elem : mon_templates->get_all() ) {
        mtype &mon = const_cast<mtype &>( elem );
        apply_species_attributes( mon );
        set_species_ids( mon );
        mon.size = volume_to_size( mon.volume );

        // adjust for worldgen difficulty parameters
        mon.speed *= get_option<int>( "MONSTER_SPEED" )      / 100.0;
        mon.hp    *= get_option<int>( "MONSTER_RESILIENCE" ) / 100.0;

        for( monster_adjustment adj : adjustments ) {
            adj.apply( mon );
        }

        if( mon.bash_skill < 0 ) {
            mon.bash_skill = calc_bash_skill( mon );
        }

        if( mon.armor_bash < 0 ) {
            mon.armor_bash = 0;
        }
        if( mon.armor_cut < 0 ) {
            mon.armor_cut = 0;
        }
        if( mon.armor_stab < 0 ) {
            mon.armor_stab = mon.armor_cut * 0.8;
        }
        if( mon.armor_acid < 0 ) {
            mon.armor_acid = mon.armor_cut * 0.5;
        }
        if( mon.armor_fire < 0 ) {
            mon.armor_fire = 0;
        }

        mon.hp = std::max( mon.hp, 1 ); // lower bound for hp scaling

        finalize_pathfinding_settings( mon );
    }

    for( const auto &mon : mon_templates->get_all() ) {
        if( !mon.has_flag( MF_NOT_HALLU ) ) {
            hallucination_monsters.push_back( mon.id );
        }
    }
}