Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port ballistic damage type and preserve commit authorship info #1458

Merged
merged 13 commits into from
Apr 21, 2022
Merged

Port ballistic damage type and preserve commit authorship info #1458

merged 13 commits into from
Apr 21, 2022

Conversation

anothersimulacrum
Copy link
Contributor

@anothersimulacrum anothersimulacrum commented Apr 12, 2022

Summary

SUMMARY: Features "Port over and implement ballistic damage type"

Purpose of change

I saw #1398 did not preserve commit authorship info. This is a version of that that does preserve that info.

Describe the solution

Cherry-pick the commits from
CleverRaven/Cataclysm-DDA#38912
CleverRaven/Cataclysm-DDA#45378
CleverRaven/Cataclysm-DDA#45336 (note! this fixes the issue mentioned in the PR body about the display)

Additional context

I don't particularly care or want this PR merged, but I would like if #1398 would use this branch and make whatever further changes it will with this as a basis, so that commit authorship info is preserved. And when you port things in the future, please peseve authorship info in commits.

Diff between this and #1398
diff --git a/data/json/flags.json b/data/json/flags.json
index 6c48594369..ac60f0fde6 100644
--- a/data/json/flags.json
+++ b/data/json/flags.json
@@ -215,11 +215,6 @@
     "type": "json_flag",
     "info": "This gear <good>completely protects</good> you from <info>acid damage</info>."
   },
-  {
-    "id": "EFFECT_BULLET_IMMUNE",
-    "context": [  ],
-    "type": "json_flag"
-  },
   {
     "id": "STAB_IMMUNE",
     "context": [ "ARMOR", "TOOL_ARMOR" ],
@@ -1050,6 +1045,11 @@
     "context": [  ],
     "type": "json_flag"
   },
+  {
+    "id": "EFFECT_BULLET_IMMUNE",
+    "context": [  ],
+    "type": "json_flag"
+  },
   {
     "id": "EFFECT_ACID_IMMUNE",
     "context": [  ],
diff --git a/data/json/items/gun/45.json b/data/json/items/gun/45.json
index 6b73bf1454..b6df0f94d7 100644
--- a/data/json/items/gun/45.json
+++ b/data/json/items/gun/45.json
@@ -315,7 +315,7 @@
     "weight": "930 g",
     "ammo": "45",
     "price_postapoc": 2500,
-    "ranged_damage": 0,
+    "ranged_damage": { "damage_type": "bullet", "amount": 0 },
     "built_in_mods": [ "match_trigger" ],
     "magazines": [ [ "45", [ "usp45mag" ] ] ]
   },
diff --git a/data/json/items/gun/9mm.json b/data/json/items/gun/9mm.json
index a8c7397f34..0788aafde6 100644
--- a/data/json/items/gun/9mm.json
+++ b/data/json/items/gun/9mm.json
@@ -212,7 +212,7 @@
     "bashing": 8,
     "ascii_picture": "hk_mp5-pdw",
     "dispersion": 270,
-    "ranged_damage": 0,
+    "ranged_damage": { "damage_type": "bullet", "amount": 0 },
     "built_in_mods": [ "folding_stock", "grip" ],
     "valid_mod_locations": [
       [ "accessories", 3 ],
@@ -254,7 +254,7 @@
       [ "sling", 1 ],
       [ "stock", 1 ]
     ],
-    "ranged_damage": 0
+    "ranged_damage": { "damage_type": "bullet", "amount": 0 }
   },
   {
     "id": "briefcase_smg",
diff --git a/data/json/items/gunmod/laser_gunmods.json b/data/json/items/gunmod/laser_gunmods.json
index ea7673de5b..103d2065ff 100644
--- a/data/json/items/gunmod/laser_gunmods.json
+++ b/data/json/items/gunmod/laser_gunmods.json
@@ -32,8 +32,8 @@
     "location": "lens",
     "mod_targets": [ "rifle", "pistol" ],
     "range_modifier": 15,
-    "dispersion_modifier": 15,
-    "damage_modifier": { "damage_type": "heat", "amount": 5 }
+    "damage_modifier": { "damage_type": "heat", "amount": 5 },
+    "dispersion_modifier": 15
   },
   {
     "id": "electrolaser_conversion",
diff --git a/data/json/obsoletion/items.json b/data/json/obsoletion/items.json
index 3a2dc554f3..a3819132f6 100644
--- a/data/json/obsoletion/items.json
+++ b/data/json/obsoletion/items.json
@@ -487,7 +487,7 @@
     "color": "magenta",
     "skill": "pistol",
     "range": 30,
-    "ranged_damage": { "damage_type": "stab", "amount": 10, "armor_penetration": 6 },
+    "ranged_damage": { "damage_type": "bullet", "amount": 10, "armor_penetration": 6 },
     "dispersion": 180,
     "durability": 4,
     "loudness": 7,
@@ -1016,7 +1016,7 @@
     "type": "AMMO",
     "name": { "str": "40mm slug" },
     "description": "A 40mm shell loaded with a massive bullet.  Say goodbye to your shoulder, I guess.",
-    "damage": { "damage_type": "stab", "amount": 130 },
+    "damage": { "damage_type": "bullet", "amount": 130 },
     "recoil": 875,
     "extend": { "effects": [ "LARGE_BEANBAG" ] }
   },
