1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-16 21:49:55 +00:00

Switching in nextCastStyle() is now based on enum CastingStyle.

This commit is contained in:
Miroslav Puda 2013-05-27 16:08:58 +02:00
parent 252a1d9223
commit 1c7b94e94f

View file

@ -100,38 +100,53 @@ namespace MWMechanics
void Enchanting::nextCastStyle() void Enchanting::nextCastStyle()
{ {
mCastStyle++;
if (itemEmpty()) if (itemEmpty())
{ {
mCastStyle = 0; mCastStyle = ESM::CS_WhenUsed;
return; return;
} }
if ((mObjectType == typeid(ESM::Armor).name())||(mObjectType == typeid(ESM::Clothing).name()))
{ const bool powerfulSoul = getGemCharge() >= \
int soulConstAmount = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find ("iSoulAmountForConstantEffect")->getInt(); MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find ("iSoulAmountForConstantEffect")->getInt();
if ((mObjectType == typeid(ESM::Armor).name()) || (mObjectType == typeid(ESM::Clothing).name()))
{ // Armor or Clothing
switch(mCastStyle) switch(mCastStyle)
{ {
case 1: case ESM::CS_WhenUsed:
mCastStyle = 2; if (powerfulSoul)
case 3: mCastStyle = ESM::CS_ConstantEffect;
if(getGemCharge()<soulConstAmount) return;
mCastStyle=2; default: // takes care of Constant effect too
case 4: mCastStyle = ESM::CS_WhenUsed;
mCastStyle = 2; return;
} }
} }
else if(mObjectType == typeid(ESM::Weapon).name()) else if(mObjectType == typeid(ESM::Weapon).name())
{ { // Weapon
switch(mCastStyle) switch(mCastStyle)
{ {
case 3: case ESM::CS_WhenStrikes:
mCastStyle = 1; mCastStyle = ESM::CS_WhenUsed;
return;
case ESM::CS_WhenUsed:
if (powerfulSoul)
mCastStyle = ESM::CS_ConstantEffect;
else
mCastStyle = ESM::CS_WhenStrikes;
return;
default: // takes care of Constant effect too
mCastStyle = ESM::CS_WhenStrikes;
return;
} }
} }
else if(mObjectType == typeid(ESM::Book).name()) else if(mObjectType == typeid(ESM::Book).name())
{ { // Scroll or Book
mCastStyle=0; mCastStyle = ESM::CS_CastOnce;
return;
} }
// Fail case
mCastStyle = ESM::CS_CastOnce;
} }
/* /*