diff --git a/data/mods/Aftershock/ammo_effects.json b/data/mods/Aftershock/ammo_effects.json index b514adaedf790..675d3420f11f9 100644 --- a/data/mods/Aftershock/ammo_effects.json +++ b/data/mods/Aftershock/ammo_effects.json @@ -46,6 +46,11 @@ "type": "ammo_effect", "aoe": { "field_type": "fd_toxic_foam", "intensity_min": 1, "intensity_max": 4, "chance": 70, "radius": 1 } }, + { + "id": "ELECTRIC_CHAIN", + "type": "ammo_effect", + "spell_data": { "id": "spell_electric_chain" } + }, { "id": "MULTI_EFFECTS", "type": "ammo_effect", diff --git a/data/mods/Aftershock/itemgroups/weapons/energy_gun_groups.json b/data/mods/Aftershock/itemgroups/weapons/energy_gun_groups.json index e3f92ccc72d5d..0a34bcfb36df0 100644 --- a/data/mods/Aftershock/itemgroups/weapons/energy_gun_groups.json +++ b/data/mods/Aftershock/itemgroups/weapons/energy_gun_groups.json @@ -91,7 +91,7 @@ "subtype": "distribution", "ammo": 100, "magazine": 100, - "items": [ [ "afs_electro_anomaly_rifle", 1 ], [ "afs_voltaic_pistol", 90 ] ] + "items": [ [ "afs_electro_anomaly_rifle", 1 ], [ "afs_voltaic_pistol", 90 ], [ "afs_archangel_enr", 9 ] ] }, { "id": "afs_any_voltaic_mag", diff --git a/data/mods/Aftershock/items/gun/voltaic.json b/data/mods/Aftershock/items/gun/voltaic.json index 51a7333c6f0d1..b11b2c1a90b35 100644 --- a/data/mods/Aftershock/items/gun/voltaic.json +++ b/data/mods/Aftershock/items/gun/voltaic.json @@ -25,6 +25,32 @@ "ammo_effects": [ "ELECTRO_ANOMALY" ], "flags": [ "NEVER_JAMS", "NON_FOULING", "NEEDS_NO_LUBE" ] }, + { + "id": "afs_archangel_enr", + "type": "GUN", + "copy-from": "laser_rifle", + "name": { "str": "W3310 Archangel ENR" }, + "description": "A powerful anti-drone defense weapon, the W3310 Archangel is capable of firing a chain of electrical discharges that can arc between multiple targets. Most effective against groups of lightly armored foes, use within closed spaces is not recommended due to the risk of self-inflicted injury.", + "price": "22 kUSD", + "price_postapoc": "22 kUSD", + "ammo": [ "battery" ], + "ammo_to_fire": 0, + "energy_drain": "75 kJ", + "modes": [ [ "DEFAULT", "Pulse ", 1 ] ], + "ranged_damage": [ { "damage_type": "electric", "amount": 15 } ], + "pocket_data": [ + { + "pocket_type": "MAGAZINE_WELL", + "holster": true, + "max_contains_volume": "20 L", + "max_contains_weight": "20 kg", + "magazine_well": "75 ml", + "item_restriction": [ "afs_voltaic_cartridge" ] + } + ], + "ammo_effects": [ "ELECTRIC_CHAIN" ], + "flags": [ "NEVER_JAMS", "NON_FOULING", "NEEDS_NO_LUBE" ] + }, { "id": "afs_voltaic_pistol", "type": "GUN", diff --git a/data/mods/Aftershock/spells.json b/data/mods/Aftershock/spells.json index 28dd2c93f2427..1ec2b081b9cd8 100644 --- a/data/mods/Aftershock/spells.json +++ b/data/mods/Aftershock/spells.json @@ -187,6 +187,69 @@ "effect": "effect_on_condition", "effect_str": "afs_motion_sensor_eoc" }, + { + "id": "spell_electric_chain", + "type": "SPELL", + "name": "Superconductive Arc", + "description": "Your weapon arcs electricity to a nearby target.", + "effect": "attack", + "shape": "line", + "valid_targets": [ "hostile", "ground" ], + "flags": [ "SOMATIC", "NO_LEGS", "RANDOM_TARGET", "NO_EXPLOSION_SFX", "RANDOM_DAMAGE" ], + "min_damage": 15, + "max_damage": 15, + "min_range": 15, + "max_range": 15, + "extra_effects": [ { "id": "spell_electric_chain_2" } ], + "difficulty": 1, + "sound_description": "a crackle", + "damage_type": "electric" + }, + { + "id": "spell_electric_chain_2", + "type": "SPELL", + "name": "Superconductive Arc II", + "description": "Your bionic weapon arcs electricity to a nearby target.", + "effect": "attack", + "shape": "blast", + "valid_targets": [ "ally", "hostile", "ground" ], + "flags": [ "LOUD", "RANDOM_TARGET", "RANDOM_CRITTER", "NO_EXPLOSION_SFX", "NO_PROJECTILE" ], + "min_damage": 10, + "max_damage": 15, + "extra_effects": [ { "id": "spell_electric_chain_3" } ], + "min_range": 4, + "max_range": 4, + "min_aoe": 2, + "max_aoe": 2, + "field_id": "fd_electricity", + "min_field_intensity": 1, + "max_field_intensity": 1, + "field_chance": 5, + "damage_type": "electric", + "sound_description": "a crackle" + }, + { + "id": "spell_electric_chain_3", + "type": "SPELL", + "name": "Superconductive Arc III", + "description": "Your bionic weapon arcs electricity to a nearby target.", + "effect": "attack", + "shape": "blast", + "valid_targets": [ "ally", "hostile", "ground" ], + "flags": [ "LOUD", "RANDOM_TARGET", "RANDOM_CRITTER", "NO_EXPLOSION_SFX", "NO_PROJECTILE" ], + "min_damage": 10, + "max_damage": 15, + "min_range": 4, + "max_range": 4, + "min_aoe": 2, + "max_aoe": 2, + "field_id": "fd_electricity", + "min_field_intensity": 1, + "max_field_intensity": 1, + "field_chance": 5, + "damage_type": "electric", + "sound_description": "a crackle" + }, { "id": "bio_blade_electric_arc", "type": "SPELL", @@ -194,8 +257,8 @@ "description": "Your bionic weapon arcs electricity to a nearby target.", "effect": "attack", "shape": "blast", - "valid_targets": [ "hostile" ], - "flags": [ "SOMATIC", "NO_LEGS", "RANDOM_TARGET", "RANDOM_DAMAGE" ], + "valid_targets": [ "hostile", "ally", "self" ], + "flags": [ "LOUD", "RANDOM_TARGET", "RANDOM_DAMAGE", "RANDOM_AOE" ], "max_level": 1, "min_damage": 5, "max_damage": 15, @@ -213,8 +276,8 @@ "description": "Your bionic weapon arcs electricity to a nearby target.", "effect": "attack", "shape": "blast", - "valid_targets": [ "hostile" ], - "flags": [ "SOMATIC", "NO_LEGS", "RANDOM_TARGET", "RANDOM_DAMAGE" ], + "valid_targets": [ "hostile", "ally", "self" ], + "flags": [ "LOUD", "RANDOM_TARGET", "RANDOM_DAMAGE", "RANDOM_AOE" ], "max_level": 1, "min_damage": 5, "max_damage": 15, diff --git a/src/ammo_effect.cpp b/src/ammo_effect.cpp index 03f75f9b0c138..945338a42517f 100644 --- a/src/ammo_effect.cpp +++ b/src/ammo_effect.cpp @@ -93,6 +93,8 @@ void ammo_effect::load( const JsonObject &jo, const std::string_view ) optional( jo, was_loaded, "do_flashbang", do_flashbang, false ); optional( jo, was_loaded, "do_emp_blast", do_emp_blast, false ); optional( jo, was_loaded, "foamcrete_build", foamcrete_build, false ); + optional( jo, was_loaded, "spell_data", spell_data ); + } diff --git a/src/ammo_effect.h b/src/ammo_effect.h index c066a928cdd2b..1e56ddd624845 100644 --- a/src/ammo_effect.h +++ b/src/ammo_effect.h @@ -10,6 +10,7 @@ #include "explosion.h" #include "field_type.h" +#include "magic.h" #include "type_id.h" class JsonObject; @@ -23,6 +24,7 @@ struct ammo_effect { void load( const JsonObject &jo, std::string_view src ); void finalize(); void check() const; + fake_spell spell_data; field_type_id aoe_field_type = fd_null.id_or( INVALID_FIELD_TYPE_ID ); /** used during JSON loading only */ diff --git a/src/projectile.cpp b/src/projectile.cpp index 127242d25a2bd..8a793551c56b7 100644 --- a/src/projectile.cpp +++ b/src/projectile.cpp @@ -184,10 +184,17 @@ void apply_ammo_effects( const Creature *source, const tripoint &p, if( ae.foamcrete_build ) { foamcrete_build( p ); } + //cast ammo effect spells + const spell ammo_spell = ae.spell_data.get_spell(); + if( ammo_spell.is_valid() ) { + ammo_spell.cast_all_effects( *const_cast( source ), p ); + ammo_spell.make_sound( p, *const_cast( source ) ); + } } } } + int max_aoe_size( const std::set &tags ) { int aoe_size = 0;