@@ -1931,7 +1931,7 @@
     "price_postapoc": 12000,
     "bashing": 8,
     "to_hit": -1,
-    "ranged_damage": { "damage_type": "bullet", "amount": 15 },
+    "ranged_damage": { "damage_type": "stab", "amount": 15 },
     "range": 3,
     "dispersion": 350,
     "durability": 7,
@@ -1995,7 +1995,7 @@
     "ammo": "metal_rail",
     "skill": "rifle",
     "range": 40,
-    "ranged_damage": { "damage_type": "bullet", "amount": 40 },
+    "ranged_damage": { "damage_type": "stab", "amount": 40 },
     "dispersion": 100,
     "durability": 7,
     "clip_size": 10,
@@ -2067,7 +2067,7 @@
     "ammo": "nail",
     "skill": "rifle",
     "range": 12,
-    "ranged_damage": { "damage_type": "bullet", "amount": 4, "armor_penetration": 20 },
+    "ranged_damage": { "damage_type": "stab", "amount": 4, "armor_penetration": 20 },
     "dispersion": 180,
     "durability": 5,
     "ups_charges": 5,
@@ -2159,7 +2159,7 @@
     "weight": "34500 g",
     "bashing": 8,
     "ammo_type": "mininuke_mod",
-    "damage": { "damage_type": "bullet", "amount": 14 },
+    "damage": { "damage_type": "stab", "amount": 14 },
     "stack_size": 2,
     "effects": [ "MININUKE_MOD", "NEVER_MISFIRES" ]
   },
diff --git a/data/json/obsoletion/monsters.json b/data/json/obsoletion/monsters.json
index 6d08b69925..f3afb8e68d 100644
--- a/data/json/obsoletion/monsters.json
+++ b/data/json/obsoletion/monsters.json
@@ -63,6 +63,7 @@
     "melee_cut": 0,
     "dodge": 6,
     "armor_cut": 6,
+    "armor_bullet": 5,
     "harvest": "arachnid",
     "anger_triggers": [ "PLAYER_WEAK" ],
     "fear_triggers": [ "PLAYER_CLOSE" ],
@@ -283,6 +284,7 @@
     "melee_cut": 6,
     "armor_bash": 12,
     "armor_cut": 8,
+    "armor_bullet": 6,
     "path_settings": { "max_dist": 5 },
     "revert_to_itype": "bot_tripod",
     "special_attacks": [ [ "FLAMETHROWER", 10 ] ],
@@ -313,6 +315,7 @@
     "melee_cut": 0,
     "armor_bash": 90,
     "armor_cut": 90,
+    "armor_bullet": 72,
     "vision_day": 50,
     "revert_to_itype": "bot_tankbot",
     "starting_ammo": { "40x46mm_m433": 200, "556": 3000 },
@@ -355,6 +358,7 @@
     "melee_cut": 0,
     "armor_bash": 18,
     "armor_cut": 14,
+    "armor_bullet": 11,
     "vision_day": 50,
     "vision_night": 35,
     "revert_to_itype": "bot_chickenbot",
diff --git a/data/mods/Aftershock/items/bioparts.json b/data/mods/Aftershock/items/bioparts.json
index 0484b3307d..345fd22be8 100644
--- a/data/mods/Aftershock/items/bioparts.json
+++ b/data/mods/Aftershock/items/bioparts.json
@@ -97,8 +97,7 @@
     "color": "magenta",
     "skill": "launcher",
     "range": 30,
-    "ranged_damage": 19,
-    "pierce": 12,
+    "ranged_damage": { "damage_type": "stab", "amount": 19, "armor_penetration": 12 },
     "dispersion": 90,
     "durability": 7,
     "loudness": 4,
