2020-01-14 22:14:55 +01:00
|
|
|
import * as Card from GUI.Card;
|
2020-01-15 18:01:07 +01:00
|
|
|
import * as State from GUI.Screen.Game.State;
|
|
|
|
|
|
|
|
return {
|
|
|
|
make: RiverCard
|
|
|
|
};
|
2020-01-14 17:27:56 +01:00
|
|
|
|
2020-01-14 22:14:55 +01:00
|
|
|
function RiverCard(name) {
|
|
|
|
var card = Card.make(name);
|
|
|
|
var candidate = false;
|
2020-01-16 16:44:19 +01:00
|
|
|
card.dom.addEventListener('click', onClick);
|
2020-01-14 22:14:55 +01:00
|
|
|
card.setCandidate = setCandidate;
|
|
|
|
return card;
|
|
|
|
|
|
|
|
function onClick() {
|
2020-01-16 16:44:19 +01:00
|
|
|
if(candidate) {
|
|
|
|
var withCard = State.getSelected().value.name;
|
|
|
|
State.select(false);
|
|
|
|
State.play(
|
2020-01-25 10:56:55 +01:00
|
|
|
State.globalState.step == 'ToPlay' ?
|
2020-01-16 16:44:19 +01:00
|
|
|
{capture: [withCard, name]} : {choose: name}
|
|
|
|
);
|
|
|
|
}
|
2020-01-14 22:14:55 +01:00
|
|
|
}
|
|
|
|
|
2020-01-15 18:01:07 +01:00
|
|
|
function setCandidate(yes) {
|
2020-01-14 22:14:55 +01:00
|
|
|
candidate = yes;
|
|
|
|
card.dom.classList.toggle("candidate", yes);
|
|
|
|
}
|
2020-01-14 17:27:56 +01:00
|
|
|
}
|