fix: Fixes TimeSpan rounding issues (#1610)
### Summary TLDR - .NET Framework rounded TimeSpan (and some DateTime) methods to the nearest millisecond. This was actually _expected_ accidentally for parts of RunUO. We are aiming to fix this and clean up some other bad assumptions. Closes #1604
This commit is contained in:
parent
98727d13b3
commit
331f24cb71
16 changed files with 91 additions and 87 deletions
|
|
@ -212,9 +212,7 @@ public abstract partial class BasePotion : Item, ICraftable, ICommodity
|
|||
return v;
|
||||
}
|
||||
|
||||
var scalar = 1.0 + 0.01 * EnhancePotions(m);
|
||||
|
||||
return TimeSpan.FromSeconds(v.TotalSeconds * scalar);
|
||||
return v * (1.0 + 0.01 * EnhancePotions(m));
|
||||
}
|
||||
|
||||
public static double Scale(Mobile m, double v)
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ public abstract partial class BaseConflagrationPotion : BasePotion
|
|||
{
|
||||
if (m_Delay.TryGetValue(m, out var timer) && timer.Next > Core.Now)
|
||||
{
|
||||
return (int)(timer.Next - Core.Now).TotalSeconds;
|
||||
return (int)Math.Round((timer.Next - Core.Now).TotalSeconds);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ public abstract partial class BaseConfusionBlastPotion : BasePotion
|
|||
{
|
||||
if (_delay.TryGetValue(m, out var timer) && timer.Next > Core.Now)
|
||||
{
|
||||
return (int)(timer.Next - Core.Now).TotalSeconds;
|
||||
return (int)Math.Round((timer.Next - Core.Now).TotalSeconds);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -495,36 +495,33 @@ public class BandageContext : Timer
|
|||
seconds = 9.4 + 0.6 * ((double)(120 - dex) / 10);
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (Core.AOS && GetPrimarySkill(patient) == SkillName.Veterinary)
|
||||
{
|
||||
if (Core.AOS && GetPrimarySkill(patient) == SkillName.Veterinary)
|
||||
seconds = 2.0;
|
||||
}
|
||||
else if (Core.AOS)
|
||||
{
|
||||
if (dex < 204)
|
||||
{
|
||||
seconds = 2.0;
|
||||
}
|
||||
else if (Core.AOS)
|
||||
{
|
||||
if (dex < 204)
|
||||
{
|
||||
seconds = 3.2 - Math.Sin((double)dex / 130) * 2.5 + resDelay;
|
||||
}
|
||||
else
|
||||
{
|
||||
seconds = 0.7 + resDelay;
|
||||
}
|
||||
}
|
||||
else if (dex >= 100)
|
||||
{
|
||||
seconds = 3.0 + resDelay;
|
||||
}
|
||||
else if (dex >= 40)
|
||||
{
|
||||
seconds = 4.0 + resDelay;
|
||||
seconds = 3.2 - Math.Sin((double)dex / 130) * 2.5 + resDelay;
|
||||
}
|
||||
else
|
||||
{
|
||||
seconds = 5.0 + resDelay;
|
||||
seconds = 0.7 + resDelay;
|
||||
}
|
||||
}
|
||||
else if (dex >= 100)
|
||||
{
|
||||
seconds = 3.0 + resDelay;
|
||||
}
|
||||
else if (dex >= 40)
|
||||
{
|
||||
seconds = 4.0 + resDelay;
|
||||
}
|
||||
else
|
||||
{
|
||||
seconds = 5.0 + resDelay;
|
||||
}
|
||||
|
||||
var context = GetContext(healer);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue