Skip to content

Commit

Permalink
Aftershock: Smartguns (#61361)
Browse files Browse the repository at this point in the history
* Smartguns

* Style corrections

* Update ranged.cpp

* Remove a weapon that snuck through.
  • Loading branch information
John-Candlebury authored Oct 5, 2022
1 parent 8c5310f commit 60ae0ca
Show file tree
Hide file tree
Showing 17 changed files with 265 additions and 2 deletions.
5 changes: 5 additions & 0 deletions data/json/flags.json
Original file line number Diff line number Diff line change
Expand Up @@ -928,6 +928,11 @@
"type": "json_flag",
"info": "This clothing has a wool lining sewn into it to <good>increase</good> its overall <info>warmth</info>."
},
{
"id": "WONT_TRAIN_MARKSMANSHIP",
"type": "json_flag",
"//": "This gun wont train marksmanship when fired. Used in Aftershock smart guns."
},
{
"id": "UNARMED_WEAPON",
"type": "json_flag",
Expand Down
8 changes: 8 additions & 0 deletions data/mods/Aftershock/itemgroups/nanofab_recipes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"type": "item_group",
"id": "afs_template_10mm_smart",
"subtype": "distribution",
"entries": [ { "item": "afs_10mm_smart", "prob": 10 } ]
}
]
22 changes: 22 additions & 0 deletions data/mods/Aftershock/items/ammo/10mm.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,27 @@
"dispersion": 60,
"recoil": 600,
"extend": { "effects": [ "COOKOFF" ], "flags": [ "CASELESS_ROUNDS" ] }
},
{
"id": "afs_10mm_smart",
"type": "AMMO",
"name": { "str_sp": "10mm SDART" },
"description": "High precision 10mm microjet darts. These low velocity rounds can adjust mid-flight to exploit weaknesses in the target's defenses.",
"//": "tiny guided rockets.",
"weight": "7 g",
"volume": "115 ml",
"price": 150,
"material": [ "superalloy", "powder", "plastic" ],
"symbol": "=",
"color": "pink",
"count": 42,
"stack_size": 42,
"ammo_type": "afs_10mm_smart",
"range": 14,
"damage": { "damage_type": "bullet", "amount": 20, "armor_penetration": 10 },
"dispersion": 0,
"recoil": 600,
"critical_multiplier": 4,
"extend": { "effects": [ "COOKOFF", "NEVER_MISFIRES" ], "flags": [ "CASELESS_ROUNDS" ] }
}
]
22 changes: 22 additions & 0 deletions data/mods/Aftershock/items/ammo/25mm.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,27 @@
"range": 110,
"damage": { "damage_type": "bullet", "amount": 280, "armor_penetration": 70 },
"dispersion": 15
},
{
"id": "afs_25mm_smart",
"type": "AMMO",
"name": { "str_sp": "25mm SDART" },
"description": "High precision 25mm microjet darts. These low velocity rounds can adjust mid-flight to exploit weaknesses in the target's defenses.",
"//": "tiny guided rockets.",
"weight": "42 g",
"volume": "60 ml",
"price": "55000 USD",
"material": [ "superalloy", "powder", "plastic" ],
"symbol": "=",
"color": "pink",
"count": 5,
"ammo_type": "afs_25mm_smart",
"range": 110,
"stack_size": 1,
"recoil": 100,
"effects": [ "NEVER_MISFIRES", "CASELESS_ROUNDS" ],
"damage": { "damage_type": "bullet", "amount": 40, "armor_penetration": 5 },
"critical_multiplier": 10,
"dispersion": 0
}
]
12 changes: 12 additions & 0 deletions data/mods/Aftershock/items/ammo_type.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,24 @@
"name": "25mm",
"default": "afs_25mm_shot"
},
{
"type": "ammunition_type",
"id": "afs_25mm_smart",
"name": "25mm microjet",
"default": "afs_25mm_smart"
},
{
"type": "ammunition_type",
"id": "afs_10mm",
"name": "10mm",
"default": "afs_10mm_caseless_JHP"
},
{
"type": "ammunition_type",
"id": "afs_10mm_smart",
"name": "10mm microjet",
"default": "afs_10mm_smart"
},
{
"type": "ammunition_type",
"id": "afs_7.50mm",
Expand Down
47 changes: 47 additions & 0 deletions data/mods/Aftershock/items/gun/10mm.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,52 @@
"item_restriction": [ "afs_84k_20mag" ]
}
]
},
{
"id": "afs_silvergram_pistol",
"copy-from": "pistol_base",
"looks_like": "glock_17",
"type": "GUN",
"name": { "str": "W1011 Silvergram" },
"description": "A finely sculpted white and silver pistol entrusted to Wraitheon's corporate elite. It employs advanced targeting and precision guiding capabilities to deliver devastating bursts of guided 10mm microjet darts. Firing is as expensive as it looks.",
"weight": "780 g",
"volume": "480 ml",
"longest_side": "205 mm",
"price": "750 kUSD",
"to_hit": -2,
"bashing": 8,
"material": [ "plastic", "superalloy" ],
"built_in_mods": [ "afs_smart_scope" ],
"skill": "smartgun",
"symbol": "(",
"color": "dark_gray",
"ammo": "afs_10mm_smart",
"dispersion": 0,
"durability": 9,
"blackpowder_tolerance": 0,
"variants": [
{
"id": "silverhawk",
"name": { "str": "W1011 Silverhawk" },
"description": "A Silvergram smart pistol given a far less conspicuous \"military carbon\" black finish. Its performance and smart targeting capacities are otherwise identical."
}
],
"min_cycle_recoil": 570,
"modes": [ [ "DEFAULT", "2rd. burst", 2 ] ],
"pocket_data": [
{
"magazine_well": "103 ml",
"pocket_type": "MAGAZINE_WELL",
"holster": true,
"max_contains_volume": "20 L",
"max_contains_weight": "20 kg",
"item_restriction": [ "afs_silvergram_22mag" ]
}
],
"valid_mod_locations": [ [ "sights", 1 ], [ "sling", 1 ] ],
"flags": [ "NEVER_JAMS", "MUNDANE", "WONT_TRAIN_MARKSMANSHIP" ],
"relic_data": {
"passive_effects": [ { "has": "WIELD", "condition": "ALWAYS", "values": [ { "value": "WEAPON_DISPERSION", "multiply": -0.9 } ] } ]
}
}
]
32 changes: 32 additions & 0 deletions data/mods/Aftershock/items/gun/25mm.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,37 @@
],
"flags": [ "NEVER_JAMS", "RELOAD_EJECT" ],
"pocket_data": [ { "pocket_type": "MAGAZINE", "rigid": true, "ammo_restriction": { "afs_25mm": 1 } } ]
},
{
"id": "afs_wa2519",
"looks_like": "m79",
"type": "GUN",
"reload_noise_volume": 10,
"name": { "str": "Wraitheon Armory 2519" },
"description": "The much feared 2519 smart sniper platform leverages advanced ballistic targeting and guidance computers to deliver heavy munitions with unerring precision. Its undisputed lethality makes it a rare sight outside of the company's max security divisions.",
"weight": "3500 g",
"volume": "450 ml",
"longest_side": "95 cm",
"barrel_volume": "1170 ml",
"price": "1500 USD",
"to_hit": -3,
"bashing": 10,
"material": [ "superalloy", "wood" ],
"built_in_mods": [ "afs_smart_scope" ],
"symbol": "(",
"color": "cyan",
"skill": "smartgun",
"modes": [ [ "DEFAULT", "single shot", 1 ] ],
"dispersion": 0,
"durability": 9,
"ammo": [ "afs_25mm_smart" ],
"clip_size": 1,
"reload": 1000,
"valid_mod_locations": [ [ "sights", 1 ], [ "sling", 1 ] ],
"flags": [ "NEVER_JAMS", "RELOAD_EJECT", "MUNDANE", "WONT_TRAIN_MARKSMANSHIP" ],
"relic_data": {
"passive_effects": [ { "has": "WIELD", "condition": "ALWAYS", "values": [ { "value": "WEAPON_DISPERSION", "multiply": -0.9 } ] } ]
},
"pocket_data": [ { "pocket_type": "MAGAZINE", "rigid": true, "ammo_restriction": { "afs_25mm_smart": 1 } } ]
}
]
23 changes: 23 additions & 0 deletions data/mods/Aftershock/items/gunmods/sights.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,28 @@
"aim_speed_modifier": 15,
"min_skills": [ [ "weapon", 2 ], [ "gun", 1 ] ],
"flags": [ "DISABLE_SIGHTS" ]
},
{
"id": "afs_smart_scope",
"type": "GUNMOD",
"name": { "str_sp": "ballistic computer" },
"description": "An integrated ballistic computer completely replaces the sights of this weapon. Aiming depends on a small glass screen on which targets are automatically highlighted.",
"weight": "60 g",
"volume": "250 ml",
"integral_volume": "0 ml",
"integral_weight": "0 g",
"price": "10 kUSD",
"price_postapoc": "10 kUSD",
"install_time": "10 m",
"material": [ "steel" ],
"symbol": ":",
"color": "dark_gray",
"location": "sights",
"mod_targets": [ "smartgun" ],
"sight_dispersion": 0,
"field_of_view": 3000,
"aim_speed_modifier": 5000,
"min_skills": [ [ "weapon", 2 ], [ "gun", 1 ] ],
"flags": [ "DISABLE_SIGHTS" ]
}
]
17 changes: 17 additions & 0 deletions data/mods/Aftershock/items/magazine/10mm.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,22 @@
"ammo_type": [ "afs_10mm" ],
"flags": [ "MAG_COMPACT" ],
"pocket_data": [ { "pocket_type": "MAGAZINE", "rigid": true, "ammo_restriction": { "afs_10mm": 20 } } ]
},
{
"id": "afs_silvergram_22mag",
"looks_like": "glock17_17",
"type": "MAGAZINE",
"name": { "str": "Silvergram 22-round magazine" },
"description": "A transparent polymer 22-round magazine for Silvergram pattern smart pistols.",
"weight": "70 g",
"volume": "103 ml",
"longest_side": "114 mm",
"price": 2400,
"material": [ "plastic", "superalloy" ],
"symbol": "#",
"color": "light_gray",
"ammo_type": [ "afs_10mm_smart" ],
"flags": [ "MAG_COMPACT" ],
"pocket_data": [ { "pocket_type": "MAGAZINE", "rigid": true, "ammo_restriction": { "afs_10mm_smart": 22 } } ]
}
]
12 changes: 12 additions & 0 deletions data/mods/Aftershock/items/nanofab_templates.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[
{
"type": "GENERIC",
"id": "afs_10mm_smart_template",
"copy-from": "standard_template_construct",
"color": "yellow",
"name": { "str": "Wraitheon production chip" },
"description": "An encrypted Wraitheon industrial production chip. The executive logo embossed on its lower right imply its contents are extremely valuable.",
"nanofab_template_group": "afs_template_10mm_smart",
"template_requirements": "afs_nanofab_material_3"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[
{
"type": "terrain",
"id": "t_nanofab",
"name": "nanofabricator control panel",
"symbol": "&",
"description": "A small computer panel attached to a nanofabricator. It has a single slot for reading templates.",
"allowed_template_ids": [ "standard_template_construct", "debug_template", "afs_10mm_smart_template" ],
"color": "red",
"looks_like": "f_console",
"move_cost": 0,
"coverage": 50,
"flags": [ "WALL", "NOITEM", "PERMEABLE" ],
"examine_action": "nanofab",
"bash": {
"str_min": 8,
"str_max": 150,
"sound": "crunch!",
"sound_fail": "whack!",
"ter_set": "t_console_broken",
"items": [
{ "item": "processor", "prob": 25 },
{ "item": "RAM", "count": [ 0, 2 ], "prob": 50 },
{ "item": "cable", "charges": [ 1, 2 ], "prob": 50 },
{ "item": "small_lcd_screen", "prob": 25 },
{ "item": "e_scrap", "count": [ 1, 4 ], "prob": 50 },
{ "item": "circuit", "count": [ 0, 2 ], "prob": 50 },
{ "item": "power_supply", "prob": 25 },
{ "item": "amplifier", "prob": 25 },
{ "item": "plastic_chunk", "count": [ 4, 10 ], "prob": 50 },
{ "item": "scrap", "count": [ 2, 6 ], "prob": 50 }
]
}
}
]
9 changes: 8 additions & 1 deletion data/mods/Aftershock/player/professions.json
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,17 @@
"skills": [ { "level": 6, "name": "speech" }, { "level": 6, "name": "computer" } ],
"items": {
"both": {
"items": [ "tux", "dress_shoes", "socks", "gold_watch", "undershirt", "gasdiscount_platinum" ],
"items": [ "tux", "dress_shoes", "socks", "gold_watch", "undershirt", "gasdiscount_platinum", "afs_10mm_smart_template" ],
"entries": [
{ "item": "cash_card", "charges": 200000000 },
{ "item": "cash_card", "charges": 200000000 },
{
"item": "afs_silvergram_pistol",
"ammo-item": "afs_10mm_smart",
"charges": 22,
"container-item": "holster"
},
{ "item": "afs_silvergram_22mag", "ammo-item": "afs_10mm_smart", "charges": 22 },
{ "item": "afs_wraitheon_smartphone" }
]
},
Expand Down
5 changes: 5 additions & 0 deletions data/mods/Aftershock/recipes/requirements.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,10 @@
[ "afs_plasma_torch", 1 ]
]
]
},
{
"id": "afs_nanofab_material_3",
"type": "requirement",
"components": [ [ [ "afs_material_3", 2 ] ] ]
}
]
12 changes: 12 additions & 0 deletions data/mods/Aftershock/skills.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[
{
"type": "skill",
"id": "smartgun",
"name": { "str": "smart guns" },
"description": "Back in the 21st century marksmanship was an art whose mastery meant arduous years of constant training and preparation. There are computers for that now.",
"tags": [ "combat_skill" ],
"time_to_attack": { "min_time": 20, "base_time": 30, "time_reduction_per_level": 1 },
"display_category": "display_ranged",
"companion_skill_practice": [ { "skill": "combat", "weight": 25 } ]
}
]
1 change: 1 addition & 0 deletions src/flag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ const flag_id flag_WATER_FRIENDLY( "WATER_FRIENDLY" );
const flag_id flag_WET( "WET" );
const flag_id flag_WHIP( "WHIP" );
const flag_id flag_WIND_EXTINGUISH( "WIND_EXTINGUISH" );
const flag_id flag_WONT_TRAIN_MARKSMANSHIP( "WONT_TRAIN_MARKSMANSHIP" );
const flag_id flag_WRITE_MESSAGE( "WRITE_MESSAGE" );
const flag_id flag_ZERO_WEIGHT( "ZERO_WEIGHT" );
const flag_id flag_ZOOM( "ZOOM" );
Expand Down
1 change: 1 addition & 0 deletions src/flag.h
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ extern const flag_id flag_WRITE_MESSAGE;
extern const flag_id flag_ZERO_WEIGHT;
extern const flag_id flag_ZOOM;
extern const flag_id flag_wooled;
extern const flag_id flag_WONT_TRAIN_MARKSMANSHIP;
extern const flag_id flag_MUTE;
extern const flag_id flag_NOT_FOOTWEAR;
extern const flag_id flag_NO_CLEAN;
Expand Down
4 changes: 3 additions & 1 deletion src/ranged.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,9 @@ int Character::fire_gun( const tripoint &target, int shots, item &gun )
moves -= time_to_attack( *this, *gun_id );

// Practice the base gun skill proportionally to number of hits, but always by one.
practice( skill_gun, ( hits + 1 ) * 5 );
if( !gun.has_flag( flag_WONT_TRAIN_MARKSMANSHIP ) ) {
practice( skill_gun, ( hits + 1 ) * 5 );
}
// launchers train weapon skill for both hits and misses.
int practice_units = gun_skill == skill_launcher ? curshot : hits;
practice( gun_skill, ( practice_units + 1 ) * 5 );
Expand Down

0 comments on commit 60ae0ca

Please sign in to comment.