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 unarmed weapon experience gain #62578

Merged
merged 4 commits into from
Jan 16, 2023
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
6 changes: 0 additions & 6 deletions data/json/flags.json
Original file line number Diff line number Diff line change
Expand Up @@ -935,12 +935,6 @@
"type": "json_flag",
"//": "This gun wont train marksmanship when fired. Used in Aftershock smart guns."
},
{
"id": "UNARMED_WEAPON",
"type": "json_flag",
"//": "Allows wielding with unarmed fighting styles and trains unarmed when used.",
"info": "This weapon <good>can be used with</good> <info>unarmed fighting styles</info>."
},
{
"id": "NANOFAB_REPAIR",
"type": "json_flag",
Expand Down
2 changes: 1 addition & 1 deletion data/json/items/armor/integrated.json
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@
"qualities": [ [ "CUT", 2 ], [ "BUTCHER", 4 ], [ "PRY", 1 ] ],
"environmental_protection": 1,
"techniques": [ "RAPID" ],
"flags": [ "INTEGRATED", "ALLOWS_NATURAL_ATTACKS", "UNARMED_WEAPON", "UNBREAKABLE", "OUTER", "PADDED" ],
"flags": [ "INTEGRATED", "ALLOWS_NATURAL_ATTACKS", "UNBREAKABLE", "OUTER", "PADDED" ],
"armor": [
{
"material": [ { "type": "sclerotin", "covered_by_mat": 100, "thickness": 3.2 } ],
Expand Down
2 changes: 1 addition & 1 deletion data/json/items/generic.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
"description": "seeing this is a bug",
"price": 0,
"volume": "0 ml",
"flags": [ "PSEUDO", "UNARMED_WEAPON" ],
"flags": [ "PSEUDO" ],
"//": "Fist is internally represented as 'wielding a none as a weapon'"
},
{
Expand Down
1 change: 0 additions & 1 deletion data/json/items/melee/unarmed_weapons.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@
"bashing": 4,
"price_postapoc": 50,
"qualities": [ [ "HAMMER", 1 ] ],
"flags": [ "UNARMED_WEAPON" ],
"material_thickness": 1,
"armor": [
{
Expand Down
2 changes: 1 addition & 1 deletion data/json/items/tool/electronics.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
"turns_per_charge": 1,
"use_action": [ "EHANDCUFFS" ],
"//": "Don't add ELECTRONIC flag here, since these handcuffs have their own behavior when affected by EMP blast",
"flags": [ "ALWAYS_TWOHAND", "UNARMED_WEAPON", "TRADER_AVOID", "WATER_BREAK" ]
"flags": [ "ALWAYS_TWOHAND", "TRADER_AVOID", "WATER_BREAK" ]
},
{
"id": "eink_tablet_pc",
Expand Down
6 changes: 6 additions & 0 deletions data/json/obsolete.json
Original file line number Diff line number Diff line change
Expand Up @@ -1069,5 +1069,11 @@
"copy-from": "AID_abstract",
"name": { "str_sp": "Railgun CBM installation data" },
"description": "Precise step-by-step instructions and other required data for installation of Railgun CBM, stored on a data card of proprietary form-factor, designed to be used extensively by an Autodoc, and allowing bionic installation with minimal failure chance. Integrated security subroutine renders it unusable after installation."
},
{
"id": "UNARMED_WEAPON",
"type": "json_flag",
"//": "REMOVE After 0.G.",
"info": "This weapon <good>can be used with</good> <info>unarmed fighting styles</info>."
}
]
11 changes: 6 additions & 5 deletions data/mods/Aftershock/items/weapons.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
},
{
"id": "afs_hydraulic_gauntlet",
"type": "GENERIC",
"type": "ARMOR",
"name": { "str": "hydraulic gauntlet" },
"description": "A huge, heavy metal gauntlet lined with tubing and gauges. Slow and unwieldy, it uses internal pressure to deliver devastating blows, but takes tremendous strength to use effectively. Thanks to an internal microreactor, it doesn't require power of its own.",
"weight": "3778 g",
Expand All @@ -133,8 +133,9 @@
"color": "light_gray",
"bashing": 50,
"to_hit": -2,
"flags": [ "NO_REPAIR", "NONCONDUCTIVE", "SLOW_WIELD", "DURABLE_MELEE", "LEAK_DAM", "UNARMED_WEAPON" ],
"techniques": [ "BRUTAL", "AFS_PRESSURE_CRUNCH" ]
"flags": [ "NO_REPAIR", "NONCONDUCTIVE", "SLOW_WIELD", "DURABLE_MELEE", "LEAK_DAM" ],
"techniques": [ "BRUTAL", "AFS_PRESSURE_CRUNCH" ],
"armor": [ { "encumbrance": 5, "coverage": 100, "covers": [ "hand_r" ] } ]
},
{
"id": "afs_freeze_gauntlet",
Expand All @@ -151,10 +152,10 @@
"color": "light_cyan",
"bashing": 3,
"relic_data": {
"passive_effects": [ { "has": "WIELD", "condition": "ALWAYS", "values": [ { "value": "ITEM_DAMAGE_COLD", "add": 17 } ] } ]
"passive_effects": [ { "has": "WORN", "condition": "ALWAYS", "values": [ { "value": "ITEM_DAMAGE_COLD", "add": 17 } ] } ]
},
"to_hit": 0,
"flags": [ "NO_REPAIR", "NONCONDUCTIVE", "SLOW_WIELD", "DURABLE_MELEE", "UNARMED_WEAPON" ],
"flags": [ "NO_REPAIR", "NONCONDUCTIVE", "SLOW_WIELD", "DURABLE_MELEE" ],
"techniques": [ "WBLOCK_1" ],
"material_thickness": 1,
"armor": [ { "encumbrance": 5, "coverage": 100, "covers": [ "hand_l", "hand_r" ] } ]
Expand Down
5 changes: 3 additions & 2 deletions data/mods/CRT_EXPANSION/items/crt_gun.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
},
{
"id": "crt_fire_glove",
"type": "GUN",
"type": "ARMOR",
"name": "C.R.I.T Fire Glove",
"description": "Experimental CQB weapon system under development in C.R.I.T R&D.",
"weight": "650 g",
Expand Down Expand Up @@ -189,7 +189,8 @@
[ "underbarrel", 1 ]
],
"ammo_effects": [ "STREAM", "INCENDIARY" ],
"flags": [ "NEVER_JAMS", "NO_UNLOAD", "UNARMED_WEAPON", "DURABLE_MELEE", "NON_FOULING" ]
"flags": [ "NEVER_JAMS", "NO_UNLOAD", "DURABLE_MELEE", "NON_FOULING" ],
"armor": [ { "encumbrance": 5, "coverage": 100, "covers": [ "hand_r" ] } ]
},
{
"id": "pelletgun",
Expand Down
16 changes: 12 additions & 4 deletions data/mods/CRT_EXPANSION/items/crt_tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@
"symbol": ";",
"qualities": [ [ "PRY", 1 ], [ "CUT", 2 ], [ "CUT_FINE", 1 ] ],
"use_action": [ "CROWBAR" ],
"flags": [ "SHEATH_KNIFE", "UNARMED_WEAPON", "STAB", "UNBREAKABLE_MELEE" ],
"flags": [ "SHEATH_KNIFE", "STAB", "UNBREAKABLE_MELEE" ],
"techniques": [ "WBLOCK_2", "UHAND", "PROD" ]
},
{
"id": "crt_knuckledusters",
"type": "TOOL",
"type": "ARMOR",
"category": "weapons",
"name": { "str": "pair of C.R.I.T Knuckledusters", "str_pl": "pairs of C.R.I.T Knuckledusters" },
"description": "C.R.I.T CQB knuckledusters. Not too different from any normal pair other than weight.",
Expand All @@ -61,8 +61,16 @@
"bashing": 10,
"to_hit": 1,
"symbol": "8",
"flags": [ "UNARMED_WEAPON", "UNBREAKABLE_MELEE" ],
"techniques": [ "WBLOCK_2", "HOOK" ]
"flags": [ "UNBREAKABLE_MELEE" ],
"techniques": [ "WBLOCK_2", "HOOK" ],
"armor": [
{
"encumbrance": 5,
"coverage": 20,
"covers": [ "hand_l", "hand_r" ],
"specifically_covers": [ "hand_fingers_l", "hand_fingers_r" ]
}
]
},
{
"id": "sword_crt",
Expand Down
18 changes: 11 additions & 7 deletions data/mods/Magiclysm/items/enchanted_unarmed.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"relative": { "to_hit": 2 }
},
{
"type": "GENERIC",
"type": "ARMOR",
"id": "flaming_fist",
"symbol": "3",
"color": "red",
Expand All @@ -31,7 +31,8 @@
"to_hit": 2,
"bashing": 12,
"qualities": [ [ "HAMMER", 1 ] ],
"flags": [ "UNARMED_WEAPON", "DURABLE_MELEE", "NONCONDUCTIVE", "FLAMING" ]
"flags": [ "DURABLE_MELEE", "NONCONDUCTIVE", "FLAMING" ],
"armor": [ { "encumbrance": 5, "coverage": 20, "covers": [ "hand_r" ] } ]
},
{
"type": "GENERIC",
Expand Down Expand Up @@ -65,12 +66,13 @@
"to_hit": 3,
"qualities": [ [ "HAMMER", 2 ] ],
"techniques": [ "WBLOCK_1", "BRUTAL" ],
"flags": [ "UNARMED_WEAPON", "DURABLE_MELEE", "NONCONDUCTIVE", "OVERSIZE", "MESSY" ]
"flags": [ "DURABLE_MELEE", "NONCONDUCTIVE", "OVERSIZE", "MESSY" ],
"armor": [ { "encumbrance": 5, "coverage": 20, "covers": [ "hand_r" ] } ]
},
{
"id": "shotcestus",
"copy-from": "shotgun_base",
"type": "GUN",
"type": "ARMOR",
"name": { "str": "shotcestus", "str_pl": "shotcestuses" },
"description": "A sawn-off double-barrel shotgun mounted on a metal cestus. The lack of a stock to absorb recoil means some strength is required to fire.",
"weight": "1566 g",
Expand All @@ -90,9 +92,10 @@
"reload": 200,
"barrel_volume": "500 ml",
"valid_mod_locations": [ [ "mechanism", 1 ] ],
"flags": [ "UNARMED_WEAPON", "DURABLE_MELEE", "NEVER_JAMS", "RELOAD_EJECT", "RELOAD_ONE" ],
"flags": [ "DURABLE_MELEE", "NEVER_JAMS", "RELOAD_EJECT", "RELOAD_ONE" ],
"faults": [ "fault_gun_blackpowder", "fault_gun_dirt" ],
"pocket_data": [ { "pocket_type": "MAGAZINE", "ammo_restriction": { "shot": 2 } } ]
"pocket_data": [ { "pocket_type": "MAGAZINE", "ammo_restriction": { "shot": 2 } } ],
"armor": [ { "encumbrance": 5, "coverage": 20, "covers": [ "hand_r" ] } ]
},
{
"type": "GENERIC",
Expand All @@ -108,6 +111,7 @@
"to_hit": 1,
"qualities": [ [ "HAMMER", 1 ] ],
"techniques": [ "WBLOCK_1", "BRUTAL" ],
"flags": [ "UNARMED_WEAPON", "DURABLE_MELEE", "TRADER_AVOID", "MAGIC_FOCUS" ]
"flags": [ "DURABLE_MELEE", "TRADER_AVOID", "MAGIC_FOCUS" ],
"armor": [ { "encumbrance": 5, "coverage": 20, "covers": [ "hand_r" ] } ]
}
]
42 changes: 15 additions & 27 deletions data/mods/Magiclysm/items/ethereal_items.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[
{
"id": "stonefist",
"type": "GENERIC",
"type": "ARMOR",
"name": { "str": "pair of magical armored stone gauntlets", "str_pl": "pairs of magical armored stone gauntlets" },
"description": "A magical flexible stonelike substance for protection and attack.",
"weight": "1 g",
Expand All @@ -26,7 +26,7 @@
]
},
"qualities": [ [ "HAMMER", 1 ] ],
"flags": [ "STURDY", "UNARMED_WEAPON", "DURABLE_MELEE", "NONCONDUCTIVE", "MAGIC_FOCUS" ],
"flags": [ "STURDY", "DURABLE_MELEE", "NONCONDUCTIVE", "MAGIC_FOCUS" ],
"techniques": [ "WBLOCK_3" ]
},
{
Expand Down Expand Up @@ -194,16 +194,7 @@
"volume": "155 ml",
"weight": "300 g",
"bashing": 6,
"flags": [
"UNARMED_WEAPON",
"UNBREAKABLE_MELEE",
"NONCONDUCTIVE",
"LIGHT_5",
"TRADER_AVOID",
"NO_REPAIR",
"NO_SALVAGE",
"MAGIC_FOCUS"
],
"flags": [ "UNBREAKABLE_MELEE", "NONCONDUCTIVE", "LIGHT_5", "TRADER_AVOID", "NO_REPAIR", "NO_SALVAGE", "MAGIC_FOCUS" ],
"relic_data": { "passive_effects": [ { "has": "WORN", "values": [ { "value": "ITEM_DAMAGE_ELEC", "add": 20 } ] } ] },
"material_thickness": 1,
"armor": [
Expand Down Expand Up @@ -247,7 +238,6 @@
"WHIP",
"STURDY",
"TRADER_AVOID",
"UNARMED_WEAPON",
"UNBREAKABLE_MELEE",
"NO_REPAIR",
"NO_SALVAGE",
Expand All @@ -273,7 +263,6 @@
"WHIP",
"STURDY",
"TRADER_AVOID",
"UNARMED_WEAPON",
"UNBREAKABLE_MELEE",
"NO_REPAIR",
"NO_SALVAGE",
Expand Down Expand Up @@ -840,7 +829,7 @@
},
{
"id": "subzero_talons",
"type": "GENERIC",
"type": "ARMOR",
"name": { "str_sp": "subzero talons" },
"description": "Claws made from ice, able to freeze on contact while mauling foes. You, however, feel only a slight chill on your hands.",
"weight": "100 g",
Expand All @@ -853,20 +842,19 @@
"color": "light_gray",
"qualities": [ [ "CUT", 2 ], [ "CUT_FINE", 1 ], [ "BUTCHER", 12 ] ],
"weapon_category": [ "CLAWS" ],
"flags": [
"UNARMED_WEAPON",
"UNBREAKABLE_MELEE",
"NONCONDUCTIVE",
"NO_UNWIELD",
"MAGIC_FOCUS",
"TRADER_AVOID",
"NO_REPAIR",
"NO_SALVAGE"
],
"flags": [ "UNBREAKABLE_MELEE", "NONCONDUCTIVE", "NO_UNWIELD", "MAGIC_FOCUS", "TRADER_AVOID", "NO_REPAIR", "NO_SALVAGE" ],
"techniques": [ "WBLOCK_2", "RAPID" ],
"relic_data": {
"passive_effects": [ { "has": "WIELD", "condition": "ALWAYS", "values": [ { "value": "ITEM_DAMAGE_COLD", "add": 6 } ] } ]
}
"passive_effects": [ { "has": "WORN", "condition": "ALWAYS", "values": [ { "value": "ITEM_DAMAGE_COLD", "add": 6 } ] } ]
},
"armor": [
{
"encumbrance": 5,
"coverage": 20,
"covers": [ "hand_l", "hand_r" ],
"specifically_covers": [ "hand_back_l", "hand_back_r" ]
}
]
},
{
"id": "armor_spirit",
Expand Down
2 changes: 1 addition & 1 deletion src/character.h
Original file line number Diff line number Diff line change
Expand Up @@ -1946,7 +1946,7 @@ class Character : public Creature, public visitable
/** How much dispersion does one point of target's dodge add when throwing at said target? */
int throw_dispersion_per_dodge( bool add_encumbrance = true ) const;

/** True if unarmed or wielding a weapon with the UNARMED_WEAPON flag */
/** True if unarmed */
bool unarmed_attack() const;

/// Checks for items, tools, and vehicles with the Lifting quality near the character
Expand Down
1 change: 0 additions & 1 deletion src/flag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,6 @@ const flag_id flag_TRADER_AVOID( "TRADER_AVOID" );
const flag_id flag_TRADER_KEEP( "TRADER_KEEP" );
const flag_id flag_TRADER_KEEP_EQUIPPED( "TRADER_KEEP_EQUIPPED" );
const flag_id flag_TWO_WAY_RADIO( "TWO_WAY_RADIO" );
const flag_id flag_UNARMED_WEAPON( "UNARMED_WEAPON" );
const flag_id flag_UNBREAKABLE( "UNBREAKABLE" );
const flag_id flag_UNBREAKABLE_MELEE( "UNBREAKABLE_MELEE" );
const flag_id flag_UNDERSIZE( "UNDERSIZE" );
Expand Down
1 change: 0 additions & 1 deletion src/flag.h
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,6 @@ extern const flag_id flag_TRADER_AVOID;
extern const flag_id flag_TRADER_KEEP;
extern const flag_id flag_TRADER_KEEP_EQUIPPED;
extern const flag_id flag_TWO_WAY_RADIO;
extern const flag_id flag_UNARMED_WEAPON;
extern const flag_id flag_UNBREAKABLE;
extern const flag_id flag_UNBREAKABLE_MELEE;
extern const flag_id flag_UNDERSIZE;
Expand Down
10 changes: 0 additions & 10 deletions src/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ static const quality_id qual_LIFT( "LIFT" );
static const skill_id skill_cooking( "cooking" );
static const skill_id skill_melee( "melee" );
static const skill_id skill_survival( "survival" );
static const skill_id skill_unarmed( "unarmed" );
static const skill_id skill_weapon( "weapon" );

static const species_id species_ROBOT( "ROBOT" );
Expand Down Expand Up @@ -851,11 +850,6 @@ bool item::is_null() const
return ( type == nullptr || type == nullitem() || typeId().is_null() );
}

