Skip to content
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

Open
wants to merge 4 commits into
base: mainline
Choose a base branch
from

Conversation

k-electron
Copy link

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.

var taskInfos = __instance.Data.Tasks.ToArray();
var allTasksCount = taskInfos.Count;
var maxRevealsCount =
CustomGameOptions.ProphetTotalReveals < 1 ? 1 : CustomGameOptions.ProphetTotalReveals;
Copy link
Owner

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?

Copy link
Author

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;
Copy link
Owner

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.

Copy link
Author

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.

Copy link
Author

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);
Copy link
Owner

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?

Copy link
Author

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.

Copy link
Author

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.

@Anusien
Copy link
Owner

Anusien commented Mar 16, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants