float CreatureStats::getFatigueTerm() const { int max = getFatigue().getModified(); int current = getFatigue().getCurrent(); float normalised = max==0 ? 1 : std::max (0.0f, static_cast<float> (current)/max); const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); return store.gameSettings.find ("fFatigueBase")->getFloat() - store.gameSettings.find ("fFatigueMult")->getFloat() * (1-normalised); }
float CreatureStats::getFatigueTerm() const { int max = getFatigue().getModified(); int current = getFatigue().getCurrent(); float normalised = max==0 ? 1 : std::max (0.0f, static_cast<float> (current)/max); const MWWorld::Store<ESM::GameSetting> &gmst = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>(); return gmst.find ("fFatigueBase")->getFloat() - gmst.find ("fFatigueMult")->getFloat() * (1-normalised); }
float CreatureStats::getFatigueTerm() const { float max = getFatigue().getModified(); float current = getFatigue().getCurrent(); float normalised = floor(max) == 0 ? 1 : std::max (0.0f, current / max); const MWWorld::Store<ESM::GameSetting> &gmst = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>(); static const float fFatigueBase = gmst.find("fFatigueBase")->getFloat(); static const float fFatigueMult = gmst.find("fFatigueMult")->getFloat(); return fFatigueBase - fFatigueMult * (1-normalised); }
void CreatureStats::setAttribute(int index, const AttributeValue &value) { if (index < 0 || index > 7) { throw std::runtime_error("attribute index is out of range"); } const AttributeValue& currentValue = !mIsWerewolf ? mAttributes[index] : mWerewolfAttributes[index]; if (value != currentValue) { if(!mIsWerewolf) mAttributes[index] = value; else mWerewolfAttributes[index] = value; if (index == ESM::Attribute::Intelligence) mRecalcMagicka = true; else if (index == ESM::Attribute::Strength || index == ESM::Attribute::Willpower || index == ESM::Attribute::Agility || index == ESM::Attribute::Endurance) { int strength = getAttribute(ESM::Attribute::Strength).getModified(); int willpower = getAttribute(ESM::Attribute::Willpower).getModified(); int agility = getAttribute(ESM::Attribute::Agility).getModified(); int endurance = getAttribute(ESM::Attribute::Endurance).getModified(); DynamicStat<float> fatigue = getFatigue(); float diff = (strength+willpower+agility+endurance) - fatigue.getBase(); fatigue.modify(diff); setFatigue(fatigue); } } }