Commit 5af04b89 authored by Chunchi Che's avatar Chunchi Che

fix fetchCheckCardMeta and spring focus

parent f7897383
Pipeline #23398 passed with stages
in 18 minutes and 42 seconds
...@@ -25,11 +25,19 @@ const helper = async ( ...@@ -25,11 +25,19 @@ const helper = async (
selected?: boolean, selected?: boolean,
mustSelect?: boolean, mustSelect?: boolean,
) => { ) => {
const controller = location.controller; const { controller, zone, sequence } = location;
const target = cardStore.at(zone, controller, sequence);
// 这里可能直接用target.meta即可,不用再查一遍DB
// 但是ygopro后端传回来了code,感觉这里会有些坑,因此求稳这样写
const newID = const newID =
code !== 0 code !== 0
? code ? code
: cardStore.at(location.zone, controller, location.sequence)?.code || 0; : target !== undefined
? target.code !== 0
? target.code
: target.meta.id
: 0;
const meta = fetchCard(newID); const meta = fetchCard(newID);
const effectDesc = effect_description const effectDesc = effect_description
......
...@@ -9,7 +9,8 @@ export const focus = async (props: { card: CardType; api: SpringApi }) => { ...@@ -9,7 +9,8 @@ export const focus = async (props: { card: CardType; api: SpringApi }) => {
const { card, api } = props; const { card, api } = props;
if ( if (
card.location.zone === ygopro.CardZone.HAND || card.location.zone === ygopro.CardZone.HAND ||
card.location.zone === ygopro.CardZone.DECK card.location.zone === ygopro.CardZone.DECK ||
card.location.zone === ygopro.CardZone.EXTRA
) { ) {
const current = { ...api.current[0].get() }; const current = { ...api.current[0].get() };
await asyncStart(api)({ await asyncStart(api)({
......
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