Implemented research cost, tweaked some values.
This commit is contained in:
@@ -16,6 +16,7 @@ public partial class TestRunner : Node
|
||||
Run("Robot research effects change robot stats", TestRobotResearchEffects);
|
||||
Run("Research completion applies effects once", TestResearchCompletionAppliesEffectsOnce);
|
||||
Run("Research execution pays resources and finishes", TestResearchExecutionPaysResourcesAndFinishes);
|
||||
Run("Research cannot start without resources", TestResearchCannotStartWithoutResources);
|
||||
Run("Inventory add failure keeps inventory unchanged", TestInventoryAddFailureKeepsInventoryUnchanged);
|
||||
Run("Resource extraction and save data roundtrip", TestResourceSaveRoundtrip);
|
||||
Run("Robot save data roundtrip keeps robot state", TestRobotSaveRoundtrip);
|
||||
@@ -238,6 +239,29 @@ public partial class TestRunner : Node
|
||||
AssertEqual(0, GameData.inventory.items.Count, "failed add should not create stacks");
|
||||
}
|
||||
|
||||
private void TestResearchCannotStartWithoutResources()
|
||||
{
|
||||
ResearchData researchData = new ResearchData
|
||||
{
|
||||
Id = "missing_stones",
|
||||
Inputs = new List<Ingredient>
|
||||
{
|
||||
new Ingredient { Item = "stone", Amount = 3 }
|
||||
},
|
||||
Research = "basics",
|
||||
CraftTime = 1.0,
|
||||
Texture = "",
|
||||
Effects = new List<ResearchEffect>()
|
||||
};
|
||||
|
||||
Research research = new Research(researchData);
|
||||
ResearchResult result = research.Execute(1.0);
|
||||
|
||||
AssertFalse(research.CanStart(), "research should not be startable");
|
||||
AssertEqual(ResearchResult.FAILED, result, "research should fail without resources");
|
||||
AssertEqual(ResearchState.UNDEFINED, research.state, "research state should stay unchanged");
|
||||
}
|
||||
|
||||
private void TestSplitSaveFilesRoundtrip()
|
||||
{
|
||||
GameData.inventory.AddItem(new Item { data = GameData.availableItems["water"] }, 7);
|
||||
|
||||
Reference in New Issue
Block a user