38 lines
878 B
TypeScript
38 lines
878 B
TypeScript
import { MutationTree } from "vuex";
|
|
import { DraftState, PlayerStatus } from "./types";
|
|
import { Card } from "@/mlpccg";
|
|
|
|
const mutations: MutationTree<DraftState> = {
|
|
playerPicked(state, payload: { name: string; picked: boolean }) {
|
|
const idx = state.pod.findIndex(p => p.name == payload.name);
|
|
state.pod[idx].picked = payload.picked;
|
|
},
|
|
|
|
resetPickStatus(state) {
|
|
state.pod = state.pod.map(p => ({ ...p, picked: false }));
|
|
},
|
|
|
|
setCardPool(state, pool: Card[]) {
|
|
state.cards = pool;
|
|
},
|
|
|
|
setPackInfo(state, payload: { current: number; total: number }) {
|
|
state.currentPack = payload.current;
|
|
state.packCount = payload.total;
|
|
},
|
|
|
|
addPicks(state, pick: Card) {
|
|
state.picks.push(pick);
|
|
},
|
|
|
|
setPod(state, pod: PlayerStatus[]) {
|
|
state.pod = pod;
|
|
},
|
|
|
|
resetPicks(state) {
|
|
state.picks = [];
|
|
}
|
|
};
|
|
|
|
export default mutations;
|