Created
September 22, 2019 23:45
-
-
Save IntegerMan/e7b26371c0efc012e7d84851e2b18659 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private OneOf<WorkCompletedResult, ProgressMadeResult, SetbackResult> | |
GetWorkOnItemResult(CrewContext context, WorkItem item) | |
{ | |
var roll = context.GetRandomNumber(1, 20); | |
// Something went wrong. Likely a mistaken assumption or bad requirement | |
if (roll == 1) | |
{ | |
return new SetbackResult(Priority.High); | |
} | |
// We got a massive success or we've previously made significant progress | |
if (roll >= 20 - item.ProgressMade) | |
{ | |
return new WorkCompletedResult(item); | |
} | |
// Okay, not a great roll, let's call it a setback | |
if (roll < 3) | |
{ | |
return new SetbackResult(Priority.Normal); | |
} | |
// Just a bit of progress | |
return new ProgressMadeResult(item); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment