From 3bcc1a4fe812cdfe9bcf5385d972201855053aa9 Mon Sep 17 00:00:00 2001 From: RobbieNeko <30732426+RobbieNeko@users.noreply.github.com> Date: Sat, 11 Jan 2025 13:26:07 -0500 Subject: [PATCH] feat(balance): Permit One-handed casting (#5919) * One-handed casting Allow one-handed weapons to impede, but not stop, casting. * style(autofix.ci): automated formatting * fix import type on flag.h should we even be importing it? Idk --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> --- src/handle_action.cpp | 2 +- src/magic.cpp | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/handle_action.cpp b/src/handle_action.cpp index 8b4c94fb2565..a1ef05bf409c 100644 --- a/src/handle_action.cpp +++ b/src/handle_action.cpp @@ -1456,7 +1456,7 @@ static void cast_spell() spell &sp = *u.magic->get_spells()[spell_index]; if( u.is_armed() && !sp.has_flag( spell_flag::NO_HANDS ) && - !u.primary_weapon().has_flag( flag_MAGIC_FOCUS ) ) { + !u.primary_weapon().has_flag( flag_MAGIC_FOCUS ) && u.primary_weapon().is_two_handed( u ) ) { add_msg( game_message_params{ m_bad, gmf_bypass_cooldown }, _( "You need your hands free to cast this spell!" ) ); return; diff --git a/src/magic.cpp b/src/magic.cpp index d294e15454a5..9be46ac7fdf4 100644 --- a/src/magic.cpp +++ b/src/magic.cpp @@ -25,6 +25,7 @@ #include "enums.h" #include "event.h" #include "field.h" +#include "flag.h" #include "game.h" #include "generic_factory.h" #include "input.h" @@ -737,6 +738,10 @@ int spell::casting_time( const Character &guy ) const guy.encumb( body_part_arm_l ) + guy.encumb( body_part_arm_r ) - 20 ); casting_time += arms_encumb * 2; } + if( guy.is_armed() && !has_flag( spell_flag::NO_HANDS ) && + !guy.primary_weapon().has_flag( flag_MAGIC_FOCUS ) ) { + casting_time = std::round( casting_time * 1.5 ); + } return casting_time; }