-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prophet now needs to complete tasks to earn revelations - Fixes #190 #206
base: mainline
Are you sure you want to change the base?
Conversation
var taskInfos = __instance.Data.Tasks.ToArray(); | ||
var allTasksCount = taskInfos.Count; | ||
var maxRevealsCount = | ||
CustomGameOptions.ProphetTotalReveals < 1 ? 1 : CustomGameOptions.ProphetTotalReveals; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't ProphetTotalReveals
bounded to be a minimum of 1?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
being too defensive. rewritten to remove divison eliminating both risk of float imprecision and divide-by-zero.
var allTasksCount = taskInfos.Count; | ||
var maxRevealsCount = | ||
CustomGameOptions.ProphetTotalReveals < 1 ? 1 : CustomGameOptions.ProphetTotalReveals; | ||
var currentRevealsCount = Role.GetRole<Prophet>(PlayerControl.LocalPlayer).Revealed.Count; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is using PlayerControl.LocalPlayer
but the method takes in a PlayerControl __instance
object. Not sure which is intended.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I modelled it after CompleteTask.cs
from the Snitch, where it seems like both patterns are used. I think they both work, but not sure what the implications are. I tried a bunch of different multi-client setups to test and didn't run into any problems as coded.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also just removed the __instance
and it still works. It seems like both PlayerControl.LocalPlayer
and __instance
are really the same thing.
var timeSpan = now - role.LastRevealed; | ||
var cooldown = CustomGameOptions.ProphetCooldown * 1000f; | ||
var requiredTasksForNextReveal = (currentRevealsCount + 1) | ||
* ((float) allTasksCount / maxRevealsCount); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this handling things as float
? So if we have 8 tasks and 3 reveals, it will trigger at 3, 6 and 8?
Is there a possibility of floating point imprecision accidentally denying someone the last reveal?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wouldn't really happen at the scale of these numbers, but, rewritten to remove divison eliminating both risk of float imprecision and divide-by-zero.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So if we have 8 tasks and 3 reveals, it will trigger at 3, 6 and 8?
that is correct.
…ion and divide-by-zero errors.
Looks good to me and it held up to some simple testing. Would like to try it out some night with more people before releasing to the general public. |
You only get as many revelations as tasks. The prophet is a strong role as it is and having more revelations than tasks is potentially too strong. Revelations are doled out as (tasks / reveals) number of tasks (rounded up) are completed.