fix: Fixes exceptional crafting chance (#1136)
This commit is contained in:
parent
41cc7e60d9
commit
bc746dbf14
2 changed files with 8 additions and 15 deletions
|
|
@ -813,8 +813,7 @@ namespace Server.Engines.Craft
|
||||||
|
|
||||||
public bool CheckSkills(
|
public bool CheckSkills(
|
||||||
Mobile from, Type typeRes, CraftSystem craftSystem, ref int quality, out bool allRequiredSkills
|
Mobile from, Type typeRes, CraftSystem craftSystem, ref int quality, out bool allRequiredSkills
|
||||||
) =>
|
) => CheckSkills(from, typeRes, craftSystem, ref quality, out allRequiredSkills, true);
|
||||||
CheckSkills(from, typeRes, craftSystem, ref quality, out allRequiredSkills, true);
|
|
||||||
|
|
||||||
public bool CheckSkills(
|
public bool CheckSkills(
|
||||||
Mobile from, Type typeRes, CraftSystem craftSystem, ref int quality,
|
Mobile from, Type typeRes, CraftSystem craftSystem, ref int quality,
|
||||||
|
|
@ -873,19 +872,15 @@ namespace Server.Engines.Craft
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
double chance = craftSystem.GetChanceAtMin(this) + (valMainSkill - minMainSkill) / (maxMainSkill - minMainSkill) *
|
var minChance = craftSystem.GetChanceAtMin(this);
|
||||||
(1.0 - craftSystem.GetChanceAtMin(this));
|
|
||||||
|
|
||||||
if (allRequiredSkills && from.Talisman is BaseTalisman talisman && talisman.Skill == craftSystem.MainSkill)
|
double chance = minChance + (valMainSkill - minMainSkill) / (maxMainSkill - minMainSkill) * (1.0 - minChance);
|
||||||
|
|
||||||
|
if (from.Talisman is BaseTalisman talisman && talisman.Skill == craftSystem.MainSkill)
|
||||||
{
|
{
|
||||||
chance += talisman.SuccessBonus / 100.0;
|
chance += talisman.SuccessBonus / 100.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (allRequiredSkills && valMainSkill >= maxMainSkill)
|
|
||||||
{
|
|
||||||
chance = 1.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return chance;
|
return chance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -914,7 +909,7 @@ namespace Server.Engines.Craft
|
||||||
|
|
||||||
var chance = GetSuccessChance(from, typeRes, craftSystem, false, out var allRequiredSkills);
|
var chance = GetSuccessChance(from, typeRes, craftSystem, false, out var allRequiredSkills);
|
||||||
|
|
||||||
if (!allRequiredSkills || !(chance >= 0.0))
|
if (!allRequiredSkills || chance <= 0.0)
|
||||||
{
|
{
|
||||||
from.EndAction<CraftSystem>();
|
from.EndAction<CraftSystem>();
|
||||||
from.SendGump(
|
from.SendGump(
|
||||||
|
|
|
||||||
|
|
@ -79,10 +79,8 @@ namespace Server.Items
|
||||||
|
|
||||||
if (allRequiredSkills && chance >= 0.0)
|
if (allRequiredSkills && chance >= 0.0)
|
||||||
{
|
{
|
||||||
pm.SendLocalizedMessage(
|
// You have learned a new recipe: ~1_RECIPE~
|
||||||
1073451,
|
pm.SendLocalizedMessage(1073451, r.TextDefinition.ToString());
|
||||||
r.TextDefinition.ToString()
|
|
||||||
); // You have learned a new recipe: ~1_RECIPE~
|
|
||||||
pm.AcquireRecipe(r);
|
pm.AcquireRecipe(r);
|
||||||
Delete();
|
Delete();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue