예제 #1
0
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;
}
예제 #2
0
파일: alchemy.cpp 프로젝트: 0xmono/openmw
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;
}