fix: Fixes casting by sending ParalyzeFlag to client while animating (#1397)

This commit is contained in:
mark1145 2023-04-28 16:12:07 +10:00 committed by GitHub
parent ba4c4627c3
commit 55dc4a7da5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 17 deletions

View file

@ -33,6 +33,7 @@ public interface IHued
public interface ISpell
{
bool BlocksMovement { get; }
bool IsCasting { get; }
void OnCasterHurt();
void OnCasterKilled();

View file

@ -6959,7 +6959,7 @@ public class Mobile : IHued, IComparable<Mobile>, ISpawnable, IObjectPropertyLis
{
var flags = 0x0;
if (m_Paralyzed || m_Frozen)
if (m_Paralyzed || m_Frozen || m_Spell?.BlocksMovement == true)
{
flags |= 0x01;
}

View file

@ -54,7 +54,8 @@ namespace Server.Items
if (canSwing)
{
canSwing = attacker.Spell is not Spell sp || !sp.IsCasting || !sp.BlocksMovement;
// On OSI you can swing + hold a cast at the same time
canSwing = attacker.Spell is not Spell { IsCasting: true, BlocksMovement: true };
}
}

View file

@ -64,7 +64,7 @@ namespace Server.Spells
public virtual bool BlockedByHorrificBeast => true;
public virtual bool BlockedByAnimalForm => true;
public virtual bool BlocksMovement => true;
public virtual bool BlocksMovement => IsCasting;
public virtual bool CheckNextSpellTime => Scroll is not BaseWand;
@ -145,6 +145,8 @@ namespace Server.Spells
{
Caster.Spell = null;
}
Caster.Delta(MobileDelta.Flags); // Remove paralyze
}
public void StartDelayedDamageContext(Mobile m, Timer t)
@ -420,6 +422,8 @@ namespace Server.Spells
{
DoHurtFizzle();
}
Caster.Delta(MobileDelta.Flags); // Remove paralyze
}
public virtual void DoHurtFizzle()
@ -554,6 +558,8 @@ namespace Server.Spells
WeaponAbility.ClearCurrentAbility(Caster);
}
Caster.Delta(MobileDelta.Flags); // Start paralyze
_castTimer = new CastTimer(this, castDelay);
// m_CastTimer.Start();
@ -885,21 +891,23 @@ namespace Server.Spells
protected override void OnTick()
{
if (m_Spell.State != SpellState.Casting || m_Spell.Caster.Spell != m_Spell)
var caster = m_Spell.Caster;
if (m_Spell.State != SpellState.Casting || caster.Spell != m_Spell)
{
Stop();
return;
}
if (!m_Spell.Caster.Mounted && m_Spell.Info.Action >= 0)
if (!caster.Mounted && m_Spell.Info.Action >= 0)
{
if (m_Spell.Caster.Body.IsHuman)
if (caster.Body.IsHuman)
{
m_Spell.Caster.Animate(m_Spell.Info.Action, 7, 1, true, false, 0);
caster.Animate(m_Spell.Info.Action, 7, 1, true, false, 0);
}
else if (m_Spell.Caster.Player && m_Spell.Caster.Body.IsMonster)
else if (caster.Player && caster.Body.IsMonster)
{
m_Spell.Caster.Animate(12, 7, 1, true, false, 0);
caster.Animate(12, 7, 1, true, false, 0);
}
}
@ -921,27 +929,31 @@ namespace Server.Spells
protected override void OnTick()
{
if (m_Spell?.Caster == null)
var caster = m_Spell?.Caster;
if (caster == null)
{
return;
}
if (m_Spell.State == SpellState.Casting && m_Spell.Caster.Spell == m_Spell)
if (m_Spell.State == SpellState.Casting && caster.Spell == m_Spell)
{
m_Spell.State = SpellState.Sequencing;
m_Spell._castTimer = null;
m_Spell.Caster.OnSpellCast(m_Spell);
m_Spell.Caster.Region?.OnSpellCast(m_Spell.Caster, m_Spell);
m_Spell.Caster.NextSpellTime =
caster.OnSpellCast(m_Spell);
caster.Region?.OnSpellCast(caster, m_Spell);
caster.NextSpellTime =
Core.TickCount + (int)m_Spell.GetCastRecovery().TotalMilliseconds; // Spell.NextSpellDelay;
var originalTarget = m_Spell.Caster.Target;
caster.Delta(MobileDelta.Flags); // Update paralyze
var originalTarget = caster.Target;
m_Spell.OnCast();
if (m_Spell.Caster.Player && m_Spell.Caster.Target != originalTarget)
if (caster.Player && caster.Target != originalTarget)
{
m_Spell.Caster.Target?.BeginTimeout(m_Spell.Caster, 30000); // 30 seconds
caster.Target?.BeginTimeout(caster, 30000); // 30 seconds
}
m_Spell._castTimer = null;