-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ternaries in spell costs work the opposite of the way the game shows that they should #69751
Comments
That is odd |
Is the casting time supposed to be 20 seconds? The listed casting time in the screenshot is accurate (it takes over 30 minutes to cast) |
oh no, i forgot that i used debug mana that increases time to cast for 50 times; |
Spell cost is evaluated after casting the spell Cataclysm-DDA/src/activity_handlers.cpp Lines 3778 to 3783 in bdaa430
This should fix itdiff --git a/src/activity_handlers.cpp b/src/activity_handlers.cpp
index d6b19b2ad4..6869b50647 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 );
+ 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 ); But I can't say for sure it wasn't intentional |
Describe the bug
#69464 switched Karma Arms and a couple other spells to using a ternary to determine spell cost and casting time, so that turning them on takes time and mana and turning them off is free. This is reflected in the UI, which shows that Karma Arms costs 200 mana to cast and 0 mana to remove.
However, in-game the opposite happens--Karma Arms is free to cast and costs 200 mana to remove. Casting time works properly.
Attach save file
Ohio City-trimmed.tar.gz
Steps to reproduce
Expected behavior
Spell casting costs work the way the spellcasting screen says they should.
Screenshots
Screenshots
Turning on Karma Arms:Status screen afterwards (note Mana)
Turning off Karma Arms:
Status screen afterwards (note Mana)
Versions and configuration
Dark Days Ahead [dda],
Disable NPC Needs [no_npc_food],
Portal Storms Ignore NPCs [personal_portal_storms],
Slowdown Fungal Growth [no_fungal_growth],
No Rail Stations [No_Rail_Stations],
Xedra Evolved [xedra_evolved]
]
Additional context
The linked PR has the same formula for both cost and time, and time works properly, so there might be something odd in the spell cost code specifically.
I also tested Stalker's Oculars and Devil's Tail and the same bug occurs (and also occurs when I tested it with a Mind Over Matter power).
The text was updated successfully, but these errors were encountered: