Merge remote-tracking branch 'scrawl/master'

openmw-37
Marc Zinnschlag 9 years ago
commit 7e7215b3b3

@ -123,6 +123,9 @@ namespace MWMechanics
}
}
if (spell->mData.mType == ESM::Spell::ST_Power)
return stats.getSpells().canUsePower(spell->mId) ? 100 : 0;
if (spell->mData.mType != ESM::Spell::ST_Spell)
return 100;
@ -817,6 +820,10 @@ namespace MWMechanics
sndMgr->playSound3D(mCaster, "Spell Failure " + schools[school], 1.0f, 1.0f);
return false;
}
// A power can be used once per 24h
if (spell->mData.mType == ESM::Spell::ST_Power)
stats.getSpells().usePower(spell->mId);
}
if (mCaster == getPlayer() && spellIncreasesSkill(spell))

@ -312,7 +312,7 @@ namespace MWMechanics
bool Spells::canUsePower(const std::string &power) const
{
std::map<std::string, MWWorld::TimeStamp>::const_iterator it = mUsedPowers.find(power);
std::map<std::string, MWWorld::TimeStamp>::const_iterator it = mUsedPowers.find(Misc::StringUtils::lowerCase(power));
if (it == mUsedPowers.end() || it->second + 24 <= MWBase::Environment::get().getWorld()->getTimeStamp())
return true;
else
@ -321,7 +321,7 @@ namespace MWMechanics
void Spells::usePower(const std::string &power)
{
mUsedPowers[power] = MWBase::Environment::get().getWorld()->getTimeStamp();
mUsedPowers[Misc::StringUtils::lowerCase(power)] = MWBase::Environment::get().getWorld()->getTimeStamp();
}
void Spells::readState(const ESM::SpellState &state)

@ -2660,10 +2660,6 @@ namespace MWWorld
{
const ESM::Spell* spell = getStore().get<ESM::Spell>().find(selectedSpell);
// A power can be used once per 24h
if (spell->mData.mType == ESM::Spell::ST_Power)
stats.getSpells().usePower(spell->mId);
cast.cast(spell);
}
else if (actor.getClass().hasInventoryStore(actor))

Loading…
Cancel
Save