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

Drop charge rifle #15713

Merged
merged 5 commits into from
Mar 14, 2016
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 0 additions & 3 deletions data/json/item_groups.json
Original file line number Diff line number Diff line change
Expand Up @@ -4195,7 +4195,6 @@
["purifier", 12],
["plut_cell", 10],
["ftk93", 1],
["nx17", 1],
["canister_goo", 8],
["UPS_off", 5],
["adv_UPS_off", 3],
Expand Down Expand Up @@ -6604,7 +6603,6 @@
["m1014", 1],
["steyr_aug", 6],
["v29", 1],
["nx17", 1],
["flamethrower", 1],
["flashlight", 40],
["radio", 20],
Expand Down Expand Up @@ -7064,7 +7062,6 @@
["m240", 1],
["m27iar", 1],
["ftk93", 1],
["nx17", 1],
["m320", 5],
["m320_mod", 10],
["ugl_buttstock", 10],
Expand Down
1 change: 0 additions & 1 deletion data/json/itemgroups/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@
["militarymap", 20],
["mininuke", 10],
["mutagen", 80],
["nx17", 10],
["optical_cloak", 20],
["pickaxe", 10],
["plasma", 80],
Expand Down
15 changes: 0 additions & 15 deletions data/json/items/ammo.json
Original file line number Diff line number Diff line change
Expand Up @@ -852,21 +852,6 @@
"effects" : ["INCENDIARY"],
"flags" : ["UNRECOVERABLE"]
},
{ "type" : "AMMO",
"id" : "charge_shot",
"price" : 0,
"name" : "charge",
"symbol" : "=",
"color" : "red",
"description" : "A weak plasma charge.",
"volume" : 0,
"weight" : 0,
"ammo_type" : "NULL",
"damage" : 5,
"range" : 30,
"dispersion" : 30,
"count" : 1
},
{ "type" : "AMMO",
"id" : "shot_hull",
"category" : "spare_parts",
Expand Down
24 changes: 24 additions & 0 deletions data/json/items/obsolete.json
Original file line number Diff line number Diff line change
Expand Up @@ -370,5 +370,29 @@
"encumbrance" : 0,
"coverage" : 12,
"material_thickness" : 1
},
{
"id": "nx17",
"type": "GUN",
"symbol": "(",
"color": "magenta",
"name": "NX-17 charge rifle",
"description": "A multi-purpose rifle, designed for use in conjunction with a unified power supply, or UPS. It does not reload normally; instead, press fire once to start charging it from your UPS, then again to unload the charge.",
"price": 1200000,
"material": ["steel", "plastic"],
"flags": ["CHARGE", "NO_UNLOAD", "NEVER_JAMS", "NO_UNLOAD"],
"skill": "rifle",
"weight": 1814,
"volume": 13,
"bashing": 8,
"cutting": 0,
"to_hit": -1,
"dispersion": 10,
"sight_dispersion": 60,
"aim_speed" : 6,
"recoil": 0,
"durability": 8,
"reload": 0,
"valid_mod_locations": [[ "accessories", 4 ],[ "barrel", 1 ],[ "grip", 1 ],[ "mechanism", 4 ],[ "muzzle", 1 ],[ "rail", 1 ],[ "sights", 1 ],[ "stock", 1 ],[ "underbarrel", 1 ]]
}
]
25 changes: 0 additions & 25 deletions data/json/items/ranged.json
Original file line number Diff line number Diff line change
Expand Up @@ -331,31 +331,6 @@
"reload": 600,
"valid_mod_locations": [[ "accessories", 4 ],[ "barrel", 1 ],[ "grip", 1 ],[ "mechanism", 4 ],[ "muzzle", 1 ],[ "rail", 1 ],[ "sights", 1 ],[ "stock", 1 ],[ "underbarrel", 1 ]]
},

