Commit 247ad7f3 authored by Chunchi Che's avatar Chunchi Che

impl attack in store

parent 848d06a7
Pipeline #21664 passed with stages
in 10 minutes and 35 seconds
import { ygopro } from "@/api";
import { fetchEsHintMeta } from "@/stores";
import { fetchEsHintMeta, matStore } from "@/stores";
export default (attack: ygopro.StocGameMessage.MsgAttack) => {
fetchEsHintMeta({
originMsg: "「[?]」攻击时",
location: attack.attacker_location,
});
const attacker = matStore
.in(attack.attacker_location.location)
.of(attack.attacker_location.controler)
.at(attack.attacker_location.sequence);
if (attacker) {
if (attack.direct_attack) {
attacker.directAttack = true;
setTimeout(() => (attacker.directAttack = false), 500);
} else {
const target = matStore
.in(attack.target_location.location)
.of(attack.target_location.controler)
.at(attack.target_location.sequence);
if (target) {
attacker.attackTarget = target;
setTimeout(() => (attacker.attackTarget = undefined), 500);
}
}
}
};
......@@ -52,6 +52,7 @@ function reloadDuelField(
counters: {},
focus: false,
chaining: false,
directAttack: false,
reload: true,
};
});
......
......@@ -41,6 +41,7 @@ export default (start: ygopro.StocGameMessage.MsgStart) => {
},
focus: false,
chaining: false,
directAttack: false,
counters: {},
idleInteractivities: [],
});
......@@ -59,6 +60,7 @@ export default (start: ygopro.StocGameMessage.MsgStart) => {
},
focus: false,
chaining: false,
directAttack: false,
counters: {},
idleInteractivities: [],
});
......@@ -78,6 +80,7 @@ export default (start: ygopro.StocGameMessage.MsgStart) => {
},
focus: false,
chaining: false,
directAttack: false,
counters: {},
idleInteractivities: [],
});
......
......@@ -43,6 +43,7 @@ class CardArray extends Array<CardState> implements ArrayCardState {
},
focus: focus ?? false,
chaining: false,
directAttack: false,
counters: {},
idleInteractivities: [],
});
......@@ -164,6 +165,7 @@ const genBlock = (zone: ygopro.CardZone, n: number) =>
},
focus: false,
chaining: false,
directAttack: false,
idleInteractivities: [],
counters: {},
}));
......
......@@ -132,6 +132,8 @@ export interface CardState {
}; // 位置信息,叫location的原因是为了和ygo对齐
focus: boolean; // 用于实现动画效果,当这个字段为true时,该张卡片会被放大并在屏幕中央展示
chaining: boolean; // 是否在连锁中
directAttack: boolean; // 是否正在直接攻击为玩家
attackTarget?: CardState; // 攻击目标。(嵌套结构可行么?)
idleInteractivities: Interactivity<number>[]; // IDLE状态下的互动信息
placeInteractivity?: Interactivity<{
controler: number;
......
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