Commit c72ba4ee authored by Chunchi Che's avatar Chunchi Che

update attackTarget

parent a4236002
......@@ -8,11 +8,6 @@ export default async (attack: ygopro.StocGameMessage.MsgAttack) => {
location: attack.attacker_location,
});
// const attacker = matStore
// .in(attack.attacker_location.location)
// .of(attack.attacker_location.controler)
// .at(attack.attacker_location.sequence);
const attacker = cardStore.at(
attack.attacker_location.location,
attack.attacker_location.controler,
......@@ -26,11 +21,6 @@ export default async (attack: ygopro.StocGameMessage.MsgAttack) => {
await sleep(500);
attacker.directAttack = false;
} else {
// const target = matStore
// .in(attack.target_location.location)
// .of(attack.target_location.controler)
// .at(attack.target_location.sequence);
const target = cardStore.at(
attack.target_location.location,
attack.target_location.controler,
......@@ -39,7 +29,6 @@ export default async (attack: ygopro.StocGameMessage.MsgAttack) => {
if (target) {
attacker.attackTarget = {
sequence: attack.target_location.sequence, // FIXME: 确实会覆盖,代码这样没错吗
opponent: !matStore.isMe(attack.target_location.controler),
...target,
};
......
import { CardData, CardText, fetchCard, ygopro } from "@/api";
import { proxy } from "valtio";
import { CardData, CardText, fetchCard, ygopro } from "@/api";
import type { Interactivity } from "./matStore/types";
/**
......@@ -33,7 +35,7 @@ export interface CardType {
chainIndex?: number /*连锁的序号,如果为空表示不在连锁
TODO: 目前是妥协的设计,因为其实一张卡是可以在同一个连锁链中被连锁多次的,这里为了避免太过复杂只保存最后的连锁序号*/;
directAttack: boolean; // 是否正在直接攻击为玩家
attackTarget?: CardType & { sequence: number; opponent: boolean }; // 攻击目标。(嵌套结构可行么?)
attackTarget?: CardType & { opponent: boolean }; // 攻击目标。(嵌套结构可行么?)
}
class CardStore {
......
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