fix: Removes the absurb 6 hour skill edge case and fixes target cancellations (#2212)

This commit is contained in:
Kamron Batman 2025-06-07 10:58:01 -10:00 committed by GitHub
parent ea4080ce0e
commit 14bc38e375
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 32 additions and 45 deletions

View file

@ -661,6 +661,7 @@ public partial class Mobile : IHued, IComparable<Mobile>, ISpawnable, IObjectPro
}
}
[CommandProperty(AccessLevel.Administrator)]
public long NextActionTime { get; set; }
public long NextActionMessage { get; set; }
@ -675,6 +676,7 @@ public partial class Mobile : IHued, IComparable<Mobile>, ISpawnable, IObjectPro
public virtual bool CanRegenStam => Alive;
public virtual bool CanRegenMana => Alive;
[CommandProperty(AccessLevel.Administrator)]
public long NextSkillTime { get; set; }
public List<AggressorInfo> Aggressors { get; private set; }

View file

@ -21,23 +21,18 @@ namespace Server.SkillHandlers
m.SendLocalizedMessage(500397); // To whom do you wish to grovel?
return TimeSpan.FromHours(6.0);
return TimeSpan.FromSeconds(30.0);
}
private class InternalTarget : Target
{
private bool m_SetSkillTime = true;
public InternalTarget() : base(12, false, TargetFlags.None)
{
}
protected override void OnTargetFinish(Mobile from)
protected override void OnTargetCancel(Mobile from, TargetCancelType cancelType)
{
if (m_SetSkillTime)
{
from.NextSkillTime = Core.TickCount;
}
from.NextSkillTime = Core.TickCount;
}
protected override void OnTarget(Mobile from, object targeted)
@ -81,8 +76,6 @@ namespace Server.SkillHandlers
from.Animate(32, 5, 1, true, false, 0); // Bow
new InternalTimer(from, targ).Start();
m_SetSkillTime = false;
}
}
else // Not a Mobile
@ -125,16 +118,7 @@ namespace Server.SkillHandlers
else if (m_From.CheckTargetSkill(SkillName.Begging, m_Target, 0.0, 100.0))
{
var toConsume = theirPack.GetAmount(typeof(Gold)) / 10;
var max = 10 + m_From.Fame / 2500;
if (max > 14)
{
max = 14;
}
else if (max < 10)
{
max = 10;
}
var max = Math.Clamp(10 + m_From.Fame / 2500, 10, 14);
if (toConsume > max)
{

View file

@ -18,7 +18,7 @@ namespace Server.SkillHandlers
src.SendLocalizedMessage(500819); // Where will you search?
src.Target = new InternalTarget();
return TimeSpan.FromSeconds(6.0);
return TimeSpan.FromSeconds(30.0);
}
private class InternalTarget : Target
@ -27,6 +27,11 @@ namespace Server.SkillHandlers
{
}
protected override void OnTargetCancel(Mobile from, TargetCancelType cancelType)
{
from.NextSkillTime = Core.TickCount;
}
protected override void OnTarget(Mobile src, object targ)
{
var foundAnyone = false;

View file

@ -27,27 +27,22 @@ namespace Server.SkillHandlers
from.RevealingAction();
from.SendLocalizedMessage(1049525); // Whom do you wish to calm?
from.Target = new InternalTarget(from, instrument);
from.NextSkillTime = Core.TickCount + 21600000;
from.NextSkillTime = Core.TickCount + 30000; // 30s timeout on the targeter
}
private class InternalTarget : Target
{
private readonly BaseInstrument m_Instrument;
private bool m_SetSkillTime = true;
public InternalTarget(Mobile from, BaseInstrument instrument) : base(
BaseInstrument.GetBardRange(from, SkillName.Peacemaking),
false,
TargetFlags.None
) =>
m_Instrument = instrument;
) => m_Instrument = instrument;
protected override void OnTargetFinish(Mobile from)
protected override void OnTargetCancel(Mobile from, TargetCancelType cancelType)
{
if (m_SetSkillTime)
{
from.NextSkillTime = Core.TickCount;
}
from.NextSkillTime = Core.TickCount;
}
protected override void OnTarget(Mobile from, object targeted)
@ -60,21 +55,19 @@ namespace Server.SkillHandlers
}
else if (from.Region.IsPartOf<SafeZone>())
{
from.SendMessage("You may not peacemake in this area.");
from.SendMessage("You may not use peacemaking in this area.");
}
else if (targ.Region.IsPartOf<SafeZone>())
{
from.SendMessage("You may not peacemake there.");
from.SendMessage("You may not use peacemaking there.");
}
else 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
{
m_SetSkillTime = false;
from.NextSkillTime = Core.TickCount + 10000;
if (targeted == from)
@ -149,17 +142,14 @@ namespace Server.SkillHandlers
if (!from.CanBeHarmful(targ, false))
{
from.SendLocalizedMessage(1049528);
m_SetSkillTime = true;
}
else if (bc?.Uncalmable == true)
{
from.SendLocalizedMessage(1049526); // You have no chance of calming that creature.
m_SetSkillTime = true;
}
else if (bc?.BardPacified == true)
{
from.SendLocalizedMessage(1049527); // That creature is already being calmed.
m_SetSkillTime = true;
}
else if (!BaseInstrument.CheckMusicianship(from))
{
@ -193,10 +183,10 @@ namespace Server.SkillHandlers
targ.Combatant = null;
targ.Warmode = false;
from.SendLocalizedMessage(1049532); // You play hypnotic music, calming your target.
if (bc != null)
{
from.SendLocalizedMessage(1049532); // You play hypnotic music, calming your target.
// You play hypnotic music, calming your target.
var seconds = 100 - diff / 1.5;
if (seconds > 120)
@ -212,8 +202,7 @@ namespace Server.SkillHandlers
}
else
{
from.SendLocalizedMessage(1049532); // You play hypnotic music, calming your target.
// You play hypnotic music, calming your target.
// You hear lovely music, and forget to continue battling!
targ.SendLocalizedMessage(500616);
}

View file

@ -62,7 +62,7 @@ public static class Stealing
m.SendLocalizedMessage(502698); // Which item do you want to steal?
}
return TimeSpan.FromSeconds(10.0);
return TimeSpan.FromSeconds(30.0);
}
private class StealingTarget : Target
@ -75,6 +75,11 @@ public static class Stealing
AllowNonlocal = true;
}
protected override void OnTargetCancel(Mobile from, TargetCancelType cancelType)
{
from.NextSkillTime = Core.TickCount;
}
private Item TryStealItem(Item toSteal, ref bool caught)
{
Item stolen = null;
@ -83,7 +88,7 @@ public static class Stealing
var mobRoot = root as Mobile;
var rootIsPlayer = mobRoot?.Player == true;
StealableArtifacts.StealableInstance si = toSteal.Parent == null || !toSteal.Movable
var si = toSteal.Parent == null || !toSteal.Movable
? StealableArtifacts.GetStealableInstance(toSteal)
: null;
@ -404,6 +409,8 @@ public static class Stealing
pm.PermaFlags.Add(mobRoot);
pm.Delta(MobileDelta.Noto);
}
from.NextSkillTime = Core.TickCount + 10000; // 10 seconds cooldown
}
}
}