diff --git a/data/mods/Magiclysm/effects/enchantments.json b/data/mods/Magiclysm/effects/enchantments.json new file mode 100644 index 000000000000..81a913ae8de0 --- /dev/null +++ b/data/mods/Magiclysm/effects/enchantments.json @@ -0,0 +1,42 @@ +[ + { + "id": "ench_overcharge_burn_scar", + "type": "enchantment", + "ench_effects": [ { "effect": "burn_scar", "intensity": 1 } ] + }, + { + "id": "ench_windrun", + "type": "enchantment", + "has": "WORN", + "ench_effects": [ { "effect": "enchant_windrun", "intensity": 1 } ], + "values": [ { "value": "MOVE_COST", "multiply": -0.25 } ] + }, + { + "id": "ench_test_night", + "type": "enchantment", + "has": "WORN", + "condition": "NIGHT", + "values": [ { "value": "PERCEPTION", "multiply": 10 } ] + }, + { + "id": "ench_test_day", + "type": "enchantment", + "has": "WORN", + "condition": "DAY", + "values": [ { "value": "STRENGTH", "multiply": 10 } ] + }, + { + "id": "ench_test_dawn", + "type": "enchantment", + "has": "WORN", + "condition": "DAWN", + "values": [ { "value": "DEXTERITY", "multiply": 10 } ] + }, + { + "id": "ench_test_dusk", + "type": "enchantment", + "has": "WORN", + "condition": "DUSK", + "values": [ { "value": "INTELLIGENCE", "multiply": 10 } ] + } +] diff --git a/data/mods/Magiclysm/items/armor.json b/data/mods/Magiclysm/items/armor.json index 58cbfe228219..c99b8919b5f8 100644 --- a/data/mods/Magiclysm/items/armor.json +++ b/data/mods/Magiclysm/items/armor.json @@ -104,5 +104,27 @@ "volume": "150 L", "material_thickness": 6, "environmental_protection": 8 + }, + { + "id": "helmet_testNight", + "copy-from": "helmet_chitin", + "type": "ARMOR", + "name": { "str": "Night testing Helmet" }, + "description": "I can see EVERYTHING!", + "material": [ "demon_chitin" ], + "proportional": { "weight": 0.9, "encumbrance": 0.9, "price": 10, "warmth": 2 }, + "relic_data": { "passive_effects": [ { "id": "ench_test_night" }, { "id": "ench_test_dawn" } ] }, + "environmental_protection": 8 + }, + { + "id": "gauntlets_testDay", + "copy-from": "gauntlets_chitin", + "type": "ARMOR", + "name": { "str": "pair of Day Testing gauntlets" }, + "description": "Super strong so long as the sun's on!", + "material": [ "demon_chitin" ], + "proportional": { "weight": 0.9, "encumbrance": 0.9, "price": 10, "warmth": 2 }, + "relic_data": { "passive_effects": [ { "id": "ench_test_day" }, { "id": "ench_test_dusk" } ] }, + "environmental_protection": 8 } ] 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 051aea5406c8..9a03d2b8b15a 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 @@ -371,6 +371,10 @@ Values: - `ALWAYS` (default) - Always active - `UNDERGROUND` - 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 +- `DAY` - When it is day time +- `DAWN` - When it is dawn - `ACTIVE` - whenever the item, mutation, bionic, or whatever the enchantment is attached to is active. diff --git a/src/magic_enchantment.cpp b/src/magic_enchantment.cpp index fa8d24d7fc5a..ed246555d7f4 100644 --- a/src/magic_enchantment.cpp +++ b/src/magic_enchantment.cpp @@ -6,6 +6,7 @@ #include #include "bodypart.h" +#include "calendar.h" #include "character.h" #include "creature.h" #include "debug.h" @@ -60,6 +61,10 @@ namespace io case enchantment::condition::ALWAYS: return "ALWAYS"; case enchantment::condition::UNDERGROUND: return "UNDERGROUND"; case enchantment::condition::UNDERWATER: return "UNDERWATER"; + case enchantment::condition::DAY: return "DAY"; + case enchantment::condition::NIGHT: return "NIGHT"; + case enchantment::condition::DUSK: return "DUSK"; + case enchantment::condition::DAWN: return "DAWN"; case enchantment::condition::ACTIVE: return "ACTIVE"; case enchantment::condition::NUM_CONDITION: break; } @@ -188,6 +193,22 @@ bool enchantment::is_active( const Character &guy, const bool active ) const return true; } + if( active_conditions.second == condition::NIGHT ) { + return is_night( calendar::turn ); + } + + if( active_conditions.second == condition::DAY ) { + return is_day( calendar::turn ); + } + + if( active_conditions.second == condition::DUSK ) { + return is_dusk( calendar::turn ); + } + + if( active_conditions.second == condition::DAWN ) { + return is_dawn( calendar::turn ); + } + if( active_conditions.second == condition::UNDERGROUND ) { return guy.pos().z < 0; } diff --git a/src/magic_enchantment.h b/src/magic_enchantment.h index 8bf3a8d2db60..9e86e233960c 100644 --- a/src/magic_enchantment.h +++ b/src/magic_enchantment.h @@ -84,6 +84,10 @@ class enchantment ALWAYS, UNDERGROUND, UNDERWATER, + NIGHT, + DAY, + DUSK, + DAWN, ACTIVE, // the item, mutation, etc. is active NUM_CONDITION };