feat: add actor behavior buffs
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System.Linq;
|
||||
using Xunit;
|
||||
using XWorld.Framework.ActorBehavior;
|
||||
|
||||
@@ -94,6 +95,26 @@ namespace XWorld.Framework.Tests.ActorBehavior
|
||||
|
||||
Assert.Contains(world.DrainEvents(), e => e.Kind == BehaviorEventKind.ProjectileMoved && e.Position.X > 0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Buff_TicksByIntervalRepeatCountAndExpires()
|
||||
{
|
||||
BehaviorWorld world = TestWorld.CreateServerWorld();
|
||||
|
||||
Assert.True(world.ApplyBuff(2, "fighter", "slow_01", 1));
|
||||
Assert.Equal(1, world.ActiveBuffCount(2));
|
||||
|
||||
world.Tick(1.0f);
|
||||
world.Tick(1.0f);
|
||||
world.Tick(1.0f);
|
||||
world.Tick(0.1f);
|
||||
var events = world.DrainEvents();
|
||||
|
||||
Assert.Contains(events, e => e.Kind == BehaviorEventKind.BuffAdded && e.TargetActorId == 2);
|
||||
Assert.Equal(3, events.Count(e => e.Kind == BehaviorEventKind.BuffTicked && e.TargetActorId == 2));
|
||||
Assert.Contains(events, e => e.Kind == BehaviorEventKind.BuffRemoved && e.TargetActorId == 2);
|
||||
Assert.Equal(0, world.ActiveBuffCount(2));
|
||||
}
|
||||
}
|
||||
|
||||
internal static class TestWorld
|
||||
|
||||
Reference in New Issue
Block a user