Commit fd10aa4d authored by Chunchi Che's avatar Chunchi Che

Merge branch 'feat/swap_grave_deck' into 'main'

Feat/swap grave deck

See merge request mycard/Neos!240
parents 9f145997 aaf22ab7
Pipeline #22549 passed with stages
in 14 minutes and 26 seconds
neos-protobuf @ 2b7892f4
Subproject commit 70d4b723250a24084b3fa5dcfb550431e29ea7e3
Subproject commit 2b7892f461be231b95ccc3c13512359177f3bb98
This diff is collapsed.
......@@ -225,5 +225,14 @@
"fieldType": "uint8"
}
]
},
"35": {
"protoType": "swap_grave_deck",
"fields": [
{
"fieldName": "player",
"fieldType": "uint8"
}
]
}
}
......@@ -36,6 +36,7 @@ const MsgConstructorMap: Map<string, Constructor> = new Map([
["become_target", ygopro.StocGameMessage.MsgBecomeTarget],
["shuffle_deck", ygopro.StocGameMessage.MsgShuffleDeck],
["rock_paper_scissors", ygopro.StocGameMessage.MsgRockPaperScissors],
["swap_grave_deck", ygopro.StocGameMessage.MsgSwapGraveDeck],
]);
export interface penetrateType {
......
......@@ -47,6 +47,7 @@ import onMsgStart from "./start";
import onMsgSummoned from "./summoned";
import onMsgSummoning from "./summoning";
import onMsgSwap from "./swap";
import onMsgSwapGraveDeck from "./swapGraveDeck";
import onMsgToss from "./toss";
import onUnimplemented from "./unimplemented";
import onMsgUpdateCounter from "./updateCounter";
......@@ -339,6 +340,11 @@ async function _handleGameMsg(pb: ygopro.YgoStocMsg) {
break;
}
case "swap_grave_deck": {
await onMsgSwapGraveDeck(msg.swap_grave_deck);
break;
}
case "unimplemented": {
onUnimplemented(msg.unimplemented);
......
import { ygopro } from "@/api";
import { eventbus, Task } from "@/infra";
import { cardStore } from "@/stores";
import MsgSwapGraveDeck = ygopro.StocGameMessage.MsgSwapGraveDeck;
const { DECK, GRAVE } = ygopro.CardZone;
export default async (swapGraveDeck: MsgSwapGraveDeck) => {
const player = swapGraveDeck.player;
const deck = cardStore.at(DECK, player);
const grave = cardStore.at(GRAVE, player);
for (const card of deck) {
card.location.zone = GRAVE;
await eventbus.call(Task.Move, card.uuid);
}
for (const card of grave) {
card.location.zone = DECK;
await eventbus.call(Task.Move, card.uuid);
}
};
......@@ -4,7 +4,6 @@
top: 0;
left: 0;
height: 100vh; // FIXME: 100% on safari
display: flex;
flex-direction: column;
justify-content: space-between;
padding: 20px 35px;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment