mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-31 23:15:41 +00:00
Spells that always succeed should not increase your skill when you cast them
This commit is contained in:
parent
e8a245bea3
commit
fc789265e2
2 changed files with 19 additions and 2 deletions
|
@ -151,6 +151,20 @@ namespace MWMechanics
|
|||
return school;
|
||||
}
|
||||
|
||||
bool spellIncreasesSkill(const ESM::Spell *spell)
|
||||
{
|
||||
if (spell->mData.mType == ESM::Spell::ST_Spell && !(spell->mData.mFlags & ESM::Spell::F_Always))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool spellIncreasesSkill(const std::string &spellId)
|
||||
{
|
||||
const ESM::Spell* spell =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find(spellId);
|
||||
return spellIncreasesSkill(spell);
|
||||
}
|
||||
|
||||
float getEffectResistanceAttribute (short effectId, const MagicEffects* actorEffects)
|
||||
{
|
||||
short resistanceEffect = ESM::MagicEffect::getResistanceEffect(effectId);
|
||||
|
@ -775,7 +789,7 @@ namespace MWMechanics
|
|||
}
|
||||
}
|
||||
|
||||
if (mCaster.getRefData().getHandle() == "player" && spell->mData.mType == ESM::Spell::ST_Spell)
|
||||
if (mCaster.getRefData().getHandle() == "player" && spellIncreasesSkill(spell))
|
||||
mCaster.getClass().skillUsageSucceeded(mCaster,
|
||||
spellSchoolToSkill(school), 0);
|
||||
|
||||
|
@ -874,5 +888,4 @@ namespace MWMechanics
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -36,6 +36,10 @@ namespace MWMechanics
|
|||
int getSpellSchool(const std::string& spellId, const MWWorld::Ptr& actor);
|
||||
int getSpellSchool(const ESM::Spell* spell, const MWWorld::Ptr& actor);
|
||||
|
||||
/// Get whether or not the given spell contributes to skill progress.
|
||||
bool spellIncreasesSkill(const ESM::Spell* spell);
|
||||
bool spellIncreasesSkill(const std::string& spellId);
|
||||
|
||||
/// 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 (short effectId, const MagicEffects* actorEffects);
|
||||
|
|
Loading…
Reference in a new issue