2.5 update
This commit is contained in:
@@ -2183,6 +2183,48 @@ namespace BumpCombat.Tests
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ModifierDefinition_ModelWrapperAppliesToCharacterModelAndHealsOnce()
|
||||
{
|
||||
GameObject owner = new("Modifier Model Wrapper Test");
|
||||
ModifierDefinition definition =
|
||||
ScriptableObject.CreateInstance<ModifierDefinition>();
|
||||
try
|
||||
{
|
||||
PlayerStats stats = owner.AddComponent<PlayerStats>();
|
||||
definition.Configure(
|
||||
"test.model-move-speed",
|
||||
"Move speed",
|
||||
CharacterStat.MoveSpeed,
|
||||
ModifierOperation.Flat,
|
||||
2f,
|
||||
1,
|
||||
7f);
|
||||
|
||||
int healCalls = 0;
|
||||
float healedAmount = 0f;
|
||||
System.Action<float> heal = amount =>
|
||||
{
|
||||
healCalls++;
|
||||
healedAmount += amount;
|
||||
};
|
||||
|
||||
Assert.That(definition.CanApplyToModel(stats), Is.True);
|
||||
Assert.That(definition.TryApplyToModel(stats, heal), Is.True);
|
||||
Assert.That(definition.CanApplyToModel(stats), Is.False);
|
||||
Assert.That(definition.TryApplyToModel(stats, heal), Is.False);
|
||||
Assert.That(healCalls, Is.EqualTo(1));
|
||||
Assert.That(healedAmount, Is.EqualTo(7f));
|
||||
Assert.That(stats.Evaluate(CharacterStat.MoveSpeed, 10f),
|
||||
Is.EqualTo(12f));
|
||||
}
|
||||
finally
|
||||
{
|
||||
Object.DestroyImmediate(definition);
|
||||
Object.DestroyImmediate(owner);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void FormalPlayerPrefab_UsesSixItemCatalogAndThreeColorOwnershipCap()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user