public bool RequirementsMet(IActor forActor) { //if it requires equipping if (Slot != null && !IsEquipped) { return(false); } //it has unique conditions that are not met yet return(Require.All(r => r.IsMet(forActor.CurrentLocation.World, GetSystemArgs(forActor)))); }
public bool CanUse(IActor actor, out string reason) { if (IsErased) { reason = "Item no longer exists"; return(false); } if (!Require.All(c => c.IsMet(actor.CurrentLocation.World, GetSystemArgs(actor)))) { reason = "Item requirements not met:" + string.Join(Environment.NewLine, Require.Select(r => r.ToString())); return(false); } reason = null; return(true); }
public void All_WhenEmpty_DoesNotThrow() { Require.All(Enumerable.Empty <int>(), v => v > 1, "message", "name"); }
public void All_WhenContainsElementThatDoesNotMatchPredicate_ThrowsArgumentException() { Assert.Throws <ArgumentException>(() => Require.All(new[] { 1, 5 }, v => v > 1, "message", "name")); }
public void All_WhenNull_ThrowsArgumentNullException() { Assert.Throws <ArgumentNullException>(() => Require.All((int[])null, v => v > 1, "message", "name")); }
public void All_WhenAllElementsMatchesPredicate_DoesNotThrow() { Require.All(new[] { 2, 3 }, v => v > 1, "message", "name"); }