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

ISSUE-919: Add a decadent draft game mode #990

Merged
merged 37 commits into from
May 13, 2020

Conversation

keeler
Copy link
Contributor

@keeler keeler commented Apr 25, 2020

Summary

Fix #919

Adds a "Decadent" game mode to address the request in #919. As described in that issue, it's also known as "Rich Man's Draft" or "Decadent Sealed".

This is essentially a draft where each person picks only one card from a pack, discards the rest, and opens a new pack until all packs have been drafted. As such, it's implemented as a draft where if you would pass, a new round is started instead.

image

Details

  • Only works with the "Draft" game type.
  • Can choose as low as 36 or as high as 60 packs to draft from.
  • All packs must be from the same set.
    • Implemented this way because editing 36+ set selection dropdowns manually is tedious.
  • Refactored frontend/src/utils.jsx to split out common components into the frontend/src/components/ directory.
    • Extracted these components: Checkbox, Spaced, Select, TextArea.
    • Fixed in TextArea.jsx App.save("list", ...) --> App.save(link, ...)
    • Changed utils.jsx --> utils.js
  • Added frontend/test/ for tests of toTitleCase() in utils.js.
  • Created SetReplicated component which is like the Set component except it fills the entire set array with the same set instead of handling one index of the array.
    • Open to suggestions for a better name for this component.
    • Factored out SetChoices which is reused in Set and SetReplicated.

@HerveH44 HerveH44 temporarily deployed to beta-dr4ft-issue-919-de-rnrqrn April 25, 2020 20:37 Inactive
@HerveH44 HerveH44 temporarily deployed to beta-dr4ft-issue-919-de-rnrqrn April 26, 2020 02:17 Inactive
@ZeldaZach
Copy link
Member

Tried on the beta build, but it kept crashing

@keeler
Copy link
Contributor Author

keeler commented Apr 26, 2020

Tried on the beta build, but it kept crashing

Thanks for giving it a shot! Can you share what settings you used? Is there any way to get the logs? There don't seem to be any integration/UI tests and I'm not totally sure what the best way to manually test is.

@ZeldaZach
Copy link
Member

I tested Decadent mode, 36 packs for both Ikoria and Theros Returned, but they both crashed when I tried to start the game. Unfortunately, I don't have a way to grab those logs from the service. Did it work when you ran it locally under the same conditions?

@keeler
Copy link
Contributor Author

keeler commented Apr 26, 2020

Worked for me with Guilds of Ravnica. But I realize just now that I had # players set to 1. Once I adjusted to 8 it crashed!

Looking into it, and converting this to a draft PR.

Thanks for your patience!

@keeler keeler marked this pull request as draft April 26, 2020 02:45
@HerveH44 HerveH44 temporarily deployed to beta-dr4ft-issue-919-de-rnrqrn April 26, 2020 04:43 Inactive
@tooomm
Copy link
Contributor

tooomm commented Apr 26, 2020

Worked for IKO and THB for me. Tried 36 and 60 packs. 8 player.

  • We should dispaly "x times set", e.g. 40x IKO instead saying IKO / IKO / ... 40 times in this mode. :)

info

  • I like the name Rich Man's Draft more, that name seems to be used more frequently as well

  • Played around with the deployment on heroku and ended up with the new game option showing for sealed at one point as well:

decadent-sealed
I could not open a room however.

@HerveH44 HerveH44 had a problem deploying to beta-dr4ft-issue-919-de-rnrqrn April 26, 2020 19:31 Failure
@HerveH44 HerveH44 temporarily deployed to beta-dr4ft-issue-919-de-rnrqrn April 26, 2020 20:00 Inactive
@HerveH44 HerveH44 temporarily deployed to beta-dr4ft-issue-919-de-rnrqrn April 26, 2020 20:35 Inactive
backend/game.js Outdated Show resolved Hide resolved
@HerveH44 HerveH44 temporarily deployed to beta-dr4ft-issue-919-de-rnrqrn May 2, 2020 06:27 Inactive
@HerveH44 HerveH44 temporarily deployed to beta-dr4ft-issue-919-de-rnrqrn May 2, 2020 07:52 Inactive
@tooomm
Copy link
Contributor

tooomm commented May 4, 2020

