- Changed reverse lookup map constructor for gmsts, names, and ESM::MagicEffectIds to be more generic. - Changed refIdToIndex to use map instead of array traversal. - Removed redundant check from refIdToGmstString. - Removed sMagicEffectNames and associated map. Removed dead code from loadmgef.cpp/hpp. - Changed return types of magic effect bindings to RefId. - Reverted ESMStore search to find. - Changed std::map to std::unordered_map for faster lookups in resistance and weakness functions. - Changed loadmgef To methods to pass RefId by value. - Removed StringRefId alias MagicEffectId. - Changed all effectId arguments in PR to pass-by-value. - Removed ESM::MagicEffect::refIdToName function. - Changed effect key type from long to ESM::RefId in OpGetEffect of mwscript. - Removed superfluous MWWorld::Store<ESM::GameSettings> argument to MagicEffect store's setUp method. - Removed transformation code from decompose for ENAM and IRDT structs. - Changed resistance and weakness maps to initialization to use initialization instead of assignment. - Changed sGmstEffectIds to constexpr array since all parameters are known at compile time. - Changed getBoundItemsMap to use an unordered_map and have string_view values. - MagicEffect store definition removed (uses standard template class TypedDynamicStore). - Fixed bug in calculating sun damage that would have made vampires daywalkers in Mournhold. - Removed polymorphic EffectKey constructor and added overload to getOrDefault. - Placed ESM spec IRDT and ENAM structs in anonymous namespace. - Added exception if attempting to serialize ENAM subrecords with out of bounds index. - Added include format statements to satisfy Ubuntu CI linker.
39 lines
1.6 KiB
C++
39 lines
1.6 KiB
C++
#ifndef MWMECHANICS_SPELLRESISTANCE_H
|
|
#define MWMECHANICS_SPELLRESISTANCE_H
|
|
|
|
namespace ESM
|
|
{
|
|
struct Spell;
|
|
class RefId;
|
|
}
|
|
|
|
namespace MWWorld
|
|
{
|
|
class Ptr;
|
|
}
|
|
|
|
namespace MWMechanics
|
|
{
|
|
class MagicEffects;
|
|
|
|
/// Get an effect multiplier for applying an effect cast by the given actor in the given spell (optional).
|
|
/// @return effect multiplier from 0 to 2. (100% net resistance to 100% net weakness)
|
|
/// @param effects Override the actor's current magicEffects. Useful if there are effects currently
|
|
/// being applied (but not applied yet) that should also be considered.
|
|
float getEffectMultiplier(ESM::RefId effectId, const MWWorld::Ptr& actor, const MWWorld::Ptr& caster,
|
|
const ESM::Spell* spell = nullptr, const MagicEffects* effects = nullptr);
|
|
|
|
/// Get the effective resistance against an effect casted by the given actor in the given spell (optional).
|
|
/// @return >=100 for fully resisted. can also return negative value for damage amplification.
|
|
/// @param effects Override the actor's current magicEffects. Useful if there are effects currently
|
|
/// being applied (but not applied yet) that should also be considered.
|
|
float getEffectResistance(ESM::RefId effectId, const MWWorld::Ptr& actor, const MWWorld::Ptr& caster,
|
|
const ESM::Spell* spell = nullptr, const MagicEffects* effects = nullptr);
|
|
|
|
/// Get the resistance attribute against an effect for a given actor. This will add together
|
|
/// ResistX and Weakness to X effects relevant against the given effect.
|
|
float getEffectResistanceAttribute(ESM::RefId effectId, const MagicEffects* actorEffects);
|
|
}
|
|
|
|
#endif
|