From 69428b9f4cc318b81b29db4b38e2867bdb6d1380 Mon Sep 17 00:00:00 2001 From: GuardianDll Date: Sat, 9 Sep 2023 20:56:44 +0200 Subject: [PATCH 1/4] Initial commit --- data/json/ammo_effects.json | 227 +++++++++++++++--- data/json/items/gun/ups.json | 2 +- .../monster_special_attacks/monster_gun.json | 2 +- data/mods/Aftershock/items/ammo_effects.json | 1 + .../Xedra_Evolved/items/inventor/gun.json | 4 +- doc/JSON_FLAGS.md | 99 +------- doc/JSON_INFO.md | 49 +++- src/creature.cpp | 4 +- src/magic.cpp | 2 +- 9 files changed, 246 insertions(+), 144 deletions(-) diff --git a/data/json/ammo_effects.json b/data/json/ammo_effects.json index 226be57f2cee8..db364a5ddea9e 100644 --- a/data/json/ammo_effects.json +++ b/data/json/ammo_effects.json @@ -23,83 +23,268 @@ "do_flashbang": false, "do_emp_blast": false }, + { + "id": "NO_PENETRATE_OBSTACLES", + "type": "ammo_effect", + "//": "Prevents a projectile from going through a tile with obstacles, such as chainlink fences or dressers. Hardcoded" + }, + { + "id": "BEANBAG", + "type": "ammo_effect", + "//": "Stuns the target. Hardcoded" + }, + { + "id": "LARGE_BEANBAG", + "type": "ammo_effect", + "//": "Heavily stuns the target. Hardcoded" + }, + { + "id": "DRAW_AS_LINE", + "type": "ammo_effect", + "//": "Doesn't go through regular bullet animation; instead draws a line and the bullet on its end for one frame. Hardcoded" + }, + { + "id": "APPLY_SAP", + "type": "ammo_effect", + "//": "Applies sap-coated effect on hit, used with special hardcoded monster attack. Hardcoded" + }, + { + "id": "BLINDS_EYES", + "type": "ammo_effect", + "//": "Blinds the target if it hits the head. Hardcoded" + }, + { + "id": "BOUNCE", + "type": "ammo_effect", + "//": "Inflicts target with `bounced` effect and rebounds to a nearby target without this effect. Hardcoded" + }, + { + "id": "BURST", + "type": "ammo_effect", + "//": "Ammo effect, applied to thrown projectile, when it has 'burst_when_filled' defined, which makes it spills the contents on hit. Hardcoded, and probably can't be used as actual ammo effect" + }, + { + "id": "COOKOFF", + "type": "ammo_effect", + "//": "Ammo item explodes when lit on fire. Hardcoded" + }, + { + "id": "BLACKPOWDER", + "type": "ammo_effect", + "//": "This ammo may clog up the gun with blackpowder fouling, which will also cause rust. Hardcoded" + }, + { + "id": "HEAVY_HIT", + "type": "ammo_effect", + "//": "Automatically applied to any projectile, heavier than 500g, to increase it's noise (currently used only when projectile fall into water). Hardcoded" + }, + { + "id": "INCENDIARY", + "type": "ammo_effect", + "//": "Creature, that got hit with this projectile, would be ignited for a short duration, up to 4 seconds, (6 if creature is made out of flammable material or made out of veggy). Hardcoded" + }, + { + "id": "IGNITE", + "type": "ammo_effect", + "//": "Same as INCENDIARY, creature that got hit with this projectile, would be ignited for a short duration, up to 6 seconds, (10 if creature is made out of flammable material or made out of veggy). Hardcoded" + }, + { + "id": "JET", + "type": "ammo_effect", + "//": "For curses build, draws a `*` symbol as a flying projectile (unlike usual `#` symbol). Hardcoded" + }, + { + "id": "MATCHHEAD", + "type": "ammo_effect", + "//": "Bullet has a chance of damaging the gun from overpressure regardless of fouling level, used in . Hardcoded" + }, + { + "id": "MAGIC", + "type": "ammo_effect", + "//": "Always best possible hit, no damage multipliers. Hardcoded" + }, + { + "id": "MUZZLE_SMOKE", + "type": "ammo_effect", + "//": "Generate a small cloud of smoke at the source. Hardcoded" + }, + { + "id": "NEVER_MISFIRES", + "type": "ammo_effect", + "//": "Firing ammo without this flag may trigger a misfiring, this is independent of the weapon flags. Hardcoded" + }, + { + "id": "NO_DAMAGE_SCALING", + "type": "ammo_effect", + "//": "Always set 100% damage due to hit in the weakpoint. Hardcoded" + }, + { + "id": "NO_EMBED", + "type": "ammo_effect", + "//": "When an item would be spawned from the projectile, it will always be spawned on the ground rather than in a monster's inventory. Implied for active thrown items. Doesn't do anything on projectiles that do not drop items. Hardcoded" + }, + { + "id": "NOGIB", + "type": "ammo_effect", + "//": "Prevents overkill damage on the target (target won't explode into gibs, same as monster's flag `NOGIB`). Hardcoded" + }, + { + "id": "NO_ITEM_DAMAGE", + "type": "ammo_effect", + "//": "Will not damage items on the map even when it otherwise would try to. Hardcoded" + }, + { + "id": "NON_FOULING", + "type": "ammo_effect", + "//": "This ammo does not cause dirtying or blackpowder fouling on the gun when fired. Hardcoded" + }, + { + "id": "NO_OVERSHOOT", + "type": "ammo_effect", + "//": "Projectiles with this effect won't fly farther than player's set target tile. Hardcoded" + }, + { + "id": "NPC_AVOID", + "type": "ammo_effect", + "//": "NPCs won't use guns or gunmods loaded with ammo with this effect. Hardcoded" + }, + { + "id": "NULL_SOURCE", + "type": "ammo_effect", + "//": "Projectiles with this effect doesn't have a creature who fired them; applied only to explosives' shrapnel. Hardcoded" + }, + { + "id": "PARALYZEPOISON", + "type": "ammo_effect", + "//": "Applies paralyzing poison effect on damaging hit. Hardcoded" + }, + { + "id": "ROBOT_DAZZLE", + "type": "ammo_effect", + "//": "Applies sensor-stunning effect to robots. Hardcoded" + }, + { + "id": "RECOVER_X", + "type": "ammo_effect", + "//": " Has a [(X-1)/X] probability to create a single charge of the used ammo at the point of impact. Change the X with any number, like 'RECOVER_2' means [(2-1)/2]=50% chance. Hardcoded" + }, + { + "id": "RECYCLED", + "type": "ammo_effect", + "//": "Causes the gun to misfire sometimes, used in handloaded ammo; this is independent of the weapon flags. Hardcoded" + }, + { + "id": "SHATTER_SELF", + "type": "ammo_effect", + "//": "Destroys itself and creates shards on hit. Applied to any projectile (usually throwing one), if it has glass as material, and not active. Hardcoded" + }, + { + "id": "SHOT", + "type": "ammo_effect", + "//": "Multiple smaller pellets; less effective against armor but increases chance to hit and no point-blank penalty. Hardcoded" + }, + { + "id": "WIDE", + "type": "ammo_effect", + "//": "Prevent HARDTOSHOOT monster flag from having any effect; automatically applied to ammo with `SHOT` flag or which have liquid phase. Hardcoded" + }, + { + "id": "CASELESS_ROUNDS", + "type": "ammo_effect", + "//": "This ammo is caseless rounds that cannot be disassembled or reloaded. Hardcoded" + }, { "id": "FLAME", "type": "ammo_effect", + "//": "Very small explosion that lights fires", "aoe": { "field_type": "fd_fire", "intensity_min": 1, "intensity_max": 1, "size": 3 } }, { "id": "NAPALM", "type": "ammo_effect", + "//": "Explosion that spreads fire", "aoe": { "field_type": "fd_fire", "intensity_min": 1, "intensity_max": 1, "size": 3 }, "explosion": { "power": 60, "distance_factor": 0.7, "fire": true } }, { "id": "NAPALM_BIG", "type": "ammo_effect", + "//": "Large explosion that spreads fire", "aoe": { "field_type": "fd_fire", "intensity_min": 1, "intensity_max": 1, "radius": 3, "size": 4 }, "explosion": { "power": 360, "distance_factor": 0.8, "fire": true } }, { "id": "NAPALM_TBG7V", "type": "ammo_effect", + "//": "Creates a large fire on hit", "aoe": { "field_type": "fd_fire", "intensity_min": 1, "intensity_max": 1, "radius": 3, "size": 4 } }, { "id": "PYROPHORIC", "type": "ammo_effect", + "//": "Large explosion that spreads fire of high intensity", "aoe": { "field_type": "fd_fire", "intensity_min": 2, "intensity_max": 2, "radius": 3 }, "explosion": { "power": 360, "distance_factor": 0.8, "fire": true } }, { "id": "ACIDBOMB", "type": "ammo_effect", + "//": "Leaves a pool of acid on detonation", "aoe": { "field_type": "fd_acid", "intensity_min": 3, "intensity_max": 3 } }, { "id": "TOXICGAS", "type": "ammo_effect", + "//": "Creates a cloud of toxic gas on hit", "aoe": { "field_type": "fd_toxic_gas", "intensity_min": 3, "intensity_max": 3 } }, { "id": "GAS_FUNGICIDAL", "type": "ammo_effect", + "//": "Creates a cloud of fungicidal gas on hit", "aoe": { "field_type": "fd_fungicidal_gas", "intensity_min": 3, "intensity_max": 3 } }, { "id": "GAS_INSECTICIDAL", "type": "ammo_effect", + "//": "Creates a cloud of insecticidal gas on hit", "aoe": { "field_type": "fd_insecticidal_gas", "intensity_min": 3, "intensity_max": 3 } }, { "id": "SMOKE", "type": "ammo_effect", + "//": "Generates a cloud of smoke at the target", "aoe": { "field_type": "fd_smoke", "intensity_min": 3, "intensity_max": 3 } }, { "id": "SMOKE_BIG", "type": "ammo_effect", + "//": "Generates a large cloud of smoke at the target", "aoe": { "field_type": "fd_smoke", "intensity_min": 3, "intensity_max": 3, "radius": 6 } }, { "id": "FLARE", "type": "ammo_effect", + "//": "Lights the target tile on fire", "aoe": { "field_type": "fd_fire", "intensity_min": 1, "intensity_max": 1 } }, { "id": "LIGHTNING", "type": "ammo_effect", + "//": "Creates a trail of lightning", "aoe": { "field_type": "fd_electricity", "intensity_min": 6, "intensity_max": 10, "chance": 25 } }, { "id": "PLASMA", "type": "ammo_effect", + "//": "Creates a trail of superheated plasma", "aoe": { "field_type": "fd_plasma", "intensity_min": 2, "intensity_max": 3, "chance": 50 }, "trail": { "field_type": "fd_plasma", "intensity_min": 1, "intensity_max": 2, "chance": 50 } }, { "id": "PLASMA_BUBBLE", "type": "ammo_effect", + "//": "Creates a cloud of superheated plasma", "aoe": { "field_type": "fd_plasma", "intensity_min": 1, "intensity_max": 3, "radius": 1, "chance": 10 } }, { @@ -130,11 +315,13 @@ { "id": "FRAG", "type": "ammo_effect", + "//": "Small explosion that spreads shrapnel", "explosion": { "power": 185, "shrapnel": { "casing_mass": 212, "fragment_mass": 0.025 } } }, { "id": "FRAG_20x66", "type": "ammo_effect", + "//": "Small explosion that spreads shrapnel", "explosion": { "power": 40, "shrapnel": { "casing_mass": 15, "fragment_mass": 0.08 } } }, { @@ -145,16 +332,19 @@ { "id": "EXPLOSIVE_SMALL_HOMEMADE_GRENADE_1", "type": "ammo_effect", + "//": "", "explosion": { "power": 150, "shrapnel": { "casing_mass": 200, "fragment_mass": 0.4 } } }, { "id": "EXPLOSIVE_HOMEMADE_GRENADE_1", "type": "ammo_effect", + "//": "", "explosion": { "power": 300, "shrapnel": { "casing_mass": 400, "fragment_mass": 0.4 } } }, { "id": "EXPLOSIVE_SMALL_HOMEMADE_GRENADE_2", "type": "ammo_effect", + "//": "", "explosion": { "power": 460, "shrapnel": { "casing_mass": 200, "fragment_mass": 0.4 } } }, { @@ -232,69 +422,46 @@ "type": "ammo_effect", "explosion": { "power": 7980, "shrapnel": { "casing_mass": 8725, "fragment_mass": 0.5 } } }, - { - "id": "MININUKE_MOD", - "type": "ammo_effect", - "aoe": { - "field_type": "fd_nuke_gas", - "intensity_min": 3, - "intensity_max": 3, - "radius": 18, - "size": 1, - "check_passable": true, - "check_sees": true, - "check_sees_radius": 3 - }, - "explosion": { "power": 72000000 } - }, { "id": "FLASHBANG", "type": "ammo_effect", + "//": "Blinds and deafens nearby targets", "do_flashbang": true }, { "id": "EMP", "type": "ammo_effect", + "//": "Damages 'electronic' terrain types (such as consoles or card readers) In rare cases might make card readers open doors. Damages and destroys robotic enemies. Drains bionic power and power from any electronic equipment in player possession", "do_emp_blast": true }, { "id": "TRAIL", "type": "ammo_effect", + "//": "Creates a trail of smoke", "trail": { "field_type": "fd_smoke", "intensity_min": 1, "intensity_max": 2, "chance": 75 } }, { "id": "STREAM", "type": "ammo_effect", + "//": "Leaves a trail of fire fields", "trail": { "field_type": "fd_fire", "intensity_min": 1, "intensity_max": 2, "chance": 66 } }, { "id": "STREAM_BIG", "type": "ammo_effect", + "//": "Leaves a trail of intense fire fields", "trail": { "field_type": "fd_fire", "intensity_min": 2, "intensity_max": 2, "chance": 75 } }, { "id": "STREAM_GAS_FUNGICIDAL", "type": "ammo_effect", + "//": "Leaves a trail of fungicidal gas", "trail": { "field_type": "fd_fungicidal_gas", "intensity_min": 1, "intensity_max": 2, "chance": 66 } }, - { - "id": "STREAM_GAS_INSCENTICIDAL", - "type": "ammo_effect", - "trail": { "field_type": "fd_insecticidal_gas", "intensity_min": 1, "intensity_max": 2, "chance": 66 } - }, { "id": "LASER", "type": "ammo_effect", + "//": "Creates a trail of laser", "trail": { "field_type": "fd_laser", "intensity_min": 2, "intensity_max": 2 } - }, - { - "id": "DRAW_LASER_BEAM", - "type": "ammo_effect", - "trail": { "field_type": "fd_laser", "intensity_min": 2, "intensity_max": 2 } - }, - { - "id": "NO_PENETRATE_OBSTACLES", - "type": "ammo_effect", - "//": "Don't act penetrate obstacles such as fences or reinforced glass" } ] diff --git a/data/json/items/gun/ups.json b/data/json/items/gun/ups.json index 1407b9e669666..1ad49e1e4caad 100644 --- a/data/json/items/gun/ups.json +++ b/data/json/items/gun/ups.json @@ -37,7 +37,7 @@ [ "stock accessory", 1 ], [ "underbarrel", 1 ] ], - "ammo_effects": [ "DRAW_LASER_BEAM", "EMP" ], + "ammo_effects": [ "LASER", "EMP" ], "flags": [ "NEVER_JAMS", "NO_UNLOAD", "NON_FOULING", "NEEDS_NO_LUBE", "USE_UPS", "OVERHEATS" ], "faults": [ "fault_overheat_melting", "fault_overheat_safety" ], "melee_damage": { "bash": 12 } diff --git a/data/json/monster_special_attacks/monster_gun.json b/data/json/monster_special_attacks/monster_gun.json index 42c44ca33d37c..6fb8dbc0f87ca 100644 --- a/data/json/monster_special_attacks/monster_gun.json +++ b/data/json/monster_special_attacks/monster_gun.json @@ -153,7 +153,7 @@ "type": "GUN", "name": { "str": "deterrent laser weapon" }, "energy_drain": "0 kJ", - "ammo_effects": [ "DRAW_LASER_BEAM" ], + "ammo_effects": [ "LASER" ], "ranged_damage": { "damage_type": "electric", "amount": 10, "armor_penetration": 4 }, "flags": [ "NEVER_JAMS", "NO_UNLOAD", "NON_FOULING", "NEEDS_NO_LUBE", "NO_TURRET" ] }, diff --git a/data/mods/Aftershock/items/ammo_effects.json b/data/mods/Aftershock/items/ammo_effects.json index 3d15960b30e59..e1acf02d1998d 100644 --- a/data/mods/Aftershock/items/ammo_effects.json +++ b/data/mods/Aftershock/items/ammo_effects.json @@ -2,6 +2,7 @@ { "id": "FOAMCRETE", "type": "ammo_effect", + "//": "Applies foamcrete effect on hit.", "foamcrete_build": true } ] diff --git a/data/mods/Xedra_Evolved/items/inventor/gun.json b/data/mods/Xedra_Evolved/items/inventor/gun.json index 49c84912a5f30..f0abeea2d3019 100644 --- a/data/mods/Xedra_Evolved/items/inventor/gun.json +++ b/data/mods/Xedra_Evolved/items/inventor/gun.json @@ -119,7 +119,7 @@ [ "stock accessory", 1 ], [ "underbarrel", 1 ] ], - "ammo_effects": [ "LASER", "INCENDIARY", "DRAW_LASER_BEAM" ], + "ammo_effects": [ "LASER", "INCENDIARY" ], "flags": [ "NEVER_JAMS", "NO_SALVAGE", "NO_REPAIR", "NON_FOULING", "NEEDS_NO_LUBE", "TRADER_AVOID" ], "pocket_data": [ { @@ -164,7 +164,7 @@ [ "stock accessory", 1 ], [ "underbarrel", 1 ] ], - "ammo_effects": [ "LASER", "PLASMA_BUBBLE", "INCENDIARY", "DRAW_LASER_BEAM" ], + "ammo_effects": [ "LASER", "PLASMA_BUBBLE", "INCENDIARY" ], "flags": [ "NEVER_JAMS", "NO_SALVAGE", "NO_REPAIR", "NON_FOULING", "NEEDS_NO_LUBE", "TRADER_AVOID" ], "relic_data": { "charge_info": { "recharge_condition": "worn", "recharge_type": "periodic", "time": "5 m", "regenerate_ammo": true } }, "pocket_data": [ { "pocket_type": "MAGAZINE", "ammo_restriction": { "aetheric_charge": 480 }, "airtight": true } ] diff --git a/doc/JSON_FLAGS.md b/doc/JSON_FLAGS.md index 1c5f9c8272927..4fa1a70de15ac 100644 --- a/doc/JSON_FLAGS.md +++ b/doc/JSON_FLAGS.md @@ -6,8 +6,6 @@ - [TODO](#todo) - [Ammo](#ammo) - [Ammo type](#ammo-type) - - [Effects](#ammo-effects) - - [Flags](#flags) - [Traps](#traps) - [Armor](#armor) - [Covers](#covers) @@ -174,101 +172,6 @@ These are handled through `ammo_types.json`. You can tag a weapon with these to - ```water``` Water - ```paper``` Paper -### Ammo effects - -- ```ACIDBOMB``` Leaves a pool of acid on detonation. -- ```ACT_ON_RANGED_HIT``` The item should activate when thrown or fired, then immediately get processed if it spawns on the ground. -- ```APPLY_SAP``` Applies sap-coated effect on hit. -- ```BEANBAG``` Stuns the target. -- ```BLACKPOWDER``` May clog up the gun with blackpowder fouling, which will also cause rust. -- ```BLINDS_EYES``` Blinds the target if it hits the head (ranged projectiles can't actually hit the eyes at the moment). -- ```BOUNCE``` Inflicts target with `bounced` effect and rebounds to a nearby target without this effect. -- ```BURST``` Spills the contents on hit. -- ```COOKOFF``` Explodes when lit on fire. -- ```CUSTOM_EXPLOSION``` Explosion as specified in ```"explosion"``` field of used ammo. See `JSON_INFO.md`. -- ```DRAW_AS_LINE``` Doesn't go through regular bullet animation; instead draws a line and the bullet on its end for one frame. -- ```DRAW_LASER_BEAM``` Creates a trail of laser (the field type). -- ```EMP``` Damages "electronic" terrain types (such as consoles or card readers) In rare cases might make card readers open doors. Damages and destroys robotic enemies. Drains bionic power and power from any electronic equipment in player possession. -- ```EXPLOSIVE``` - -- ```EXPLOSIVE_120mmHEAT``` - -- ```EXPLOSIVE_20x66``` - -- ```EXPLOSIVE_66mmHEAT``` - -- ```EXPLOSIVE_84x246HE``` - -- ```EXPLOSIVE_84x246HEDP``` - -- ```EXPLOSIVE_ATGMHEAT``` - -- ```EXPLOSIVE_BIG``` - -- ```EXPLOSIVE_GRENADE``` - -- ```EXPLOSIVE_HESHOT``` - -- ```EXPLOSIVE_HOMEMADE``` - Explosions of various power, with or without shrapnel, see `ammo_effects.json` for exact values. -- ```EXPLOSIVE_HOMEMADE_GRENADE_1``` - -- ```EXPLOSIVE_HOMEMADE_GRENADE_2``` - -- ```EXPLOSIVE_HUGE``` - -- ```EXPLOSIVE_m430a1``` - -- ```EXPLOSIVE_m433``` - -- ```EXPLOSIVE_OG7V``` - -- ```EXPLOSIVE_PG7VL``` - -- ```EXPLOSIVE_PG7VR``` - -- ```EXPLOSIVE_RAUFOSS``` - -- ```EXPLOSIVE_SMALL``` - -- ```EXPLOSIVE_SMALL_HOMEMADE_GRENADE_1``` - -- ```EXPLOSIVE_SMALL_HOMEMADE_GRENADE_2``` - -- ```EXPLOSIVE_TBG7V``` - -- ```FLAME``` Very small explosion that lights fires. -- ```FLARE``` Lights the target tile on fire. -- ```FLASHBANG``` Blinds and deafens nearby targets. -- ```FOAMCRETE``` Applies foamcrete effect on hit. -- ```FRAG``` Small explosion that spreads shrapnel ("power": 185, "shrapnel": { "casing_mass": 212, "fragment_mass": 0.025}). -- ```FRAG_20x66``` Small explosion that spreads shrapnel ("power": 40, "shrapnel": { "casing_mass": 15, "fragment_mass": 0.08 }). -- ```GAS_FUNGICIDAL``` Creates a cloud of fungicidal gas on hit. -- ```GAS_INSECTICIDAL``` Creates a cloud of insecticidal gas on hit. -- ```HEAVY_HIT``` Creates a loud sound on hit. -- ```INCENDIARY``` Lights target on fire. -- ```IGNITE``` Lights target on intense and longer-lasting fire. -- ```JET``` Draws a `*` symbol as a flying projectile (unlike usual `#` symbol). -- ```LARGE_BEANBAG``` Heavily stuns the target. -- ```LASER``` Creates a trail of laser (the field type). -- ```LIGHTNING``` Creates a trail of lightning. -- ```magic``` Always best possible hit, do nothing special, no damage mults, nothing. -- ```MATCHHEAD``` Bullet has a chance of damaging the gun from overpressure regardless of fouling level. -- ```MININUKE_MOD``` Small thermo-nuclear detonation that leaves behind radioactive fallout. -- ```MUZZLE_SMOKE``` Generate a small cloud of smoke at the source. -- ```NAPALM``` Explosion that spreads fire. -- ```NAPALM_BIG``` Large explosion that spreads fire. -- ```NAPALM_TBG7V``` Creates a large fire on hit. -- ```NEVER_MISFIRES``` Firing ammo without this flag may trigger a misfiring, this is independent of the weapon flags. -- ```NO_DAMAGE_SCALING``` Always set 100% damage due to hit in the weakpoint. -- ```NO_EMBED``` When an item would be spawned from the projectile, it will always be spawned on the ground rather than in a monster's inventory. Implied for active thrown items. Doesn't do anything on projectiles that do not drop items. -- ```NOGIB``` Prevents overkill damage on the target (target won't explode into gibs, see also the monster flag `NOGIB`). -- ```NO_ITEM_DAMAGE``` Will not damage items on the map even when it otherwise would try to. -- ```NON_FOULING``` This ammo does not cause dirtying or blackpowder fouling on the gun when fired. -- ```NO_OVERSHOOT``` Projectiles with this effect won't fly farther than player's set target tile. -- ```NO_PENETRATE_OBSTACLES``` Prevents a projectile from going through a tile with obstacles, such as chainlink fences or dressers. -- ```NPC_AVOID``` NPCs won't use guns or gunmods loaded with ammo with this effect. -- ```NULL_SOURCE``` Projectiles with this effect doesn't have a creature who fired them; applied only to explosives' shrapnel. -- ```PARALYZEPOISON``` Applies paralyzing poison effect on damaging hit. -- ```PLASMA``` Creates a trail of superheated plasma. -- ```PLASMA_BUBBLE``` Creates a cloud of superheated plasma. -- ```PYROPHORIC``` Large explosion that spreads fire of high intensity. -- ```ROBOT_DAZZLE``` Applies sensor-stunning effect to robots. -- ```RECOVER_[X]``` Has a (X-1/X) chance to create a single charge of the used ammo at the point of impact. -- ```RECYCLED``` (For handmade ammo) causes the gun to misfire sometimes; this is independent of the weapon flags. -- ```SHATTER_SELF``` Destroys itself and creates shards on hit. -- ```SHOT``` Multiple smaller pellets; less effective against armor but increases chance to hit and no point-blank penalty. -- ```SMOKE``` Generates a cloud of smoke at the target. -- ```SMOKE_BIG``` Generates a large cloud of smoke at the target. -- ```STREAM``` Leaves a trail of fire fields. -- ```STREAM_BIG``` Leaves a trail of intense fire fields. -- ```STREAM_GAS_FUNGICIDAL``` Leaves a trail of fungicidal gas. -- ```STREAM_GAS_INSCENTICIDAL``` Leaves a trail of insecticidal gas. -- ```TANGLE``` When this projectile hits a target, it has a chance to tangle them up and immobilize them. -- ```TOXICGAS``` Creates a cloud of toxic gas on hit. -- ```TRAIL``` Creates a trail of smoke. -- ```WIDE``` Prevents `HARDTOSHOOT` monster flag from having any effect. Implied by ```SHOT``` or liquid ammo. - -### Flags - -- ```CASELESS_ROUNDS``` Caseless rounds that cannot be disassembled or reloaded. - ## Traps - ```AVATAR_ONLY``` Only the player character will trigger this trap. @@ -842,6 +745,7 @@ These flags can be applied via JSON item definition to most items. Not to be co - ```CORPSE``` Flag used to spawn various human corpses during the mapgen. - ```CREDIT_CARD_SHAPED``` This item is shaped like a credit card and fits into the card slots of a wallet and similar pockets. - ```CRUTCHES``` Item with this flag helps characters not to fall down if their legs are broken. +- ```CUSTOM_EXPLOSION``` Flag, automatically applied to items that has defined `explosion` data in definition. See `JSON_INFO.md` - ```CUT_HARVEST``` You need a grass-cutting tool like sickle to harvest this plant - ```DANGEROUS``` NPCs will not accept this item. Explosion iuse actor implies this flag. Implies `NPC_THROW_NOW`. - ```DETERGENT``` This item can be used as a detergent in a washing machine. @@ -944,6 +848,7 @@ These flags can be applied via JSON item definition to most items. Not to be co - ```SPLINT``` This item is splint, when worn on broken body part, it slowly mend it - ```STRICT_HUMANITARIANISM``` Flag, automatically applied to food, if it was cooked from demihuman meat, and allow a different food interactions in names - ```TACK``` Item can be used as tack for a mount. +- ```TANGLE``` When this item is thrown, and hits a target, it has a chance to tangle them up and immobilize them. - ```TARDIS``` Container item with this flag bypasses internal checks for pocket data, so inside it could be bigger than on the outside, and could hold items that otherwise won't fit its dimensions. - ```TIE_UP``` Item can be used to tie up a creature. - ```TINDER``` This item can be used as tinder for lighting a fire with a `REQUIRES_TINDER` flagged firestarter. diff --git a/doc/JSON_INFO.md b/doc/JSON_INFO.md index 0172cda2bee9e..5097ab67c85b0 100644 --- a/doc/JSON_INFO.md +++ b/doc/JSON_INFO.md @@ -3246,16 +3246,45 @@ See [GAME_BALANCE.md](GAME_BALANCE.md)'s `MELEE_WEAPONS` section for the criteri ### Ammo Effects -```C++ - "id": "TACTICAL_LASER_EXPLOSION", // Defines this as some generic item - "type": "ammo_effect", // Defines this as an ammo_effect - "trigger_chance": 5, // Option one in X chances for the rest of json defined ammo_effect properties to trigger at the hit location. Defaults to 1 - "explosion": { } // (Optional) Creates an explosion at the hit location. See "explosion" for details. - "aoe": { }, // (Optional) Spawn a square of specified fields on the hit location. - "trail": { } // (Optional) Spawn a line of fields on the projectiles path. Not affected by trigger_chance. - "foamcrete_build": true // (Optional) Creates foamcrete fields and walls on the hit location. - "do_flashbang": true // (Optional) Creates a hardcoded Flashbang explosion. - "do_emp_blast": true // (Optional) Creates a one tile radious EMP explosion at the hit location. +ammo_effects define what effect the projectile, that you shoot, would have. List of existing ammo effects, **including hardcoded one**, can be found at `data/json/ammo_effects.json` + +```c++ +{ + "id": "AE_NULL", // id of an effect + "type": "ammo_effect", // define it is an ammo effect + "aoe": { // this field would be spawned at the tile projectile hit + "field_type": "fd_fog", // field, that would be spawned around the center of projectile; default "fd_null" + "intensity_min": 1, // min intensity of the field; default 0 + "intensity_max": 3, // max intensity of the field; default 0 + "radius": 5, // radius of a field to spawn; default 1 + "radius_z": 1, // radius across z-level; default 0 + "chance": 100, // probability to spawn 1 unit of field, from 0 to 100; default 100 + "size": 0, // seems to be the threshold, where autoturret stops shooting the weapon to prevent friendly fire;; default 0 + "check_passable": false, // if false, projectile is able to penetrate impassable terrains, if penetration is defined (like walls and windows); if true, projectile can't penetrate even the sheet of glass; default false + "check_sees": false, // if false, field can be spawned behind the opaque wall (for example, behind the concrete wall); if true, it can't; default false + "check_sees_radius": 0 // if "check_sees" is true, and this value is smaller than "radius", this value is used as radius instead. The purpose nor reasoning is unknown, probably some legacy of mininuke, so just don't use it; default 0 + }, + "trail": { // this field would be spawned across whole projectile path + "field_type": "fd_fog", // field, that would be spawned; defautl "fd_null" + "intensity_min": 1, // min intensity of the field; default 0 + "intensity_max": 3, // max intensity of the field; default 0 + "chance": 100 // probability to spawn 1 unit of field, from 0 to 100; default 100 + }, + "explosion": { // explosion, that will happen at the tile that projectile hit + "power": 0, // mandatory; power of the explosion, in grams of tnt; pipebomb is about 300, grenade (without shrapnel) is 240 + "distance_factor": 0.8, // how fast the explosion decay, closer to 1 mean lesser "power" loss per tile, 0.8 means 20% of power loss per tile; default 0.75, value should be bigger than 0, but lesser than 1 + "fire": false, // explosion create a fire, related to it's power, distance and distance_factor + "shrapnel": { // explosion create a shrapnel, that deal the damage, calculated by gurney equasion + "casing_mass": 0, // total mass of casing, casing/power ratio determines fragment velocity. + "fragment_mass": 0.0, // Mass of each fragment in grams. Large fragments hit harder, small fragments hit more often. + "recovery": 0, // Percentage chance to drop an item at landing point. + "drop": "null" // Which item to drop at landing point + } + }, + "do_flashbang": false, // Creates a one tile radius EMP explosion at the hit location; default false + "do_emp_blast": false // Creates a hardcoded flashbang explosion; default false + "foamcrete_build": false // Creates foamcrete fields and walls on the hit location, used in aftershock; default false +} ``` ### Magazine diff --git a/src/creature.cpp b/src/creature.cpp index c5cda5f707dec..1b78e5a011e89 100644 --- a/src/creature.cpp +++ b/src/creature.cpp @@ -963,7 +963,7 @@ projectile_attack_results Creature::select_body_part_projectile_attack( const projectile &proj, const double goodhit, const double missed_by ) const { projectile_attack_results ret( proj ); - const bool magic = proj.proj_effects.count( "magic" ) > 0; + const bool magic = proj.proj_effects.count( "MAGIC" ) > 0; double hit_value = missed_by + rng_float( -0.5, 0.5 ); if( magic ) { // Best possible hit @@ -1089,7 +1089,7 @@ void Creature::messaging_projectile_attack( const Creature *source, void Creature::deal_projectile_attack( Creature *source, dealt_projectile_attack &attack, bool print_messages, const weakpoint_attack &wp_attack ) { - const bool magic = attack.proj.proj_effects.count( "magic" ) > 0; + const bool magic = attack.proj.proj_effects.count( "MAGIC" ) > 0; const double missed_by = attack.missed_by; if( missed_by >= 1.0 && !magic ) { // Total miss diff --git a/src/magic.cpp b/src/magic.cpp index 78ddb1ca39f51..2079b431c7707 100644 --- a/src/magic.cpp +++ b/src/magic.cpp @@ -1627,7 +1627,7 @@ dealt_projectile_attack spell::get_projectile_attack( const tripoint &target, projectile bolt; bolt.speed = 10000; bolt.impact = get_damage_instance( caster ); - bolt.proj_effects.emplace( "magic" ); + bolt.proj_effects.emplace( "MAGIC" ); dealt_projectile_attack atk; atk.end_point = target; From e50792c76e9dabb160cea9abbb8be1b3267433ec Mon Sep 17 00:00:00 2001 From: Anton Simakov <67688115+GuardianDll@users.noreply.github.com> Date: Sun, 10 Sep 2023 00:26:51 +0200 Subject: [PATCH 2/4] Apply suggestions from code review --- data/json/ammo_effects.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/json/ammo_effects.json b/data/json/ammo_effects.json index db364a5ddea9e..e1765abe98bfd 100644 --- a/data/json/ammo_effects.json +++ b/data/json/ammo_effects.json @@ -96,7 +96,7 @@ { "id": "MATCHHEAD", "type": "ammo_effect", - "//": "Bullet has a chance of damaging the gun from overpressure regardless of fouling level, used in . Hardcoded" + "//": "Bullet has a chance of damaging the gun from overpressure regardless of fouling level, used in rounds, reloaded with matches. Hardcoded" }, { "id": "MAGIC", From 3f90558e37fc60b65a560226ed3b12526382a02d Mon Sep 17 00:00:00 2001 From: Anton Simakov <67688115+GuardianDll@users.noreply.github.com> Date: Sun, 10 Sep 2023 00:33:43 +0200 Subject: [PATCH 3/4] Apply suggestions from code review --- data/json/ammo_effects.json | 5 ----- 1 file changed, 5 deletions(-) diff --git a/data/json/ammo_effects.json b/data/json/ammo_effects.json index e1765abe98bfd..2c5a838999fe5 100644 --- a/data/json/ammo_effects.json +++ b/data/json/ammo_effects.json @@ -188,11 +188,6 @@ "type": "ammo_effect", "//": "Prevent HARDTOSHOOT monster flag from having any effect; automatically applied to ammo with `SHOT` flag or which have liquid phase. Hardcoded" }, - { - "id": "CASELESS_ROUNDS", - "type": "ammo_effect", - "//": "This ammo is caseless rounds that cannot be disassembled or reloaded. Hardcoded" - }, { "id": "FLAME", "type": "ammo_effect", From 460fffbf16811b58f7ac404c9085cf0cac4bd7f0 Mon Sep 17 00:00:00 2001 From: GuardianDll Date: Sun, 10 Sep 2023 00:34:53 +0200 Subject: [PATCH 4/4] why you two are still here? --- data/json/ammo_effects.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/data/json/ammo_effects.json b/data/json/ammo_effects.json index db364a5ddea9e..fe0156617f25f 100644 --- a/data/json/ammo_effects.json +++ b/data/json/ammo_effects.json @@ -338,13 +338,11 @@ { "id": "EXPLOSIVE_HOMEMADE_GRENADE_1", "type": "ammo_effect", - "//": "", "explosion": { "power": 300, "shrapnel": { "casing_mass": 400, "fragment_mass": 0.4 } } }, { "id": "EXPLOSIVE_SMALL_HOMEMADE_GRENADE_2", "type": "ammo_effect", - "//": "", "explosion": { "power": 460, "shrapnel": { "casing_mass": 200, "fragment_mass": 0.4 } } }, {