From 9c9f2ca044636e1e1217b5b0d02e0b7470317202 Mon Sep 17 00:00:00 2001 From: GuardianDll Date: Sat, 7 Dec 2024 13:09:43 +0100 Subject: [PATCH 1/8] refactor and simplify force_add --- src/magic_enchantment.cpp | 186 ++++++++++---------------------------- src/magic_enchantment.h | 2 + 2 files changed, 50 insertions(+), 138 deletions(-) diff --git a/src/magic_enchantment.cpp b/src/magic_enchantment.cpp index 8a9ae0ca44902..cb6a1adb4e3be 100644 --- a/src/magic_enchantment.cpp +++ b/src/magic_enchantment.cpp @@ -810,179 +810,89 @@ void enchant_cache::force_add( const enchant_cache &rhs ) void enchant_cache::force_add( const enchantment &rhs, const Character &guy ) { const_dialogue d( get_const_talker_for( guy ), nullptr ); - for( const std::pair &pair_values : - rhs.values_add ) { - values_add[pair_values.first] += pair_values.second.evaluate( d ); - } - for( const std::pair &pair_values : - rhs.values_multiply ) { - // values do not multiply against each other, they add. - // so +10% and -10% will add to 0% - values_multiply[pair_values.first] += pair_values.second.evaluate( d ); - } - - for( const std::pair &pair_values : - rhs.skill_values_add ) { - skill_values_add[pair_values.first] += pair_values.second.evaluate( d ); - } - for( const std::pair &pair_values : - rhs.skill_values_multiply ) { - // values do not multiply against each other, they add. - // so +10% and -10% will add to 0% - skill_values_multiply[pair_values.first] += pair_values.second.evaluate( d ); - } - - for( const std::pair &pair_values : - rhs.damage_values_add ) { - damage_values_add[pair_values.first] += pair_values.second.evaluate( d ); - } - for( const std::pair &pair_values : - rhs.damage_values_multiply ) { - damage_values_multiply[pair_values.first] += pair_values.second.evaluate( d ); - } - - // from eval to cache, for char - for( const enchantment::special_vision &struc : rhs.special_vision_vector ) { - special_vision_vector.emplace_back( special_vision{ - struc.special_vision_descriptions_vector, struc.condition, struc.range.evaluate( d ), - struc.precise, struc.ignores_aiming_cone } ); - } - - hit_me_effect.insert( hit_me_effect.end(), rhs.hit_me_effect.begin(), rhs.hit_me_effect.end() ); - - hit_you_effect.insert( hit_you_effect.end(), rhs.hit_you_effect.begin(), rhs.hit_you_effect.end() ); - - ench_effects.insert( rhs.ench_effects.begin(), rhs.ench_effects.end() ); - - if( rhs.emitter ) { - emitter = rhs.emitter; - } - - for( const bodypart_changes &bp : rhs.modified_bodyparts ) { - modified_bodyparts.emplace_back( bp ); - } - - for( const trait_id &branch : rhs.mutations ) { - mutations.emplace( branch ); - } - - for( const std::pair> &act_pair : - rhs.intermittent_activation ) { - for( const fake_spell &fake : act_pair.second ) { - intermittent_activation[act_pair.first].emplace_back( fake ); - } - } - - details.emplace_back( rhs.name.translated(), rhs.description.translated() ); + force_add_with_dialogue( rhs, d ); } void enchant_cache::force_add( const enchantment &rhs, const monster &mon ) { const_dialogue d( get_const_talker_for( mon ), nullptr ); - for( const std::pair &pair_values : - rhs.values_add ) { - values_add[pair_values.first] += pair_values.second.evaluate( d ); - } - for( const std::pair &pair_values : - rhs.values_multiply ) { - // values do not multiply against each other, they add. - // so +10% and -10% will add to 0% - values_multiply[pair_values.first] += pair_values.second.evaluate( d ); - } - - for( const std::pair &pair_values : - rhs.skill_values_add ) { - skill_values_add[pair_values.first] += pair_values.second.evaluate( d ); - } - for( const std::pair &pair_values : - rhs.skill_values_multiply ) { - // values do not multiply against each other, they add. - // so +10% and -10% will add to 0% - skill_values_multiply[pair_values.first] += pair_values.second.evaluate( d ); - } - - for( const std::pair &pair_values : - rhs.damage_values_add ) { - damage_values_add[pair_values.first] += pair_values.second.evaluate( d ); - } - for( const std::pair &pair_values : - rhs.damage_values_multiply ) { - damage_values_multiply[pair_values.first] += pair_values.second.evaluate( d ); - } - - // from eval to cache, for monster - for( const enchantment::special_vision &struc : rhs.special_vision_vector ) { - special_vision_vector.emplace_back( special_vision{ - struc.special_vision_descriptions_vector, struc.condition, struc.range.evaluate( d ), - struc.precise, struc.ignores_aiming_cone } ); - } - - hit_me_effect.insert( hit_me_effect.end(), rhs.hit_me_effect.begin(), rhs.hit_me_effect.end() ); - - hit_you_effect.insert( hit_you_effect.end(), rhs.hit_you_effect.begin(), rhs.hit_you_effect.end() ); - - ench_effects.insert( rhs.ench_effects.begin(), rhs.ench_effects.end() ); - - if( rhs.emitter ) { - emitter = rhs.emitter; - } - - for( const bodypart_changes &bp : rhs.modified_bodyparts ) { - modified_bodyparts.emplace_back( bp ); - } - - for( const trait_id &branch : rhs.mutations ) { - mutations.emplace( branch ); - } - - for( const std::pair> &act_pair : - rhs.intermittent_activation ) { - for( const fake_spell &fake : act_pair.second ) { - intermittent_activation[act_pair.first].emplace_back( fake ); - } - } - - details.emplace_back( rhs.name.translated(), rhs.description.translated() ); + force_add_with_dialogue( rhs, d ); } void enchant_cache::force_add( const enchantment &rhs ) +{ + const_dialogue d( nullptr, nullptr ); + force_add_with_dialogue( rhs, d, false ); +} + +void enchant_cache::force_add_with_dialogue( const enchantment &rhs, const const_dialogue d, + const bool evaluate ) { for( const std::pair &pair_values : rhs.values_add ) { - values_add[pair_values.first] += pair_values.second.constant(); + if( evaluate ) { + values_add[pair_values.first] += pair_values.second.evaluate( d ); + } else { + values_add[pair_values.first] += pair_values.second.constant(); + } } for( const std::pair &pair_values : rhs.values_multiply ) { // values do not multiply against each other, they add. // so +10% and -10% will add to 0% - values_multiply[pair_values.first] += pair_values.second.constant(); + if( evaluate ) { + values_multiply[pair_values.first] += pair_values.second.evaluate( d ); + } else { + values_multiply[pair_values.first] += pair_values.second.constant(); + } } for( const std::pair &pair_values : rhs.skill_values_add ) { - skill_values_add[pair_values.first] += pair_values.second.constant(); + if( evaluate ) { + skill_values_add[pair_values.first] += pair_values.second.evaluate( d ); + } else { + skill_values_add[pair_values.first] += pair_values.second.constant(); + } } for( const std::pair &pair_values : rhs.skill_values_multiply ) { // values do not multiply against each other, they add. // so +10% and -10% will add to 0% - skill_values_multiply[pair_values.first] += pair_values.second.constant(); + if( evaluate ) { + skill_values_multiply[pair_values.first] += pair_values.second.evaluate( d ); + } else { + skill_values_multiply[pair_values.first] += pair_values.second.constant(); + } } for( const std::pair &pair_values : rhs.damage_values_add ) { - damage_values_add[pair_values.first] += pair_values.second.constant(); + if( evaluate ) { + damage_values_add[pair_values.first] += pair_values.second.evaluate( d ); + } else { + damage_values_add[pair_values.first] += pair_values.second.constant(); + } } for( const std::pair &pair_values : rhs.damage_values_multiply ) { - damage_values_multiply[pair_values.first] += pair_values.second.constant(); + if( evaluate ) { + damage_values_multiply[pair_values.first] += pair_values.second.evaluate( d ); + } else { + damage_values_multiply[pair_values.first] += pair_values.second.constant(); + } } - // from eval to cache, with constant for( const enchantment::special_vision &struc : rhs.special_vision_vector ) { - special_vision_vector.emplace_back( special_vision{ - struc.special_vision_descriptions_vector, struc.condition, struc.range.constant(), - struc.precise, struc.ignores_aiming_cone } ); + if( evaluate ) { + special_vision_vector.emplace_back( special_vision{ + struc.special_vision_descriptions_vector, struc.condition, struc.range.evaluate( d ), + struc.precise, struc.ignores_aiming_cone } ); + } else { + special_vision_vector.emplace_back( special_vision{ + struc.special_vision_descriptions_vector, struc.condition, struc.range.constant(), + struc.precise, struc.ignores_aiming_cone } ); + } } hit_me_effect.insert( hit_me_effect.end(), rhs.hit_me_effect.begin(), rhs.hit_me_effect.end() ); diff --git a/src/magic_enchantment.h b/src/magic_enchantment.h index 264d686c0ecee..e7e74dae70593 100644 --- a/src/magic_enchantment.h +++ b/src/magic_enchantment.h @@ -320,6 +320,8 @@ class enchant_cache : public enchantment void force_add( const enchantment &rhs, const monster &mon ); void force_add( const enchantment &rhs ); void force_add( const enchant_cache &rhs ); + void force_add_with_dialogue( const enchantment &rhs, const const_dialogue d, + const bool evaluate = true ); // modifies character stats, or does other passive effects void activate_passive( Character &guy ) const; From f8380ef97ab35b7b6a35938a411c4f9d50925ff5 Mon Sep 17 00:00:00 2001 From: GuardianDll Date: Tue, 10 Dec 2024 18:38:07 +0100 Subject: [PATCH 2/8] replace ARMOR_ and EXTRA_ enchantments with dedicated fields, remove ITEM_ARMOR_ as not used --- data/json/artifact/relic_procgen_data.json | 168 ---------- data/json/effects.json | 27 +- data/json/mutations/mutations.json | 4 +- data/mods/Aftershock/items/item_enchants.json | 6 +- data/mods/Aftershock/player/bionics.json | 3 +- data/mods/Aftershock/spells/enchantments.json | 14 +- .../BombasticPerks/perkdata/bellringer.json | 2 +- data/mods/BombasticPerks/perkdata/empath.json | 10 +- .../Spells/attunements/Crusader.json | 10 +- .../Spells/attunements/Force_Mage.json | 10 +- .../Spells/attunements/Gaias_Chosen.json | 16 +- data/mods/Magiclysm/effects/effects.json | 38 +-- .../Magiclysm/enchantments/Basic_Classes.json | 4 +- .../mods/Magiclysm/items/enchanted_boots.json | 4 +- .../Magiclysm/items/enchanted_bracers.json | 24 +- .../Magiclysm/items/enchanted_clothes.json | 2 +- .../mods/Magiclysm/items/enchanted_rings.json | 42 +-- data/mods/Magiclysm/items/ethereal_items.json | 4 +- data/mods/Magiclysm/items/item_enchants.json | 38 ++- data/mods/Magiclysm/items/obsolete.json | 6 - .../Magiclysm/mutations/debug_mutations.json | 6 +- data/mods/Magiclysm/traits/attunements.json | 25 +- .../effects/effects_monster.json | 38 +-- .../effects/effects_potions.json | 4 +- .../effects/effects_psionic.json | 88 ++---- .../enchantments/enchantments_baneful.json | 13 +- .../enchantments/enchantments_player.json | 32 +- .../mods/MindOverMatter/items/armor/belt.json | 30 +- .../mutations/psi_passives.json | 6 +- data/mods/Xedra_Evolved/effects/effects.json | 107 +++---- .../Xedra_Evolved/enchantments/armor.json | 3 +- .../itemgroups/map_extra_itemgroups.json | 72 ----- .../Xedra_Evolved/items/inventor/armor.json | 10 +- .../Xedra_Evolved/mutations/mutations.json | 10 +- .../paraclesians/ierde_mutation_spells.json | 5 +- .../paraclesians/salamander_mutations.json | 2 +- .../paraclesians/sylph_mutations.json | 9 +- .../paraclesians/undine_mutation_spells.json | 26 +- .../Xedra_Evolved/mutations/temporary.json | 2 +- .../procgen/dreamsmith_procgen.json | 292 ------------------ data/mods/Xedra_Evolved/spells/XAEA.json | 2 +- .../spells/integrated_armor_spells.json | 14 +- doc/MAGIC.md | 77 ++--- src/character.h | 6 - src/character_armor.cpp | 51 +-- src/character_attire.cpp | 30 -- src/creature.h | 1 + src/magic_enchantment.cpp | 266 +++++++++++----- src/magic_enchantment.h | 51 ++- src/melee.cpp | 5 - src/monster.cpp | 34 +- src/monster.h | 2 - 52 files changed, 554 insertions(+), 1197 deletions(-) diff --git a/data/json/artifact/relic_procgen_data.json b/data/json/artifact/relic_procgen_data.json index 91ee1af746fa8..74468b390bf0c 100644 --- a/data/json/artifact/relic_procgen_data.json +++ b/data/json/artifact/relic_procgen_data.json @@ -85,62 +85,6 @@ "increment": 0.2, "power_per_increment": 10 }, - { - "weight": 100, - "min_value": -0.2, - "max_value": 1, - "type": "ARMOR_ACID", - "increment": 0.1, - "power_per_increment": -125 - }, - { - "weight": 100, - "min_value": -0.2, - "max_value": 1, - "type": "ARMOR_BASH", - "increment": 0.1, - "power_per_increment": -250 - }, - { - "weight": 100, - "min_value": -0.2, - "max_value": 1, - "type": "ARMOR_CUT", - "increment": 0.1, - "power_per_increment": -250 - }, - { - "weight": 100, - "min_value": -0.2, - "max_value": 1, - "type": "ARMOR_ELEC", - "increment": 0.1, - "power_per_increment": -125 - }, - { - "weight": 100, - "min_value": -0.2, - "max_value": 1, - "type": "ARMOR_HEAT", - "increment": 0.1, - "power_per_increment": -125 - }, - { - "weight": 100, - "min_value": -0.2, - "max_value": 1, - "type": "ARMOR_STAB", - "increment": 0.1, - "power_per_increment": -250 - }, - { - "weight": 100, - "min_value": -0.2, - "max_value": 1, - "type": "ARMOR_BULLET", - "increment": 0.1, - "power_per_increment": -250 - }, { "weight": 50, "min_value": -0.4, @@ -364,62 +308,6 @@ "increment": 0.2, "power_per_increment": 10 }, - { - "weight": 100, - "min_value": -0.2, - "max_value": 1, - "type": "ARMOR_ACID", - "increment": 0.1, - "power_per_increment": -125 - }, - { - "weight": 100, - "min_value": -0.2, - "max_value": 1, - "type": "ARMOR_BASH", - "increment": 0.1, - "power_per_increment": -250 - }, - { - "weight": 100, - "min_value": -0.2, - "max_value": 1, - "type": "ARMOR_CUT", - "increment": 0.1, - "power_per_increment": -250 - }, - { - "weight": 100, - "min_value": -0.2, - "max_value": 1, - "type": "ARMOR_ELEC", - "increment": 0.1, - "power_per_increment": -125 - }, - { - "weight": 100, - "min_value": -0.2, - "max_value": 1, - "type": "ARMOR_HEAT", - "increment": 0.1, - "power_per_increment": -125 - }, - { - "weight": 100, - "min_value": -0.2, - "max_value": 1, - "type": "ARMOR_STAB", - "increment": 0.1, - "power_per_increment": -250 - }, - { - "weight": 100, - "min_value": -0.2, - "max_value": 1, - "type": "ARMOR_BULLET", - "increment": 0.1, - "power_per_increment": -250 - }, { "weight": 50, "min_value": -0.4, @@ -647,62 +535,6 @@ "increment": 0.2, "power_per_increment": 10 }, - { - "weight": 100, - "min_value": -0.2, - "max_value": 1, - "type": "ARMOR_ACID", - "increment": 0.1, - "power_per_increment": -125 - }, - { - "weight": 100, - "min_value": -0.2, - "max_value": 1, - "type": "ARMOR_BASH", - "increment": 0.1, - "power_per_increment": -250 - }, - { - "weight": 100, - "min_value": -0.2, - "max_value": 1, - "type": "ARMOR_CUT", - "increment": 0.1, - "power_per_increment": -250 - }, - { - "weight": 100, - "min_value": -0.2, - "max_value": 1, - "type": "ARMOR_ELEC", - "increment": 0.1, - "power_per_increment": -125 - }, - { - "weight": 100, - "min_value": -0.2, - "max_value": 1, - "type": "ARMOR_HEAT", - "increment": 0.1, - "power_per_increment": -125 - }, - { - "weight": 100, - "min_value": -0.2, - "max_value": 1, - "type": "ARMOR_STAB", - "increment": 0.1, - "power_per_increment": -250 - }, - { - "weight": 100, - "min_value": -0.2, - "max_value": 1, - "type": "ARMOR_BULLET", - "increment": 0.1, - "power_per_increment": -250 - }, { "weight": 50, "min_value": -0.4, diff --git a/data/json/effects.json b/data/json/effects.json index 67dcbe289b171..f1386b5fa50a2 100644 --- a/data/json/effects.json +++ b/data/json/effects.json @@ -570,13 +570,13 @@ "enchantments": [ { "condition": "ALWAYS", - "values": [ - { "value": "SPEED", "multiply": -0.5 }, - { "value": "ARMOR_BASH", "add": 15 }, - { "value": "ARMOR_STAB", "add": 15 }, - { "value": "ARMOR_CUT", "add": 15 }, - { "value": "ARMOR_BULLET", "add": 50 } - ] + "incoming_damage_mod": [ + { "type": "bash", "add": 15 }, + { "type": "stab", "add": 15 }, + { "type": "cut", "add": 15 }, + { "type": "bullet", "add": 50 } + ], + "values": [ { "value": "SPEED", "multiply": -0.5 } ] } ] }, @@ -591,12 +591,13 @@ "enchantments": [ { "condition": "ALWAYS", - "values": [ - { "value": "SPEED", "multiply": { "math": [ "Nemesis_iteration * 0.01" ] } }, - { "value": "ARMOR_BASH", "add": { "math": [ "Nemesis_iteration * -1" ] } }, - { "value": "ARMOR_STAB", "add": { "math": [ "Nemesis_iteration * -1" ] } }, - { "value": "ARMOR_CUT", "add": { "math": [ "Nemesis_iteration * -1" ] } } - ] + "incoming_damage_mod": [ + { "type": "bash", "add": { "math": [ "Nemesis_iteration * -1" ] } }, + { "type": "stab", "add": { "math": [ "Nemesis_iteration * -1" ] } }, + { "type": "cut", "add": { "math": [ "Nemesis_iteration * -1" ] } }, + { "type": "bullet", "add": { "math": [ "Nemesis_iteration * -1" ] } } + ], + "values": [ { "value": "SPEED", "multiply": { "math": [ "Nemesis_iteration * 0.01" ] } } ] } ] }, diff --git a/data/json/mutations/mutations.json b/data/json/mutations/mutations.json index ede2f6249c9ad..5c29886209e84 100644 --- a/data/json/mutations/mutations.json +++ b/data/json/mutations/mutations.json @@ -2903,8 +2903,8 @@ "enchantments": [ { "condition": "ALWAYS", + "incoming_damage_mod_post_absorbed": [ { "type": "bash", "multiply": 0.4 } ], "values": [ - { "value": "EXTRA_BASH", "multiply": 0.4 }, { "value": "MOVE_COST", "multiply": -0.1 }, { "value": "ATTACK_SPEED", "multiply": -0.1 }, { "value": "CARRY_WEIGHT", "multiply": -0.2 } @@ -7162,8 +7162,8 @@ "category": [ "BIRD", "SLIME", "ELFA" ], "enchantments": [ { + "incoming_damage_mod_post_absorbed": [ { "type": "bash", "multiply": 0.8 } ], "values": [ - { "value": "EXTRA_BASH", "multiply": 0.8 }, { "value": "MOVE_COST", "multiply": -0.2 }, { "value": "ATTACK_SPEED", "multiply": -0.2 }, { "value": "CARRY_WEIGHT", "multiply": -0.4 } diff --git a/data/mods/Aftershock/items/item_enchants.json b/data/mods/Aftershock/items/item_enchants.json index 75498d900a1cd..eb1c88c9d9a7e 100644 --- a/data/mods/Aftershock/items/item_enchants.json +++ b/data/mods/Aftershock/items/item_enchants.json @@ -6,7 +6,7 @@ "condition": "ALWAYS", "name": { "str": "Cold Barrier" }, "description": "Reduces incoming cold damage by 25%.", - "values": [ { "value": "ARMOR_COLD", "multiply": -0.25 } ] + "incoming_damage_mod": [ { "type": "cold", "multiply": -0.25 } ] }, { "type": "enchantment", @@ -56,7 +56,7 @@ "has": "WORN", "condition": "ACTIVE", "name": { "str": "Low Energy Forcefield" }, - "values": [ { "value": "ARMOR_BASH", "add": -25 }, { "value": "ARMOR_CUT", "add": -25 } ], + "incoming_damage_mod": [ { "type": "bash", "add": -25 }, { "type": "cut", "add": -25 } ], "description": "Reduces incoming bash and cut damage by 25." }, { @@ -65,7 +65,7 @@ "has": "WORN", "condition": "ACTIVE", "name": { "str": "High Energy Forcefield" }, - "values": [ { "value": "ARMOR_BULLET", "add": -40 }, { "value": "ARMOR_STAB", "add": -40 } ], + "incoming_damage_mod": [ { "type": "stab", "add": -40 }, { "type": "bullet", "add": -40 } ], "description": "Reduces incoming pierce and bullet damage by 40." }, { diff --git a/data/mods/Aftershock/player/bionics.json b/data/mods/Aftershock/player/bionics.json index fdd04e964bf74..776f325ebd8c0 100644 --- a/data/mods/Aftershock/player/bionics.json +++ b/data/mods/Aftershock/player/bionics.json @@ -179,9 +179,8 @@ "enchantments": [ { "condition": "ACTIVE", + "incoming_damage_mod": [ { "type": "biological", "add": -7 }, { "type": "cold", "add": -5 } ], "values": [ - { "value": "ARMOR_BIO", "add": -7 }, - { "value": "ARMOR_COLD", "add": -5 }, { "value": "PAIN_REMOVE", "add": 45 }, { "value": "METABOLISM", "multiply": 1.5 }, { "value": "REGEN_HP", "multiply": 2 } diff --git a/data/mods/Aftershock/spells/enchantments.json b/data/mods/Aftershock/spells/enchantments.json index d2637716eec10..14f54fc9e5987 100644 --- a/data/mods/Aftershock/spells/enchantments.json +++ b/data/mods/Aftershock/spells/enchantments.json @@ -42,25 +42,25 @@ "type": "enchantment", "id": "protect_cold", "condition": "ACTIVE", - "values": [ { "value": "ARMOR_COLD", "add": -15 } ] + "incoming_damage_mod": [ { "type": "cold", "add": -15 } ] }, { "type": "enchantment", "id": "forcefield_bash_cut_weak", "condition": "ACTIVE", - "values": [ { "value": "ARMOR_BASH", "add": -5 }, { "value": "ARMOR_CUT", "add": -5 } ] + "incoming_damage_mod": [ { "type": "bash", "add": -5 }, { "type": "cut", "add": -5 } ] }, { "type": "enchantment", "id": "forcefield_bash_cut_medium", "condition": "ACTIVE", - "values": [ { "value": "ARMOR_BASH", "add": -15 }, { "value": "ARMOR_CUT", "add": -15 } ] + "incoming_damage_mod": [ { "type": "bash", "add": -15 }, { "type": "cut", "add": -15 } ] }, { "type": "enchantment", "id": "forcefield_bash_cut_heavy", "condition": "ACTIVE", - "values": [ { "value": "ARMOR_BASH", "add": -25 }, { "value": "ARMOR_CUT", "add": -25 } ] + "incoming_damage_mod": [ { "type": "bash", "add": -25 }, { "type": "cut", "add": -25 } ] }, { "type": "enchantment", @@ -74,7 +74,7 @@ "npc_message": "%1$s's shield goes off with a flash of light and sound." } ], - "values": [ { "value": "ARMOR_BULLET", "add": -10 }, { "value": "ARMOR_STAB", "add": -10 } ] + "incoming_damage_mod": [ { "type": "stab", "add": -10 }, { "type": "bullet", "add": -10 } ] }, { "type": "enchantment", @@ -88,13 +88,13 @@ "npc_message": "%1$s's shield goes off with an arc of electricity." } ], - "values": [ { "value": "ARMOR_BULLET", "add": -20 }, { "value": "ARMOR_STAB", "add": -20 } ] + "incoming_damage_mod": [ { "type": "stab", "add": -20 }, { "type": "bullet", "add": -20 } ] }, { "type": "enchantment", "id": "forcefield_ballistic_piercing_heavy", "condition": "ACTIVE", "intermittent_activation": { "effects": [ { "frequency": "1 hour", "spell_effects": [ { "id": "radiation_field" } ] } ] }, - "values": [ { "value": "ARMOR_BULLET", "add": -40 }, { "value": "ARMOR_STAB", "add": -40 } ] + "incoming_damage_mod": [ { "type": "stab", "add": -40 }, { "type": "bullet", "add": -40 } ] } ] diff --git a/data/mods/BombasticPerks/perkdata/bellringer.json b/data/mods/BombasticPerks/perkdata/bellringer.json index 25b79e5770a8c..4922472d4ef46 100644 --- a/data/mods/BombasticPerks/perkdata/bellringer.json +++ b/data/mods/BombasticPerks/perkdata/bellringer.json @@ -27,6 +27,6 @@ "apply_message": "", "rating": "bad", "max_duration": "1 s", - "enchantments": [ { "values": [ { "value": "ARMOR_BASH", "multiply": -0.33 } ] } ] + "incoming_damage_mod": [ { "type": "bash", "multiply": -0.33 } ] } ] diff --git a/data/mods/BombasticPerks/perkdata/empath.json b/data/mods/BombasticPerks/perkdata/empath.json index 9d248a960df72..0665f25b987cf 100644 --- a/data/mods/BombasticPerks/perkdata/empath.json +++ b/data/mods/BombasticPerks/perkdata/empath.json @@ -141,11 +141,11 @@ "enchantments": [ { "condition": "ALWAYS", - "values": [ - { "value": "ARMOR_BASH", "add": -8.0 }, - { "value": "ARMOR_CUT", "add": -8.0 }, - { "value": "ARMOR_BULLET", "add": -8.0 }, - { "value": "ARMOR_ACID", "multiply": 0.0 } + "incoming_damage_mod": [ + { "type": "acid", "multiply": -1 }, + { "type": "bash", "add": -8 }, + { "type": "cut", "add": -8 }, + { "type": "bullet", "add": -8 } ] } ] diff --git a/data/mods/Magiclysm/Spells/attunements/Crusader.json b/data/mods/Magiclysm/Spells/attunements/Crusader.json index 0cdd3aeee79d3..ac545159195e9 100644 --- a/data/mods/Magiclysm/Spells/attunements/Crusader.json +++ b/data/mods/Magiclysm/Spells/attunements/Crusader.json @@ -37,11 +37,11 @@ { "has": "WORN", "condition": "ALWAYS", - "values": [ - { "value": "ARMOR_CUT", "add": -6 }, - { "value": "ARMOR_BASH", "add": -6 }, - { "value": "ARMOR_STAB", "add": -6 }, - { "value": "ARMOR_BULLET", "add": -3 } + "incoming_damage_mod": [ + { "type": "bash", "add": -6 }, + { "type": "stab", "add": -6 }, + { "type": "cut", "add": -6 }, + { "type": "bullet", "add": -3 } ] } ] diff --git a/data/mods/Magiclysm/Spells/attunements/Force_Mage.json b/data/mods/Magiclysm/Spells/attunements/Force_Mage.json index f7e74e2e99449..16eb0b00a7b21 100644 --- a/data/mods/Magiclysm/Spells/attunements/Force_Mage.json +++ b/data/mods/Magiclysm/Spells/attunements/Force_Mage.json @@ -42,11 +42,11 @@ { "has": "WORN", "condition": "ALWAYS", - "values": [ - { "value": "ARMOR_BASH", "multiply": -0.3 }, - { "value": "ARMOR_CUT", "multiply": -0.3 }, - { "value": "ARMOR_STAB", "multiply": -0.3 }, - { "value": "ARMOR_BULLET", "multiply": -0.3 } + "incoming_damage_mod": [ + { "type": "bash", "multiply": -0.3 }, + { "type": "stab", "multiply": -0.3 }, + { "type": "cut", "multiply": -0.3 }, + { "type": "bullet", "multiply": -0.3 } ] } ] diff --git a/data/mods/Magiclysm/Spells/attunements/Gaias_Chosen.json b/data/mods/Magiclysm/Spells/attunements/Gaias_Chosen.json index 5116bca226a13..d61f4f004c03b 100644 --- a/data/mods/Magiclysm/Spells/attunements/Gaias_Chosen.json +++ b/data/mods/Magiclysm/Spells/attunements/Gaias_Chosen.json @@ -65,20 +65,6 @@ "name": [ "Terra Armor" ], "desc": [ "Your body is covered in dense, ethereal shell, that protect you." ], "remove_message": "Your lost your terra shell.", - "enchantments": [ - { - "values": [ - { "value": "ARMOR_ACID", "add": { "math": [ "u_spell_level('terra_armor') * -3" ] } }, - { "value": "ARMOR_BASH", "add": { "math": [ "u_spell_level('terra_armor') * -3" ] } }, - { "value": "ARMOR_BIO", "add": { "math": [ "u_spell_level('terra_armor') * -3" ] } }, - { "value": "ARMOR_BULLET", "add": { "math": [ "u_spell_level('terra_armor') * -3" ] } }, - { "value": "ARMOR_COLD", "add": { "math": [ "u_spell_level('terra_armor') * -3" ] } }, - { "value": "ARMOR_CUT", "add": { "math": [ "u_spell_level('terra_armor') * -3" ] } }, - { "value": "ARMOR_ELEC", "add": { "math": [ "u_spell_level('terra_armor') * -3" ] } }, - { "value": "ARMOR_HEAT", "add": { "math": [ "u_spell_level('terra_armor') * -3" ] } }, - { "value": "ARMOR_STAB", "add": { "math": [ "u_spell_level('terra_armor') * -3" ] } } - ] - } - ] + "enchantments": [ { "values": [ { "value": "ARMOR_ALL", "add": { "math": [ "u_spell_level('terra_armor') * -3" ] } } ] } ] } ] diff --git a/data/mods/Magiclysm/effects/effects.json b/data/mods/Magiclysm/effects/effects.json index 9ebae7ee90fc1..1e0e9bf3bde98 100644 --- a/data/mods/Magiclysm/effects/effects.json +++ b/data/mods/Magiclysm/effects/effects.json @@ -250,7 +250,7 @@ "remove_message": "The tingling fades.", "enchantments": [ { - "values": [ { "value": "ARMOR_ACID", "multiply": { "math": [ "((u_spell_level('acid_resistance') * -0.02) - 0.2)" ] } } ] + "incoming_damage_mod": [ { "type": "acid", "multiply": { "math": [ "((u_spell_level('acid_resistance') * -0.02) - 0.2)" ] } } ] } ] }, @@ -261,7 +261,7 @@ "desc": [ "You are greatly protected from acid damage." ], "apply_message": "Your body tingles.", "remove_message": "The tingling fades.", - "enchantments": [ { "values": [ { "value": "ARMOR_ACID", "multiply": -0.75 } ] } ] + "enchantments": [ { "incoming_damage_mod": [ { "type": "acid", "multiply": -0.75 } ] } ] }, { "type": "effect_type", @@ -740,7 +740,7 @@ "remove_message": "Sparks under your skin vanish.", "rating": "good", "show_intensity": false, - "enchantments": [ { "values": [ { "value": "ARMOR_ELEC", "add": -35 } ] } ] + "enchantments": [ { "incoming_damage_mod": [ { "type": "electric", "add": -35 } ] } ] }, { "type": "effect_type", @@ -822,7 +822,7 @@ "show_intensity": false, "enchantments": [ { - "values": [ { "value": "ARMOR_BASH", "add": -10 }, { "value": "ARMOR_CUT", "add": -10 }, { "value": "ARMOR_STAB", "add": -10 } ] + "incoming_damage_mod": [ { "type": "bash", "add": -10 }, { "type": "stab", "add": -10 }, { "type": "cut", "add": -10 } ] } ] }, @@ -1016,10 +1016,8 @@ "enchantments": [ { "emitter": "emit_kelvinist_anti_cold", - "values": [ - { "value": "CLIMATE_CONTROL_HEAT", "add": 50 }, - { "value": "ARMOR_COLD", "add": { "math": [ "( u_spell_level('kelvinist_anti_cold') * -1)" ] } } - ] + "incoming_damage_mod": [ { "type": "cold", "add": { "math": [ "( u_spell_level('kelvinist_anti_cold') * -1)" ] } } ], + "values": [ { "value": "CLIMATE_CONTROL_HEAT", "add": 50 } ] } ] }, @@ -1035,10 +1033,8 @@ "enchantments": [ { "emitter": "emit_kelvinist_anti_heat", - "values": [ - { "value": "CLIMATE_CONTROL_CHILL", "add": 50 }, - { "value": "ARMOR_HEAT", "add": { "math": [ "( u_spell_level('kelvinist_anti_heat') * -1)" ] } } - ] + "incoming_damage_mod": [ { "type": "heat", "add": { "math": [ "( u_spell_level('kelvinist_anti_heat') * -1)" ] } } ], + "values": [ { "value": "CLIMATE_CONTROL_CHILL", "add": 50 } ] } ] }, @@ -1353,7 +1349,7 @@ "show_in_info": true, "blocks_effects": [ "blisters" ], "removes_effects": [ "onfire" ], - "enchantments": [ { "values": [ { "value": "ARMOR_HEAT", "multiply": -1 } ] } ], + "enchantments": [ { "incoming_damage_mod": [ { "type": "heat", "multiply": -1 } ] } ], "flags": [ "HEAT_IMMUME" ] }, { @@ -1827,21 +1823,7 @@ "rating": "good", "show_intensity": false, "show_in_info": false, - "enchantments": [ - { - "values": [ - { "value": "ARMOR_BASH", "add": -20 }, - { "value": "ARMOR_CUT", "add": -20 }, - { "value": "ARMOR_STAB", "add": -20 }, - { "value": "ARMOR_BULLET", "add": -20 }, - { "value": "ARMOR_HEAT", "add": -20 }, - { "value": "ARMOR_COLD", "add": -20 }, - { "value": "ARMOR_ELEC", "add": -20 }, - { "value": "ARMOR_ACID", "add": -20 }, - { "value": "ARMOR_BIO", "add": -20 } - ] - } - ] + "enchantments": [ { "values": [ { "value": "ARMOR_ALL", "add": -20 } ] } ] }, { "id": "sun_mage_buff", diff --git a/data/mods/Magiclysm/enchantments/Basic_Classes.json b/data/mods/Magiclysm/enchantments/Basic_Classes.json index cc99974721be6..86cbf92367a2d 100644 --- a/data/mods/Magiclysm/enchantments/Basic_Classes.json +++ b/data/mods/Magiclysm/enchantments/Basic_Classes.json @@ -2,11 +2,11 @@ { "type": "enchantment", "id": "KELVINIST", - "values": [ { "value": "ARMOR_HEAT", "add": { "math": [ "u_school_level('KELVINIST') / -6" ] } } ] + "incoming_damage_mod": [ { "type": "heat", "add": { "math": [ "u_school_level('KELVINIST') / -6" ] } } ] }, { "type": "enchantment", "id": "STORMSHAPER", - "values": [ { "value": "ARMOR_ELEC", "add": { "math": [ "u_school_level('STORMSHAPER') / -6" ] } } ] + "incoming_damage_mod": [ { "type": "electric", "add": { "math": [ "u_school_level('STORMSHAPER') / -6" ] } } ] } ] diff --git a/data/mods/Magiclysm/items/enchanted_boots.json b/data/mods/Magiclysm/items/enchanted_boots.json index 4b54f6c90a417..76fe8420b1d00 100644 --- a/data/mods/Magiclysm/items/enchanted_boots.json +++ b/data/mods/Magiclysm/items/enchanted_boots.json @@ -187,7 +187,9 @@ "material_thickness": 3, "environmental_protection": 3, "flags": [ "WATERPROOF", "STURDY" ], - "relic_data": { "passive_effects": [ { "has": "WORN", "condition": "ALWAYS", "values": [ { "value": "ARMOR_ELEC", "add": -20 } ] } ] }, + "relic_data": { + "passive_effects": [ { "has": "WORN", "condition": "ALWAYS", "incoming_damage_mod": [ { "type": "electric", "add": -20 } ] } ] + }, "material": [ "leather" ], "armor": [ { diff --git a/data/mods/Magiclysm/items/enchanted_bracers.json b/data/mods/Magiclysm/items/enchanted_bracers.json index c0a1cbc6310b0..42471ab86eec7 100644 --- a/data/mods/Magiclysm/items/enchanted_bracers.json +++ b/data/mods/Magiclysm/items/enchanted_bracers.json @@ -40,11 +40,11 @@ { "has": "WORN", "condition": "ALWAYS", - "values": [ - { "value": "ARMOR_CUT", "add": -2 }, - { "value": "ARMOR_BASH", "add": -2 }, - { "value": "ARMOR_STAB", "add": -2 }, - { "value": "ARMOR_BULLET", "add": -1 } + "incoming_damage_mod": [ + { "type": "bash", "add": -2 }, + { "type": "stab", "add": -2 }, + { "type": "cut", "add": -2 }, + { "type": "bullet", "add": -1 } ] } ] @@ -64,11 +64,11 @@ { "has": "WORN", "condition": "ALWAYS", - "values": [ - { "value": "ARMOR_CUT", "add": -4 }, - { "value": "ARMOR_BASH", "add": -4 }, - { "value": "ARMOR_STAB", "add": -4 }, - { "value": "ARMOR_BULLET", "add": -2 } + "incoming_damage_mod": [ + { "type": "bash", "add": -4 }, + { "type": "stab", "add": -4 }, + { "type": "cut", "add": -4 }, + { "type": "bullet", "add": -2 } ] } ] @@ -86,7 +86,7 @@ "flags": [ "BELTED", "STURDY", "BLOCK_WHILE_WORN", "NO_UNLOAD", "NO_RELOAD" ], "relic_data": { "charge_info": { "recharge_type": "periodic", "time": "24 h", "regenerate_ammo": true }, - "passive_effects": [ { "has": "WORN", "condition": "ALWAYS", "values": [ { "value": "ARMOR_ELEC", "add": -5 } ] } ] + "passive_effects": [ { "has": "WORN", "condition": "ALWAYS", "incoming_damage_mod": [ { "type": "electric", "add": -5 } ] } ] }, "use_action": { "type": "cast_spell", "spell_id": "jolt", "no_fail": true, "level": 15, "need_worn": true } }, @@ -102,7 +102,7 @@ "flags": [ "BELTED", "STURDY", "BLOCK_WHILE_WORN", "NO_UNLOAD", "NO_RELOAD" ], "relic_data": { "charge_info": { "recharge_type": "periodic", "time": "24 h", "regenerate_ammo": true }, - "passive_effects": [ { "has": "WORN", "condition": "ALWAYS", "values": [ { "value": "ARMOR_ELEC", "add": -10 } ] } ] + "passive_effects": [ { "has": "WORN", "condition": "ALWAYS", "incoming_damage_mod": [ { "type": "electric", "add": -10 } ] } ] }, "use_action": { "type": "cast_spell", "spell_id": "lightning_bolt", "no_fail": true, "level": 15, "need_worn": true } }, diff --git a/data/mods/Magiclysm/items/enchanted_clothes.json b/data/mods/Magiclysm/items/enchanted_clothes.json index 4885672885a53..96f6d55ac1bbe 100644 --- a/data/mods/Magiclysm/items/enchanted_clothes.json +++ b/data/mods/Magiclysm/items/enchanted_clothes.json @@ -48,7 +48,7 @@ { "has": "WORN", "condition": "ALWAYS", - "values": [ { "value": "ARMOR_BULLET", "add": -8 }, { "value": "ARMOR_STAB", "add": -3 }, { "value": "ARMOR_CUT", "add": -3 } ] + "incoming_damage_mod": [ { "type": "stab", "add": -3 }, { "type": "cut", "add": -3 }, { "type": "bullet", "add": -8 } ] } ] } diff --git a/data/mods/Magiclysm/items/enchanted_rings.json b/data/mods/Magiclysm/items/enchanted_rings.json index d4a5e27deefde..d3c175c351c7e 100644 --- a/data/mods/Magiclysm/items/enchanted_rings.json +++ b/data/mods/Magiclysm/items/enchanted_rings.json @@ -362,11 +362,11 @@ { "has": "WORN", "condition": "ALWAYS", - "values": [ - { "value": "ARMOR_CUT", "add": -2 }, - { "value": "ARMOR_BASH", "add": -2 }, - { "value": "ARMOR_STAB", "add": -2 }, - { "value": "ARMOR_BULLET", "add": -1 } + "incoming_damage_mod": [ + { "type": "bash", "add": -2 }, + { "type": "stab", "add": -2 }, + { "type": "cut", "add": -2 }, + { "type": "bullet", "add": -1 } ] } ] @@ -384,11 +384,11 @@ { "has": "WORN", "condition": "ALWAYS", - "values": [ - { "value": "ARMOR_CUT", "add": -4 }, - { "value": "ARMOR_BASH", "add": -4 }, - { "value": "ARMOR_STAB", "add": -4 }, - { "value": "ARMOR_BULLET", "add": -2 } + "incoming_damage_mod": [ + { "type": "bash", "add": -4 }, + { "type": "stab", "add": -4 }, + { "type": "cut", "add": -4 }, + { "type": "bullet", "add": -2 } ] } ] @@ -406,11 +406,11 @@ { "has": "WORN", "condition": "ALWAYS", - "values": [ - { "value": "ARMOR_CUT", "add": -6 }, - { "value": "ARMOR_BASH", "add": -6 }, - { "value": "ARMOR_STAB", "add": -6 }, - { "value": "ARMOR_BULLET", "add": -3 } + "incoming_damage_mod": [ + { "type": "bash", "add": -6 }, + { "type": "stab", "add": -6 }, + { "type": "cut", "add": -6 }, + { "type": "bullet", "add": -3 } ] } ] @@ -428,11 +428,11 @@ { "has": "WORN", "condition": "ALWAYS", - "values": [ - { "value": "ARMOR_CUT", "add": -8 }, - { "value": "ARMOR_BASH", "add": -8 }, - { "value": "ARMOR_STAB", "add": -8 }, - { "value": "ARMOR_BULLET", "add": -4 } + "incoming_damage_mod": [ + { "type": "bash", "add": -8 }, + { "type": "stab", "add": -8 }, + { "type": "cut", "add": -8 }, + { "type": "bullet", "add": -4 } ] } ] @@ -499,7 +499,7 @@ { "has": "WORN", "condition": "ALWAYS", - "values": [ { "value": "ARMOR_HEAT", "multiply": -0.5 } ], + "incoming_damage_mod": [ { "type": "heat", "multiply": -0.5 } ], "ench_effects": [ { "effect": "effect_mring_fire_protection", "intensity": 1 } ] } ] diff --git a/data/mods/Magiclysm/items/ethereal_items.json b/data/mods/Magiclysm/items/ethereal_items.json index 5b5f32a18c84b..3a5a55a36621c 100644 --- a/data/mods/Magiclysm/items/ethereal_items.json +++ b/data/mods/Magiclysm/items/ethereal_items.json @@ -1472,11 +1472,11 @@ "condition": "ALWAYS", "hit_me_effect": [ { "id": "druid_thorn_skin_attacked", "hit_self": false, "once_in": 2 } ], "melee_damage_bonus": [ { "type": "stab", "add": 3 } ], + "incoming_damage_mod": [ { "type": "heat", "multiply": 0.6 } ], "values": [ { "value": "DEXTERITY", "add": -1 }, { "value": "STRENGTH", "add": 1 }, - { "value": "CLIMATE_CONTROL_HEAT", "add": 20 }, - { "value": "ARMOR_HEAT", "multiply": 0.6 } + { "value": "CLIMATE_CONTROL_HEAT", "add": 20 } ] } ] diff --git a/data/mods/Magiclysm/items/item_enchants.json b/data/mods/Magiclysm/items/item_enchants.json index e1b6f0c5ec830..315fe3e8c6098 100644 --- a/data/mods/Magiclysm/items/item_enchants.json +++ b/data/mods/Magiclysm/items/item_enchants.json @@ -26,31 +26,33 @@ "condition": "ALWAYS", "name": { "str": "Magic armor" }, "description": "This magical armor improves with your intelligence and the spell's level.", - "values": [ + "incoming_damage_mod": [ { - "value": "ARMOR_BASH", + "type": "bash", "add": { "math": [ "((u_val('intelligence') * 1.5) + (u_spell_level('spirit_armor') + u_spell_level('spirit_armor_plus')) * 0.5) * -1" ] } }, { - "value": "ARMOR_CUT", + "type": "stab", "add": { "math": [ "((u_val('intelligence') * 1.5) + (u_spell_level('spirit_armor') + u_spell_level('spirit_armor_plus')) * 0.5) * -1" ] } }, { - "value": "ARMOR_STAB", + "type": "cut", "add": { "math": [ "((u_val('intelligence') * 1.5) + (u_spell_level('spirit_armor') + u_spell_level('spirit_armor_plus')) * 0.5) * -1" ] } }, { - "value": "ARMOR_BULLET", + "type": "bullet", "add": { "math": [ "((u_val('intelligence') * 1.5) + (u_spell_level('spirit_armor') + u_spell_level('spirit_armor_plus')) * 0.5) * -1" ] } - }, + } + ], + "values": [ { "value": "LUMINATION", "add": { @@ -95,9 +97,9 @@ "name": { "str": "Caustic Aura" }, "description": "A thin shell of acid hangs in the air around you.", "hit_me_effect": [ { "id": "corrosive_aura_spell" } ], - "values": [ + "incoming_damage_mod": [ { - "value": "ARMOR_ACID", + "type": "acid", "add": { "math": [ "(-2 - (0.5 * u_spell_level('biomancer_caustic_aura')) - (0.5 * u_spell_level('biomancer_caustic_aura_plus')))" ] } @@ -169,16 +171,18 @@ "name": { "str": "Luck Bone" }, "//": "relic_data is set when the item is created and then never changes, so each luck-bone should have random minor effects. All deliberately picked so they can't be seen on the character sheet", "description": "The spirits within are giving you their blessing.", + "incoming_damage_mod": [ + { "type": "bash", "add": { "math": [ "rand(3) * -1" ] } }, + { "type": "cut", "add": { "math": [ "rand(3) * -1" ] } }, + { "type": "stab", "add": { "math": [ "rand(3) * -1" ] } }, + { "type": "bullet", "add": { "math": [ "rand(3) * -1" ] } }, + { "type": "acid", "add": { "math": [ "rand(3) * -1" ] } }, + { "type": "electric", "add": { "math": [ "rand(3) * -1" ] } }, + { "type": "heat", "add": { "math": [ "rand(3) * -1" ] } }, + { "type": "cold", "add": { "math": [ "rand(3) * -1" ] } }, + { "type": "biological", "add": { "math": [ "rand(3) * -1" ] } } + ], "values": [ - { "value": "ARMOR_ACID", "add": { "math": [ "rand(3) * -1" ] } }, - { "value": "ARMOR_BASH", "add": { "math": [ "rand(3) * -1" ] } }, - { "value": "ARMOR_BIO", "add": { "math": [ "rand(3) * -1" ] } }, - { "value": "ARMOR_BULLET", "add": { "math": [ "rand(3) * -1" ] } }, - { "value": "ARMOR_COLD", "add": { "math": [ "rand(3) * -1" ] } }, - { "value": "ARMOR_CUT", "add": { "math": [ "rand(3) * -1" ] } }, - { "value": "ARMOR_ELEC", "add": { "math": [ "rand(3) * -1" ] } }, - { "value": "ARMOR_HEAT", "add": { "math": [ "rand(3) * -1" ] } }, - { "value": "ARMOR_STAB", "add": { "math": [ "rand(3) * -1" ] } }, { "value": "FORCEFIELD", "add": { "math": [ "rand(5) * 0.01" ] } }, { "value": "EVASION", "add": { "math": [ "rand(5) * 0.01" ] } }, { "value": "LEARNING_FOCUS", "add": { "math": [ "rand(5)" ] } }, diff --git a/data/mods/Magiclysm/items/obsolete.json b/data/mods/Magiclysm/items/obsolete.json index d3a90688d23b8..c080dcf18dad3 100644 --- a/data/mods/Magiclysm/items/obsolete.json +++ b/data/mods/Magiclysm/items/obsolete.json @@ -113,9 +113,6 @@ "UNBREAKABLE", "ALLOWS_NATURAL_ATTACKS" ], - "relic_data": { - "passive_effects": [ { "has": "WORN", "condition": "ALWAYS", "values": [ { "value": "ARMOR_ACID", "multiply": -0.25 } ] } ] - }, "armor": [ { "encumbrance": 0, @@ -146,9 +143,6 @@ "UNBREAKABLE", "ALLOWS_NATURAL_ATTACKS" ], - "relic_data": { - "passive_effects": [ { "has": "WORN", "condition": "ALWAYS", "values": [ { "value": "ARMOR_ACID", "multiply": -0.6 } ] } ] - }, "armor": [ { "encumbrance": 0, diff --git a/data/mods/Magiclysm/mutations/debug_mutations.json b/data/mods/Magiclysm/mutations/debug_mutations.json index f11a45d569b70..10819831da2a9 100644 --- a/data/mods/Magiclysm/mutations/debug_mutations.json +++ b/data/mods/Magiclysm/mutations/debug_mutations.json @@ -9,7 +9,11 @@ "description": { "str": "To cast bug killing spells.", "//~": "NO_I18N" }, "debug": false, "enchantments": [ - { "condition": "ALWAYS", "values": [ { "value": "ARMOR_BULLET", "add": -100 }, { "value": "PERCEPTION", "add": 15 } ] } + { + "condition": "ALWAYS", + "incoming_damage_mod": [ { "type": "bullet", "add": -100 } ], + "values": [ { "value": "PERCEPTION", "add": 15 } ] + } ] }, { diff --git a/data/mods/Magiclysm/traits/attunements.json b/data/mods/Magiclysm/traits/attunements.json index a92a54722fe38..02bd7c08abc6a 100644 --- a/data/mods/Magiclysm/traits/attunements.json +++ b/data/mods/Magiclysm/traits/attunements.json @@ -306,8 +306,8 @@ "spells_learned": [ [ "quake", 5 ], [ "rock_blast", 5 ] ], "enchantments": [ { + "incoming_damage_mod": [ { "type": "cut", "add": -15 } ], "values": [ - { "value": "ARMOR_CUT", "add": -15 }, { "value": "STRENGTH", "add": 5 }, { "value": "MAX_STAMINA", "multiply": 3 }, { "value": "REGEN_STAMINA", "multiply": 3 } @@ -353,11 +353,8 @@ "description": "You have used your expertise in Biomancy to change your body more toward your affinity for fire as a Kelvinist. Fire doesn't bother you as much anymore, and your blood is flammable when it touches the air, resulting in a gout of flame when something hurts you. You are also starting to study more spells that focus on using your own body's affinity for fire.\n\nSalamander: Your Fire Elemental abilities grant you good resistance to temperature conditions and heat damage. Also, your body emits streams of blistering heat towards anyone who attacks you.", "enchantments": [ { - "values": [ - { "value": "ARMOR_HEAT", "multiply": -0.4 }, - { "value": "CLIMATE_CONTROL_HEAT", "add": 30 }, - { "value": "CLIMATE_CONTROL_CHILL", "add": 10 } - ] + "incoming_damage_mod": [ { "type": "heat", "multiply": -0.4 } ], + "values": [ { "value": "CLIMATE_CONTROL_HEAT", "add": 30 }, { "value": "CLIMATE_CONTROL_CHILL", "add": 10 } ] }, { "hit_me_effect": [ @@ -682,11 +679,8 @@ "enchantments": [ { "melee_damage_bonus": [ { "type": "cold", "add": 9 } ], - "values": [ - { "value": "ARMOR_COLD", "multiply": -0.4 }, - { "value": "CLIMATE_CONTROL_HEAT", "add": 10 }, - { "value": "CLIMATE_CONTROL_CHILL", "add": 30 } - ] + "incoming_damage_mod": [ { "type": "cold", "multiply": -0.4 } ], + "values": [ { "value": "CLIMATE_CONTROL_HEAT", "add": 10 }, { "value": "CLIMATE_CONTROL_CHILL", "add": 30 } ] }, { "hit_you_effect": [ @@ -780,7 +774,7 @@ "purifiable": false, "valid": false, "description": "This attunement grants you a magical control over the forces of magnetism.\n\nPower: Your Magnetism Mage abilities grant you a good defense against firearms, perfect electric immunity, and the ability to see electric creatures from any distance.", - "enchantments": [ "ELECTRIC_VISION", { "values": [ { "value": "ARMOR_BULLET", "add": -50 } ] } ], + "enchantments": [ "ELECTRIC_VISION", { "incoming_damage_mod": [ { "type": "bullet", "add": -50 } ] } ], "prereqs": [ "STORMSHAPER", "EARTHSHAPER" ], "spells_learned": [ [ "railgun", 5 ], [ "magnetismmage_electrolaser", 5 ], [ "robot_disabler_explosion", 5 ] ], "cancels": [ @@ -1040,7 +1034,7 @@ "description": "You've used your knowledge of Biomancy to change your body into a form befitting a Stormshaper. You can better withstand the power of electricity, and sparks leap from your skin when something hits you. You're beginning to study spells that utilize your body's affinity for the electric.\n\nCyclone: Your Storm Elemental abilities grant you total electric immunity, and reflective zippers to anyone who tries to attack you.", "prereqs": [ "STORMSHAPER", "BIOMANCER" ], "enchantments": [ - { "values": [ { "value": "ARMOR_ELEC", "multiply": -0.4 } ] }, + { "incoming_damage_mod": [ { "type": "electric", "multiply": -0.4 } ] }, { "hit_me_effect": [ { @@ -1282,7 +1276,10 @@ "spells_learned": [ [ "lava_bomb_main", 5 ], [ "vulcanist_pyroclastic_flow", 5 ] ], "prereqs": [ "EARTHSHAPER", "KELVINIST" ], "enchantments": [ - { "values": [ { "value": "CLIMATE_CONTROL_HEAT", "add": 30 }, { "value": "ARMOR_HEAT", "multiply": -1.0 } ] }, + { + "incoming_damage_mod": [ { "type": "heat", "multiply": -1 } ], + "values": [ { "value": "CLIMATE_CONTROL_HEAT", "add": 30 } ] + }, { "ench_effects": [ { "effect": "effect_vulcanist_no_smoke_or_blisters", "intensity": 1 } ] } ], "cancels": [ diff --git a/data/mods/MindOverMatter/effects/effects_monster.json b/data/mods/MindOverMatter/effects/effects_monster.json index 19415d3e02007..a3a61128b8890 100644 --- a/data/mods/MindOverMatter/effects/effects_monster.json +++ b/data/mods/MindOverMatter/effects/effects_monster.json @@ -103,7 +103,7 @@ "show_in_info": true, "enchantments": [ { - "values": [ { "value": "ARMOR_CUT", "add": -6 }, { "value": "ARMOR_BASH", "add": -9 }, { "value": "ARMOR_STAB", "add": -4 } ] + "incoming_damage_mod": [ { "type": "bash", "add": -9 }, { "type": "stab", "add": -4 }, { "type": "cut", "add": -6 } ] } ] }, @@ -223,7 +223,7 @@ "id": "effect_monster_pyrokinetic_fire_immunity", "name": [ "Flame Immunity" ], "desc": [ "You are immune to fire." ], - "enchantments": [ { "values": [ { "value": "ARMOR_HEAT", "multiply": -1 } ] } ] + "enchantments": [ { "incoming_damage_mod": [ { "type": "heat", "multiply": -1 } ] } ] }, { "type": "effect_type", @@ -233,13 +233,13 @@ "show_in_info": true, "enchantments": [ { - "values": [ - { "value": "ARMOR_CUT", "multiply": -0.1 }, - { "value": "ARMOR_BASH", "multiply": -0.1 }, - { "value": "ARMOR_STAB", "multiply": -0.1 }, - { "value": "ARMOR_BULLET", "multiply": -0.1 }, - { "value": "SPEED", "multiply": 0.03 } - ] + "incoming_damage_mod": [ + { "type": "bash", "multiply": -0.1 }, + { "type": "stab", "multiply": -0.1 }, + { "type": "cut", "multiply": -0.1 }, + { "type": "bullet", "multiply": -0.1 } + ], + "values": [ { "value": "SPEED", "multiply": 0.03 } ] } ] }, @@ -252,11 +252,11 @@ "flags": [ "TELEKIN_SHIELD" ], "enchantments": [ { - "values": [ - { "value": "ARMOR_CUT", "add": -15 }, - { "value": "ARMOR_BASH", "add": -10 }, - { "value": "ARMOR_STAB", "add": -20 }, - { "value": "ARMOR_BULLET", "add": -35 } + "incoming_damage_mod": [ + { "type": "bash", "add": -10 }, + { "type": "stab", "add": -20 }, + { "type": "cut", "add": -15 }, + { "type": "bullet", "add": -35 } ] } ] @@ -270,11 +270,11 @@ "flags": [ "TELEKIN_SHIELD" ], "enchantments": [ { - "values": [ - { "value": "ARMOR_CUT", "add": -25 }, - { "value": "ARMOR_BASH", "add": -18 }, - { "value": "ARMOR_STAB", "add": -32 }, - { "value": "ARMOR_BULLET", "add": -50 } + "incoming_damage_mod": [ + { "type": "bash", "add": -18 }, + { "type": "stab", "add": -32 }, + { "type": "cut", "add": -25 }, + { "type": "bullet", "add": -50 } ] } ] diff --git a/data/mods/MindOverMatter/effects/effects_potions.json b/data/mods/MindOverMatter/effects/effects_potions.json index ee13166685848..3a0b8bc3de456 100644 --- a/data/mods/MindOverMatter/effects/effects_potions.json +++ b/data/mods/MindOverMatter/effects/effects_potions.json @@ -43,7 +43,7 @@ "flags": [ "BLEED_IMMUNE", "STEADY" ], "enchantments": [ { - "values": [ { "value": "ARMOR_CUT", "add": -4 }, { "value": "ARMOR_BASH", "add": -6 }, { "value": "ARMOR_STAB", "add": -3 } ] + "incoming_damage_mod": [ { "type": "bash", "add": -6 }, { "type": "stab", "add": -3 }, { "type": "cut", "add": -4 } ] } ] }, @@ -66,7 +66,7 @@ "pain_max_val": [ 10 ], "pain_tick": [ 200 ] }, - "enchantments": [ { "values": [ { "value": "ARMOR_BASH", "add": 4 } ] } ] + "enchantments": [ { "incoming_damage_mod": [ { "type": "bash", "add": 4 } ] } ] }, { "type": "effect_type", diff --git a/data/mods/MindOverMatter/effects/effects_psionic.json b/data/mods/MindOverMatter/effects/effects_psionic.json index 087eb662ddd69..26a36d4435b6d 100644 --- a/data/mods/MindOverMatter/effects/effects_psionic.json +++ b/data/mods/MindOverMatter/effects/effects_psionic.json @@ -240,19 +240,21 @@ "blocks_effects": [ "bleed", "hypovolemia", "dermatik" ], "enchantments": [ { - "values": [ - { - "value": "ARMOR_CUT", - "add": { "math": [ "( -4 * (scaling_factor(u_val('intelligence') ) ) ) * u_nether_attunement_power_scaling" ] } - }, + "incoming_damage_mod": [ { - "value": "ARMOR_BASH", + "type": "bash", "add": { "math": [ "( -6 * (scaling_factor(u_val('intelligence') ) ) ) * u_nether_attunement_power_scaling" ] } }, { - "value": "ARMOR_STAB", + "type": "stab", "add": { "math": [ "( -3 * (scaling_factor(u_val('intelligence') ) ) ) * u_nether_attunement_power_scaling" ] } }, + { + "type": "cut", + "add": { "math": [ "( -4 * (scaling_factor(u_val('intelligence') ) ) ) * u_nether_attunement_power_scaling" ] } + } + ], + "values": [ { "value": "PAIN", "multiply": { @@ -671,31 +673,7 @@ { "values": [ { - "value": "ARMOR_CUT", - "add": { "math": [ "( ( u_discern_weakness_clear_power_level * 1.5) + 2) * u_discern_weakness_clear_intelligence" ] } - }, - { - "value": "ARMOR_BASH", - "add": { "math": [ "( ( u_discern_weakness_clear_power_level * 1.5) + 2) * u_discern_weakness_clear_intelligence" ] } - }, - { - "value": "ARMOR_STAB", - "add": { "math": [ "( ( u_discern_weakness_clear_power_level * 1.5) + 2) * u_discern_weakness_clear_intelligence" ] } - }, - { - "value": "ARMOR_BULLET", - "add": { "math": [ "( ( u_discern_weakness_clear_power_level * 1.5) + 2) * u_discern_weakness_clear_intelligence" ] } - }, - { - "value": "ARMOR_ELEC", - "add": { "math": [ "( ( u_discern_weakness_clear_power_level * 1.5) + 2) * u_discern_weakness_clear_intelligence" ] } - }, - { - "value": "ARMOR_HEAT", - "add": { "math": [ "( ( u_discern_weakness_clear_power_level * 1.5) + 2) * u_discern_weakness_clear_intelligence" ] } - }, - { - "value": "ARMOR_COLD", + "value": "ARMOR_ALL", "add": { "math": [ "( ( u_discern_weakness_clear_power_level * 1.5) + 2) * u_discern_weakness_clear_intelligence" ] } } ] @@ -1702,7 +1680,7 @@ "max_duration": "7 days", "max_intensity": 95, "blocks_effects": [ "blisters" ], - "enchantments": [ { "values": [ { "value": "ARMOR_HEAT", "multiply": -1.0 } ] } ], + "enchantments": [ { "incoming_damage_mod": [ { "type": "heat", "multiply": -1 } ] } ], "flags": [ "HEAT_IMMUNE" ] }, { @@ -1717,25 +1695,25 @@ "max_intensity": 41, "enchantments": [ { - "values": [ + "incoming_damage_mod": [ { - "value": "ARMOR_CUT", + "type": "bash", "multiply": { "math": [ - "( ( u_spell_level('telekinetic_momentum') * -0.005 ) * (scaling_factor(u_val('intelligence') ) ) ) * u_nether_attunement_power_scaling" + "( ( u_spell_level('telekinetic_momentum') * -0.01 ) * (scaling_factor(u_val('intelligence') ) ) ) * u_nether_attunement_power_scaling" ] } }, { - "value": "ARMOR_BASH", + "type": "stab", "multiply": { "math": [ - "( ( u_spell_level('telekinetic_momentum') * -0.01 ) * (scaling_factor(u_val('intelligence') ) ) ) * u_nether_attunement_power_scaling" + "( ( u_spell_level('telekinetic_momentum') * -0.005 ) * (scaling_factor(u_val('intelligence') ) ) ) * u_nether_attunement_power_scaling" ] } }, { - "value": "ARMOR_STAB", + "type": "cut", "multiply": { "math": [ "( ( u_spell_level('telekinetic_momentum') * -0.005 ) * (scaling_factor(u_val('intelligence') ) ) ) * u_nether_attunement_power_scaling" @@ -1743,13 +1721,15 @@ } }, { - "value": "ARMOR_BULLET", + "type": "bullet", "multiply": { "math": [ "( ( u_spell_level('telekinetic_momentum') * -0.02 ) * (scaling_factor(u_val('intelligence') ) ) ) * u_nether_attunement_power_scaling" ] } - }, + } + ], + "values": [ { "value": "MOVE_COST", "multiply": { @@ -1854,33 +1834,33 @@ "flags": [ "TELEKIN_SHIELD" ], "enchantments": [ { - "values": [ + "incoming_damage_mod": [ { - "value": "ARMOR_CUT", + "type": "bash", "add": { "math": [ - "( -3 + ( u_spell_level('telekinetic_shield') * -1) * (scaling_factor(u_val('intelligence') ) ) ) * u_nether_attunement_power_scaling" + "( -2 + ( u_spell_level('telekinetic_shield') * -0.5) * (scaling_factor(u_val('intelligence') ) ) ) * u_nether_attunement_power_scaling" ] } }, { - "value": "ARMOR_BASH", + "type": "stab", "add": { "math": [ - "( -2 + ( u_spell_level('telekinetic_shield') * -0.5) * (scaling_factor(u_val('intelligence') ) ) ) * u_nether_attunement_power_scaling" + "( -5 + ( u_spell_level('telekinetic_shield') * -1.5) * (scaling_factor(u_val('intelligence') ) ) ) * u_nether_attunement_power_scaling" ] } }, { - "value": "ARMOR_STAB", + "type": "cut", "add": { "math": [ - "( -5 + ( u_spell_level('telekinetic_shield') * -1.5) * (scaling_factor(u_val('intelligence') ) ) ) * u_nether_attunement_power_scaling" + "( -3 + ( u_spell_level('telekinetic_shield') * -1) * (scaling_factor(u_val('intelligence') ) ) ) * u_nether_attunement_power_scaling" ] } }, { - "value": "ARMOR_BULLET", + "type": "bullet", "add": { "math": [ "( -12 + ( u_spell_level('telekinetic_shield') * -2.5) * (scaling_factor(u_val('intelligence') ) ) ) * u_nether_attunement_power_scaling" @@ -1916,11 +1896,11 @@ "removes_effects": [ "grabbed" ], "enchantments": [ { - "values": [ - { "value": "ARMOR_CUT", "add": -100000 }, - { "value": "ARMOR_BASH", "add": -100000 }, - { "value": "ARMOR_STAB", "add": -100000 }, - { "value": "ARMOR_BULLET", "add": -100000 } + "incoming_damage_mod": [ + { "type": "bash", "add": -100000 }, + { "type": "stab", "add": -100000 }, + { "type": "cut", "add": -100000 }, + { "type": "bullet", "add": -100000 } ] } ], diff --git a/data/mods/MindOverMatter/enchantments/enchantments_baneful.json b/data/mods/MindOverMatter/enchantments/enchantments_baneful.json index 3b176124d5f72..6ed86f753ee30 100644 --- a/data/mods/MindOverMatter/enchantments/enchantments_baneful.json +++ b/data/mods/MindOverMatter/enchantments/enchantments_baneful.json @@ -3,12 +3,13 @@ "type": "enchantment", "id": "ench_nemesis_buff", "condition": "ALWAYS", - "values": [ - { "value": "SPEED", "add": { "math": [ "Nemesis_iteration * 1" ] } }, - { "value": "ARMOR_BASH", "add": { "math": [ "Nemesis_iteration * -1" ] } }, - { "value": "ARMOR_STAB", "add": { "math": [ "Nemesis_iteration * -1" ] } }, - { "value": "ARMOR_CUT", "add": { "math": [ "Nemesis_iteration * -1" ] } } - ] + "incoming_damage_mod": [ + { "type": "bash", "add": { "math": [ "Nemesis_iteration * -1" ] } }, + { "type": "stab", "add": { "math": [ "Nemesis_iteration * -1" ] } }, + { "type": "cut", "add": { "math": [ "Nemesis_iteration * -1" ] } }, + { "type": "bullet", "add": { "math": [ "Nemesis_iteration * -1" ] } } + ], + "values": [ { "value": "SPEED", "add": { "math": [ "Nemesis_iteration * 1" ] } } ] }, { "type": "enchantment", diff --git a/data/mods/MindOverMatter/enchantments/enchantments_player.json b/data/mods/MindOverMatter/enchantments/enchantments_player.json index 4efff57cbdefd..325452da4bf94 100644 --- a/data/mods/MindOverMatter/enchantments/enchantments_player.json +++ b/data/mods/MindOverMatter/enchantments/enchantments_player.json @@ -91,7 +91,7 @@ "condition": "ALWAYS", "has": "HELD", "hit_you_effect": [ { "id": "electrokin_zap_attack", "hit_self": false, "once_in": 2 } ], - "values": [ { "value": "ARMOR_ELEC", "add": { "math": [ "u_spell_level('electrokinetic_melee_attacks') * -1" ] } } ] + "incoming_damage_mod": [ { "type": "electric", "add": { "math": [ "u_spell_level('electrokinetic_melee_attacks') * -1" ] } } ] }, { "id": "electrokin_zap_attack", @@ -129,36 +129,38 @@ "condition": "ALWAYS", "has": "HELD", "emitter": "emit_pyrokin_cloak", - "values": [ + "incoming_damage_mod": [ { - "value": "CLIMATE_CONTROL_CHILL", - "add": { + "type": "heat", + "multiply": { "math": [ - "(60 + ( u_spell_level('pyrokinetic_cloak') * 4) * ( ( u_val('intelligence') + 10) / 20 ) ) * u_nether_attunement_power_scaling" + "( ( u_spell_level('pyrokinetic_cloak') * -1) * ( ( u_val('intelligence') + 10) / 20 ) ) * u_nether_attunement_power_scaling" ] } }, { - "value": "CLIMATE_CONTROL_HEAT", - "add": { + "type": "cold", + "multiply": { "math": [ - "( ( u_spell_level('pyrokinetic_cloak') * 10) * ( ( u_val('intelligence') + 10) / 20 ) ) * u_nether_attunement_power_scaling" + "( ( u_spell_level('pyrokinetic_cloak') * -3) * ( ( u_val('intelligence') + 10) / 20 ) ) * u_nether_attunement_power_scaling" ] } - }, + } + ], + "values": [ { - "value": "ARMOR_HEAT", + "value": "CLIMATE_CONTROL_CHILL", "add": { "math": [ - "( ( u_spell_level('pyrokinetic_cloak') * -1) * ( ( u_val('intelligence') + 10) / 20 ) ) * u_nether_attunement_power_scaling" + "(60 + ( u_spell_level('pyrokinetic_cloak') * 4) * ( ( u_val('intelligence') + 10) / 20 ) ) * u_nether_attunement_power_scaling" ] } }, { - "value": "ARMOR_COLD", + "value": "CLIMATE_CONTROL_HEAT", "add": { "math": [ - "( ( u_spell_level('pyrokinetic_cloak') * -3) * ( ( u_val('intelligence') + 10) / 20 ) ) * u_nether_attunement_power_scaling" + "( ( u_spell_level('pyrokinetic_cloak') * 10) * ( ( u_val('intelligence') + 10) / 20 ) ) * u_nether_attunement_power_scaling" ] } } @@ -268,7 +270,7 @@ "id": "enchant_electrokin_potion", "condition": "ALWAYS", "has": "HELD", - "values": [ { "value": "ARMOR_ELEC", "add": -5 } ], + "incoming_damage_mod": [ { "type": "electric", "add": -5 } ], "hit_me_effect": [ { "id": "electro_potion_attacked", "hit_self": false } ] }, { @@ -297,7 +299,7 @@ "id": "enchant_pyrokin_potion", "condition": "ALWAYS", "has": "HELD", - "values": [ { "value": "ARMOR_HEAT", "add": -50 } ], + "incoming_damage_mod": [ { "type": "heat", "add": -50 } ], "hit_me_effect": [ { "id": "pyro_aura_attacked", "hit_self": false } ] }, { diff --git a/data/mods/MindOverMatter/items/armor/belt.json b/data/mods/MindOverMatter/items/armor/belt.json index 6aef8bcb67b11..90b0bb7112501 100644 --- a/data/mods/MindOverMatter/items/armor/belt.json +++ b/data/mods/MindOverMatter/items/armor/belt.json @@ -42,11 +42,11 @@ "has": "WORN", "condition": "ACTIVE", "ench_effects": [ { "effect": "effect_shield_belt_telekin_protection", "intensity": 1 } ], - "values": [ - { "value": "ARMOR_CUT", "add": -15 }, - { "value": "ARMOR_BASH", "add": -8 }, - { "value": "ARMOR_STAB", "add": -20 }, - { "value": "ARMOR_BULLET", "add": -40 } + "incoming_damage_mod": [ + { "type": "bash", "add": -8 }, + { "type": "stab", "add": -20 }, + { "type": "cut", "add": -15 }, + { "type": "bullet", "add": -40 } ] } ], @@ -70,22 +70,7 @@ "type": "transform" } ], - "extend": { "flags": [ "NO_TAKEOFF" ] }, - "relic_data": { - "passive_effects": [ - { - "has": "WORN", - "condition": "ACTIVE", - "ench_effects": [ { "effect": "effect_shield_belt_telekin_protection", "intensity": 1 } ], - "values": [ - { "value": "ARMOR_CUT", "add": -15 }, - { "value": "ARMOR_BASH", "add": -8 }, - { "value": "ARMOR_STAB", "add": -20 }, - { "value": "ARMOR_BULLET", "add": -40 } - ] - } - ] - } + "extend": { "flags": [ "NO_TAKEOFF" ] } }, { "id": "psionic_shield_belt_broken", @@ -166,7 +151,8 @@ { "has": "WORN", "condition": "ALWAYS", - "values": [ { "value": "ARMOR_HEAT", "multiply": -1.0 }, { "value": "CLIMATE_CONTROL_CHILL", "add": 1000 } ] + "incoming_damage_mod": [ { "type": "heat", "multiply": -1 } ], + "values": [ { "value": "CLIMATE_CONTROL_CHILL", "add": 1000 } ] } ] } diff --git a/data/mods/MindOverMatter/mutations/psi_passives.json b/data/mods/MindOverMatter/mutations/psi_passives.json index 9bef1d20049cd..3ecf5917204f6 100644 --- a/data/mods/MindOverMatter/mutations/psi_passives.json +++ b/data/mods/MindOverMatter/mutations/psi_passives.json @@ -83,10 +83,8 @@ "purifiable": false, "enchantments": [ { - "values": [ - { "value": "ARMOR_ELEC", "add": { "math": [ "u_spell_level_sum('school': 'ELECTROKINETIC') / -0.2" ] } }, - { "value": "PAIN", "multiply": { "math": [ "u_spell_level_sum('school': 'ELECTROKINETIC') * -0.00035" ] } } - ] + "incoming_damage_mod": [ { "type": "electric", "add": { "math": [ "u_spell_level_sum('school': 'ELECTROKINETIC') / -0.2" ] } } ], + "values": [ { "value": "PAIN", "multiply": { "math": [ "u_spell_level_sum('school': 'ELECTROKINETIC') * -0.00035" ] } } ] } ] }, diff --git a/data/mods/Xedra_Evolved/effects/effects.json b/data/mods/Xedra_Evolved/effects/effects.json index a458053215e1f..ebcd36807bb7e 100644 --- a/data/mods/Xedra_Evolved/effects/effects.json +++ b/data/mods/Xedra_Evolved/effects/effects.json @@ -162,7 +162,7 @@ "name": [ "Shadow Damage Reduction" ], "desc": [ "You are flatter and less real in ways that makes you less susceptible to damage." ], "show_in_info": true, - "enchantments": [ { "values": [ { "value": "ARMOR_BULLET", "multiply": -0.75 }, { "value": "ARMOR_BASH", "multiply": -0.75 } ] } ] + "enchantments": [ { "incoming_damage_mod": [ { "type": "bash", "multiply": -0.75 }, { "type": "bullet", "multiply": -0.75 } ] } ] }, { "type": "effect_type", @@ -551,9 +551,9 @@ "rating": "good", "enchantments": [ { - "values": [ + "incoming_damage_mod": [ { - "value": "ARMOR_BASH", + "type": "bash", "multiply": { "math": [ "max(((vampire_total_tier_one_traits() * -0.01) + (vampire_total_tier_two_traits() * -0.02) + (vampire_total_tier_three_traits() * -0.04) + (vampire_total_tier_four_traits_plus_potence() * -0.06)), -0.66)" @@ -561,23 +561,23 @@ } }, { - "value": "ARMOR_CUT", + "type": "stab", "multiply": { "math": [ - "max(((vampire_total_tier_one_traits() * -0.005) + (vampire_total_tier_two_traits() * -0.01) + (vampire_total_tier_three_traits() * -0.02) + (vampire_total_tier_four_traits_plus_potence() * -0.03)), -0.33)" + "max(((vampire_total_tier_one_traits() * -0.003) + (vampire_total_tier_two_traits() * -0.007) + (vampire_total_tier_three_traits() * -0.015) + (vampire_total_tier_four_traits_plus_potence() * -0.025)), -0.25)" ] } }, { - "value": "ARMOR_STAB", + "type": "cut", "multiply": { "math": [ - "max(((vampire_total_tier_one_traits() * -0.003) + (vampire_total_tier_two_traits() * -0.007) + (vampire_total_tier_three_traits() * -0.015) + (vampire_total_tier_four_traits_plus_potence() * -0.025)), -0.25)" + "max(((vampire_total_tier_one_traits() * -0.005) + (vampire_total_tier_two_traits() * -0.01) + (vampire_total_tier_three_traits() * -0.02) + (vampire_total_tier_four_traits_plus_potence() * -0.03)), -0.33)" ] } }, { - "value": "ARMOR_BULLET", + "type": "bullet", "multiply": { "math": [ "max(((vampire_total_tier_one_traits() * -0.012) + (vampire_total_tier_two_traits() * -0.025) + (vampire_total_tier_three_traits() * -0.05) + (vampire_total_tier_four_traits_plus_potence() * -0.075)), -0.85)" @@ -741,21 +741,7 @@ "rating": "good", "show_intensity": false, "//": "+1 armor for each lvl", - "enchantments": [ - { - "values": [ - { "value": "ARMOR_BASH", "add": { "math": [ "-1 * u_spell_level('spell_endurance')" ] } }, - { "value": "ARMOR_CUT", "add": { "math": [ "-1 * u_spell_level('spell_endurance')" ] } }, - { "value": "ARMOR_STAB", "add": { "math": [ "-1 * u_spell_level('spell_endurance')" ] } }, - { "value": "ARMOR_BULLET", "add": { "math": [ "-1 * u_spell_level('spell_endurance')" ] } }, - { "value": "ARMOR_ACID", "add": { "math": [ "-1 * u_spell_level('spell_endurance')" ] } }, - { "value": "ARMOR_BIO", "add": { "math": [ "-1 * u_spell_level('spell_endurance')" ] } }, - { "value": "ARMOR_COLD", "add": { "math": [ "-1 * u_spell_level('spell_endurance')" ] } }, - { "value": "ARMOR_ELEC", "add": { "math": [ "-1 * u_spell_level('spell_endurance')" ] } }, - { "value": "ARMOR_HEAT", "add": { "math": [ "-1 * u_spell_level('spell_endurance')" ] } } - ] - } - ] + "enchantments": [ { "values": [ { "value": "ARMOR_ALL", "add": { "math": [ "-1 * u_spell_level('spell_endurance')" ] } } ] } ] }, { "id": "spell_melee_damage", @@ -800,21 +786,8 @@ "show_intensity": false, "max_intensity": 2, "int_add_val": 1, - "enchantments": [ - { - "values": [ - { "value": "ARMOR_BASH", "add": { "math": [ "10 * u_spell_level('spell_weak')" ] } }, - { "value": "ARMOR_CUT", "add": { "math": [ "10 * u_spell_level('spell_weak')" ] } }, - { "value": "ARMOR_STAB", "add": { "math": [ "10 * u_spell_level('spell_weak')" ] } }, - { "value": "ARMOR_BULLET", "add": { "math": [ "10 * u_spell_level('spell_weak')" ] } }, - { "value": "ARMOR_ACID", "add": { "math": [ "10 * u_spell_level('spell_weak')" ] } }, - { "value": "ARMOR_BIO", "add": { "math": [ "10 * u_spell_level('spell_weak')" ] } }, - { "value": "ARMOR_COLD", "add": { "math": [ "10 * u_spell_level('spell_weak')" ] } }, - { "value": "ARMOR_ELEC", "add": { "math": [ "10 * u_spell_level('spell_weak')" ] } }, - { "value": "ARMOR_HEAT", "add": { "math": [ "10 * u_spell_level('spell_weak')" ] } } - ] - } - ] + "//": "todo: doesn't do anything, because monster do not have u_spell_level('spell_weak'); solution: store u_spell_level('spell_weak') as monster variable, and use variable in calculations instead", + "enchantments": [ { "values": [ { "value": "ARMOR_ALL", "add": { "math": [ "10 * u_spell_level('spell_weak')" ] } } ] } ] }, { "type": "effect_type", @@ -1238,12 +1211,12 @@ "removes_effects": [ "stunned", "dazed", "downed" ], "enchantments": [ { - "values": [ - { "value": "ARMOR_BASH", "multiply": -0.25 }, - { "value": "ARMOR_BULLET", "multiply": -0.25 }, - { "value": "ARMOR_CUT", "multiply": -0.25 }, - { "value": "ARMOR_STAB", "multiply": -0.25 }, - { "value": "ARMOR_HEAT", "multiply": -0.25 } + "incoming_damage_mod": [ + { "type": "bash", "multiply": -0.25 }, + { "type": "stab", "multiply": -0.25 }, + { "type": "cut", "multiply": -0.25 }, + { "type": "bullet", "multiply": -0.25 }, + { "type": "heat", "multiply": -0.25 } ] } ], @@ -1259,13 +1232,13 @@ "rating": "good", "enchantments": [ { - "values": [ - { "value": "ARMOR_BASH", "multiply": -0.3 }, - { "value": "ARMOR_BULLET", "multiply": -0.3 }, - { "value": "ARMOR_CUT", "multiply": -0.3 }, - { "value": "ARMOR_STAB", "multiply": -0.3 }, - { "value": "MOVE_COST", "multiply": 0.1 } - ] + "incoming_damage_mod": [ + { "type": "bash", "multiply": -0.3 }, + { "type": "stab", "multiply": -0.3 }, + { "type": "cut", "multiply": -0.3 }, + { "type": "bullet", "multiply": -0.3 } + ], + "values": [ { "value": "MOVE_COST", "multiply": 0.1 } ] } ], "flags": [ "BLEEDSLOW1" ] @@ -1420,7 +1393,12 @@ "rating": "good", "show_in_info": true, "removes_effects": [ "onfire", "blisters" ], - "enchantments": [ { "values": [ { "value": "CLIMATE_CONTROL_CHILL", "add": 1000 }, { "value": "ARMOR_HEAT", "add": -1000 } ] } ] + "enchantments": [ + { + "incoming_damage_mod": [ { "type": "heat", "add": -1000 } ], + "values": [ { "value": "CLIMATE_CONTROL_CHILL", "add": 1000 } ] + } + ] }, { "type": "effect_type", @@ -1430,7 +1408,12 @@ "desc": [ "" ], "rating": "good", "removes_effects": [ "onfire", "blisters" ], - "enchantments": [ { "values": [ { "value": "CLIMATE_CONTROL_CHILL", "add": 1000 }, { "value": "ARMOR_HEAT", "add": -1000 } ] } ] + "enchantments": [ + { + "incoming_damage_mod": [ { "type": "heat", "add": -1000 } ], + "values": [ { "value": "CLIMATE_CONTROL_CHILL", "add": 1000 } ] + } + ] }, { "type": "effect_type", @@ -1675,7 +1658,7 @@ "enchantments": [ { "hit_me_effect": [ { "id": "undine_acid_resist_ally_thorns", "hit_self": false, "once_in": 3 } ], - "values": [ { "value": "ARMOR_ACID", "multiply": -0.75 } ] + "incoming_damage_mod": [ { "type": "acid", "multiply": -0.75 } ] } ] }, @@ -2428,21 +2411,7 @@ "rating": "bad", "show_intensity": false, "show_in_info": true, - "enchantments": [ - { - "condition": "ALWAYS", - "values": [ - { "value": "ARMOR_BASH", "add": -15 }, - { "value": "ARMOR_STAB", "add": -15 }, - { "value": "ARMOR_CUT", "add": -15 }, - { "value": "ARMOR_HEAT", "add": -15 }, - { "value": "ARMOR_COLD", "add": -15 }, - { "value": "ARMOR_ELEC", "add": -15 }, - { "value": "ARMOR_ACID", "add": -15 }, - { "value": "ARMOR_BULLET", "add": -15 } - ] - } - ] + "enchantments": [ { "condition": "ALWAYS", "values": [ { "value": "ARMOR_ALL", "add": -15 } ] } ] }, { "id": "effect_moon_withdrawal", diff --git a/data/mods/Xedra_Evolved/enchantments/armor.json b/data/mods/Xedra_Evolved/enchantments/armor.json index 7df85a9ffcec7..a5674a0dfb588 100644 --- a/data/mods/Xedra_Evolved/enchantments/armor.json +++ b/data/mods/Xedra_Evolved/enchantments/armor.json @@ -6,7 +6,8 @@ "type": "enchantment", "has": "WORN", "condition": "ALWAYS", - "values": [ { "value": "CLIMATE_CONTROL_HEAT", "add": 20 }, { "value": "ARMOR_COLD", "add": -15 } ] + "incoming_damage_mod": [ { "type": "cold", "add": -15 } ], + "values": [ { "value": "CLIMATE_CONTROL_HEAT", "add": 20 } ] }, { "id": "ench_climate_periapta_feline", diff --git a/data/mods/Xedra_Evolved/itemgroups/map_extra_itemgroups.json b/data/mods/Xedra_Evolved/itemgroups/map_extra_itemgroups.json index f4964850ea256..88ea41f345730 100644 --- a/data/mods/Xedra_Evolved/itemgroups/map_extra_itemgroups.json +++ b/data/mods/Xedra_Evolved/itemgroups/map_extra_itemgroups.json @@ -187,78 +187,6 @@ "increment": 0.2, "power_per_increment": 100 }, - { - "weight": 100, - "min_value": -0.2, - "max_value": 1, - "type": "ARMOR_ACID", - "increment": 0.1, - "power_per_increment": -500 - }, - { - "weight": 100, - "min_value": -0.2, - "max_value": 1, - "type": "ARMOR_BASH", - "increment": 0.1, - "power_per_increment": -500 - }, - { - "weight": 100, - "min_value": -0.2, - "max_value": 1, - "type": "ARMOR_BIO", - "increment": 0.1, - "power_per_increment": -500 - }, - { - "weight": 100, - "min_value": -0.2, - "max_value": 1, - "type": "ARMOR_COLD", - "increment": 0.1, - "power_per_increment": -500 - }, - { - "weight": 100, - "min_value": -0.2, - "max_value": 1, - "type": "ARMOR_CUT", - "increment": 0.1, - "power_per_increment": -500 - }, - { - "weight": 100, - "min_value": -0.2, - "max_value": 1, - "type": "ARMOR_ELEC", - "increment": 0.1, - "power_per_increment": -500 - }, - { - "weight": 100, - "min_value": -0.2, - "max_value": 1, - "type": "ARMOR_HEAT", - "increment": 0.1, - "power_per_increment": -500 - }, - { - "weight": 100, - "min_value": -0.2, - "max_value": 1, - "type": "ARMOR_STAB", - "increment": 0.1, - "power_per_increment": -500 - }, - { - "weight": 100, - "min_value": -0.2, - "max_value": 1, - "type": "ARMOR_BULLET", - "increment": 0.1, - "power_per_increment": -500 - }, { "weight": 50, "min_value": -0.4, diff --git a/data/mods/Xedra_Evolved/items/inventor/armor.json b/data/mods/Xedra_Evolved/items/inventor/armor.json index 2a7906ecc6d9a..d64bacc52f029 100644 --- a/data/mods/Xedra_Evolved/items/inventor/armor.json +++ b/data/mods/Xedra_Evolved/items/inventor/armor.json @@ -308,11 +308,11 @@ { "has": "WORN", "condition": "ACTIVE", - "values": [ - { "value": "ARMOR_CUT", "multiply": -0.5 }, - { "value": "ARMOR_BASH", "multiply": -0.5 }, - { "value": "ARMOR_STAB", "multiply": -0.5 }, - { "value": "ARMOR_BULLET", "multiply": -0.5 } + "incoming_damage_mod": [ + { "type": "bash", "multiply": -0.5 }, + { "type": "stab", "multiply": -0.5 }, + { "type": "cut", "multiply": -0.5 }, + { "type": "bullet", "multiply": -0.5 } ] } ] diff --git a/data/mods/Xedra_Evolved/mutations/mutations.json b/data/mods/Xedra_Evolved/mutations/mutations.json index 608bb54f2601d..f8e848158467d 100644 --- a/data/mods/Xedra_Evolved/mutations/mutations.json +++ b/data/mods/Xedra_Evolved/mutations/mutations.json @@ -227,11 +227,11 @@ "deactivated_eocs": [ "EOC_VAMPIRIC_RESILIENCE_deactivated" ], "enchantments": [ { - "values": [ - { "value": "ARMOR_BASH", "multiply": -0.05 }, - { "value": "ARMOR_CUT", "multiply": -0.03 }, - { "value": "ARMOR_STAB", "multiply": -0.02 }, - { "value": "ARMOR_BULLET", "multiply": -0.08 } + "incoming_damage_mod": [ + { "type": "bash", "multiply": -0.05 }, + { "type": "stab", "multiply": -0.02 }, + { "type": "cut", "multiply": -0.03 }, + { "type": "bullet", "multiply": -0.08 } ] } ] diff --git a/data/mods/Xedra_Evolved/mutations/paraclesians/ierde_mutation_spells.json b/data/mods/Xedra_Evolved/mutations/paraclesians/ierde_mutation_spells.json index 340551a6521c4..95cb3b42def1e 100644 --- a/data/mods/Xedra_Evolved/mutations/paraclesians/ierde_mutation_spells.json +++ b/data/mods/Xedra_Evolved/mutations/paraclesians/ierde_mutation_spells.json @@ -12,13 +12,12 @@ "has": "HELD", "condition": "ALWAYS", "skills": [ { "value": "dodge", "multiply": -1 } ], + "incoming_damage_mod": [ { "type": "bash", "multiply": -0.5 }, { "type": "cut", "multiply": -0.66 } ], "values": [ { "value": "ATTACK_SPEED", "multiply": 2 }, { "value": "MOVE_COST", "multiply": 1 }, { "value": "BONUS_DODGE", "multiply": -1 }, - { "value": "FOOTSTEP_NOISE", "multiply": 4 }, - { "value": "ARMOR_CUT", "multiply": -0.66 }, - { "value": "ARMOR_BASH", "multiply": -0.5 } + { "value": "FOOTSTEP_NOISE", "multiply": 4 } ] }, { diff --git a/data/mods/Xedra_Evolved/mutations/paraclesians/salamander_mutations.json b/data/mods/Xedra_Evolved/mutations/paraclesians/salamander_mutations.json index e5fa1157d5472..8118e2d967106 100644 --- a/data/mods/Xedra_Evolved/mutations/paraclesians/salamander_mutations.json +++ b/data/mods/Xedra_Evolved/mutations/paraclesians/salamander_mutations.json @@ -585,7 +585,7 @@ "enchantments": [ { "condition": "ALWAYS", - "values": [ { "value": "ARMOR_HEAT", "multiply": -1 }, { "value": "ARMOR_COLD", "multiply": 0.5 } ], + "incoming_damage_mod": [ { "type": "heat", "multiply": -1 }, { "type": "cold", "multiply": 0.5 } ], "ench_effects": [ { "effect": "effect_hidden_flame_immunity", "intensity": 1 } ] } ], diff --git a/data/mods/Xedra_Evolved/mutations/paraclesians/sylph_mutations.json b/data/mods/Xedra_Evolved/mutations/paraclesians/sylph_mutations.json index b7713a1cf3c60..4e24bc8ab794f 100644 --- a/data/mods/Xedra_Evolved/mutations/paraclesians/sylph_mutations.json +++ b/data/mods/Xedra_Evolved/mutations/paraclesians/sylph_mutations.json @@ -223,7 +223,8 @@ "enchantments": [ { "condition": "ALWAYS", - "values": [ { "value": "CLIMATE_CONTROL_HEAT", "add": 15 }, { "value": "ARMOR_COLD", "add": -10 } ] + "incoming_damage_mod": [ { "type": "cold", "add": -10 } ], + "values": [ { "value": "CLIMATE_CONTROL_HEAT", "add": 15 } ] } ], "category": [ "SYLPH" ] @@ -240,7 +241,8 @@ "enchantments": [ { "condition": "ALWAYS", - "values": [ { "value": "CLIMATE_CONTROL_HEAT", "add": 45 }, { "value": "ARMOR_COLD", "multiply": -0.75 } ] + "incoming_damage_mod": [ { "type": "cold", "multiply": -0.75 } ], + "values": [ { "value": "CLIMATE_CONTROL_HEAT", "add": 45 } ] } ], "category": [ "SYLPH" ] @@ -259,7 +261,8 @@ "enchantments": [ { "condition": "ALWAYS", - "values": [ { "value": "CLIMATE_CONTROL_HEAT", "add": 150 }, { "value": "ARMOR_COLD", "multiply": -0.75 } ] + "incoming_damage_mod": [ { "type": "cold", "multiply": -0.75 } ], + "values": [ { "value": "CLIMATE_CONTROL_HEAT", "add": 150 } ] } ] }, diff --git a/data/mods/Xedra_Evolved/mutations/paraclesians/undine_mutation_spells.json b/data/mods/Xedra_Evolved/mutations/paraclesians/undine_mutation_spells.json index c364459ddf940..eb51ad776b824 100644 --- a/data/mods/Xedra_Evolved/mutations/paraclesians/undine_mutation_spells.json +++ b/data/mods/Xedra_Evolved/mutations/paraclesians/undine_mutation_spells.json @@ -3,24 +3,20 @@ "type": "enchantment", "id": "undine_resist_acid", "condition": "ALWAYS", - "values": [ { "value": "ARMOR_ACID", "multiply": -0.25 } ] + "incoming_damage_mod": [ { "type": "acid", "multiply": -0.25 } ] }, { "type": "enchantment", "id": "undine_resist_fire", "condition": "ALWAYS", - "values": [ { "value": "ARMOR_HEAT", "multiply": -0.5 } ] + "incoming_damage_mod": [ { "type": "heat", "multiply": -0.5 } ] }, { "type": "enchantment", "id": "ench_undine_water_body", "condition": "ALWAYS", "has": "HELD", - "values": [ - { "value": "ARMOR_BASH", "multiply": -0.1 }, - { "value": "ARMOR_CUT", "multiply": -0.2 }, - { "value": "ARMOR_BULLET", "multiply": -0.5 } - ] + "incoming_damage_mod": [ { "type": "bash", "multiply": -0.1 }, { "type": "cut", "multiply": -0.2 }, { "type": "bullet", "multiply": -0.5 } ] }, { "type": "enchantment", @@ -38,14 +34,14 @@ "id": "ench_undine_water_form_armor", "condition": "ALWAYS", "has": "HELD", - "values": [ - { "value": "ARMOR_BASH", "multiply": -0.4 }, - { "value": "ARMOR_CUT", "multiply": -0.6 }, - { "value": "ARMOR_STAB", "multiply": -0.8 }, - { "value": "ARMOR_BULLET", "multiply": -1.0 }, - { "value": "ARMOR_COLD", "multiply": 2.0 }, - { "value": "CLIMATE_CONTROL_HEAT", "add": -20 } - ] + "incoming_damage_mod": [ + { "type": "bash", "multiply": -0.4 }, + { "type": "stab", "multiply": -0.8 }, + { "type": "cut", "multiply": -0.6 }, + { "type": "bullet", "multiply": -1.0 }, + { "type": "cold", "multiply": 2 } + ], + "values": [ { "value": "CLIMATE_CONTROL_HEAT", "add": -20 } ] }, { "type": "enchantment", diff --git a/data/mods/Xedra_Evolved/mutations/temporary.json b/data/mods/Xedra_Evolved/mutations/temporary.json index 9ba208f235464..4f88eb2c0d16d 100644 --- a/data/mods/Xedra_Evolved/mutations/temporary.json +++ b/data/mods/Xedra_Evolved/mutations/temporary.json @@ -379,12 +379,12 @@ }, { "condition": "ALWAYS", + "incoming_damage_mod_post_absorbed": [ { "type": "bash", "multiply": 0.8 } ], "values": [ { "value": "PERCEPTION", "add": 4 }, { "value": "BODYTEMP_SLEEP", "add": 0.5 }, { "value": "OVERMAP_SIGHT", "add": 4 }, { "value": "METABOLISM", "multiply": -0.2 }, - { "value": "EXTRA_BASH", "multiply": 0.8 }, { "value": "MOVE_COST", "multiply": -0.2 }, { "value": "ATTACK_SPEED", "multiply": -0.2 }, { "value": "CARRY_WEIGHT", "multiply": -0.1 }, diff --git a/data/mods/Xedra_Evolved/procgen/dreamsmith_procgen.json b/data/mods/Xedra_Evolved/procgen/dreamsmith_procgen.json index 2de9e0d4f06a5..ad760764f6dd4 100644 --- a/data/mods/Xedra_Evolved/procgen/dreamsmith_procgen.json +++ b/data/mods/Xedra_Evolved/procgen/dreamsmith_procgen.json @@ -212,79 +212,6 @@ "id": "dreamsmith_lottery_def_head", "//": "In addition to stats and armor, this pool should related to perception, sight, or vision", "passive_add_procgen_values": [ - { "weight": 100, "min_value": -1, "max_value": -20, "type": "ARMOR_ACID", "increment": -1, "power_per_increment": 75 }, - { - "weight": 100, - "min_value": -1, - "max_value": -20, - "type": "ARMOR_BASH", - "increment": -1, - "power_per_increment": 150, - "ench_has": "WORN" - }, - { - "weight": 100, - "min_value": -1, - "max_value": -20, - "type": "ARMOR_BIO", - "increment": -1, - "power_per_increment": 75, - "ench_has": "WORN" - }, - { - "weight": 100, - "min_value": -1, - "max_value": -20, - "type": "ARMOR_BULLET", - "increment": -1, - "power_per_increment": 150, - "ench_has": "WORN" - }, - { - "weight": 100, - "min_value": -1, - "max_value": -20, - "type": "ARMOR_COLD", - "increment": -1, - "power_per_increment": 75, - "ench_has": "WORN" - }, - { - "weight": 100, - "min_value": -1, - "max_value": -20, - "type": "ARMOR_CUT", - "increment": -1, - "power_per_increment": 150, - "ench_has": "WORN" - }, - { - "weight": 100, - "min_value": -1, - "max_value": -20, - "type": "ARMOR_ELEC", - "increment": -1, - "power_per_increment": 75, - "ench_has": "WORN" - }, - { - "weight": 100, - "min_value": -1, - "max_value": -20, - "type": "ARMOR_HEAT", - "increment": -1, - "power_per_increment": 75, - "ench_has": "WORN" - }, - { - "weight": 100, - "min_value": -1, - "max_value": -20, - "type": "ARMOR_STAB", - "increment": -1, - "power_per_increment": 75, - "ench_has": "WORN" - }, { "weight": 100, "min_value": 1, @@ -357,79 +284,6 @@ "id": "dreamsmith_lottery_def_body", "//": "In addition to stats and armor, this pool should related to the concept of defense or avoiding attack or environmental protection", "passive_add_procgen_values": [ - { "weight": 100, "min_value": -1, "max_value": -20, "type": "ARMOR_ACID", "increment": -1, "power_per_increment": 75 }, - { - "weight": 100, - "min_value": -1, - "max_value": -20, - "type": "ARMOR_BASH", - "increment": -1, - "power_per_increment": 150, - "ench_has": "WORN" - }, - { - "weight": 100, - "min_value": -1, - "max_value": -20, - "type": "ARMOR_BIO", - "increment": -1, - "power_per_increment": 75, - "ench_has": "WORN" - }, - { - "weight": 100, - "min_value": -1, - "max_value": -20, - "type": "ARMOR_BULLET", - "increment": -1, - "power_per_increment": 150, - "ench_has": "WORN" - }, - { - "weight": 100, - "min_value": -1, - "max_value": -20, - "type": "ARMOR_COLD", - "increment": -1, - "power_per_increment": 75, - "ench_has": "WORN" - }, - { - "weight": 100, - "min_value": -1, - "max_value": -20, - "type": "ARMOR_CUT", - "increment": -1, - "power_per_increment": 150, - "ench_has": "WORN" - }, - { - "weight": 100, - "min_value": -1, - "max_value": -20, - "type": "ARMOR_ELEC", - "increment": -1, - "power_per_increment": 75, - "ench_has": "WORN" - }, - { - "weight": 100, - "min_value": -1, - "max_value": -20, - "type": "ARMOR_HEAT", - "increment": -1, - "power_per_increment": 75, - "ench_has": "WORN" - }, - { - "weight": 100, - "min_value": -1, - "max_value": -20, - "type": "ARMOR_STAB", - "increment": -1, - "power_per_increment": 75, - "ench_has": "WORN" - }, { "weight": 100, "min_value": 1, @@ -574,79 +428,6 @@ "id": "dreamsmith_lottery_def_hands", "//": "In addition to stats and armor, this pool should related to the concept of adroitness or martial skill", "passive_add_procgen_values": [ - { "weight": 100, "min_value": -1, "max_value": -20, "type": "ARMOR_ACID", "increment": -1, "power_per_increment": 75 }, - { - "weight": 100, - "min_value": -1, - "max_value": -20, - "type": "ARMOR_BASH", - "increment": -1, - "power_per_increment": 150, - "ench_has": "WORN" - }, - { - "weight": 100, - "min_value": -1, - "max_value": -20, - "type": "ARMOR_BIO", - "increment": -1, - "power_per_increment": 75, - "ench_has": "WORN" - }, - { - "weight": 100, - "min_value": -1, - "max_value": -20, - "type": "ARMOR_BULLET", - "increment": -1, - "power_per_increment": 150, - "ench_has": "WORN" - }, - { - "weight": 100, - "min_value": -1, - "max_value": -20, - "type": "ARMOR_COLD", - "increment": -1, - "power_per_increment": 75, - "ench_has": "WORN" - }, - { - "weight": 100, - "min_value": -1, - "max_value": -20, - "type": "ARMOR_CUT", - "increment": -1, - "power_per_increment": 150, - "ench_has": "WORN" - }, - { - "weight": 100, - "min_value": -1, - "max_value": -20, - "type": "ARMOR_ELEC", - "increment": -1, - "power_per_increment": 75, - "ench_has": "WORN" - }, - { - "weight": 100, - "min_value": -1, - "max_value": -20, - "type": "ARMOR_HEAT", - "increment": -1, - "power_per_increment": 75, - "ench_has": "WORN" - }, - { - "weight": 100, - "min_value": -1, - "max_value": -20, - "type": "ARMOR_STAB", - "increment": -1, - "power_per_increment": 75, - "ench_has": "WORN" - }, { "weight": 100, "min_value": 1, @@ -755,79 +536,6 @@ "id": "dreamsmith_lottery_def_feet", "//": "In addition to stats and armor, this pool should related to the movement or stealth", "passive_add_procgen_values": [ - { "weight": 100, "min_value": -1, "max_value": -20, "type": "ARMOR_ACID", "increment": -1, "power_per_increment": 75 }, - { - "weight": 100, - "min_value": -1, - "max_value": -20, - "type": "ARMOR_BASH", - "increment": -1, - "power_per_increment": 150, - "ench_has": "WORN" - }, - { - "weight": 100, - "min_value": -1, - "max_value": -20, - "type": "ARMOR_BIO", - "increment": -1, - "power_per_increment": 75, - "ench_has": "WORN" - }, - { - "weight": 100, - "min_value": -1, - "max_value": -20, - "type": "ARMOR_BULLET", - "increment": -1, - "power_per_increment": 150, - "ench_has": "WORN" - }, - { - "weight": 100, - "min_value": -1, - "max_value": -20, - "type": "ARMOR_COLD", - "increment": -1, - "power_per_increment": 75, - "ench_has": "WORN" - }, - { - "weight": 100, - "min_value": -1, - "max_value": -20, - "type": "ARMOR_CUT", - "increment": -1, - "power_per_increment": 150, - "ench_has": "WORN" - }, - { - "weight": 100, - "min_value": -1, - "max_value": -20, - "type": "ARMOR_ELEC", - "increment": -1, - "power_per_increment": 75, - "ench_has": "WORN" - }, - { - "weight": 100, - "min_value": -1, - "max_value": -20, - "type": "ARMOR_HEAT", - "increment": -1, - "power_per_increment": 75, - "ench_has": "WORN" - }, - { - "weight": 100, - "min_value": -1, - "max_value": -20, - "type": "ARMOR_STAB", - "increment": -1, - "power_per_increment": 75, - "ench_has": "WORN" - }, { "weight": 100, "min_value": 1, diff --git a/data/mods/Xedra_Evolved/spells/XAEA.json b/data/mods/Xedra_Evolved/spells/XAEA.json index 122320c16e988..a03a9a5509314 100644 --- a/data/mods/Xedra_Evolved/spells/XAEA.json +++ b/data/mods/Xedra_Evolved/spells/XAEA.json @@ -343,7 +343,7 @@ "remove_message": "Electric clouds are gone.", "rating": "good", "show_intensity": false, - "enchantments": [ { "emitter": "emit_shock_cloud_big", "values": [ { "value": "ARMOR_ELEC", "add": -100 } ] } ] + "enchantments": [ { "emitter": "emit_shock_cloud_big", "incoming_damage_mod": [ { "type": "electric", "add": -100 } ] } ] }, { "id": "XAEA_mod_moves", diff --git a/data/mods/Xedra_Evolved/spells/integrated_armor_spells.json b/data/mods/Xedra_Evolved/spells/integrated_armor_spells.json index 981d547cf3647..a5fa3d96d440a 100644 --- a/data/mods/Xedra_Evolved/spells/integrated_armor_spells.json +++ b/data/mods/Xedra_Evolved/spells/integrated_armor_spells.json @@ -19,11 +19,8 @@ "name": { "str": "Salamander" }, "description": "Your Fire Elemental abilities grant you good resistance to temperature conditions and heat damage. Also your body emits streams of heat into anyone who attack you.", "condition": "ALWAYS", - "values": [ - { "value": "ARMOR_HEAT", "multiply": -0.2 }, - { "value": "CLIMATE_CONTROL_HEAT", "add": 15 }, - { "value": "CLIMATE_CONTROL_CHILL", "add": 10 } - ], + "incoming_damage_mod": [ { "type": "heat", "multiply": -0.2 } ], + "values": [ { "value": "CLIMATE_CONTROL_HEAT", "add": 15 }, { "value": "CLIMATE_CONTROL_CHILL", "add": 10 } ], "hit_me_effect": [ { "id": "integrated_coal_skin_burnback", @@ -52,11 +49,8 @@ "name": { "str": "Salamonstrous" }, "description": "Your Fire Elemental abilities grant you good resistance to temperature conditions and heat damage. Also your body emits streams of heat into anyone who attack you.", "condition": "ALWAYS", - "values": [ - { "value": "ARMOR_HEAT", "multiply": -0.5 }, - { "value": "CLIMATE_CONTROL_HEAT", "add": 45 }, - { "value": "CLIMATE_CONTROL_CHILL", "add": 10 } - ], + "incoming_damage_mod": [ { "type": "heat", "multiply": -0.5 } ], + "values": [ { "value": "CLIMATE_CONTROL_HEAT", "add": 45 }, { "value": "CLIMATE_CONTROL_CHILL", "add": 10 } ], "hit_me_effect": [ { "id": "integrated_coal_skin_burnback", diff --git a/doc/MAGIC.md b/doc/MAGIC.md index 2b481a6035736..c59bfcae18741 100644 --- a/doc/MAGIC.md +++ b/doc/MAGIC.md @@ -655,7 +655,31 @@ There are two possible syntaxes. The first is by defining an enchantment object "modified_bodyparts": [ { "gain": "test_corvid_beak" }, { "lose": "torso" } ], "mutations": [ "GILLS", "MEMBRANE", "AMPHIBIAN", "WAYFARER", "WILDSHAPE:FISH" ], "ench_effects": [ { "effect": "invisibility", "intensity": 1 } ], - "melee_damage_bonus": [ { "type": "bash", "add": 10 } ] + "melee_damage_bonus": [ // adds this amount of damage to attack; adding damage adds flat number to attacks, multiplier multiplies existing damage after adding + { "type": "bash", "add": 10 }, // add 10 would straight add 10 damage of this type to each attack + { "type": "cut", "add": -3 }, // add -3 would decrease any cut damage up to zero + { "type": "heat", "multiply": 0.5 }, // 0.5 would mean damage be increased by 50% + { "type": "acid", "multiply": -0.5 }, // -0.5 would mean 50% decrease of damage + { "type": "necrotic", "add": 10, "multiply": 0.1 }, // any damage_type is supported + { "type": "biological", "add": { "math": [ "Nemesis_iteration * -1" ] } } // supports math and stuff, works for both character/npcs and monsters. multiple `melee_damage_bonus`es of the same type do stack + ], + "incoming_damage_mod": [ // any incoming damage would be modified by this value + { "type": "bash", "add": 10 }, // adding would increase the taken damage (hurt more!) + { "type": "stab", "add": -8 }, // negative adding would subtract damage taken by this amount + { "type": "cut", "multiply": -0.5 }, // multiplication would multiply entire damage; -0.5 would result in 50% of damage being removed + { "type": "bullet", "add": 1 }, // `"multiply": 1` would double all incoming bullet damage + { "type": "electric", "add": { "math": [ "rand(3) * -1" ] } }, // supports math and stuff, works for both character/npcs and monsters. multiple `incoming_damage_mod`es of the same type do stack + { "type": "acid", "add": 1, "multiply": 1 } // damage is subtracted before your physical armor (chain mail or similar), best works for decreasing incoming damage, as if character has additional layer of armor + ], + "incoming_damage_mod_post_absorbed": [ // works exactly same as incoming_damage_mod, but is applied after your physical armor (chain mail or similar), so best works for adding damage, as if character is specifically suseptible to this type of damage + { "type": "bash", "add": 10 }, + { "type": "stab", "add": -8 }, + { "type": "cut", "multiply": -0.5 }, + { "type": "bullet", "add": 1 }, + { "type": "electric", "add": { "math": [ "rand(3) * -1" ] } }, + { "type": "acid", "add": 1, "multiply": 1 } + ], + "intermittent_activation": { "effects": [ { @@ -836,16 +860,7 @@ The following is a list of possible enchantment `values`: Character status value | Description --- |--- -`ARMOR_ACID` | Negative values give armor against the damage, positive values make you accept more damage of this type. -`ARMOR_ALL` | -`ARMOR_BASH` | -`ARMOR_BIO` | -`ARMOR_BULLET` | -`ARMOR_COLD` | -`ARMOR_CUT` | -`ARMOR_ELEC` | -`ARMOR_HEAT` | -`ARMOR_STAB` | +`ARMOR_ALL` | Gives this amount of protection against any damage type except one with "no_resist": true. For more precise changes use incoming_damage_mod or item_armor_bonus `ATTACK_NOISE` | Affects the amount of noise you make while melee attacking. `ATTACK_SPEED` | Affects attack speed of item, even if it's not the one you're wielding, and throwing cost (capped at 25 moves). `"add": 10` adds 10 moves to each attack (makes it longer), `"add": -10` makes each attack faster for 10 moves; `"multiply": 1` doubles the speed of each attack `AVOID_FRIENDRY_FIRE` | Flat chance for your character to avoid friendry fire if there is a friend in the line of fire. From 0.0 (no chance) to 1.0 (never frindly fire). @@ -869,15 +884,6 @@ Character status value | Description `DODGE_CHANCE` | Modifies the probability to dodge an attack. Default is 0, so better to use `add` `EFFECTIVE_HEALTH_MOD` | If this is anything other than zero (which it defaults to) you will use it instead of your actual health mod. `EQUIPMENT_DAMAGE_CHANCE` | Modifies the likelihood that weapons and armor take durability damage. Since it's a percent, using 'multiply' is recommended. Positive values increase likelihood of damage while negative values decrease likelihood. `multiply`: -1 and below result in indestructible equipment. -`EXTRA_ACID` | EXTRA_TYPE increases received damage of the selected type. -`EXTRA_BASH` | -`EXTRA_BIO` | -`EXTRA_BULLET` | -`EXTRA_COLD` | -`EXTRA_CUT` | -`EXTRA_ELEC` | -`EXTRA_HEAT` | -`EXTRA_STAB` | `EXTRA_ELEC_PAIN` | Multiplier on electric damage received, the result is applied as extra pain. `EVASION` | Flat chance for your character to dodge incoming attacks regardless of other modifiers. From 0.0 (no evasion chance) to 1.0 (100% evasion chance). `FALL_DAMAGE` | Affects the amount of fall damage you take. @@ -962,15 +968,6 @@ Character status value | Description Enchanted item value | Description --- |--- -`ITEM_ARMOR_ACID` | -`ITEM_ARMOR_BASH` | -`ITEM_ARMOR_BIO` | -`ITEM_ARMOR_BULLET` | -`ITEM_ARMOR_COLD` | -`ITEM_ARMOR_CUT` | -`ITEM_ARMOR_ELEC` | -`ITEM_ARMOR_HEAT` | -`ITEM_ARMOR_STAB` | `ITEM_ATTACK_SPEED` | ### Enchantments on monsters @@ -978,16 +975,6 @@ A small subset of enchantments can be applied to monsters via effects. These are Character status value | Description --- |--- -`ARMOR_ACID` | Negative values give armor against the damage, positive values make the monster accept more damage of this type. -`ARMOR_ALL` | -`ARMOR_BASH` | -`ARMOR_BIO` | -`ARMOR_BULLET` | -`ARMOR_COLD` | -`ARMOR_CUT` | -`ARMOR_ELEC` | -`ARMOR_HEAT` | -`ARMOR_STAB` | `REGEN_HP` | Affects the rate the monster recovers hp. `VISION_RANGE` | Affects monster vision range, both day and night one. `SPEED` | Affects the base speed of the monster. @@ -996,11 +983,11 @@ Character status value | Description ### Enchantment value examples ```C++ - { "value": "ARMOR_ELEC", "add": -20 } // subtracts 20 points of incoming electrical damage + { "incoming_damage_mod": [ { "type": "electric", "add": -20 } ] }, // subtracts 20 points of incoming electrical damage { "value": "ATTACK_SPEED", "add": -60 } // subtracts 60 attack moves, making the attacker faster - { "value": "ARMOR_COLD", "multiply": -0.4 } // subtracts 40% of incoming cold damage - { "value": "ARMOR_HEAT", "multiply": 0.4 } // increases damage taken from fire by 40% - { "value": "ARMOR_CUT", "add": 2 } // increases incoming cut damage by 2 - { "value": "ARMOR_BIO", "multiply": -1.4 } // subtracts 100 percent of incoming biological damage, heals for the remaining 40% - { "value": "ARMOR_ACID", "multiply": 1.4 } // increases incoming acid damage by 140% + { "incoming_damage_mod": [ { "type": "cold", "multiply": -0.4 } ] } // subtracts 40% of incoming cold damage + { "incoming_damage_mod": [ { "type": "heat", "multiply": 0.4 } ] } // increases damage taken from fire by 40% + { "incoming_damage_mod": [ { "type": "cut", "add": 2 } ] } // increases incoming cut damage by 2 + { "incoming_damage_mod": [ { "type": "biological", "multiply": -1.4 } ] } // subtracts 100 percent of incoming biological damage + { "incoming_damage_mod": [ { "type": "acid", "multiply": 1.4 } ] } // increases incoming acid damage by 140% ``` diff --git a/src/character.h b/src/character.h index bca79ca5f3e90..6a69dcadf940c 100644 --- a/src/character.h +++ b/src/character.h @@ -1148,8 +1148,6 @@ class Character : public Creature, public visitable void perform_technique( const ma_technique &technique, Creature &t, damage_instance &di, int &move_cost, item_location &cur_weapon ); - // modifies the damage dealt based on the character's enchantments - damage_instance modify_damage_dealt_with_enchantments( const damage_instance &dam ) const override; /** * Sets up a melee attack and handles melee attack function calls * @param t Creature to attack @@ -4175,10 +4173,6 @@ class Character : public Creature, public visitable mutable time_point next_climate_control_check; mutable bool last_climate_control_ret; - // a cache of all active enchantment values. - // is recalculated every turn in Character::recalculate_enchantment_cache - pimpl enchantment_cache; - private: /* cached recipes, which are invalidated if the turn changes */ mutable time_point cached_recipe_turn; diff --git a/src/character_armor.cpp b/src/character_armor.cpp index 3e19e5cbaeefa..ea15d14b89e23 100644 --- a/src/character_armor.cpp +++ b/src/character_armor.cpp @@ -128,30 +128,12 @@ static void armor_enchantment_adjust( Character &guy, damage_unit &du ) if( du.amount < 0.1f ) { return; } - // FIXME: hardcoded damage types -> enchantments - if( du.type == STATIC( damage_type_id( "acid" ) ) ) { - du.amount = guy.calculate_by_enchantment( du.amount, enchant_vals::mod::ARMOR_ACID ); - } else if( du.type == STATIC( damage_type_id( "bash" ) ) ) { - du.amount = guy.calculate_by_enchantment( du.amount, enchant_vals::mod::ARMOR_BASH ); - } else if( du.type == STATIC( damage_type_id( "biological" ) ) ) { - du.amount = guy.calculate_by_enchantment( du.amount, enchant_vals::mod::ARMOR_BIO ); - } else if( du.type == STATIC( damage_type_id( "cold" ) ) ) { - du.amount = guy.calculate_by_enchantment( du.amount, enchant_vals::mod::ARMOR_COLD ); - } else if( du.type == STATIC( damage_type_id( "cut" ) ) ) { - du.amount = guy.calculate_by_enchantment( du.amount, enchant_vals::mod::ARMOR_CUT ); - } else if( du.type == STATIC( damage_type_id( "electric" ) ) ) { - du.amount = guy.calculate_by_enchantment( du.amount, enchant_vals::mod::ARMOR_ELEC ); - } else if( du.type == STATIC( damage_type_id( "heat" ) ) ) { - du.amount = guy.calculate_by_enchantment( du.amount, enchant_vals::mod::ARMOR_HEAT ); - } else if( du.type == STATIC( damage_type_id( "stab" ) ) ) { - du.amount = guy.calculate_by_enchantment( du.amount, enchant_vals::mod::ARMOR_STAB ); - } else if( du.type == STATIC( damage_type_id( "bullet" ) ) ) { - du.amount = guy.calculate_by_enchantment( du.amount, enchant_vals::mod::ARMOR_BULLET ); + double total = guy.enchantment_cache->modify_damage_units_by_armor_protection( du.type, du.amount ); + if( !du.type->no_resist ) { + total += guy.calculate_by_enchantment( du.amount, enchant_vals::mod::ARMOR_ALL ); } - if( du.type != STATIC( damage_type_id( "pure" ) ) ) { - du.amount = guy.calculate_by_enchantment( du.amount, enchant_vals::mod::ARMOR_ALL ); - } - du.amount = std::max( 0.0f, du.amount ); + + du.amount = std::max( 0.0, total ); } void destroyed_armor_msg( Character &who, const std::string &pre_damage_name ) @@ -170,27 +152,8 @@ void destroyed_armor_msg( Character &who, const std::string &pre_damage_name ) void post_absorbed_damage_enchantment_adjust( Character &guy, damage_unit &du ) { - // FIXME: hardcoded damage types -> enchantments - if( du.type == STATIC( damage_type_id( "acid" ) ) ) { - du.amount = guy.calculate_by_enchantment( du.amount, enchant_vals::mod::EXTRA_ACID ); - } else if( du.type == STATIC( damage_type_id( "bash" ) ) ) { - du.amount = guy.calculate_by_enchantment( du.amount, enchant_vals::mod::EXTRA_BASH ); - } else if( du.type == STATIC( damage_type_id( "biological" ) ) ) { - du.amount = guy.calculate_by_enchantment( du.amount, enchant_vals::mod::EXTRA_BIO ); - } else if( du.type == STATIC( damage_type_id( "cold" ) ) ) { - du.amount = guy.calculate_by_enchantment( du.amount, enchant_vals::mod::EXTRA_COLD ); - } else if( du.type == STATIC( damage_type_id( "cut" ) ) ) { - du.amount = guy.calculate_by_enchantment( du.amount, enchant_vals::mod::EXTRA_CUT ); - } else if( du.type == STATIC( damage_type_id( "electric" ) ) ) { - du.amount = guy.calculate_by_enchantment( du.amount, enchant_vals::mod::EXTRA_ELEC ); - } else if( du.type == STATIC( damage_type_id( "heat" ) ) ) { - du.amount = guy.calculate_by_enchantment( du.amount, enchant_vals::mod::EXTRA_HEAT ); - } else if( du.type == STATIC( damage_type_id( "stab" ) ) ) { - du.amount = guy.calculate_by_enchantment( du.amount, enchant_vals::mod::EXTRA_STAB ); - } else if( du.type == STATIC( damage_type_id( "bullet" ) ) ) { - du.amount = guy.calculate_by_enchantment( du.amount, enchant_vals::mod::EXTRA_BULLET ); - } - du.amount = std::max( 0.0f, du.amount ); + du.amount = std::max( 0.0, guy.enchantment_cache->modify_damage_units_by_extra_damage( du.type, + du.amount ) ); } const weakpoint *Character::absorb_hit( const weakpoint_attack &, const bodypart_id &bp, diff --git a/src/character_attire.cpp b/src/character_attire.cpp index 1bd9d06d193ff..ae1bddd0a0bfb 100644 --- a/src/character_attire.cpp +++ b/src/character_attire.cpp @@ -1867,35 +1867,6 @@ item &outfit::front() return worn.front(); } -static void item_armor_enchantment_adjust( Character &guy, damage_unit &du, item &armor ) -{ - //If we're not dealing any damage of the given type, don't even bother. - if( du.amount < 0.1f ) { - return; - } - // FIXME: hardcoded damage types -> enchantments - if( du.type == STATIC( damage_type_id( "acid" ) ) ) { - du.amount = armor.calculate_by_enchantment( guy, du.amount, enchant_vals::mod::ITEM_ARMOR_ACID ); - } else if( du.type == STATIC( damage_type_id( "bash" ) ) ) { - du.amount = armor.calculate_by_enchantment( guy, du.amount, enchant_vals::mod::ITEM_ARMOR_BASH ); - } else if( du.type == STATIC( damage_type_id( "biological" ) ) ) { - du.amount = armor.calculate_by_enchantment( guy, du.amount, enchant_vals::mod::ITEM_ARMOR_BIO ); - } else if( du.type == STATIC( damage_type_id( "cold" ) ) ) { - du.amount = armor.calculate_by_enchantment( guy, du.amount, enchant_vals::mod::ITEM_ARMOR_COLD ); - } else if( du.type == STATIC( damage_type_id( "cut" ) ) ) { - du.amount = armor.calculate_by_enchantment( guy, du.amount, enchant_vals::mod::ITEM_ARMOR_CUT ); - } else if( du.type == STATIC( damage_type_id( "electric" ) ) ) { - du.amount = armor.calculate_by_enchantment( guy, du.amount, enchant_vals::mod::ITEM_ARMOR_ELEC ); - } else if( du.type == STATIC( damage_type_id( "heat" ) ) ) { - du.amount = armor.calculate_by_enchantment( guy, du.amount, enchant_vals::mod::ITEM_ARMOR_HEAT ); - } else if( du.type == STATIC( damage_type_id( "stab" ) ) ) { - du.amount = armor.calculate_by_enchantment( guy, du.amount, enchant_vals::mod::ITEM_ARMOR_STAB ); - } else if( du.type == STATIC( damage_type_id( "bullet" ) ) ) { - du.amount = armor.calculate_by_enchantment( guy, du.amount, enchant_vals::mod::ITEM_ARMOR_BULLET ); - } - du.amount = std::max( 0.0f, du.amount ); -} - void outfit::absorb_damage( Character &guy, damage_unit &elem, bodypart_id bp, std::list &worn_remains, bool &armor_destroyed ) { @@ -1926,7 +1897,6 @@ void outfit::absorb_damage( Character &guy, damage_unit &elem, bodypart_id bp, const std::string pre_damage_name = armor.tname(); bool destroy = false; - item_armor_enchantment_adjust( guy, elem, armor ); // Heat damage can set armor on fire // Even though it doesn't cause direct physical damage to it // FIXME: Hardcoded damage type diff --git a/src/creature.h b/src/creature.h index 048100ccd6665..2bfd7e63d182b 100644 --- a/src/creature.h +++ b/src/creature.h @@ -910,6 +910,7 @@ class Creature : public viewer virtual bool has_grab_break_tec() const = 0; virtual int get_throw_resist() const; + pimpl enchantment_cache; /* * Setters for stats and bonuses */ diff --git a/src/magic_enchantment.cpp b/src/magic_enchantment.cpp index cb6a1adb4e3be..263e9e68b5754 100644 --- a/src/magic_enchantment.cpp +++ b/src/magic_enchantment.cpp @@ -129,34 +129,7 @@ namespace io case enchant_vals::mod::LEARNING_FOCUS: return "LEARNING_FOCUS"; case enchant_vals::mod::RECOIL_MODIFIER: return "RECOIL_MODIFIER"; case enchant_vals::mod::ARMOR_ALL: return "ARMOR_ALL"; - case enchant_vals::mod::ARMOR_ACID: return "ARMOR_ACID"; - case enchant_vals::mod::ARMOR_BASH: return "ARMOR_BASH"; - case enchant_vals::mod::ARMOR_BIO: return "ARMOR_BIO"; - case enchant_vals::mod::ARMOR_COLD: return "ARMOR_COLD"; - case enchant_vals::mod::ARMOR_CUT: return "ARMOR_CUT"; - case enchant_vals::mod::ARMOR_ELEC: return "ARMOR_ELEC"; - case enchant_vals::mod::ARMOR_HEAT: return "ARMOR_HEAT"; - case enchant_vals::mod::ARMOR_STAB: return "ARMOR_STAB"; - case enchant_vals::mod::ARMOR_BULLET: return "ARMOR_BULLET"; - case enchant_vals::mod::EXTRA_BASH: return "EXTRA_BASH"; - case enchant_vals::mod::EXTRA_CUT: return "EXTRA_CUT"; - case enchant_vals::mod::EXTRA_STAB: return "EXTRA_STAB"; - case enchant_vals::mod::EXTRA_BULLET: return "EXTRA_BULLET"; - case enchant_vals::mod::EXTRA_HEAT: return "EXTRA_HEAT"; - case enchant_vals::mod::EXTRA_COLD: return "EXTRA_COLD"; - case enchant_vals::mod::EXTRA_ELEC: return "EXTRA_ELEC"; - case enchant_vals::mod::EXTRA_ACID: return "EXTRA_ACID"; - case enchant_vals::mod::EXTRA_BIO: return "EXTRA_BIO"; case enchant_vals::mod::EXTRA_ELEC_PAIN: return "EXTRA_ELEC_PAIN"; - case enchant_vals::mod::ITEM_ARMOR_BASH: return "ITEM_ARMOR_BASH"; - case enchant_vals::mod::ITEM_ARMOR_CUT: return "ITEM_ARMOR_CUT"; - case enchant_vals::mod::ITEM_ARMOR_STAB: return "ITEM_ARMOR_STAB"; - case enchant_vals::mod::ITEM_ARMOR_BULLET: return "ITEM_ARMOR_BULLET"; - case enchant_vals::mod::ITEM_ARMOR_HEAT: return "ITEM_ARMOR_HEAT"; - case enchant_vals::mod::ITEM_ARMOR_COLD: return "ITEM_ARMOR_COLD"; - case enchant_vals::mod::ITEM_ARMOR_ELEC: return "ITEM_ARMOR_ELEC"; - case enchant_vals::mod::ITEM_ARMOR_ACID: return "ITEM_ARMOR_ACID"; - case enchant_vals::mod::ITEM_ARMOR_BIO: return "ITEM_ARMOR_BIO"; case enchant_vals::mod::ITEM_ATTACK_SPEED: return "ITEM_ATTACK_SPEED"; case enchant_vals::mod::EQUIPMENT_DAMAGE_CHANCE: return "EQUIPMENT_DAMAGE_CHANCE"; case enchant_vals::mod::CLIMATE_CONTROL_HEAT: return "CLIMATE_CONTROL_HEAT"; @@ -245,6 +218,29 @@ void load_add_and_multiply( const JsonObject &jo, const bool &is_child, } } +template +void load_add_and_multiply( const JsonObject &jo, const std::string_view array_key, + const std::string &type_key, std::map &add_map, std::map &mult_map ) +{ + if( jo.has_array( array_key ) ) { + for( const JsonObject value_obj : jo.get_array( array_key ) ) { + + const TKey value = TKey( value_obj.get_string( type_key ) ); + const double add = value_obj.get_float( "add", 0.0 ); + const double mult = value_obj.get_float( "multiply", 0.0 ); + + if( add != 0.0 ) { + add_map.emplace( value, add ); + } + + if( mult != 0.0 ) { + mult_map.emplace( value, mult ); + } + + } + } +} + void enchantment::load_enchantment( const JsonObject &jo, const std::string &src ) { spell_factory.load( jo, src ); @@ -335,16 +331,7 @@ bool enchantment::is_monster_relevant() const // Check add values. for( const std::pair &pair_values : values_add ) { - if( pair_values.first == enchant_vals::mod::ARMOR_ACID || - pair_values.first == enchant_vals::mod::ARMOR_ALL || - pair_values.first == enchant_vals::mod::ARMOR_BASH || - pair_values.first == enchant_vals::mod::ARMOR_BIO || - pair_values.first == enchant_vals::mod::ARMOR_BULLET || - pair_values.first == enchant_vals::mod::ARMOR_COLD || - pair_values.first == enchant_vals::mod::ARMOR_CUT || - pair_values.first == enchant_vals::mod::ARMOR_ELEC || - pair_values.first == enchant_vals::mod::ARMOR_HEAT || - pair_values.first == enchant_vals::mod::ARMOR_STAB || + if( pair_values.first == enchant_vals::mod::ARMOR_ALL || pair_values.first == enchant_vals::mod::REGEN_HP || pair_values.first == enchant_vals::mod::VISION_RANGE || pair_values.first == enchant_vals::mod::SPEED || @@ -356,16 +343,7 @@ bool enchantment::is_monster_relevant() const // Check mult values. for( const std::pair &pair_values : values_multiply ) { - if( pair_values.first == enchant_vals::mod::ARMOR_ACID || - pair_values.first == enchant_vals::mod::ARMOR_ALL || - pair_values.first == enchant_vals::mod::ARMOR_BASH || - pair_values.first == enchant_vals::mod::ARMOR_BIO || - pair_values.first == enchant_vals::mod::ARMOR_BULLET || - pair_values.first == enchant_vals::mod::ARMOR_COLD || - pair_values.first == enchant_vals::mod::ARMOR_CUT || - pair_values.first == enchant_vals::mod::ARMOR_ELEC || - pair_values.first == enchant_vals::mod::ARMOR_HEAT || - pair_values.first == enchant_vals::mod::ARMOR_STAB || + if( pair_values.first == enchant_vals::mod::ARMOR_ALL || pair_values.first == enchant_vals::mod::REGEN_HP || pair_values.first == enchant_vals::mod::VISION_RANGE || pair_values.first == enchant_vals::mod::SPEED || @@ -373,6 +351,12 @@ bool enchantment::is_monster_relevant() const return true; } } + + if( damage_values_add.size() != 0 || damage_values_multiply.size() != 0 || + armor_values_add.size() != 0 || armor_values_multiply.size() != 0 ) { + return true; + } + return false; } @@ -466,12 +450,18 @@ void enchantment::load( const JsonObject &jo, const std::string_view, load_add_and_multiply( jo, is_child, "values", "value", values_add, values_multiply ); - load_add_and_multiply( jo, is_child, "skills", "value", skill_values_add, - skill_values_multiply ); + load_add_and_multiply( jo, is_child, "skills", "value", + skill_values_add, skill_values_multiply ); load_add_and_multiply( jo, is_child, "melee_damage_bonus", "type", damage_values_add, damage_values_multiply ); + load_add_and_multiply( jo, is_child, "incoming_damage_mod", "type", + armor_values_add, armor_values_multiply ); + + load_add_and_multiply( jo, is_child, "incoming_damage_mod_post_absorbed", "type", + extra_damage_add, extra_damage_multiply ); + if( !is_child && jo.has_array( "special_vision" ) ) { for( const JsonObject vision_obj : jo.get_array( "special_vision" ) ) { special_vision _vision; @@ -520,7 +510,34 @@ void enchant_cache::load( const JsonObject &jo, const std::string_view, "MOTION_VISION_RANGE", "SIGHT_RANGE_FAE", "SIGHT_RANGE_NETHER", - "SIGHT_RANGE_MINDS" + "SIGHT_RANGE_MINDS", + "ARMOR_ACID", + "ARMOR_BASH", + "ARMOR_BIO", + "ARMOR_COLD", + "ARMOR_CUT", + "ARMOR_ELEC", + "ARMOR_HEAT", + "ARMOR_STAB", + "ARMOR_BULLET", + "EXTRA_BASH", + "EXTRA_CUT", + "EXTRA_STAB", + "EXTRA_BULLET", + "EXTRA_HEAT", + "EXTRA_COLD", + "EXTRA_ELEC", + "EXTRA_ACID", + "EXTRA_BIO", + "ITEM_ARMOR_BASH", + "ITEM_ARMOR_CUT", + "ITEM_ARMOR_STAB", + "ITEM_ARMOR_BULLET", + "ITEM_ARMOR_HEAT", + "ITEM_ARMOR_COLD", + "ITEM_ARMOR_ELEC", + "ITEM_ARMOR_ACID", + "ITEM_ARMOR_BIO" // values above to be removed after 0.I }; @@ -546,33 +563,17 @@ void enchant_cache::load( const JsonObject &jo, const std::string_view, } } - if( jo.has_array( "skills" ) ) { - for( const JsonObject value_obj : jo.get_array( "skills" ) ) { - const skill_id value = skill_id( value_obj.get_string( "value" ) ); - const int add = value_obj.get_int( "add", 0 ); - const double mult = value_obj.get_float( "multiply", 0.0 ); - if( add != 0 ) { - skill_values_add.emplace( value, add ); - } - if( mult != 0.0 ) { - skill_values_multiply.emplace( value, static_cast( mult ) ); - } - } - } + load_add_and_multiply( jo, "skills", "value", + skill_values_add, skill_values_multiply ); - if( jo.has_array( "melee_damage_bonus" ) ) { - for( const JsonObject value_obj : jo.get_array( "melee_damage_bonus" ) ) { - const damage_type_id value = damage_type_id( value_obj.get_string( "type" ) ); - const int add = value_obj.get_int( "add", 0 ); - const double mult = value_obj.get_float( "multiply", 0.0 ); - if( add != 0 ) { - damage_values_add.emplace( value, add ); - } - if( mult != 0.0 ) { - damage_values_multiply.emplace( value, static_cast( mult ) ); - } - } - } + load_add_and_multiply( jo, "melee_damage_bonus", "type", + damage_values_add, damage_values_multiply ); + + load_add_and_multiply( jo, "incoming_damage_mod", "type", + armor_values_add, armor_values_multiply ); + + load_add_and_multiply( jo, "incoming_damage_mod_post_absorbed", "type", + extra_damage_add, extra_damage_multiply ); if( jo.has_array( "special_vision" ) ) { for( const JsonObject vision_obj : jo.get_array( "special_vision" ) ) { @@ -753,11 +754,11 @@ void enchant_cache::force_add( const enchant_cache &rhs ) values_multiply[pair_values.first] += pair_values.second; } - for( const std::pair &pair_values : + for( const std::pair &pair_values : rhs.skill_values_add ) { skill_values_add[pair_values.first] += pair_values.second; } - for( const std::pair &pair_values : + for( const std::pair &pair_values : rhs.skill_values_multiply ) { // values do not multiply against each other, they add. // so +10% and -10% will add to 0% @@ -774,6 +775,25 @@ void enchant_cache::force_add( const enchant_cache &rhs ) damage_values_multiply[pair_values.first] += pair_values.second; } + for( const std::pair &pair_values : rhs.armor_values_add ) { + armor_values_add[pair_values.first] += pair_values.second; + } + for( const std::pair &pair_values : + rhs.armor_values_multiply ) { + // values do not multiply against each other, they add. + // so +10% and -10% will add to 0% + armor_values_multiply[pair_values.first] += pair_values.second; + } + + for( const std::pair &pair_values : rhs.extra_damage_add ) { + extra_damage_add[pair_values.first] += pair_values.second; + } + for( const std::pair &pair_values : + rhs.extra_damage_multiply ) { + // values do not multiply against each other, they add. + // so +10% and -10% will add to 0% + extra_damage_multiply[pair_values.first] += pair_values.second; + } // from cache to cache? for( const special_vision &struc : rhs.special_vision_vector ) { special_vision_vector.emplace_back( special_vision{ @@ -883,6 +903,39 @@ void enchant_cache::force_add_with_dialogue( const enchantment &rhs, const const } } + for( const std::pair &pair_values : + rhs.armor_values_add ) { + if( evaluate ) { + armor_values_add[pair_values.first] += pair_values.second.evaluate( d ); + } else { + armor_values_add[pair_values.first] += pair_values.second.constant(); + } + } + for( const std::pair &pair_values : + rhs.armor_values_multiply ) { + if( evaluate ) { + armor_values_multiply[pair_values.first] += pair_values.second.evaluate( d ); + } else { + armor_values_multiply[pair_values.first] += pair_values.second.constant(); + } + } + + for( const std::pair &pair_values : + rhs.extra_damage_add ) { + if( evaluate ) { + extra_damage_add[pair_values.first] += pair_values.second.evaluate( d ); + } else { + extra_damage_add[pair_values.first] += pair_values.second.constant(); + } + } + for( const std::pair &pair_values : + rhs.extra_damage_multiply ) { + if( evaluate ) { + extra_damage_multiply[pair_values.first] += pair_values.second.evaluate( d ); + } else { + extra_damage_multiply[pair_values.first] += pair_values.second.constant(); + } + } for( const enchantment::special_vision &struc : rhs.special_vision_vector ) { if( evaluate ) { special_vision_vector.emplace_back( special_vision{ @@ -1031,7 +1084,7 @@ double enchant_cache::get_value_add( const enchant_vals::mod value ) const return found->second; } -int enchant_cache::get_skill_value_add( const skill_id &value ) const +double enchant_cache::get_skill_value_add( const skill_id &value ) const { const auto found = skill_values_add.find( value ); if( found == skill_values_add.cend() ) { @@ -1049,6 +1102,24 @@ int enchant_cache::get_damage_add( const damage_type_id &value ) const return found->second; } +int enchant_cache::get_armor_add( const damage_type_id &value ) const +{ + const auto found = armor_values_add.find( value ); + if( found == armor_values_add.cend() ) { + return 0; + } + return found->second; +} + +int enchant_cache::get_extra_damage_add( const damage_type_id &value ) const +{ + const auto found = extra_damage_add.find( value ); + if( found == extra_damage_add.cend() ) { + return 0; + } + return found->second; +} + double enchant_cache::get_value_multiply( const enchant_vals::mod value ) const { const auto found = values_multiply.find( value ); @@ -1121,6 +1192,24 @@ double enchant_cache::get_damage_multiply( const damage_type_id &value ) const return found->second; } +double enchant_cache::get_armor_multiply( const damage_type_id &value ) const +{ + const auto found = armor_values_multiply.find( value ); + if( found == armor_values_multiply.cend() ) { + return 0; + } + return found->second; +} + +double enchant_cache::get_extra_damage_multiply( const damage_type_id &value ) const +{ + const auto found = extra_damage_multiply.find( value ); + if( found == extra_damage_multiply.cend() ) { + return 0; + } + return found->second; +} + double enchant_cache::modify_value( const enchant_vals::mod mod_val, double value ) const { value += get_value_add( mod_val ); @@ -1182,6 +1271,25 @@ double enchant_cache::modify_melee_damage( const damage_type_id &mod_val, double return value; } +double enchant_cache::modify_damage_units_by_armor_protection( const damage_type_id &mod_val, + double value ) const +{ + // since it's armor bonus, and we modify the damage units applied on damage absorbtion + // we decrease said value; 10 damage taken and +6 damage mitigation + // result in [10 - 6 =] 4 damage taken + value += get_armor_add( mod_val ); + value *= 1.0 + get_armor_multiply( mod_val ); + return value; +} + +double enchant_cache::modify_damage_units_by_extra_damage( const damage_type_id &mod_val, + double value ) const +{ + value += get_extra_damage_add( mod_val ); + value *= 1.0 + get_extra_damage_multiply( mod_val ); + return value; +} + int enchant_cache::mult_bonus( enchant_vals::mod value_type, int base_value ) const { return get_value_multiply( value_type ) * base_value; diff --git a/src/magic_enchantment.h b/src/magic_enchantment.h index e7e74dae70593..b6ac369273aeb 100644 --- a/src/magic_enchantment.h +++ b/src/magic_enchantment.h @@ -103,36 +103,9 @@ enum class mod : int { MENDING_MODIFIER, STOMACH_SIZE_MULTIPLIER, LEARNING_FOCUS, - ARMOR_ACID, ARMOR_ALL, - ARMOR_BASH, - ARMOR_BIO, - ARMOR_BULLET, - ARMOR_COLD, - ARMOR_CUT, - ARMOR_ELEC, - ARMOR_HEAT, - ARMOR_STAB, - EXTRA_BASH, - EXTRA_CUT, - EXTRA_STAB, - EXTRA_BULLET, - EXTRA_HEAT, - EXTRA_COLD, - EXTRA_ELEC, - EXTRA_ACID, - EXTRA_BIO, EXTRA_ELEC_PAIN, RECOIL_MODIFIER, //affects recoil when shooting a gun - ITEM_ARMOR_BASH, - ITEM_ARMOR_CUT, - ITEM_ARMOR_STAB, - ITEM_ARMOR_BULLET, - ITEM_ARMOR_HEAT, - ITEM_ARMOR_COLD, - ITEM_ARMOR_ELEC, - ITEM_ARMOR_ACID, - ITEM_ARMOR_BIO, ITEM_ATTACK_SPEED, EQUIPMENT_DAMAGE_CHANCE, CLIMATE_CONTROL_HEAT, @@ -263,6 +236,12 @@ class enchantment std::map damage_values_add; // NOLINT(cata-serialize) std::map damage_values_multiply; // NOLINT(cata-serialize) + std::map armor_values_add; // NOLINT(cata-serialize) + std::map armor_values_multiply; // NOLINT(cata-serialize) + + std::map extra_damage_add; // NOLINT(cata-serialize) + std::map extra_damage_multiply; // NOLINT(cata-serialize) + std::vector hit_me_effect; std::vector hit_you_effect; @@ -315,6 +294,8 @@ class enchant_cache : public enchantment time_duration modify_value( enchant_vals::mod mod_val, time_duration value ) const; double modify_melee_damage( const damage_type_id &mod_val, double value ) const; + double modify_damage_units_by_armor_protection( const damage_type_id &mod_val, double value ) const; + double modify_damage_units_by_extra_damage( const damage_type_id &mod_val, double value ) const; // adds two enchantments together and ignores their conditions void force_add( const enchantment &rhs, const Character &guy ); void force_add( const enchantment &rhs, const monster &mon ); @@ -329,10 +310,14 @@ class enchant_cache : public enchantment double get_value_multiply( enchant_vals::mod value ) const; int mult_bonus( enchant_vals::mod value_type, int base_value ) const; - int get_skill_value_add( const skill_id &value ) const; + double get_skill_value_add( const skill_id &value ) const; int get_damage_add( const damage_type_id &value ) const; + int get_armor_add( const damage_type_id &value ) const; + int get_extra_damage_add( const damage_type_id &value ) const; double get_skill_value_multiply( const skill_id &value ) const; double get_damage_multiply( const damage_type_id &value ) const; + double get_armor_multiply( const damage_type_id &value ) const; + double get_extra_damage_multiply( const damage_type_id &value ) const; int skill_mult_bonus( const skill_id &value_type, int base_value ) const; // attempts to add two like enchantments together. // if their conditions don't match, return false. else true. @@ -391,12 +376,18 @@ class enchant_cache : public enchantment std::map values_multiply; // NOLINT(cata-serialize) // the exact same as above, though specifically for skills - std::map skill_values_add; // NOLINT(cata-serialize) - std::map skill_values_multiply; // NOLINT(cata-serialize) + std::map skill_values_add; // NOLINT(cata-serialize) + std::map skill_values_multiply; // NOLINT(cata-serialize) std::map damage_values_add; // NOLINT(cata-serialize) std::map damage_values_multiply; // NOLINT(cata-serialize) + std::map armor_values_add; // NOLINT(cata-serialize) + std::map armor_values_multiply; // NOLINT(cata-serialize) + + std::map extra_damage_add; // NOLINT(cata-serialize) + std::map extra_damage_multiply; // NOLINT(cata-serialize) + }; template struct enum_traits; diff --git a/src/melee.cpp b/src/melee.cpp index c777e8f3acde5..ea6a92711bf95 100644 --- a/src/melee.cpp +++ b/src/melee.cpp @@ -508,11 +508,6 @@ bool Character::melee_attack( Creature &t, bool allow_special ) } damage_instance Creature::modify_damage_dealt_with_enchantments( const damage_instance &dam ) const -{ - return dam; -} - -damage_instance Character::modify_damage_dealt_with_enchantments( const damage_instance &dam ) const { damage_instance modified; diff --git a/src/monster.cpp b/src/monster.cpp index cdc9bb9d8ad92..beceaab98fd20 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -231,37 +231,19 @@ static int compute_kill_xp( const mtype_id &mon_type ) return mon_type->difficulty + mon_type->difficulty_base; } -// adjusts damage unit depending on type by enchantments. static void armor_enchantment_adjust( monster &mon, damage_unit &du ) { //If we're not dealing any damage of the given type, don't even bother. if( du.amount < 0.1f ) { return; } - // FIXME: hardcoded damage types -> enchantments - if( du.type == STATIC( damage_type_id( "acid" ) ) ) { - du.amount = mon.calculate_by_enchantment( du.amount, enchant_vals::mod::ARMOR_ACID ); - } else if( du.type == STATIC( damage_type_id( "bash" ) ) ) { - du.amount = mon.calculate_by_enchantment( du.amount, enchant_vals::mod::ARMOR_BASH ); - } else if( du.type == STATIC( damage_type_id( "biological" ) ) ) { - du.amount = mon.calculate_by_enchantment( du.amount, enchant_vals::mod::ARMOR_BIO ); - } else if( du.type == STATIC( damage_type_id( "cold" ) ) ) { - du.amount = mon.calculate_by_enchantment( du.amount, enchant_vals::mod::ARMOR_COLD ); - } else if( du.type == STATIC( damage_type_id( "cut" ) ) ) { - du.amount = mon.calculate_by_enchantment( du.amount, enchant_vals::mod::ARMOR_CUT ); - } else if( du.type == STATIC( damage_type_id( "electric" ) ) ) { - du.amount = mon.calculate_by_enchantment( du.amount, enchant_vals::mod::ARMOR_ELEC ); - } else if( du.type == STATIC( damage_type_id( "heat" ) ) ) { - du.amount = mon.calculate_by_enchantment( du.amount, enchant_vals::mod::ARMOR_HEAT ); - } else if( du.type == STATIC( damage_type_id( "stab" ) ) ) { - du.amount = mon.calculate_by_enchantment( du.amount, enchant_vals::mod::ARMOR_STAB ); - } else if( du.type == STATIC( damage_type_id( "bullet" ) ) ) { - du.amount = mon.calculate_by_enchantment( du.amount, enchant_vals::mod::ARMOR_BULLET ); - } - if( du.type != STATIC( damage_type_id( "pure" ) ) ) { - du.amount = mon.calculate_by_enchantment( du.amount, enchant_vals::mod::ARMOR_ALL ); - } - du.amount = std::max( 0.0f, du.amount ); + + double total = mon.enchantment_cache->modify_damage_units_by_armor_protection( du.type, du.amount ); + if( !du.type->no_resist ) { + total += mon.calculate_by_enchantment( du.amount, enchant_vals::mod::ARMOR_ALL ); + } + + du.amount = std::max( 0.0, total ); } monster::monster() @@ -2091,6 +2073,8 @@ bool monster::melee_attack( Creature &target, float accuracy ) damage.add_damage( damage_bash, dice( type->melee_dice, type->melee_sides ) ); } + modify_damage_dealt_with_enchantments( damage ); + dealt_damage_instance dealt_dam; if( hitspread >= 0 ) { diff --git a/src/monster.h b/src/monster.h index 29ec1e619e036..0f08b861913a3 100644 --- a/src/monster.h +++ b/src/monster.h @@ -587,8 +587,6 @@ class monster : public Creature std::optional lastseen_turn; - pimpl enchantment_cache; - // Stair data. int staircount = 0; From 78d2f9059ca854c25367654f27ee6eba81a353cc Mon Sep 17 00:00:00 2001 From: GuardianDll Date: Tue, 10 Dec 2024 20:08:22 +0100 Subject: [PATCH 3/8] move few function from character/monster to creature --- src/character.cpp | 11 ----------- src/character.h | 2 -- src/character_armor.cpp | 22 ++-------------------- src/character_attire.h | 1 - src/creature.cpp | 32 ++++++++++++++++++++++++++++++++ src/creature.h | 4 ++++ src/item.cpp | 27 --------------------------- src/item.h | 2 -- src/monster.cpp | 30 +++--------------------------- src/monster.h | 2 -- 10 files changed, 41 insertions(+), 92 deletions(-) diff --git a/src/character.cpp b/src/character.cpp index 64e59322931e7..733cdd127c327 100644 --- a/src/character.cpp +++ b/src/character.cpp @@ -7746,17 +7746,6 @@ void Character::recalculate_enchantment_cache() recalc_hp(); } -double Character::calculate_by_enchantment( double modify, enchant_vals::mod value, - bool round_output ) const -{ - modify += enchantment_cache->get_value_add( value ); - modify *= 1.0 + enchantment_cache->get_value_multiply( value ); - if( round_output ) { - modify = std::round( modify ); - } - return modify; -} - void Character::passive_absorb_hit( const bodypart_id &bp, damage_unit &du ) const { // >0 check because some mutations provide negative armor diff --git a/src/character.h b/src/character.h index 6a69dcadf940c..af8a574726ba6 100644 --- a/src/character.h +++ b/src/character.h @@ -1572,8 +1572,6 @@ class Character : public Creature, public visitable // recalculates enchantment cache by iterating through all held, worn, and wielded items void recalculate_enchantment_cache(); // gets add and mult value from enchantment cache - double calculate_by_enchantment( double modify, enchant_vals::mod value, - bool round_output = false ) const; /** Returns true if the player has any martial arts buffs attached */ bool has_mabuff( const mabuff_id &buff_id ) const; diff --git a/src/character_armor.cpp b/src/character_armor.cpp index ea15d14b89e23..766f8f2f3d846 100644 --- a/src/character_armor.cpp +++ b/src/character_armor.cpp @@ -122,19 +122,7 @@ int Character::get_env_resist( bodypart_id bp ) const // adjusts damage unit depending on type by enchantments. // the ITEM_ enchantments only affect the damage resistance for that one item, while the others affect all of them -static void armor_enchantment_adjust( Character &guy, damage_unit &du ) -{ - //If we're not dealing any damage of the given type, don't even bother. - if( du.amount < 0.1f ) { - return; - } - double total = guy.enchantment_cache->modify_damage_units_by_armor_protection( du.type, du.amount ); - if( !du.type->no_resist ) { - total += guy.calculate_by_enchantment( du.amount, enchant_vals::mod::ARMOR_ALL ); - } - du.amount = std::max( 0.0, total ); -} void destroyed_armor_msg( Character &who, const std::string &pre_damage_name ) { @@ -150,12 +138,6 @@ void destroyed_armor_msg( Character &who, const std::string &pre_damage_name ) pre_damage_name ); } -void post_absorbed_damage_enchantment_adjust( Character &guy, damage_unit &du ) -{ - du.amount = std::max( 0.0, guy.enchantment_cache->modify_damage_units_by_extra_damage( du.type, - du.amount ) ); -} - const weakpoint *Character::absorb_hit( const weakpoint_attack &, const bodypart_id &bp, damage_instance &dam ) { @@ -209,13 +191,13 @@ const weakpoint *Character::absorb_hit( const weakpoint_attack &, const bodypart } } - armor_enchantment_adjust( *this, elem ); + adjust_taken_damage_by_enchantments( elem ); worn.absorb_damage( *this, elem, bp, worn_remains, armor_destroyed ); passive_absorb_hit( bp, elem ); - post_absorbed_damage_enchantment_adjust( *this, elem ); + adjust_taken_damage_by_enchantments_post_absorbed( elem ); elem.amount = std::max( elem.amount, 0.0f ); } map &here = get_map(); diff --git a/src/character_attire.h b/src/character_attire.h index a3697a7f86d22..bc1de53091fb7 100644 --- a/src/character_attire.h +++ b/src/character_attire.h @@ -263,7 +263,6 @@ class outfit }; units::mass get_selected_stack_weight( const item *i, const std::map &without ); -void post_absorbed_damage_enchantment_adjust( Character &guy, damage_unit &du ); void destroyed_armor_msg( Character &who, const std::string &pre_damage_name ); #endif // CATA_SRC_CHARACTER_ATTIRE_H diff --git a/src/creature.cpp b/src/creature.cpp index d102156bc51df..2ad7701d58cb4 100644 --- a/src/creature.cpp +++ b/src/creature.cpp @@ -3359,6 +3359,38 @@ void Creature::knock_back_from( const tripoint &p ) knock_back_to( to ); } +double Creature::calculate_by_enchantment( double modify, enchant_vals::mod value, + bool round_output ) const +{ + modify += enchantment_cache->get_value_add( value ); + modify *= 1.0 + enchantment_cache->get_value_multiply( value ); + if( round_output ) { + modify = std::round( modify ); + } + return modify; +} + +void Creature::adjust_taken_damage_by_enchantments( damage_unit &du ) const +{ + //If we're not dealing any damage of the given type, don't even bother. + if( du.amount < 0.1f ) { + return; + } + + double total = enchantment_cache->modify_damage_units_by_armor_protection( du.type, du.amount ); + if( !du.type->no_resist ) { + total += calculate_by_enchantment( du.amount, enchant_vals::mod::ARMOR_ALL ); + } + + du.amount = std::max( 0.0, total ); +} + +void Creature::adjust_taken_damage_by_enchantments_post_absorbed( damage_unit &du ) const +{ + du.amount = std::max( 0.0, enchantment_cache->modify_damage_units_by_extra_damage( du.type, + du.amount ) ); +} + void Creature::add_msg_if_player( const translation &msg ) const { return add_msg_if_player( msg.translated() ); diff --git a/src/creature.h b/src/creature.h index 2bfd7e63d182b..2869425097a17 100644 --- a/src/creature.h +++ b/src/creature.h @@ -439,6 +439,10 @@ class Creature : public viewer // TODO: this is just a shim so knockbacks work void knock_back_from( const tripoint &p ); + double calculate_by_enchantment( double modify, enchant_vals::mod value, + bool round_output = false ) const; + void adjust_taken_damage_by_enchantments( damage_unit &du ) const; + void adjust_taken_damage_by_enchantments_post_absorbed( damage_unit &du ) const; virtual void knock_back_to( const tripoint &to ) = 0; // Converts the "cover_vitals" protection on the specified body part into diff --git a/src/item.cpp b/src/item.cpp index 607694cc5cb22..ce24b2d7922b8 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -10152,33 +10152,6 @@ std::vector item::get_defined_enchantments() const return type->relic_data->get_defined_enchantments(); } -double item::calculate_by_enchantment( const Character &owner, double modify, - enchant_vals::mod value, bool round_value ) const -{ - double add_value = 0.0; - double mult_value = 1.0; - for( const enchant_cache &ench : get_proc_enchantments() ) { - if( ench.is_active( owner, *this ) ) { - add_value += ench.get_value_add( value ); - mult_value += ench.get_value_multiply( value ); - } - } - if( type->relic_data ) { - for( const enchantment &ench : type->relic_data->get_defined_enchantments() ) { - if( ench.is_active( owner, *this ) ) { - add_value += ench.get_value_add( value, owner ); - mult_value += ench.get_value_multiply( value, owner ); - } - } - } - modify += add_value; - modify *= mult_value; - if( round_value ) { - modify = std::round( modify ); - } - return modify; -} - double item::calculate_by_enchantment_wield( const Character &owner, double modify, enchant_vals::mod value, bool round_value ) const diff --git a/src/item.h b/src/item.h index 609de1e482bdb..461fd00251b50 100644 --- a/src/item.h +++ b/src/item.h @@ -2937,8 +2937,6 @@ class item : public visitable std::vector get_proc_enchantments() const; std::vector get_defined_enchantments() const; - double calculate_by_enchantment( const Character &owner, double modify, enchant_vals::mod value, - bool round_value = false ) const; // calculates the enchantment value as if this item were wielded. double calculate_by_enchantment_wield( const Character &owner, double modify, enchant_vals::mod value, diff --git a/src/monster.cpp b/src/monster.cpp index beceaab98fd20..3abc3cffe529b 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -231,21 +231,6 @@ static int compute_kill_xp( const mtype_id &mon_type ) return mon_type->difficulty + mon_type->difficulty_base; } -static void armor_enchantment_adjust( monster &mon, damage_unit &du ) -{ - //If we're not dealing any damage of the given type, don't even bother. - if( du.amount < 0.1f ) { - return; - } - - double total = mon.enchantment_cache->modify_damage_units_by_armor_protection( du.type, du.amount ); - if( !du.type->no_resist ) { - total += mon.calculate_by_enchantment( du.amount, enchant_vals::mod::ARMOR_ALL ); - } - - du.amount = std::max( 0.0, total ); -} - monster::monster() { unset_dest(); @@ -2012,7 +1997,7 @@ const weakpoint *monster::absorb_hit( const weakpoint_attack &attack, const body const weakpoint *wp = type->weakpoints.select_weakpoint( attack ); wp->apply_to( r ); for( damage_unit &elem : dam.damage_units ) { - armor_enchantment_adjust( *this, elem ); + adjust_taken_damage_by_enchantments( elem ); add_msg_debug( debugmode::DF_MONSTER, "Dam Type: %s :: Dam Amt: %.1f :: Ar Pen: %.1f :: Armor Mult: %.1f", elem.type.c_str(), elem.amount, elem.res_pen, elem.res_mult ); @@ -2023,7 +2008,9 @@ const weakpoint *monster::absorb_hit( const weakpoint_attack &attack, const body r.get_effective_resist( elem ) ); elem.amount -= std::min( r.get_effective_resist( elem ) + get_worn_armor_val( elem.type ), elem.amount ); + adjust_taken_damage_by_enchantments_post_absorbed( elem ); } + wp->apply_to( dam, attack.is_crit ); return wp; } @@ -4079,14 +4066,3 @@ std::function monster::get_path_avoid() const return false; }; } - -double monster::calculate_by_enchantment( double modify, enchant_vals::mod value, - bool round_output ) const -{ - modify += enchantment_cache->get_value_add( value ); - modify *= 1.0 + enchantment_cache->get_value_multiply( value ); - if( round_output ) { - modify = std::round( modify ); - } - return modify; -} diff --git a/src/monster.h b/src/monster.h index 0f08b861913a3..4608d104e2c3f 100644 --- a/src/monster.h +++ b/src/monster.h @@ -619,8 +619,6 @@ class monster : public Creature const pathfinding_settings &get_pathfinding_settings() const override; std::function get_path_avoid() const override; - double calculate_by_enchantment( double modify, enchant_vals::mod value, - bool round_output = false ) const; private: void process_trigger( mon_trigger trig, int amount ); void process_trigger( mon_trigger trig, const std::function &amount_func ); From 48e6d465c7952dc32856d16be7e2fa3043e82537 Mon Sep 17 00:00:00 2001 From: GuardianDll Date: Tue, 10 Dec 2024 20:16:08 +0100 Subject: [PATCH 4/8] add missed deserialization code --- src/magic_enchantment.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/magic_enchantment.cpp b/src/magic_enchantment.cpp index 263e9e68b5754..125bddffc6c0c 100644 --- a/src/magic_enchantment.cpp +++ b/src/magic_enchantment.cpp @@ -700,6 +700,36 @@ void enchant_cache::serialize( JsonOut &jsout ) const } jsout.end_array(); + jsout.member( "incoming_damage_mod" ); + jsout.start_array(); + for( const damage_type &dt : damage_type::get_all() ) { + jsout.start_object(); + jsout.member( "type", dt.id ); + if( get_armor_add( dt.id ) != 0 ) { + jsout.member( "add", get_armor_add( dt.id ) ); + } + if( get_armor_multiply( dt.id ) != 0 ) { + jsout.member( "multiply", get_armor_multiply( dt.id ) ); + } + jsout.end_object(); + } + jsout.end_array(); + + jsout.member( "incoming_damage_mod_post_absorbed" ); + jsout.start_array(); + for( const damage_type &dt : damage_type::get_all() ) { + jsout.start_object(); + jsout.member( "type", dt.id ); + if( get_extra_damage_add( dt.id ) != 0 ) { + jsout.member( "add", get_extra_damage_add( dt.id ) ); + } + if( get_extra_damage_multiply( dt.id ) != 0 ) { + jsout.member( "multiply", get_extra_damage_multiply( dt.id ) ); + } + jsout.end_object(); + } + jsout.end_array(); + jsout.member( "special_vision" ); jsout.start_array(); for( const special_vision &struc : special_vision_vector ) { From 9b254f80624ac35520f9b7f992d6cd52542fdaf1 Mon Sep 17 00:00:00 2001 From: GuardianDll Date: Tue, 10 Dec 2024 22:30:14 +0100 Subject: [PATCH 5/8] misc --- src/creature.cpp | 2 +- src/magic_enchantment.cpp | 3 --- src/melee.cpp | 9 ++++++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/creature.cpp b/src/creature.cpp index 2ad7701d58cb4..404b13d79de58 100644 --- a/src/creature.cpp +++ b/src/creature.cpp @@ -3379,7 +3379,7 @@ void Creature::adjust_taken_damage_by_enchantments( damage_unit &du ) const double total = enchantment_cache->modify_damage_units_by_armor_protection( du.type, du.amount ); if( !du.type->no_resist ) { - total += calculate_by_enchantment( du.amount, enchant_vals::mod::ARMOR_ALL ); + total = calculate_by_enchantment( total, enchant_vals::mod::ARMOR_ALL ); } du.amount = std::max( 0.0, total ); diff --git a/src/magic_enchantment.cpp b/src/magic_enchantment.cpp index 125bddffc6c0c..208f46d98dde4 100644 --- a/src/magic_enchantment.cpp +++ b/src/magic_enchantment.cpp @@ -1304,9 +1304,6 @@ double enchant_cache::modify_melee_damage( const damage_type_id &mod_val, double double enchant_cache::modify_damage_units_by_armor_protection( const damage_type_id &mod_val, double value ) const { - // since it's armor bonus, and we modify the damage units applied on damage absorbtion - // we decrease said value; 10 damage taken and +6 damage mitigation - // result in [10 - 6 =] 4 damage taken value += get_armor_add( mod_val ); value *= 1.0 + get_armor_multiply( mod_val ); return value; diff --git a/src/melee.cpp b/src/melee.cpp index ea6a92711bf95..8d9e03a1f1637 100644 --- a/src/melee.cpp +++ b/src/melee.cpp @@ -524,9 +524,12 @@ damage_instance Creature::modify_damage_dealt_with_enchantments( const damage_in continue; } - modified.add_damage( dt.id, enchantment_cache->modify_melee_damage( dt.id, 0.0f ) ); - modified.add_damage( dt.id, enchantment_cache->modify_value( enchant_vals::mod::MELEE_DAMAGE, - 0.0f ) ); + double dmg_mod = enchantment_cache->modify_melee_damage( dt.id, 0.0f ); + if( dmg_mod != 0 ) { + modified.add_damage( dt.id, dmg_mod ); + modified.add_damage( dt.id, enchantment_cache->modify_value( enchant_vals::mod::MELEE_DAMAGE, + 0.0f ) ); + } } return modified; From 99cacc1d2e72a5892876cc3eaa6f169fdb10fcf1 Mon Sep 17 00:00:00 2001 From: Anton Simakov <67688115+GuardianDll@users.noreply.github.com> Date: Wed, 11 Dec 2024 08:25:17 +0100 Subject: [PATCH 6/8] please clang --- data/mods/BombasticPerks/perkdata/bellringer.json | 2 +- src/magic_enchantment.cpp | 6 +++--- src/magic_enchantment.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/data/mods/BombasticPerks/perkdata/bellringer.json b/data/mods/BombasticPerks/perkdata/bellringer.json index 4922472d4ef46..62940ca4a2d3b 100644 --- a/data/mods/BombasticPerks/perkdata/bellringer.json +++ b/data/mods/BombasticPerks/perkdata/bellringer.json @@ -27,6 +27,6 @@ "apply_message": "", "rating": "bad", "max_duration": "1 s", - "incoming_damage_mod": [ { "type": "bash", "multiply": -0.33 } ] + "enchantments": [ { "incoming_damage_mod": [ { "type": "bash", "multiply": -0.33 } ] } ] } ] diff --git a/src/magic_enchantment.cpp b/src/magic_enchantment.cpp index 208f46d98dde4..03e9fc239bfdc 100644 --- a/src/magic_enchantment.cpp +++ b/src/magic_enchantment.cpp @@ -352,8 +352,8 @@ bool enchantment::is_monster_relevant() const } } - if( damage_values_add.size() != 0 || damage_values_multiply.size() != 0 || - armor_values_add.size() != 0 || armor_values_multiply.size() != 0 ) { + if( !damage_values_add.empty() || !damage_values_multiply.empty() || + !armor_values_add.empty() || !armor_values_multiply.empty() ) { return true; } @@ -875,7 +875,7 @@ void enchant_cache::force_add( const enchantment &rhs ) force_add_with_dialogue( rhs, d, false ); } -void enchant_cache::force_add_with_dialogue( const enchantment &rhs, const const_dialogue d, +void enchant_cache::force_add_with_dialogue( const enchantment &rhs, const const_dialogue &d, const bool evaluate ) { for( const std::pair &pair_values : diff --git a/src/magic_enchantment.h b/src/magic_enchantment.h index b6ac369273aeb..9527a77b98fc6 100644 --- a/src/magic_enchantment.h +++ b/src/magic_enchantment.h @@ -301,8 +301,8 @@ class enchant_cache : public enchantment void force_add( const enchantment &rhs, const monster &mon ); void force_add( const enchantment &rhs ); void force_add( const enchant_cache &rhs ); - void force_add_with_dialogue( const enchantment &rhs, const const_dialogue d, - const bool evaluate = true ); + void force_add_with_dialogue( const enchantment &rhs, const_dialogue d, + bool evaluate = true ); // modifies character stats, or does other passive effects void activate_passive( Character &guy ) const; From 3caacba7b772e08e96ba2df0cf2d2b2ac68a438b Mon Sep 17 00:00:00 2001 From: Anton Simakov <67688115+GuardianDll@users.noreply.github.com> Date: Wed, 11 Dec 2024 08:42:18 +0100 Subject: [PATCH 7/8] Update src/magic_enchantment.h Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- src/magic_enchantment.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/magic_enchantment.h b/src/magic_enchantment.h index 9527a77b98fc6..a21d5e24f4e4d 100644 --- a/src/magic_enchantment.h +++ b/src/magic_enchantment.h @@ -302,7 +302,7 @@ class enchant_cache : public enchantment void force_add( const enchantment &rhs ); void force_add( const enchant_cache &rhs ); void force_add_with_dialogue( const enchantment &rhs, const_dialogue d, - bool evaluate = true ); + bool evaluate = true ); // modifies character stats, or does other passive effects void activate_passive( Character &guy ) const; From 8df5b80ef2e383cac5167439a1c09c83799caf50 Mon Sep 17 00:00:00 2001 From: Anton Simakov <67688115+GuardianDll@users.noreply.github.com> Date: Wed, 11 Dec 2024 09:32:57 +0100 Subject: [PATCH 8/8] please clang --- src/magic_enchantment.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/magic_enchantment.h b/src/magic_enchantment.h index a21d5e24f4e4d..f91fd480e06df 100644 --- a/src/magic_enchantment.h +++ b/src/magic_enchantment.h @@ -301,7 +301,7 @@ class enchant_cache : public enchantment void force_add( const enchantment &rhs, const monster &mon ); void force_add( const enchantment &rhs ); void force_add( const enchant_cache &rhs ); - void force_add_with_dialogue( const enchantment &rhs, const_dialogue d, + void force_add_with_dialogue( const enchantment &rhs, const const_dialogue &d, bool evaluate = true ); // modifies character stats, or does other passive effects