123
This commit is contained in:
@ -1592,25 +1592,16 @@
|
||||
return;
|
||||
}
|
||||
|
||||
// Специальная обработка для Грабежа - открываем модальное окно
|
||||
// Специальная обработка для Грабежа - отправляем playSpell на сервер
|
||||
const spellCard = cardDb[spellMode.cardId];
|
||||
if (spellCard && spellCard.spellEffect === 'steal_cards' && (spellCard.spellTarget === 'enemy_player' || spellCard.spellTarget === 'enemy_board')) {
|
||||
// Выбираем противника (tp должен быть индексом противника, tb игнорируем для enemy_player)
|
||||
if (tp !== state.yourIndex && tp >= 0) {
|
||||
const targetPlayer = state.players[tp];
|
||||
if (targetPlayer && targetPlayer.board && targetPlayer.board.length > 0) {
|
||||
stealCardsMode.active = true;
|
||||
stealCardsMode.handIndex = spellMode.handIndex;
|
||||
stealCardsMode.targetPlayerIndex = tp;
|
||||
// Получаем актуальную доску из gameState
|
||||
stealCardsMode.targetDeck = targetPlayer.board ? targetPlayer.board.map(m => m.cardId) : [];
|
||||
stealCardsMode.selectedIndices = [];
|
||||
showStealCardsModal(state, {
|
||||
targetPlayerIndex: tp,
|
||||
targetPlayerName: targetPlayer.name || `Игрок ${tp + 1}`,
|
||||
targetBoardSize: targetPlayer.board.length,
|
||||
maxCards: Math.min(2, targetPlayer.board.length)
|
||||
});
|
||||
// Отправляем playSpell на сервер, чтобы сервер знал о выборе противника
|
||||
socket.emit('playSpell', { handIndex: spellMode.handIndex, targetPlayerIndex: tp, targetBoardIndex: null });
|
||||
// Сервер отправит stealCardsRequest, который откроет модальное окно
|
||||
spellMode = { active: false, handIndex: -1, cardId: '', spellTarget: '' };
|
||||
$('spell-mode')?.classList.add('hidden');
|
||||
return;
|
||||
@ -1635,24 +1626,15 @@
|
||||
var tp = parseInt(el.dataset.dropPlayer ?? el.dataset.playerIndex, 10);
|
||||
var tb = parseInt(el.dataset.dropBoard ?? el.dataset.boardIndex, 10);
|
||||
|
||||
// Специальная обработка для Грабежа
|
||||
// Специальная обработка для Грабежа - отправляем playSpell на сервер
|
||||
const spellCard = cardDb[spellMode.cardId];
|
||||
if (spellCard && spellCard.spellEffect === 'steal_cards' && (spellCard.spellTarget === 'enemy_player' || spellCard.spellTarget === 'enemy_board')) {
|
||||
if (tp !== state.yourIndex && tp >= 0) {
|
||||
const targetPlayer = state.players[tp];
|
||||
if (targetPlayer && targetPlayer.board && targetPlayer.board.length > 0) {
|
||||
stealCardsMode.active = true;
|
||||
stealCardsMode.handIndex = spellMode.handIndex;
|
||||
stealCardsMode.targetPlayerIndex = tp;
|
||||
// Получаем актуальную доску из gameState
|
||||
stealCardsMode.targetDeck = targetPlayer.board ? targetPlayer.board.map(m => m.cardId) : [];
|
||||
stealCardsMode.selectedIndices = [];
|
||||
showStealCardsModal(state, {
|
||||
targetPlayerIndex: tp,
|
||||
targetPlayerName: targetPlayer.name || `Игрок ${tp + 1}`,
|
||||
targetBoardSize: targetPlayer.board.length,
|
||||
maxCards: Math.min(2, targetPlayer.board.length)
|
||||
});
|
||||
// Отправляем playSpell на сервер, чтобы сервер знал о выборе противника
|
||||
socket.emit('playSpell', { handIndex: spellMode.handIndex, targetPlayerIndex: tp, targetBoardIndex: null });
|
||||
// Сервер отправит stealCardsRequest, который откроет модальное окно
|
||||
spellMode = { active: false, handIndex: -1, cardId: '', spellTarget: '' };
|
||||
$('spell-mode')?.classList.add('hidden');
|
||||
return;
|
||||
@ -1711,18 +1693,9 @@
|
||||
if (tp === state.yourIndex || tp < 0) return;
|
||||
const targetPlayer = state.players[tp];
|
||||
if (targetPlayer && targetPlayer.board && targetPlayer.board.length > 0) {
|
||||
stealCardsMode.active = true;
|
||||
stealCardsMode.handIndex = spellMode.handIndex;
|
||||
stealCardsMode.targetPlayerIndex = tp;
|
||||
// Получаем актуальную доску из gameState
|
||||
stealCardsMode.targetDeck = targetPlayer.board ? targetPlayer.board.map(m => m.cardId) : [];
|
||||
stealCardsMode.selectedIndices = [];
|
||||
showStealCardsModal(state, {
|
||||
targetPlayerIndex: tp,
|
||||
targetPlayerName: targetPlayer.name || `Игрок ${tp + 1}`,
|
||||
targetBoardSize: targetPlayer.board.length,
|
||||
maxCards: Math.min(2, targetPlayer.board.length)
|
||||
});
|
||||
// Отправляем playSpell на сервер, чтобы сервер знал о выборе противника
|
||||
socket.emit('playSpell', { handIndex: spellMode.handIndex, targetPlayerIndex: tp, targetBoardIndex: null });
|
||||
// Сервер отправит stealCardsRequest, который откроет модальное окно
|
||||
spellMode = { active: false, handIndex: -1, cardId: '', spellTarget: '' };
|
||||
$('spell-mode')?.classList.add('hidden');
|
||||
}
|
||||
@ -1740,18 +1713,9 @@
|
||||
if (tp === state.yourIndex || tp < 0) return;
|
||||
const targetPlayer = state.players[tp];
|
||||
if (targetPlayer && targetPlayer.board && targetPlayer.board.length > 0) {
|
||||
stealCardsMode.active = true;
|
||||
stealCardsMode.handIndex = spellMode.handIndex;
|
||||
stealCardsMode.targetPlayerIndex = tp;
|
||||
// Получаем актуальную доску из gameState
|
||||
stealCardsMode.targetDeck = targetPlayer.board ? targetPlayer.board.map(m => m.cardId) : [];
|
||||
stealCardsMode.selectedIndices = [];
|
||||
showStealCardsModal(state, {
|
||||
targetPlayerIndex: tp,
|
||||
targetPlayerName: targetPlayer.name || `Игрок ${tp + 1}`,
|
||||
targetBoardSize: targetPlayer.board.length,
|
||||
maxCards: Math.min(2, targetPlayer.board.length)
|
||||
});
|
||||
// Отправляем playSpell на сервер, чтобы сервер знал о выборе противника
|
||||
socket.emit('playSpell', { handIndex: spellMode.handIndex, targetPlayerIndex: tp, targetBoardIndex: null });
|
||||
// Сервер отправит stealCardsRequest, который откроет модальное окно
|
||||
spellMode = { active: false, handIndex: -1, cardId: '', spellTarget: '' };
|
||||
$('spell-mode')?.classList.add('hidden');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user