fix: Fixes provocation for pre-pub 16 (#1335)

This commit is contained in:
Kamron Batman 2023-02-07 23:33:45 -08:00 committed by GitHub
parent 44c69620a6
commit 3cf6db73f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 28 additions and 32 deletions

View file

@ -79,7 +79,7 @@ namespace Server.Engines.Spawners
var fullOutputDir = Path.Combine(outputDir, stemDir);
PathUtility.EnsureDirectory(fullOutputDir);
var outputFileName = $"{file.Name[..^file.Extension.Length]}.json";
var outputFileName = $"{file.Name.AsSpan(0, file.Name.Length - file.Extension.Length)}.json";
ParsePremiumSpawnerFile(file.FullName, Path.Combine(fullOutputDir, outputFileName), options);
}
catch (Exception e)
@ -231,13 +231,11 @@ namespace Server.Engines.Spawners
return TimeSpan.MinValue;
}
time = time.ToLowerInvariant();
return time[^1] switch
return char.ToLowerInvariant(time[^1]) switch
{
'h' => TimeSpan.FromHours(double.Parse(time[..^1])),
'm' => TimeSpan.FromMinutes(double.Parse(time[..^1])),
's' => TimeSpan.FromSeconds(double.Parse(time[..^1])),
'h' => TimeSpan.FromHours(double.Parse(time.AsSpan(0, time.Length - 1))),
'm' => TimeSpan.FromMinutes(double.Parse(time.AsSpan(0, time.Length - 1))),
's' => TimeSpan.FromSeconds(double.Parse(time.AsSpan(0, time.Length - 1))),
_ => TimeSpan.FromMinutes(double.Parse(time))
};
}

View file

@ -260,7 +260,10 @@ namespace Server.Items
- Summoning Undead
*/
var val = targ.HitsMax * 1.6 + targ.StamMax + targ.ManaMax;
// Before LBR, the success rate is actually your skill rate.
// We are going to fudge the numbers so it feels right without having two separate provocation calculations
// To do this, we should *undo* the 1.6x multiplier on HitsMaxSeed
var val = targ.HitsMax * (Core.LBR ? 1.6 : 0.625) + targ.StamMax + targ.ManaMax;
val += targ.SkillsTotal / 10.0;

View file

@ -166,16 +166,14 @@ namespace Server.Misc
private static string GetFormattedInfo(string code)
{
if (code?.Length != 3)
if (code?.Length == 3)
{
return $"Unknown code {code}";
}
for (var i = 0; i < InternationalCodes.Length; i++)
{
if (code == InternationalCodes[i].Code)
for (var i = 0; i < InternationalCodes.Length; i++)
{
return $"{InternationalCodes[i].GetName()}";
if (code == InternationalCodes[i].Code)
{
return InternationalCodes[i].GetName();
}
}
}

View file

@ -30,6 +30,7 @@ namespace Server
private static int[] Load()
{
var path = "Data/shrink.json";
var table = JsonConfig.Deserialize<Dictionary<string, string>>(path);
if (table == null)
{

View file

@ -380,7 +380,7 @@ namespace Server.Misc
if (mob.Female && skillTitle.EndsWithOrdinal("man"))
{
skillTitle = $"{skillTitle[..^3]}woman";
return $"{skillLevel} {skillTitle.AsSpan(0, skillTitle.Length - 3)}woman";
}
return $"{skillLevel} {skillTitle}";

View file

@ -63,9 +63,9 @@ namespace Server.SkillHandlers
{
from.RevealingAction();
m_Instrument.PlayInstrumentWell(from);
from.SendLocalizedMessage(
1008085
); // You play your music and your target becomes angered. Whom do you wish them to attack?
// You play your music and your target becomes angered. Whom do you wish them to attack?
from.SendLocalizedMessage(1008085);
from.Target = new InternalSecondTarget(from, m_Instrument, creature);
}
}
@ -99,9 +99,8 @@ namespace Server.SkillHandlers
{
if (!m_Instrument.IsChildOf(from.Backpack))
{
from.SendLocalizedMessage(
1062488
); // The instrument you are trying to play is no longer in your backpack!
// The instrument you are trying to play is no longer in your backpack!
from.SendLocalizedMessage(1062488);
}
else if (m_Creature.Unprovokable)
{
@ -111,21 +110,18 @@ namespace Server.SkillHandlers
{
from.SendLocalizedMessage(1049446); // You have no chance of provoking those creatures.
}
else if (m_Creature.Map != creature.Map || !m_Creature.InRange(
creature,
BaseInstrument.GetBardRange(from, SkillName.Provocation)
))
else if (m_Creature.Map != creature.Map ||
!m_Creature.InRange(creature, BaseInstrument.GetBardRange(from, SkillName.Provocation)))
{
from.SendLocalizedMessage(
1049450
); // The creatures you are trying to provoke are too far away from each other for your music to have an effect.
// The creatures you are trying to provoke are too far away from each other for your music to have an effect.
from.SendLocalizedMessage(1049450);
}
else if (m_Creature != creature)
{
from.NextSkillTime = Core.TickCount + 10000;
var diff = (m_Instrument.GetDifficultyFor(m_Creature) + m_Instrument.GetDifficultyFor(creature)) *
0.5 - 5.0;
var diff =
(m_Instrument.GetDifficultyFor(m_Creature) + m_Instrument.GetDifficultyFor(creature)) * 0.5 - 5.0;
var music = from.Skills.Musicianship.Value;
if (music > 100.0)