Skip to content

Commit

Permalink
feat(content): Relic_data expanded to support aboveground as a condit…
Browse files Browse the repository at this point in the history
…ion (#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>
  • Loading branch information
RoyalFox2140 and autofix-ci[bot] authored Jan 10, 2025
1 parent 2e0cbba commit 87c8585
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 0 deletions.
15 changes: 15 additions & 0 deletions data/json/artifact/premade_artifacts.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
7 changes: 7 additions & 0 deletions data/json/effects.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions src/magic_enchantment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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() );
}
Expand Down
1 change: 1 addition & 0 deletions src/magic_enchantment.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ class enchantment
enum condition {
ALWAYS,
UNDERGROUND,
ABOVEGROUND,
UNDERWATER,
NIGHT,
DAY,
Expand Down

0 comments on commit 87c8585

Please sign in to comment.