Commit 0ce53436 authored by Chunchi Che's avatar Chunchi Che

fix selectCounter, selectIdleCmd and selectPlace

parent dca9b416
import { ygopro } from "@/api"; import { ygopro } from "@/api";
import { getCardByLocation, messageStore } from "@/stores"; import { cardStore, messageStore } from "@/stores";
type MsgSelectCounter = ygopro.StocGameMessage.MsgSelectCounter; type MsgSelectCounter = ygopro.StocGameMessage.MsgSelectCounter;
export default (selectCounter: MsgSelectCounter) => { export default (selectCounter: MsgSelectCounter) => {
...@@ -7,7 +7,7 @@ export default (selectCounter: MsgSelectCounter) => { ...@@ -7,7 +7,7 @@ export default (selectCounter: MsgSelectCounter) => {
messageStore.checkCounterModal.min = selectCounter.min; messageStore.checkCounterModal.min = selectCounter.min;
messageStore.checkCounterModal.options = selectCounter.options!.map( messageStore.checkCounterModal.options = selectCounter.options!.map(
({ location, code, counter_count }) => { ({ location, code, counter_count }) => {
const id = getCardByLocation(location)?.occupant?.id; const id = cardStore.find(location)?.code;
const newCode = code ? code : id || 0; const newCode = code ? code : id || 0;
return { return {
......
import { ygopro } from "@/api"; import { ygopro } from "@/api";
import { import {
cardStore, cardStore,
clearAllIdleInteractivities as clearAllIdleInteractivities,
type Interactivity, type Interactivity,
InteractType, InteractType,
matStore, matStore,
...@@ -14,7 +13,6 @@ export default (selectIdleCmd: MsgSelectIdleCmd) => { ...@@ -14,7 +13,6 @@ export default (selectIdleCmd: MsgSelectIdleCmd) => {
const cmds = selectIdleCmd.idle_cmds; const cmds = selectIdleCmd.idle_cmds;
// 先清掉之前的互动性 // 先清掉之前的互动性
clearAllIdleInteractivities(player);
cardStore.inner.forEach((card) => { cardStore.inner.forEach((card) => {
card.idleInteractivities = []; card.idleInteractivities = [];
}); });
...@@ -33,19 +31,18 @@ export default (selectIdleCmd: MsgSelectIdleCmd) => { ...@@ -33,19 +31,18 @@ export default (selectIdleCmd: MsgSelectIdleCmd) => {
[InteractType.ACTIVATE]: { activateIndex: data.effect_description }, [InteractType.ACTIVATE]: { activateIndex: data.effect_description },
}; };
const tmp = map[interactType]; const tmp = map[interactType];
matStore const target = cardStore.at(location, player, sequence);
.in(location) if (target) {
.of(player) target.idleInteractivities.push({
.addIdleInteractivity(sequence, {
...tmp, ...tmp,
interactType, interactType,
response: data.response, response: data.response,
}); });
cardStore.at(location, player, sequence).idleInteractivities.push({ } else {
...tmp, console.warn(
interactType, `target from zone=${location}, controller=${player}, sequence=${sequence} is null`
response: data.response, );
}); }
} else { } else {
console.warn(`Undefined InteractType`); console.warn(`Undefined InteractType`);
} }
......
import { ygopro } from "@/api"; import { ygopro } from "@/api";
import { InteractType, matStore, placeStore } from "@/stores"; import { InteractType, placeStore } from "@/stores";
type MsgSelectPlace = ygopro.StocGameMessage.MsgSelectPlace; type MsgSelectPlace = ygopro.StocGameMessage.MsgSelectPlace;
...@@ -24,30 +24,4 @@ export default (selectPlace: MsgSelectPlace) => { ...@@ -24,30 +24,4 @@ export default (selectPlace: MsgSelectPlace) => {
break; break;
} }
} }
for (const place of selectPlace.places) {
switch (place.zone) {
case ygopro.CardZone.MZONE: {
matStore.monsters
.of(place.controler)
.setPlaceInteractivityType(
place.sequence,
InteractType.PLACE_SELECTABLE
);
break;
}
case ygopro.CardZone.SZONE: {
matStore.magics
.of(place.controler)
.setPlaceInteractivityType(
place.sequence,
InteractType.PLACE_SELECTABLE
);
break;
}
default: {
console.warn(`Unhandled zoneType: ${place.zone}`);
}
}
}
}; };
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