boardgamers / gaia-engine

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

Auto charge / auto income #229

Closed zeitlinger closed 3 years ago

zeitlinger commented 3 years ago

Auto income

When autoIncome is true, the player will not be asked about the order of gain token and charge power during income phase.

From all possible combinations, the one with least wasted charges is chosen, "most tokens in area3" as tie-breaker.

Auto Brainstone

When autoBrainstone is true, the player will not be asked

Itars auto-charge to area 3

When itarsAutoChargeToArea3 is true, the player will not be asked whenever a token is about to move to area 3

Decline auto-charge unless it's free

When autoChargePower is set to 0, all auto-charges that are not free will be declined.

Other changes

The player is always asked when an auto-charge would partially wasted.

See charge rules.

Fixes #226 Fixes #223 Fixes #221

coyotte508 commented 3 years ago

Thank you for the changes! This is going to be really cool, I'm also going to tweak BGS to show the Itars & Taklon settings only when the player has the corresponding faction.

I will go over the code once again tomorrow evening and do some tests locally, maybe that will bleed a bit into Thursday.

zeitlinger commented 3 years ago

Do not hesitate to break up the PR if you want to continue working on some of the settings while others are ready. Or keep the one PR :)

no, there's no hurry.

zeitlinger commented 3 years ago

I guess we need to refactor the brainstone handling

  1. asking for brainstone destination should not be a separate step - it should rather be included in the charge options right away
  2. this will also avoid the exception in the auto charge - where it asks for brainstone - which breaks the auto brainstone - IIUC
coyotte508 commented 3 years ago

Regarding the brainsone in a separate step - it should be possible to do it with the current setup, it's just that autoBrainstone and autoCharge would need to share some logic (specifically autoCharge would need to be aware of the player's autoBrainstone setting).

I'm not against refactoring if the current setup proves really impractical, but I think it can be done well enough as is - without making too many breaking changes to the format of the logs

zeitlinger commented 3 years ago

Regarding the brainsone in a separate step - it should be possible to do it with the current setup, it's just that autoBrainstone and autoCharge would need to share some logic (specifically autoCharge would need to be aware of the player's autoBrainstone setting).

I'm not against refactoring if the current setup proves really impractical, but I think it can be done well enough as is - without making too many breaking changes to the format of the logs

it was a bad idea - I tried it, but the code because rather messy. I also convinced myself that the current setup should work :smile:

coyotte508 commented 3 years ago

It sounds like a challenge!

I just tested locally and was confused when my taklons with autocharge 2pw and auto brainstone didn't leech. I guess no sleep for me today ^^

zeitlinger commented 3 years ago

Did you get it to work?

On Wed, Feb 17, 2021, 23:27 coyotte508 notifications@github.com wrote:

It sounds like a challenge!

I just tested locally and was confused when my taklons with autocharge 2pw and auto brainstone didn't leech. I guess no sleep for me today ^^

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/boardgamers/gaia-engine/pull/229#issuecomment-780896142, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAVTR45TIHMUYU3CC7Z64MDS7Q7GFANCNFSM4XVLBMYA .

coyotte508 commented 3 years ago

I think so!

I added some tests in the wrapper. I'll do some more testing before putting it live.