import * as Card from GUI.Card; import * as State from GUI.Screen.Game.State; return { make: RiverCard }; function RiverCard(name) { var card = Card.make(name); var candidate = false; card.dom.addEventListener('click', onClick); card.setCandidate = setCandidate; return card; function onClick() { if(candidate) { var withCard = State.getSelected().value.name; State.select(false); State.play( State.state.step == 'ToPlay' ? {capture: [withCard, name]} : {choose: name} ); } } function setCandidate(yes) { candidate = yes; card.dom.classList.toggle("candidate", yes); } }