From dfb8658ab414f96ba2111e7d5db6fc4a08a1bb73 Mon Sep 17 00:00:00 2001 From: Standing-Storm <120433252+Standing-Storm@users.noreply.github.com> Date: Sun, 26 Nov 2023 11:36:47 -0600 Subject: [PATCH] Move spell cost calculation up slightly to account for spell cost ternaries (#69760) * Initial commit * Update src/activity_handlers.cpp Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- src/activity_handlers.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/activity_handlers.cpp b/src/activity_handlers.cpp index d6b19b2ad42a7..aae8b2c3a2b26 100644 --- a/src/activity_handlers.cpp +++ b/src/activity_handlers.cpp @@ -3775,11 +3775,12 @@ void activity_handlers::spellcasting_finish( player_activity *act, Character *yo // spells with the components in hand. spell_being_cast.use_components( *you ); + // pay the cost. Allows ternaries based on having an effect or trait to calculate cost correctly + int cost = spell_being_cast.energy_cost( *you ); + spell_being_cast.cast_all_effects( *you, *target ); if( act->get_value( 2 ) != 0 ) { - // pay the cost - int cost = spell_being_cast.energy_cost( *you ); switch( spell_being_cast.energy_source() ) { case magic_energy_type::mana: you->magic->mod_mana( *you, -cost );