MWMechanics::Alchemy::Result MWMechanics::Alchemy::create (const std::string& name) { if (mTools[ESM::Apparatus::MortarPestle].isEmpty()) return Result_NoMortarAndPestle; if (countIngredients()<2) return Result_LessThanTwoIngredients; if (name.empty()) return Result_NoName; if (listEffects().empty()) return Result_NoEffects; if (beginEffects() == endEffects()) { // all effects were nullified due to insufficient skill removeIngredients(); return Result_RandomFailure; } if (getAlchemyFactor() < OEngine::Misc::Rng::roll0to99()) { removeIngredients(); return Result_RandomFailure; } addPotion (name); removeIngredients(); increaseSkill(); return Result_Success; }
MWMechanics::Alchemy::Result MWMechanics::Alchemy::create (const std::string& name) { if (mTools[ESM::Apparatus::MortarPestle].isEmpty()) return Result_NoMortarAndPestle; if (countIngredients()<2) return Result_LessThanTwoIngredients; if (name.empty() && getPotionName().empty()) return Result_NoName; if (beginEffects()==endEffects()) return Result_NoEffects; if (getChance()<std::rand()/static_cast<double> (RAND_MAX)*100) { removeIngredients(); return Result_RandomFailure; } addPotion (name); removeIngredients(); increaseSkill(); return Result_Success; }