Initial commit: Theriapolis baseline at port/godot branch point
Captures the pre-Godot-port state of the codebase. This is the rollback anchor for the Godot port (M0 of theriapolis-rpg-implementation-plan-godot-port.md). All Phase 0 through Phase 6.5 work is included; Phase 7 is in flight. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
using Theriapolis.Core.Data;
|
||||
using Theriapolis.Core.Entities;
|
||||
using Theriapolis.Core.Rules.Character;
|
||||
using Theriapolis.Core.Rules.Stats;
|
||||
using Theriapolis.Core.Util;
|
||||
using Xunit;
|
||||
|
||||
namespace Theriapolis.Tests.Entities;
|
||||
|
||||
public sealed class ActorCharacterTests
|
||||
{
|
||||
private readonly ContentResolver _content = new(new ContentLoader(TestHelpers.DataDirectory));
|
||||
|
||||
[Fact]
|
||||
public void SpawnPlayer_WithCharacter_AttachesIt()
|
||||
{
|
||||
var mgr = new ActorManager();
|
||||
var character = MakeCharacter();
|
||||
var p = mgr.SpawnPlayer(new Vec2(100, 200), character);
|
||||
Assert.NotNull(p.Character);
|
||||
Assert.Equal("Wolf-Folk", p.Character!.Species.Name);
|
||||
Assert.Equal(Allegiance.Player, p.Allegiance);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SpawnPlayer_NoCharacter_LeavesItNull()
|
||||
{
|
||||
var mgr = new ActorManager();
|
||||
var p = mgr.SpawnPlayer(new Vec2(100, 200));
|
||||
Assert.Null(p.Character);
|
||||
Assert.True(p.IsAlive); // null-character actors are considered alive
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Actor_IsAlive_ReflectsCharacterHp()
|
||||
{
|
||||
var mgr = new ActorManager();
|
||||
var character = MakeCharacter();
|
||||
var p = mgr.SpawnPlayer(new Vec2(0, 0), character);
|
||||
Assert.True(p.IsAlive);
|
||||
character.CurrentHp = 0;
|
||||
Assert.False(p.IsAlive);
|
||||
character.Conditions.Add(Condition.Unconscious);
|
||||
Assert.True(p.IsAlive); // unconscious counts as alive (death-save loop)
|
||||
}
|
||||
|
||||
private Character MakeCharacter()
|
||||
{
|
||||
return new CharacterBuilder
|
||||
{
|
||||
Clade = _content.Clades["canidae"],
|
||||
Species = _content.Species["wolf"],
|
||||
ClassDef = _content.Classes["fangsworn"],
|
||||
Background = _content.Backgrounds["pack_raised"],
|
||||
BaseAbilities = new AbilityScores(15, 14, 13, 12, 10, 8),
|
||||
Name = "Test",
|
||||
}
|
||||
.ChooseSkill(SkillId.Athletics)
|
||||
.ChooseSkill(SkillId.Intimidation)
|
||||
.Build();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user