diff --git a/data/mods/CRT_EXPANSION/items/crt_ammo.json b/data/mods/CRT_EXPANSION/items/crt_ammo.json
index 98683ce367..6cda7f55f7 100644
--- a/data/mods/CRT_EXPANSION/items/crt_ammo.json
+++ b/data/mods/CRT_EXPANSION/items/crt_ammo.json
@@ -11,7 +11,7 @@
     "volume": "200ml",
     "weight": "2 g",
     "ammo_type": "pellets",
-    "damage": 4,
+    "damage": { "damage_type": "stab", "amount": 4 },
     "dispersion": 100,
     "count": 100,
     "stack_size": 200,
@@ -28,7 +28,7 @@
     "material": "steel",
     "symbol": "=",
     "color": "dark_gray",
-    "relative": { "price": 300, "damage": 6, "pierce": 1, "dispersion": -20 }
+    "relative": { "price": 300, "damage": { "damage_type": "stab", "amount": 6, "armor_penetration": 1 }, "dispersion": -20 }
   },
   {
     "id": "hp_pellet",
@@ -40,7 +40,7 @@
     "material": "steel",
     "symbol": "=",
     "color": "dark_gray",
-    "relative": { "price": 200, "damage": 3, "pierce": 3 }
+    "relative": { "price": 200, "damage": { "damage_type": "stab", "amount": 3, "armor_penetration": 3 } }
   },
   {
     "id": "alloy_pellet",
@@ -51,7 +51,7 @@
     "material": "steel",
     "symbol": "=",
     "color": "dark_gray",
-    "relative": { "price": 500, "pierce": 2, "loudness": 25, "dispersion": 20 }
+    "relative": { "price": 500, "damage": { "damage_type": "stab", "armor_penetration": 2 }, "loudness": 25, "dispersion": 20 }
   },
   {
     "type": "AMMO",
diff --git a/data/mods/CRT_EXPANSION/items/crt_gun.json b/data/mods/CRT_EXPANSION/items/crt_gun.json
index a2228ed951..6058ca2adc 100644
--- a/data/mods/CRT_EXPANSION/items/crt_gun.json
+++ b/data/mods/CRT_EXPANSION/items/crt_gun.json
@@ -145,7 +145,7 @@
     "color": "yellow",
     "skill": "smg",
     "range": 2,
-    "ranged_damage": -2,
+    "ranged_damage": { "damage_type": "bullet", "amount": -2 },
     "dispersion": 150,
     "durability": 10,
     "loudness": 30,
@@ -209,7 +209,7 @@
     "bashing": 10,
     "to_hit": -1,
     "range": 17,
-    "ranged_damage": 5,
+    "ranged_damage": { "damage_type": "stab", "amount": 5 },
     "dispersion": 120,
     "durability": 8,
     "loudness": 18,
diff --git a/data/mods/CRT_EXPANSION/items/crt_gunmods.json b/data/mods/CRT_EXPANSION/items/crt_gunmods.json
index 15fdbdfc94..ffc9c9b1e6 100644
--- a/data/mods/CRT_EXPANSION/items/crt_gunmods.json
+++ b/data/mods/CRT_EXPANSION/items/crt_gunmods.json
@@ -60,7 +60,7 @@
     "name": { "str": "diffracting lens", "str_pl": "diffracting lenses" },
     "description": "A set of optics made to fit on laser weapons, which will diffract the laser beam into several lower powered beams.  This slightly increases point-blank damage and makes it difficult to not hit, but reduces range",
     "range_modifier": -7,
-    "damage_modifier": 2,
+    "damage_modifier": { "damage_type": "stab", "amount": 2 },
     "ammo_effects": [ "SHOT" ],
     "min_skills": [ [ "weapon", 1 ] ],
     "mod_targets": [ "rifle", "pistol", "smg", "shotgun" ]
diff --git a/data/mods/CrazyCataclysm/crazy_items.json b/data/mods/CrazyCataclysm/crazy_items.json
index 8d686658a4..1a823f163e 100644
--- a/data/mods/CrazyCataclysm/crazy_items.json
+++ b/data/mods/CrazyCataclysm/crazy_items.json
@@ -69,8 +69,7 @@
     "color": "cyan",
     "skill": "rifle",
     "range": 45,
-    "ranged_damage": 250,
-    "pierce": 20,
+    "ranged_damage": { "damage_type": "stab", "amount": 250, "armor_penetration": 20 },
     "dispersion": 10,
     "recoil": 100,
     "durability": 10,
diff --git a/data/mods/Generic_Guns/ammo/pistol.json b/data/mods/Generic_Guns/ammo/pistol.json
index 3881ecf5f2..a53027829f 100644
--- a/data/mods/Generic_Guns/ammo/pistol.json
+++ b/data/mods/Generic_Guns/ammo/pistol.json
@@ -39,9 +39,8 @@
     "name": { "str_sp": "pistol ammo, ball (black powder)" },
     "proportional": {
       "price": 0.3,
-      "damage": { "damage_type": "bullet", "amount": 0.76 },
+      "damage": { "damage_type": "bullet", "amount": 0.76, "armor_penetration": 0.5 },
       "recoil": 0.76,
-      "pierce": 0.5,
       "dispersion": 1.2
     },
     "extend": { "effects": [ "RECYCLED", "BLACKPOWDER", "MUZZLE_SMOKE" ] },
@@ -54,9 +53,8 @@
     "name": { "str_sp": "pistol ammo, JHP (black powder)" },
     "proportional": {
       "price": 0.3,
-      "damage": { "damage_type": "bullet", "amount": 0.76 },
+      "damage": { "damage_type": "bullet", "amount": 0.76, "armor_penetration": 0.5 },
       "recoil": 0.76,
-      "pierce": 0.5,
       "dispersion": 1.2
     },
     "extend": { "effects": [ "RECYCLED", "BLACKPOWDER", "MUZZLE_SMOKE" ] },
diff --git a/data/mods/Generic_Guns/ammo/pistol_magnum.json b/data/mods/Generic_Guns/ammo/pistol_magnum.json
index 20e9f5bb97..e46ae9f151 100644
--- a/data/mods/Generic_Guns/ammo/pistol_magnum.json
+++ b/data/mods/Generic_Guns/ammo/pistol_magnum.json
@@ -39,9 +39,8 @@
     "name": { "str_sp": "magnum ammo, ball (black powder)" },
     "proportional": {
       "price": 0.3,
-      "damage": { "damage_type": "bullet", "amount": 0.76 },
+      "damage": { "damage_type": "bullet", "amount": 0.76, "armor_penetration": 0.5 },
       "recoil": 0.76,
-      "pierce": 0.5,
       "dispersion": 1.2
     },
     "extend": { "effects": [ "RECYCLED", "BLACKPOWDER", "MUZZLE_SMOKE" ] },
@@ -54,9 +53,8 @@
     "name": { "str_sp": "magnum ammo, JHP (black powder)" },
     "proportional": {
       "price": 0.3,
-      "damage": { "damage_type": "bullet", "amount": 0.76 },
+      "damage": { "damage_type": "bullet", "amount": 0.76, "armor_penetration": 0.5 },
       "recoil": 0.76,
-      "pierce": 0.5,
       "dispersion": 1.2
     },
     "extend": { "effects": [ "RECYCLED", "BLACKPOWDER", "MUZZLE_SMOKE" ] },
diff --git a/data/mods/Generic_Guns/ammo/pistol_tiny.json b/data/mods/Generic_Guns/ammo/pistol_tiny.json
index 3d45c36fd6..3da6d47384 100644
--- a/data/mods/Generic_Guns/ammo/pistol_tiny.json
+++ b/data/mods/Generic_Guns/ammo/pistol_tiny.json
@@ -40,9 +40,8 @@
     "name": { "str_sp": "tiny pistol ammo, ball (black powder)" },
     "proportional": {
       "price": 0.3,
-      "damage": { "damage_type": "bullet", "amount": 0.57 },
+      "damage": { "damage_type": "bullet", "amount": 0.57, "armor_penetration": 0.5 },
       "recoil": 0.57,
-      "pierce": 0.5,
       "dispersion": 1.2
     },
     "extend": { "effects": [ "RECYCLED", "BLACKPOWDER", "MUZZLE_SMOKE" ] },
@@ -55,9 +54,8 @@
     "name": { "str_sp": "tiny pistol ammo, JHP (black powder)" },
     "proportional": {
       "price": 0.3,
-      "damage": { "damage_type": "bullet", "amount": 0.57 },
+      "damage": { "damage_type": "bullet", "amount": 0.57, "armor_penetration": 0.5 },
       "recoil": 0.57,
-      "pierce": 0.5,
       "dispersion": 1.2
     },
     "extend": { "effects": [ "RECYCLED", "BLACKPOWDER", "MUZZLE_SMOKE" ] },
diff --git a/data/mods/Generic_Guns/ammo/rifle.json b/data/mods/Generic_Guns/ammo/rifle.json
index 4fa82cd66d..12ce4851a6 100644
--- a/data/mods/Generic_Guns/ammo/rifle.json
+++ b/data/mods/Generic_Guns/ammo/rifle.json
@@ -39,9 +39,8 @@
     "name": { "str_sp": "rifle ammo, ball (black powder)" },
     "proportional": {
       "price": 0.3,
-      "damage": { "damage_type": "bullet", "amount": 0.57 },
+      "damage": { "damage_type": "bullet", "amount": 0.57, "armor_penetration": 0.5 },
       "recoil": 0.57,
-      "pierce": 0.5,
       "dispersion": 1.2
     },
     "extend": { "effects": [ "RECYCLED", "BLACKPOWDER", "MUZZLE_SMOKE" ] },
@@ -54,9 +53,8 @@
     "name": { "str_sp": "rifle ammo, AP (black powder)" },
     "proportional": {
       "price": 0.3,
-      "damage": { "damage_type": "bullet", "amount": 0.57 },
+      "damage": { "damage_type": "bullet", "amount": 0.57, "armor_penetration": 0.5 },
       "recoil": 0.57,
-      "pierce": 0.5,
       "dispersion": 1.2
     },
     "extend": { "effects": [ "RECYCLED", "BLACKPOWDER", "MUZZLE_SMOKE" ] },
diff --git a/data/mods/Generic_Guns/ammo/rifle_huge.json b/data/mods/Generic_Guns/ammo/rifle_huge.json
index 0f99ccb6d0..33d3061e93 100644
--- a/data/mods/Generic_Guns/ammo/rifle_huge.json
+++ b/data/mods/Generic_Guns/ammo/rifle_huge.json
@@ -39,9 +39,8 @@
     "name": { "str_sp": "rifle ammo, ball (black powder)" },
     "proportional": {
       "price": 0.3,
-      "damage": { "damage_type": "bullet", "amount": 0.57 },
+      "damage": { "damage_type": "bullet", "amount": 0.57, "armor_penetration": 0.5 },
       "recoil": 0.57,
-      "pierce": 0.5,
       "dispersion": 1.2
     },
     "extend": { "effects": [ "RECYCLED", "BLACKPOWDER", "MUZZLE_SMOKE" ] },
@@ -54,9 +53,8 @@
     "name": { "str_sp": "rifle ammo, AP (black powder)" },
     "proportional": {
       "price": 0.3,
-      "damage": { "damage_type": "bullet", "amount": 0.57 },
+      "damage": { "damage_type": "bullet", "amount": 0.57, "armor_penetration": 0.5 },
       "recoil": 0.57,
-      "pierce": 0.5,
       "dispersion": 1.2
     },
     "extend": { "effects": [ "RECYCLED", "BLACKPOWDER", "MUZZLE_SMOKE" ] },
diff --git a/data/mods/Generic_Guns/ammo/shot.json b/data/mods/Generic_Guns/ammo/shot.json
index fd0b8c47f5..eb107446ef 100644
--- a/data/mods/Generic_Guns/ammo/shot.json
+++ b/data/mods/Generic_Guns/ammo/shot.json
@@ -39,7 +39,7 @@
     "name": { "str_sp": "shotshell, slug" },
     "description": "A shotshell with a single projectile, shaped somewhat like a shuttlecock.  Slugs are used with shotguns to give them extra range, allowing them to stand in for a rifle.  Extremely damaging but rather inaccurate.",
     "dispersion": 100,
-    "relative": { "range": 12, "pierce": 6 },
+    "relative": { "range": 12, "damage": { "damage_type": "bullet", "armor_penetratoin": 6 } },
     "proportional": { "price": 1.4, "price_postapoc": 1.4, "recoil": 1.4 },
     "delete": { "effects": [ "SHOT" ] }
   },
