|
|
@ -45,7 +45,7 @@ import { setSelectedCard, setMessagePanelSpace, setMPDims, movePlayer,
|
|
|
|
setMovingSkip } from './actions.js'
|
|
|
|
setMovingSkip } from './actions.js'
|
|
|
|
import { buy, roll, endTurn, loan, trade, submitTradeAccept,
|
|
|
|
import { buy, roll, endTurn, loan, trade, submitTradeAccept,
|
|
|
|
submitTradeDeny, submitTradeCancel, audit,
|
|
|
|
submitTradeDeny, submitTradeCancel, audit,
|
|
|
|
buyUncleBert, skip } from './interface.js'
|
|
|
|
buyUncleBert, skip, endAiTurn } from './interface.js'
|
|
|
|
|
|
|
|
|
|
|
|
function netWorth(player) {
|
|
|
|
function netWorth(player) {
|
|
|
|
return ((player.assets.hay + player.assets.grain) * 2000) +
|
|
|
|
return ((player.assets.hay + player.assets.grain) * 2000) +
|
|
|
@ -1447,9 +1447,11 @@ class Moving extends React.Component {
|
|
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
render() {
|
|
|
|
let buttons;
|
|
|
|
let buttons;
|
|
|
|
if (this.props.player.name !== this.props.game.currentPlayer) {
|
|
|
|
if ((this.props.player.name !== this.props.game.currentPlayer &&
|
|
|
|
|
|
|
|
!this.props.currentPlayer.ai)) {
|
|
|
|
buttons = (<Fragment />);
|
|
|
|
buttons = (<Fragment />);
|
|
|
|
} else if (this.props.ui.playerSpaces[this.props.player.color] === this.props.ui.actionValue.to) {
|
|
|
|
} else if (this.props.ui.playerSpaces[(this.props.currentPlayer.ai && this.props.currentPlayer.color) || this.props.player.color]
|
|
|
|
|
|
|
|
=== this.props.ui.actionValue.to) {
|
|
|
|
buttons = (<Button onClick={() => this.props.showNextAction()}>Continue</Button>);
|
|
|
|
buttons = (<Button onClick={() => this.props.showNextAction()}>Continue</Button>);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
buttons = (<Button onClick={() => this.skip()}>Skip</Button>);
|
|
|
|
buttons = (<Button onClick={() => this.skip()}>Skip</Button>);
|
|
|
@ -1479,7 +1481,8 @@ class Moving extends React.Component {
|
|
|
|
class Action extends React.Component {
|
|
|
|
class Action extends React.Component {
|
|
|
|
render() {
|
|
|
|
render() {
|
|
|
|
let view, buttons;
|
|
|
|
let view, buttons;
|
|
|
|
const currentPlayer = this.props.player.name === this.props.game.currentPlayer ?
|
|
|
|
const currentPlayer = (this.props.player.name === this.props.game.currentPlayer ||
|
|
|
|
|
|
|
|
this.props.game.currentPlayer === '') ?
|
|
|
|
this.props.player : this.props.game.otherPlayers
|
|
|
|
this.props.player : this.props.game.otherPlayers
|
|
|
|
.find(p => p.player.name === this.props.game.currentPlayer).player;
|
|
|
|
.find(p => p.player.name === this.props.game.currentPlayer).player;
|
|
|
|
switch (this.props.ui.action) {
|
|
|
|
switch (this.props.ui.action) {
|
|
|
@ -1587,6 +1590,7 @@ class Action extends React.Component {
|
|
|
|
case 'move':
|
|
|
|
case 'move':
|
|
|
|
view = (<Moving showNextAction={() => this.props.showNextAction()}
|
|
|
|
view = (<Moving showNextAction={() => this.props.showNextAction()}
|
|
|
|
key={this.props.game.currentPlayer + '|' + this.props.ui.actionValue.from + '|' + this.props.ui.actionValue.to}
|
|
|
|
key={this.props.game.currentPlayer + '|' + this.props.ui.actionValue.from + '|' + this.props.ui.actionValue.to}
|
|
|
|
|
|
|
|
currentPlayer={currentPlayer}
|
|
|
|
player={this.props.player}
|
|
|
|
player={this.props.player}
|
|
|
|
game={this.props.game}
|
|
|
|
game={this.props.game}
|
|
|
|
spaces={this.props.spaces}
|
|
|
|
spaces={this.props.spaces}
|
|
|
@ -1601,6 +1605,7 @@ class Action extends React.Component {
|
|
|
|
case 'resolve-move':
|
|
|
|
case 'resolve-move':
|
|
|
|
view = (<Moving showNextAction={() => this.props.showNextAction()}
|
|
|
|
view = (<Moving showNextAction={() => this.props.showNextAction()}
|
|
|
|
key={this.props.game.currentPlayer + '|' + this.props.ui.actionValue.from + '|' + this.props.ui.actionValue.to}
|
|
|
|
key={this.props.game.currentPlayer + '|' + this.props.ui.actionValue.from + '|' + this.props.ui.actionValue.to}
|
|
|
|
|
|
|
|
currentPlayer={currentPlayer}
|
|
|
|
player={this.props.player}
|
|
|
|
player={this.props.player}
|
|
|
|
game={this.props.game}
|
|
|
|
game={this.props.game}
|
|
|
|
spaces={this.props.spaces}
|
|
|
|
spaces={this.props.spaces}
|
|
|
@ -1615,6 +1620,7 @@ class Action extends React.Component {
|
|
|
|
case 'goto':
|
|
|
|
case 'goto':
|
|
|
|
view = (<Moving showNextAction={() => this.props.showNextAction()}
|
|
|
|
view = (<Moving showNextAction={() => this.props.showNextAction()}
|
|
|
|
timerId={this.props.timerId}
|
|
|
|
timerId={this.props.timerId}
|
|
|
|
|
|
|
|
currentPlayer={currentPlayer}
|
|
|
|
setTimerId={this.props.setTimerId}
|
|
|
|
setTimerId={this.props.setTimerId}
|
|
|
|
player={this.props.player}
|
|
|
|
player={this.props.player}
|
|
|
|
game={this.props.game}
|
|
|
|
game={this.props.game}
|
|
|
@ -1635,11 +1641,13 @@ class Action extends React.Component {
|
|
|
|
this.props.ui.actionValue.from - 49 : this.props.ui.actionValue.from);
|
|
|
|
this.props.ui.actionValue.from - 49 : this.props.ui.actionValue.from);
|
|
|
|
view = (<Rolling num={roll}
|
|
|
|
view = (<Rolling num={roll}
|
|
|
|
name={this.props.game.currentPlayer}
|
|
|
|
name={this.props.game.currentPlayer}
|
|
|
|
showScreen={this.props.player.name === this.props.game.currentPlayer
|
|
|
|
showScreen={(this.props.player.name === this.props.game.currentPlayer ||
|
|
|
|
|
|
|
|
currentPlayer.ai)
|
|
|
|
? () => this.props.showNextAction()
|
|
|
|
? () => this.props.showNextAction()
|
|
|
|
: false}
|
|
|
|
: false}
|
|
|
|
autoSkip={this.props.ui.autoSkip}
|
|
|
|
autoSkip={this.props.ui.autoSkip}
|
|
|
|
skip={this.props.player.name === this.props.game.currentPlayer}
|
|
|
|
skip={(this.props.player.name === this.props.game.currentPlayer ||
|
|
|
|
|
|
|
|
currentPlayer.ai)}
|
|
|
|
showScreenDelay={2000} />);
|
|
|
|
showScreenDelay={2000} />);
|
|
|
|
buttons = (<Fragment />);
|
|
|
|
buttons = (<Fragment />);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -1650,6 +1658,12 @@ class Action extends React.Component {
|
|
|
|
screen={this.props.screen}
|
|
|
|
screen={this.props.screen}
|
|
|
|
showScreen={this.props.showScreen}
|
|
|
|
showScreen={this.props.showScreen}
|
|
|
|
game={this.props.game} />);
|
|
|
|
game={this.props.game} />);
|
|
|
|
|
|
|
|
} else if (currentPlayer.ai) {
|
|
|
|
|
|
|
|
view = (
|
|
|
|
|
|
|
|
<Button onClick={endAiTurn}>
|
|
|
|
|
|
|
|
Next Player's Turn
|
|
|
|
|
|
|
|
</Button>
|
|
|
|
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
view = (<Fragment>Waiting for {this.props.game.currentPlayer}</Fragment>);
|
|
|
|
view = (<Fragment>Waiting for {this.props.game.currentPlayer}</Fragment>);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1663,7 +1677,7 @@ class Action extends React.Component {
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
<div className={'center'}>
|
|
|
|
<div className={'center'}>
|
|
|
|
{this.props.otherPlayersTurn ? (<Fragment />) : buttons}
|
|
|
|
{(this.props.otherPlayersTurn && !currentPlayer.ai ) ? (<Fragment />) : buttons}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</Col>
|
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
</Row>
|
|
|
|