void Spells::add (const ESM::Spell* spell) { if (mSpells.find (spell->mId)==mSpells.end()) { std::map<const int, float> random; // Determine the random magnitudes (unless this is a castable spell, in which case // they will be determined when the spell is cast) if (spell->mData.mType != ESM::Spell::ST_Power && spell->mData.mType != ESM::Spell::ST_Spell) { for (unsigned int i=0; i<spell->mEffects.mList.size();++i) { if (spell->mEffects.mList[i].mMagnMin != spell->mEffects.mList[i].mMagnMax) random[i] = Misc::Rng::rollClosedProbability(); } } if (hasCorprusEffect(spell)) { CorprusStats corprus; corprus.mWorsenings = 0; corprus.mNextWorsening = MWBase::Environment::get().getWorld()->getTimeStamp() + CorprusStats::sWorseningPeriod; mCorprusSpells[spell->mId] = corprus; } mSpells.insert (std::make_pair (spell->mId, random)); } }
void Spells::purgeCorprusDisease() { for (TContainer::iterator iter = mSpells.begin(); iter!=mSpells.end();) { const ESM::Spell *spell = MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find (iter->first); if (hasCorprusEffect(spell)) mSpells.erase(iter++); else ++iter; } }
void Spells::purgeCorprusDisease() { for (TContainer::iterator iter = mSpells.begin(); iter!=mSpells.end();) { const ESM::Spell *spell = iter->first; if (hasCorprusEffect(spell)) { mSpells.erase(iter++); mSpellsChanged = true; } else ++iter; } }
void Spells::purgeBlightDisease() { for (TContainer::iterator iter = mSpells.begin(); iter!=mSpells.end();) { const ESM::Spell *spell = iter->first; if (spell->mData.mType == ESM::Spell::ST_Blight && !hasCorprusEffect(spell)) { mSpells.erase(iter++); mSpellsChanged = true; } else ++iter; } }