Correct cast cost for enchantments.

actorid
Miroslav Puda 12 years ago
parent 1c7b94e94f
commit 9a9b075a02

@ -66,7 +66,7 @@ namespace MWGui
mCharge->setCaption(boost::lexical_cast<std::string>(mEnchanting.getGemCharge()));
mCastCost->setCaption(boost::lexical_cast<std::string>(mEnchanting.getEnchantCost()));
mCastCost->setCaption(boost::lexical_cast<std::string>(mEnchanting.getCastCost()));
mPrice->setCaption(boost::lexical_cast<std::string>(mEnchanting.getEnchantPrice()));

@ -206,6 +206,24 @@ namespace MWMechanics
return enchantmentCost;
}
float Enchanting::getCastCost() const
{
const float enchantCost = getEnchantCost();
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
MWMechanics::NpcStats &stats = MWWorld::Class::get(player).getNpcStats(player);
int eSkill = stats.getSkill(ESM::Skill::Enchant).getModified();
/*
* Each point of enchant skill above/under 10 subtracts/adds
* one percent of enchantment cost while minimum is 1.
*/
const float castCost = enchantCost - (enchantCost / 100) * (eSkill - 10);
return (castCost < 1) ? 1 : castCost;
}
int Enchanting::getEnchantPrice() const
{
if(mEnchanter.isEmpty())

@ -37,6 +37,7 @@ namespace MWMechanics
void nextCastStyle(); //Set enchant type to next possible type (for mOldItemPtr object)
int getCastStyle() const;
float getEnchantCost() const;
float getCastCost() const;
int getEnchantPrice() const;
float getMaxEnchantValue() const;
int getGemCharge() const;

Loading…
Cancel
Save