bool item::is_unarmed_weapon() const
{
return is_null() || has_flag( flag_UNARMED_WEAPON );
}

bool item::is_frozen_liquid() const
{
return made_of( phase_id::SOLID ) && made_of_from_type( phase_id::LIQUID );
Expand Down Expand Up @@ -10596,10 +10590,6 @@ gun_type_type item::gun_type() const

skill_id item::melee_skill() const
{
if( is_unarmed_weapon() ) {
return skill_unarmed;
}

if( !is_melee() ) {
return skill_id::NULL_ID();
}
Expand Down
2 changes: 0 additions & 2 deletions src/item.h
Original file line number Diff line number Diff line change
Expand Up @@ -1511,8 +1511,6 @@ class item : public visitable
/** Returns true if the item is broken or will be broken on activation */
bool is_broken_on_active() const;

bool is_unarmed_weapon() const; //Returns true if the item should be considered unarmed

bool has_temperature() const;

/** Returns true if the item is A: is SOLID and if it B: is of type LIQUID */
Expand Down
9 changes: 1 addition & 8 deletions src/martialarts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ static const bionic_id bio_armor_arms( "bio_armor_arms" );
static const bionic_id bio_armor_legs( "bio_armor_legs" );
static const bionic_id bio_cqb( "bio_cqb" );

static const flag_id json_flag_UNARMED_WEAPON( "UNARMED_WEAPON" );
static const json_character_flag json_flag_ALWAYS_BLOCK( "ALWAYS_BLOCK" );
static const json_character_flag json_flag_NONSTANDARD_BLOCK( "NONSTANDARD_BLOCK" );

Expand Down Expand Up @@ -620,15 +619,13 @@ bool ma_requirements::is_valid_character( const Character &u ) const
bool melee_style = u.martial_arts_data->selected_strictly_melee();
bool is_armed = u.is_armed();
bool forced_unarmed = u.martial_arts_data->selected_force_unarmed();
bool unarmed_weapon = is_armed && !forced_unarmed && weapon->has_flag( json_flag_UNARMED_WEAPON );
bool weapon_ok = melee_allowed && weapon && is_valid_weapon( *weapon );
bool style_weapon = weapon && u.martial_arts_data->selected_has_weapon( weapon->typeId() );
bool all_weapons = u.martial_arts_data->selected_allow_all_weapons();

bool unarmed_ok = !is_armed || ( unarmed_weapon && unarmed_weapons_allowed );
bool melee_ok = weapon_ok && ( style_weapon || all_weapons );

bool valid_unarmed = !melee_style && unarmed_allowed && unarmed_ok;
bool valid_unarmed = !melee_style && unarmed_allowed && !is_armed;
bool valid_melee = !strictly_unarmed && ( forced_unarmed || melee_ok );

if( !valid_unarmed && !valid_melee ) {
Expand Down Expand Up @@ -1282,10 +1279,6 @@ bool martialart::weapon_valid( const item_location &it ) const
return true;
}

if( !strictly_unarmed && !strictly_melee && it && it->has_flag( json_flag_UNARMED_WEAPON ) ) {
return true;
}

return false;
}

Expand Down
Loading