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

House Rule: Happy Ending #49

Closed
Lattyware opened this issue Dec 21, 2015 · 6 comments
Closed

House Rule: Happy Ending #49

Lattyware opened this issue Dec 21, 2015 · 6 comments
Assignees
Labels
client Issues that touch the client side of the game. enhancement A suggestion for a new feature or expansion of an existing feature. good-first-issue This issue would be a good one to pick if you want to contribute but are not sure where to start. Hacktoberfest This would be a good issue to pick up for Hacktoberfest. help-wanted An issue where outside help would be particularly useful or necessary. server Issues that touch the server side of the game.
Milestone

Comments

@Lattyware
Copy link
Owner

Lattyware commented Dec 21, 2015

Add a new house rule that can be enabled from the house rules during game setup:

When the game ends, the final round is a 'Make a Haiku' black card.

This task is marked as a good first issue. If you would like to contribute but are unsure where to start, please take a look at the wiki for how to set up a development environment, and feel free to ask if you are still not sure.

@Lattyware Lattyware added enhancement A suggestion for a new feature or expansion of an existing feature. client Issues that touch the client side of the game. server Issues that touch the server side of the game. labels Dec 21, 2015
@Lattyware Lattyware added this to the nice-to-have milestone Dec 21, 2015
@Lattyware Lattyware added Hacktoberfest This would be a good issue to pick up for Hacktoberfest. help-wanted An issue where outside help would be particularly useful or necessary. good-first-issue This issue would be a good one to pick if you want to contribute but are not sure where to start. labels Sep 30, 2020
@lhvy
Copy link
Contributor

lhvy commented Oct 3, 2020

I am currently working on this. So far I have managed to make a rule trigger an extra round once someone wins and also added the Happy Ending rule to both client and server. I am having two issues I would appreciate help with:

  • How do I force a certain card when starting a new round? My attempts so far have been unsuccessful.
  • When I enable my new rule and press save, I get this error The server didn't understand a request from the client. Details: Error: Invalid PublicConfig: PublicConfig.rules.houseRules should NOT have additional properties I think the issue is due to my manual editing of validation.validator.ts as I can see it was generated by typescript-json-validator, but I'm unsure how to regenerate/edit this file correctly.

My changes so far are on my fork of this repo if anyone would like to have a look.

@Lattyware
Copy link
Owner Author

Lattyware commented Oct 3, 2020

Great to hear you are working on it.

Forcing a card would involve changing the way the round is generated. We do this in game.startNewRound(), and more specifically we replace the old call with a new one. Instead, you would want to discard the old one, but then inject the specific call you want as the new one instead of drawing one off the deck.

You should be able to generate validation.validator.ts with npm run generate-json-validators, which should hopefully then fix that issue.

I took a quick look at your changes, and they make sense so far, but let me know if you run into any other issues.

@lhvy
Copy link
Contributor

lhvy commented Oct 3, 2020

I have everything sorted now except for sending a specific card. I think I know the correct spot to do so and have added comments there but I don't know how to choose a specific call or choose one from a deck that isn't enabled in the case the selected decks don't include the base deck.

@Lattyware
Copy link
Owner Author

There are a couple of ways to go about that, in theory you could go for something very complex where the user can select a call or something, but I'd recommend against that (or if you think it is valuable, make a new issue and do it more simply first).

What I'd suggest is just hard-coding a call as a constant, which in the case of the house rule as described is fine. The difficult part of this is the source, I would suggest making a new source like Custom called Generated.

Then it's just a case of making the card with that source, i.e:

const happyEndingCall: Call = {
  id: Card.id(),
  parts: [
    ["Make a haiku."],
    [
      {
        transform: "Capitalize",
      },
      ",",
    ],
    [
      {
        transform: "Capitalize",
      },
      ",",
    ],
    [
      {
        transform: "Capitalize",
      },
      ".",
    ],
  ],
  source: { source: "Generated" },
};

Obviously, this falls over when it comes to localization, but that is harder to solve as we don't have translations of the base deck for all languages. I would suggest that is a problem for another issue.

@lhvy
Copy link
Contributor

lhvy commented Oct 4, 2020

For now, I think I will hard-code the card in. I have managed to get everything working so expect a pull request soon!

@Lattyware
Copy link
Owner Author

In as of #179 being merged, thanks to @CookieCoder15! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client Issues that touch the client side of the game. enhancement A suggestion for a new feature or expansion of an existing feature. good-first-issue This issue would be a good one to pick if you want to contribute but are not sure where to start. Hacktoberfest This would be a good issue to pick up for Hacktoberfest. help-wanted An issue where outside help would be particularly useful or necessary. server Issues that touch the server side of the game.
Projects
None yet
Development

No branches or pull requests

2 participants