Trader onGain doesn't work?
I have the two following issues: Bot a) Trader/Market:
# Play Big Money including Banks, except buy Wharf with every $5 buy.
{
name: 'Trader/Market'
author: 'DStu'
requires: ['Trader', 'Cache']
gainPriority: (state, my) -> [
"Province" if my.getTotalMoney() >= 16
"Duchy" if state.gainsToEndGame() <= 4
"Estate" if state.gainsToEndGame() <= 2
"Market"
"Trader" if my.countInDeck("Trader") < 2
"Silver"
"Copper" if my.countInHand("Trader") > 0
]
actionPriority: (state, my) -> [
]
trashPriority: (state, my) -> [
"Trader" if my.getAvailableMoney() < 5
"Estate" if state.gainsToEndGame() > 4
"Curse"
"Copper"
]
}
== Trader/Market's turn 3 ==
[...]
Trader/Market draws 5 cards: [Estate, Copper, Trader, Copper, Estate].
== BigSmithy's turn 4 ==
[...]
== Trader/Market's turn 4 ==
Trader/Market plays Copper.
Trader/Market plays Copper.
Coins: 2, Potions: 0, Buys: 1
Trader/Market buys Copper.
(Trader/Market shuffles.)
Trader/Market draws 5 cards: [Silver, Copper, Copper, Estate, Copper].
Why doesn't it show the Trader? Similarly with Cache:
# Play Big Money including Banks, except buy Wharf with every $5 buy.
{
name: 'Trader/Cache'
author: 'DStu'
requires: ['Trader', 'Cache']
gainPriority: (state, my) -> [
"Province" if my.getTotalMoney() >= 16
"Duchy" if state.gainsToEndGame() <= 4
"Estate" if state.gainsToEndGame() <= 2
"Cache" if my.countInHand("Trader") > 0
"Gold"
"Cache"
"Trader" if my.countInDeck("Trader") < 2
"Silver"
]
actionPriority: (state, my) -> [
"Trader" if (my.getAvailableMoney() < 5 and this.wantsToTrash(state) )
"Trader" if (my.countInHand("Trader") > 1 and this.wantsToTrash(state) )
]
trashPriority: (state, my) -> [
"Trader" if my.getAvailableMoney() < 5
"Estate" if state.gainsToEndGame() > 4
"Curse"
"Copper"
]
}
== Trader/Cache's turn 7 ==
[...]
Trader/Cache draws 5 cards: [Copper, Trader, Silver, Copper, Gold].
== BigSmithy's turn 8 ==
[...]
== Trader/Cache's turn 8 ==
Trader/Cache plays Gold.
Trader/Cache plays Silver.
Trader/Cache plays Copper.
Trader/Cache plays Copper.
Coins: 7, Potions: 0, Buys: 1
Trader/Cache buys Cache.
Trader/Cache gains Copper.
Trader/Cache gains Copper.
Trader/Cache draws 5 cards: [Copper, Silver, Copper, Silver, Copper].