55 lines
2.5 KiB
C#
55 lines
2.5 KiB
C#
|
|
namespace NeonSprawl.Server.Tests.Game.Npc;
|
|
|
|
public class NpcBehaviorDefinitionsWorldApiTests
|
|
{
|
|
/// <summary>Frozen prototype three in registry id order (ordinal). Keep in sync with Bruno.</summary>
|
|
public static readonly string[] FrozenThreeInIdOrder =
|
|
[
|
|
PrototypeNpcBehaviorRegistry.PrototypeEliteMiniBoss,
|
|
PrototypeNpcBehaviorRegistry.PrototypeMeleePressure,
|
|
PrototypeNpcBehaviorRegistry.PrototypeRangedControl,
|
|
];
|
|
|
|
[Fact]
|
|
public async Task GetNpcBehaviorDefinitions_ShouldReturnSchemaV1_WithFrozenThreeInIdOrder()
|
|
{
|
|
// Arrange
|
|
await using var factory = new InMemoryWebApplicationFactory();
|
|
var client = factory.CreateClient();
|
|
// Act
|
|
var response = await client.GetAsync("/game/world/npc-behavior-definitions");
|
|
// Assert
|
|
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
|
var body = await response.Content.ReadFromJsonAsync<NpcBehaviorDefinitionsListResponse>();
|
|
Assert.NotNull(body);
|
|
Assert.Equal(NpcBehaviorDefinitionsListResponse.CurrentSchemaVersion, body!.SchemaVersion);
|
|
Assert.NotNull(body.NpcBehaviors);
|
|
Assert.Equal(3, body.NpcBehaviors.Count);
|
|
var ids = body.NpcBehaviors.Select(static b => b.Id).ToList();
|
|
Assert.Equal(FrozenThreeInIdOrder, ids);
|
|
|
|
var melee = body.NpcBehaviors.Single(b => b.Id == PrototypeNpcBehaviorRegistry.PrototypeMeleePressure);
|
|
Assert.Equal("Melee Pressure", melee.DisplayName);
|
|
Assert.Equal("melee_pressure", melee.ArchetypeKind);
|
|
Assert.Equal(100, melee.MaxHp);
|
|
Assert.Equal(8.0, melee.AggroRadius);
|
|
Assert.Equal(16.0, melee.LeashRadius);
|
|
Assert.Equal(1.5, melee.TelegraphWindupSeconds);
|
|
Assert.Equal(15, melee.AttackDamage);
|
|
Assert.Equal(3.0, melee.AttackCooldownSeconds);
|
|
Assert.Equal("prototype_npc_melee_strike", melee.AttackAbilityId);
|
|
|
|
var elite = body.NpcBehaviors.Single(b => b.Id == PrototypeNpcBehaviorRegistry.PrototypeEliteMiniBoss);
|
|
Assert.Equal("Elite Mini-Boss", elite.DisplayName);
|
|
Assert.Equal("elite_mini_boss", elite.ArchetypeKind);
|
|
Assert.Equal(200, elite.MaxHp);
|
|
Assert.Equal(8.0, elite.AggroRadius);
|
|
Assert.Equal(18.0, elite.LeashRadius);
|
|
Assert.Equal(2.5, elite.TelegraphWindupSeconds);
|
|
Assert.Equal(25, elite.AttackDamage);
|
|
Assert.Equal(5.0, elite.AttackCooldownSeconds);
|
|
Assert.Equal("prototype_npc_elite_slam", elite.AttackAbilityId);
|
|
}
|
|
}
|