From bb811f37bd2575541edd83a07794f2b875682eea Mon Sep 17 00:00:00 2001 From: Vollch Date: Tue, 10 Oct 2023 16:29:49 +0300 Subject: [PATCH] Item summoning spells should respect "Keep hands free" (#3405) --- src/character_martial_arts.h | 2 +- src/magic_spell_effect.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/character_martial_arts.h b/src/character_martial_arts.h index 77c21767f2aa..d3662f8de1b2 100644 --- a/src/character_martial_arts.h +++ b/src/character_martial_arts.h @@ -19,7 +19,6 @@ class character_martial_arts private: std::vector ma_styles; matype_id style_selected = matype_id( "style_none" ); - bool keep_hands_free = false; public: character_martial_arts(); character_martial_arts( const std::vector &styles, @@ -32,6 +31,7 @@ class character_martial_arts void reset_style(); // checks that style selected is one that is known, otherwise resets it void selected_style_check(); + bool keep_hands_free = false; /** Creates the UI and handles player input for picking martial arts styles */ bool pick_style( const avatar &you ); diff --git a/src/magic_spell_effect.cpp b/src/magic_spell_effect.cpp index cb870518375e..3502f277d941 100644 --- a/src/magic_spell_effect.cpp +++ b/src/magic_spell_effect.cpp @@ -18,6 +18,7 @@ #include "avatar.h" #include "bodypart.h" #include "calendar.h" +#include "character_martial_arts.h" #include "character.h" #include "color.h" #include "creature.h" @@ -740,7 +741,7 @@ void spell_effect::spawn_ethereal_item( const spell &sp, Creature &caster, const if( you.can_wear( granted ).success() ) { granted.set_flag( flag_id( "FIT" ) ); you.wear_item( granted, false ); - } else if( !you.is_armed() ) { + } else if( !you.is_armed() && !you.martial_arts_data->keep_hands_free ) { you.set_primary_weapon( granted ); } else { you.i_add( granted );