|
|
@ -12,7 +12,7 @@
|
|
|
|
namespace MWMechanics
|
|
|
|
namespace MWMechanics
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Enchanting::Enchanting():
|
|
|
|
Enchanting::Enchanting():
|
|
|
|
mCastStyle(ESM::CastingStyle_CastOnce)
|
|
|
|
mCastStyle(ESM::Enchantment::CastOnce)
|
|
|
|
{}
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
void Enchanting::setOldItem(MWWorld::Ptr oldItem)
|
|
|
|
void Enchanting::setOldItem(MWWorld::Ptr oldItem)
|
|
|
@ -74,7 +74,7 @@ namespace MWMechanics
|
|
|
|
MWWorld::Class::get (mEnchanter).skillUsageSucceeded (mEnchanter, ESM::Skill::Enchant, 1);
|
|
|
|
MWWorld::Class::get (mEnchanter).skillUsageSucceeded (mEnchanter, ESM::Skill::Enchant, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(mCastStyle==ESM::CastingStyle_ConstantEffect)
|
|
|
|
if(mCastStyle==ESM::Enchantment::ConstantEffect)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
enchantment.mData.mCharge=0;
|
|
|
|
enchantment.mData.mCharge=0;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -102,7 +102,7 @@ namespace MWMechanics
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (itemEmpty())
|
|
|
|
if (itemEmpty())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
mCastStyle = ESM::CastingStyle_WhenUsed;
|
|
|
|
mCastStyle = ESM::Enchantment::WhenUsed;
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -112,12 +112,12 @@ namespace MWMechanics
|
|
|
|
{ // Armor or Clothing
|
|
|
|
{ // Armor or Clothing
|
|
|
|
switch(mCastStyle)
|
|
|
|
switch(mCastStyle)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
case ESM::CastingStyle_WhenUsed:
|
|
|
|
case ESM::Enchantment::WhenUsed:
|
|
|
|
if (powerfulSoul)
|
|
|
|
if (powerfulSoul)
|
|
|
|
mCastStyle = ESM::CastingStyle_ConstantEffect;
|
|
|
|
mCastStyle = ESM::Enchantment::ConstantEffect;
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
default: // takes care of Constant effect too
|
|
|
|
default: // takes care of Constant effect too
|
|
|
|
mCastStyle = ESM::CastingStyle_WhenUsed;
|
|
|
|
mCastStyle = ESM::Enchantment::WhenUsed;
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -125,28 +125,28 @@ namespace MWMechanics
|
|
|
|
{ // Weapon
|
|
|
|
{ // Weapon
|
|
|
|
switch(mCastStyle)
|
|
|
|
switch(mCastStyle)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
case ESM::CastingStyle_WhenStrikes:
|
|
|
|
case ESM::Enchantment::WhenStrikes:
|
|
|
|
mCastStyle = ESM::CastingStyle_WhenUsed;
|
|
|
|
mCastStyle = ESM::Enchantment::WhenUsed;
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
case ESM::CastingStyle_WhenUsed:
|
|
|
|
case ESM::Enchantment::WhenUsed:
|
|
|
|
if (powerfulSoul)
|
|
|
|
if (powerfulSoul)
|
|
|
|
mCastStyle = ESM::CastingStyle_ConstantEffect;
|
|
|
|
mCastStyle = ESM::Enchantment::ConstantEffect;
|
|
|
|
else
|
|
|
|
else
|
|
|
|
mCastStyle = ESM::CastingStyle_WhenStrikes;
|
|
|
|
mCastStyle = ESM::Enchantment::WhenStrikes;
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
default: // takes care of Constant effect too
|
|
|
|
default: // takes care of Constant effect too
|
|
|
|
mCastStyle = ESM::CastingStyle_WhenStrikes;
|
|
|
|
mCastStyle = ESM::Enchantment::WhenStrikes;
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(mObjectType == typeid(ESM::Book).name())
|
|
|
|
else if(mObjectType == typeid(ESM::Book).name())
|
|
|
|
{ // Scroll or Book
|
|
|
|
{ // Scroll or Book
|
|
|
|
mCastStyle = ESM::CastingStyle_CastOnce;
|
|
|
|
mCastStyle = ESM::Enchantment::CastOnce;
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Fail case
|
|
|
|
// Fail case
|
|
|
|
mCastStyle = ESM::CastingStyle_CastOnce;
|
|
|
|
mCastStyle = ESM::Enchantment::CastOnce;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
@ -184,7 +184,7 @@ namespace MWMechanics
|
|
|
|
magMax = (it->mMagnMax == 0) ? 1 : it->mMagnMax;
|
|
|
|
magMax = (it->mMagnMax == 0) ? 1 : it->mMagnMax;
|
|
|
|
area = (it->mArea == 0) ? 1 : it->mArea;
|
|
|
|
area = (it->mArea == 0) ? 1 : it->mArea;
|
|
|
|
|
|
|
|
|
|
|
|
if (mCastStyle == ESM::CastingStyle_ConstantEffect)
|
|
|
|
if (mCastStyle == ESM::Enchantment::ConstantEffect)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
magnitudeCost = (magMin + magMax) * baseCost * 2.5;
|
|
|
|
magnitudeCost = (magMin + magMax) * baseCost * 2.5;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -209,7 +209,7 @@ namespace MWMechanics
|
|
|
|
|
|
|
|
|
|
|
|
float Enchanting::getCastCost() const
|
|
|
|
float Enchanting::getCastCost() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (mCastStyle == ESM::CastingStyle_ConstantEffect)
|
|
|
|
if (mCastStyle == ESM::Enchantment::ConstantEffect)
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
|
|
const float enchantCost = getEnchantPoints();
|
|
|
|
const float enchantCost = getEnchantPoints();
|
|
|
@ -256,16 +256,12 @@ namespace MWMechanics
|
|
|
|
}
|
|
|
|
}
|
|
|
|
bool Enchanting::soulEmpty() const
|
|
|
|
bool Enchanting::soulEmpty() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (mSoulGemPtr.isEmpty())
|
|
|
|
return mSoulGemPtr.isEmpty();
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool Enchanting::itemEmpty() const
|
|
|
|
bool Enchanting::itemEmpty() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(mOldItemPtr.isEmpty())
|
|
|
|
return mOldItemPtr.isEmpty();
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Enchanting::setSelfEnchanting(bool selfEnchanting)
|
|
|
|
void Enchanting::setSelfEnchanting(bool selfEnchanting)
|
|
|
@ -291,7 +287,7 @@ namespace MWMechanics
|
|
|
|
+ (0.125 * creatureStats.getAttribute (ESM::Attribute::Luck).getModified()));
|
|
|
|
+ (0.125 * creatureStats.getAttribute (ESM::Attribute::Luck).getModified()));
|
|
|
|
|
|
|
|
|
|
|
|
float chance2 = 2.5 * getEnchantPoints();
|
|
|
|
float chance2 = 2.5 * getEnchantPoints();
|
|
|
|
if(mCastStyle==ESM::CastingStyle_ConstantEffect)
|
|
|
|
if(mCastStyle==ESM::Enchantment::ConstantEffect)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
float constantChance = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find ("fEnchantmentConstantChanceMult")->getFloat();
|
|
|
|
float constantChance = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find ("fEnchantmentConstantChanceMult")->getFloat();
|
|
|
|
chance2 /= constantChance;
|
|
|
|
chance2 /= constantChance;
|
|
|
|