Пример #1
0
bool mutation_branch::conflicts_with_item( const item &it ) const
{
    if( allow_soft_gear && it.is_soft() ) {
        return false;
    }

    for( body_part bp : restricts_gear ) {
        if( it.covers( bp ) ) {
            return true;
        }
    }

    return false;
}
Пример #2
0
void player_morale::set_worn( const item &it, bool worn )
{
    const bool just_fancy = it.has_flag( "FANCY" );
    const bool super_fancy = it.has_flag( "SUPER_FANCY" );

    if( just_fancy || super_fancy ) {
        const int sign = ( worn ) ? 1 : -1;

        for( int i = 0; i < num_bp; i++ ) {
            const auto bp = static_cast<body_part>( i );
            if( it.covers( bp ) ) {
                covered[i] = std::max( covered[i] + sign, 0 );
            }
        }

        if( super_fancy ) {
            super_fancy_bonus += 2 * sign;
        }

        update_stylish_bonus();
    }
}