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

fix: internal-mag guns that lack RELOAD_ONE no longer massively inflate reload cost #5769

Merged
merged 2 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -613,10 +613,10 @@
}

Character::Character( Character &&source ) noexcept : Creature( std::move( source ) ),
worn( new worn_item_location( this ) ),

Check warning on line 616 in src/character.cpp

View workflow job for this annotation

GitHub Actions / build

missing exception handler for allocation failure at 'new' [bugprone-unhandled-exception-at-new]
inv( new character_item_location( this ) )

Check warning on line 617 in src/character.cpp

View workflow job for this annotation

GitHub Actions / build

missing exception handler for allocation failure at 'new' [bugprone-unhandled-exception-at-new]
{
move_operator_common( std::move( source ) );

Check warning on line 619 in src/character.cpp

View workflow job for this annotation

GitHub Actions / build

'source' used after it was moved [bugprone-use-after-move]
}

Character &Character::operator=( Character &&source )
Expand All @@ -624,7 +624,7 @@
{
move_operator_common( std::move( source ) );

Creature::operator=( std::move( source ) );

Check warning on line 627 in src/character.cpp

View workflow job for this annotation

GitHub Actions / build

'source' used after it was moved [bugprone-use-after-move]
return *this;
}

Expand Down Expand Up @@ -11534,7 +11534,9 @@
/** @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
Loading