Skip to content

Commit

Permalink
feat(balance): Permit One-handed casting (#5919)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
RobbieNeko and autofix-ci[bot] authored Jan 11, 2025
1 parent 287fb52 commit 3bcc1a4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/handle_action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions src/magic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 3bcc1a4

Please sign in to comment.