|
|
@ -34,7 +34,7 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
|
|
|
import { faUser, faUsers, faTractor, faWindowRestore,
|
|
|
|
import { faUser, faUsers, faTractor, faWindowRestore,
|
|
|
|
faDollarSign, faTimes, faExchangeAlt,
|
|
|
|
faDollarSign, faTimes, faExchangeAlt,
|
|
|
|
faInfoCircle, faArrowUp, faArrowDown, faAward,
|
|
|
|
faInfoCircle, faArrowUp, faArrowDown, faAward,
|
|
|
|
faBan, faArrowCircleLeft } from '@fortawesome/free-solid-svg-icons'
|
|
|
|
faBan, faArrowCircleLeft, faPlusCircle } from '@fortawesome/free-solid-svg-icons'
|
|
|
|
|
|
|
|
|
|
|
|
import { GroupBox, Row, Col, Button } from '../widgets.jsx'
|
|
|
|
import { GroupBox, Row, Col, Button } from '../widgets.jsx'
|
|
|
|
import SpaceNode from './SpaceNode.jsx'
|
|
|
|
import SpaceNode from './SpaceNode.jsx'
|
|
|
@ -48,21 +48,22 @@ import { setSelectedCard, setMessagePanelSpace, setMPDims, movePlayer,
|
|
|
|
import { buy, roll, endTurn, loan, trade, submitTradeAccept,
|
|
|
|
import { buy, roll, endTurn, loan, trade, submitTradeAccept,
|
|
|
|
submitTradeDeny, submitTradeCancel, audit,
|
|
|
|
submitTradeDeny, submitTradeCancel, audit,
|
|
|
|
buyUncleBert, skip, endAiTurn, startGame, readyToStart,
|
|
|
|
buyUncleBert, skip, endAiTurn, startGame, readyToStart,
|
|
|
|
leaveGame, kickPlayer, toggleRevealForTrade } from './interface.js'
|
|
|
|
leaveGame, kickPlayer, toggleRevealForTrade,
|
|
|
|
|
|
|
|
addAIPlayer } 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) +
|
|
|
|
(player.assets.fruit * 5000) +
|
|
|
|
(player.assets.fruit * 5000) +
|
|
|
|
(player.assets.cows * 500) +
|
|
|
|
(player.assets.cows * 500) +
|
|
|
|
((player.assets.harvester + player.assets.tractor) * 10000) +
|
|
|
|
((player.assets.harvester + player.assets.tractor) * 10000) +
|
|
|
|
player.displayCash - player.debt;
|
|
|
|
player.displayCash - player.debt;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function assetsValue(player) {
|
|
|
|
function assetsValue(player) {
|
|
|
|
return ((player.assets.hay + player.assets.grain) * 2000) +
|
|
|
|
return ((player.assets.hay + player.assets.grain) * 2000) +
|
|
|
|
(player.assets.fruit * 5000) +
|
|
|
|
(player.assets.fruit * 5000) +
|
|
|
|
(player.assets.cows * 500) +
|
|
|
|
(player.assets.cows * 500) +
|
|
|
|
((player.assets.harvester + player.assets.tractor) * 10000);
|
|
|
|
((player.assets.harvester + player.assets.tractor) * 10000);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class ResourceUnit extends React.Component {
|
|
|
|
class ResourceUnit extends React.Component {
|
|
|
@ -617,227 +618,227 @@ class TradeContainer extends React.Component {
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<GroupBox title='Trade'>
|
|
|
|
<GroupBox title='Trade'>
|
|
|
|
{this.state.showCards ? (
|
|
|
|
{this.state.showCards ? (
|
|
|
|
<TradeCards player={this.state.showCardsPlayer}
|
|
|
|
<TradeCards player={this.state.showCardsPlayer}
|
|
|
|
me={player}
|
|
|
|
me={player}
|
|
|
|
tradeCard={this.tradeCard}
|
|
|
|
tradeCard={this.tradeCard}
|
|
|
|
goBack={this.viewPlayerCards}
|
|
|
|
goBack={this.viewPlayerCards}
|
|
|
|
cardsBeingTraded={this.state.sendCards.map(c => c.id).concat(this.state.receiveCards.map(c => c.id))}
|
|
|
|
cardsBeingTraded={this.state.sendCards.map(c => c.id).concat(this.state.receiveCards.map(c => c.id))}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
) : (
|
|
|
|
) : (
|
|
|
|
<>
|
|
|
|
<>
|
|
|
|
<Row>
|
|
|
|
<Row>
|
|
|
|
<Col width="12">
|
|
|
|
<Col width="12">
|
|
|
|
<div className="trade-player-container">
|
|
|
|
<div className="trade-player-container">
|
|
|
|
<h4>
|
|
|
|
<h4>
|
|
|
|
{player.name}
|
|
|
|
{player.name}
|
|
|
|
{player.cards.length > 0 ? (
|
|
|
|
{player.cards.length > 0 ? (
|
|
|
|
<>
|
|
|
|
<>
|
|
|
|
{' - '}
|
|
|
|
{' - '}
|
|
|
|
<a onClick={e => this.viewPlayerCards(e, player)}>
|
|
|
|
<a onClick={e => this.viewPlayerCards(e, player)}>
|
|
|
|
<FontAwesomeIcon icon={faWindowRestore} /> Trade Cards
|
|
|
|
<FontAwesomeIcon icon={faWindowRestore} /> Trade Cards
|
|
|
|
</a>
|
|
|
|
</a>
|
|
|
|
</>
|
|
|
|
</>
|
|
|
|
) : (<></>)}
|
|
|
|
) : (<></>)}
|
|
|
|
</h4>
|
|
|
|
</h4>
|
|
|
|
{Object.keys(player.ridges).map((ridge, idx) => (
|
|
|
|
{Object.keys(player.ridges).map((ridge, idx) => (
|
|
|
|
<Fragment key={'player-trade' + ridge}>
|
|
|
|
<Fragment key={'player-trade' + ridge}>
|
|
|
|
{!tradeProposed && (player.ridges[ridge] > 0) && !toTrade[ridge] ? (
|
|
|
|
{!tradeProposed && (player.ridges[ridge] > 0) && !toTrade[ridge] ? (
|
|
|
|
<Button className="tiny"
|
|
|
|
<Button className="tiny"
|
|
|
|
onClick={() => this.tradeAsset(ridge, player.ridges[ridge], true)}>
|
|
|
|
onClick={() => this.tradeAsset(ridge, player.ridges[ridge], true)}>
|
|
|
|
<FontAwesomeIcon icon={faArrowDown} /> {ridgeNames[idx]} {'('}{player.ridges[ridge]} cows{')'}
|
|
|
|
<FontAwesomeIcon icon={faArrowDown} /> {ridgeNames[idx]} {'('}{player.ridges[ridge]} cows{')'}
|
|
|
|
</Button>
|
|
|
|
</Button>
|
|
|
|
) : (<></>)}
|
|
|
|
) : (<></>)}
|
|
|
|
{' '}
|
|
|
|
{' '}
|
|
|
|
</Fragment>
|
|
|
|
</Fragment>
|
|
|
|
))}
|
|
|
|
))}
|
|
|
|
<div className='resource-unit-container'>
|
|
|
|
<div className='resource-unit-container'>
|
|
|
|
{this.resources.map((o, i) => {
|
|
|
|
{this.resources.map((o, i) => {
|
|
|
|
let amount = o.key === 'money' ? Math.floor(player.cash / 1000) : player.assets[o.key];
|
|
|
|
let amount = o.key === 'money' ? Math.floor(player.cash / 1000) : player.assets[o.key];
|
|
|
|
if (o.key === 'cows') { amount = player.assets.cows - playerRidgeCows(player); }
|
|
|
|
if (o.key === 'cows') { amount = player.assets.cows - playerRidgeCows(player); }
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<ResourceUnit img={o.img ? o.img : false} h={o.h} s={o.s} label={o.label}
|
|
|
|
<ResourceUnit img={o.img ? o.img : false} h={o.h} s={o.s} label={o.label}
|
|
|
|
key={i}
|
|
|
|
key={i}
|
|
|
|
className={o.key === 'money' ? 'double-width' : false}
|
|
|
|
className={o.key === 'money' ? 'double-width' : false}
|
|
|
|
amount={amount + Math.min(0, toTrade[o.key])}
|
|
|
|
amount={amount + Math.min(0, toTrade[o.key])}
|
|
|
|
>
|
|
|
|
>
|
|
|
|
{o.icon ? (
|
|
|
|
{o.icon ? (
|
|
|
|
<>
|
|
|
|
<>
|
|
|
|
<FontAwesomeIcon icon={o.icon} />(K)
|
|
|
|
<FontAwesomeIcon icon={o.icon} />(K)
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
</>
|
|
|
|
</>
|
|
|
|
) : ''}
|
|
|
|
) : ''}
|
|
|
|
{amount + Math.min(0, toTrade[o.key])}
|
|
|
|
{amount + Math.min(0, toTrade[o.key])}
|
|
|
|
{o.icon ? (<br />) : ''}
|
|
|
|
{o.icon ? (<br />) : ''}
|
|
|
|
{!tradeProposed && ((amount + Math.min(0, toTrade[o.key])) > 0 || toTrade[o.key] > 0) ? (
|
|
|
|
{!tradeProposed && ((amount + Math.min(0, toTrade[o.key])) > 0 || toTrade[o.key] > 0) ? (
|
|
|
|
<>
|
|
|
|
<>
|
|
|
|
<Button className="tiny"
|
|
|
|
<Button className="tiny"
|
|
|
|
onClick={() => this.tradeAsset(o.key, o.amount * -1)}>
|
|
|
|
onClick={() => this.tradeAsset(o.key, o.amount * -1)}>
|
|
|
|
<FontAwesomeIcon icon={faArrowDown} />
|
|
|
|
<FontAwesomeIcon icon={faArrowDown} />
|
|
|
|
</Button>
|
|
|
|
</Button>
|
|
|
|
{o.key === 'money' && (amount + Math.min(0, toTrade[o.key])) >= 10 ? (
|
|
|
|
{o.key === 'money' && (amount + Math.min(0, toTrade[o.key])) >= 10 ? (
|
|
|
|
<Button className="tiny"
|
|
|
|
<Button className="tiny"
|
|
|
|
onClick={() => this.tradeAsset(o.key, o.amount * -10)}>
|
|
|
|
onClick={() => this.tradeAsset(o.key, o.amount * -10)}>
|
|
|
|
<FontAwesomeIcon icon={faArrowDown} />
|
|
|
|
<FontAwesomeIcon icon={faArrowDown} />
|
|
|
|
<FontAwesomeIcon icon={faArrowDown} />
|
|
|
|
<FontAwesomeIcon icon={faArrowDown} />
|
|
|
|
</Button>
|
|
|
|
</Button>
|
|
|
|
) : ''}
|
|
|
|
) : ''}
|
|
|
|
</>
|
|
|
|
</>
|
|
|
|
) : (<></>)}
|
|
|
|
) : (<></>)}
|
|
|
|
</ResourceUnit>
|
|
|
|
</ResourceUnit>
|
|
|
|
);
|
|
|
|
);
|
|
|
|
})}
|
|
|
|
})}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</Col>
|
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
</Row>
|
|
|
|
<Row>
|
|
|
|
<Row>
|
|
|
|
<Col width="12">
|
|
|
|
<Col width="12">
|
|
|
|
{Object.keys(otherPlayer ? otherPlayer.ridges : []).map((ridge, idx) => (
|
|
|
|
{Object.keys(otherPlayer ? otherPlayer.ridges : []).map((ridge, idx) => (
|
|
|
|
<Fragment key={'to-trade' + ridge}>
|
|
|
|
<Fragment key={'to-trade' + ridge}>
|
|
|
|
{(otherPlayer.ridges[ridge] > 0) && toTrade[ridge] ? (
|
|
|
|
{(otherPlayer.ridges[ridge] > 0) && toTrade[ridge] ? (
|
|
|
|
|
|
|
|
<Button className="tiny"
|
|
|
|
|
|
|
|
onClick={() => this.tradeAsset(ridge, false)}>
|
|
|
|
|
|
|
|
<FontAwesomeIcon icon={faArrowDown} /> {ridgeNames[idx]} {'('}{otherPlayer.ridges[ridge]} cows{')'}
|
|
|
|
|
|
|
|
</Button>
|
|
|
|
|
|
|
|
) : (<></>)}
|
|
|
|
|
|
|
|
{' '}
|
|
|
|
|
|
|
|
</Fragment>
|
|
|
|
|
|
|
|
))}
|
|
|
|
|
|
|
|
{this.state.receiveCards.map((card, idx) => (
|
|
|
|
<Button className="tiny"
|
|
|
|
<Button className="tiny"
|
|
|
|
onClick={() => this.tradeAsset(ridge, false)}>
|
|
|
|
key={idx}
|
|
|
|
<FontAwesomeIcon icon={faArrowDown} /> {ridgeNames[idx]} {'('}{otherPlayer.ridges[ridge]} cows{')'}
|
|
|
|
onClick={() => this.unTradeCard(card.id)}>
|
|
|
|
|
|
|
|
{card.summary}
|
|
|
|
</Button>
|
|
|
|
</Button>
|
|
|
|
) : (<></>)}
|
|
|
|
))}
|
|
|
|
{' '}
|
|
|
|
</Col>
|
|
|
|
</Fragment>
|
|
|
|
</Row>
|
|
|
|
))}
|
|
|
|
<Row>
|
|
|
|
{this.state.receiveCards.map((card, idx) => (
|
|
|
|
<Col width="12">
|
|
|
|
<Button className="tiny"
|
|
|
|
<div className='resource-unit-container resources-to-trade'>
|
|
|
|
key={idx}
|
|
|
|
{this.resources.map((o, i) => (
|
|
|
|
onClick={() => this.unTradeCard(card.id)}>
|
|
|
|
<ResourceUnit h={o.h} s={o.s} label={o.label}
|
|
|
|
{card.summary}
|
|
|
|
key={i}
|
|
|
|
</Button>
|
|
|
|
className={(this.tradeClass(toTrade[o.key])) + (o.key === 'money' ? ' double-width' : '')}
|
|
|
|
))}
|
|
|
|
amount={toTrade[o.key]}
|
|
|
|
</Col>
|
|
|
|
>
|
|
|
|
</Row>
|
|
|
|
{Math.abs(toTrade[o.key])}
|
|
|
|
<Row>
|
|
|
|
</ResourceUnit>
|
|
|
|
<Col width="12">
|
|
|
|
))}
|
|
|
|
<div className='resource-unit-container resources-to-trade'>
|
|
|
|
</div>
|
|
|
|
{this.resources.map((o, i) => (
|
|
|
|
</Col>
|
|
|
|
<ResourceUnit h={o.h} s={o.s} label={o.label}
|
|
|
|
</Row>
|
|
|
|
key={i}
|
|
|
|
<Row>
|
|
|
|
className={(this.tradeClass(toTrade[o.key])) + (o.key === 'money' ? ' double-width' : '')}
|
|
|
|
<Col width="12">
|
|
|
|
amount={toTrade[o.key]}
|
|
|
|
{Object.keys(player.ridges).map((ridge, idx) => (
|
|
|
|
>
|
|
|
|
<Fragment key={'to-trade' + ridge}>
|
|
|
|
{Math.abs(toTrade[o.key])}
|
|
|
|
{(player.ridges[ridge] > 0) && toTrade[ridge] ? (
|
|
|
|
</ResourceUnit>
|
|
|
|
<Button className="tiny"
|
|
|
|
))}
|
|
|
|
onClick={() => this.tradeAsset(ridge, false)}>
|
|
|
|
</div>
|
|
|
|
<FontAwesomeIcon icon={faArrowUp} /> {ridgeNames[idx]} {'('}{player.ridges[ridge]} cows{')'}
|
|
|
|
</Col>
|
|
|
|
</Button>
|
|
|
|
</Row>
|
|
|
|
) : (<></>)}
|
|
|
|
<Row>
|
|
|
|
{' '}
|
|
|
|
<Col width="12">
|
|
|
|
</Fragment>
|
|
|
|
{Object.keys(player.ridges).map((ridge, idx) => (
|
|
|
|
))}
|
|
|
|
<Fragment key={'to-trade' + ridge}>
|
|
|
|
{this.state.sendCards.map((card, idx) => (
|
|
|
|
{(player.ridges[ridge] > 0) && toTrade[ridge] ? (
|
|
|
|
|
|
|
|
<Button className="tiny"
|
|
|
|
<Button className="tiny"
|
|
|
|
onClick={() => this.tradeAsset(ridge, false)}>
|
|
|
|
key={idx}
|
|
|
|
<FontAwesomeIcon icon={faArrowUp} /> {ridgeNames[idx]} {'('}{player.ridges[ridge]} cows{')'}
|
|
|
|
onClick={() => this.unTradeCard(card.id)}>
|
|
|
|
|
|
|
|
{card.summary}
|
|
|
|
</Button>
|
|
|
|
</Button>
|
|
|
|
) : (<></>)}
|
|
|
|
))}
|
|
|
|
{' '}
|
|
|
|
</Col>
|
|
|
|
</Fragment>
|
|
|
|
</Row>
|
|
|
|
))}
|
|
|
|
<Row>
|
|
|
|
{this.state.sendCards.map((card, idx) => (
|
|
|
|
<Col width="12">
|
|
|
|
<Button className="tiny"
|
|
|
|
<div className="trade-player-container">
|
|
|
|
key={idx}
|
|
|
|
{otherPlayer ? (
|
|
|
|
onClick={() => this.unTradeCard(card.id)}>
|
|
|
|
<div className='resource-unit-container'>
|
|
|
|
{card.summary}
|
|
|
|
{this.resources.map((o, i) => {
|
|
|
|
</Button>
|
|
|
|
let amount = o.key === 'money' ? 99 : otherPlayer.assets[o.key];
|
|
|
|
))}
|
|
|
|
if (o.key === 'cows') { amount = otherPlayer.assets.cows - playerRidgeCows(otherPlayer); }
|
|
|
|
</Col>
|
|
|
|
return (
|
|
|
|
</Row>
|
|
|
|
<ResourceUnit img={o.img ? o.img : false} h={o.h} s={o.s} label={o.label}
|
|
|
|
<Row>
|
|
|
|
key={i}
|
|
|
|
<Col width="12">
|
|
|
|
className={o.key === 'money' ? 'double-width' : false}
|
|
|
|
<div className="trade-player-container">
|
|
|
|
amount={amount - Math.max(0, toTrade[o.key])}
|
|
|
|
{otherPlayer ? (
|
|
|
|
>
|
|
|
|
<div className='resource-unit-container'>
|
|
|
|
{o.icon ? (
|
|
|
|
{this.resources.map((o, i) => {
|
|
|
|
<>
|
|
|
|
let amount = o.key === 'money' ? 99 : otherPlayer.assets[o.key];
|
|
|
|
<FontAwesomeIcon icon={o.icon} />(K)
|
|
|
|
if (o.key === 'cows') { amount = otherPlayer.assets.cows - playerRidgeCows(otherPlayer); }
|
|
|
|
<br />
|
|
|
|
return (
|
|
|
|
</>
|
|
|
|
<ResourceUnit img={o.img ? o.img : false} h={o.h} s={o.s} label={o.label}
|
|
|
|
|
|
|
|
key={i}
|
|
|
|
|
|
|
|
className={o.key === 'money' ? 'double-width' : false}
|
|
|
|
|
|
|
|
amount={amount - Math.max(0, toTrade[o.key])}
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
{o.icon ? (
|
|
|
|
|
|
|
|
<>
|
|
|
|
|
|
|
|
<FontAwesomeIcon icon={o.icon} />(K)
|
|
|
|
|
|
|
|
<br />
|
|
|
|
|
|
|
|
</>
|
|
|
|
|
|
|
|
) : ''}
|
|
|
|
|
|
|
|
{amount - Math.max(0, toTrade[o.key])}
|
|
|
|
|
|
|
|
{o.icon ? (<br />) : ''}
|
|
|
|
|
|
|
|
{!tradeProposed && ((amount - Math.max(0, toTrade[o.key])) > 0 || toTrade[o.key] < 0) ? (
|
|
|
|
|
|
|
|
<>
|
|
|
|
|
|
|
|
<Button className="tiny"
|
|
|
|
|
|
|
|
onClick={() => this.tradeAsset(o.key, o.amount)}>
|
|
|
|
|
|
|
|
<FontAwesomeIcon icon={faArrowUp} />
|
|
|
|
|
|
|
|
</Button>
|
|
|
|
|
|
|
|
{o.key === 'money' && (amount - Math.min(0, toTrade[o.key])) >= 10 ? (
|
|
|
|
|
|
|
|
<Button className="tiny"
|
|
|
|
|
|
|
|
onClick={() => this.tradeAsset(o.key, o.amount * 10)}>
|
|
|
|
|
|
|
|
<FontAwesomeIcon icon={faArrowUp} />
|
|
|
|
|
|
|
|
<FontAwesomeIcon icon={faArrowUp} />
|
|
|
|
|
|
|
|
</Button>
|
|
|
|
|
|
|
|
) : ''}
|
|
|
|
) : ''}
|
|
|
|
</>
|
|
|
|
{amount - Math.max(0, toTrade[o.key])}
|
|
|
|
) : (<></>)}
|
|
|
|
{o.icon ? (<br />) : ''}
|
|
|
|
</ResourceUnit>
|
|
|
|
{!tradeProposed && ((amount - Math.max(0, toTrade[o.key])) > 0 || toTrade[o.key] < 0) ? (
|
|
|
|
);
|
|
|
|
<>
|
|
|
|
})}
|
|
|
|
<Button className="tiny"
|
|
|
|
|
|
|
|
onClick={() => this.tradeAsset(o.key, o.amount)}>
|
|
|
|
|
|
|
|
<FontAwesomeIcon icon={faArrowUp} />
|
|
|
|
|
|
|
|
</Button>
|
|
|
|
|
|
|
|
{o.key === 'money' && (amount - Math.min(0, toTrade[o.key])) >= 10 ? (
|
|
|
|
|
|
|
|
<Button className="tiny"
|
|
|
|
|
|
|
|
onClick={() => this.tradeAsset(o.key, o.amount * 10)}>
|
|
|
|
|
|
|
|
<FontAwesomeIcon icon={faArrowUp} />
|
|
|
|
|
|
|
|
<FontAwesomeIcon icon={faArrowUp} />
|
|
|
|
|
|
|
|
</Button>
|
|
|
|
|
|
|
|
) : ''}
|
|
|
|
|
|
|
|
</>
|
|
|
|
|
|
|
|
) : (<></>)}
|
|
|
|
|
|
|
|
</ResourceUnit>
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
})}
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
) : (<></>)}
|
|
|
|
|
|
|
|
{Object.keys(otherPlayer ? otherPlayer.ridges : []).map((ridge, idx) => (
|
|
|
|
|
|
|
|
<Fragment key={'other-player-trade' + ridge}>
|
|
|
|
|
|
|
|
{!tradeProposed && ((otherPlayer.ridges[ridge] > 0) && !toTrade[ridge]) ? (
|
|
|
|
|
|
|
|
<Button className="tiny"
|
|
|
|
|
|
|
|
onClick={() => this.tradeAsset(ridge, otherPlayer.ridges[ridge], true)}>
|
|
|
|
|
|
|
|
<FontAwesomeIcon icon={faArrowUp} /> {ridgeNames[idx]} {'('}{otherPlayer.ridges[ridge]} cows{')'}
|
|
|
|
|
|
|
|
</Button>
|
|
|
|
|
|
|
|
) : (<></>)}
|
|
|
|
|
|
|
|
{' '}
|
|
|
|
|
|
|
|
</Fragment>
|
|
|
|
|
|
|
|
))}
|
|
|
|
|
|
|
|
<select onChange={this.selectPlayer}
|
|
|
|
|
|
|
|
value={otherPlayer.name}>
|
|
|
|
|
|
|
|
{this.props.game.otherPlayers.map(p => (
|
|
|
|
|
|
|
|
<option key={p.player.name} value={p.player.name}>
|
|
|
|
|
|
|
|
{p.player.name}
|
|
|
|
|
|
|
|
</option>
|
|
|
|
|
|
|
|
))}
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
{otherPlayer && otherPlayer.revealedCards.length > 0 ? (
|
|
|
|
|
|
|
|
<a onClick={e => this.viewPlayerCards(e, otherPlayer)}>
|
|
|
|
|
|
|
|
<FontAwesomeIcon icon={faWindowRestore} /> Trade Cards
|
|
|
|
|
|
|
|
</a>
|
|
|
|
|
|
|
|
) : (<></>)}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
) : (<></>)}
|
|
|
|
</Col>
|
|
|
|
{Object.keys(otherPlayer ? otherPlayer.ridges : []).map((ridge, idx) => (
|
|
|
|
</Row>
|
|
|
|
<Fragment key={'other-player-trade' + ridge}>
|
|
|
|
<Row>
|
|
|
|
{!tradeProposed && ((otherPlayer.ridges[ridge] > 0) && !toTrade[ridge]) ? (
|
|
|
|
<Col width="12">
|
|
|
|
<Button className="tiny"
|
|
|
|
{player.trade.error ? (
|
|
|
|
onClick={() => this.tradeAsset(ridge, otherPlayer.ridges[ridge], true)}>
|
|
|
|
<p><b>ERROR:</b> {player.trade.error}</p>
|
|
|
|
<FontAwesomeIcon icon={faArrowUp} /> {ridgeNames[idx]} {'('}{otherPlayer.ridges[ridge]} cows{')'}
|
|
|
|
) : (<></>)}
|
|
|
|
</Button>
|
|
|
|
{tradeProposed && player.trade.originator === player.name ? (
|
|
|
|
) : (<></>)}
|
|
|
|
<Button onClick={submitTradeCancel}>Cancel trade</Button>
|
|
|
|
{' '}
|
|
|
|
) : (<></>)}
|
|
|
|
</Fragment>
|
|
|
|
{tradeProposed && player.trade.originator !== player.name ? (
|
|
|
|
))}
|
|
|
|
<>
|
|
|
|
<select onChange={this.selectPlayer}
|
|
|
|
<Button onClick={submitTradeAccept}>Accept trade</Button>{' '}
|
|
|
|
value={otherPlayer.name}>
|
|
|
|
<Button onClick={submitTradeCancel}>Deny trade</Button>
|
|
|
|
{this.props.game.otherPlayers.map(p => (
|
|
|
|
</>
|
|
|
|
<option key={p.player.name} value={p.player.name}>
|
|
|
|
) : (<></>)}
|
|
|
|
{p.player.name}
|
|
|
|
{!tradeProposed ? (
|
|
|
|
</option>
|
|
|
|
<Button onClick={this.propose}>Propose Trade</Button>
|
|
|
|
))}
|
|
|
|
) : (<></>)}
|
|
|
|
</select>
|
|
|
|
</Col>
|
|
|
|
{otherPlayer && otherPlayer.revealedCards.length > 0 ? (
|
|
|
|
</Row>
|
|
|
|
<a onClick={e => this.viewPlayerCards(e, otherPlayer)}>
|
|
|
|
</>)}
|
|
|
|
<FontAwesomeIcon icon={faWindowRestore} /> Trade Cards
|
|
|
|
|
|
|
|
</a>
|
|
|
|
|
|
|
|
) : (<></>)}
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
|
|
</Row>
|
|
|
|
|
|
|
|
<Row>
|
|
|
|
|
|
|
|
<Col width="12">
|
|
|
|
|
|
|
|
{player.trade.error ? (
|
|
|
|
|
|
|
|
<p><b>ERROR:</b> {player.trade.error}</p>
|
|
|
|
|
|
|
|
) : (<></>)}
|
|
|
|
|
|
|
|
{tradeProposed && player.trade.originator === player.name ? (
|
|
|
|
|
|
|
|
<Button onClick={submitTradeCancel}>Cancel trade</Button>
|
|
|
|
|
|
|
|
) : (<></>)}
|
|
|
|
|
|
|
|
{tradeProposed && player.trade.originator !== player.name ? (
|
|
|
|
|
|
|
|
<>
|
|
|
|
|
|
|
|
<Button onClick={submitTradeAccept}>Accept trade</Button>{' '}
|
|
|
|
|
|
|
|
<Button onClick={submitTradeCancel}>Deny trade</Button>
|
|
|
|
|
|
|
|
</>
|
|
|
|
|
|
|
|
) : (<></>)}
|
|
|
|
|
|
|
|
{!tradeProposed ? (
|
|
|
|
|
|
|
|
<Button onClick={this.propose}>Propose Trade</Button>
|
|
|
|
|
|
|
|
) : (<></>)}
|
|
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
|
|
</Row>
|
|
|
|
|
|
|
|
</>)}
|
|
|
|
|
|
|
|
</GroupBox>
|
|
|
|
</GroupBox>
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1340,7 +1341,7 @@ class Harvest extends React.Component {
|
|
|
|
Get ready to harvest <b>{this.props.acres}
|
|
|
|
Get ready to harvest <b>{this.props.acres}
|
|
|
|
{this.props.crop === 'cows' ? ' head of cow' : ' acres'}</b>!
|
|
|
|
{this.props.crop === 'cows' ? ' head of cow' : ' acres'}</b>!
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{isCurrentPlayer ? (
|
|
|
|
{isCurrentPlayer || this.props.currentPlayer.ai ? (
|
|
|
|
<Button onClick={() => this.nextView('roll')}>
|
|
|
|
<Button onClick={() => this.nextView('roll')}>
|
|
|
|
Roll for harvest!
|
|
|
|
Roll for harvest!
|
|
|
|
</Button>
|
|
|
|
</Button>
|
|
|
@ -1356,7 +1357,7 @@ class Harvest extends React.Component {
|
|
|
|
view = (<Die decay={true} num={this.props.rolled} ms={2000} roll={true}
|
|
|
|
view = (<Die decay={true} num={this.props.rolled} ms={2000} roll={true}
|
|
|
|
rolls={this.props.rolls}
|
|
|
|
rolls={this.props.rolls}
|
|
|
|
showScreen={() => this.nextView('income')}
|
|
|
|
showScreen={() => this.nextView('income')}
|
|
|
|
skip={this.props.player.name === this.props.game.currentPlayer}
|
|
|
|
skip={this.props.player.name === this.props.game.currentPlayer || this.props.currentPlayer.ai}
|
|
|
|
autoSkip={this.props.autoSkip === 'die'}
|
|
|
|
autoSkip={this.props.autoSkip === 'die'}
|
|
|
|
showScreenDelay={2000} />);
|
|
|
|
showScreenDelay={2000} />);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -1372,7 +1373,7 @@ class Harvest extends React.Component {
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{isCurrentPlayer ? (
|
|
|
|
{isCurrentPlayer || this.props.currentPlayer.ai ? (
|
|
|
|
<div className='center spacer'>
|
|
|
|
<div className='center spacer'>
|
|
|
|
<Button onClick={() => this.nextView('operating-expense')}>Draw Operating Expense</Button>
|
|
|
|
<Button onClick={() => this.nextView('operating-expense')}>Draw Operating Expense</Button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
@ -1389,7 +1390,7 @@ class Harvest extends React.Component {
|
|
|
|
dangerouslySetInnerHTML={{__html: this.props.contents}} />
|
|
|
|
dangerouslySetInnerHTML={{__html: this.props.contents}} />
|
|
|
|
</GroupBox>
|
|
|
|
</GroupBox>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{isCurrentPlayer ? (
|
|
|
|
{isCurrentPlayer || this.props.currentPlayer.ai ? (
|
|
|
|
<div className='center spacer'>
|
|
|
|
<div className='center spacer'>
|
|
|
|
<Button onClick={() => this.nextView('expense-value')}>Continue</Button>
|
|
|
|
<Button onClick={() => this.nextView('expense-value')}>Continue</Button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
@ -1424,7 +1425,7 @@ class Harvest extends React.Component {
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{isCurrentPlayer ?
|
|
|
|
{isCurrentPlayer || this.props.currentPlayer.ai ?
|
|
|
|
(
|
|
|
|
(
|
|
|
|
<div className='center spacer'>
|
|
|
|
<div className='center spacer'>
|
|
|
|
<Button onClick={this.props.nextAction}>Continue</Button>
|
|
|
|
<Button onClick={this.props.nextAction}>Continue</Button>
|
|
|
@ -1488,7 +1489,7 @@ class Action extends React.Component {
|
|
|
|
|
|
|
|
|
|
|
|
bertSubmit = (e) => {
|
|
|
|
bertSubmit = (e) => {
|
|
|
|
e.preventDefault();
|
|
|
|
e.preventDefault();
|
|
|
|
if (this.state.bertChoice === 'accept') {
|
|
|
|
if (this.state.bertChoice === 'accept' || this.props.currentPlayer.ai) {
|
|
|
|
buyUncleBert();
|
|
|
|
buyUncleBert();
|
|
|
|
this.props.showNextAction();
|
|
|
|
this.props.showNextAction();
|
|
|
|
} else if (this.state.bertChoice === 'deny') {
|
|
|
|
} else if (this.state.bertChoice === 'deny') {
|
|
|
@ -1550,6 +1551,11 @@ class Action extends React.Component {
|
|
|
|
</form>
|
|
|
|
</form>
|
|
|
|
</>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
const aiButton = (
|
|
|
|
|
|
|
|
<form onSubmit={this.bertSubmit}>
|
|
|
|
|
|
|
|
<Button type="submit">Continue</Button>
|
|
|
|
|
|
|
|
</form>
|
|
|
|
|
|
|
|
);
|
|
|
|
view = (
|
|
|
|
view = (
|
|
|
|
<GroupBox title={`Uncle Bert's inheritance`}>
|
|
|
|
<GroupBox title={`Uncle Bert's inheritance`}>
|
|
|
|
<div className='center'>
|
|
|
|
<div className='center'>
|
|
|
@ -1567,6 +1573,7 @@ class Action extends React.Component {
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
{(this.props.player.name === this.props.game.currentPlayer) ?
|
|
|
|
{(this.props.player.name === this.props.game.currentPlayer) ?
|
|
|
|
ffButtons : (<Fragment />)}
|
|
|
|
ffButtons : (<Fragment />)}
|
|
|
|
|
|
|
|
{currentPlayer.ai ? aiButton : (<></>)}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</GroupBox>
|
|
|
|
</GroupBox>
|
|
|
@ -1937,6 +1944,11 @@ class StartGame extends React.Component {
|
|
|
|
): (<></>)}
|
|
|
|
): (<></>)}
|
|
|
|
</li>
|
|
|
|
</li>
|
|
|
|
))}
|
|
|
|
))}
|
|
|
|
|
|
|
|
<li>
|
|
|
|
|
|
|
|
<span className="add-ai" onClick={addAIPlayer}>
|
|
|
|
|
|
|
|
<FontAwesomeIcon icon={faPlusCircle} />AI
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</ul>
|
|
|
|
<h4>Game Settings</h4>
|
|
|
|
<h4>Game Settings</h4>
|
|
|
|
<ul>
|
|
|
|
<ul>
|
|
|
|