Skip to content

Commit

Permalink
Merge branch 'feat-mvp' of github.com:Mississippi-Labs/mississippi in…
Browse files Browse the repository at this point in the history
…to feat-mvp
  • Loading branch information
LidamaoHub committed Oct 22, 2023
2 parents d95c222 + 7708592 commit 523a2ec
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion packages/client/src/pages/game/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,20 @@ const Game = () => {
setStartBattleData(false);
if (e == 1) {
console.log('win');
getWinTreasureChest(targetPlayer.gem)
let treasureChestData = treasureChest
console.log(treasureChestData, treasureChestData[treasureChestData.length - 1]);
let item = {
id: treasureChestData.length ? treasureChestData[treasureChestData.length - 1].id + 1 : 1,
x: targetPlayer.x,
y: targetPlayer.y,
gem: targetPlayer.gem
}
treasureChestData.push(item)
let targetPlayerIndex = players.findIndex((item) => item.x === targetPlayer.x && item.y === targetPlayer.y);
players.splice(targetPlayerIndex, 1);
setTreasureChest([...treasureChestData]);
setPlayers([...players]);
// getWinTreasureChest(targetPlayer.gem)
setTargetPlayer(null);
} else if (e == 2) {
console.log('lose');
Expand Down

0 comments on commit 523a2ec

Please sign in to comment.