mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 04:45:33 +00:00
Merge remote-tracking branch 'jordan-ayers/topic/disease-cleanup'
This commit is contained in:
commit
a166034e12
2 changed files with 10 additions and 18 deletions
|
@ -25,6 +25,8 @@ namespace MWMechanics
|
|||
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find(
|
||||
"fDiseaseXferChance")->getFloat();
|
||||
|
||||
MagicEffects& actorEffects = actor.getClass().getCreatureStats(actor).getMagicEffects();
|
||||
|
||||
Spells& spells = carrier.getClass().getCreatureStats(carrier).getSpells();
|
||||
for (Spells::TIterator it = spells.begin(); it != spells.end(); ++it)
|
||||
{
|
||||
|
@ -33,26 +35,16 @@ namespace MWMechanics
|
|||
if (actor.getClass().getCreatureStats(actor).getSpells().hasSpell(spell->mId))
|
||||
continue;
|
||||
|
||||
bool hasCorprusEffect = false;
|
||||
for (std::vector<ESM::ENAMstruct>::const_iterator effectIt = spell->mEffects.mList.begin(); effectIt != spell->mEffects.mList.end(); ++effectIt)
|
||||
{
|
||||
if (effectIt->mEffectID == ESM::MagicEffect::Corprus)
|
||||
{
|
||||
hasCorprusEffect = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
float resist = 0.f;
|
||||
if (hasCorprusEffect)
|
||||
resist = 1.f - 0.01 * (actor.getClass().getCreatureStats(actor).getMagicEffects().get(ESM::MagicEffect::ResistCorprusDisease).getMagnitude()
|
||||
- actor.getClass().getCreatureStats(actor).getMagicEffects().get(ESM::MagicEffect::WeaknessToCorprusDisease).getMagnitude());
|
||||
if (spells.hasCorprusEffect(spell))
|
||||
resist = 1.f - 0.01 * (actorEffects.get(ESM::MagicEffect::ResistCorprusDisease).getMagnitude()
|
||||
- actorEffects.get(ESM::MagicEffect::WeaknessToCorprusDisease).getMagnitude());
|
||||
else if (spell->mData.mType == ESM::Spell::ST_Disease)
|
||||
resist = 1.f - 0.01 * (actor.getClass().getCreatureStats(actor).getMagicEffects().get(ESM::MagicEffect::ResistCommonDisease).getMagnitude()
|
||||
- actor.getClass().getCreatureStats(actor).getMagicEffects().get(ESM::MagicEffect::WeaknessToCommonDisease).getMagnitude());
|
||||
resist = 1.f - 0.01 * (actorEffects.get(ESM::MagicEffect::ResistCommonDisease).getMagnitude()
|
||||
- actorEffects.get(ESM::MagicEffect::WeaknessToCommonDisease).getMagnitude());
|
||||
else if (spell->mData.mType == ESM::Spell::ST_Blight)
|
||||
resist = 1.f - 0.01 * (actor.getClass().getCreatureStats(actor).getMagicEffects().get(ESM::MagicEffect::ResistBlightDisease).getMagnitude()
|
||||
- actor.getClass().getCreatureStats(actor).getMagicEffects().get(ESM::MagicEffect::WeaknessToBlightDisease).getMagnitude());
|
||||
resist = 1.f - 0.01 * (actorEffects.get(ESM::MagicEffect::ResistBlightDisease).getMagnitude()
|
||||
- actorEffects.get(ESM::MagicEffect::WeaknessToBlightDisease).getMagnitude());
|
||||
else
|
||||
continue;
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ namespace MWMechanics
|
|||
|
||||
TIterator end() const;
|
||||
|
||||
bool hasSpell(const std::string& spell) { return mSpells.find(Misc::StringUtils::lowerCase(spell)) != mSpells.end(); }
|
||||
bool hasSpell(const std::string& spell) const { return mSpells.find(Misc::StringUtils::lowerCase(spell)) != mSpells.end(); }
|
||||
|
||||
void add (const std::string& spell);
|
||||
///< Adding a spell that is already listed in *this is a no-op.
|
||||
|
|
Loading…
Reference in a new issue