46 lines
1.7 KiB
C#
46 lines
1.7 KiB
C#
using System.Collections.Generic;
|
|
using NUnit.Framework;
|
|
using pflib_net.characters.internals.characters;
|
|
using pflib_net.characters.internals.characters.internals.proficiencies;
|
|
|
|
namespace pflib_net.characters.internals.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<ProficiencyTypes, ProficiencyValues>
|
|
{
|
|
{ ProficiencyTypes.Unarmored, ProficiencyValues.Expert },
|
|
{ ProficiencyTypes.LightArmor, ProficiencyValues.None },
|
|
{ ProficiencyTypes.MediumArmor, ProficiencyValues.None },
|
|
{ ProficiencyTypes.HeavyArmor, ProficiencyValues.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<ProficiencyTypes, ProficiencyValues>
|
|
{
|
|
{ ProficiencyTypes.Unarmored, ProficiencyValues.Expert },
|
|
{ ProficiencyTypes.LightArmor, ProficiencyValues.None },
|
|
{ ProficiencyTypes.MediumArmor, ProficiencyValues.None },
|
|
{ ProficiencyTypes.HeavyArmor, ProficiencyValues.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));
|
|
}
|
|
} |