Skip to content

Commit

Permalink
fix: internal-mag guns that lack RELOAD_ONE no longer massively inf…
Browse files Browse the repository at this point in the history
…late reload cost (cataclysmbnteam#5769)

* fix: internal-mag guns that lack `RELOAD_ONE` no longer massively inflate reload cost

* style(autofix.ci): automated formatting

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
  • Loading branch information
chaosvolt and autofix-ci[bot] authored Nov 27, 2024
1 parent 5865454 commit 0575c7a
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion data/json/items/classes/gun.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"skill": "launcher",
"ammo": "flammable",
"ammo_effects": [ "FLARE" ],
"reload": 4,
"reload": 400,
"flags": [ "FIRE_100", "NEVER_JAMS", "FIRESTARTER", "PYROMANIAC_WEAPON" ],
"use_action": { "type": "firestarter", "moves": 200 },
"faults": [ ]
Expand Down
2 changes: 1 addition & 1 deletion data/json/items/gun/misc.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"handling": 40,
"modes": [ [ "DEFAULT", "burst", 4 ] ],
"clip_size": 100,
"reload": 0,
"reload": 500,
"loudness": 5,
"valid_mod_locations": [ [ "sling", 1 ] ]
}
Expand Down
2 changes: 1 addition & 1 deletion data/json/items/gun/nail.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"dispersion": 800,
"loudness": 10,
"clip_size": 20,
"reload": 50,
"reload": 200,
"ranged_damage": { "damage_type": "stab", "amount": 1 },
"valid_mod_locations": [ [ "grip", 1 ], [ "rail", 1 ], [ "sights", 1 ], [ "stock", 1 ], [ "underbarrel", 1 ] ]
},
Expand Down
1 change: 1 addition & 0 deletions data/json/items/gun/ups.json
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@
"modes": [ [ "DEFAULT", "semi", 1 ], [ "AUTO", "auto", 5 ] ],
"ammo": "water",
"clip_size": 80,
"reload": 300,
"extend": { "flags": [ "MOUNTED_GUN", "NO_RECOVER_AMMO" ] },
"delete": { "flags": [ "NO_UNLOAD" ] }
}
Expand Down
2 changes: 1 addition & 1 deletion data/json/items/magazine/chemical_spray.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"ammo_type": "chemical_spray",
"capacity": 800,
"reliability": 9,
"reload_time": 3,
"reload_time": 1,
"flags": [ "MAG_BULKY" ]
}
]
8 changes: 4 additions & 4 deletions data/json/items/magazine/liquid.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"ammo_type": "flammable",
"capacity": 3000,
"reliability": 9,
"reload_time": 3,
"reload_time": 1,
"flags": [ "MAG_BULKY" ]
},
{
Expand All @@ -34,7 +34,7 @@
"ammo_type": "flammable",
"capacity": 500,
"reliability": 9,
"reload_time": 3,
"reload_time": 1,
"flags": [ "MAG_BULKY" ]
},
{
Expand All @@ -53,7 +53,7 @@
"ammo_type": "flammable",
"capacity": 2000,
"reliability": 10,
"reload_time": 3,
"reload_time": 1,
"flags": [ "MAG_BULKY" ]
},
{
Expand All @@ -72,7 +72,7 @@
"ammo_type": "flammable",
"capacity": 4000,
"reliability": 10,
"reload_time": 3,
"reload_time": 1,
"flags": [ "MAG_BULKY" ]
}
]
5 changes: 3 additions & 2 deletions data/json/items/ranged/pneumatic.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@
"recoil": 350,
"durability": 7,
"clip_size": 10,
"loudness": 16
"loudness": 16,
"extend": { "flags": [ "RELOAD_ONE" ] }
},
{
"id": "tihar",
Expand Down Expand Up @@ -104,7 +105,7 @@
"durability": 7,
"modes": [ [ "DEFAULT", "single", 1 ], [ "DOUBLE", "double", 2 ] ],
"clip_size": 2,
"reload": 6000,
"reload": 1000,
"loudness": 22,
"valid_mod_locations": [
[ "accessories", 4 ],
Expand Down
2 changes: 1 addition & 1 deletion data/json/items/ranged/spearguns.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"dispersion": 105,
"durability": 8,
"clip_size": 4,
"reload": 6000,
"reload": 1000,
"loudness": 11,
"valid_mod_locations": [
[ "accessories", 4 ],
Expand Down
4 changes: 3 additions & 1 deletion src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11534,7 +11534,9 @@ int Character::item_reload_cost( const item &it, item &ammo, int qty ) const
/** @EFFECT_SHOTGUN decreases time taken to reload a shotgun */
/** @EFFECT_LAUNCHER decreases time taken to reload a launcher */

int cost = ( it.is_gun() ? it.get_reload_time() : it.type->magazine->reload_time ) * qty;
// If we're topping off an internal magazine in a gun, only use base reload time, magazines use time per round.
int cost = ( it.is_gun() ? it.get_reload_time() : it.type->magazine->reload_time ) *
( it.is_gun() ? 1 : qty );

skill_id sk = it.is_gun() ? it.type->gun->skill_used : skill_gun;
mv += cost / ( 1.0f + std::min( get_skill_level( sk ) * 0.1f, 1.0f ) );
Expand Down

0 comments on commit 0575c7a

Please sign in to comment.