Commit 131e1918 authored by chechunchi's avatar chechunchi

remove attack related props in CardType

parent c326d28b
Pipeline #22133 passed with stages
in 13 minutes and 26 seconds
import { ygopro } from "@/api";
import { cardStore, fetchEsHintMeta, matStore } from "@/stores";
import { cardStore, fetchEsHintMeta } from "@/stores";
export default async (attack: ygopro.StocGameMessage.MsgAttack) => {
fetchEsHintMeta({
......@@ -15,10 +15,7 @@ export default async (attack: ygopro.StocGameMessage.MsgAttack) => {
if (attacker) {
if (attack.direct_attack) {
attacker.directAttack = true;
// await sleep(500);
attacker.directAttack = false;
// TODO: 实现直接攻击的动画
} else {
const target = cardStore.at(
attack.target_location.zone,
......@@ -27,14 +24,12 @@ export default async (attack: ygopro.StocGameMessage.MsgAttack) => {
);
if (target) {
attacker.attackTarget = {
opponent: !matStore.isMe(attack.target_location.controller),
...target,
};
// await sleep(500);
attacker.attackTarget = undefined;
// TODO: 实现攻击`target`的动画
} else {
console.warn(`<Attack>target from ${attack.target_location} is null`);
}
}
} else {
console.warn(`<Attack>attacker from ${attack.attacker_location} is null`);
}
};
......@@ -64,7 +64,6 @@ export default async (start: ygopro.StocGameMessage.MsgStart) => {
},
isToken: !((i + 1) % 3),
chaining: false,
directAttack: false,
})
)
)
......
......@@ -23,12 +23,9 @@ export interface CardType {
reload?: boolean; // 这个字段会在收到MSG_RELOAD_FIELD的时候设置成true,在收到MSG_UPDATE_DATE的时候设置成false
isToken: boolean; // 是否是token
// 新的字段(从matstore之中搬过来的)
chaining: boolean; // 是否在连锁中
chainIndex?: number /*连锁的序号,如果为空表示不在连锁
TODO: 目前是妥协的设计,因为其实一张卡是可以在同一个连锁链中被连锁多次的,这里为了避免太过复杂只保存最后的连锁序号*/;
directAttack: 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