Esempio n. 1
0
    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));
        }
    }
Esempio n. 2
0
    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;
        }
    }
Esempio n. 3
0
 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;
     }
 }
Esempio n. 4
0
 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;
     }
 }