{
"id": "nx17",
"type": "GUN",
"symbol": "(",
"color": "magenta",
"name": "NX-17 charge rifle",
"description": "A multi-purpose rifle, designed for use in conjunction with a unified power supply, or UPS. It does not reload normally; instead, press fire once to start charging it from your UPS, then again to unload the charge.",
"price": 1200000,
"material": ["steel", "plastic"],
"flags": ["CHARGE", "NO_UNLOAD", "NEVER_JAMS", "NO_UNLOAD"],
"skill": "rifle",
"weight": 1814,
"volume": 13,
"bashing": 8,
"cutting": 0,
"to_hit": -1,
"dispersion": 10,
"sight_dispersion": 60,
"aim_speed" : 6,
"recoil": 0,
"durability": 8,
"reload": 0,
"valid_mod_locations": [[ "accessories", 4 ],[ "barrel", 1 ],[ "grip", 1 ],[ "mechanism", 4 ],[ "muzzle", 1 ],[ "rail", 1 ],[ "sights", 1 ],[ "stock", 1 ],[ "underbarrel", 1 ]]
},
{
"id": "flamethrower_simple",
"type": "GUN",
Expand Down
18 changes: 0 additions & 18 deletions data/json/vehicle_parts.json
Original file line number Diff line number Diff line change
Expand Up @@ -4298,24 +4298,6 @@
"breaks_into" : [
{"item": "ftk93", "prob": 50}
]
},{
"type" : "vehicle_part",
"id" : "laser_gun",
"name" : "mounted NX17",
"symbol" : "t",
"color" : "magenta",
"broken_symbol" : "#",
"broken_color" : "magenta",
"damage_modifier" : 80,
"durability" : 400,
"range" : 12,
"item" : "nx17",
"difficulty" : 8,
"location" : "on_roof",
"flags" : ["TURRET"],
"breaks_into" : [
{"item": "nx17", "prob": 50}
]
},{
"type" : "vehicle_part",
"id" : "laser_rifle",
Expand Down
1 change: 0 additions & 1 deletion data/json/vehicles/cars.json
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,6 @@
{"x": 1, "y": 0, "part": "flamethrower"},
{"x": 1, "y": 1, "part": "frame_horizontal"},
{"x": 1, "y": 1, "part": "storage_battery_mount", "//": "to make the blazemod happy"},
{"x": 1, "y": 1, "part": "laser_gun"},
{"x": 1, "y": -1, "part": "frame_nw"},
{"x": 1, "y": -1, "part": "wheel_steerable"},
{"x": 1, "y": -1, "part": "watercannon"},
Expand Down
4 changes: 0 additions & 4 deletions lua/class_definitions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,6 @@ classes = {
functions = {
{ name = "acid_resist", rval = "int", args = { } },
{ name = "acid_resist", rval = "int", args = { "bool" } },
{ name = "activate_charger_gun", rval = "bool", args = { "player" } },
{ name = "add_rain_to_container", rval = nil, args = { "bool" } },
{ name = "add_rain_to_container", rval = nil, args = { "bool", "int" } },
{ name = "add_technique", rval = nil, args = { "matec_id" } },
Expand Down Expand Up @@ -924,7 +923,6 @@ classes = {
{ name = "cut_resist", rval = "int", args = { "bool" } },
{ name = "damage_bash", rval = "int", args = { } },
{ name = "damage_cut", rval = "int", args = { } },
{ name = "deactivate_charger_gun", rval = "bool", args = { } },
{ name = "deserialize", rval = nil, args = { "string" } },
{ name = "destroyed_at_zero_charges", rval = "bool", args = { } },
{ name = "detonate", rval = nil, args = { "tripoint" } },
Expand Down Expand Up @@ -1000,7 +998,6 @@ classes = {
{ name = "is_bashing_weapon", rval = "bool", args = { } },
{ name = "is_bionic", rval = "bool", args = { } },
{ name = "is_book", rval = "bool", args = { } },
{ name = "is_charger_gun", rval = "bool", args = { } },
{ name = "is_container", rval = "bool", args = { } },
{ name = "is_container_empty", rval = "bool", args = { } },
{ name = "is_container_full", rval = "bool", args = { } },
Expand Down Expand Up @@ -1091,7 +1088,6 @@ classes = {
{ name = "type_name", rval = "string", args = { "int" } },
{ name = "type_name", rval = "string", args = { } },
{ name = "unset_curammo", rval = nil, args = { } },
{ name = "update_charger_gun_ammo", rval = "bool", args = { } },
{ name = "volume", rval = "int", args = { } },
{ name = "weap_skill", rval = "skill_id", args = { } },
{ name = "weight", rval = "int", args = { } },
Expand Down
3 changes: 0 additions & 3 deletions src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -718,9 +718,6 @@ bool Character::has_active_item(const itype_id & id) const

item Character::remove_weapon()
{
if( weapon.active ) {
weapon.deactivate_charger_gun();
}
item tmp = weapon;
weapon = ret_null;
return tmp;
Expand Down
6 changes: 0 additions & 6 deletions src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10723,12 +10723,6 @@ void game::plfire( bool burst, const tripoint &default_target )
return;
}

if( !gun.active && !gun.is_in_auxiliary_mode() ) {
if( gun.activate_charger_gun( u ) ) {
return;
}
}

if( gun.has_flag("FIRE_TWOHAND") && ( !u.has_two_arms() || u.worn_with_flag("RESTRICT_HANDS") ) ) {
add_msg(m_info, _("You need two free hands to fire your %s."), gun.tname().c_str() );
return;
Expand Down
128 changes: 2 additions & 126 deletions src/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@
#include <iterator>

static const std::string GUN_MODE_VAR_NAME( "item::mode" );
static const std::string CHARGER_GUN_FLAG_NAME( "CHARGE" );
static const std::string CHARGER_GUN_AMMO_ID( "charge_shot" );

const skill_id skill_survival( "survival" );
const skill_id skill_melee( "melee" );
Expand Down Expand Up @@ -3879,12 +3877,8 @@ int item::gun_range( bool with_ammo ) const
for( const auto mod : gunmods() ) {
ret += mod->type->gunmod->range;
}
if( with_ammo ) {
if( is_charger_gun() ) {
ret += 5 + charges * 5;
} else if( ammo_data() ) {
ret += ammo_data()->ammo->range;
}
if( with_ammo && ammo_data() ) {
ret += ammo_data()->ammo->range;
}
return std::max( 0, ret );
}
Expand Down Expand Up @@ -5474,121 +5468,6 @@ bool item::process_tool( player *carrier, const tripoint &pos )
return false;
}

bool item::is_charger_gun() const
{
return has_flag( CHARGER_GUN_FLAG_NAME );
}

bool item::deactivate_charger_gun()
{
if( !is_charger_gun() ) {
return false;
}
charges = 0;
active = false;
return true;
}

bool item::activate_charger_gun( player &u )
{
if( !is_charger_gun() ) {
return false;
}
if( u.has_charges( "UPS", 1 ) ) {
u.add_msg_if_player( m_info, _( "Your %s starts charging." ), tname().c_str() );
charges = 0;
poison = 0;
set_curammo( CHARGER_GUN_AMMO_ID );
active = true;
} else {
u.add_msg_if_player( m_info, _( "You need a powered UPS." ) );
}
return true;
}

bool item::update_charger_gun_ammo()
{
if( !is_charger_gun() ) {
return false;
}
if( ammo_current() != CHARGER_GUN_AMMO_ID ) {
set_curammo( CHARGER_GUN_AMMO_ID );
}
const auto tmpammo = ammo_data()->ammo.get();

long charges = ammo_remaining();
tmpammo->damage = charges * charges;
tmpammo->pierce = ( charges >= 4 ? ( charges - 3 ) * 2.5 : 0 );
if( charges <= 4 ) {
tmpammo->dispersion = 210 - charges * 30;
} else {
tmpammo->dispersion = charges * ( charges - 4 );
tmpammo->dispersion = 15 * charges * ( charges - 4 );
}
tmpammo->recoil = tmpammo->dispersion * .8;
tmpammo->ammo_effects.clear();
if( charges == 8 ) {
tmpammo->ammo_effects.insert( "EXPLOSIVE_BIG" );
} else if( charges >= 7 ) {
tmpammo->ammo_effects.insert( "EXPLOSIVE" );
} else if( charges >= 6 ) {
tmpammo->ammo_effects.insert( "EXPLOSIVE_SMALL" );
}
if( charges >= 5 ) {
tmpammo->ammo_effects.insert( "FLAME" );
} else if( charges >= 4 ) {
tmpammo->ammo_effects.insert( "INCENDIARY" );
}
return true;
}

bool item::process_charger_gun( player *carrier, const tripoint &pos )
{
if( carrier == nullptr || this != &carrier->weapon ) {
// Either on the ground or in the inventory of the player, in both cases:
// stop charging.
deactivate_charger_gun();
return false;
}
if( charges == 8 ) { // Maintaining charge takes less power.
if( carrier->use_charges_if_avail( "UPS", 4 ) ) {
poison++;
} else {
poison--;
}
if( poison >= 3 && one_in( 20 ) ) { // 3 turns leeway, then it may discharge.
//~ %s is weapon name
carrier->add_memorial_log( pgettext( "memorial_male", "Accidental discharge of %s." ),
pgettext( "memorial_female", "Accidental discharge of %s." ),
tname().c_str() );
carrier->add_msg_player_or_npc( m_bad, _( "Your %s discharges!" ), _( "<npcname>'s %s discharges!" ), tname().c_str() );
tripoint target( pos.x + rng( -12, 12 ), pos.y + rng( -12, 12 ), pos.z );
carrier->fire_gun( target );
} else {
carrier->add_msg_player_or_npc( m_warning, _( "Your %s beeps alarmingly." ), _( "<npcname>'s %s beeps alarmingly." ), tname().c_str() );
}
} else { // We're chargin it up!
if( carrier->use_charges_if_avail( "UPS", 1 + charges ) ) {
poison++;
} else {
poison--;
}
if( poison >= charges ) {
charges++;
poison = 0;
}
}
if( poison < 0 ) {
carrier->add_msg_if_player( m_neutral, _( "Your %s spins down." ), tname().c_str() );
charges--;
poison = charges - 1;
}
if( charges <= 0 ) {
active = false;
}
return false;
}

bool item::process( player *carrier, const tripoint &pos, bool activate )
{
const bool preserves = type->container && type->container->preserves;
Expand Down Expand Up @@ -5639,9 +5518,6 @@ bool item::process( player *carrier, const tripoint &pos, bool activate )
if( is_tool() && process_tool( carrier, pos ) ) {
return true;
}
if( is_charger_gun() && process_charger_gun( carrier, pos ) ) {
return true;
}
return false;
}

Expand Down