mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-19 17:09:40 +00:00
Cap enchantment casting cost to 1 as displayed in enchanting window. Display current enchantment charge in spell window.
This commit is contained in:
parent
07408a4652
commit
14c9a4e1d3
3 changed files with 12 additions and 4 deletions
|
@ -463,7 +463,7 @@ namespace MWClass
|
|||
// Check if we have enough charges
|
||||
const float enchantCost = enchantment->mData.mCost;
|
||||
int eSkill = stats.getSkill(ESM::Skill::Enchant).getModified();
|
||||
const float castCost = enchantCost - (enchantCost / 100) * (eSkill - 10);
|
||||
const int castCost = std::max(1.f, enchantCost - (enchantCost / 100) * (eSkill - 10));
|
||||
|
||||
if (weapon.getCellRef().mEnchantmentCharge == -1)
|
||||
weapon.getCellRef().mEnchantmentCharge = enchantment->mData.mCharge;
|
||||
|
|
|
@ -282,8 +282,16 @@ namespace MWGui
|
|||
MyGUI::Button* costCharge = mSpellView->createWidget<MyGUI::Button>(equipped ? "SpellText" : "SpellTextUnequipped",
|
||||
MyGUI::IntCoord(4, mHeight, mWidth-8, spellHeight), MyGUI::Align::Left | MyGUI::Align::Top);
|
||||
|
||||
std::string cost = boost::lexical_cast<std::string>(enchant->mData.mCost);
|
||||
std::string charge = boost::lexical_cast<std::string>(enchant->mData.mCharge); /// \todo track current charge
|
||||
float enchantCost = enchant->mData.mCost;
|
||||
MWMechanics::NpcStats &stats = player.getClass().getNpcStats(player);
|
||||
int eSkill = stats.getSkill(ESM::Skill::Enchant).getModified();
|
||||
int castCost = std::max(1.f, enchantCost - (enchantCost / 100) * (eSkill - 10));
|
||||
|
||||
std::string cost = boost::lexical_cast<std::string>(castCost);
|
||||
int currentCharge = int(item.getCellRef().mEnchantmentCharge);
|
||||
if (currentCharge == -1)
|
||||
currentCharge = enchant->mData.mCharge;
|
||||
std::string charge = boost::lexical_cast<std::string>(currentCharge);
|
||||
if (enchant->mData.mType == ESM::Enchantment::CastOnce)
|
||||
{
|
||||
// this is Morrowind behaviour
|
||||
|
|
|
@ -295,7 +295,7 @@ namespace MWMechanics
|
|||
const float enchantCost = enchantment->mData.mCost;
|
||||
MWMechanics::NpcStats &stats = MWWorld::Class::get(mCaster).getNpcStats(mCaster);
|
||||
int eSkill = stats.getSkill(ESM::Skill::Enchant).getModified();
|
||||
const float castCost = enchantCost - (enchantCost / 100) * (eSkill - 10);
|
||||
const int castCost = std::max(1.f, enchantCost - (enchantCost / 100) * (eSkill - 10));
|
||||
|
||||
if (item.getCellRef().mEnchantmentCharge == -1)
|
||||
item.getCellRef().mEnchantmentCharge = enchantment->mData.mCharge;
|
||||
|
|
Loading…
Reference in a new issue