From b45659ef88ecb1f48be9f4b96b6d6d57081a8ab1 Mon Sep 17 00:00:00 2001 From: KorGgenT Date: Sat, 21 Sep 2019 16:57:18 -0400 Subject: [PATCH] enchantment: REGEN_MANA --- .../mods/Magiclysm/itemgroups/itemgroups.json | 2 +- data/mods/Magiclysm/items/enchanted.json | 22 +++++++++++++++++++ src/magic.cpp | 3 ++- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/data/mods/Magiclysm/itemgroups/itemgroups.json b/data/mods/Magiclysm/itemgroups/itemgroups.json index c85f8060b3668..a8799770d5e04 100644 --- a/data/mods/Magiclysm/itemgroups/itemgroups.json +++ b/data/mods/Magiclysm/itemgroups/itemgroups.json @@ -59,7 +59,7 @@ { "type": "item_group", "id": "displays", - "items": [ [ "mana_potion_lesser", 50 ], [ "magi_staff_minor", 5 ] ] + "items": [ [ "mana_potion_lesser", 50 ], [ "magi_staff_minor", 5 ], [ "wizard_hat", 5 ] ] }, { "id": "coffee_display_2", diff --git a/data/mods/Magiclysm/items/enchanted.json b/data/mods/Magiclysm/items/enchanted.json index 5991e6c3cf402..692046477a6c1 100644 --- a/data/mods/Magiclysm/items/enchanted.json +++ b/data/mods/Magiclysm/items/enchanted.json @@ -36,5 +36,27 @@ "bashing": 19, "category": "weapons", "to_hit": 3 + }, + { + "id": "wizard_hat", + "type": "ARMOR", + "name": "wizard hat", + "description": "A blue pointed hat with stars stiched into it. Wearing it increases your mana regeneration.", + "weight": "390 g", + "volume": "2 L", + "price": 9500, + "material": [ "cotton" ], + "symbol": "^", + "color": "light_blue", + "covers": [ "HEAD" ], + "coverage": 50, + "encumbrance": 12, + "warmth": 7, + "material_thickness": 2, + "environmental_protection": 2, + "relic_data": { + "passive_effects": [ { "has": "WORN", "condition": "ALWAYS", "values": [ { "value": "REGEN_MANA", "multiply": 1 } ] } ] + }, + "flags": [ "VARSIZE" ] } ] diff --git a/src/magic.cpp b/src/magic.cpp index 73e6ef8693d11..e5e4b8b232dbf 100644 --- a/src/magic.cpp +++ b/src/magic.cpp @@ -1298,7 +1298,8 @@ void known_magic::update_mana( const player &p, float turns ) // mana should replenish in 8 hours. const float full_replenish = to_turns( 8_hours ); const float ratio = turns / full_replenish; - mod_mana( p, floor( ratio * max_mana( p ) * p.mutation_value( "mana_regen_multiplier" ) ) ); + mod_mana( p, floor( ratio * p.calculate_by_enchantment( max_mana( p ) * + p.mutation_value( "mana_regen_multiplier" ), enchantment::mod::REGEN_MANA ) ) ); } std::vector known_magic::spells() const