修改机器人的出牌逻辑
This commit is contained in:
parent
94a123f7e6
commit
b048727ac3
@ -168,13 +168,24 @@ export class Robot {
|
|||||||
if (!cards) {
|
if (!cards) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let cardIds = cards.map(o => o.id);
|
let cardIds: number[] = [];
|
||||||
// let cardIds = [cardArr[0].id]
|
let hasEatCard = false;
|
||||||
|
for (let card of cards) {
|
||||||
|
if (!targetCard || (targetCard && card.id !== targetCard.id)) {
|
||||||
|
cardIds.push(card.id);
|
||||||
|
}
|
||||||
|
if (targetCard && card.id == targetCard.id) {
|
||||||
|
hasEatCard = true
|
||||||
|
}
|
||||||
|
}
|
||||||
log(`discard: ${self.sessionId} ${cardIds}`);
|
log(`discard: ${self.sessionId} ${cardIds}`);
|
||||||
self.reply('discard_card_c2s', {
|
let repData: any = {
|
||||||
cards: cardIds,
|
cards: cardIds
|
||||||
target: targetCard.id
|
}
|
||||||
});
|
if (hasEatCard) {
|
||||||
|
repData.target = targetCard.id
|
||||||
|
}
|
||||||
|
self.reply('discard_card_c2s', repData);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -145,12 +145,24 @@ export class RobotClient implements Client {
|
|||||||
if (!cards) {
|
if (!cards) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let cardIds = cards.map(o => o.id);
|
let cardIds: number[] = [];
|
||||||
|
let hasEatCard = false;
|
||||||
|
for (let card of cards) {
|
||||||
|
if (!targetCard || (targetCard && card.id !== targetCard.id)) {
|
||||||
|
cardIds.push(card.id);
|
||||||
|
}
|
||||||
|
if (targetCard && card.id == targetCard.id) {
|
||||||
|
hasEatCard = true
|
||||||
|
}
|
||||||
|
}
|
||||||
log(`discard: ${self.sessionId} ${cardIds}`);
|
log(`discard: ${self.sessionId} ${cardIds}`);
|
||||||
self.reply('discard_card_c2s', {
|
let repData: any = {
|
||||||
cards: cardIds,
|
cards: cardIds
|
||||||
target: targetCard.id
|
}
|
||||||
});
|
if (hasEatCard) {
|
||||||
|
repData.target = targetCard.id
|
||||||
|
}
|
||||||
|
self.reply('discard_card_c2s', repData);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user