diff --git a/doc/MARTIALART_JSON.md b/doc/MARTIALART_JSON.md index 35a72dfed4565..0214ff974d363 100644 --- a/doc/MARTIALART_JSON.md +++ b/doc/MARTIALART_JSON.md @@ -51,6 +51,7 @@ "forbidden_buffs_all": [ "eskrima_hit_buff" ], // This technique is forbidden if all of the named buffs are active "req_flags": [ "" ] // List of item flags the used weapon needs to be eligible for the technique "required_char_flags": [ "" ] // List of "character" (bionic, trait, effect or bodypart) flags the character needs to be able to use this technique +"required_char_flags_all": [ ""] // This technique requires all of the listed character flags to trigger "forbidden_char_flags": [ "" ] // List of character flags disabling this technique "crit_tec" : true, // This technique only works on a critical hit "crit_ok" : true, // This technique works on both normal and critical hits diff --git a/src/martialarts.cpp b/src/martialarts.cpp index a9efa74845fd7..0c41a6a0c09f4 100644 --- a/src/martialarts.cpp +++ b/src/martialarts.cpp @@ -212,6 +212,7 @@ void ma_requirements::load( const JsonObject &jo, const std::string & ) optional( jo, was_loaded, "req_flags", req_flags, string_id_reader<::json_flag> {} ); optional( jo, was_loaded, "required_char_flags", req_char_flags ); + optional( jo, was_loaded, "required_char_flags_all", req_char_flags_all ); optional( jo, was_loaded, "forbidden_char_flags", forbidden_char_flags ); optional( jo, was_loaded, "skill_requirements", min_skill, ma_skill_reader {} ); @@ -612,6 +613,14 @@ bool ma_requirements::is_valid_character( const Character &u ) const } } + if( !req_char_flags_all.empty() ) { + for( const json_character_flag &flag : req_char_flags_all ) { + if( !u.has_flag( flag ) ) { + return false; + } + } + } + if( !forbidden_char_flags.empty() ) { bool has_flag = false; for( const json_character_flag &flag : forbidden_char_flags ) { diff --git a/src/martialarts.h b/src/martialarts.h index b316b4fc52598..9b13f315e6950 100644 --- a/src/martialarts.h +++ b/src/martialarts.h @@ -82,7 +82,8 @@ struct ma_requirements { std::set req_flags; // any item flags required for this technique - cata::flat_set req_char_flags; // Character flags required + cata::flat_set req_char_flags; // any listed character flags required + cata::flat_set req_char_flags_all; // all listed character flags required cata::flat_set forbidden_char_flags; // Character flags disabling the technique ma_requirements() {