@keeler

Any errors in the console or anything?

I'm on Windows 10. From Firefox web console:


Error: "Minified React error #152; visit https://reactjs.org/docs/error-decoder.html?invariant=152&args[]=Q for the full message or use the non-minified dev environment for full errors and additional helpful warnings."
    Ti https://beta-dr4ft-issue-919-de-rnrqrn.herokuapp.com/vendors~app~7d359b94-5deb42b5b127fad78a0a.js:14
    Oo https://beta-dr4ft-issue-919-de-rnrqrn.herokuapp.com/vendors~app~7d359b94-5deb42b5b127fad78a0a.js:14
    va https://beta-dr4ft-issue-919-de-rnrqrn.herokuapp.com/vendors~app~7d359b94-5deb42b5b127fad78a0a.js:14
    cu https://beta-dr4ft-issue-919-de-rnrqrn.herokuapp.com/vendors~app~7d359b94-5deb42b5b127fad78a0a.js:14
    au https://beta-dr4ft-issue-919-de-rnrqrn.herokuapp.com/vendors~app~7d359b94-5deb42b5b127fad78a0a.js:14
    Za https://beta-dr4ft-issue-919-de-rnrqrn.herokuapp.com/vendors~app~7d359b94-5deb42b5b127fad78a0a.js:14
    Hl https://beta-dr4ft-issue-919-de-rnrqrn.herokuapp.com/vendors~app~7d359b94-5deb42b5b127fad78a0a.js:14
    unstable_runWithPriority https://beta-dr4ft-issue-919-de-rnrqrn.herokuapp.com/vendors~app~7d359b94-5deb42b5b127fad78a0a.js:30
    Bl https://beta-dr4ft-issue-919-de-rnrqrn.herokuapp.com/vendors~app~7d359b94-5deb42b5b127fad78a0a.js:14
    Hl https://beta-dr4ft-issue-919-de-rnrqrn.herokuapp.com/vendors~app~7d359b94-5deb42b5b127fad78a0a.js:14
    A https://beta-dr4ft-issue-919-de-rnrqrn.herokuapp.com/vendors~app~7d359b94-5deb42b5b127fad78a0a.js:30
    onmessage https://beta-dr4ft-issue-919-de-rnrqrn.herokuapp.com/vendors~app~7d359b94-5deb42b5b127fad78a0a.js:30
vendors~app~7d359b94-5deb42b5b127fad78a0a.js:14:82483
    ea https://beta-dr4ft-issue-919-de-rnrqrn.herokuapp.com/vendors~app~7d359b94-5deb42b5b127fad78a0a.js:14
    callback https://beta-dr4ft-issue-919-de-rnrqrn.herokuapp.com/vendors~app~7d359b94-5deb42b5b127fad78a0a.js:14
    fi https://beta-dr4ft-issue-919-de-rnrqrn.herokuapp.com/vendors~app~7d359b94-5deb42b5b127fad78a0a.js:14
    ia https://beta-dr4ft-issue-919-de-rnrqrn.herokuapp.com/vendors~app~7d359b94-5deb42b5b127fad78a0a.js:14
    pu https://beta-dr4ft-issue-919-de-rnrqrn.herokuapp.com/vendors~app~7d359b94-5deb42b5b127fad78a0a.js:14
    unstable_runWithPriority https://beta-dr4ft-issue-919-de-rnrqrn.herokuapp.com/vendors~app~7d359b94-5deb42b5b127fad78a0a.js:30
    Bl https://beta-dr4ft-issue-919-de-rnrqrn.herokuapp.com/vendors~app~7d359b94-5deb42b5b127fad78a0a.js:14
    du https://beta-dr4ft-issue-919-de-rnrqrn.herokuapp.com/vendors~app~7d359b94-5deb42b5b127fad78a0a.js:14
    Za https://beta-dr4ft-issue-919-de-rnrqrn.herokuapp.com/vendors~app~7d359b94-5deb42b5b127fad78a0a.js:14
    Hl https://beta-dr4ft-issue-919-de-rnrqrn.herokuapp.com/vendors~app~7d359b94-5deb42b5b127fad78a0a.js:14
    unstable_runWithPriority https://beta-dr4ft-issue-919-de-rnrqrn.herokuapp.com/vendors~app~7d359b94-5deb42b5b127fad78a0a.js:30
    Bl https://beta-dr4ft-issue-919-de-rnrqrn.herokuapp.com/vendors~app~7d359b94-5deb42b5b127fad78a0a.js:14
    Hl https://beta-dr4ft-issue-919-de-rnrqrn.herokuapp.com/vendors~app~7d359b94-5deb42b5b127fad78a0a.js:14
    A https://beta-dr4ft-issue-919-de-rnrqrn.herokuapp.com/vendors~app~7d359b94-5deb42b5b127fad78a0a.js:30
    onmessage https://beta-dr4ft-issue-919-de-rnrqrn.herokuapp.com/vendors~app~7d359b94-5deb42b5b127fad78a0a.js:30
