public PlayerTests() { System.Func <string, IGameAction> ok = (string m) => ActionOutcome.Success(m).AsAction(); var verbList = new List <IVerb <DummyEntity> >() { new ZeroTargetVerb <DummyEntity>((e) => ok($"entity#{e}.meditate()"), "meditate"), new SingleTargetVerb <DummyEntity>(DummyLookup, (e, t) => ok($"entity#{e}.contemplate(entity#{t})"), "contemplate"), new SingleTargetVerbWithTool <DummyEntity>(DummyLookup, (e, v, t) => ok($"entity#{e}.shave(entity#{v}, entity#{t})"), "shave"), }; verbSuite = new(verbList); }
public void CanCampInWilderness() { actor.Enter <Location>(wilderness); var action = new CampAction(actor); for (int i = 0; i < 10; i++) { Assert.AreEqual(ActionOutcome.Progress(), action.Execute(dryRun: false)); } Assert.IsFalse(wilderness.Get <Wilderness>().HasCampsite); Assert.AreEqual(ActionOutcome.Success(), action.Execute(dryRun: false)); Assert.IsTrue(wilderness.Get <Wilderness>().HasCampsite); }
public void TakeTest() { GameObject place = new GameObject(); GameObject prop = new GameObject(place); prop.AddTrait(new InventoryItem(weight: 1)); PhysicalActor actor = new PhysicalActor(new FakeBody(), place); Take take = new Take { Actor = actor, Target = prop }; ActionOutcome outcome = take.Attempt(); Assert.IsTrue(outcome.Success()); Assert.AreEqual(actor, prop.Location); }