Skip to content

Commit 5897716

Browse files
committed
Fix issue with Delay system. Fix some cases where bound buff's dummy cast could fail.
1 parent e1655e5 commit 5897716

3 files changed

Lines changed: 14 additions & 11 deletions

File tree

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project>
22
<PropertyGroup>
3-
<Version>3.3.0-rc3</Version>
3+
<Version>3.3.0-rc4</Version>
44
<UsePackageReferences>false</UsePackageReferences>
55
<PackageLicenseFile>LICENSE</PackageLicenseFile>
66
<PackageProjectUrl>https://github.com/Orden4/WCSharp</PackageProjectUrl>

WCSharp.Buffs/BoundBuff.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System.Linq;
22
using WCSharp.Api;
33
using WCSharp.Dummies;
4+
using WCSharp.Timers;
45
using static WCSharp.Api.Common;
56

67
namespace WCSharp.Buffs
@@ -51,15 +52,14 @@ public BoundBuff(unit caster, unit target) : base(caster, target)
5152
public void BindDummyCast(int abilityId, int buffId, int orderId, int level = 1, player dummyPlayer = null)
5253
{
5354
dummyPlayer ??= Player(PLAYER_NEUTRAL_PASSIVE);
54-
var dummy = DummySystem.GetDummy();
55-
SetUnitOwner(dummy, dummyPlayer, false);
55+
var dummy = DummySystem.GetDummy(GetUnitX(Target), GetUnitY(Target), dummyPlayer);
5656
UnitAddAbility(dummy, abilityId);
5757
if (level > 1)
5858
{
5959
SetUnitAbilityLevel(dummy, abilityId, level);
6060
}
6161
IssueTargetOrderById(dummy, orderId, Target);
62-
DummySystem.RecycleDummy(dummy);
62+
DummySystem.RecycleDummy(dummy, TimerSystem.DEFAULT_TICK_INTERVAL);
6363

6464
BuffId = buffId;
6565
}

WCSharp.Shared/Delay.cs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.Generic;
33
using WCSharp.Api;
4+
using WCSharp.Shared.Extensions;
45
using static WCSharp.Api.Common;
56

67
namespace WCSharp.Shared
@@ -34,32 +35,34 @@ public static void Add(Action func)
3435
{
3536
TimerStart(timer, 0.0f, false, execute);
3637
}
37-
funcs.Add(func);
38+
funcs.DirectAdd(func);
3839
}
3940

4041
private static void ExecuteAll()
4142
{
42-
for (var i = 0; i < funcs.Count; i++)
43+
var size = funcs.Count;
44+
for (var i = 1; i <= size; i++)
4345
{
44-
funcs[i]();
46+
funcs.DirectGet(i)();
4547
}
46-
funcs.Clear();
48+
funcs.RemoveRange(0, size);
4749
}
4850

4951
private static void ExecuteAllDebug()
5052
{
53+
var size = funcs.Count;
5154
try
5255
{
53-
for (var i = 0; i < funcs.Count; i++)
56+
for (var i = 1; i <= size; i++)
5457
{
55-
funcs[i]();
58+
funcs.DirectGet(i)();
5659
}
5760
}
5861
catch (Exception ex)
5962
{
6063
Console.WriteLine(ex);
6164
}
62-
funcs.Clear();
65+
funcs.RemoveRange(0, size);
6366
}
6467
}
6568
}

0 commit comments

Comments
 (0)