From 19a6d5abc0ae3c3827a2f00db08ca04a71c48d8e Mon Sep 17 00:00:00 2001 From: Hymore246 Date: Sat, 1 Jan 2022 16:14:24 -0600 Subject: [PATCH 01/18] Added attack vectors to martial arts techniques --- data/json/techniques.json | 12 +++-- src/character_martial_arts.h | 4 ++ src/martialarts.cpp | 43 +++++++++++++++++ src/martialarts.h | 5 ++ src/melee.cpp | 91 ++++++++++++++++++++++++++---------- 5 files changed, 127 insertions(+), 28 deletions(-) diff --git a/data/json/techniques.json b/data/json/techniques.json index bee1c03151071..2c6167d87e4f4 100644 --- a/data/json/techniques.json +++ b/data/json/techniques.json @@ -227,7 +227,8 @@ "disarms": true, "down_dur": 1, "knockback_dist": 1, - "mult_bonuses": [ { "stat": "movecost", "scale": 0.7 } ] + "mult_bonuses": [ { "stat": "movecost", "scale": 0.7 } ], + "attack_vectors": [ "HAND" ] }, { "type": "technique", @@ -297,7 +298,8 @@ "name": "Cross", "messages": [ "You throw a heavy cross at %s", " throws a cross at %s" ], "unarmed_allowed": true, - "mult_bonuses": [ { "stat": "damage", "type": "bash", "scale": 1.2 } ] + "mult_bonuses": [ { "stat": "damage", "type": "bash", "scale": 1.2 } ], + "attack_vectors": [ "HAND", "FOOT" ] }, { "type": "technique", @@ -327,7 +329,8 @@ { "stat": "damage", "type": "bash", "scale": 0.66 }, { "stat": "damage", "type": "cut", "scale": 0.66 }, { "stat": "damage", "type": "stab", "scale": 0.66 } - ] + ], + "attack_vectors": [ "TORSE", "PEI" ] }, { "type": "technique", @@ -338,7 +341,8 @@ "unarmed_allowed": true, "crit_tec": true, "stun_dur": 1, - "mult_bonuses": [ { "stat": "damage", "type": "bash", "scale": 1.4 } ] + "mult_bonuses": [ { "stat": "damage", "type": "bash", "scale": 1.4 } ], + "attack_vectors": [ ] }, { "type": "technique", diff --git a/src/character_martial_arts.h b/src/character_martial_arts.h index 49f790f77817c..15f294eb95fc0 100644 --- a/src/character_martial_arts.h +++ b/src/character_martial_arts.h @@ -78,6 +78,10 @@ class character_martial_arts /** Fires all kill-triggered martial arts events */ void ma_onkill_effects( Character &owner ); + /** Returns an attack vector that the player can use */ + std::string get_valid_attack_vector( const Character &user, std::vector attack_vectors) const; + /** Returns true if the player is able to use the given attack vector */ + bool can_use_attack_vector( const Character &user, std::string av ) const; /** Returns true if the player has the leg block technique available */ bool can_leg_block( const Character &owner ) const; /** Returns true if the player has the arm block technique available */ diff --git a/src/martialarts.cpp b/src/martialarts.cpp index 3909f3b2faff7..20b27c1acc8ea 100644 --- a/src/martialarts.cpp +++ b/src/martialarts.cpp @@ -229,6 +229,9 @@ void ma_technique::load( const JsonObject &jo, const std::string &src ) optional( jo, was_loaded, "aoe", aoe, "" ); optional( jo, was_loaded, "flags", flags, auto_flags_reader<> {} ); + + optional( jo, was_loaded, "attack_vectors", attack_vectors, {} ); + optional( jo, was_loaded, "attack_vectors_random", attack_vectors_random, {} ); reqs.load( jo, src ); bonuses.load( jo ); @@ -1159,6 +1162,46 @@ ma_technique character_martial_arts::get_miss_recovery( const Character &owner ) return get_valid_technique( owner, &ma_technique::miss_recovery ); } + +std::string character_martial_arts::get_valid_attack_vector( const Character &user, std::vector attack_vectors ) const +{ + for( const std::string av : attack_vectors ) { + if( can_use_attack_vector( user, av ) ) { + return av; + } + } + + return "NONE"; +} + +bool character_martial_arts::can_use_attack_vector( const Character &user, std::string av ) const +{ + martialart ma = style_selected.obj(); + bool valid_weapon = ma.weapon_valid( user.get_wielded_item() ); + int arm_r_hp = user.get_part_hp_cur( bodypart_id( "arm_r" ) ); + int arm_l_hp = user.get_part_hp_cur( bodypart_id( "arm_l" ) ); + int leg_r_hp = user.get_part_hp_cur( bodypart_id( "leg_r" ) ); + int leg_l_hp = user.get_part_hp_cur( bodypart_id( "leg_l" ) ); + + if( av == "HEAD" || av == "TORSO" ) { + return true; + } + else if( av == "WEAPON" && valid_weapon && ( arm_r_hp > 0 || arm_l_hp > 0 ) ) { + return true; + } + else if( ( av == "HAND" || av == "ARM" ) && ( arm_r_hp > 0 || arm_l_hp > 0 ) ) { + return true; + } + else if( ( av == "FOOT" || av == "LEG" ) && ( leg_r_hp > 0 && leg_l_hp > 0 ) ) { + return true; + } + else if( ( av == "GRAPPLE" || av == "THROW" ) && ( arm_r_hp > 0 && arm_l_hp > 0 ) ) { + return true; + } + + return false; +} + bool character_martial_arts::can_leg_block( const Character &owner ) const { const martialart &ma = style_selected.obj(); diff --git a/src/martialarts.h b/src/martialarts.h index b4bc0cbc64bd4..34ffd3876a323 100644 --- a/src/martialarts.h +++ b/src/martialarts.h @@ -131,6 +131,11 @@ class ma_technique bool crit_ok = false; ma_requirements reqs; + + // What way is the technique delivered to the target? + + std::vector attack_vectors; // by priority + std::vector attack_vectors_random; // randomly int down_dur = 0; int stun_dur = 0; diff --git a/src/melee.cpp b/src/melee.cpp index 49afa446fdab5..df283438bf373 100644 --- a/src/melee.cpp +++ b/src/melee.cpp @@ -565,25 +565,7 @@ bool Character::melee_attack_abstract( Creature &t, bool allow_special, item *cur_weapon = allow_unarmed ? &used_weapon() : &weapon; - // If no weapon is selected, use highest layer of gloves instead. - bool unarmed_flag_set = false; - if( cur_weapon->is_null() ) { - for( item &worn_item : worn ) { - // Uses enum layer_level to make distinction for top layer. - if( ( worn_item.covers( bodypart_id( "hand_l" ) ) && - worn_item.covers( bodypart_id( "hand_r" ) ) ) ) { - if( cur_weapon->is_null() || ( worn_item.get_layer() >= cur_weapon->get_layer() ) ) { - cur_weapon = &worn_item; - cur_weapon->set_flag( flag_UNARMED_WEAPON ); - unarmed_flag_set = true; - } - - } - } - } - - int move_cost = attack_speed( cur_weapon->has_flag( flag_UNARMED_WEAPON ) ? - null_item_reference() : *cur_weapon ); + int move_cost = attack_speed( *cur_weapon ); if( cur_weapon->attack_time() > move_cost * 20 ) { add_msg( m_bad, _( "This weapon is too unwieldy to attack with!" ) ); @@ -686,8 +668,6 @@ bool Character::melee_attack_abstract( Creature &t, bool allow_special, // select target body part const bodypart_id &target_bp = t.select_body_part( -1, -1, can_attack_high(), hit_spread ); - damage_instance d; - roll_all_damage( critical_hit, d, false, *cur_weapon, &t, target_bp ); const bool has_force_technique = !force_technique.str().empty(); @@ -701,9 +681,64 @@ bool Character::melee_attack_abstract( Creature &t, bool allow_special, technique_id = tec_none; } - // if you have two broken arms you aren't doing any martial arts - // and your hits are not going to hurt very much - if( get_limb_score( limb_score_block, body_part_type::type::arm ) < 1.0f ) { + std::string attack_vector; + + // Failsafe for tec_none + if( technique_id == tec_none ) { + attack_vector = "HANDS"; + } + else { + attack_vector = martial_arts_data->get_valid_attack_vector( *this, technique_id.obj().attack_vectors ); + + if( attack_vector == "NONE" ) { + std::vector shuffled_attack_vectors = technique_id.obj().attack_vectors_random; + std::shuffle( shuffled_attack_vectors.begin(), shuffled_attack_vectors.end(), rng_get_engine() ); + attack_vector = martial_arts_data->get_valid_attack_vector( *this, shuffled_attack_vectors ); + } + } + + // If no weapon is selected, use highest layer of gloves instead. + if( attack_vector != "WEAPON" ) { + for( item &worn_item : worn ) { + bool covers; + + if( attack_vector == "HAND" || attack_vector == "GRAPPLE" || attack_vector == "THROW" ) { + covers = worn_item.covers( bodypart_id( "hand_l" ) ) && + worn_item.covers( bodypart_id( "hand_r" ) ); + } + else if( attack_vector == "ARM" ) { + covers = worn_item.covers( bodypart_id( "arm_l" ) ) && + worn_item.covers( bodypart_id( "arm_r" ) ); + } + else if( attack_vector == "FOOT" ) { + covers = worn_item.covers( bodypart_id( "foot_l" ) ) && + worn_item.covers( bodypart_id( "foot_r" ) ); + } + else if( attack_vector == "LEG" ) { + covers = worn_item.covers( bodypart_id( "leg_l" ) ) && + worn_item.covers( bodypart_id( "leg_r" ) ); + } + else if( attack_vector == "HEAD" ) { + covers = worn_item.covers( bodypart_id( "head" ) ); + } + else if( attack_vector == "TORSO" ) { + covers = worn_item.covers( bodypart_id( "torso" ) ); + } + + // Uses enum layer_level to make distinction for top layer. + if( covers ) { + if( cur_weapon->is_null() || ( worn_item.get_layer() >= cur_weapon->get_layer() ) ) { + cur_weapon = &worn_item; + } + } + } + } + + damage_instance d; + roll_all_damage( critical_hit, d, false, *cur_weapon, &t, target_bp ); + + // your hits are not going to hurt very much if you can't use martial arts due to broken limbs + if( attack_vector == "HANDS" && get_limb_score( limb_score_block, body_part_type::type::arm ) < 1.0f ) { technique_id = tec_none; d.mult_damage( 0.1 ); } @@ -1511,6 +1546,14 @@ matec_id Character::pick_technique( Creature &t, const item &weap, continue; } + // Does the player have a functional attack vector to deliver the technique? + std::vector shuffled_attack_vectors = tec.attack_vectors_random; + std::shuffle( shuffled_attack_vectors.begin(), shuffled_attack_vectors.end(), rng_get_engine() ); + if( martial_arts_data->get_valid_attack_vector( *this, tec.attack_vectors ) == "NONE" && martial_arts_data->get_valid_attack_vector( *this, shuffled_attack_vectors ) == "NONE" ) { + continue; + } + + if( tec.is_valid_character( *this ) ) { possible.push_back( tec.id ); From 0e4b7f8e18298b7d6bf16c748ee54dd7da831de6 Mon Sep 17 00:00:00 2001 From: Hymore246 Date: Mon, 3 Jan 2022 20:48:40 -0600 Subject: [PATCH 02/18] Added new attack vectors --- src/martialarts.cpp | 4 ++-- src/martialarts.h | 3 +-- src/melee.cpp | 24 ++++++++++++++++++++---- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/martialarts.cpp b/src/martialarts.cpp index 20b27c1acc8ea..b80c9380d8eda 100644 --- a/src/martialarts.cpp +++ b/src/martialarts.cpp @@ -1189,10 +1189,10 @@ bool character_martial_arts::can_use_attack_vector( const Character &user, std:: else if( av == "WEAPON" && valid_weapon && ( arm_r_hp > 0 || arm_l_hp > 0 ) ) { return true; } - else if( ( av == "HAND" || av == "ARM" ) && ( arm_r_hp > 0 || arm_l_hp > 0 ) ) { + else if( ( av == "HAND" || av == "ARM" || av == "ELBOW" || av == "SHOULDER" ) && ( arm_r_hp > 0 || arm_l_hp > 0 ) ) { return true; } - else if( ( av == "FOOT" || av == "LEG" ) && ( leg_r_hp > 0 && leg_l_hp > 0 ) ) { + else if( ( av == "FOOT" || av == "LOWER_LEG" || av == "KNEE" || av == "HIP" ) && ( leg_r_hp > 0 && leg_l_hp > 0 ) ) { return true; } else if( ( av == "GRAPPLE" || av == "THROW" ) && ( arm_r_hp > 0 && arm_l_hp > 0 ) ) { diff --git a/src/martialarts.h b/src/martialarts.h index 34ffd3876a323..b749383166de2 100644 --- a/src/martialarts.h +++ b/src/martialarts.h @@ -132,8 +132,7 @@ class ma_technique ma_requirements reqs; - // What way is the technique delivered to the target? - + // What way is the technique delivered to the target? std::vector attack_vectors; // by priority std::vector attack_vectors_random; // randomly diff --git a/src/melee.cpp b/src/melee.cpp index df283438bf373..cb75cab98bd38 100644 --- a/src/melee.cpp +++ b/src/melee.cpp @@ -710,13 +710,29 @@ bool Character::melee_attack_abstract( Creature &t, bool allow_special, covers = worn_item.covers( bodypart_id( "arm_l" ) ) && worn_item.covers( bodypart_id( "arm_r" ) ); } + else if( attack_vector == "ELBOW" ) { + covers = worn_item.covers( bodypart_id( "arm_elbow_l" ) ) && + worn_item.covers( bodypart_id( "arm_elbow_r" ) ); + } + else if( attack_vector == "SHOULDER" ) { + covers = worn_item.covers( bodypart_id( "arm_shoulder_l" ) ) && + worn_item.covers( bodypart_id( "arm_shoulder_r" ) ); + } else if( attack_vector == "FOOT" ) { covers = worn_item.covers( bodypart_id( "foot_l" ) ) && worn_item.covers( bodypart_id( "foot_r" ) ); } - else if( attack_vector == "LEG" ) { - covers = worn_item.covers( bodypart_id( "leg_l" ) ) && - worn_item.covers( bodypart_id( "leg_r" ) ); + else if( attack_vector == "LOWER_LEG" ) { + covers = worn_item.covers( bodypart_id( "leg_lower_l" ) ) && + worn_item.covers( bodypart_id( "leg_lower_r" ) ); + } + else if( attack_vector == "KNEE" ) { + covers = worn_item.covers( bodypart_id( "leg_knee_l" ) ) && + worn_item.covers( bodypart_id( "leg_knee_r" ) ); + } + else if( attack_vector == "HIP" ) { + covers = worn_item.covers( bodypart_id( "leg_hip_l" ) ) && + worn_item.covers( bodypart_id( "leg_hip_r" ) ); } else if( attack_vector == "HEAD" ) { covers = worn_item.covers( bodypart_id( "head" ) ); @@ -735,6 +751,7 @@ bool Character::melee_attack_abstract( Creature &t, bool allow_special, } damage_instance d; + //bool unarmed = attack_vector == "WEAPON"; roll_all_damage( critical_hit, d, false, *cur_weapon, &t, target_bp ); // your hits are not going to hurt very much if you can't use martial arts due to broken limbs @@ -1553,7 +1570,6 @@ matec_id Character::pick_technique( Creature &t, const item &weap, continue; } - if( tec.is_valid_character( *this ) ) { possible.push_back( tec.id ); From b60c284206028e8994b5874276e8f1df2b2ff463 Mon Sep 17 00:00:00 2001 From: Hymore246 Date: Tue, 4 Jan 2022 18:35:55 -0600 Subject: [PATCH 03/18] Updated damage formulas with unarmed variable --- data/json/techniques.json | 15 ++++++++++----- src/character.h | 10 +++++----- src/item.cpp | 8 ++++---- src/melee.cpp | 31 ++++++++++++------------------- 4 files changed, 31 insertions(+), 33 deletions(-) diff --git a/data/json/techniques.json b/data/json/techniques.json index 2c6167d87e4f4..d68c972f88294 100644 --- a/data/json/techniques.json +++ b/data/json/techniques.json @@ -872,7 +872,8 @@ { "stat": "damage", "type": "bash", "scale": 1.4 }, { "stat": "damage", "type": "cut", "scale": 1.4 }, { "stat": "damage", "type": "stab", "scale": 1.4 } - ] + ], + "attack_vectors": [ "HAND" ] }, { "type": "technique", @@ -886,7 +887,8 @@ { "stat": "damage", "type": "bash", "scale": 0.66 }, { "stat": "damage", "type": "cut", "scale": 0.66 }, { "stat": "damage", "type": "stab", "scale": 0.66 } - ] + ], + "attack_vectors": [ "HAND" ] }, { "type": "technique", @@ -898,7 +900,8 @@ { "stat": "damage", "type": "bash", "scale": 1.2 }, { "stat": "damage", "type": "cut", "scale": 1.2 }, { "stat": "damage", "type": "stab", "scale": 1.2 } - ] + ], + "attack_vectors": [ "FOOT" ] }, { "type": "technique", @@ -907,7 +910,8 @@ "messages": [ "You strike %s with your staff", " strikes %s with your staff" ], "skill_requirements": [ { "name": "melee", "level": 3 } ], "melee_allowed": true, - "mult_bonuses": [ { "stat": "movecost", "scale": 0.9 } ] + "mult_bonuses": [ { "stat": "movecost", "scale": 0.9 } ], + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -922,7 +926,8 @@ { "stat": "damage", "type": "bash", "scale": 1.1 }, { "stat": "damage", "type": "cut", "scale": 1.1 }, { "stat": "damage", "type": "stab", "scale": 1.1 } - ] + ], + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", diff --git a/src/character.h b/src/character.h index 6c27f388219cd..259d0a8c4cc8a 100644 --- a/src/character.h +++ b/src/character.h @@ -953,19 +953,19 @@ class Character : public Creature, public visitable // If average == true, adds expected values of random rolls instead of rolling. /** Adds all 3 types of physical damage to instance */ - void roll_all_damage( bool crit, damage_instance &di, bool average, const item &weap, + void roll_all_damage( bool crit, damage_instance &di, bool average, const item &weap, bool unarmed, const Creature *target, const bodypart_id &bp ) const; /** Adds player's total bash damage to the damage instance */ - void roll_bash_damage( bool crit, damage_instance &di, bool average, const item &weap, + void roll_bash_damage( bool crit, damage_instance &di, bool average, const item &weap, bool unarmed, float crit_mod ) const; /** Adds player's total cut damage to the damage instance */ - void roll_cut_damage( bool crit, damage_instance &di, bool average, const item &weap, + void roll_cut_damage( bool crit, damage_instance &di, bool average, const item &weap, bool unarmed, float crit_mod ) const; /** Adds player's total stab damage to the damage instance */ - void roll_stab_damage( bool crit, damage_instance &di, bool average, const item &weap, + void roll_stab_damage( bool crit, damage_instance &di, bool average, const item &weap, bool unarmed, float crit_mod ) const; /** Adds player's total non-bash, non-cut, non-stab damage to the damage instance */ - void roll_other_damage( bool crit, damage_instance &di, bool average, const item &weap, + void roll_other_damage( bool crit, damage_instance &di, bool average, const item &weap, bool unarmed, float crit_mod ) const; /** Returns true if the player should be dead */ diff --git a/src/item.cpp b/src/item.cpp index 2877b5fb68f65..91b21490eb667 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -1832,7 +1832,7 @@ double item::effective_dps( const Character &guy, Creature &mon ) const Creature *temp_mon = &mon; double subtotal_damage = 0; damage_instance base_damage; - guy.roll_all_damage( crit, base_damage, true, *this, &mon, bp ); + guy.roll_all_damage( crit, base_damage, true, *this, false, &mon, bp ); damage_instance dealt_damage = base_damage; // TODO: Modify DPS calculation to consider weakpoints. resistances r = resistances( *static_cast( temp_mon ) ); @@ -1857,7 +1857,7 @@ double item::effective_dps( const Character &guy, Creature &mon ) const if( has_technique( RAPID ) ) { Creature *temp_rs_mon = &mon; damage_instance rs_base_damage; - guy.roll_all_damage( crit, rs_base_damage, true, *this, &mon, bp ); + guy.roll_all_damage( crit, rs_base_damage, true, *this, false, &mon, bp ); damage_instance dealt_rs_damage = rs_base_damage; for( damage_unit &dmg_unit : dealt_rs_damage.damage_units ) { dmg_unit.damage_multiplier *= 0.66; @@ -4487,9 +4487,9 @@ void item::combat_info( std::vector &info, const iteminfo_query *parts ( dmg_bash || dmg_cut || dmg_stab || type->m_to_hit > 0 ) ) || debug_mode ) { bodypart_id bp = bodypart_id( "torso" ); damage_instance non_crit; - player_character.roll_all_damage( false, non_crit, true, *this, nullptr, bp ); + player_character.roll_all_damage( false, non_crit, true, *this, false, nullptr, bp ); damage_instance crit; - player_character.roll_all_damage( true, crit, true, *this, nullptr, bp ); + player_character.roll_all_damage( true, crit, true, *this, false, nullptr, bp ); int attack_cost = player_character.attack_speed( *this ); insert_separation_line( info ); if( parts->test( iteminfo_parts::DESCRIPTION_MELEEDMG ) ) { diff --git a/src/melee.cpp b/src/melee.cpp index cb75cab98bd38..aa1ccac3948bf 100644 --- a/src/melee.cpp +++ b/src/melee.cpp @@ -400,16 +400,16 @@ std::string Character::get_miss_reason() } void Character::roll_all_damage( bool crit, damage_instance &di, bool average, - const item &weap, const Creature *target, const bodypart_id &bp ) const + const item &weap, bool unarmed, const Creature *target, const bodypart_id &bp ) const { float crit_mod = 1.f; if( target != nullptr ) { crit_mod = target->get_crit_factor( bp ); } - roll_bash_damage( crit, di, average, weap, crit_mod ); - roll_cut_damage( crit, di, average, weap, crit_mod ); - roll_stab_damage( crit, di, average, weap, crit_mod ); - roll_other_damage( crit, di, average, weap, crit_mod ); + roll_bash_damage( crit, di, average, weap, unarmed, crit_mod ); + roll_cut_damage( crit, di, average, weap, unarmed, crit_mod ); + roll_stab_damage( crit, di, average, weap, unarmed, crit_mod ); + roll_other_damage( crit, di, average, weap, unarmed, crit_mod ); } static void melee_train( Character &you, int lo, int hi, const item &weap ) @@ -751,8 +751,8 @@ bool Character::melee_attack_abstract( Creature &t, bool allow_special, } damage_instance d; - //bool unarmed = attack_vector == "WEAPON"; - roll_all_damage( critical_hit, d, false, *cur_weapon, &t, target_bp ); + bool unarmed = attack_vector == "WEAPON"; + roll_all_damage( critical_hit, d, false, *cur_weapon, unarmed, &t, target_bp ); // your hits are not going to hurt very much if you can't use martial arts due to broken limbs if( attack_vector == "HANDS" && get_limb_score( limb_score_block, body_part_type::type::arm ) < 1.0f ) { @@ -891,10 +891,6 @@ bool Character::melee_attack_abstract( Creature &t, bool allow_special, } } - if( unarmed_flag_set ) { - cur_weapon->unset_flag( flag_UNARMED_WEAPON ); - } - if( !t.is_hallucination() ) { handle_melee_wear( *cur_weapon ); } @@ -1186,11 +1182,10 @@ float Character::bonus_damage( bool random ) const } void Character::roll_bash_damage( bool crit, damage_instance &di, bool average, - const item &weap, float crit_mod ) const + const item &weap, bool unarmed, float crit_mod ) const { float bash_dam = 0.0f; - - const bool unarmed = weap.is_unarmed_weapon(); + int skill = get_skill_level( unarmed ? skill_unarmed : skill_bashing ); if( has_active_bionic( bio_cqb ) ) { skill = BIO_CQB_LEVEL; @@ -1300,12 +1295,11 @@ void Character::roll_bash_damage( bool crit, damage_instance &di, bool average, } void Character::roll_cut_damage( bool crit, damage_instance &di, bool average, - const item &weap, float crit_mod ) const + const item &weap, bool unarmed, float crit_mod ) const { float cut_dam = mabuff_damage_bonus( damage_type::CUT ) + weap.damage_melee( damage_type::CUT ); float cut_mul = 1.0f; - const bool unarmed = weap.is_unarmed_weapon(); int skill = get_skill_level( unarmed ? skill_unarmed : skill_cutting ); if( has_active_bionic( bio_cqb ) ) { @@ -1375,11 +1369,10 @@ void Character::roll_cut_damage( bool crit, damage_instance &di, bool average, } void Character::roll_stab_damage( bool crit, damage_instance &di, bool /*average*/, - const item &weap, float crit_mod ) const + const item &weap, bool unarmed, float crit_mod ) const { float cut_dam = mabuff_damage_bonus( damage_type::STAB ) + weap.damage_melee( damage_type::STAB ); - const bool unarmed = weap.is_unarmed_weapon(); int skill = get_skill_level( unarmed ? skill_unarmed : skill_stabbing ); if( has_active_bionic( bio_cqb ) ) { @@ -1440,7 +1433,7 @@ void Character::roll_stab_damage( bool crit, damage_instance &di, bool /*average } void Character::roll_other_damage( bool /*crit*/, damage_instance &di, bool /*average*/, - const item &weap, float /*crit_mod*/ ) const + const item &weap, bool unarmed, float /*crit_mod*/ ) const { std::map dt_map = get_dt_map(); From b61c90b0eda69909d1c84865b19cca1f01693852 Mon Sep 17 00:00:00 2001 From: Hymore246 Date: Fri, 7 Jan 2022 18:41:34 -0600 Subject: [PATCH 04/18] Added attack vectors to techniques.json --- data/json/techniques.json | 334 ++++++++++++++++++++++------------ data/mods/MMA/techniques.json | 90 ++++++--- 2 files changed, 280 insertions(+), 144 deletions(-) diff --git a/data/json/techniques.json b/data/json/techniques.json index d68c972f88294..12ff05bdb3495 100644 --- a/data/json/techniques.json +++ b/data/json/techniques.json @@ -38,7 +38,8 @@ "name": "disarm", "melee_allowed": true, "disarms": true, - "description": "Unwield target's weapon" + "description": "Unwield target's weapon", + "attack_vectors": [ "HAND" ] }, { "type": "technique", @@ -56,7 +57,8 @@ "crit_tec": true, "messages": [ "You swing through %s and everyone nearby", " swings through %s and everyone nearby" ], "aoe": "spin", - "description": "Attack adjacent enemies, crit only, min 4 melee" + "description": "Attack adjacent enemies, crit only, min 4 melee", + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -68,7 +70,8 @@ "weighting": 2, "messages": [ "You swing in a wide arc through %s", " swings in a wide arc through %s" ], "aoe": "wide", - "description": "Attack in a wide arc, crit only, min 3 melee" + "description": "Attack in a wide arc, crit only, min 3 melee", + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -79,7 +82,8 @@ "crit_tec": true, "messages": [ "You pierce straight through %s", " pierces through %s" ], "aoe": "impale", - "description": "Attack target and another one behind it, crit only, min 4 melee" + "description": "Attack target and another one behind it, crit only, min 4 melee", + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -90,7 +94,8 @@ "stun_dur": 1, "knockback_dist": 1, "messages": [ "You send %s reeling", " sends %s reeling" ], - "description": "Stun 1 turn, knockback 1 tile, crit only" + "description": "Stun 1 turn, knockback 1 tile, crit only", + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -104,7 +109,8 @@ { "stat": "damage", "type": "stab", "scale": 0.66 } ], "messages": [ "You quickly strike %s", " quickly strikes %s" ], - "description": "50% moves, 66% damage" + "description": "50% moves, 66% damage", + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -118,7 +124,8 @@ "Snicker-snack! You slice through %s like hot knife slices through butter.", "Snicker-snack! slices through %s like hot knife slices through butter." ], - "description": "Cut damage multiply by 99, crit only" + "description": "Cut damage multiply by 99, crit only", + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -127,7 +134,8 @@ "melee_allowed": true, "stun_dur": 2, "messages": [ "You wrap up %s", " wraps up %s" ], - "description": "Stun 2 turns" + "description": "Stun 2 turns", + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -136,7 +144,8 @@ "melee_allowed": true, "down_dur": 2, "messages": [ "You sweep %s", " sweeps %s" ], - "description": "Down 2 turns" + "description": "Down 2 turns", + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -146,7 +155,8 @@ "crit_tec": true, "messages": [ "You precisely hit %s", " precisely hits %s" ], "stun_dur": 2, - "description": "Stun 2 turns, crit only" + "description": "Stun 2 turns, crit only", + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -155,7 +165,8 @@ "melee_allowed": true, "disarms": true, "messages": [ "You disarm %s using your whip", " disarms %s using their whip" ], - "description": "Unwield target's weapon" + "description": "Unwield target's weapon", + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -182,7 +193,8 @@ "melee_allowed": true, "crit_tec": true, "messages": [ "You jab deftly at %s", " jabs deftly at %s" ], - "stun_dur": 2 + "stun_dur": 2, + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -197,7 +209,8 @@ "crit_ok": true, "down_dur": 1, "knockback_dist": 1, - "mult_bonuses": [ { "stat": "movecost", "scale": 0.7 } ] + "mult_bonuses": [ { "stat": "movecost", "scale": 0.7 } ], + "attack_vectors": [ "THROW" ] }, { "type": "technique", @@ -211,7 +224,8 @@ "crit_ok": true, "down_dur": 1, "knockback_dist": 1, - "mult_bonuses": [ { "stat": "movecost", "scale": 0.7 } ] + "mult_bonuses": [ { "stat": "movecost", "scale": 0.7 } ], + "attack_vectors": [ "THROW" ] }, { "type": "technique", @@ -228,7 +242,7 @@ "down_dur": 1, "knockback_dist": 1, "mult_bonuses": [ { "stat": "movecost", "scale": 0.7 } ], - "attack_vectors": [ "HAND" ] + "attack_vectors": [ "THROW" ] }, { "type": "technique", @@ -244,7 +258,8 @@ "disarms": true, "down_dur": 1, "knockback_dist": 1, - "mult_bonuses": [ { "stat": "movecost", "scale": 0.7 } ] + "mult_bonuses": [ { "stat": "movecost", "scale": 0.7 } ], + "attack_vectors": [ "THROW" ] }, { "type": "technique", @@ -275,7 +290,8 @@ { "stat": "damage", "type": "cut", "scale": 1.1 }, { "stat": "damage", "type": "stab", "scale": 1.1 }, { "stat": "movecost", "scale": 1.2 } - ] + ], + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -290,7 +306,8 @@ { "stat": "damage", "type": "bash", "scale": 0.66 }, { "stat": "damage", "type": "cut", "scale": 0.66 }, { "stat": "damage", "type": "stab", "scale": 0.66 } - ] + ], + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -299,7 +316,7 @@ "messages": [ "You throw a heavy cross at %s", " throws a cross at %s" ], "unarmed_allowed": true, "mult_bonuses": [ { "stat": "damage", "type": "bash", "scale": 1.2 } ], - "attack_vectors": [ "HAND", "FOOT" ] + "attack_vectors": [ "HAND" ] }, { "type": "technique", @@ -315,7 +332,8 @@ "knockback_spread": 1, "stun_dur": 1, "down_dur": 1, - "mult_bonuses": [ { "stat": "damage", "type": "bash", "scale": 1.5 } ] + "mult_bonuses": [ { "stat": "damage", "type": "bash", "scale": 1.5 } ], + "attack_vectors": [ "HAND" ] }, { "type": "technique", @@ -330,7 +348,7 @@ { "stat": "damage", "type": "cut", "scale": 0.66 }, { "stat": "damage", "type": "stab", "scale": 0.66 } ], - "attack_vectors": [ "TORSE", "PEI" ] + "attack_vectors": [ "HAND" ] }, { "type": "technique", @@ -342,7 +360,7 @@ "crit_tec": true, "stun_dur": 1, "mult_bonuses": [ { "stat": "damage", "type": "bash", "scale": 1.4 } ], - "attack_vectors": [ ] + "attack_vectors": [ "HAND" ] }, { "type": "technique", @@ -391,7 +409,8 @@ "messages": [ "You knock %s's weapon away", " knock %s's weapon away" ], "skill_requirements": [ { "name": "melee", "level": 6 } ], "melee_allowed": true, - "disarms": true + "disarms": true, + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -400,7 +419,8 @@ "messages": [ "You knock %s's weapon away", " knock %s's weapon away" ], "skill_requirements": [ { "name": "unarmed", "level": 6 } ], "unarmed_allowed": true, - "disarms": true + "disarms": true, + "attack_vectors": [ "HAND" ] }, { "type": "technique", @@ -411,7 +431,8 @@ "unarmed_allowed": true, "crit_tec": true, "knockback_dist": 1, - "stun_dur": 1 + "stun_dur": 1, + "attack_vectors": [ "HAND" ] }, { "type": "technique", @@ -420,7 +441,8 @@ "messages": [ "You trip %s", " trip %s" ], "skill_requirements": [ { "name": "unarmed", "level": 5 } ], "unarmed_allowed": true, - "down_dur": 1 + "down_dur": 1, + "attack_vectors": [ "HAND" ] }, { "type": "technique", @@ -442,7 +464,8 @@ { "stat": "damage", "type": "bash", "scale": 1.2 }, { "stat": "damage", "type": "cut", "scale": 1.2 }, { "stat": "damage", "type": "stab", "scale": 1.2 } - ] + ], + "attack_vectors": [ "FOOT" ] }, { "type": "technique", @@ -456,7 +479,8 @@ { "stat": "damage", "type": "bash", "scale": 1.4 }, { "stat": "damage", "type": "cut", "scale": 1.4 }, { "stat": "damage", "type": "stab", "scale": 1.4 } - ] + ], + "attack_vectors": [ "FOOT" ] }, { "type": "technique", @@ -473,7 +497,8 @@ { "stat": "damage", "type": "bash", "scale": 1.2 }, { "stat": "damage", "type": "cut", "scale": 1.2 }, { "stat": "damage", "type": "stab", "scale": 1.2 } - ] + ], + "attack_vectors": [ "FOOT" ] }, { "type": "technique", @@ -491,7 +516,8 @@ { "stat": "damage", "type": "bash", "scale": 1.4 }, { "stat": "damage", "type": "cut", "scale": 1.4 }, { "stat": "damage", "type": "stab", "scale": 1.4 } - ] + ], + "attack_vectors": [ "FOOT" ] }, { "type": "technique", @@ -516,7 +542,8 @@ { "stat": "damage", "type": "bash", "scale": 1.25 }, { "stat": "damage", "type": "cut", "scale": 1.25 }, { "stat": "damage", "type": "stab", "scale": 1.25 } - ] + ], + "attack_vectors": [ "FOOT" ] }, { "type": "technique", @@ -545,7 +572,8 @@ { "stat": "damage", "type": "bash", "scale": 1.5 }, { "stat": "damage", "type": "cut", "scale": 1.5 }, { "stat": "damage", "type": "stab", "scale": 1.5 } - ] + ], + "attack_vectors": [ "HAND" ] }, { "type": "technique", @@ -553,7 +581,8 @@ "name": "Dragon Claw", "unarmed_allowed": true, "mult_bonuses": [ { "stat": "damage", "type": "bash", "scale": 1.2 } ], - "messages": [ "You lash out at %s with a Dragon Claw", " lashes out at %s with a Dragon Claw" ] + "messages": [ "You lash out at %s with a Dragon Claw", " lashes out at %s with a Dragon Claw" ], + "attack_vectors": [ "HAND" ] }, { "type": "technique", @@ -568,7 +597,8 @@ { "stat": "damage", "type": "bash", "scale": 1.4 }, { "stat": "damage", "type": "cut", "scale": 1.4 }, { "stat": "damage", "type": "stab", "scale": 1.4 } - ] + ], + "attack_vectors": [ "FOOT" ] }, { "type": "technique", @@ -584,7 +614,8 @@ { "stat": "damage", "type": "bash", "scale": 1.5 }, { "stat": "damage", "type": "cut", "scale": 1.5 }, { "stat": "damage", "type": "stab", "scale": 1.5 } - ] + ], + "attack_vectors": [ "HAND" ] }, { "type": "technique", @@ -593,7 +624,8 @@ "messages": [ "You round strike %s", " round strikes %s" ], "skill_requirements": [ { "name": "melee", "level": 4 } ], "melee_allowed": true, - "mult_bonuses": [ { "stat": "movecost", "scale": 0.6 } ] + "mult_bonuses": [ { "stat": "movecost", "scale": 0.6 } ], + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -602,7 +634,8 @@ "messages": [ "You fan strike %s", " fan strikes %s" ], "skill_requirements": [ { "name": "melee", "level": 2 } ], "melee_allowed": true, - "mult_bonuses": [ { "stat": "movecost", "scale": 0.75 } ] + "mult_bonuses": [ { "stat": "movecost", "scale": 0.75 } ], + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -610,7 +643,8 @@ "name": "Snap Strike", "messages": [ "You snap out at %s", " snaps quickly at %s" ], "melee_allowed": true, - "mult_bonuses": [ { "stat": "movecost", "scale": 0.8 } ] + "mult_bonuses": [ { "stat": "movecost", "scale": 0.8 } ], + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -626,7 +660,8 @@ { "stat": "damage", "type": "bash", "scale": 1.5 }, { "stat": "damage", "type": "cut", "scale": 1.5 }, { "stat": "damage", "type": "stab", "scale": 1.5 } - ] + ], + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -637,7 +672,8 @@ "melee_allowed": true, "crit_tec": true, "stun_dur": 1, - "mult_bonuses": [ { "stat": "movecost", "scale": 0.8 } ] + "mult_bonuses": [ { "stat": "movecost", "scale": 0.8 } ], + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -647,7 +683,8 @@ "skill_requirements": [ { "name": "melee", "level": 4 } ], "melee_allowed": true, "crit_tec": true, - "down_dur": 1 + "down_dur": 1, + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -667,7 +704,8 @@ "skill_requirements": [ { "name": "melee", "level": 2 } ], "melee_allowed": true, "crit_ok": true, - "mult_bonuses": [ { "stat": "movecost", "scale": 0.8 } ] + "mult_bonuses": [ { "stat": "movecost", "scale": 0.8 } ], + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -683,7 +721,8 @@ { "stat": "damage", "type": "bash", "scale": 1.25 }, { "stat": "damage", "type": "cut", "scale": 1.25 }, { "stat": "damage", "type": "stab", "scale": 1.25 } - ] + ], + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -699,7 +738,8 @@ { "stat": "damage", "type": "bash", "scale": 1.25 }, { "stat": "damage", "type": "cut", "scale": 1.25 }, { "stat": "damage", "type": "stab", "scale": 1.25 } - ] + ], + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -717,7 +757,8 @@ { "stat": "damage", "type": "bash", "scale": 1.2 }, { "stat": "damage", "type": "cut", "scale": 1.2 }, { "stat": "damage", "type": "stab", "scale": 1.2 } - ] + ], + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -735,7 +776,8 @@ { "stat": "damage", "type": "bash", "scale": 0.5 }, { "stat": "damage", "type": "cut", "scale": 0.5 }, { "stat": "damage", "type": "stab", "scale": 0.5 } - ] + ], + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -749,7 +791,8 @@ { "stat": "damage", "type": "bash", "scale": 1.1 }, { "stat": "damage", "type": "cut", "scale": 1.1 }, { "stat": "damage", "type": "stab", "scale": 1.1 } - ] + ], + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -787,7 +830,8 @@ { "stat": "damage", "type": "bash", "scale": 0.5 }, { "stat": "damage", "type": "cut", "scale": 0.5 }, { "stat": "damage", "type": "stab", "scale": 0.5 } - ] + ], + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -803,7 +847,8 @@ { "stat": "damage", "type": "bash", "scale": 1.5 }, { "stat": "damage", "type": "cut", "scale": 1.5 }, { "stat": "damage", "type": "stab", "scale": 1.5 } - ] + ], + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -815,7 +860,8 @@ "unarmed_weapons_allowed": false, "crit_ok": true, "down_dur": 1, - "mult_bonuses": [ { "stat": "damage", "type": "bash", "scale": 1.25 } ] + "mult_bonuses": [ { "stat": "damage", "type": "bash", "scale": 1.25 } ], + "attack_vectors": [ "THROW" ] }, { "type": "technique", @@ -828,7 +874,8 @@ "unarmed_weapons_allowed": false, "disarms": true, "down_dur": 1, - "mult_bonuses": [ { "stat": "damage", "type": "bash", "scale": 1.25 } ] + "mult_bonuses": [ { "stat": "damage", "type": "bash", "scale": 1.25 } ], + "attack_vectors": [ "THROW" ] }, { "type": "technique", @@ -843,7 +890,8 @@ "side_switch": true, "down_dur": 1, "stun_dur": 1, - "mult_bonuses": [ { "stat": "damage", "type": "bash", "scale": 1.5 } ] + "mult_bonuses": [ { "stat": "damage", "type": "bash", "scale": 1.5 } ], + "attack_vectors": [ "THROW" ] }, { "type": "technique", @@ -873,7 +921,7 @@ { "stat": "damage", "type": "cut", "scale": 1.4 }, { "stat": "damage", "type": "stab", "scale": 1.4 } ], - "attack_vectors": [ "HAND" ] + "attack_vectors": [ "HAND" ] }, { "type": "technique", @@ -888,7 +936,7 @@ { "stat": "damage", "type": "cut", "scale": 0.66 }, { "stat": "damage", "type": "stab", "scale": 0.66 } ], - "attack_vectors": [ "HAND" ] + "attack_vectors": [ "HAND" ] }, { "type": "technique", @@ -901,7 +949,7 @@ { "stat": "damage", "type": "cut", "scale": 1.2 }, { "stat": "damage", "type": "stab", "scale": 1.2 } ], - "attack_vectors": [ "FOOT" ] + "attack_vectors": [ "FOOT" ] }, { "type": "technique", @@ -911,7 +959,7 @@ "skill_requirements": [ { "name": "melee", "level": 3 } ], "melee_allowed": true, "mult_bonuses": [ { "stat": "movecost", "scale": 0.9 } ], - "attack_vectors": [ "WEAPON" ] + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -927,7 +975,7 @@ { "stat": "damage", "type": "cut", "scale": 1.1 }, { "stat": "damage", "type": "stab", "scale": 1.1 } ], - "attack_vectors": [ "WEAPON" ] + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -942,7 +990,8 @@ { "stat": "damage", "type": "bash", "scale": 0.66 }, { "stat": "damage", "type": "cut", "scale": 0.66 }, { "stat": "damage", "type": "stab", "scale": 0.66 } - ] + ], + "attack_vectors": [ "WEAPON", "HAND" ] }, { "type": "technique", @@ -953,7 +1002,9 @@ "melee_allowed": true, "unarmed_allowed": true, "crit_tec": true, - "stun_dur": 1 + "stun_dur": 1, + "attack_vectors": [ "WEAPON" ], + "attack_vectors_random": [ "HAND", "FOOT", "ELBOW", "KNEE", "LOWER_LEG" ] }, { "type": "technique", @@ -964,7 +1015,8 @@ "melee_allowed": true, "unarmed_allowed": true, "crit_ok": true, - "down_dur": 1 + "down_dur": 1, + "attack_vectors": [ "THROW" ] }, { "type": "technique", @@ -980,7 +1032,8 @@ "human_target": true, "stun_dur": 1, "flat_bonuses": [ { "stat": "arpen", "type": "bash", "scaling-stat": "str", "scale": 1.0 } ], - "mult_bonuses": [ { "stat": "damage", "type": "bash", "scale": 2.0 } ] + "mult_bonuses": [ { "stat": "damage", "type": "bash", "scale": 2.0 } ], + "attack_vectors": [ "GRAPPLE" ] }, { "type": "technique", @@ -1012,7 +1065,8 @@ "unarmed_allowed": true, "crit_tec": true, "stun_dur": 1, - "mult_bonuses": [ { "stat": "movecost", "scale": 0.5 } ] + "mult_bonuses": [ { "stat": "movecost", "scale": 0.5 } ], + "attack_vectors": [ "HAND" ] }, { "type": "technique", @@ -1025,16 +1079,18 @@ { "stat": "damage", "type": "bash", "scale": 0.66 }, { "stat": "damage", "type": "cut", "scale": 0.66 }, { "stat": "damage", "type": "stab", "scale": 0.66 } - ] + ], + "attack_vectors": [ "HAND" ] }, { "type": "technique", "id": "tec_leopard_claw", - "name": "Leopard Swipe", + "name": "Leopard Claw", "messages": [ "You savagely claw at %s", " savagely claws at %s" ], "unarmed_allowed": true, "crit_tec": true, - "mult_bonuses": [ { "stat": "movecost", "scale": 0.8 }, { "stat": "damage", "type": "bash", "scale": 1.3 } ] + "mult_bonuses": [ { "stat": "movecost", "scale": 0.8 }, { "stat": "damage", "type": "bash", "scale": 1.3 } ], + "attack_vectors": [ "HAND" ] }, { "type": "technique", @@ -1045,7 +1101,8 @@ "required_buffs_all": [ "buff_leopard_oncrit" ], "crit_tec": true, "down_dur": 1, - "mult_bonuses": [ { "stat": "movecost", "scale": 0.8 }, { "stat": "damage", "type": "bash", "scale": 2.0 } ] + "mult_bonuses": [ { "stat": "movecost", "scale": 0.8 }, { "stat": "damage", "type": "bash", "scale": 2.0 } ], + "attack_vectors": [ "HAND" ] }, { "type": "technique", @@ -1061,7 +1118,8 @@ { "stat": "damage", "type": "stab", "scale": 0.33 } ], "crit_tec": true, - "down_dur": 2 + "down_dur": 2, + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -1077,7 +1135,8 @@ { "stat": "arpen", "type": "cut", "scaling-stat": "str", "scale": 1.5 }, { "stat": "arpen", "type": "stab", "scaling-stat": "str", "scale": 1.5 } ], - "mult_bonuses": [ { "stat": "damage", "type": "bash", "scale": 0 } ] + "mult_bonuses": [ { "stat": "damage", "type": "bash", "scale": 0 } ], + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -1100,7 +1159,8 @@ "skill_requirements": [ { "name": "unarmed", "level": 1 } ], "unarmed_allowed": true, "crit_tec": true, - "mult_bonuses": [ { "stat": "movecost", "scale": 0.5 } ] + "mult_bonuses": [ { "stat": "movecost", "scale": 0.5 } ], + "attack_vectors": [ "ELBOW" ] }, { "type": "technique", @@ -1113,7 +1173,8 @@ { "stat": "damage", "type": "bash", "scale": 1.3 }, { "stat": "damage", "type": "cut", "scale": 1.3 }, { "stat": "damage", "type": "stab", "scale": 1.3 } - ] + ], + "attack_vectors_random": [ "LOWER_LEG", "FOOT" ] }, { "type": "technique", @@ -1124,7 +1185,8 @@ "unarmed_allowed": true, "crit_tec": true, "stun_dur": 1, - "mult_bonuses": [ { "stat": "damage", "type": "bash", "scale": 1.4 } ] + "mult_bonuses": [ { "stat": "damage", "type": "bash", "scale": 1.4 } ], + "attack_vectors": [ "KNEE" ] }, { "type": "technique", @@ -1145,7 +1207,9 @@ "skill_requirements": [ { "name": "melee", "level": 2 } ], "unarmed_allowed": true, "melee_allowed": true, - "mult_bonuses": [ { "stat": "movecost", "scale": 0.8 } ] + "mult_bonuses": [ { "stat": "movecost", "scale": 0.8 } ], + "attack_vectors": [ "WEAPON" ], + "attack_vectors_random": [ "HAND", "ELBOW", "LOWER_LEG", "FOOT" ] }, { "type": "technique", @@ -1157,7 +1221,9 @@ "melee_allowed": true, "required_buffs_all": [ "buff_ninjutsu_onattack" ], "crit_tec": true, - "mult_bonuses": [ { "stat": "movecost", "scale": 0.8 } ] + "mult_bonuses": [ { "stat": "movecost", "scale": 0.8 } ], + "attack_vectors": [ "WEAPON" ], + "attack_vectors_random": [ "HAND", "ELBOW", "LOWER_LEG", "FOOT" ] }, { "type": "technique", @@ -1173,7 +1239,8 @@ { "stat": "damage", "type": "bash", "scale": 1.3 }, { "stat": "damage", "type": "cut", "scale": 1.3 }, { "stat": "damage", "type": "stab", "scale": 1.3 } - ] + ], + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -1186,7 +1253,8 @@ "crit_tec": true, "down_dur": 2, "stun_dur": 2, - "mult_bonuses": [ { "stat": "damage", "type": "bash", "scale": 2.0 } ] + "mult_bonuses": [ { "stat": "damage", "type": "bash", "scale": 2.0 } ], + "attack_vectors": [ "THROW" ] }, { "type": "technique", @@ -1199,7 +1267,8 @@ { "stat": "movecost", "scale": 1.75 }, { "stat": "damage", "type": "bash", "scale": 2.0 }, { "stat": "damage", "type": "cut", "scale": 2.0 } - ] + ], + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -1208,7 +1277,8 @@ "messages": [ "Your strike knocks %s off balance", "'s strike knocks %s off balance" ], "skill_requirements": [ { "name": "melee", "level": 3 } ], "melee_allowed": true, - "down_dur": 1 + "down_dur": 1, + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -1223,7 +1293,8 @@ { "stat": "damage", "type": "bash", "scale": 1.5 }, { "stat": "damage", "type": "cut", "scale": 1.5 }, { "stat": "damage", "type": "stab", "scale": 1.5 } - ] + ], + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -1239,7 +1310,8 @@ { "stat": "movecost", "scale": 0.5 }, { "stat": "damage", "type": "bash", "scale": 1.5 }, { "stat": "damage", "type": "cut", "scale": 1.5 } - ] + ], + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -1262,7 +1334,8 @@ { "stat": "damage", "type": "bash", "scale": 1.2 }, { "stat": "damage", "type": "cut", "scale": 1.2 }, { "stat": "damage", "type": "stab", "scale": 1.2 } - ] + ], + "attack_vectors": [ "HAND" ] }, { "type": "technique", @@ -1272,7 +1345,8 @@ "skill_requirements": [ { "name": "unarmed", "level": 2 } ], "unarmed_allowed": true, "crit_tec": true, - "stun_dur": 2 + "stun_dur": 2, + "attack_vectors": [ "FOOT" ] }, { "type": "technique", @@ -1293,7 +1367,8 @@ "unarmed_allowed": true, "stunned_target": true, "weighting": 3, - "mult_bonuses": [ { "stat": "movecost", "scale": 0.5 } ] + "mult_bonuses": [ { "stat": "movecost", "scale": 0.5 } ], + "attack_vectors": [ "KNEE" ] }, { "type": "technique", @@ -1308,7 +1383,8 @@ "disarms": true, "stun_dur": 1, "flat_bonuses": [ { "stat": "arpen", "type": "bash", "scaling-stat": "str", "scale": 1.0 } ], - "mult_bonuses": [ { "stat": "damage", "type": "bash", "scale": 1.25 } ] + "mult_bonuses": [ { "stat": "damage", "type": "bash", "scale": 1.25 } ], + "attack_vectors": [ "GRAPPLE" ] }, { "type": "technique", @@ -1323,7 +1399,8 @@ "knockback_dist": 2, "knockback_spread": 2, "stunned_target": true, - "mult_bonuses": [ { "stat": "damage", "type": "bash", "scale": 2.0 } ] + "mult_bonuses": [ { "stat": "damage", "type": "bash", "scale": 2.0 } ], + "attack_vectors": [ "THROW" ] }, { "type": "technique", @@ -1333,7 +1410,8 @@ "skill_requirements": [ { "name": "melee", "level": 2 } ], "melee_allowed": true, "crit_tec": true, - "down_dur": 2 + "down_dur": 2, + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -1349,7 +1427,8 @@ { "stat": "damage", "type": "bash", "scale": 1.33 }, { "stat": "damage", "type": "cut", "scale": 1.33 }, { "stat": "damage", "type": "stab", "scale": 1.33 } - ] + ], + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -1359,7 +1438,8 @@ "skill_requirements": [ { "name": "melee", "level": 4 } ], "melee_allowed": true, "crit_tec": true, - "stun_dur": 2 + "stun_dur": 2, + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -1375,7 +1455,8 @@ { "stat": "damage", "type": "bash", "scale": 1.33 }, { "stat": "damage", "type": "cut", "scale": 1.33 }, { "stat": "damage", "type": "stab", "scale": 1.33 } - ] + ], + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -1389,7 +1470,8 @@ { "stat": "arpen", "type": "cut", "scaling-stat": "per", "scale": 0.5 }, { "stat": "arpen", "type": "stab", "scaling-stat": "per", "scale": 0.5 } ], - "mult_bonuses": [ { "stat": "movecost", "scale": 0.8 } ] + "mult_bonuses": [ { "stat": "movecost", "scale": 0.8 } ], + "attack_vectors": [ "HAND" ] }, { "type": "technique", @@ -1426,7 +1508,8 @@ { "stat": "arpen", "type": "cut", "scaling-stat": "per", "scale": 1.0 }, { "stat": "arpen", "type": "stab", "scaling-stat": "per", "scale": 1.0 } ], - "mult_bonuses": [ { "stat": "damage", "type": "bash", "scale": 1.5 } ] + "mult_bonuses": [ { "stat": "damage", "type": "bash", "scale": 1.5 } ], + "attack_vectors": [ "HAND" ] }, { "type": "technique", @@ -1440,7 +1523,8 @@ { "stat": "damage", "type": "bash", "scale": 0.5 }, { "stat": "damage", "type": "cut", "scale": 0.5 }, { "stat": "damage", "type": "stab", "scale": 0.5 } - ] + ], + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -1454,7 +1538,8 @@ { "stat": "damage", "type": "bash", "scale": 0.5 }, { "stat": "damage", "type": "cut", "scale": 0.5 }, { "stat": "damage", "type": "stab", "scale": 0.5 } - ] + ], + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -1475,7 +1560,8 @@ "unarmed_allowed": true, "weighting": 2, "take_weapon": true, - "mult_bonuses": [ { "stat": "damage", "type": "bash", "scale": 0.5 } ] + "mult_bonuses": [ { "stat": "damage", "type": "bash", "scale": 0.5 } ], + "attack_vectors": [ "HAND" ] }, { "type": "technique", @@ -1495,7 +1581,8 @@ { "stat": "damage", "type": "bash", "scale": 1.5 }, { "stat": "damage", "type": "cut", "scale": 1.5 }, { "stat": "damage", "type": "stab", "scale": 1.5 } - ] + ], + "attack_vectors": [ "FOOT" ] }, { "type": "technique", @@ -1503,7 +1590,8 @@ "name": "Side Kick", "unarmed_allowed": true, "messages": [ "You turn slightly and side-kick %s", " turns slightly and side-kicks %s" ], - "knockback_dist": 1 + "knockback_dist": 1, + "attack_vectors": [ "FOOT" ] }, { "type": "technique", @@ -1513,7 +1601,8 @@ "skill_requirements": [ { "name": "unarmed", "level": 2 } ], "unarmed_allowed": true, "crit_ok": true, - "down_dur": 1 + "down_dur": 1, + "attack_vectors_random": [ "FOOT", "LOWER_LEG" ] }, { "type": "technique", @@ -1525,7 +1614,8 @@ { "stat": "damage", "type": "bash", "scale": 1.2 }, { "stat": "damage", "type": "cut", "scale": 1.2 }, { "stat": "damage", "type": "stab", "scale": 1.2 } - ] + ], + "attack_vectors": [ "FOOT" ] }, { "type": "technique", @@ -1544,7 +1634,8 @@ "messages": [ "You gently disarm %s", " gently disarms %s" ], "skill_requirements": [ { "name": "unarmed", "level": 3 } ], "unarmed_allowed": true, - "disarms": true + "disarms": true, + "attack_vectors": [ "HAND" ] }, { "type": "technique", @@ -1559,7 +1650,8 @@ { "stat": "damage", "type": "bash", "scale": 1.5 }, { "stat": "damage", "type": "cut", "scale": 1.5 }, { "stat": "damage", "type": "stab", "scale": 1.5 } - ] + ], + "attack_vectors": [ "HAND" ] }, { "type": "technique", @@ -1576,7 +1668,8 @@ { "stat": "damage", "type": "bash", "scale": 1.2 }, { "stat": "damage", "type": "cut", "scale": 1.2 }, { "stat": "damage", "type": "stab", "scale": 1.2 } - ] + ], + "attack_vectors": [ "THROW" ] }, { "type": "technique", @@ -1593,7 +1686,8 @@ { "stat": "damage", "type": "bash", "scale": 2.0 }, { "stat": "damage", "type": "cut", "scale": 2.0 }, { "stat": "damage", "type": "stab", "scale": 2.0 } - ] + ], + "attack_vectors": [ "HAND" ] }, { "type": "technique", @@ -1615,7 +1709,8 @@ "skill_requirements": [ { "name": "unarmed", "level": 1 } ], "unarmed_allowed": true, "down_dur": 1, - "mult_bonuses": [ { "stat": "damage", "type": "bash", "scale": 1.25 } ] + "mult_bonuses": [ { "stat": "damage", "type": "bash", "scale": 1.25 } ], + "attack_vectors": [ "THROW" ] }, { "type": "technique", @@ -1634,7 +1729,8 @@ { "stat": "damage", "type": "bash", "scale": 1.25 }, { "stat": "damage", "type": "cut", "scale": 1.25 }, { "stat": "damage", "type": "stab", "scale": 1.25 } - ] + ], + "attack_vectors": [ "HAND" ] }, { "type": "technique", @@ -1649,12 +1745,13 @@ { "stat": "damage", "type": "bash", "scale": 1.25 }, { "stat": "damage", "type": "cut", "scale": 1.25 }, { "stat": "damage", "type": "stab", "scale": 1.25 } - ] + ], + "attack_vectors": [ "HAND" ] }, { "type": "technique", "id": "tec_tiger_wide", - "name": "Tiger Ramage", + "name": "Tiger Rampage", "messages": [ "You slash wildly at %s and those nearby", " slashes wildly at %s and those nearby" ], "skill_requirements": [ { "name": "unarmed", "level": 5 } ], "unarmed_allowed": true, @@ -1665,7 +1762,8 @@ { "stat": "damage", "type": "bash", "scale": 1.25 }, { "stat": "damage", "type": "cut", "scale": 1.25 }, { "stat": "damage", "type": "stab", "scale": 1.25 } - ] + ], + "attack_vectors": [ "HAND" ] }, { "type": "technique", @@ -1677,7 +1775,8 @@ { "stat": "damage", "type": "bash", "scale": 1.1 }, { "stat": "damage", "type": "cut", "scale": 1.1 }, { "stat": "damage", "type": "stab", "scale": 1.1 } - ] + ], + "attack_vectors": [ "HAND" ] }, { "type": "technique", @@ -1694,7 +1793,8 @@ { "stat": "damage", "type": "bash", "scale": 1.1 }, { "stat": "damage", "type": "cut", "scale": 1.1 }, { "stat": "damage", "type": "stab", "scale": 1.1 } - ] + ], + "attack_vectors": [ "HAND" ] }, { "type": "technique", @@ -1709,7 +1809,8 @@ { "stat": "damage", "type": "bash", "scale": 1.2 }, { "stat": "damage", "type": "cut", "scale": 1.2 }, { "stat": "damage", "type": "stab", "scale": 1.2 } - ] + ], + "attack_vectors": [ "HAND" ] }, { "type": "technique", @@ -1728,7 +1829,8 @@ { "stat": "damage", "type": "bash", "scale": 1.2 }, { "stat": "damage", "type": "cut", "scale": 1.2 }, { "stat": "damage", "type": "stab", "scale": 1.2 } - ] + ], + "attack_vectors": [ "HAND" ] }, { "type": "technique", @@ -1761,7 +1863,8 @@ { "stat": "damage", "type": "bash", "scale": 1.2 }, { "stat": "damage", "type": "cut", "scale": 1.2 }, { "stat": "damage", "type": "stab", "scale": 1.2 } - ] + ], + "attack_vectors": [ "HAND" ] }, { "type": "technique", @@ -1788,7 +1891,8 @@ { "stat": "damage", "type": "bash", "scale": 1.3 }, { "stat": "damage", "type": "cut", "scale": 1.3 }, { "stat": "damage", "type": "stab", "scale": 1.3 } - ] + ], + "attack_vectors_random": [ "HAND", "FOOT" ] }, { "type": "technique", @@ -1802,7 +1906,8 @@ { "stat": "damage", "type": "bash", "scaling-stat": "str", "scale": 0.1 } ], "flat_bonuses": [ { "stat": "movecost", "scale": 100 }, { "stat": "movecost", "scaling-stat": "str", "scale": 10 } ], - "messages": [ "You slowly strike %s", " slowly strikes %s" ] + "messages": [ "You slowly strike %s", " slowly strikes %s" ], + "attack_vectors": [ "HAND" ] }, { "type": "technique", @@ -1822,6 +1927,7 @@ { "stat": "arpen", "type": "bash", "scaling-stat": "per", "scale": 1 } ], "crit_tec": true, - "messages": [ "You phase-strike %s", " phase-strikes %s" ] + "messages": [ "You phase-strike %s", " phase-strikes %s" ], + "attack_vectors": [ "WEAPON", "HAND" ] } ] diff --git a/data/mods/MMA/techniques.json b/data/mods/MMA/techniques.json index 761dcd525cda5..6eac8ac3150ac 100644 --- a/data/mods/MMA/techniques.json +++ b/data/mods/MMA/techniques.json @@ -5,7 +5,8 @@ "name": "Burning Blade", "messages": [ "You unleash a fiery attack against %s", " unleash a fiery attack against %s" ], "melee_allowed": true, - "flat_bonuses": [ { "stat": "damage", "type": "heat", "scale": 3.0 } ] + "flat_bonuses": [ { "stat": "damage", "type": "heat", "scale": 3.0 } ], + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -15,7 +16,8 @@ "skill_requirements": [ { "name": "melee", "level": 1 } ], "melee_allowed": true, "crit_tec": true, - "flat_bonuses": [ { "stat": "damage", "type": "heat", "scale": 7.0 } ] + "flat_bonuses": [ { "stat": "damage", "type": "heat", "scale": 7.0 } ], + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -26,7 +28,8 @@ "melee_allowed": true, "crit_ok": true, "aoe": "impale", - "flat_bonuses": [ { "stat": "damage", "type": "heat", "scale": 7.0 } ] + "flat_bonuses": [ { "stat": "damage", "type": "heat", "scale": 7.0 } ], + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -40,7 +43,8 @@ "melee_allowed": true, "crit_tec": true, "aoe": "spin", - "flat_bonuses": [ { "stat": "damage", "type": "heat", "scale": 10.0 } ] + "flat_bonuses": [ { "stat": "damage", "type": "heat", "scale": 10.0 } ], + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -49,7 +53,8 @@ "messages": [ "You carve an arc through %s and those nearby", " carve an arc through %s and those nearby" ], "skill_requirements": [ { "name": "melee", "level": 2 } ], "melee_allowed": true, - "aoe": "wide" + "aoe": "wide", + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -58,7 +63,8 @@ "messages": [ "You spot %s's weakpoint and strike", " spot %s's weakpoint and strike" ], "skill_requirements": [ { "name": "melee", "level": 1 } ], "melee_allowed": true, - "flat_bonuses": [ { "stat": "damage", "type": "stab", "scaling-stat": "int", "scale": 0.5 } ] + "flat_bonuses": [ { "stat": "damage", "type": "stab", "scaling-stat": "int", "scale": 0.5 } ], + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -68,7 +74,8 @@ "skill_requirements": [ { "name": "melee", "level": 4 } ], "melee_allowed": true, "crit_tec": true, - "flat_bonuses": [ { "stat": "damage", "type": "stab", "scaling-stat": "int", "scale": 1.0 } ] + "flat_bonuses": [ { "stat": "damage", "type": "stab", "scaling-stat": "int", "scale": 1.0 } ], + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -82,7 +89,8 @@ "melee_allowed": true, "required_buffs_all": [ "mma_buff_hylian_onpause" ], "crit_ok": true, - "aoe": "spin" + "aoe": "spin", + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -96,7 +104,8 @@ "melee_allowed": true, "required_buffs_all": [ "mma_buff_hylian_onpause" ], "crit_ok": true, - "aoe": "wide" + "aoe": "wide", + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -104,7 +113,8 @@ "name": "Disarming Strike", "messages": [ "You skillfully disarm %s", " skillfully disarms %s" ], "unarmed_allowed": true, - "disarms": true + "disarms": true, + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -114,7 +124,8 @@ "skill_requirements": [ { "name": "melee", "level": 1 } ], "melee_allowed": true, "defensive": true, - "miss_recovery": true + "miss_recovery": true, + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -129,7 +140,8 @@ { "stat": "damage", "type": "bash", "scale": 1.25 }, { "stat": "damage", "type": "cut", "scale": 1.25 }, { "stat": "damage", "type": "stab", "scale": 1.25 } - ] + ], + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -144,7 +156,8 @@ { "stat": "damage", "type": "bash", "scale": 1.4 }, { "stat": "damage", "type": "cut", "scale": 1.4 }, { "stat": "damage", "type": "stab", "scale": 1.4 } - ] + ], + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -156,7 +169,8 @@ ], "skill_requirements": [ { "name": "melee", "level": 3 } ], "melee_allowed": true, - "aoe": "wide" + "aoe": "wide", + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -171,7 +185,8 @@ { "stat": "damage", "type": "bash", "scale": 1.25 }, { "stat": "damage", "type": "cut", "scale": 1.25 }, { "stat": "damage", "type": "stab", "scale": 1.25 } - ] + ], + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -185,7 +200,8 @@ { "stat": "damage", "type": "bash", "scale": 1.2 }, { "stat": "damage", "type": "cut", "scale": 1.2 }, { "stat": "damage", "type": "stab", "scale": 1.2 } - ] + ], + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -208,7 +224,8 @@ { "stat": "damage", "type": "bash", "scale": 1.5 }, { "stat": "damage", "type": "cut", "scale": 1.5 }, { "stat": "damage", "type": "stab", "scale": 1.5 } - ] + ], + "attack_vectors": [ "WEAPON", "HAND" ] }, { "type": "technique", @@ -224,7 +241,8 @@ { "stat": "damage", "type": "bash", "scale": 0.66 }, { "stat": "damage", "type": "cut", "scale": 0.66 }, { "stat": "damage", "type": "stab", "scale": 0.66 } - ] + ], + "attack_vectors": [ "WEAPON", "HAND" ] }, { "type": "technique", @@ -238,7 +256,8 @@ { "stat": "damage", "type": "bash", "scale": 2.0 }, { "stat": "damage", "type": "cut", "scale": 2.0 }, { "stat": "damage", "type": "stab", "scale": 2.0 } - ] + ], + "attack_vectors": [ "FOOT" ] }, { "type": "technique", @@ -252,7 +271,8 @@ { "stat": "arpen", "type": "bash", "scaling-stat": "str", "scale": 1.5 }, { "stat": "arpen", "type": "cut", "scaling-stat": "str", "scale": 1.5 }, { "stat": "arpen", "type": "stab", "scaling-stat": "str", "scale": 1.5 } - ] + ], + "attack_vectors": [ "ARM" ] }, { "type": "technique", @@ -262,7 +282,8 @@ "skill_requirements": [ { "name": "unarmed", "level": 3 } ], "unarmed_allowed": true, "crit_ok": true, - "flat_bonuses": [ { "stat": "hit", "scale": 5.0 } ] + "flat_bonuses": [ { "stat": "hit", "scale": 5.0 } ], + "attack_vectors_random": [ "HAND", "FOOT", "HEAD", "TORSO" ] }, { "type": "technique", @@ -272,7 +293,8 @@ "skill_requirements": [ { "name": "unarmed", "level": 3 } ], "unarmed_allowed": true, "crit_ok": true, - "down_dur": 1 + "down_dur": 1, + "attack_vectors_random": [ "FOOT", "LOWER_LEG" ] }, { "type": "technique", @@ -283,7 +305,8 @@ "melee_allowed": true, "unarmed_allowed": true, "crit_tec": true, - "stun_dur": 1 + "stun_dur": 1, + "attack_vectors": [ "WEAPON", "HAND" ] }, { "type": "technique", @@ -300,7 +323,8 @@ { "stat": "damage", "type": "bash", "scale": 1.33 }, { "stat": "damage", "type": "cut", "scale": 1.33 }, { "stat": "damage", "type": "stab", "scale": 1.33 } - ] + ], + "attack_vectors": [ "THOW" ] }, { "type": "technique", @@ -320,7 +344,8 @@ { "stat": "damage", "type": "bash", "scale": 1.5 }, { "stat": "damage", "type": "cut", "scale": 1.5 }, { "stat": "damage", "type": "stab", "scale": 1.5 } - ] + ], + "attack_vectors": [ "THROW" ] }, { "type": "technique", @@ -330,7 +355,8 @@ "skill_requirements": [ { "name": "melee", "level": 2 } ], "melee_allowed": true, "crit_ok": true, - "disarms": true + "disarms": true, + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -340,7 +366,8 @@ "skill_requirements": [ { "name": "melee", "level": 5 } ], "melee_allowed": true, "crit_ok": true, - "aoe": "wide" + "aoe": "wide", + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -357,7 +384,8 @@ { "stat": "arpen", "type": "bash", "scaling-stat": "str", "scale": 0.5 }, { "stat": "arpen", "type": "cut", "scaling-stat": "str", "scale": 0.5 }, { "stat": "arpen", "type": "stab", "scaling-stat": "str", "scale": 0.5 } - ] + ], + "attack_vectors": [ "WEAPON", "HAND" ] }, { "type": "technique", @@ -368,7 +396,8 @@ "melee_allowed": true, "unarmed_allowed": true, "crit_tec": true, - "stun_dur": 1 + "stun_dur": 1, + "attack_vectors": [ "WEAPON", "HAND" ] }, { "type": "technique", @@ -385,7 +414,8 @@ { "stat": "damage", "type": "bash", "scale": 1.3 }, { "stat": "damage", "type": "cut", "scale": 1.3 }, { "stat": "damage", "type": "stab", "scale": 1.3 } - ] + ], + "attack_vectors": [ "WEAPON", "HAND" ] }, { "type": "technique", From e09b11f76bb04e1a5ebce8b27be292153c6c6629 Mon Sep 17 00:00:00 2001 From: Hymore246 Date: Sat, 8 Jan 2022 12:01:57 -0600 Subject: [PATCH 05/18] Updated damage formulas to use attack vectors --- src/character.h | 10 +-- src/item.cpp | 8 +- src/melee.cpp | 205 +++++++++++++++++++++++++++++++++--------------- 3 files changed, 152 insertions(+), 71 deletions(-) diff --git a/src/character.h b/src/character.h index 259d0a8c4cc8a..e975ae4557da6 100644 --- a/src/character.h +++ b/src/character.h @@ -953,19 +953,19 @@ class Character : public Creature, public visitable // If average == true, adds expected values of random rolls instead of rolling. /** Adds all 3 types of physical damage to instance */ - void roll_all_damage( bool crit, damage_instance &di, bool average, const item &weap, bool unarmed, + void roll_all_damage( bool crit, damage_instance &di, bool average, const item &weap, std::string attack_vector, const Creature *target, const bodypart_id &bp ) const; /** Adds player's total bash damage to the damage instance */ - void roll_bash_damage( bool crit, damage_instance &di, bool average, const item &weap, bool unarmed, + void roll_bash_damage( bool crit, damage_instance &di, bool average, const item &weap, std::string attack_vector, float crit_mod ) const; /** Adds player's total cut damage to the damage instance */ - void roll_cut_damage( bool crit, damage_instance &di, bool average, const item &weap, bool unarmed, + void roll_cut_damage( bool crit, damage_instance &di, bool average, const item &weap, std::string attack_vector, float crit_mod ) const; /** Adds player's total stab damage to the damage instance */ - void roll_stab_damage( bool crit, damage_instance &di, bool average, const item &weap, bool unarmed, + void roll_stab_damage( bool crit, damage_instance &di, bool average, const item &weap, std::string attack_vector, float crit_mod ) const; /** Adds player's total non-bash, non-cut, non-stab damage to the damage instance */ - void roll_other_damage( bool crit, damage_instance &di, bool average, const item &weap, bool unarmed, + void roll_other_damage( bool crit, damage_instance &di, bool average, const item &weap, std::string attack_vector, float crit_mod ) const; /** Returns true if the player should be dead */ diff --git a/src/item.cpp b/src/item.cpp index 91b21490eb667..09ef0c87c4815 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -1832,7 +1832,7 @@ double item::effective_dps( const Character &guy, Creature &mon ) const Creature *temp_mon = &mon; double subtotal_damage = 0; damage_instance base_damage; - guy.roll_all_damage( crit, base_damage, true, *this, false, &mon, bp ); + guy.roll_all_damage( crit, base_damage, true, *this, "WEAPON", &mon, bp ); damage_instance dealt_damage = base_damage; // TODO: Modify DPS calculation to consider weakpoints. resistances r = resistances( *static_cast( temp_mon ) ); @@ -1857,7 +1857,7 @@ double item::effective_dps( const Character &guy, Creature &mon ) const if( has_technique( RAPID ) ) { Creature *temp_rs_mon = &mon; damage_instance rs_base_damage; - guy.roll_all_damage( crit, rs_base_damage, true, *this, false, &mon, bp ); + guy.roll_all_damage( crit, rs_base_damage, true, *this, "WEAPON", &mon, bp ); damage_instance dealt_rs_damage = rs_base_damage; for( damage_unit &dmg_unit : dealt_rs_damage.damage_units ) { dmg_unit.damage_multiplier *= 0.66; @@ -4487,9 +4487,9 @@ void item::combat_info( std::vector &info, const iteminfo_query *parts ( dmg_bash || dmg_cut || dmg_stab || type->m_to_hit > 0 ) ) || debug_mode ) { bodypart_id bp = bodypart_id( "torso" ); damage_instance non_crit; - player_character.roll_all_damage( false, non_crit, true, *this, false, nullptr, bp ); + player_character.roll_all_damage( false, non_crit, true, *this, "WEAPON", nullptr, bp ); damage_instance crit; - player_character.roll_all_damage( true, crit, true, *this, false, nullptr, bp ); + player_character.roll_all_damage( true, crit, true, *this, "WEAPON", nullptr, bp ); int attack_cost = player_character.attack_speed( *this ); insert_separation_line( info ); if( parts->test( iteminfo_parts::DESCRIPTION_MELEEDMG ) ) { diff --git a/src/melee.cpp b/src/melee.cpp index aa1ccac3948bf..b97d869ce1d2c 100644 --- a/src/melee.cpp +++ b/src/melee.cpp @@ -400,16 +400,16 @@ std::string Character::get_miss_reason() } void Character::roll_all_damage( bool crit, damage_instance &di, bool average, - const item &weap, bool unarmed, const Creature *target, const bodypart_id &bp ) const + const item &weap, std::string attack_vector, const Creature *target, const bodypart_id &bp ) const { float crit_mod = 1.f; if( target != nullptr ) { crit_mod = target->get_crit_factor( bp ); } - roll_bash_damage( crit, di, average, weap, unarmed, crit_mod ); - roll_cut_damage( crit, di, average, weap, unarmed, crit_mod ); - roll_stab_damage( crit, di, average, weap, unarmed, crit_mod ); - roll_other_damage( crit, di, average, weap, unarmed, crit_mod ); + roll_bash_damage( crit, di, average, weap, attack_vector, crit_mod ); + roll_cut_damage( crit, di, average, weap, attack_vector, crit_mod ); + roll_stab_damage( crit, di, average, weap, attack_vector, crit_mod ); + roll_other_damage( crit, di, average, weap, attack_vector, crit_mod ); } static void melee_train( Character &you, int lo, int hi, const item &weap ) @@ -751,8 +751,7 @@ bool Character::melee_attack_abstract( Creature &t, bool allow_special, } damage_instance d; - bool unarmed = attack_vector == "WEAPON"; - roll_all_damage( critical_hit, d, false, *cur_weapon, unarmed, &t, target_bp ); + roll_all_damage( critical_hit, d, false, *cur_weapon, attack_vector, &t, target_bp ); // your hits are not going to hurt very much if you can't use martial arts due to broken limbs if( attack_vector == "HANDS" && get_limb_score( limb_score_block, body_part_type::type::arm ) < 1.0f ) { @@ -1182,9 +1181,10 @@ float Character::bonus_damage( bool random ) const } void Character::roll_bash_damage( bool crit, damage_instance &di, bool average, - const item &weap, bool unarmed, float crit_mod ) const + const item &weap, std::string attack_vector, float crit_mod ) const { float bash_dam = 0.0f; + bool unarmed = attack_vector == "WEAPON"; int skill = get_skill_level( unarmed ? skill_unarmed : skill_bashing ); if( has_active_bionic( bio_cqb ) ) { @@ -1219,11 +1219,41 @@ void Character::roll_bash_damage( bool crit, damage_instance &di, bool average, } if( unarmed ) { - const bool left_empty = !natural_attack_restricted_on( bodypart_id( "hand_l" ) ); - const bool right_empty = !natural_attack_restricted_on( bodypart_id( "hand_r" ) ) && - weap.is_null(); - if( left_empty || right_empty ) { - float per_hand = 0.0f; + bool bp_unrestricted; + + if( attack_vector == "ARM" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "arm_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "arm_r" ) ) ); + } + else if( attack_vector == "ELBOW" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "arm_elbow_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "arm_elbow_r" ) ) ); + } + else if( attack_vector == "SHOULDER" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "arm_shoulder_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "arm_shoulder_r" ) ) ); + } + else if( attack_vector == "FOOT" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "foot_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "foot_r" ) ) ); + } + else if( attack_vector == "LOWER_LEG" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "leg_lower_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "leg_lower_r" ) ) ); + } + else if( attack_vector == "KNEE" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "leg_knee_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "leg_knee_r" ) ) ); + } + else if( attack_vector == "HIP" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "leg_hip_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "leg_hip_r" ) ) ); + } + else if( attack_vector == "HEAD" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "head" ) ); + } + else if( attack_vector == "TORSO" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "torso" ) ); + } + else { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "hand_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "hand_r" ) ) && weap.is_null() ); + } + + if( bp_unrestricted ) { + float extra_damage = 0.0f; for( const trait_id &mut : get_mutations() ) { if( mut->flags.count( json_flag_NEED_ACTIVE_TO_MELEE ) > 0 && !has_active_mutation( mut ) ) { continue; @@ -1233,16 +1263,12 @@ void Character::roll_bash_damage( bool crit, damage_instance &di, bool average, if( mut->flags.count( json_flag_UNARMED_BONUS ) > 0 && bash_bonus > 0 ) { unarmed_bonus += std::min( get_skill_level( skill_unarmed ) / 2, 4 ); } - per_hand += bash_bonus + unarmed_bonus; + extra_damage += bash_bonus + unarmed_bonus; const std::pair rand_bash = mut->rand_bash_bonus; - per_hand += average ? ( rand_bash.first + rand_bash.second ) / 2.0f : rng( rand_bash.first, + extra_damage += average ? ( rand_bash.first + rand_bash.second ) / 2.0f : rng( rand_bash.first, rand_bash.second ); } - bash_dam += per_hand; // First hand - if( left_empty && right_empty ) { - // Second hand - bash_dam += per_hand; - } + bash_dam += extra_damage; } } @@ -1295,10 +1321,11 @@ void Character::roll_bash_damage( bool crit, damage_instance &di, bool average, } void Character::roll_cut_damage( bool crit, damage_instance &di, bool average, - const item &weap, bool unarmed, float crit_mod ) const + const item &weap, std::string attack_vector, float crit_mod ) const { float cut_dam = mabuff_damage_bonus( damage_type::CUT ) + weap.damage_melee( damage_type::CUT ); float cut_mul = 1.0f; + bool unarmed = attack_vector == "WEAPON"; int skill = get_skill_level( unarmed ? skill_unarmed : skill_cutting ); @@ -1307,16 +1334,41 @@ void Character::roll_cut_damage( bool crit, damage_instance &di, bool average, } if( unarmed ) { - // TODO: 1-handed weapons that aren't unarmed attacks - const bool left_empty = !natural_attack_restricted_on( bodypart_id( "hand_l" ) ); - const bool right_empty = !natural_attack_restricted_on( bodypart_id( "hand_r" ) ) && - weap.is_null(); - if( left_empty || right_empty ) { - float per_hand = 0.0f; - if( has_bionic( bio_razors ) ) { - per_hand += 2; - } + bool bp_unrestricted; + + if( attack_vector == "ARM" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "arm_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "arm_r" ) ) ); + } + else if( attack_vector == "ELBOW" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "arm_elbow_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "arm_elbow_r" ) ) ); + } + else if( attack_vector == "SHOULDER" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "arm_shoulder_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "arm_shoulder_r" ) ) ); + } + else if( attack_vector == "FOOT" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "foot_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "foot_r" ) ) ); + } + else if( attack_vector == "LOWER_LEG" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "leg_lower_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "leg_lower_r" ) ) ); + } + else if( attack_vector == "KNEE" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "leg_knee_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "leg_knee_r" ) ) ); + } + else if( attack_vector == "HIP" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "leg_hip_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "leg_hip_r" ) ) ); + } + else if( attack_vector == "HEAD" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "head" ) ); + } + else if( attack_vector == "TORSO" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "torso" ) ); + } + else { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "hand_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "hand_r" ) ) && weap.is_null() ); + } + if( bp_unrestricted ) { + float extra_damage = 0.0f; for( const trait_id &mut : get_mutations() ) { if( mut->flags.count( json_flag_NEED_ACTIVE_TO_MELEE ) > 0 && !has_active_mutation( mut ) ) { continue; @@ -1326,19 +1378,14 @@ void Character::roll_cut_damage( bool crit, damage_instance &di, bool average, if( mut->flags.count( json_flag_UNARMED_BONUS ) > 0 && cut_bonus > 0 ) { unarmed_bonus += std::min( get_skill_level( skill_unarmed ) / 2, 4 ); } - per_hand += cut_bonus + unarmed_bonus; + extra_damage += cut_bonus + unarmed_bonus; const std::pair rand_cut = mut->rand_cut_bonus; - per_hand += average ? ( rand_cut.first + rand_cut.second ) / 2.0f : rng( rand_cut.first, + extra_damage += average ? ( rand_cut.first + rand_cut.second ) / 2.0f : rng( rand_cut.first, rand_cut.second ); } - // TODO: add acidproof check back to slime hands (probably move it elsewhere) - - cut_dam += per_hand; // First hand - if( left_empty && right_empty ) { - // Second hand - cut_dam += per_hand; - } + cut_dam += extra_damage; } + } if( cut_dam <= 0.0f ) { @@ -1368,10 +1415,11 @@ void Character::roll_cut_damage( bool crit, damage_instance &di, bool average, di.add_damage( damage_type::CUT, cut_dam, arpen, armor_mult, cut_mul ); } -void Character::roll_stab_damage( bool crit, damage_instance &di, bool /*average*/, - const item &weap, bool unarmed, float crit_mod ) const +void Character::roll_stab_damage( bool crit, damage_instance &di, bool average, + const item &weap, std::string attack_vector, float crit_mod ) const { - float cut_dam = mabuff_damage_bonus( damage_type::STAB ) + weap.damage_melee( damage_type::STAB ); + float stab_dam = mabuff_damage_bonus( damage_type::STAB ) + weap.damage_melee( damage_type::STAB ); + bool unarmed = attack_vector == "WEAPON"; int skill = get_skill_level( unarmed ? skill_unarmed : skill_stabbing ); @@ -1380,33 +1428,66 @@ void Character::roll_stab_damage( bool crit, damage_instance &di, bool /*average } if( unarmed ) { - const bool left_empty = !natural_attack_restricted_on( bodypart_id( "hand_l" ) ); - const bool right_empty = !natural_attack_restricted_on( bodypart_id( "hand_r" ) ) && - weap.is_null(); - if( left_empty || right_empty ) { - float per_hand = 0.0f; + bool bp_unrestricted; - for( const trait_id &mut : get_mutations() ) { - per_hand += mut->pierce_dmg_bonus; + if( attack_vector == "ARM" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "arm_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "arm_r" ) ) ); + } + else if( attack_vector == "ELBOW" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "arm_elbow_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "arm_elbow_r" ) ) ); + } + else if( attack_vector == "SHOULDER" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "arm_shoulder_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "arm_shoulder_r" ) ) ); + } + else if( attack_vector == "FOOT" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "foot_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "foot_r" ) ) ); + } + else if( attack_vector == "LOWER_LEG" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "leg_lower_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "leg_lower_r" ) ) ); + } + else if( attack_vector == "KNEE" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "leg_knee_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "leg_knee_r" ) ) ); + } + else if( attack_vector == "HIP" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "leg_hip_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "leg_hip_r" ) ) ); + } + else if( attack_vector == "HEAD" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "head" ) ); + } + else if( attack_vector == "TORSO" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "torso" ) ); + } + else { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "hand_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "hand_r" ) ) && weap.is_null() ); + } - if( mut->flags.count( json_flag_UNARMED_BONUS ) > 0 && cut_bonus > 0 ) { - per_hand += std::min( skill / 2, 4 ); + if( bp_unrestricted ) { + float extra_damage = 0.0f; + for( const trait_id &mut : get_mutations() ) { + if( mut->flags.count( json_flag_NEED_ACTIVE_TO_MELEE ) > 0 && !has_active_mutation( mut ) ) { + continue; } + float unarmed_bonus = 0.0f; + const int pierce_bonus = mut->pierce_dmg_bonus; + if( mut->flags.count( json_flag_UNARMED_BONUS ) > 0 && pierce_bonus > 0 ) { + unarmed_bonus += std::min( get_skill_level( skill_unarmed ) / 2, 4 ); + } + extra_damage += pierce_bonus + unarmed_bonus; + const std::pair rand_pierce = mut->rand_cut_bonus; + extra_damage += average ? ( rand_pierce.first + rand_pierce.second ) / 2.0f : rng( rand_pierce.first, + rand_pierce.second ); } - - if( has_bionic( bio_razors ) ) { - per_hand += 2; + + if( attack_vector == "HAND" && has_bionic( bio_razors ) ) { + extra_damage += 2; } - cut_dam += per_hand; // First hand - if( left_empty && right_empty ) { - // Second hand - cut_dam += per_hand; - } + stab_dam += extra_damage; } + } - if( cut_dam <= 0 ) { + if( stab_dam <= 0 ) { return; // No negative stabbing! } @@ -1429,11 +1510,11 @@ void Character::roll_stab_damage( bool crit, damage_instance &di, bool /*average armor_mult = 1.f - 0.34f * crit_mod; } - di.add_damage( damage_type::STAB, cut_dam, arpen, armor_mult, stab_mul ); + di.add_damage( damage_type::STAB, stab_dam, arpen, armor_mult, stab_mul ); } void Character::roll_other_damage( bool /*crit*/, damage_instance &di, bool /*average*/, - const item &weap, bool unarmed, float /*crit_mod*/ ) const + const item &weap, std::string attack_vector, float /*crit_mod*/ ) const { std::map dt_map = get_dt_map(); From 6789311b153a678059602417aa1545488c1db871 Mon Sep 17 00:00:00 2001 From: Hymore246 Date: Sun, 9 Jan 2022 12:22:23 -0600 Subject: [PATCH 06/18] Updated a few technique attack vectors --- data/json/techniques.json | 3 ++- data/mods/MMA/techniques.json | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/data/json/techniques.json b/data/json/techniques.json index 12ff05bdb3495..e755a10ac15ee 100644 --- a/data/json/techniques.json +++ b/data/json/techniques.json @@ -944,6 +944,7 @@ "name": "Roundhouse Kick", "messages": [ "You roundhouse kick %s", " roundhouse kicks %s" ], "unarmed_allowed": true, + "melee_allowed": true, "mult_bonuses": [ { "stat": "damage", "type": "bash", "scale": 1.2 }, { "stat": "damage", "type": "cut", "scale": 1.2 }, @@ -1004,7 +1005,7 @@ "crit_tec": true, "stun_dur": 1, "attack_vectors": [ "WEAPON" ], - "attack_vectors_random": [ "HAND", "FOOT", "ELBOW", "KNEE", "LOWER_LEG" ] + "attack_vectors_random": [ "HAND", "FOOT", "ELBOW", "KNEE", "LOWER_LEG", "HEAD" ] }, { "type": "technique", diff --git a/data/mods/MMA/techniques.json b/data/mods/MMA/techniques.json index 6eac8ac3150ac..7b9e80d941b21 100644 --- a/data/mods/MMA/techniques.json +++ b/data/mods/MMA/techniques.json @@ -283,7 +283,7 @@ "unarmed_allowed": true, "crit_ok": true, "flat_bonuses": [ { "stat": "hit", "scale": 5.0 } ], - "attack_vectors_random": [ "HAND", "FOOT", "HEAD", "TORSO" ] + "attack_vectors_random": [ "HAND", "FOOT", "HEAD", "TORSO", "HEAD" ] }, { "type": "technique", From 87c6707bb3469c4d5fea5e18b7690d79d9a3a7a9 Mon Sep 17 00:00:00 2001 From: Hymore246 Date: Sun, 9 Jan 2022 19:42:26 -0600 Subject: [PATCH 07/18] Astyle formatting --- src/character_martial_arts.h | 3 +- src/martialarts.cpp | 21 ++-- src/melee.cpp | 227 +++++++++++++++++------------------ 3 files changed, 121 insertions(+), 130 deletions(-) diff --git a/src/character_martial_arts.h b/src/character_martial_arts.h index 15f294eb95fc0..0af814c056e2e 100644 --- a/src/character_martial_arts.h +++ b/src/character_martial_arts.h @@ -79,7 +79,8 @@ class character_martial_arts void ma_onkill_effects( Character &owner ); /** Returns an attack vector that the player can use */ - std::string get_valid_attack_vector( const Character &user, std::vector attack_vectors) const; + std::string get_valid_attack_vector( const Character &user, + std::vector attack_vectors ) const; /** Returns true if the player is able to use the given attack vector */ bool can_use_attack_vector( const Character &user, std::string av ) const; /** Returns true if the player has the leg block technique available */ diff --git a/src/martialarts.cpp b/src/martialarts.cpp index b80c9380d8eda..6cfb095649c76 100644 --- a/src/martialarts.cpp +++ b/src/martialarts.cpp @@ -229,7 +229,7 @@ void ma_technique::load( const JsonObject &jo, const std::string &src ) optional( jo, was_loaded, "aoe", aoe, "" ); optional( jo, was_loaded, "flags", flags, auto_flags_reader<> {} ); - + optional( jo, was_loaded, "attack_vectors", attack_vectors, {} ); optional( jo, was_loaded, "attack_vectors_random", attack_vectors_random, {} ); @@ -1163,7 +1163,8 @@ ma_technique character_martial_arts::get_miss_recovery( const Character &owner ) } -std::string character_martial_arts::get_valid_attack_vector( const Character &user, std::vector attack_vectors ) const +std::string character_martial_arts::get_valid_attack_vector( const Character &user, + std::vector attack_vectors ) const { for( const std::string av : attack_vectors ) { if( can_use_attack_vector( user, av ) ) { @@ -1185,20 +1186,18 @@ bool character_martial_arts::can_use_attack_vector( const Character &user, std:: if( av == "HEAD" || av == "TORSO" ) { return true; - } - else if( av == "WEAPON" && valid_weapon && ( arm_r_hp > 0 || arm_l_hp > 0 ) ) { + } else if( av == "WEAPON" && valid_weapon && ( arm_r_hp > 0 || arm_l_hp > 0 ) ) { return true; - } - else if( ( av == "HAND" || av == "ARM" || av == "ELBOW" || av == "SHOULDER" ) && ( arm_r_hp > 0 || arm_l_hp > 0 ) ) { + } else if( ( av == "HAND" || av == "ARM" || av == "ELBOW" || av == "SHOULDER" ) && ( arm_r_hp > 0 || + arm_l_hp > 0 ) ) { return true; - } - else if( ( av == "FOOT" || av == "LOWER_LEG" || av == "KNEE" || av == "HIP" ) && ( leg_r_hp > 0 && leg_l_hp > 0 ) ) { + } else if( ( av == "FOOT" || av == "LOWER_LEG" || av == "KNEE" || av == "HIP" ) && ( leg_r_hp > 0 && + leg_l_hp > 0 ) ) { return true; - } - else if( ( av == "GRAPPLE" || av == "THROW" ) && ( arm_r_hp > 0 && arm_l_hp > 0 ) ) { + } else if( ( av == "GRAPPLE" || av == "THROW" ) && ( arm_r_hp > 0 && arm_l_hp > 0 ) ) { return true; } - + return false; } diff --git a/src/melee.cpp b/src/melee.cpp index b97d869ce1d2c..0df4b018e7284 100644 --- a/src/melee.cpp +++ b/src/melee.cpp @@ -686,15 +686,15 @@ bool Character::melee_attack_abstract( Creature &t, bool allow_special, // Failsafe for tec_none if( technique_id == tec_none ) { attack_vector = "HANDS"; - } - else { - attack_vector = martial_arts_data->get_valid_attack_vector( *this, technique_id.obj().attack_vectors ); + } else { + attack_vector = martial_arts_data->get_valid_attack_vector( *this, + technique_id.obj().attack_vectors ); if( attack_vector == "NONE" ) { std::vector shuffled_attack_vectors = technique_id.obj().attack_vectors_random; std::shuffle( shuffled_attack_vectors.begin(), shuffled_attack_vectors.end(), rng_get_engine() ); attack_vector = martial_arts_data->get_valid_attack_vector( *this, shuffled_attack_vectors ); - } + } } // If no weapon is selected, use highest layer of gloves instead. @@ -704,40 +704,31 @@ bool Character::melee_attack_abstract( Creature &t, bool allow_special, if( attack_vector == "HAND" || attack_vector == "GRAPPLE" || attack_vector == "THROW" ) { covers = worn_item.covers( bodypart_id( "hand_l" ) ) && - worn_item.covers( bodypart_id( "hand_r" ) ); - } - else if( attack_vector == "ARM" ) { + worn_item.covers( bodypart_id( "hand_r" ) ); + } else if( attack_vector == "ARM" ) { covers = worn_item.covers( bodypart_id( "arm_l" ) ) && - worn_item.covers( bodypart_id( "arm_r" ) ); - } - else if( attack_vector == "ELBOW" ) { + worn_item.covers( bodypart_id( "arm_r" ) ); + } else if( attack_vector == "ELBOW" ) { covers = worn_item.covers( bodypart_id( "arm_elbow_l" ) ) && - worn_item.covers( bodypart_id( "arm_elbow_r" ) ); - } - else if( attack_vector == "SHOULDER" ) { + worn_item.covers( bodypart_id( "arm_elbow_r" ) ); + } else if( attack_vector == "SHOULDER" ) { covers = worn_item.covers( bodypart_id( "arm_shoulder_l" ) ) && - worn_item.covers( bodypart_id( "arm_shoulder_r" ) ); - } - else if( attack_vector == "FOOT" ) { + worn_item.covers( bodypart_id( "arm_shoulder_r" ) ); + } else if( attack_vector == "FOOT" ) { covers = worn_item.covers( bodypart_id( "foot_l" ) ) && - worn_item.covers( bodypart_id( "foot_r" ) ); - } - else if( attack_vector == "LOWER_LEG" ) { + worn_item.covers( bodypart_id( "foot_r" ) ); + } else if( attack_vector == "LOWER_LEG" ) { covers = worn_item.covers( bodypart_id( "leg_lower_l" ) ) && - worn_item.covers( bodypart_id( "leg_lower_r" ) ); - } - else if( attack_vector == "KNEE" ) { + worn_item.covers( bodypart_id( "leg_lower_r" ) ); + } else if( attack_vector == "KNEE" ) { covers = worn_item.covers( bodypart_id( "leg_knee_l" ) ) && - worn_item.covers( bodypart_id( "leg_knee_r" ) ); - } - else if( attack_vector == "HIP" ) { + worn_item.covers( bodypart_id( "leg_knee_r" ) ); + } else if( attack_vector == "HIP" ) { covers = worn_item.covers( bodypart_id( "leg_hip_l" ) ) && - worn_item.covers( bodypart_id( "leg_hip_r" ) ); - } - else if( attack_vector == "HEAD" ) { + worn_item.covers( bodypart_id( "leg_hip_r" ) ); + } else if( attack_vector == "HEAD" ) { covers = worn_item.covers( bodypart_id( "head" ) ); - } - else if( attack_vector == "TORSO" ) { + } else if( attack_vector == "TORSO" ) { covers = worn_item.covers( bodypart_id( "torso" ) ); } @@ -749,12 +740,13 @@ bool Character::melee_attack_abstract( Creature &t, bool allow_special, } } } - + damage_instance d; roll_all_damage( critical_hit, d, false, *cur_weapon, attack_vector, &t, target_bp ); - + // your hits are not going to hurt very much if you can't use martial arts due to broken limbs - if( attack_vector == "HANDS" && get_limb_score( limb_score_block, body_part_type::type::arm ) < 1.0f ) { + if( attack_vector == "HANDS" && + get_limb_score( limb_score_block, body_part_type::type::arm ) < 1.0f ) { technique_id = tec_none; d.mult_damage( 0.1 ); } @@ -1185,7 +1177,7 @@ void Character::roll_bash_damage( bool crit, damage_instance &di, bool average, { float bash_dam = 0.0f; bool unarmed = attack_vector == "WEAPON"; - + int skill = get_skill_level( unarmed ? skill_unarmed : skill_bashing ); if( has_active_bionic( bio_cqb ) ) { skill = BIO_CQB_LEVEL; @@ -1222,34 +1214,33 @@ void Character::roll_bash_damage( bool crit, damage_instance &di, bool average, bool bp_unrestricted; if( attack_vector == "ARM" ) { - bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "arm_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "arm_r" ) ) ); - } - else if( attack_vector == "ELBOW" ) { - bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "arm_elbow_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "arm_elbow_r" ) ) ); - } - else if( attack_vector == "SHOULDER" ) { - bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "arm_shoulder_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "arm_shoulder_r" ) ) ); - } - else if( attack_vector == "FOOT" ) { - bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "foot_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "foot_r" ) ) ); - } - else if( attack_vector == "LOWER_LEG" ) { - bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "leg_lower_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "leg_lower_r" ) ) ); - } - else if( attack_vector == "KNEE" ) { - bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "leg_knee_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "leg_knee_r" ) ) ); - } - else if( attack_vector == "HIP" ) { - bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "leg_hip_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "leg_hip_r" ) ) ); - } - else if( attack_vector == "HEAD" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "arm_l" ) ) || + ( !natural_attack_restricted_on( bodypart_id( "arm_r" ) ) ); + } else if( attack_vector == "ELBOW" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "arm_elbow_l" ) ) || + ( !natural_attack_restricted_on( bodypart_id( "arm_elbow_r" ) ) ); + } else if( attack_vector == "SHOULDER" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "arm_shoulder_l" ) ) || + ( !natural_attack_restricted_on( bodypart_id( "arm_shoulder_r" ) ) ); + } else if( attack_vector == "FOOT" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "foot_l" ) ) || + ( !natural_attack_restricted_on( bodypart_id( "foot_r" ) ) ); + } else if( attack_vector == "LOWER_LEG" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "leg_lower_l" ) ) || + ( !natural_attack_restricted_on( bodypart_id( "leg_lower_r" ) ) ); + } else if( attack_vector == "KNEE" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "leg_knee_l" ) ) || + ( !natural_attack_restricted_on( bodypart_id( "leg_knee_r" ) ) ); + } else if( attack_vector == "HIP" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "leg_hip_l" ) ) || + ( !natural_attack_restricted_on( bodypart_id( "leg_hip_r" ) ) ); + } else if( attack_vector == "HEAD" ) { bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "head" ) ); - } - else if( attack_vector == "TORSO" ) { + } else if( attack_vector == "TORSO" ) { bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "torso" ) ); - } - else { - bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "hand_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "hand_r" ) ) && weap.is_null() ); + } else { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "hand_l" ) ) || + ( !natural_attack_restricted_on( bodypart_id( "hand_r" ) ) && weap.is_null() ); } if( bp_unrestricted ) { @@ -1266,7 +1257,7 @@ void Character::roll_bash_damage( bool crit, damage_instance &di, bool average, extra_damage += bash_bonus + unarmed_bonus; const std::pair rand_bash = mut->rand_bash_bonus; extra_damage += average ? ( rand_bash.first + rand_bash.second ) / 2.0f : rng( rand_bash.first, - rand_bash.second ); + rand_bash.second ); } bash_dam += extra_damage; } @@ -1337,34 +1328,33 @@ void Character::roll_cut_damage( bool crit, damage_instance &di, bool average, bool bp_unrestricted; if( attack_vector == "ARM" ) { - bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "arm_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "arm_r" ) ) ); - } - else if( attack_vector == "ELBOW" ) { - bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "arm_elbow_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "arm_elbow_r" ) ) ); - } - else if( attack_vector == "SHOULDER" ) { - bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "arm_shoulder_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "arm_shoulder_r" ) ) ); - } - else if( attack_vector == "FOOT" ) { - bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "foot_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "foot_r" ) ) ); - } - else if( attack_vector == "LOWER_LEG" ) { - bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "leg_lower_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "leg_lower_r" ) ) ); - } - else if( attack_vector == "KNEE" ) { - bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "leg_knee_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "leg_knee_r" ) ) ); - } - else if( attack_vector == "HIP" ) { - bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "leg_hip_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "leg_hip_r" ) ) ); - } - else if( attack_vector == "HEAD" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "arm_l" ) ) || + ( !natural_attack_restricted_on( bodypart_id( "arm_r" ) ) ); + } else if( attack_vector == "ELBOW" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "arm_elbow_l" ) ) || + ( !natural_attack_restricted_on( bodypart_id( "arm_elbow_r" ) ) ); + } else if( attack_vector == "SHOULDER" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "arm_shoulder_l" ) ) || + ( !natural_attack_restricted_on( bodypart_id( "arm_shoulder_r" ) ) ); + } else if( attack_vector == "FOOT" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "foot_l" ) ) || + ( !natural_attack_restricted_on( bodypart_id( "foot_r" ) ) ); + } else if( attack_vector == "LOWER_LEG" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "leg_lower_l" ) ) || + ( !natural_attack_restricted_on( bodypart_id( "leg_lower_r" ) ) ); + } else if( attack_vector == "KNEE" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "leg_knee_l" ) ) || + ( !natural_attack_restricted_on( bodypart_id( "leg_knee_r" ) ) ); + } else if( attack_vector == "HIP" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "leg_hip_l" ) ) || + ( !natural_attack_restricted_on( bodypart_id( "leg_hip_r" ) ) ); + } else if( attack_vector == "HEAD" ) { bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "head" ) ); - } - else if( attack_vector == "TORSO" ) { + } else if( attack_vector == "TORSO" ) { bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "torso" ) ); - } - else { - bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "hand_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "hand_r" ) ) && weap.is_null() ); + } else { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "hand_l" ) ) || + ( !natural_attack_restricted_on( bodypart_id( "hand_r" ) ) && weap.is_null() ); } if( bp_unrestricted ) { @@ -1381,7 +1371,7 @@ void Character::roll_cut_damage( bool crit, damage_instance &di, bool average, extra_damage += cut_bonus + unarmed_bonus; const std::pair rand_cut = mut->rand_cut_bonus; extra_damage += average ? ( rand_cut.first + rand_cut.second ) / 2.0f : rng( rand_cut.first, - rand_cut.second ); + rand_cut.second ); } cut_dam += extra_damage; } @@ -1431,34 +1421,33 @@ void Character::roll_stab_damage( bool crit, damage_instance &di, bool average, bool bp_unrestricted; if( attack_vector == "ARM" ) { - bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "arm_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "arm_r" ) ) ); - } - else if( attack_vector == "ELBOW" ) { - bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "arm_elbow_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "arm_elbow_r" ) ) ); - } - else if( attack_vector == "SHOULDER" ) { - bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "arm_shoulder_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "arm_shoulder_r" ) ) ); - } - else if( attack_vector == "FOOT" ) { - bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "foot_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "foot_r" ) ) ); - } - else if( attack_vector == "LOWER_LEG" ) { - bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "leg_lower_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "leg_lower_r" ) ) ); - } - else if( attack_vector == "KNEE" ) { - bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "leg_knee_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "leg_knee_r" ) ) ); - } - else if( attack_vector == "HIP" ) { - bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "leg_hip_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "leg_hip_r" ) ) ); - } - else if( attack_vector == "HEAD" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "arm_l" ) ) || + ( !natural_attack_restricted_on( bodypart_id( "arm_r" ) ) ); + } else if( attack_vector == "ELBOW" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "arm_elbow_l" ) ) || + ( !natural_attack_restricted_on( bodypart_id( "arm_elbow_r" ) ) ); + } else if( attack_vector == "SHOULDER" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "arm_shoulder_l" ) ) || + ( !natural_attack_restricted_on( bodypart_id( "arm_shoulder_r" ) ) ); + } else if( attack_vector == "FOOT" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "foot_l" ) ) || + ( !natural_attack_restricted_on( bodypart_id( "foot_r" ) ) ); + } else if( attack_vector == "LOWER_LEG" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "leg_lower_l" ) ) || + ( !natural_attack_restricted_on( bodypart_id( "leg_lower_r" ) ) ); + } else if( attack_vector == "KNEE" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "leg_knee_l" ) ) || + ( !natural_attack_restricted_on( bodypart_id( "leg_knee_r" ) ) ); + } else if( attack_vector == "HIP" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "leg_hip_l" ) ) || + ( !natural_attack_restricted_on( bodypart_id( "leg_hip_r" ) ) ); + } else if( attack_vector == "HEAD" ) { bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "head" ) ); - } - else if( attack_vector == "TORSO" ) { + } else if( attack_vector == "TORSO" ) { bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "torso" ) ); - } - else { - bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "hand_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "hand_r" ) ) && weap.is_null() ); + } else { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "hand_l" ) ) || + ( !natural_attack_restricted_on( bodypart_id( "hand_r" ) ) && weap.is_null() ); } if( bp_unrestricted ) { @@ -1474,10 +1463,11 @@ void Character::roll_stab_damage( bool crit, damage_instance &di, bool average, } extra_damage += pierce_bonus + unarmed_bonus; const std::pair rand_pierce = mut->rand_cut_bonus; - extra_damage += average ? ( rand_pierce.first + rand_pierce.second ) / 2.0f : rng( rand_pierce.first, - rand_pierce.second ); + extra_damage += average ? ( rand_pierce.first + rand_pierce.second ) / 2.0f : rng( + rand_pierce.first, + rand_pierce.second ); } - + if( attack_vector == "HAND" && has_bionic( bio_razors ) ) { extra_damage += 2; } @@ -1640,7 +1630,8 @@ matec_id Character::pick_technique( Creature &t, const item &weap, // Does the player have a functional attack vector to deliver the technique? std::vector shuffled_attack_vectors = tec.attack_vectors_random; std::shuffle( shuffled_attack_vectors.begin(), shuffled_attack_vectors.end(), rng_get_engine() ); - if( martial_arts_data->get_valid_attack_vector( *this, tec.attack_vectors ) == "NONE" && martial_arts_data->get_valid_attack_vector( *this, shuffled_attack_vectors ) == "NONE" ) { + if( martial_arts_data->get_valid_attack_vector( *this, tec.attack_vectors ) == "NONE" && + martial_arts_data->get_valid_attack_vector( *this, shuffled_attack_vectors ) == "NONE" ) { continue; } From bcddaafc46f8dba7907c373fcf91ea5100d6dd3b Mon Sep 17 00:00:00 2001 From: Hymore246 Date: Sun, 9 Jan 2022 23:22:06 -0600 Subject: [PATCH 08/18] astyle fix --- src/melee.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/melee.cpp b/src/melee.cpp index 18ddd0e1e3957..b71c5ff72c16d 100644 --- a/src/melee.cpp +++ b/src/melee.cpp @@ -1269,7 +1269,7 @@ void Character::roll_bash_damage( bool crit, damage_instance &di, bool average, if( bp_unrestricted ) { float extra_damage = 0.0f; - + for( const trait_id &mut : get_mutations() ) { if( mut->flags.count( json_flag_NEED_ACTIVE_TO_MELEE ) > 0 && !has_active_mutation( mut ) ) { continue; @@ -1411,7 +1411,7 @@ void Character::roll_cut_damage( bool crit, damage_instance &di, bool average, } cut_dam += extra_damage; } - + float dam = 0.0f; float ap = 0.0f; for( const bodypart_id &bp : get_all_body_parts() ) { @@ -1521,7 +1521,7 @@ void Character::roll_stab_damage( bool crit, damage_instance &di, bool average, stab_dam += extra_damage; } - + float dam = 0.0f; float ap = 0.0f; for( const bodypart_id &bp : get_all_body_parts() ) { From 009cdc10016248903a155ed5f19687c8ecaa980a Mon Sep 17 00:00:00 2001 From: Hymore246 Date: Mon, 10 Jan 2022 07:41:39 -0600 Subject: [PATCH 09/18] error fixes in melee.cpp --- src/melee.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/melee.cpp b/src/melee.cpp index b71c5ff72c16d..f7e664e152de2 100644 --- a/src/melee.cpp +++ b/src/melee.cpp @@ -1530,7 +1530,7 @@ void Character::roll_stab_damage( bool crit, damage_instance &di, bool average, ap += bp->unarmed_arpen( damage_type::STAB ); } } - cut_dam += dam; + stab_dam += dam; arpen += ap; } @@ -1565,7 +1565,7 @@ void Character::roll_other_damage( bool /*crit*/, damage_instance &di, bool /*av const item &weap, std::string attack_vector, float /*crit_mod*/ ) const { std::map dt_map = get_dt_map(); - const bool unarmed = weap.is_unarmed_weapon(); + bool unarmed = attack_vector == "WEAPON"; for( const std::pair &dt : dt_map ) { damage_type type_name = dt.second; From 86a0ea1d2bbb98eeed28da25341ac0213bc63c1f Mon Sep 17 00:00:00 2001 From: Hymore246 Date: Mon, 10 Jan 2022 08:59:46 -0600 Subject: [PATCH 10/18] fixed undeclared variable --- src/melee.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/melee.cpp b/src/melee.cpp index f7e664e152de2..6fc3625a1635e 100644 --- a/src/melee.cpp +++ b/src/melee.cpp @@ -712,7 +712,7 @@ bool Character::melee_attack_abstract( Creature &t, bool allow_special, // If no weapon is selected, use highest layer of gloves instead. if( attack_vector != "WEAPON" ) { for( item &worn_item : worn ) { - bool covers; + bool covers = false; if( attack_vector == "HAND" || attack_vector == "GRAPPLE" || attack_vector == "THROW" ) { covers = worn_item.covers( bodypart_id( "hand_l" ) ) && From 9693d69abb3b334ab0458de9a4c537ff50817ba1 Mon Sep 17 00:00:00 2001 From: Hymore246 Date: Thu, 17 Feb 2022 08:13:51 -0600 Subject: [PATCH 11/18] Astyle formatting fix --- src/character.h | 15 ++++++++++----- src/martialarts.h | 4 ++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/character.h b/src/character.h index 7ea0085b5f2a7..0131d84846e2b 100644 --- a/src/character.h +++ b/src/character.h @@ -963,19 +963,24 @@ class Character : public Creature, public visitable // If average == true, adds expected values of random rolls instead of rolling. /** Adds all 3 types of physical damage to instance */ - void roll_all_damage( bool crit, damage_instance &di, bool average, const item &weap, std::string attack_vector, + void roll_all_damage( bool crit, damage_instance &di, bool average, const item &weap, + std::string attack_vector, const Creature *target, const bodypart_id &bp ) const; /** Adds player's total bash damage to the damage instance */ - void roll_bash_damage( bool crit, damage_instance &di, bool average, const item &weap, std::string attack_vector, + void roll_bash_damage( bool crit, damage_instance &di, bool average, const item &weap, + std::string attack_vector, float crit_mod ) const; /** Adds player's total cut damage to the damage instance */ - void roll_cut_damage( bool crit, damage_instance &di, bool average, const item &weap, std::string attack_vector, + void roll_cut_damage( bool crit, damage_instance &di, bool average, const item &weap, + std::string attack_vector, float crit_mod ) const; /** Adds player's total stab damage to the damage instance */ - void roll_stab_damage( bool crit, damage_instance &di, bool average, const item &weap, std::string attack_vector, + void roll_stab_damage( bool crit, damage_instance &di, bool average, const item &weap, + std::string attack_vector, float crit_mod ) const; /** Adds player's total non-bash, non-cut, non-stab damage to the damage instance */ - void roll_other_damage( bool crit, damage_instance &di, bool average, const item &weap, std::string attack_vector, + void roll_other_damage( bool crit, damage_instance &di, bool average, const item &weap, + std::string attack_vector, float crit_mod ) const; /** Returns true if the player should be dead */ diff --git a/src/martialarts.h b/src/martialarts.h index 0ce3dc443a2ef..e88b7a33ff861 100644 --- a/src/martialarts.h +++ b/src/martialarts.h @@ -150,8 +150,8 @@ class ma_technique bool attack_override = false; // The attack replaces the one it triggered off of ma_requirements reqs; - - // What way is the technique delivered to the target? + + // What way is the technique delivered to the target? std::vector attack_vectors; // by priority std::vector attack_vectors_random; // randomly From ca351bd8b411a2c8685f5a3f8e098dceeed10844 Mon Sep 17 00:00:00 2001 From: Hymore246 Date: Thu, 17 Feb 2022 15:21:52 -0600 Subject: [PATCH 12/18] Fixed sublimb bug. Added attack vectors to bojutsu --- data/json/techniques.json | 17 +++++++++++------ src/martialarts.cpp | 5 +++-- src/melee.cpp | 32 ++++++++++++++++++++++---------- 3 files changed, 36 insertions(+), 18 deletions(-) diff --git a/data/json/techniques.json b/data/json/techniques.json index 015f1e157115c..4bb696e263142 100644 --- a/data/json/techniques.json +++ b/data/json/techniques.json @@ -283,7 +283,8 @@ "messages": [ "You thrust at the %s", " thrusts at %s" ], "skill_requirements": [ { "name": "melee", "level": 1 } ], "melee_allowed": true, - "mult_bonuses": [ { "stat": "damage", "type": "bash", "scale": 1.2 } ] + "mult_bonuses": [ { "stat": "damage", "type": "bash", "scale": 1.2 } ], + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -298,7 +299,8 @@ "block_counter": true, "crit_ok": true, "down_dur": 1, - "mult_bonuses": [ { "stat": "movecost", "scale": 0.8 } ] + "mult_bonuses": [ { "stat": "movecost", "scale": 0.8 } ], + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -313,7 +315,8 @@ "block_counter": true, "crit_ok": true, "stun_dur": 1, - "mult_bonuses": [ { "stat": "damage", "type": "bash", "scale": 1.4 } ] + "mult_bonuses": [ { "stat": "damage", "type": "bash", "scale": 1.4 } ], + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -325,7 +328,8 @@ "required_buffs_all": [ "buff_bojutsu_onmove" ], "weighting": 2, "crit_ok": true, - "mult_bonuses": [ { "stat": "movecost", "scale": 0.75 }, { "stat": "damage", "type": "bash", "scale": 1.5 } ] + "mult_bonuses": [ { "stat": "movecost", "scale": 0.75 }, { "stat": "damage", "type": "bash", "scale": 1.5 } ], + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -346,7 +350,8 @@ "skill_requirements": [ { "name": "melee", "level": 5 } ], "melee_allowed": true, "crit_ok": true, - "disarms": true + "disarms": true, + "attack_vectors": [ "WEAPON" ] }, { "type": "technique", @@ -645,7 +650,7 @@ { "stat": "damage", "type": "cut", "scale": 1.5 }, { "stat": "damage", "type": "stab", "scale": 1.5 } ], - "attack_vectors": [ "HAND" ] + "attack_vectors": [ "WRIST" ] }, { "type": "technique", diff --git a/src/martialarts.cpp b/src/martialarts.cpp index c09c7250c6afe..9a3c1ba6698f1 100644 --- a/src/martialarts.cpp +++ b/src/martialarts.cpp @@ -1256,8 +1256,9 @@ bool character_martial_arts::can_use_attack_vector( const Character &user, std:: return true; } else if( av == "WEAPON" && valid_weapon && ( arm_r_hp > 0 || arm_l_hp > 0 ) ) { return true; - } else if( ( av == "HAND" || av == "ARM" || av == "ELBOW" || av == "SHOULDER" ) && ( arm_r_hp > 0 || - arm_l_hp > 0 ) ) { + } else if( ( av == "HAND" || av == "WRIST" || av == "ARM" || av == "ELBOW" || av == "SHOULDER" ) && + ( arm_r_hp > 0 || + arm_l_hp > 0 ) ) { return true; } else if( ( av == "FOOT" || av == "LOWER_LEG" || av == "KNEE" || av == "HIP" ) && ( leg_r_hp > 0 && leg_l_hp > 0 ) ) { diff --git a/src/melee.cpp b/src/melee.cpp index b3c8eb797da21..ffd443d740bbf 100644 --- a/src/melee.cpp +++ b/src/melee.cpp @@ -725,23 +725,26 @@ bool Character::melee_attack_abstract( Creature &t, bool allow_special, covers = worn_item.covers( bodypart_id( "arm_l" ) ) && worn_item.covers( bodypart_id( "arm_r" ) ); } else if( attack_vector == "ELBOW" ) { - covers = worn_item.covers( bodypart_id( "arm_elbow_l" ) ) && - worn_item.covers( bodypart_id( "arm_elbow_r" ) ); + covers = worn_item.covers( sub_bodypart_id( "arm_elbow_l" ) ) && + worn_item.covers( sub_bodypart_id( "arm_elbow_r" ) ); + } else if( attack_vector == "WRIST" ) { + covers = worn_item.covers( sub_bodypart_id( "hand_wrist_l" ) ) && + worn_item.covers( sub_bodypart_id( "hand_wrist_r" ) ); } else if( attack_vector == "SHOULDER" ) { - covers = worn_item.covers( bodypart_id( "arm_shoulder_l" ) ) && - worn_item.covers( bodypart_id( "arm_shoulder_r" ) ); + covers = worn_item.covers( sub_bodypart_id( "arm_shoulder_l" ) ) && + worn_item.covers( sub_bodypart_id( "arm_shoulder_r" ) ); } else if( attack_vector == "FOOT" ) { covers = worn_item.covers( bodypart_id( "foot_l" ) ) && worn_item.covers( bodypart_id( "foot_r" ) ); } else if( attack_vector == "LOWER_LEG" ) { - covers = worn_item.covers( bodypart_id( "leg_lower_l" ) ) && - worn_item.covers( bodypart_id( "leg_lower_r" ) ); + covers = worn_item.covers( sub_bodypart_id( "leg_lower_l" ) ) && + worn_item.covers( sub_bodypart_id( "leg_lower_r" ) ); } else if( attack_vector == "KNEE" ) { - covers = worn_item.covers( bodypart_id( "leg_knee_l" ) ) && - worn_item.covers( bodypart_id( "leg_knee_r" ) ); + covers = worn_item.covers( sub_bodypart_id( "leg_knee_l" ) ) && + worn_item.covers( sub_bodypart_id( "leg_knee_r" ) ); } else if( attack_vector == "HIP" ) { - covers = worn_item.covers( bodypart_id( "leg_hip_l" ) ) && - worn_item.covers( bodypart_id( "leg_hip_r" ) ); + covers = worn_item.covers( sub_bodypart_id( "leg_hip_l" ) ) && + worn_item.covers( sub_bodypart_id( "leg_hip_r" ) ); } else if( attack_vector == "HEAD" ) { covers = worn_item.covers( bodypart_id( "head" ) ); } else if( attack_vector == "TORSO" ) { @@ -1251,6 +1254,9 @@ void Character::roll_bash_damage( bool crit, damage_instance &di, bool average, } else if( attack_vector == "ELBOW" ) { bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "arm_elbow_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "arm_elbow_r" ) ) ); + } else if( attack_vector == "WRIST" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "hand_wrist_l" ) ) || + ( !natural_attack_restricted_on( bodypart_id( "hand_wrist_r" ) ) ); } else if( attack_vector == "SHOULDER" ) { bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "arm_shoulder_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "arm_shoulder_r" ) ) ); @@ -1382,6 +1388,9 @@ void Character::roll_cut_damage( bool crit, damage_instance &di, bool average, } else if( attack_vector == "ELBOW" ) { bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "arm_elbow_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "arm_elbow_r" ) ) ); + } else if( attack_vector == "WRIST" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "hand_wrist_l" ) ) || + ( !natural_attack_restricted_on( bodypart_id( "hand_wrist_r" ) ) ); } else if( attack_vector == "SHOULDER" ) { bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "arm_shoulder_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "arm_shoulder_r" ) ) ); @@ -1486,6 +1495,9 @@ void Character::roll_stab_damage( bool crit, damage_instance &di, bool average, } else if( attack_vector == "ELBOW" ) { bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "arm_elbow_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "arm_elbow_r" ) ) ); + } else if( attack_vector == "WRIST" ) { + bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "hand_wrist_l" ) ) || + ( !natural_attack_restricted_on( bodypart_id( "hand_wrist_r" ) ) ); } else if( attack_vector == "SHOULDER" ) { bp_unrestricted = !natural_attack_restricted_on( bodypart_id( "arm_shoulder_l" ) ) || ( !natural_attack_restricted_on( bodypart_id( "arm_shoulder_r" ) ) ); From b1bf93ad8e3aa067f61e6d354630413777ec4f41 Mon Sep 17 00:00:00 2001 From: Hymore246 Date: Thu, 17 Feb 2022 16:07:33 -0600 Subject: [PATCH 13/18] Fixed code formatting --- src/martialarts.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/martialarts.cpp b/src/martialarts.cpp index 9a3c1ba6698f1..c6db9ca46f0c2 100644 --- a/src/martialarts.cpp +++ b/src/martialarts.cpp @@ -1234,7 +1234,7 @@ ma_technique character_martial_arts::get_miss_recovery( const Character &owner ) std::string character_martial_arts::get_valid_attack_vector( const Character &user, std::vector attack_vectors ) const { - for( const std::string av : attack_vectors ) { + for( auto av : attack_vectors ) { if( can_use_attack_vector( user, av ) ) { return av; } @@ -1251,19 +1251,20 @@ bool character_martial_arts::can_use_attack_vector( const Character &user, std:: int arm_l_hp = user.get_part_hp_cur( bodypart_id( "arm_l" ) ); int leg_r_hp = user.get_part_hp_cur( bodypart_id( "leg_r" ) ); int leg_l_hp = user.get_part_hp_cur( bodypart_id( "leg_l" ) ); + bool healthy_arm = arm_r_hp > 0 || arm_l_hp > 0; + bool healthy_arms = arm_r_hp > 0 && arm_l_hp > 0; + bool healthy_legs = leg_r_hp > 0 && leg_l_hp > 0; if( av == "HEAD" || av == "TORSO" ) { return true; - } else if( av == "WEAPON" && valid_weapon && ( arm_r_hp > 0 || arm_l_hp > 0 ) ) { + } else if( av == "WEAPON" && valid_weapon && healthy_arm ) { return true; } else if( ( av == "HAND" || av == "WRIST" || av == "ARM" || av == "ELBOW" || av == "SHOULDER" ) && - ( arm_r_hp > 0 || - arm_l_hp > 0 ) ) { + healthy_arm ) { return true; - } else if( ( av == "FOOT" || av == "LOWER_LEG" || av == "KNEE" || av == "HIP" ) && ( leg_r_hp > 0 && - leg_l_hp > 0 ) ) { + } else if( ( av == "FOOT" || av == "LOWER_LEG" || av == "KNEE" || av == "HIP" ) && healthy_legs ) { return true; - } else if( ( av == "GRAPPLE" || av == "THROW" ) && ( arm_r_hp > 0 && arm_l_hp > 0 ) ) { + } else if( ( av == "GRAPPLE" || av == "THROW" ) && healthy_arms ) { return true; } From 29a16375cf139f194119db1b61c189be844d4266 Mon Sep 17 00:00:00 2001 From: Hymore246 Date: Thu, 17 Feb 2022 18:28:42 -0600 Subject: [PATCH 14/18] Added FINGERS sub limb --- data/json/techniques.json | 2 +- src/martialarts.cpp | 4 ++-- src/melee.cpp | 3 +++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/data/json/techniques.json b/data/json/techniques.json index 4bb696e263142..6ceed268d2283 100644 --- a/data/json/techniques.json +++ b/data/json/techniques.json @@ -1082,7 +1082,7 @@ "crit_tec": true, "stun_dur": 1, "attack_vectors": [ "WEAPON" ], - "attack_vectors_random": [ "HAND", "FOOT", "ELBOW", "KNEE", "LOWER_LEG", "HEAD" ] + "attack_vectors_random": [ "HAND", "FINGERS", "FOOT", "ELBOW", "KNEE", "LOWER_LEG", "HEAD" ] }, { "type": "technique", diff --git a/src/martialarts.cpp b/src/martialarts.cpp index c6db9ca46f0c2..4b7c01e89b7be 100644 --- a/src/martialarts.cpp +++ b/src/martialarts.cpp @@ -1259,8 +1259,8 @@ bool character_martial_arts::can_use_attack_vector( const Character &user, std:: return true; } else if( av == "WEAPON" && valid_weapon && healthy_arm ) { return true; - } else if( ( av == "HAND" || av == "WRIST" || av == "ARM" || av == "ELBOW" || av == "SHOULDER" ) && - healthy_arm ) { + } else if( ( av == "HAND" || av == "FINGER" || av == "WRIST" || av == "ARM" || av == "ELBOW" || + av == "SHOULDER" ) && healthy_arm ) { return true; } else if( ( av == "FOOT" || av == "LOWER_LEG" || av == "KNEE" || av == "HIP" ) && healthy_legs ) { return true; diff --git a/src/melee.cpp b/src/melee.cpp index ffd443d740bbf..b5e40ad3003d8 100644 --- a/src/melee.cpp +++ b/src/melee.cpp @@ -727,6 +727,9 @@ bool Character::melee_attack_abstract( Creature &t, bool allow_special, } else if( attack_vector == "ELBOW" ) { covers = worn_item.covers( sub_bodypart_id( "arm_elbow_l" ) ) && worn_item.covers( sub_bodypart_id( "arm_elbow_r" ) ); + } else if( attack_vector == "FINGERS" ) { + covers = worn_item.covers( sub_bodypart_id( "hand_fingers_l" ) ) && + worn_item.covers( sub_bodypart_id( "hand_fingers_r" ) ); } else if( attack_vector == "WRIST" ) { covers = worn_item.covers( sub_bodypart_id( "hand_wrist_l" ) ) && worn_item.covers( sub_bodypart_id( "hand_wrist_r" ) ); From 00ec2a1e4cf618511783f5e0609e7dbcf6a64fcc Mon Sep 17 00:00:00 2001 From: Hymore246 Date: Thu, 17 Feb 2022 20:06:14 -0600 Subject: [PATCH 15/18] Fixed condition code redundancy --- src/martialarts.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/martialarts.cpp b/src/martialarts.cpp index 4b7c01e89b7be..4d6411d8fb436 100644 --- a/src/martialarts.cpp +++ b/src/martialarts.cpp @@ -1254,17 +1254,14 @@ bool character_martial_arts::can_use_attack_vector( const Character &user, std:: bool healthy_arm = arm_r_hp > 0 || arm_l_hp > 0; bool healthy_arms = arm_r_hp > 0 && arm_l_hp > 0; bool healthy_legs = leg_r_hp > 0 && leg_l_hp > 0; - - if( av == "HEAD" || av == "TORSO" ) { - return true; - } else if( av == "WEAPON" && valid_weapon && healthy_arm ) { - return true; - } else if( ( av == "HAND" || av == "FINGER" || av == "WRIST" || av == "ARM" || av == "ELBOW" || - av == "SHOULDER" ) && healthy_arm ) { - return true; - } else if( ( av == "FOOT" || av == "LOWER_LEG" || av == "KNEE" || av == "HIP" ) && healthy_legs ) { - return true; - } else if( ( av == "GRAPPLE" || av == "THROW" ) && healthy_arms ) { + bool always_ok = av == "HEAD" || av == "TORSO"; + bool weapon_ok = av == "WEAPON" && valid_weapon && healthy_arm; + bool arm_ok = av == "HAND" || av == "FINGER" || av == "WRIST" || av == "ARM" || av == "ELBOW" || + av == "SHOULDER" && healthy_arm; + bool arms_ok = av == "GRAPPLE" || av == "THROW" && healthy_arms; + bool legs_ok = av == "FOOT" || av == "LOWER_LEG" || av == "KNEE" || av == "HIP" && healthy_legs; + + if( always_ok || weapon_ok || arm_ok || arms_ok || legs_ok ) { return true; } From 7dc01e9a093ffe98882fdb1740d60120413a7101 Mon Sep 17 00:00:00 2001 From: Hymore246 Date: Thu, 17 Feb 2022 20:43:08 -0600 Subject: [PATCH 16/18] conditional fix --- src/martialarts.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/martialarts.cpp b/src/martialarts.cpp index 4d6411d8fb436..5185cc526e784 100644 --- a/src/martialarts.cpp +++ b/src/martialarts.cpp @@ -1256,10 +1256,10 @@ bool character_martial_arts::can_use_attack_vector( const Character &user, std:: bool healthy_legs = leg_r_hp > 0 && leg_l_hp > 0; bool always_ok = av == "HEAD" || av == "TORSO"; bool weapon_ok = av == "WEAPON" && valid_weapon && healthy_arm; - bool arm_ok = av == "HAND" || av == "FINGER" || av == "WRIST" || av == "ARM" || av == "ELBOW" || - av == "SHOULDER" && healthy_arm; - bool arms_ok = av == "GRAPPLE" || av == "THROW" && healthy_arms; - bool legs_ok = av == "FOOT" || av == "LOWER_LEG" || av == "KNEE" || av == "HIP" && healthy_legs; + bool arm_ok = ( av == "HAND" || av == "FINGER" || av == "WRIST" || av == "ARM" || av == "ELBOW" || + av == "SHOULDER" ) && healthy_arm; + bool arms_ok = ( av == "GRAPPLE" || av == "THROW" ) && healthy_arms; + bool legs_ok = ( av == "FOOT" || av == "LOWER_LEG" || av == "KNEE" || av == "HIP" ) && healthy_legs; if( always_ok || weapon_ok || arm_ok || arms_ok || legs_ok ) { return true; From f948139765e2dabc80a381907e32373d125eea40 Mon Sep 17 00:00:00 2001 From: Hymore246 Date: Mon, 21 Feb 2022 13:22:10 -0600 Subject: [PATCH 17/18] Added palm and hand_back locations --- data/json/techniques.json | 6 +++--- src/martialarts.cpp | 2 +- src/melee.cpp | 6 ++++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/data/json/techniques.json b/data/json/techniques.json index 6ceed268d2283..e9baee7b8afa8 100644 --- a/data/json/techniques.json +++ b/data/json/techniques.json @@ -1013,7 +1013,7 @@ { "stat": "damage", "type": "cut", "scale": 0.66 }, { "stat": "damage", "type": "stab", "scale": 0.66 } ], - "attack_vectors": [ "HAND" ] + "attack_vectors": [ "HAND_BACK" ] }, { "type": "technique", @@ -1729,7 +1729,7 @@ { "stat": "damage", "type": "cut", "scale": 1.5 }, { "stat": "damage", "type": "stab", "scale": 1.5 } ], - "attack_vectors": [ "HAND" ] + "attack_vectors": [ "PALM" ] }, { "type": "technique", @@ -1765,7 +1765,7 @@ { "stat": "damage", "type": "cut", "scale": 2.0 }, { "stat": "damage", "type": "stab", "scale": 2.0 } ], - "attack_vectors": [ "HAND" ] + "attack_vectors": [ "PALM" ] }, { "type": "technique", diff --git a/src/martialarts.cpp b/src/martialarts.cpp index dae13803f2515..390e800664350 100644 --- a/src/martialarts.cpp +++ b/src/martialarts.cpp @@ -1266,7 +1266,7 @@ bool character_martial_arts::can_use_attack_vector( const Character &user, std:: bool always_ok = av == "HEAD" || av == "TORSO"; bool weapon_ok = av == "WEAPON" && valid_weapon && healthy_arm; bool arm_ok = ( av == "HAND" || av == "FINGER" || av == "WRIST" || av == "ARM" || av == "ELBOW" || - av == "SHOULDER" ) && healthy_arm; + av == "HAND_BACK" || av == "PALM" || av == "SHOULDER" ) && healthy_arm; bool arms_ok = ( av == "GRAPPLE" || av == "THROW" ) && healthy_arms; bool legs_ok = ( av == "FOOT" || av == "LOWER_LEG" || av == "KNEE" || av == "HIP" ) && healthy_legs; diff --git a/src/melee.cpp b/src/melee.cpp index b5e40ad3003d8..49115704caa89 100644 --- a/src/melee.cpp +++ b/src/melee.cpp @@ -733,6 +733,12 @@ bool Character::melee_attack_abstract( Creature &t, bool allow_special, } else if( attack_vector == "WRIST" ) { covers = worn_item.covers( sub_bodypart_id( "hand_wrist_l" ) ) && worn_item.covers( sub_bodypart_id( "hand_wrist_r" ) ); + } else if( attack_vector == "PALM" ) { + covers = worn_item.covers( sub_bodypart_id( "hand_palm_l" ) ) && + worn_item.covers( sub_bodypart_id( "hand_palm_r" ) ); + } else if( attack_vector == "HAND_BACK" ) { + covers = worn_item.covers( sub_bodypart_id( "hand_back_l" ) ) && + worn_item.covers( sub_bodypart_id( "hand_back_r" ) ); } else if( attack_vector == "SHOULDER" ) { covers = worn_item.covers( sub_bodypart_id( "arm_shoulder_l" ) ) && worn_item.covers( sub_bodypart_id( "arm_shoulder_r" ) ); From 1c138c123502211f341eb29579552822b3b57223 Mon Sep 17 00:00:00 2001 From: Hymore246 Date: Thu, 24 Feb 2022 15:13:19 -0600 Subject: [PATCH 18/18] simplified condition statement --- src/martialarts.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/martialarts.cpp b/src/martialarts.cpp index 83fc44aa2cc37..c7eb2be199837 100644 --- a/src/martialarts.cpp +++ b/src/martialarts.cpp @@ -1270,11 +1270,7 @@ bool character_martial_arts::can_use_attack_vector( const Character &user, std:: bool arms_ok = ( av == "GRAPPLE" || av == "THROW" ) && healthy_arms; bool legs_ok = ( av == "FOOT" || av == "LOWER_LEG" || av == "KNEE" || av == "HIP" ) && healthy_legs; - if( always_ok || weapon_ok || arm_ok || arms_ok || legs_ok ) { - return true; - } - - return false; + return always_ok || weapon_ok || arm_ok || arms_ok || legs_ok; } bool character_martial_arts::can_leg_block( const Character &owner ) const