diff --git a/data/mods/Generic_Guns/firearms/pistol_magnum.json b/data/mods/Generic_Guns/firearms/pistol_magnum.json
index 1b47b99df1..4487ea3f38 100644
--- a/data/mods/Generic_Guns/firearms/pistol_magnum.json
+++ b/data/mods/Generic_Guns/firearms/pistol_magnum.json
@@ -30,7 +30,7 @@
     "price": 10000,
     "bashing": 10,
     "color": "brown",
-    "ranged_damage": 0,
+    "ranged_damage": { "damage_type": "bullet", "amount": 0 },
     "dispersion": 550,
     "durability": 6,
     "blackpowder_tolerance": 60,
@@ -54,7 +54,7 @@
     "type": "GUN",
     "name": { "str": "pipe magnum" },
     "ammo": [ "ammo_pistol_magnum", "ammo_pistol" ],
-    "ranged_damage": -2,
+    "ranged_damage": { "damage_type": "bullet", "amount": -2 },
     "description": "A firearm made from a stout pipe, reinforced at the chamber.  It holds a single a round of standard or magnum pistol ammunition, and has a crude assembly to fire it.  There's no extractor, so it might be slow to reload, and its construction makes for poor reliability and longevity.",
     "dispersion": 440,
     "reload": 110
