From 87c8585e86a87da0c04157b0254d2f200add4c2c Mon Sep 17 00:00:00 2001 From: RoyalFox <112293514+RoyalFox2140@users.noreply.github.com> Date: Fri, 10 Jan 2025 14:24:20 -0500 Subject: [PATCH] feat(content): Relic_data expanded to support aboveground as a condition (#5915) * OMG THAT TRIANGLE IS SPICY * style(autofix.ci): automated formatting --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> --- data/json/artifact/premade_artifacts.json | 15 +++++++++++++++ data/json/effects.json | 7 +++++++ .../docs/en/mod/json/reference/creatures/magic.md | 1 + src/magic_enchantment.cpp | 5 +++++ src/magic_enchantment.h | 1 + 5 files changed, 29 insertions(+) diff --git a/data/json/artifact/premade_artifacts.json b/data/json/artifact/premade_artifacts.json index 4c50d3cf931c..000e59690f07 100644 --- a/data/json/artifact/premade_artifacts.json +++ b/data/json/artifact/premade_artifacts.json @@ -14,6 +14,21 @@ "passive_effects": [ { "has": "HELD", "condition": "ALWAYS", "ench_effects": [ { "effect": "debug_clairvoyance", "intensity": 1 } ] } ] } }, + { + "id": "radiation_triangle", + "type": "TOOL", + "name": { "str": "The irradiation triangle" }, + "description": "Who so ever dares to hold this triangle inside inventory when not underground shall gain 1 to 3 irradiation every 10 minutes.", + "weight": "1 g", + "volume": "1 ml", + "material": [ "iron" ], + "symbol": "]", + "color": "light_gray", + "flags": [ "TRADER_AVOID" ], + "relic_data": { + "passive_effects": [ { "has": "HELD", "condition": "ABOVEGROUND", "ench_effects": [ { "effect": "debug_irradiation", "intensity": 1 } ] } ] + } + }, { "id": "chaos_dagger", "type": "GENERIC", diff --git a/data/json/effects.json b/data/json/effects.json index 5303e158cf7e..7c89a826d795 100644 --- a/data/json/effects.json +++ b/data/json/effects.json @@ -839,6 +839,13 @@ "desc": [ "You can see through everything!" ], "flags": [ "EFFECT_SUPER_CLAIRVOYANCE" ] }, + { + "type": "effect_type", + "id": "debug_irradiation", + "name": [ "Irradiation triangle" ], + "desc": [ "This irradiates you every 15 minutes while aboveground so long as you have it in your inventory!" ], + "base_mods": { "rad_min": [ 1 ], "rad_max": [ 3 ], "rad_tick": [ 900 ] } + }, { "type": "effect_type", "id": "took_xanax", diff --git a/doc/src/content/docs/en/mod/json/reference/creatures/magic.md b/doc/src/content/docs/en/mod/json/reference/creatures/magic.md index 9a03d2b8b15a..9d16215e779f 100644 --- a/doc/src/content/docs/en/mod/json/reference/creatures/magic.md +++ b/doc/src/content/docs/en/mod/json/reference/creatures/magic.md @@ -370,6 +370,7 @@ Values: - `ALWAYS` (default) - Always active - `UNDERGROUND` - When the owner of the item is below Z-level 0 +- `ABOVEGROUND` - When the owner of the item is below Z-level 0 - `UNDERWATER` - When the owner is in swimmable terrain - `NIGHT` - When it is night time - `DUSK` - When it is dusk diff --git a/src/magic_enchantment.cpp b/src/magic_enchantment.cpp index ed246555d7f4..caec2805a08b 100644 --- a/src/magic_enchantment.cpp +++ b/src/magic_enchantment.cpp @@ -60,6 +60,7 @@ namespace io switch ( data ) { case enchantment::condition::ALWAYS: return "ALWAYS"; case enchantment::condition::UNDERGROUND: return "UNDERGROUND"; + case enchantment::condition::ABOVEGROUND: return "ABOVEGROUND"; case enchantment::condition::UNDERWATER: return "UNDERWATER"; case enchantment::condition::DAY: return "DAY"; case enchantment::condition::NIGHT: return "NIGHT"; @@ -213,6 +214,10 @@ bool enchantment::is_active( const Character &guy, const bool active ) const return guy.pos().z < 0; } + if( active_conditions.second == condition::ABOVEGROUND ) { + return guy.pos().z > -1; + } + if( active_conditions.second == condition::UNDERWATER ) { return get_map().is_divable( guy.pos() ); } diff --git a/src/magic_enchantment.h b/src/magic_enchantment.h index 9e86e233960c..20803e62dbcf 100644 --- a/src/magic_enchantment.h +++ b/src/magic_enchantment.h @@ -83,6 +83,7 @@ class enchantment enum condition { ALWAYS, UNDERGROUND, + ABOVEGROUND, UNDERWATER, NIGHT, DAY,