Commit 81ae8d96 authored by Chunchi Che's avatar Chunchi Che

Merge branch 'fix/chain' into 'main'

Fix/chain

See merge request mycard/Neos!201
parents 82a45e60 b9f33694
Pipeline #21770 passed with stages
in 13 minutes and 36 seconds
Subproject commit c83175eb31577752e3ea02100e5f782f4417b654 Subproject commit 48be6a827024995962fc479db1ec69bde38a72f6
This diff is collapsed.
...@@ -114,6 +114,10 @@ ...@@ -114,6 +114,10 @@
"protoType": "chain_solved", "protoType": "chain_solved",
"fields": [{ "fieldName": "solved_index", "fieldType": "uint8"}] "fields": [{ "fieldName": "solved_index", "fieldType": "uint8"}]
}, },
"74": {
"protoType": "chain_end",
"fields": []
},
"75": { "75": {
"protoType": "chain_solved", "protoType": "chain_solved",
"fields": [{ "fieldName": "solved_index", "fieldType": "uint8"}] "fields": [{ "fieldName": "solved_index", "fieldType": "uint8"}]
......
...@@ -31,6 +31,7 @@ const MsgConstructorMap: Map<string, Constructor> = new Map([ ...@@ -31,6 +31,7 @@ const MsgConstructorMap: Map<string, Constructor> = new Map([
["chaining", ygopro.StocGameMessage.MsgChaining], ["chaining", ygopro.StocGameMessage.MsgChaining],
["attack_disable", ygopro.StocGameMessage.MsgAttackDisabled], ["attack_disable", ygopro.StocGameMessage.MsgAttackDisabled],
["chain_solved", ygopro.StocGameMessage.MsgChainSolved], ["chain_solved", ygopro.StocGameMessage.MsgChainSolved],
["chain_end", ygopro.StocGameMessage.MsgChainEnd],
]); ]);
export interface penetrateType { export interface penetrateType {
......
import { ygopro } from "@/api";
import { matStore } from "@/stores";
export default (_chainEnd: ygopro.StocGameMessage.MsgChainEnd) => {
while (true) {
const chain = matStore.chains.pop();
if (chain === undefined) {
break;
}
matStore.setChained(chain, undefined);
}
};
...@@ -17,6 +17,8 @@ export default (chainSolved: ygopro.StocGameMessage.MsgChainSolved) => { ...@@ -17,6 +17,8 @@ export default (chainSolved: ygopro.StocGameMessage.MsgChainSolved) => {
// 设置被连锁状态为空 // 设置被连锁状态为空
matStore.setChained(location, undefined); matStore.setChained(location, undefined);
} else { } else {
console.warn("pop from chains return null!"); console.warn(
`pop from chains return null! solved_index=${chainSolved.solved_index}, len of chains in store=${matStore.chains.length}`
);
} }
}; };
...@@ -3,6 +3,7 @@ import { matStore } from "@/stores"; ...@@ -3,6 +3,7 @@ import { matStore } from "@/stores";
import onMsgAttack from "./attack"; import onMsgAttack from "./attack";
import onMsgAttackDisable from "./attackDisable"; import onMsgAttackDisable from "./attackDisable";
import onMsgChainEnd from "./chainEnd";
import onMsgChaining from "./chaining"; import onMsgChaining from "./chaining";
import onMsgChainSolved from "./chainSolved"; import onMsgChainSolved from "./chainSolved";
import onMsgDraw from "./draw"; import onMsgDraw from "./draw";
...@@ -234,6 +235,11 @@ export default async function handleGameMsg(pb: ygopro.YgoStocMsg) { ...@@ -234,6 +235,11 @@ export default async function handleGameMsg(pb: ygopro.YgoStocMsg) {
break; break;
} }
case "chain_end": {
onMsgChainEnd(msg.chain_end);
break;
}
case "summoning": { case "summoning": {
onMsgSummoning(msg.summoning); onMsgSummoning(msg.summoning);
......
...@@ -48,6 +48,11 @@ export default async (move: MsgMove) => { ...@@ -48,6 +48,11 @@ export default async (move: MsgMove) => {
.in(from.location) .in(from.location)
.of(from.controler) .of(from.controler)
.remove(from.sequence); .remove(from.sequence);
if (removed === undefined) {
console.warn(`remove from matStore return undefined, location=${from}`);
}
uuid = removed.uuid; uuid = removed.uuid;
chainIndex = removed.chainIndex; chainIndex = removed.chainIndex;
......
...@@ -292,6 +292,8 @@ export const matStore: MatState = proxy<MatState>({ ...@@ -292,6 +292,8 @@ export const matStore: MatState = proxy<MatState>({
.at(location.sequence); .at(location.sequence);
if (target) { if (target) {
target.chainIndex = chainIndex; target.chainIndex = chainIndex;
} else {
console.warn(`target is null in setChained, location=${location}`);
} }
}, },
}); });
......
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