diff --git a/data/mods/Magiclysm/items/archery.json b/data/mods/Magiclysm/items/archery.json
index fb10359a97..2c254a3790 100644
--- a/data/mods/Magiclysm/items/archery.json
+++ b/data/mods/Magiclysm/items/archery.json
@@ -19,7 +19,7 @@
     "armor_data": { "covers": [ "torso" ], "encumbrance": 14 },
     "reload_noise_volume": 2,
     "loudness": 5,
-    "ranged_damage": 40,
+    "ranged_damage": { "damage_type": "stab", "amount": 40 },
     "range": 20,
     "dispersion": 95,
     "durability": 6,
diff --git a/data/mods/Magiclysm/items/enchanted_ranged.json b/data/mods/Magiclysm/items/enchanted_ranged.json
index f863ffc51f..a414e41239 100644
--- a/data/mods/Magiclysm/items/enchanted_ranged.json
+++ b/data/mods/Magiclysm/items/enchanted_ranged.json
@@ -39,6 +39,7 @@
     "symbol": "(",
     "color": "dark_gray",
     "ammo": [ "9mm", "9x18", "380", "357mag", "38" ],
+    "ranged_damage": { "damage_type": "bullet", "amount": 0 },
     "dispersion": 558,
     "durability": 7,
     "blackpowder_tolerance": 66,
