boardgamers / gaia-engine

Javascript engine for project gaia
MIT License
13 stars 6 forks source link

Income phase #65

Closed rzulian closed 6 years ago

rzulian commented 6 years ago

Requests for income order if there are +t and +pw in the same time. Iterates until the condition is not met and calculate gets remaining incomes. It's assuming that each income is a separate action, which is accordingly to the boardgame. Therefore PI have two different incomes that we load we PI has been build.

coyotte508 commented 6 years ago

There's just the last comment, repeated here because it's on an outdated diff:

Let's say that the player has 4 choices: 2t, 1t, 2pw, 1pw.

From what I see, from the current code the player can do several things:

If in the last line of Command.Income, engine.player(player).receiveIncome(); replaces this.selectIncomePhase(player);, only the first line would be allowed. The game wouldn't ask the player again what to do.

The player would also be able to do just that:

In the current code, if you just do income 2p, the game asks you again for another choice.

This isn't caught by the tests because there aren't any actions after the income command

coyotte508 commented 6 years ago

For example this test causes an error:

init 2 randomSeed
p1 faction ivits
p2 faction nevlas
p2 build m 0x-4
p2 build m -1x0
p1 build PI -2x-4
p2 booster booster4
p1 booster booster5
p1 income 2pw
p1 build m -1x-3
rzulian commented 6 years ago

I'l have a look at it asap

rzulian commented 6 years ago

Your example is giving an error because player1 has three possible incomes: 4pw,t, and 2pw. If the income command is 2pw, player still have to decide if then choose 4pw or t. So p1 income 2pw, t or p1 income 2pw, 4pw works.

Back to your note: If you are requesting the player to set the whole sequence, you are missing the ability the resolve when no selection is needed. (e.g player selects 1t and then 2t. A this point everything else is automatic). In my opinion the UI should allow for append the command to the preceding. a simple if in add move. What do you think?

coyotte508 commented 6 years ago

I was thinking that if a player doesn't want to bother they could just do one income command, instead of giving the whole sequence. In which case the engine would decide on the order.

Anyway it can easily be changed later if it comes up again, so I'm merging!

rzulian commented 6 years ago

I agree, I would make the "income anyway" command a possible option for the player.