Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Timer Remaining Count off by 1 fix #2046

Merged
merged 1 commit into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
}

if (LeveledExplosion)
{

Check warning on line 170 in Projects/UOContent/Items/Skill Items/Magical/Potions/Explosion Potions/BaseExplosionPotion.cs

View workflow job for this annotation

GitHub Actions / Qodana for .NET

Heuristically unreachable code

Code is heuristically unreachable
foreach (var item in map.GetItemsInRange<BaseExplosionPotion>(loc, ExplosionRange))
{
if (item != this)
Expand Down Expand Up @@ -247,7 +247,7 @@
loc = m.Location;
}
else
{

Check warning on line 250 in Projects/UOContent/Items/Skill Items/Magical/Potions/Explosion Potions/BaseExplosionPotion.cs

View workflow job for this annotation

GitHub Actions / Qodana for .NET

Heuristically unreachable code

Code is heuristically unreachable
to = m;
}
}
Expand Down Expand Up @@ -295,7 +295,13 @@

var parent = _potion.FindParent(_from);

if (RemainingCount == 0)
if (RemainingCount > 3)
{
return;
}

// Remaining decrements after OnTick so it is off by 1
if (RemainingCount <= 1)
{
Point3D loc;
Map map;
Expand All @@ -317,16 +323,13 @@

_potion.Explode(_from, true, loc, map);
}
else if (RemainingCount <= 3)
else if (parent is Item item)
{
if (parent is Item item)
{
item.PublicOverheadMessage(MessageType.Regular, 0x22, false, RemainingCount.ToString());
}
else if (parent is Mobile mobile)
{
mobile.PublicOverheadMessage(MessageType.Regular, 0x22, false, RemainingCount.ToString());
}
item.PublicOverheadMessage(MessageType.Regular, 0x22, false, RemainingCount.ToString());
}
else if (parent is Mobile mobile)
{
mobile.PublicOverheadMessage(MessageType.Regular, 0x22, false, RemainingCount.ToString());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,15 @@ int count

protected override void OnTick()
{
var delay = RemainingCount == 0
var delay = RemainingCount <= 1
? TimeSpan.MinValue
: Utility.RandomMinMax(_ability.MinDelay, _ability.MaxDelay);

_ability.EffectTick(_source, _defender, ref delay);
Interval = delay;

if (RemainingCount == 0)
// Remaining decrements after OnTick so it is off by 1
if (RemainingCount <= 1)
{
_ability.RemoveEffect(_source, _defender);
_ability.OnEffectExpired(_source, _defender);
Expand Down
Loading