Fixed broken trading with bank
Signed-off-by: James Ketrenos <james_eikona@ketrenos.com>
This commit is contained in:
parent
287d2a1551
commit
0b540cd5ec
@ -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
|
||||
};
|
||||
@ -298,11 +303,11 @@ const Trade = ({table}) => {
|
||||
source = item;
|
||||
}
|
||||
const _gets = source.gets.length ? source.gets.map((get, index) => <div key={`get-${get.type}-${index}`}>
|
||||
{ get.type === 'bank' && <div key={`get-bank-${index}`}><b>4</b> of any resource</div>}
|
||||
{ get.type === 'bank' && <div key={`get-bank-${index}`}><b>4</b> of any resource </div>}
|
||||
{ get.type !== 'bank' && <Resource key={`get-${get.type}-${index}`} disabled label type={get.type} count={get.count}/> }
|
||||
</div>) : 'nothing',
|
||||
_gives = source.gives.length ? source.gives.map((give, index) => <div key={`give-${give.type}-${index}`}>
|
||||
{ give.type === '*' && <><b>1</b> of any resource</>}
|
||||
{ give.type === '*' && <><b>1</b> of any resource </>}
|
||||
{ give.type !== '*' && <Resource disabled label type={give.type} count={give.count}/> }
|
||||
</div>) : 'nothing';
|
||||
|
||||
|
@ -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':
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user