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

fix selectCounter, selectIdleCmd and selectPlace

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