47 lines
1.7 KiB
C#
47 lines
1.7 KiB
C#
using System.Collections.Generic;
|
|
using NUnit.Framework;
|
|
using pflib_net.characters;
|
|
using pflib_net.characters.internals.proficiencies;
|
|
using pflib_net.characters.internals.stats;
|
|
|
|
namespace pflib_net.Tests.characters;
|
|
|
|
[TestFixture]
|
|
[TestOf(typeof(PlayerCharacter))]
|
|
public class PlayerCharacterTest
|
|
{
|
|
|
|
[Test]
|
|
public void DamageReducesHp()
|
|
{
|
|
var stats = new Stats(0, 0, 0, 0, 0, 0);
|
|
var armorValues = new Dictionary<ProficiencyType, ProficiencyValue>
|
|
{
|
|
{ ProficiencyType.Unarmored, ProficiencyValue.Expert },
|
|
{ ProficiencyType.LightArmor, ProficiencyValue.None },
|
|
{ ProficiencyType.MediumArmor, ProficiencyValue.None },
|
|
{ ProficiencyType.HeavyArmor, ProficiencyValue.None }
|
|
};
|
|
var armorProficiency = new ArmorProficiency(armorValues);
|
|
var creature = new PlayerCharacter(50, stats, 5, armorProficiency);
|
|
creature.ResolveAttack(20, 20);
|
|
Assert.That(creature.GetHp(), Is.LessThan(50));
|
|
}
|
|
|
|
[Test]
|
|
public void AttackFailsOnMiss()
|
|
{
|
|
var stats = new Stats(0, 0, 0, 0, 0, 0);
|
|
var armorValues = new Dictionary<ProficiencyType, ProficiencyValue>
|
|
{
|
|
{ ProficiencyType.Unarmored, ProficiencyValue.Expert },
|
|
{ ProficiencyType.LightArmor, ProficiencyValue.None },
|
|
{ ProficiencyType.MediumArmor, ProficiencyValue.None },
|
|
{ ProficiencyType.HeavyArmor, ProficiencyValue.None }
|
|
};
|
|
var armorProficiency = new ArmorProficiency(armorValues);
|
|
var creature = new PlayerCharacter(50, stats, 5, armorProficiency);
|
|
creature.ResolveAttack(0, 50);
|
|
Assert.That(creature.GetHp(), Is.EqualTo(50));
|
|
}
|
|
} |