未验证 提交 9a43a658 编写于 作者: D Dillon Matchett 提交者: GitHub

Different layers on different body parts now visible (#54277)

上级 e433d4f6
......@@ -3079,8 +3079,39 @@ static void armor_encumb_bp_info( const item &it, std::vector<iteminfo> &info,
encumb_max );
}
std::string layering;
// get the layers this bit of the armor covers if its unique compared to the rest of the armor
for( const layer_level &ll : it.get_layer( bp ) ) {
switch( ll ) {
case layer_level::PERSONAL:
layering += _( " <stat>Personal aura</stat>." );
break;
case layer_level::UNDERWEAR:
layering += _( " <stat>Close to skin</stat>." );
break;
case layer_level::REGULAR:
layering += _( " <stat>Normal</stat>." );
break;
case layer_level::WAIST:
layering += _( " <stat>Waist</stat>." );
break;
case layer_level::OUTER:
layering += _( " <stat>Outer</stat>." );
break;
case layer_level::BELTED:
layering += _( " <stat>Strapped</stat>." );
break;
case layer_level::AURA:
layering += _( " <stat>Outer aura</stat>." );
break;
default:
layering += _( " Should never see this." );
}
}
//~ Limb-specific coverage (%s = name of limb)
info.emplace_back( "DESCRIPTION", string_format( _( "<bold>%s Coverage</bold>:" ), bp_name ) );
info.emplace_back( "DESCRIPTION", string_format( _( "<bold>%s Coverage</bold>:%s" ), bp_name,
layering ) );
//~ Regular/Default coverage
info.emplace_back( bp_cat, string_format( "%s%s%s", space, _( "Default:" ), space ), "",
iteminfo::no_flags, it.get_coverage( bp ) );
......
......@@ -908,6 +908,7 @@ void Item_factory::finalize_post( itype &obj )
if( armor_data.layers.empty() ) {
armor_data.layers = default_layers;
} else {
armor_data.has_unique_layering = true;
// add any unique layer entries to the items total layer info
for( const layer_level &ll : armor_data.layers ) {
if( std::count( obj.armor->all_layers.begin(), obj.armor->all_layers.end(), ll ) == 0 ) {
......@@ -920,6 +921,8 @@ void Item_factory::finalize_post( itype &obj )
// if an item or location has no layer data then default to the flags for the item
if( armor_data.layers.empty() ) {
armor_data.layers = default_layers;
} else {
armor_data.has_unique_layering = true;
}
}
......
......@@ -283,6 +283,8 @@ struct armor_portion_data {
// What layer does it cover if any
std::vector<layer_level> layers;
// these are pre-calc values to save us time later
// the chance that every material applies to an attack
// this is primarily used as a chached value for UI
int best_protection_chance = 100; // NOLINT(cata-serialize)
......@@ -291,6 +293,9 @@ struct armor_portion_data {
// this is primarily used as a chached value for UI
int worst_protection_chance = 0; // NOLINT(cata-serialize)
// this is to test if the armor has unique layering information
bool has_unique_layering = false; // NOLINT(cata-serialize)
/**
* Returns the amount all sublocations this item covers could possibly
* cover the specific body part.
......
......@@ -402,19 +402,19 @@ TEST_CASE( "item rigidity", "[iteminfo][rigidity]" )
CHECK( item_info_str( briefcase, encumbrance ) ==
"--\n"
"<color_c_white>L. Arm Encumbrance</color>: <color_c_yellow>30</color>\n"
"<color_c_white>L. Arm Coverage</color>:\n"
"<color_c_white>L. Arm Coverage</color>: <color_c_light_blue>Strapped</color>.\n"
" Default: <color_c_yellow>10</color>\n"
"--\n"
"<color_c_white>R. Arm Encumbrance</color>: <color_c_yellow>30</color>\n"
"<color_c_white>R. Arm Coverage</color>:\n"
"<color_c_white>R. Arm Coverage</color>: <color_c_light_blue>Strapped</color>.\n"
" Default: <color_c_yellow>10</color>\n"
"--\n"
"<color_c_white>L. Hand Encumbrance</color>: <color_c_yellow>30</color>\n"
"<color_c_white>L. Hand Coverage</color>:\n"
"<color_c_white>L. Hand Coverage</color>: <color_c_light_blue>Strapped</color>.\n"
" Default: <color_c_yellow>10</color>\n"
"--\n"
"<color_c_white>R. Hand Encumbrance</color>: <color_c_yellow>30</color>\n"
"<color_c_white>R. Hand Coverage</color>:\n"
"<color_c_white>R. Hand Coverage</color>: <color_c_light_blue>Strapped</color>.\n"
" Default: <color_c_yellow>10</color>\n" );
}
......@@ -452,12 +452,12 @@ TEST_CASE( "item rigidity", "[iteminfo][rigidity]" )
"--\n"
"<color_c_white>L. Leg Encumbrance</color>: <color_c_yellow>0</color> "
"When full: <color_c_yellow>6</color>\n"
"<color_c_white>L. Leg Coverage</color>:\n"
"<color_c_white>L. Leg Coverage</color>: <color_c_light_blue>Waist</color>.\n"
" Default: <color_c_yellow>5</color>\n"
"--\n"
"<color_c_white>R. Leg Encumbrance</color>: <color_c_yellow>0</color> "
"When full: <color_c_yellow>6</color>\n"
"<color_c_white>R. Leg Coverage</color>:\n"
"<color_c_white>R. Leg Coverage</color>: <color_c_light_blue>Waist</color>.\n"
" Default: <color_c_yellow>5</color>\n" );
// test_backpack has an explicit "encumbrance" and "max_encumbrance"
......@@ -465,7 +465,7 @@ TEST_CASE( "item rigidity", "[iteminfo][rigidity]" )
"--\n"
"<color_c_white>Torso Encumbrance</color>: <color_c_yellow>2</color> "
"When full: <color_c_yellow>15</color>\n"
"<color_c_white>Torso Coverage</color>:\n"
"<color_c_white>Torso Coverage</color>: <color_c_light_blue>Strapped</color>.\n"
" Default: <color_c_yellow>30</color>\n" );
// quiver has no volume, only an implicit volume via ammo
......@@ -473,12 +473,12 @@ TEST_CASE( "item rigidity", "[iteminfo][rigidity]" )
"--\n"
"<color_c_white>L. Leg Encumbrance</color>: <color_c_yellow>3</color> "
"When full: <color_c_yellow>11</color>\n"
"<color_c_white>L. Leg Coverage</color>:\n"
"<color_c_white>L. Leg Coverage</color>: <color_c_light_blue>Waist</color>.\n"
" Default: <color_c_yellow>10</color>\n"
"--\n"
"<color_c_white>R. Leg Encumbrance</color>: <color_c_yellow>3</color> "
"When full: <color_c_yellow>11</color>\n"
"<color_c_white>R. Leg Coverage</color>:\n"
"<color_c_white>R. Leg Coverage</color>: <color_c_light_blue>Waist</color>.\n"
" Default: <color_c_yellow>10</color>\n" );
}
}
......@@ -791,11 +791,11 @@ TEST_CASE( "armor coverage, warmth, and encumbrance", "[iteminfo][armor][coverag
"<color_c_white>Size/Fit</color>: <color_c_red>(poor fit)</color>\n"
"--\n"
"<color_c_white>Arms Encumbrance</color>: <color_c_yellow>3</color>\n"
"<color_c_white>Arms Coverage</color>:\n"
"<color_c_white>Arms Coverage</color>: <color_c_light_blue>Normal</color>.\n"
" Default: <color_c_yellow>90</color>\n"
"--\n"
"<color_c_white>Torso Encumbrance</color>: <color_c_yellow>3</color>\n"
"<color_c_white>Torso Coverage</color>:\n"
"<color_c_white>Torso Coverage</color>: <color_c_light_blue>Normal</color>.\n"
" Default: <color_c_yellow>90</color>\n" );
item swat_armor( "test_swat_armor" );
......@@ -875,17 +875,17 @@ TEST_CASE( "armor coverage, warmth, and encumbrance", "[iteminfo][armor][coverag
"--\n"
"<color_c_white>Arms Encumbrance</color>: <color_c_yellow>12</color> "
"When full: <color_c_yellow>25</color>\n"
"<color_c_white>Arms Coverage</color>:\n"
"<color_c_white>Arms Coverage</color>: <color_c_light_blue>Normal</color>.\n"
" Default: <color_c_yellow>95</color>\n"
"--\n"
"<color_c_white>Legs Encumbrance</color>: <color_c_yellow>12</color> "
"When full: <color_c_yellow>25</color>\n"
"<color_c_white>Legs Coverage</color>:\n"
"<color_c_white>Legs Coverage</color>: <color_c_light_blue>Normal</color>.\n"
" Default: <color_c_yellow>95</color>\n"
"--\n"
"<color_c_white>Torso Encumbrance</color>: <color_c_yellow>12</color> "
"When full: <color_c_yellow>25</color>\n"
"<color_c_white>Torso Coverage</color>:\n"
"<color_c_white>Torso Coverage</color>: <color_c_light_blue>Normal</color>.\n"
" Default: <color_c_yellow>95</color>\n" );
// Test copy-from
......@@ -1044,32 +1044,32 @@ TEST_CASE( "armor coverage, warmth, and encumbrance", "[iteminfo][armor][coverag
"--\n"
"<color_c_white>L. Arm Encumbrance</color>: <color_c_yellow>5</color> "
"When full: <color_c_yellow>9</color>\n"
"<color_c_white>L. Arm Coverage</color>:\n"
"<color_c_white>L. Arm Coverage</color>: <color_c_light_blue>Normal</color>.\n"
" Default: <color_c_yellow>50</color>\n"
"--\n"
"<color_c_white>R. Arm Encumbrance</color>: <color_c_yellow>10</color> "
"When full: <color_c_yellow>25</color>\n"
"<color_c_white>R. Arm Coverage</color>:\n"
"<color_c_white>R. Arm Coverage</color>: <color_c_light_blue>Normal</color>.\n"
" Default: <color_c_yellow>100</color>\n"
"--\n"
"<color_c_white>Head Encumbrance</color>: <color_c_yellow>5</color> "
"When full: <color_c_yellow>9</color>\n"
"<color_c_white>Head Coverage</color>:\n"
"<color_c_white>Head Coverage</color>: <color_c_light_blue>Normal</color>.\n"
" Default: <color_c_yellow>50</color>\n"
"--\n"
"<color_c_white>L. Leg Encumbrance</color>: <color_c_yellow>5</color> "
"When full: <color_c_yellow>9</color>\n"
"<color_c_white>L. Leg Coverage</color>:\n"
"<color_c_white>L. Leg Coverage</color>: <color_c_light_blue>Normal</color>.\n"
" Default: <color_c_yellow>50</color>\n"
"--\n"
"<color_c_white>R. Leg Encumbrance</color>: <color_c_yellow>10</color> "
"When full: <color_c_yellow>25</color>\n"
"<color_c_white>R. Leg Coverage</color>:\n"
"<color_c_white>R. Leg Coverage</color>: <color_c_light_blue>Normal</color>.\n"
" Default: <color_c_yellow>100</color>\n"
"--\n"
"<color_c_white>Torso Encumbrance</color>: <color_c_yellow>10</color> "
"When full: <color_c_yellow>25</color>\n"
"<color_c_white>Torso Coverage</color>:\n"
"<color_c_white>Torso Coverage</color>: <color_c_light_blue>Normal</color>.\n"
" Default: <color_c_yellow>100</color>\n" );
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册