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

Add the multiple comparison unique pack #11280

Conversation

PLynx01
Copy link
Contributor

@PLynx01 PLynx01 commented Mar 9, 2024

I made a multiple comparison unique pack, which contains 4 new uniques and 6 modified ones to support year as a parameter. Though i made a similar PR several days ago #11250 and the PR for support of years #11262 (which was rejected), I've combined these two pull requests into this one.

I hope that this time year-related uniques will be introduced, as there is another PR adding events #11276

If you have some remarks, share them in the comments. Constructive feedback welcome.

Supports resources, stats and years
Copy link

github-actions bot commented Mar 9, 2024

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@yairm210
Copy link
Owner

yairm210 commented Mar 9, 2024

You're half-right here.
Yes, year should be part of the same check, since it's another int-resultant object.
No, we don't need to introduce extra uniques.

Let's looks at this from a language perspective first. "Between 1900 and 2000 year(s)" does not parse well. Years aren't something you have, but they are something you count.
So this should instead read as "When year is between 1900 and 2000".
Checking this against resources and stats shows that it's fine - "When gold is between 0 and 1000", "When iron is between 0 and 2".

Since that's the case, why not use the same unique for numbers as well? Base numbers are also a countable!

In fact this can be generalized to "when [countable] is between [countable2] and [countable3]"

Examples: When Gold is between Science and Culture, when Iron is between Horses and Gems.
Okay, sounds pretty bad, if we add "number of" sounds better - when number of iron is between number of horses and number of gems. So that's something we'll have to figure out.


Second problem I have is with the if/elses. What we actually need here is a function to get a string, and return a number - which we can then use for both the first and second element.
That function will be an if/else style.

@PLynx01
Copy link
Contributor Author

PLynx01 commented Mar 11, 2024

You're half-right here.
Yes, year should be part of the same check, since it's another int-resultant object.
No, we don't need to introduce extra uniques.

Let's looks at this from a language perspective first. "Between 1900 and 2000 year(s)" does not parse well. Years aren't something you have, but they are something you count.
So this should instead read as "When year is between 1900 and 2000".
Checking this against resources and stats shows that it's fine - "When gold is between 0 and 1000", "When iron is between 0 and 2".

Since that's the case, why not use the same unique for numbers as well? Base numbers are also a countable!

In fact this can be generalized to "when [countable] is between [countable2] and [countable3]"

In that case we need to add the "countable" unique parameter

Examples: When Gold is between Science and Culture, when Iron is between Horses and Gems.
Okay, sounds pretty bad, if we add "number of" sounds better - when number of iron is between number of horses and number of gems. So that's something we'll have to figure out.

In that case, please give me the desired wording of the uniques

Second problem I have is with the if/elses. What we actually need here is a function to get a string, and return a number - which we can then use for both the first and second element.
That function will be an if/else style.

Did you mean this function?

fun getCountableNumber(countable: String): Int

@PLynx01
Copy link
Contributor Author

PLynx01 commented Mar 12, 2024

I've got an idea:

We can make a "countable" mega-parameter which would accept all of the following:

  • Integer numbers
  • Fractional numbers
  • Current year
  • Stat amounts
  • Resources amounts
  • Victory Screen stats (production, force, territory, population)
  • Number of adopted policies
  • Number of researched technologies
  • Number of owned units
  • Numbers of built buildings
  • City population
  • Number of cities

And even more...

There is a lot of these, but I think we need to add support of nested parameters. Something like:

When [number of cities <with population at least 5>] is larger than [4]

What's your opinion about this?

@yairm210
Copy link
Owner

We'll need to see how we structure the nested filters
Definitely we'll need [] and not <> - conditionals are applied to entire unique and not to specific parts

@PLynx01
Copy link
Contributor Author

PLynx01 commented Mar 12, 2024

We'll need to see how we structure the nested filters
Definitely we'll need [] and not <> - conditionals are applied to entire unique and not to specific parts

[] - this is a parameter character
<> - this is a conditional character (for entire unique)

We need a "internal conditional" or "parameter conditional" character.

Let's decide together what it should be

@yairm210
Copy link
Owner

We really don't need such a thing

@PLynx01
Copy link
Contributor Author

PLynx01 commented Mar 12, 2024

We really don't need such a thing

So, in that case, would we use [] for parameter conditionals?

The following conditional unique should be true if a player has more than 4 cities with population of at least 5

Please rewrite it with your preferred syntax.

<When [number of cities <with population at least 5>] is larger than [4]>

@PLynx01
Copy link
Contributor Author

PLynx01 commented Mar 12, 2024

For now, I can make a pack of countable-checking conditional uniques, which does not involve nested conditions.

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

Successfully merging this pull request may close these issues.

2 participants