1
0

Fixed broken trading with bank

Signed-off-by: James Ketrenos <james_eikona@ketrenos.com>
This commit is contained in:
James Ketrenos 2022-03-03 18:14:44 -08:00
parent 287d2a1551
commit 0b540cd5ec
3 changed files with 15 additions and 6 deletions

View File

@ -104,7 +104,11 @@ const Trade = ({table}) => {
const canMeetOffer = (player, offer) => {
for (let i = 0; i < offer.gets.length; i++) {
const get = offer.gets[i];
if (player[get.type] < get.count) {
if (get.type === 'bank') {
if (player[player.gives[0].type] < get.count) {
return false;
}
} else if (player[get.type] < get.count) {
return false;
}
}
@ -291,6 +295,7 @@ const Trade = ({table}) => {
if (item.self) {
/* Order direction is reversed for self */
source = {
name: item.name,
gets: trade.gives,
gives: trade.gets
};

View File

@ -60,8 +60,8 @@ const ViewCard = ({table, card}) => {
break;
case 'progress-monopoly':
description = <>
When you play this card, you will select <b>1</b> type of resource.
All other players must give you all their resource cards of that type.
<p>When you play this card, you will select <b>1</b> type of resource.
All other players must give you all their resource cards of that type.</p>
</>;
break;
case 'progress-year-of-plenty':

View File

@ -1299,7 +1299,11 @@ const getValidRoads = (game, color) => {
const canMeetOffer = (player, offer) => {
for (let i = 0; i < offer.gets.length; i++) {
const get = offer.gets[i];
if (player[get.type] < get.count) {
if (get.type === 'bank') {
if (player[player.gives[0].type] < get.count) {
return false;
}
} else if (player[get.type] < get.count) {
return false;
}
}