SteamedPears / 3004-SevenWonders

Seven Wonders project for 3004
1 stars 1 forks source link

Bug: trading and combo assets #149

Closed spratt closed 11 years ago

spratt commented 11 years ago

I had a combo brick/ore asset. My neighbor had a brick. I started the trade for the brick. But I couldn't build a building that took 2 brick.

spratt commented 11 years ago

It keeps failing after trade check on valid trades.

Gankra commented 11 years ago

Having trouble reproducing.

spratt commented 11 years ago

I'll see if I can isolate the problem further, but it's not clear why most trades work fine and others fail.

Gankra commented 11 years ago

Any repro on this?

spratt commented 11 years ago

Nope, looks solid now.

spratt commented 11 years ago

Found it. Note that I was trying to build the second stage of my wonder, I had 2 clay, I was trading for a third, and the validator didn't think it was a valid action.

Screen Shot 2013-04-08 at 3 48 37 PM

Screen Shot 2013-04-08 at 3 48 48 PM

Screen Shot 2013-04-08 at 3 48 56 PM

Relevant log messages:

140186 [AWT-EventQueue-0] INFO com.steamedpears.comp3004.views.TradesView  - adding to right trades: 1 c
...
140186 [AWT-EventQueue-0] DEBUG com.steamedpears.comp3004.models.players.Player  - Player 0 validating move PlayerCommand[BUILD Loom_2_3]
140186 [AWT-EventQueue-0] DEBUG com.steamedpears.comp3004.models.players.Player  - validating number/types of moves
140186 [AWT-EventQueue-0] DEBUG com.steamedpears.comp3004.models.players.Player  - validating player can make the trades they are trying to make
140186 [AWT-EventQueue-0] DEBUG com.steamedpears.comp3004.models.players.Player  - validating player can build out wonder with this card
140186 [AWT-EventQueue-0] DEBUG com.steamedpears.comp3004.models.players.Player  - validating player has card
140187 [AWT-EventQueue-0] DEBUG com.steamedpears.comp3004.models.players.Player  - validation failed after specific command check
Gankra commented 11 years ago

Code's not broken. Underlying JSON is wrong:

"image":"Halikarnassos_b",
"stages":[
               {
                  "cost":{
                     "o":2
                  },
                  "baseAssets":{
                     "victory":2,
                     "discard":1
                  }
               },
               {
                  "cost":{
                     "s":2
                  },
                  "baseAssets":{
                     "victory":1,
                     "discard":1
                  }
               },
               {
                  "cost":{
                     "l":1,
                     "o":2
                  },
                  "baseAssets":{
                     "discard":1
                  }
               }
            ],
spratt commented 11 years ago

Want me to fix it, then?

Gankra commented 11 years ago

Just did.

spratt commented 11 years ago

Trade fails when buying Caravansery_2_3

Screen Shot 2013-04-08 at 10 06 05 PM Screen Shot 2013-04-08 at 10 06 13 PM

Relevant log file:

70870 [AWT-EventQueue-0] INFO com.steamedpears.comp3004.views.TradesView  - adding to left trades: 1 w
...
70870 [AWT-EventQueue-0] DEBUG com.steamedpears.comp3004.models.players.Player  - Player 0 validating move PlayerCommand[PLAY Caravansery_2_3]
70870 [AWT-EventQueue-0] DEBUG com.steamedpears.comp3004.models.players.Player  - validating number/types of moves
70871 [AWT-EventQueue-0] DEBUG com.steamedpears.comp3004.models.players.Player  - validating failed after gold cost check
70871 [AWT-EventQueue-0] DEBUG com.steamedpears.comp3004.models.players.Player  - validation failed after trade check
70871 [AWT-EventQueue-0] DEBUG com.steamedpears.comp3004.models.players.Player  - validation failed after specific command check
spratt commented 11 years ago

I am an idiot.