Error: Minified React error #152; visit https://reactjs.org/docs/error-decoder.html?invariant=152&args[]=Q for the full message or use the non-minified dev environment for full errors and additional helpful warnings. vendors~app~7d359b94-5deb42b5b127fad78a0a.js:14:56527

From the Firefox browser console:

NS_ERROR_FAILURE: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIInterfaceRequestor.getInterface] network-response-listener.js:84

Something else I can check?


Edit: It's something specific to this PR, as the deplyoment for #1020 works just fine in my FF75.0 (64bit) on Win10 64bit.

@tooomm
Copy link
Contributor

tooomm commented May 4, 2020

Decadent draft is not a subtype of draft, but a type of draft, so you should really have

( ) Sealed ( ) Draft ( ) Decadent.

Interesting! I think you may be right. What do others think?

@serokellcao @keeler

I think one can easily argument either way.
When you speak about limited, there is only draft and sealed. With several ways of playing each (aka how you end up with the cards for your "limited pool" to build a deck).

For my understanding draft and sealed is a first simple differentiations whether you pick your cards all for yourself (=build your pool) or you are handed a ready-to-go pool.

I tend to say Decadent is a subtype, but in the end it's the way you put or name it.
As long as there is a consistent pattern to it - and people understand the concept - it's ok. But we should keep in mind that many players never heard of the more exotic types of playing and may only know "regular draft" and "regular sealed".
That's why I argue to keep draft and sealed as single top options as guidance.
Draft --> Regular Draft, Chaos Draft, Cube Draft, Decadent Draft, Rochester Draft, Glimpse Draft, ...
Sealed --> Regular Sealed, Chaos Sealed, Cube Sealed, ...
There are even some we haven't considered so far like 2HG Draft or Team Draft. Or your mentioned Grid Draft etc.
If we make all variations/types/subtypes of drafts an individual "top level choice" it will get a bit messy I guess, and sealed will be perished.

Note: Currently, a "Decadent Sealed" (sometimes offered even at GP level as side event!) is also not possible. If one would call the game mode where every player start with a complete booster box (36 booster) as such.


It's trivial to demonstrate that people might want to play modes "cube decadent" or "chaos decadent".

Elaborating your idea even further, the result might be an additional "layer" and could look something like this:

Game Type Draft Sealed
Card Pool Type (=Booster Content) Regular Chaos Cube ...
Picking Type (specific to draft game type) Regular Decadent Glimpse ...
more? other?

Decadent, Glimpse, Rochester etc. are just picking variations for the limited game mode "draft". For either of those the underlying card pool could be one of several options, too.
That should keep flexibility and the UI somehow clean.

IMO we should keep this discussion out of this PR, finish the feature and find the best UI solution to approach further game modes in an issue ticket.
I will create one and link you once this is done.

@ZeldaZach
Copy link
Member

I like tom's idea of a 3rd category, although it might add some excessive button clicks to the program. I think it's fine as-is as a separate option that appears when draft is selected. Lets roll w/ it, and if there are issues in the future, we can reevaluate this.

@HerveH44 HerveH44 temporarily deployed to beta-dr4ft-issue-919-de-rnrqrn May 5, 2020 01:25 Inactive
@keeler
Copy link
Contributor Author

keeler commented May 5, 2020

@tooomm Thanks for your input on the Game Type + Pool Type + Picking Type. Agree that discussion should be moved out of this PR and into an issue.

