From 34576c094317a6cea3fa3f65b5e209a3a6ec0241 Mon Sep 17 00:00:00 2001 From: Mark Langsdorf Date: Sun, 7 Jun 2020 05:50:09 -0500 Subject: [PATCH 1/5] martial arts: add a reset function add a function that removes all martial arts styles, and add it to the clear_character() helper function in tests/ so that the weapon DPS tests will be more consistent. --- src/character_martial_arts.cpp | 11 +++++++++++ src/character_martial_arts.h | 1 + tests/player_helpers.cpp | 1 + 3 files changed, 13 insertions(+) diff --git a/src/character_martial_arts.cpp b/src/character_martial_arts.cpp index 9da3ee7c36eb6..dd097a8eac441 100644 --- a/src/character_martial_arts.cpp +++ b/src/character_martial_arts.cpp @@ -89,6 +89,17 @@ void character_martial_arts::reset_style() style_selected = style_none; } +void character_martial_arts::clear_styles() +{ + keep_hands_free = false; + + ma_styles = { { + style_none, style_kicks + } + }; + reset_style(); +} + void character_martial_arts::selected_style_check() { // check if player knows current style naturally, otherwise drop them back to style_none diff --git a/src/character_martial_arts.h b/src/character_martial_arts.h index 104f62888acd2..bffe3c3f32264 100644 --- a/src/character_martial_arts.h +++ b/src/character_martial_arts.h @@ -50,6 +50,7 @@ class character_martial_arts void learn_current_style_CQB( bool is_avatar ); void learn_style( const matype_id &mastyle, bool is_avatar ); void set_style( const matype_id &mastyle, bool force = false ); + void clear_styles(); /** Displays a message if the player can or cannot use the martial art */ void martialart_use_message( const Character &owner ) const; diff --git a/tests/player_helpers.cpp b/tests/player_helpers.cpp index 742cd9a3fdd6c..2ee69b55e0955 100644 --- a/tests/player_helpers.cpp +++ b/tests/player_helpers.cpp @@ -72,6 +72,7 @@ void clear_character( player &dummy, bool debug_storage ) dummy.consume( food ); dummy.empty_skills(); + dummy.martial_arts_data.clear_styles(); dummy.clear_morale(); dummy.clear_bionics(); dummy.activity.set_to_null(); From 3d1f4af50187f6ed355b9b5ea5c11084a274bafd Mon Sep 17 00:00:00 2001 From: Mark Langsdorf Date: Thu, 4 Jun 2020 20:37:59 -0500 Subject: [PATCH 2/5] weapons: add tests for melee weapon value and update 2-handed flails add tests for effective value for two-handed flails. Reduce the volume for two-handed flails so that it's possible for them to have reasonable effective DPS values without needing unreasonable damage values, though they still hit extremely hard. --- data/json/items/melee/bludgeons.json | 10 +++++----- tests/effective_dps_test.cpp | 5 +++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/data/json/items/melee/bludgeons.json b/data/json/items/melee/bludgeons.json index 9abf185ba57f5..70502d39f43be 100644 --- a/data/json/items/melee/bludgeons.json +++ b/data/json/items/melee/bludgeons.json @@ -5,11 +5,11 @@ "category": "weapons", "name": { "str": "war flail" }, "description": "This is a stout pole with a large steel flanged mace head on a short chain attached to it, based on the peasant flail agricultural tool except now with a metal head and made to thresh people in metal armor rather than grain.", - "weight": "4550 g", - "volume": "3750 ml", + "weight": "3550 g", + "volume": "2250 ml", "price": 25000, "price_postapoc": 3000, - "bashing": 50, + "bashing": 65, "material": [ "wood", "steel" ], "symbol": "\\", "color": "dark_gray", @@ -23,10 +23,10 @@ "name": { "str": "peasant flail" }, "description": "This is a stout pole with a wooden club on a leather cord attached to it, this is a tool used to thresh wheat and occasionally people when the peasants got angry at their feudal lords.", "weight": "1700 g", - "volume": "3750 ml", + "volume": "2250 ml", "price": 4000, "price_postapoc": 1000, - "bashing": 26, + "bashing": 35, "material": [ "wood" ], "symbol": "\\", "color": "brown", diff --git a/tests/effective_dps_test.cpp b/tests/effective_dps_test.cpp index c1024a96b52be..15145b1914dcf 100644 --- a/tests/effective_dps_test.cpp +++ b/tests/effective_dps_test.cpp @@ -331,4 +331,9 @@ TEST_CASE( "expected weapon dps", "[expected][dps]" ) calc_expected_dps( test_guy, "halligan", 17.0 ); calc_expected_dps( test_guy, "stick_long", 6.0 ); } + SECTION( "two-handed flails" ) { // expected value ideally around 28 + calc_expected_dps( test_guy, "2h_flail_steel", 25.0 ); + calc_expected_dps( test_guy, "2h_flail_wood", 20.0 ); + calc_expected_dps( test_guy, "homewrecker", 13.0 ); + } } From c1e7f6038a7d1251a043aaa7356bda8efeb0cf5c Mon Sep 17 00:00:00 2001 From: Mark Langsdorf Date: Fri, 5 Jun 2020 06:47:21 -0500 Subject: [PATCH 3/5] weapons: add tests for melee weapon value and update unarmed weapons add tests for effective value for unarmed weapons. Add STAB to a few weapons that should have it and slightly adjust some values so that all the basic punch weapons are relatively close to each other. --- data/json/items/melee/unarmed_weapons.json | 13 +++++++------ tests/effective_dps_test.cpp | 11 +++++++++++ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/data/json/items/melee/unarmed_weapons.json b/data/json/items/melee/unarmed_weapons.json index 9d1c5b3fb21b2..0479d469fe23c 100644 --- a/data/json/items/melee/unarmed_weapons.json +++ b/data/json/items/melee/unarmed_weapons.json @@ -39,7 +39,8 @@ "description": "A metal weapon made of brass, designed to be gripped in the palm and cause punches to do extra damage. A good, quick weapon - but you have to get within punching range to use it.", "material": "brass", "weight": "320 g", - "bashing": 3, + "volume": "250 ml", + "bashing": 4, "price_postapoc": 250, "flags": [ "UNARMED_WEAPON", "DURABLE_MELEE" ] }, @@ -57,7 +58,7 @@ "cutting": 14, "price_postapoc": 500, "qualities": [ [ "CUT", 1 ], [ "BUTCHER", 8 ] ], - "flags": [ "UNARMED_WEAPON" ], + "flags": [ "UNARMED_WEAPON", "STAB" ], "techniques": [ "WBLOCK_1" ] }, { @@ -70,10 +71,10 @@ "material": "wood", "volume": "250 ml", "weight": "430 g", - "bashing": 3, - "cutting": 4, + "bashing": 2, + "cutting": 3, "price_postapoc": 50, - "flags": [ "UNARMED_WEAPON" ] + "flags": [ "UNARMED_WEAPON", "STAB" ] }, { "type": "GENERIC", @@ -85,7 +86,7 @@ "material": "steel", "volume": "250 ml", "weight": "430 g", - "bashing": 3, + "bashing": 4, "price_postapoc": 50, "qualities": [ [ "HAMMER", 1 ] ], "flags": [ "UNARMED_WEAPON" ] diff --git a/tests/effective_dps_test.cpp b/tests/effective_dps_test.cpp index 15145b1914dcf..05dbf8a3ef48b 100644 --- a/tests/effective_dps_test.cpp +++ b/tests/effective_dps_test.cpp @@ -336,4 +336,15 @@ TEST_CASE( "expected weapon dps", "[expected][dps]" ) calc_expected_dps( test_guy, "2h_flail_wood", 20.0 ); calc_expected_dps( test_guy, "homewrecker", 13.0 ); } + SECTION( "fist weapons" ) { // expected value around 10 but wide variation + calc_expected_dps( test_guy, "bio_claws_weapon", 18.0 ); // basically a knife + calc_expected_dps( test_guy, "bagh_nakha", 14.5 ); + calc_expected_dps( test_guy, "punch_dagger", 11.0 ); + calc_expected_dps( test_guy, "knuckle_katar", 10.5 ); + calc_expected_dps( test_guy, "knuckle_steel", 4.0 ); + calc_expected_dps( test_guy, "knuckle_brass", 4.0 ); + calc_expected_dps( test_guy, "knuckle_nail", 4.0 ); + calc_expected_dps( test_guy, "cestus", 3.0 ); + } + } From 20fd8cc6543f8345493bcab510dd25b5057ba9b3 Mon Sep 17 00:00:00 2001 From: Mark Langsdorf Date: Fri, 5 Jun 2020 07:52:36 -0500 Subject: [PATCH 4/5] weapons: add tests for melee weapon value and update axes add tests for effective DPS/value for one handed axes. Bring the crash axe values in line with the hatchet. Bring the primitive axe values in line with the primitive adze. Rename and slightly nerf the hand axes. Slightly improve the stats on the pickaxe - it's still a terrible weapon, but at least now it's as dangerous as a hatchet if you managed to connect. Incidentally, noticed the new hook pike and nerf it's accuracy to be in line with other pikes. --- data/json/items/tool/firefighting.json | 10 +++++----- data/json/items/tool/woodworking.json | 23 +++++++++++------------ data/json/items/tool/workshop.json | 4 ++-- tests/effective_dps_test.cpp | 13 ++++++++++++- 4 files changed, 30 insertions(+), 20 deletions(-) diff --git a/data/json/items/tool/firefighting.json b/data/json/items/tool/firefighting.json index ea56b3f2f0a3b..17eaee6abea34 100644 --- a/data/json/items/tool/firefighting.json +++ b/data/json/items/tool/firefighting.json @@ -14,9 +14,9 @@ "techniques": [ "WBLOCK_1" ], "weight": "907 g", "volume": "1 L", - "bashing": 14, - "cutting": 8, - "to_hit": -1, + "bashing": 17, + "cutting": 28, + "to_hit": -2, "flags": [ "DURABLE_MELEE", "BELT_CLIP", "NONCONDUCTIVE", "SHEATH_AXE" ], "qualities": [ [ "AXE", 2 ], [ "CUT", 1 ], [ "PRY", 2 ], [ "BUTCHER", 16 ] ] }, @@ -130,7 +130,7 @@ "volume": "3250 ml", "bashing": 20, "cutting": 6, - "to_hit": 2, + "to_hit": -1, "qualities": [ [ "COOK", 1 ] ] }, { @@ -149,7 +149,7 @@ "volume": "1900 ml", "bashing": 15, "cutting": 13, - "to_hit": 1, + "to_hit": -1, "qualities": [ [ "PRY", 3 ], [ "HAMMER", 1 ], [ "DIG", 1 ] ], "use_action": [ "HAMMER", "CROWBAR" ] } diff --git a/data/json/items/tool/woodworking.json b/data/json/items/tool/woodworking.json index 0e14186fb84ce..4e77343b3c350 100644 --- a/data/json/items/tool/woodworking.json +++ b/data/json/items/tool/woodworking.json @@ -187,15 +187,15 @@ { "id": "hand_axe", "type": "TOOL", - "name": { "str": "stone hand axe" }, + "name": { "str": "stone axe head" }, "description": "This is a broad piece of stone with an edge narrow enough to roughly chop wood.", "weight": "453 g", "volume": "500 ml", "price": 0, "price_postapoc": 50, - "to_hit": -2, - "bashing": 14, - "cutting": 8, + "to_hit": -3, + "bashing": 7, + "cutting": 11, "material": "stone", "symbol": ";", "color": "light_gray", @@ -206,12 +206,11 @@ "id": "makeshift_axe", "copy-from": "hand_axe", "type": "TOOL", - "name": { "str": "metal hand axe" }, + "name": { "str": "metal axe head" }, "description": "This is a chunk of steel with one edge hammered down to something resembling a cutting edge. It works passably well as an axe but really can't compare to a proper axe.", "material": "steel", - "to_hit": -3, - "bashing": 9, - "cutting": 15, + "bashing": 8, + "cutting": 12, "flags": [ "SHEATH_AXE" ] }, { @@ -221,7 +220,7 @@ "description": "This is a stone adze, somewhat useful for smoothing wood objects.", "weight": "1300 g", "volume": "1 L", - "price": 1000, + "price": 0, "price_postapoc": 50, "bashing": 9, "cutting": 15, @@ -230,15 +229,15 @@ "symbol": ";", "color": "brown", "qualities": [ [ "SAW_W", 1 ], [ "BUTCHER", -56 ] ], - "flags": [ "BELT_CLIP" ] + "flags": [ "BELT_CLIP", "SHEATH_AXE" ] }, { "id": "primitive_axe", "type": "TOOL", "name": { "str": "stone axe" }, "description": "This is a stone with a narrow edge affixed to a stick. It can chop wood, but requires much more effort than a modern axe.", - "weight": "3154 g", - "volume": "3500 ml", + "weight": "1300 g", + "volume": "1 L", "price": 0, "price_postapoc": 50, "bashing": 9, diff --git a/data/json/items/tool/workshop.json b/data/json/items/tool/workshop.json index 50b432b865d9a..ba23306750b14 100644 --- a/data/json/items/tool/workshop.json +++ b/data/json/items/tool/workshop.json @@ -640,8 +640,8 @@ "price": 16000, "price_postapoc": 1250, "to_hit": -2, - "bashing": 20, - "cutting": 12, + "bashing": 30, + "cutting": 15, "material": [ "wood", "steel" ], "symbol": "/", "color": "dark_gray", diff --git a/tests/effective_dps_test.cpp b/tests/effective_dps_test.cpp index 05dbf8a3ef48b..a618cfc833d7f 100644 --- a/tests/effective_dps_test.cpp +++ b/tests/effective_dps_test.cpp @@ -346,5 +346,16 @@ TEST_CASE( "expected weapon dps", "[expected][dps]" ) calc_expected_dps( test_guy, "knuckle_nail", 4.0 ); calc_expected_dps( test_guy, "cestus", 3.0 ); } - + SECTION( "ax" ) { // expected value around 27 but no dedicated weapons + calc_expected_dps( test_guy, "hatchet", 24.0 ); + calc_expected_dps( test_guy, "crash_axe", 24.0 ); + calc_expected_dps( test_guy, "iceaxe", 19.0 ); + calc_expected_dps( test_guy, "throwing_axe", 14.0 ); + calc_expected_dps( test_guy, "carver_on", 22.5 ); + calc_expected_dps( test_guy, "pickaxe", 10.5 ); + calc_expected_dps( test_guy, "primitive_adze", 10.0 ); // rock on a stick + calc_expected_dps( test_guy, "primitive_axe", 10.0 ); // rock on a stick + calc_expected_dps( test_guy, "makeshift_axe", 9.0 ); // chunk of sharp steel + calc_expected_dps( test_guy, "hand_axe", 8.5 ); // chunk of sharp rock + } } From d2c70444bf7978fb5dcfa079519e82c3b98c961e Mon Sep 17 00:00:00 2001 From: Mark Langsdorf Date: Fri, 5 Jun 2020 12:42:27 -0500 Subject: [PATCH 5/5] weapons: add tests for melee weapon value and update bludgeons add tests for effective DPS/value for one handed bludgeons. Reduce the bashing damage on bats to bring them under maces; bring bokken, shillelagh, and baseball bat base damage closer together. Increase the weight of two by swords and nail swords to tone them down a little. Weapon value is mace > loaded stick > bats, batons, shillelaghs, and bokkens > tonfas > crowbars > shovels and improvised clubs > various tools > the humble rock. --- data/json/items/melee/bludgeons.json | 35 +++++++++-------- data/json/items/melee/swords_and_blades.json | 4 +- tests/effective_dps_test.cpp | 40 ++++++++++++++++++++ 3 files changed, 59 insertions(+), 20 deletions(-) diff --git a/data/json/items/melee/bludgeons.json b/data/json/items/melee/bludgeons.json index 70502d39f43be..d77f64e06d871 100644 --- a/data/json/items/melee/bludgeons.json +++ b/data/json/items/melee/bludgeons.json @@ -47,7 +47,7 @@ "techniques": [ "WBLOCK_1" ], "flags": [ "DURABLE_MELEE" ], "volume": "1750 ml", - "bashing": 26, + "bashing": 22, "price": 16000 }, { @@ -65,7 +65,7 @@ "qualities": [ [ "HAMMER", 1 ] ], "flags": [ "DURABLE_MELEE" ], "volume": "1750 ml", - "bashing": 26, + "bashing": 22, "price": 16000 }, { @@ -116,7 +116,7 @@ "flags": [ "DURABLE_MELEE", "BELT_CLIP" ], "use_action": { "menu_text": "Collapse", "type": "transform", "target": "baton", "msg": "You collapse your baton." }, "volume": "750 ml", - "bashing": 18, + "bashing": 21, "price": 17500 }, { @@ -209,9 +209,9 @@ "weight": "1133 g", "volume": "2 L", "//": "MA reference I used held that a bokken crushes rather than cuts (or impales) but is otherwise just as damaging as a katana. Nerfed by popular demand.", - "bashing": 26, + "bashing": 24, "cutting": 1, - "to_hit": 2, + "to_hit": 3, "category": "weapons" }, { @@ -230,7 +230,7 @@ "weight": "680 g", "volume": "2 L", "bashing": 13, - "to_hit": 1, + "to_hit": 2, "category": "weapons" }, { @@ -248,8 +248,8 @@ "flags": [ "SHEATH_SWORD" ], "weight": "1133 g", "volume": "2 L", - "bashing": 26, - "to_hit": 1, + "bashing": 17, + "to_hit": 2, "category": "weapons" }, { @@ -301,7 +301,7 @@ "techniques": [ "WBLOCK_1" ], "flags": [ "DURABLE_MELEE", "NONCONDUCTIVE" ], "volume": "2 L", - "bashing": 26, + "bashing": 22, "cutting": 8, "price": 20000 }, @@ -336,7 +336,7 @@ "techniques": [ "WBLOCK_2", "RAPID", "PRECISE" ], "flags": [ "DURABLE_MELEE" ], "volume": "600 ml", - "bashing": 8, + "bashing": 10, "price": 1000 }, { @@ -701,14 +701,13 @@ "name": { "str": "morningstar" }, "description": "A medieval weapon consisting of a wood handle with a heavy, spiked iron ball on the end. It deals devastating crushing damage, with a small amount of piercing to boot.", "weight": "1400 g", - "to_hit": -1, "color": "dark_gray", "symbol": "/", "material": [ "iron", "wood" ], "techniques": [ "SWEEP" ], "volume": "1500 ml", "bashing": 38, - "cutting": 6, + "cutting": 8, "flags": [ "DURABLE_MELEE", "SPEAR", "NONCONDUCTIVE" ], "price": 120000, "price_postapoc": 8000, @@ -727,7 +726,7 @@ "material": [ "aluminum", "wood" ], "techniques": [ "SWEEP" ], "volume": "1500 ml", - "bashing": 26, + "bashing": 13, "cutting": 1, "flags": [ "SPEAR", "NONCONDUCTIVE", "FRAGILE_MELEE" ], "price": 12000, @@ -765,7 +764,7 @@ "material": [ "wood" ], "techniques": [ "WBLOCK_1" ], "volume": "1750 ml", - "bashing": 26, + "bashing": 22, "cutting": 4, "flags": [ "STAB" ], "price": 16000, @@ -821,7 +820,7 @@ "flags": [ "DURABLE_MELEE", "BELT_CLIP" ], "use_action": { "menu_text": "Retract", "type": "transform", "target": "PR24-retracted", "msg": "You collapse your PR-24 baton." }, "volume": "2 L", - "bashing": 20, + "bashing": 22, "price": 30000, "price_postapoc": 750 }, @@ -909,7 +908,7 @@ "flags": [ "DURABLE_MELEE" ], "weight": "910 g", "volume": "1500 ml", - "bashing": 26, + "bashing": 24, "to_hit": 2, "price_postapoc": 1250, "category": "weapons" @@ -927,7 +926,7 @@ "flags": [ "DURABLE_MELEE", "NONCONDUCTIVE" ], "weight": "1135 g", "volume": "1500 ml", - "bashing": 30, + "bashing": 27, "to_hit": 2, "price_postapoc": 1750, "category": "weapons" @@ -945,7 +944,7 @@ "flags": [ "FRAGILE_MELEE" ], "weight": "850 g", "volume": "1500 ml", - "bashing": 26, + "bashing": 12, "to_hit": 1, "price_postapoc": 50, "category": "weapons" diff --git a/data/json/items/melee/swords_and_blades.json b/data/json/items/melee/swords_and_blades.json index 51bc02b7c0477..ffa5e78e615fa 100644 --- a/data/json/items/melee/swords_and_blades.json +++ b/data/json/items/melee/swords_and_blades.json @@ -8,7 +8,7 @@ "description": "A two by four with a cross guard and whittled down point; not much for slashing, but much better than your bare hands.", "material": "wood", "volume": "1250 ml", - "weight": "600 g", + "weight": "1000 g", "longest_side": "100 cm", "bashing": 12, "cutting": 1, @@ -26,7 +26,7 @@ "description": "The nail sword, or nord for short. This wooden sword has a dozen nails sticking at jagged angles from edge of the blade, making it much better at chopping than slashing.", "material": "wood", "volume": "1750 ml", - "weight": "648 g", + "weight": "1148 g", "longest_side": "100 cm", "bashing": 12, "cutting": 4, diff --git a/tests/effective_dps_test.cpp b/tests/effective_dps_test.cpp index a618cfc833d7f..3e73fed99f159 100644 --- a/tests/effective_dps_test.cpp +++ b/tests/effective_dps_test.cpp @@ -358,4 +358,44 @@ TEST_CASE( "expected weapon dps", "[expected][dps]" ) calc_expected_dps( test_guy, "makeshift_axe", 9.0 ); // chunk of sharp steel calc_expected_dps( test_guy, "hand_axe", 8.5 ); // chunk of sharp rock } + SECTION( "club" ) { // expected value around 24 but most aren't dedicated weapons + calc_expected_dps( test_guy, "mace", 24.0 ); + calc_expected_dps( test_guy, "morningstar", 23.0 ); + calc_expected_dps( test_guy, "shillelagh_weighted", 22.0 ); + calc_expected_dps( test_guy, "bwirebat", 22.0 ); + calc_expected_dps( test_guy, "baton-extended", 21.0 ); + calc_expected_dps( test_guy, "bat_metal", 21.0 ); + calc_expected_dps( test_guy, "nailbat", 21.0 ); + calc_expected_dps( test_guy, "bat", 20.0 ); + calc_expected_dps( test_guy, "shillelagh", 20.0 ); + calc_expected_dps( test_guy, "bokken", 20.0 ); + calc_expected_dps( test_guy, "PR24-extended", 20.0 ); + calc_expected_dps( test_guy, "mace_inferior", 18.0 ); + calc_expected_dps( test_guy, "tonfa", 17.0 ); + calc_expected_dps( test_guy, "tonfa_wood", 16.0 ); + calc_expected_dps( test_guy, "shocktonfa_off", 16.0 ); + calc_expected_dps( test_guy, "shocktonfa_on", 16.0 ); + calc_expected_dps( test_guy, "crowbar", 15.0 ); + calc_expected_dps( test_guy, "morningstar_inferior", 15.0 ); + calc_expected_dps( test_guy, "bokken_inferior", 13.0 ); + calc_expected_dps( test_guy, "golf_club", 14.0 ); + calc_expected_dps( test_guy, "mace_fake", 13.0 ); + calc_expected_dps( test_guy, "claw_bar", 11.0 ); + calc_expected_dps( test_guy, "shovel", 11.0 ); + calc_expected_dps( test_guy, "e_tool", 11.0 ); + calc_expected_dps( test_guy, "sword_nail", 11.0 ); + calc_expected_dps( test_guy, "sword_wood", 10.5 ); + calc_expected_dps( test_guy, "cane", 10.5 ); + calc_expected_dps( test_guy, "cudgel", 10.5 ); + calc_expected_dps( test_guy, "primitive_hammer", 10.0 ); + calc_expected_dps( test_guy, "bokken_fake", 10.5 ); + calc_expected_dps( test_guy, "shillelagh_fake", 9.5 ); + calc_expected_dps( test_guy, "morningstar_fake", 8.0 ); + calc_expected_dps( test_guy, "wrench", 7.0 ); + calc_expected_dps( test_guy, "hammer", 6.0 ); + calc_expected_dps( test_guy, "rebar", 7.0 ); + calc_expected_dps( test_guy, "primitive_shovel", 7.0 ); + calc_expected_dps( test_guy, "heavy_flashlight", 7.0 ); + calc_expected_dps( test_guy, "rock", 6.0 ); + } }