diff --git a/data/mods/Magiclysm/items/ethereal_items.json b/data/mods/Magiclysm/items/ethereal_items.json
index 510a209586..7d7761b30c 100644
--- a/data/mods/Magiclysm/items/ethereal_items.json
+++ b/data/mods/Magiclysm/items/ethereal_items.json
@@ -300,7 +300,7 @@
     "to_hit": 1,
     "reload_noise_volume": 3,
     "loudness": 6,
-    "ranged_damage": 29,
+    "ranged_damage": { "damage_type": "stab", "amount": 29 },
     "range": 12,
     "dispersion": 950,
     "durability": 6,
diff --git a/data/mods/Magiclysm/items/fuel.json b/data/mods/Magiclysm/items/fuel.json
index c1d63ecec5..0b50d00482 100644
--- a/data/mods/Magiclysm/items/fuel.json
+++ b/data/mods/Magiclysm/items/fuel.json
@@ -14,9 +14,8 @@
     "phase": "liquid",
     "category": "fuel",
     "ammo_type": "dragon_blood",
-    "damage": 5,
+    "damage": { "damage_type": "stab", "amount": 5, "armor_penetration": 5 },
     "range": 4,
-    "pierce": 5,
     "effects": [ "FLAME", "STREAM", "INCENDIARY", "NEVER_MISFIRES" ],
     "fuel": {
       "energy": 50,
diff --git a/data/mods/Magiclysm/monsters.json b/data/mods/Magiclysm/monsters.json
index d1a4187b75..07bf47dfa2 100644
--- a/data/mods/Magiclysm/monsters.json
+++ b/data/mods/Magiclysm/monsters.json
@@ -46,6 +46,7 @@
     "luminance": 16,
     "armor_bash": 2,
     "armor_cut": 2,
+    "armor_bullet": 2,
     "vision_day": 30,
     "vision_night": 30,
     "material": [ "steel" ],
diff --git a/data/mods/Magiclysm/monsters/lizardfolk.json b/data/mods/Magiclysm/monsters/lizardfolk.json
index 4493b5f6bd..8622404c10 100644
--- a/data/mods/Magiclysm/monsters/lizardfolk.json
+++ b/data/mods/Magiclysm/monsters/lizardfolk.json
@@ -24,8 +24,8 @@
     "dodge": 5,
     "armor_bash": 2,
     "armor_cut": 12,
-    "armor_stab": 6,
     "armor_bullet": 10,
+    "armor_stab": 6,
     "harvest": "lizardfolk",
     "death_function": [ "NORMAL" ],
     "death_drops": [
diff --git a/data/mods/TEST_DATA/items.json b/data/mods/TEST_DATA/items.json
index 14b18b2249..60fc65644f 100644
--- a/data/mods/TEST_DATA/items.json
+++ b/data/mods/TEST_DATA/items.json
@@ -13,7 +13,7 @@
     "weight": "657 g",
     "volume": "250 ml",
     "bashing": 7,
-    "damage": 7,
+    "damage": { "damage_type": "stab", "amount": 7 },
     "range": 10,
     "dispersion": 14,
     "loudness": 0,
@@ -371,7 +371,7 @@
     "to_hit": 1,
     "reload_noise_volume": 3,
     "loudness": 10,
-    "ranged_damage": 18,
+    "ranged_damage": { "damage_type": "stab", "amount": 18 },
     "range": 18,
     "dispersion": 850,
     "durability": 6,
diff --git a/src/assign.h b/src/assign.h
index fefaefd066..daf872edf2 100644
--- a/src/assign.h
+++ b/src/assign.h
@@ -952,19 +952,25 @@ inline bool assign( const JsonObject &jo, const std::string &name, damage_instan
         float amount = 0.0f;
         float arpen = 0.0f;
         float dmg_mult = 1.0f;
+        bool with_legacy = false;
 
         // There will always be either a prop_damage or damage (name)
         if( jo.has_member( name ) ) {
+            with_legacy = true;
             amount = jo.get_float( name );
         } else if( jo.has_member( "prop_damage" ) ) {
             dmg_mult = jo.get_float( "prop_damage" );
+            with_legacy = true;
         }
         // And there may or may not be armor penetration
         if( jo.has_member( "pierce" ) ) {
+            with_legacy = true;
             arpen = jo.get_float( "pierce" );
         }
 
-        out.add_damage( DT_STAB, amount, arpen, 1.0f, dmg_mult );
+        if( with_legacy ) {
+            out.add_damage( DT_STAB, amount, arpen, 1.0f, dmg_mult );
+        }
     }
 
     // Object via which to report errors which differs for proportional/relative values
diff --git a/src/bionics.h b/src/bionics.h
index a22e55e0d9..f8fc682d9e 100644
--- a/src/bionics.h
+++ b/src/bionics.h
@@ -82,6 +82,7 @@ struct bionic_data {
     std::map<bodypart_str_id, int> cut_protec;
     /**Amount of bullet protection offered by this bionic*/
     std::map<bodypart_str_id, int> bullet_protec;
+
     /**
      * Body part slots used to install this bionic, mapped to the amount of space required.
      */
diff --git a/src/character.h b/src/character.h
index 626cfa5b00..268806c603 100644
--- a/src/character.h
+++ b/src/character.h
@@ -1712,7 +1712,7 @@ class Character : public Creature, public visitable<Character>
         int get_armor_bash_base( bodypart_id bp ) const override;
         /** Returns cutting resistance from the creature and armor only */
         int get_armor_cut_base( bodypart_id bp ) const override;
-        /** Returns bullet resistance from the creature and armor only */
+        /** Returns cutting resistance from the creature and armor only */
         int get_armor_bullet_base( bodypart_id bp ) const override;
         /** Returns overall env_resist on a body_part */
         int get_env_resist( bodypart_id bp ) const override;
diff --git a/src/damage.cpp b/src/damage.cpp
index d0120c0206..cb3769c2c7 100644
--- a/src/damage.cpp
+++ b/src/damage.cpp
@@ -236,7 +236,7 @@ static const std::map<std::string, damage_type> dt_map = {
     { translate_marker_context( "damage type", "cut" ), DT_CUT },
     { translate_marker_context( "damage type", "acid" ), DT_ACID },
     { translate_marker_context( "damage type", "stab" ), DT_STAB },
-    { translate_marker_context( "damage type", "bullet" ), DT_BULLET },
+    { translate_marker_context( "damage_type", "bullet" ), DT_BULLET },
     { translate_marker_context( "damage type", "heat" ), DT_HEAT },
     { translate_marker_context( "damage type", "cold" ), DT_COLD },
     { translate_marker_context( "damage type", "electric" ), DT_ELECTRIC }
diff --git a/src/item.cpp b/src/item.cpp
index 21fbad76cc..bedb67758b 100644
--- a/src/item.cpp
+++ b/src/item.cpp
@@ -5838,7 +5838,6 @@ int item::stab_resist( bool to_self ) const
     return static_cast<int>( 0.8f * cut_resist( to_self ) );
 }
 
-
 int item::bullet_resist( bool to_self ) const
 {
     if( is_null() ) {
diff --git a/src/magic_enchantment.cpp b/src/magic_enchantment.cpp
index 69d90b930e..b1e6b59908 100644
--- a/src/magic_enchantment.cpp
+++ b/src/magic_enchantment.cpp
@@ -114,7 +114,7 @@ namespace io
             case enchant_vals::mod::ITEM_DAMAGE_BASH: return "ITEM_DAMAGE_BASH";
             case enchant_vals::mod::ITEM_DAMAGE_CUT: return "ITEM_DAMAGE_CUT";
             case enchant_vals::mod::ITEM_DAMAGE_STAB: return "ITEM_DAMAGE_STAB";
-            case enchant_vals::mod::ITEM_DAMAGE_BULLET: return "ITEM_DAMAGE_BULLET";
+           case enchant_vals::mod::ITEM_DAMAGE_BULLET: return "ITEM_DAMAGE_BULLET";
             case enchant_vals::mod::ITEM_DAMAGE_HEAT: return "ITEM_DAMAGE_HEAT";
             case enchant_vals::mod::ITEM_DAMAGE_COLD: return "ITEM_DAMAGE_COLD";
             case enchant_vals::mod::ITEM_DAMAGE_ELEC: return "ITEM_DAMAGE_ELEC";
diff --git a/src/monster.cpp b/src/monster.cpp
index 8903ffdc3f..32edfb8ac1 100644
--- a/src/monster.cpp
+++ b/src/monster.cpp
@@ -1877,12 +1877,12 @@ int monster::get_armor_type( damage_type dt, bodypart_id bp ) const
             return get_armor_bash( bp );
         case DT_CUT:
             return get_armor_cut( bp );
+        case DT_BULLET:
+            return get_armor_bullet( bp );
         case DT_ACID:
             return worn_armor + static_cast<int>( type->armor_acid );
         case DT_STAB:
             return worn_armor + static_cast<int>( type->armor_stab ) + armor_cut_bonus * 0.8f;
-        case DT_BULLET:
-            return get_armor_bullet( bp );
         case DT_HEAT:
             return worn_armor + static_cast<int>( type->armor_fire );
         case DT_COLD:

anothersimulacrum and others added 13 commits April 12, 2022 17:18
Currently, it's just 80% of cut, arithmetically rounded
Just set equivalent to stab damage, with arithmetical rounding
Iteminfo uses the 'front' damage unit of a damage instance for
generating the damage and armor penetration displays for ammo. However,
when items used relative or proportional, it unconditionally added an
empty STAB damage unit in an attempt to compensate for the old damage
loading system.

Make adding this stab unit dependent on whether it actually will be
empty or not, and revamp the checks for this to be more clear.

Also, change the remaining 5 items that were getting away with using the
old loading system because they did not change the values to use the new
system (with the revamped checks, they now throw errors).
@chaosvolt
Copy link
Member

(note! this fixes the issue mentioned in the PR body about the display)

Ah! That's what I was missing, thanks. I'll go ahead and close #1398 in that case, and then set aside the BN-specific rebalances I had planned at a later date after this is merged.

And when you port things in the future, please peseve authorship info in commits.

If I was able to get cherry-pick to work right I would, but I have been unable to. Moreover, per #1298 (comment)

Yes I think credit and sourcing in the PR description is a reasonable option.

I do understand that cherry-pick would be preferable when feasible however, and will try do so if I can ever get the feature working.

@Coolthulhu Coolthulhu self-assigned this Apr 19, 2022
@@ -952,19 +952,25 @@ inline bool assign( const JsonObject &jo, const std::string &name, damage_instan
float amount = 0.0f;
float arpen = 0.0f;
float dmg_mult = 1.0f;
bool with_legacy = false;
Copy link
Member

@Coolthulhu Coolthulhu Apr 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if I get this part. It's always set to true if amount is >0 or explicit 0 is specified. Why is the name with_legacy?

EDIT: Oh right, because it has this comment at the top that Github cut off because it's the 4th line.

@KheirFerrum KheirFerrum mentioned this pull request Apr 20, 2022
5 tasks
@Coolthulhu Coolthulhu merged commit 7adc745 into cataclysmbnteam:upload Apr 21, 2022
@anothersimulacrum anothersimulacrum deleted the bn-bullet branch April 21, 2022 16:51
@chaosvolt
Copy link
Member

Side note, working on follow-up PR to this, will be out and about today so many not be able to finish it until later on when I get home.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants