From ba02defba24dc6be056313db5783946b5c569739 Mon Sep 17 00:00:00 2001 From: Sergey Alirzaev Date: Fri, 6 Mar 2020 22:56:54 +0300 Subject: [PATCH 1/2] Display damage per second in the item info So you can quickly eyeball the weapon effectiveness versus plain meatbags --- src/item.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/item.cpp b/src/item.cpp index bb5f63d7d5aee..5148d11d81b4d 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -1212,6 +1212,10 @@ void item::basic_info( std::vector &info, const iteminfo_query *parts, if( parts->test( iteminfo_parts::BASE_MOVES ) ) { info.push_back( iteminfo( "BASE", _( "Moves per attack: " ), "", iteminfo::lower_is_better, attack_time() ) ); + double dps = ( dmg_bash + dmg_cut + dmg_stab ) * to_moves( 1_seconds ) / + static_cast( attack_time() ); + info.push_back( iteminfo( "BASE", _( "Damage per second: " ), "", + iteminfo::is_decimal, dps ) ); } } From f6b955c638b6ce39d854d8f3fa233adb562adf64 Mon Sep 17 00:00:00 2001 From: Sergey Alirzaev Date: Sat, 7 Mar 2020 16:14:16 +0300 Subject: [PATCH 2/2] Added DPS to tests --- tests/iteminfo_test.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/iteminfo_test.cpp b/tests/iteminfo_test.cpp index a8f1250f4df77..1e8ff78b45ca0 100644 --- a/tests/iteminfo_test.cpp +++ b/tests/iteminfo_test.cpp @@ -50,7 +50,8 @@ TEST_CASE( "weapon attack ratings and moves", "[item][iteminfo]" ) "Bash: 20" " Cut: 5" " To-hit bonus: +2\n" - "Moves per attack: 145\n" ); + "Moves per attack: 145\n" + "Damage per second: 17.24\n" ); }