Commit 23daef2f authored by Chunchi Che's avatar Chunchi Che

fic chain solved service

parent 70c44a41
......@@ -139,24 +139,6 @@
"protoType": "chain_end",
"fields": []
},
"75": {
"protoType": "chain_solved",
"fields": [
{
"fieldName": "solved_index",
"fieldType": "uint8"
}
]
},
"76": {
"protoType": "chain_solved",
"fields": [
{
"fieldName": "solved_index",
"fieldType": "uint8"
}
]
},
"94": {
"protoType": "lp_update",
"fields": [
......
......@@ -2,6 +2,8 @@ import { ygopro } from "@/api";
import { cardStore, matStore, placeStore } from "@/stores";
export default (_chainEnd: ygopro.StocGameMessage.MsgChainEnd) => {
console.info(`<ChainEnd>chain has been end`);
while (true) {
const chain = matStore.chains.pop();
if (chain === undefined) {
......
......@@ -6,10 +6,12 @@ import { matStore, placeStore } from "@/stores";
// 2. NEGATED - 被无效;
// 3. DISABLED - 被禁用。
//
// 对于这三种情况`service`层的逻辑是一致的,但是UI展示应该有区别
// 因为现在还没实现连锁处理的动画,因此暂时先都一致处理,
// 体现在 `penetrage.json`文件中三个一样的配置
// 第一种MSG后端会在每一个连锁点处理完(不管是无效还是禁用)发给前端
// 第二第三种只会在特定情况下发,用于UI展示。
// 这里暂时只处理第一种
export default async (chainSolved: ygopro.StocGameMessage.MsgChainSolved) => {
console.info(`<ChainSolved>solved_index = ${chainSolved.solved_index}`);
const location = matStore.chains
.splice(chainSolved.solved_index - 1, 1)
.at(0);
......@@ -23,7 +25,8 @@ export default async (chainSolved: ygopro.StocGameMessage.MsgChainSolved) => {
}
} else {
console.warn(
`pop from chains return null! solved_index=${chainSolved.solved_index}, len of chains in store=${matStore.chains.length}`,
`pop from chains return null! solved_index=${chainSolved.solved_index},
len of chains in store=${matStore.chains.length}`,
);
}
};
......@@ -25,7 +25,9 @@ export default async (chaining: ygopro.StocGameMessage.MsgChaining) => {
const meta = fetchCard(chaining.code);
// 这里不能设置`code`,因为存在一个场景:
// 对方的`魔神仪-曼德拉护肤草`发动效果后,后端会发一次`MSG_SHUFFLE_HAND`,但传给前端的codes全是0,如果这里设置了`code`的话,在后面的`MSG_SHUFFLE_HAND`处理就会有问题。
// 对方的`魔神仪-曼德拉护肤草`发动效果后,后端会发一次`MSG_SHUFFLE_HAND`,
// 但传给前端的codes全是0,如果这里设置了`code`的话,
// 在后面的`MSG_SHUFFLE_HAND`处理就会有问题。
// target.code = meta.id;
// 设置`Meta`信息,让对手发动效果的卡也能展示正面卡图
......@@ -36,6 +38,7 @@ export default async (chaining: ygopro.StocGameMessage.MsgChaining) => {
// 发动效果动画
await callCardFocus(target.uuid);
console.color("blue")(`${target.meta.text.name} chaining`);
console.info(`<Chaining>chain stack length = ${matStore.chains.length}`);
} else {
console.warn(`<Chaining>target from ${location} is null`);
}
......
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