Thanks also for the details about the error you're seeing. I have a hunch that this will fix it. a182b91

Explanation of my hunch:
Following the error link from the logs you shared indicates that the error is happening because nothing is returned from render. The error started appearing for you after I refactored GameOptions.tsx to add the game mode descriptions. Since state is preserved, my hunch is that the state you were in when you last loaded the site you had mode "decadent sealed" selected which now won't load because the switch/case in GameOptions was returning nothing in that case. I have updated that switch/case to default to null which will display nothing. You were the one who IIRC originally gave the feedback about hiding the Sealed + Decadent option so I think this is likely. 🤞

If this does not work then this will require more digging. Unfortunately I don't have access to a Windows 10 machine, so I'd rely on your help here. Perhaps using git bisect to narrow down the specific commit where this breaks for you would be a good start. Open to other ideas/suggestions.

serokellcao added a commit to serokellcao/dr4ft that referenced this pull request May 5, 2020
Solution:

 1. Implement glimpse draft as a superset of regular draft
   a. human.js
      - Make autopick into a list of picks to make
      - Do pick after pick, removing elements from this list
      - On new cycle of picks, restore autopick list to initial value
      - On itmeout, go through the list and for each `null`, make a random pick
      - Make pick function declarative so that it's easy to understand what's
        going on
    b. game.js
      - Implement a new pack action called "keep", it does the same thing
        "pass" does, except it doesn't actually pass the pack.
      - Have
    c. bot.js
      - Make it comply with the new semantics
    d. frontend/* and util.js
      - Make necessary changes for the game to recognize this new mode
 2. Make draft functionality, such as `pick` function family polymorphic.
    This turned out to not be needed for this PR (even though I was using this
    actively during development[1]), but it's something that was considered in
    a sister-PR[2] and I preserved in this PR.
   a. human.js
      - Use static methods per necessity (so that Human instances can be
        parametrized by Human functions from Game class at construction time)
   b. game.js
      - Add mk_draft_fns function that can later be used in order to have more
        esoteric pick functions in a decoupled way (for instance, we can
        implement Grid draft like that by just implementing JSX and two
        functions in human.js!)

Automated testing was performed and no regressions were detected.

No new tests were written since this PR only slightly extends the old
functionality and no regressions is a good indicator of correctness in this
case.

Thorough manual testing was performed.

To understand the process of development better, one can consult development
branch, which shall NOT be deleted, because relics of programming should be
preserved for insights into design decisions and approaches that didn't
work.[1]

---
[1]: https://github.com/serokellcao/dr4ft/commits/glimpse-draft-relic
[2]: dr4fters#990 (comment)
serokellcao added a commit to serokellcao/dr4ft that referenced this pull request May 5, 2020
Solution:

 1. Implement glimpse draft as a superset of regular draft
   a. human.js
      - Make autopick into a list of picks to make
      - Do pick after pick, removing elements from this list
      - On new cycle of picks, restore autopick list to initial value
      - On itmeout, go through the list and for each `null`, make a random pick
      - Make pick function declarative so that it's easy to understand what's
        going on
    b. game.js
      - Implement a new pack action called "keep", it does the same thing
        "pass" does, except it doesn't actually pass the pack.
      - Have
    c. bot.js
      - Make it comply with the new semantics
    d. frontend/* and util.js
      - Make necessary changes for the game to recognize this new mode
 2. Make draft functionality, such as `pick` function family polymorphic.
    This turned out to not be needed for this PR (even though I was using this
    actively during development[1]), but it's something that was considered in
    a sister-PR[2] and I preserved in this PR.
   a. human.js
      - Use static methods per necessity (so that Human instances can be
        parametrized by Human functions from Game class at construction time)
   b. game.js
      - Add mk_draft_fns function that can later be used in order to have more
        esoteric pick functions in a decoupled way (for instance, we can
        implement Grid draft like that by just implementing JSX and two
        functions in human.js!)

Automated testing was performed and no regressions were detected.

No new tests were written since this PR only slightly extends the old
functionality and no regressions is a good indicator of correctness in this
case.

Thorough manual testing was performed.

To understand the process of development better, one can consult development
branch, which shall NOT be deleted, because relics of programming should be
preserved for insights into design decisions and approaches that didn't
work.[1]

---
[1]: https://github.com/serokellcao/dr4ft/commits/glimpse-draft-relic
[2]: dr4fters#990 (comment)
serokellcao added a commit to serokellcao/dr4ft that referenced this pull request May 5, 2020
Solution:

 1. Implement glimpse draft as a superset of regular draft
   a. human.js
      - Make autopick into a list of picks to make
      - Do pick after pick, removing elements from this list
      - On new cycle of picks, restore autopick list to initial value
      - On itmeout, go through the list and for each `null`, make a random pick
      - Make pick function declarative so that it's easy to understand what's
        going on
    b. game.js
      - Implement a new pack action called "keep", it does the same thing
        "pass" does, except it doesn't actually pass the pack.
      - Choose the correct static handlers (callbacks) for the format based on
        `mkDraftFns` switch.
    c. bot.js
      - Make it comply with the new semantics
    d. frontend/* and util.js
      - Make necessary changes for the game to recognize this new mode
 2. Make draft functionality, such as `pick` function family polymorphic.
    This turned out to not be needed for this PR (even though I was using this
    actively during development[1]), but it's something that was considered in
    a sister-PR[2] and I preserved in this PR.
   a. human.js
      - Use static methods per necessity (so that Human instances can be
        parametrized by Human functions from Game class at construction time)
   b. game.js
      - Add mk_draft_fns function that can later be used in order to have more
        esoteric pick functions in a decoupled way (for instance, we can
        implement Grid draft like that by just implementing JSX and two
        functions in human.js!)

Automated testing was performed and no regressions were detected.

No new tests were written since this PR only slightly extends the old
functionality and no regressions is a good indicator of correctness in this
case.

Thorough manual testing was performed.

To understand the process of development better, one can consult development
branch, which shall NOT be deleted, because relics of programming should be
preserved for insights into design decisions and approaches that didn't
work.[1]

---
[1]: https://github.com/serokellcao/dr4ft/commits/glimpse-draft-relic
[2]: dr4fters#990 (comment)
@tooomm
Copy link
Contributor

tooomm commented May 6, 2020

@keeler Awesome, that did the trick.
Your assumption was totally right. When I could access the page again it showed "Sealed" as selected, with no second option. Switching between sealed and draft and back showed "Sealed/Regular" selected then.

Copy link
Contributor

@tooomm tooomm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last check @HerveH44?

@tooomm tooomm requested a review from HerveH44 May 6, 2020 07:25
@HerveH44
Copy link
Contributor

HerveH44 commented May 6, 2020

Well I still see open my points on the delegate functions being in the game.join function. I don't know if @keeler looked at it or not. I would prefer to go back to implement it to the "pick" function of the player like it was before, because the delegate functions theorically should be pure functions, out in their own file so they can be testable. But this can be done in a refactor, now I guess it's time to move on and let the other PR merge this one.

@tooomm
Copy link
Contributor

tooomm commented May 6, 2020

@HerveH44 Maybe keeler wasn't sure because there was no further response in the related discussion in one of the reviews (#990 (review))?

@serokellcao
Copy link

serokellcao commented May 6, 2020 via email

@keeler
Copy link
Contributor Author

keeler commented May 13, 2020

Well I still see open my points on the delegate functions being in the game.join function. I don't know if @keeler looked at it or not.

@HerveH44 Are you referring to this thread? #990 (comment)

If that's the thread you mean, I did attempt to address this by adding delegate functions for regular and decadent draft picks, though it's arguably not ideal. I didn't feel comfortable just marking it resolved like some of your other feedback which was much more straightforward (e.g. use lodash functions).

If that's not the thread you're talking about I'm having trouble finding what thread you mean, this PR is getting a bit cluttered.

backend/game.js Show resolved Hide resolved
@HerveH44
Copy link
Contributor

Hi @keeler, sorry for the misunderstanding. The PR is really amazing and will help us integrating the new mods in the future. Thanks for your contribution.

@ZeldaZach ZeldaZach merged commit 68bcfa4 into dr4fters:master May 13, 2020
@keeler keeler deleted the ISSUE-919-decadent-draft branch May 31, 2022 02:53
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.

Feature Request: Rich Man's Draft
5 participants