-
Notifications
You must be signed in to change notification settings - Fork 396
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
Adding haveResources and checkAIPlayer to RulesAttachment #11969
Conversation
This change allows tuv to be set to 0 and be used for calculations. Also a check was add for the proper values.
Adding haveResources and checkAIPlayer to RulesAttachment. Included is RulesAttachmentTest which uses "VICTORY_TEST" to test haveResources. checkAIPlayer is not tested because of internal testing for boolean values. Cheers...
Indentation on comments fixed. Values "FUEL" and "ORE" changed to "fuel" and "ore"
Fixed spacing and import order
Formatting fixes and an additional check added for testCheckHaveResources
Still more formatting fixes
Still working on formatting issues
Formatting, and removal of @test for concatWithColon
Even if count 0 is always true, why not allowing this setting? I'm not sure, just wondering. It might have some use in case something is always allowed at some point in the game before or after a trigger changes the count. Why not having
simply as
? Is such simple listing reserved or meant to be reserved for something else? If we want the "add", shouldn't it rather belong to some other thing than the "value"? For example:
I really think that packing an operator in what is the value list is not right. Your formulation logically reads as if there are three resources, called "add", "PUs" and "Ore". Besides, how about if a mapmaker has a resource actually called "add" (possibly an acronym)? In this case, this coding would be functionally equivalent to my previous proposal if we have "add" as the default (and possibly the only available) operator. |
I don't see any more formatting during the last check. Do not understand ':game-app:game-relay-server:test' error. |
Not knowing how the process works, so might be a distraction, I notice The same folder name, might that be it? |
Triggers, purchases, etc... may change the amount of resources, but what does that have to do with checking the amount? If something is always true, then use "switch". I don't understand the reasoning here. haveResources also uses the players option.
Here it is checking for Germany or Italians or Japanese for 100 PUs to satisfy the condition. Yes this can be done with 3 separate conditions, which can then be OR'ed together in a separate condition/trigger. But saying:
Will add the PUs when checking for 100. The action is explicit; or/add. But I'm happy either way. |
What's the difference between It seems pretty confusing, since they sound like synonyms. I wonder if we can do something like: As to how to handle multiple players, I'm wondering if we could just make it use (Also, I'm confused why you say that you'd want it to be OR semantics otherwise, since for your AI check you did AND semantics...) |
As I said (whereas indeed statically having zero can be exchanged for simply a true "switch"), just like you can use triggers to change the "switch" of a condition during the game, you could use them to set the value in question, zero being functionally the same as "true" in the "switch". You can refer to my "270BC Wars" game for some examples of changing the setting of "switch" options in conditions during the game.
In theory or principle, I would disagree with the relation being OR, affirming it should be AND. That condition logically is the same as making 3 different conditions, one per player. If, then, you use those 3 conditions in a trigger without specifying the operator (called "type" in TripleA), the default operator is AND. Hence, in order for that condition to be the same as having one condition per player with the default AND operator, it should check that each of the players has at least 100 PUs. For coherency, the default operator in case of multiple "players" for the same "haveResources" condition should be AND, possibly allowing operators (like OR) to be set. In practice, however, I do agree with the relationship being rather OR than AND, because I think this is more like the established practice in other cases like directOwnershipTerritories (when having multiple players for the option). However, pushing it further that way, I argue that the default relationship would be your "sum" case for coherency with other things like directOwnershipTerritories. For example, in case of directOwnershipTerritories, if I make a condition which checks for two or more territories and set it for multiple players, the condition is true looking at how many of those territories are indifferently owned by any players in the list. For example, if I have a directOwnershipTerritories which checks for at least 3 territories to be owned by players "Germany:Italians:Japanese" and each of these players has only 1 of these territories, the condition is true, so (for coherency), if I have a condition which checks for at least 3 PUs to be owned by players "Germany:Italians:Japanese" and each of these players has only 1 PUs, I would say the condition should be true as well.
As said, I believe that this should rather be the default on even only behaviour for when you set multiple players in the same option so no need having the "sum:" part in the "value" at all. Besides, I'm strongly against having operators in the value (and how about if the game has a resource called "sum"?). Moreover, I also definitely believe here the operator should be on the "players" (not on the "haveResources"). Hence, (if not default) I rather definitely suggest having a code like
|
I also do understand that "add" and "sum" are the same operator but "add" is on the resources and "sum" is on the players. Also in my opinion, this makes no sense, so they should rather be called with the same "xxx" ("xxx" being whatever) name and applied accordingly. For example,
would sum "PUs and "Ore", and
would sum the PUs of Germany, Italians and Japanese. |
This removes add/sum keywords and allows haveResources to function more like unitPresence. The list of resources/players are summed automatically.
I hope you have not given up because being able to test for resources and AI control would be important features. By the way, I would suggest each of them having its own PR (instead of a same PR for both). |
Change Summary & Additional Notes
Adding haveResources to allow map makers to check if a player has resources available.
Adding checkAIPlayer to allow map makers to check for an AI controlled player.
A new file RulesAttachmentTest is added to test haveResources.
Release Note
haveResources allows maker to check the amount of resources available. "value" is the resources being checked, and may contain multiple resources. "count" is the amount of resources that must be equal to the of greater then for haveResouces to return true. "count" must be greater then "0", since a count of "0" would always be true, and players cannot have a negative resource. The use of "sum" or "add" as the first "value" will sum all resources together. "players" option will allow multiple players to be checked.
Will check the attachTo player for a resource of "PUs" for a value equal to or greater than "100".
Will sum "PUs" and "Ore" together.
haveResources can be entered multiple times to check for different values.
Both "PUs" and "Ore" must be true for this statement to be true.
Add the "players" option will check those players for a true statement.
checkAIPlayer will only check for an AI player if the value is "true".
NEW|Adding haveResources and checkAIPlayer"players" option can be used to check multiple players.