Dominion Strategy Forum

Please login or register.

Login with username, password and session length
Pages: [1]

Author Topic: How do I buy a card (technical question)  (Read 1625 times)

0 Members and 1 Guest are viewing this topic.

Tables

  • Margrave
  • *****
  • Offline Offline
  • Posts: 2817
  • Build more Bridges in the King's Court!
  • Respect: +3349
    • View Profile
How do I buy a card (technical question)
« on: January 04, 2013, 10:03:01 pm »
0

Okay, so I'm trying to work out exactly how buying a card works in terms of, exactly what do you do? I keep thinking I can write it down, but keep realising I have issues when I try and express it at a completely fundamental level.

I'm thinking it's something like the below. It works like a dominion card itself, you do everything in order and if you can't do it, you keep going.

Buy:
-coin equal to the cost of the card currently
Gain a copy of the card

Now this might seem elementary, but issues start occuring when we put it in context of a buy phase.

Choose card I want to buy.
If (chosen card is in the supply AND chosen card costs less than my total coin available)
  -1 Buy
  Do Buy

Is that all correct so far? Then the next question is, when does a 'when buy' effect happen? Presumably before one starts resolving the buy effect itself, correct? If not, when? Then just for a second suppose we had the following reaction: When you buy a card, you may reveal and discard this. If you do, buy a card. At first, it looks fairly innocent, okay it's a reaction that gives a badly worded +buy. Except, does it? Have I spent any coin yet? Is this slightly unintuitive resolution technically correct, just a bit weird, or do I actually need to move some stuff around in my psuedocode?

I keep thinking this should be really elementary, but yet can't quite formulate exactly what should happen. Anyone want to help?
Logged
...spin-offs are still better for all of the previously cited reasons.
But not strictly better, because the spinoff can have a different cost than the expansion.

michaeljb

  • Saboteur
  • *****
  • Offline Offline
  • Posts: 1422
  • Shuffle iT Username: michaeljb
  • Respect: +2115
    • View Profile
Re: How do I buy a card (technical question)
« Reply #1 on: January 04, 2013, 11:38:19 pm »
0

Here is how I think the buy phase works...

-Play all the treasures from your hand that you want to play
-Choose a legal card (or no card, and the buy phase is done) from the supply to buy (broad wording should cover shenanigans involving contraband, grand market, cards more expensive than you can afford, and cards not actually in the game)
-subtract that card's cost from your available coins and potions, and subtract 1 buy from your available buys
-"when you buy" effects from cards in play, in hand (hypothetically, never know what Guilds may bring), Embargo, or the bought card, in whatever order you choose
-(attempt to) gain the bought card from the supply
-if you have more than 0 buys remaining, go back to the choose a card step; otherwise, end of buy phase

Edits: typing on phone can be challenging; also probably would have made this pseudo code on my computer :p
« Last Edit: January 04, 2013, 11:42:20 pm by michaeljb »
Logged
🚂 Give 18xx games a chance 🚂

gman314

  • Minion
  • *****
  • Offline Offline
  • Posts: 589
  • Respect: +281
    • View Profile
Re: How do I buy a card (technical question)
« Reply #2 on: January 05, 2013, 01:39:26 am »
+2

Try this flow chart. It might help explain things.


Logged

Davio

  • 2012 Dutch Champion
  • *
  • Offline Offline
  • Posts: 4787
  • Respect: +3413
    • View Profile
Re: How do I buy a card (technical question)
« Reply #3 on: January 05, 2013, 02:48:28 am »
+1

When you buy a card, all cards with "on-buy" events trigger at the same time, so you can choose the order to resolve them in.

If you buy Farmlands with Haggler in play, you can do Farmlands' trashing and gaining first or Haggler, your choice.
On Iso if you have Goons in play and say, buy an Embargo'd Province it really asks you what to do first: Gain a VP or gain a Curse. In this case it doesn't matter as VP tokens are limitless, but it's following the rules very strict here.

I think there was a weird example with Talisman where you gained the copy of the card before the actual card? Something odd like that. Anyway, the longer you think about it, the weirder it gets.

I think about it the same way as michaeljb points out in any case.

Imagine there would be a Trader-like card that says "when you would buy a card". This would happen while the card is still in the supply, but after you named it and before any "on-buy" effects like Haggler and Goons.

So you don't immediately (would) gain a bought card from the supply, there's room for "would-buy" and "on-buy" events.
Logged

BSG: Cagprezimal Adama
Mage Knight: Arythea

qmech

  • Torturer
  • *****
  • Offline Offline
  • Posts: 1918
  • Shuffle iT Username: qmech
  • What year is it?
  • Respect: +2320
    • View Profile
Re: How do I buy a card (technical question)
« Reply #4 on: January 05, 2013, 05:30:21 am »
0

This is how I see it: the first thing that happens is you name a card and lose a Buy and the cost of the card.  This is atomic and can't be interrupted.  Then after that the on-Buy effects trigger.

The problem I see with "On Buy: Buy" is this one if you try to buy a second copy of the last card in a stack.  I suspect that that would be legal but that you wouldn't gain anything for the original Buy if the second Buy's gain went through uninterrupted.
Logged
Pages: [1]
 

Page created in 0.078 seconds with 20 queries.