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