Commit 87cc4ada authored by Chunchi Che's avatar Chunchi Che

fix chainSolved

parent 593de382
import { ygopro } from "@/api"; import { ygopro } from "@/api";
import { matStore } from "@/stores"; import { cardStore, matStore } from "@/stores";
// FIXME: 处理连锁会存在三种结果: // FIXME: 处理连锁会存在三种结果:
// 1. Solved - 已处理; // 1. Solved - 已处理;
...@@ -15,7 +15,12 @@ export default async (chainSolved: ygopro.StocGameMessage.MsgChainSolved) => { ...@@ -15,7 +15,12 @@ export default async (chainSolved: ygopro.StocGameMessage.MsgChainSolved) => {
.at(0); .at(0);
if (location) { if (location) {
// 设置被连锁状态为空,解除连锁 // 设置被连锁状态为空,解除连锁
matStore.setChained(location, undefined); const target = cardStore.find(location);
if (target) {
target.chainIndex = undefined;
} else {
console.log(`<ChainSolved>target from ${location} is null`);
}
} else { } else {
console.warn( console.warn(
`pop from chains return null! solved_index=${chainSolved.solved_index}, len of chains in store=${matStore.chains.length}` `pop from chains return null! solved_index=${chainSolved.solved_index}, len of chains in store=${matStore.chains.length}`
......
...@@ -23,6 +23,6 @@ export default async (chaining: ygopro.StocGameMessage.MsgChaining) => { ...@@ -23,6 +23,6 @@ export default async (chaining: ygopro.StocGameMessage.MsgChaining) => {
if (target) { if (target) {
target.chainIndex = matStore.chains.length; target.chainIndex = matStore.chains.length;
} else { } else {
console.warn(`<chaining>target from ${location} is null`); console.warn(`<Chaining>target from ${location} is null`);
} }
}; };
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