diff --git a/data/json/artifact/altered_object_active.json b/data/json/artifact/altered_object_active.json index 6a8f44ea6e028..ea7c9c549cfc8 100644 --- a/data/json/artifact/altered_object_active.json +++ b/data/json/artifact/altered_object_active.json @@ -7,6 +7,7 @@ "valid_targets": [ "ground" ], "effect": "summon", "effect_str": "mon_vortex", + "shape": "blast", "base_casting_time": 100, "message": "Space twists and deforms around you.", "min_damage": 1, @@ -25,6 +26,7 @@ "valid_targets": [ "ground" ], "effect": "summon", "effect_str": "mon_hound_tindalos", + "shape": "blast", "base_casting_time": 100, "message": "The world unravels into geometric shapes, and between the chaos you spot a horrid prowling beast.", "min_damage": 1, @@ -41,6 +43,7 @@ "name": "Artifact Force Pull", "description": "Pull objects.", "effect": "area_pull", + "shape": "blast", "valid_targets": [ "self", "ally", "hostile", "ground", "item", "field" ], "message": "An unnatural implosion sends objects flying.", "min_range": 15, @@ -58,6 +61,7 @@ "valid_targets": [ "self" ], "effect": "spawn_item", "effect_str": "artifact_teleportitis_aura", + "shape": "blast", "base_casting_time": 100, "min_duration": 4000, "max_duration": 4000 @@ -71,6 +75,7 @@ "valid_targets": [ "self" ], "effect": "spawn_item", "effect_str": "artifact_slow_aura", + "shape": "blast", "base_casting_time": 100, "min_duration": 900, "max_duration": 900 @@ -83,6 +88,7 @@ "message": "Stale golden light floods the world, and reality stands still.", "valid_targets": [ "self" ], "effect": "mod_moves", + "shape": "blast", "min_damage": 500, "max_damage": 500, "base_casting_time": 100 @@ -94,8 +100,10 @@ "description": "Grants you the Darkness effect", "message": "Persistent shadows invade your field of view.", "valid_targets": [ "self" ], - "effect": "target_attack", + "flags": [ "NO_PROJECTILE" ], + "effect": "attack", "effect_str": "darkness", + "shape": "blast", "min_duration": 2400, "max_duration": 2400 }, @@ -108,7 +116,8 @@ "min_damage": 0, "max_damage": 10, "valid_targets": [ "self" ], - "flags": [ "RANDOM_DAMAGE" ], - "effect": "target_attack" + "flags": [ "RANDOM_DAMAGE", "NO_PROJECTILE" ], + "shape": "blast", + "effect": "attack" } ] diff --git a/src/magic_spell_effect_helpers.h b/src/magic_spell_effect_helpers.h index 27229f47c9221..62fd569367837 100644 --- a/src/magic_spell_effect_helpers.h +++ b/src/magic_spell_effect_helpers.h @@ -12,7 +12,6 @@ struct tripoint; // spells do not reduce in damage the further away from the epicenter the targets are // rather they do their full damage in the entire area of effect std::set calculate_spell_effect_area( const spell &sp, const tripoint &target, - const std::function( const spell &, const tripoint &, const tripoint &, int, bool )> - &aoe_func, const Creature &caster, bool ignore_walls = false ); + const Creature &caster ); #endif // CATA_SRC_MAGIC_SPELL_EFFECT_HELPERS_H diff --git a/src/ranged.cpp b/src/ranged.cpp index 5d815a9fb0858..379b9740e1190 100644 --- a/src/ranged.cpp +++ b/src/ranged.cpp @@ -2360,15 +2360,23 @@ bool target_ui::set_cursor_pos( const tripoint &new_pos ) if( mode == TargetMode::Fire ) { recalc_aim_turning_penalty(); } else if( mode == TargetMode::Spell ) { - const std::string fx = casting->effect(); - if( fx == "target_attack" || fx == "projectile_attack" || fx == "ter_transform" ) { - spell_aoe = spell_effect::spell_effect_blast( *casting, src, dst, casting->aoe(), true ); - } else if( fx == "cone_attack" ) { - spell_aoe = spell_effect::spell_effect_cone( *casting, src, dst, casting->aoe(), true ); - } else if( fx == "line_attack" ) { - spell_aoe = spell_effect::spell_effect_line( *casting, src, dst, casting->aoe(), true ); - } else { - spell_aoe.clear(); + switch( casting->shape() ) { + case spell_shape::blast: + spell_aoe = spell_effect::spell_effect_blast( + spell_effect::override_parameters( *casting ), src, dst ); + break; + case spell_shape::cone: + spell_aoe = spell_effect::spell_effect_cone( + spell_effect::override_parameters( *casting ), src, dst ); + break; + case spell_shape::line: + spell_aoe = spell_effect::spell_effect_line( + spell_effect::override_parameters( *casting ), src, dst ); + break; + default: + spell_aoe.clear(); + debugmsg( "%s does not have valid spell shape", casting->id().str() ); + break; } } else if( mode == TargetMode::Turrets ) { update_turrets_in_range(); diff --git a/tests/magic_spell_effect_test.cpp b/tests/magic_spell_effect_test.cpp index 55f29b345075b..7acdc4e285c0d 100644 --- a/tests/magic_spell_effect_test.cpp +++ b/tests/magic_spell_effect_test.cpp @@ -48,8 +48,7 @@ TEST_CASE( "line_attack", "[magic]" ) SECTION( "aoe=0" ) { const std::set reference( { tripoint_east * 1, tripoint_east * 2, tripoint_east * 3, tripoint_east * 4, tripoint_east * 5 } ); - std::set targets = calculate_spell_effect_area( sp, target, - spell_effect::spell_effect_line, c, true ); + std::set targets = calculate_spell_effect_area( sp, target, c ); CHECK( reference == targets ); }