-
-
Notifications
You must be signed in to change notification settings - Fork 126
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
Add optional win condition feature #34
Conversation
@@ -546,6 +546,7 @@ export default function applyActionResponse( | |||
} | |||
case 'BeginGame': | |||
case 'SecretDiscovered': | |||
case 'OptionalWin': |
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 will not actually apply the action properly! You need to move this case up to where case 'GameEnd':
is to make sure it calls applyGameOverActionResponse
.
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.
Ah I see. Just to make sure we're on the same page though, this is for the consumers of applyActionResponse()
, right? Would it be possible for that consumer to call applyGameOverActionResponse()
instead? Or maybe it's impossible to do so in some cases?
apollo/lib/getWinningTeam.tsx
Outdated
export default function getWinningTeam( | ||
map: MapData, | ||
actionResponse: GameEndActionResponse, | ||
actionResponse: GameEndActionResponse | OptionalWinActionResponse, | ||
): 'draw' | PlayerID { |
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.
Ah, this is funky since the function name/module name no longer makes sense now. Maybe we should rename this to getMatchingTeam
since it gives us the team matching the ActionResponse?
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 just my opinion, but I see processRewards()
is the sole consumer of this getWinningTeam()
function in the entire codebase, and it checks if the return value is 'draw'
(i.e., winningTeam !== 'draw'
).
It just occurred to me that it might be a little awkward to have matchingTeam !== 'draw'
? In the processRewards()
perspective, I think it makes more sense to call it winningTeam
indeed, since the winner takes the rewards?
Maybe we could wait until there are other use cases that calling getWinningTeam()
wouldn't make sense at all?
Or maybe we could bring getWinningTeam()
into processRewards.tsx
as a local function and worry about other use cases later?
Wow, this is a huge PR. Thank you for implementing it, this is really great work. I left a few inline comments, but I think we are pretty close on it. Here is some overall feedback:
|
Hey thanks for the thorough review! Let me work on your feedbacks and get back to you 🫡 |
One thing I missed earlier, we aren't verifying that the game can actually continue. It's currently implied, but not tested. Would you mind adding a test with an optional condition and a regular win condition and verifying that it's possible to first achieve the optional condition, then the win condition and the game ends? |
Yeah that makes a lot of sense. I'll see to that as well! |
Hey one problem here. So I was changing So I was looking at If what I'm suspecting is correct, then would you like to change the regex in |
This is addressed in 59c42ca |
Getting close!
🤦♂️ oh man, nice find. There are "Conditions" in Effects which will later be used for scripting in the editor, and they are encoded in the same way as actions. I think the best fix here is to change
Sorry, maybe I wasn't clear. I'd prefer to split required and optional conditions into two sections. The top one with required conditions should be unchanged, then it should say "Complete optional conditions for extra rewards." and list all the optional ones. |
fyi your work on this issue spawned another one that will really add depth to the game: #35 |
Hey thanks for additional feedbacks! I truly appreciate them 😁. Let me work on them and get back to you. By the way, they must have gone unnoticed while I was updating too many things at once, but I've actually left a couple of questions on inline review threads (ones that I haven't resolved above), so could you also take a look at them? 🥹
haha this is great! I'll take a look at that after this PR is polished and merged! |
done in 59d09ac
done in 96c073d I only used
done in d8de90f I think I'm the one who misunderstood the request haha sorry. Here's a new screenshot: |
Thanks for adding this feature. This is awesome work, and the funds were sent to you! |
Hopefully closes #17
Well I was not positive that I would be able to put together a PR for this feature, but thanks to @cpojer's comments in #17, here is my attempt 😁
One thing in particular I want to mention here though, is that I decided to handle
OptionalWin
inapplyGameOverActionResponse()
instead ofapplyActionResponse()
since it feels likeOptionalWinActionResponse
is very similar toGameEndActionResponse
(they have exact same fields except for the type, and they require the usage ofpickWinningPlayer()
andprocessRewards()
).Default win condition (no 'optional' checkbox)
'Optional' checkbox (unchecked)
'Optional' checkbox (checked)
Optional win banner
optional_win_1080p.mov
Optional win banner (secret)
optional_win_secret_1080p.mov
Optional win banner (secret + reward)
optional_win_secret_reward_1080p.mov