Commit d38980b4 authored by chechunchi's avatar chechunchi Committed by Chunchi Che

udpate move.ts

parent 28b2cafe
Pipeline #21743 passed with stages
in 15 minutes and 42 seconds
...@@ -22,6 +22,7 @@ export default async (move: MsgMove) => { ...@@ -22,6 +22,7 @@ export default async (move: MsgMove) => {
// FIXME: 考虑超量素材的情况 // FIXME: 考虑超量素材的情况
let uuid; let uuid;
let chainIndex;
switch (from.location) { switch (from.location) {
case ygopro.CardZone.MZONE: case ygopro.CardZone.MZONE:
case ygopro.CardZone.SZONE: { case ygopro.CardZone.SZONE: {
...@@ -32,6 +33,7 @@ export default async (move: MsgMove) => { ...@@ -32,6 +33,7 @@ export default async (move: MsgMove) => {
target.occupant = undefined; target.occupant = undefined;
target.overlay_materials = []; target.overlay_materials = [];
uuid = target.uuid; uuid = target.uuid;
chainIndex = target.chainIndex;
// 需要重新分配UUID // 需要重新分配UUID
target.uuid = v4uuid(); target.uuid = v4uuid();
break; break;
...@@ -47,6 +49,7 @@ export default async (move: MsgMove) => { ...@@ -47,6 +49,7 @@ export default async (move: MsgMove) => {
.of(from.controler) .of(from.controler)
.remove(from.sequence); .remove(from.sequence);
uuid = removed.uuid; uuid = removed.uuid;
chainIndex = removed.chainIndex;
break; break;
} }
...@@ -77,8 +80,12 @@ export default async (move: MsgMove) => { ...@@ -77,8 +80,12 @@ export default async (move: MsgMove) => {
.of(to.controler) .of(to.controler)
.setOccupant(to.sequence, code, to.position, true); .setOccupant(to.sequence, code, to.position, true);
if (uuid) { if (uuid) {
// 设置UUID
matStore.in(to.location).of(to.controler)[to.sequence].uuid = uuid; matStore.in(to.location).of(to.controler)[to.sequence].uuid = uuid;
} }
// 设置连锁序号
matStore.in(to.location).of(to.controler)[to.sequence].chainIndex =
chainIndex;
await sleep(NeosConfig.ui.moveDelay); await sleep(NeosConfig.ui.moveDelay);
matStore.in(to.location).of(to.controler)[to.sequence].focus = false; matStore.in(to.location).of(to.controler)[to.sequence].focus = false;
...@@ -92,7 +99,7 @@ export default async (move: MsgMove) => { ...@@ -92,7 +99,7 @@ export default async (move: MsgMove) => {
matStore matStore
.in(to.location) .in(to.location)
.of(to.controler) .of(to.controler)
.insert(uuid, code, to.sequence, to.position); .insert(uuid, code, to.sequence, to.position, false, chainIndex);
} }
break; break;
} }
...@@ -106,7 +113,8 @@ export default async (move: MsgMove) => { ...@@ -106,7 +113,8 @@ export default async (move: MsgMove) => {
code, code,
to.sequence, to.sequence,
ygopro.CardPosition.FACEUP_ATTACK, ygopro.CardPosition.FACEUP_ATTACK,
true true,
chainIndex
); );
await sleep(NeosConfig.ui.moveDelay); await sleep(NeosConfig.ui.moveDelay);
......
...@@ -31,7 +31,8 @@ class CardArray extends Array<CardState> implements ArrayCardState { ...@@ -31,7 +31,8 @@ class CardArray extends Array<CardState> implements ArrayCardState {
controller: number, controller: number,
id: number, id: number,
position?: ygopro.CardPosition, position?: ygopro.CardPosition,
focus?: boolean focus?: boolean,
chainIndex?: number
) => ({ ) => ({
uuid, uuid,
occupant: await fetchCard(id, true), occupant: await fetchCard(id, true),
...@@ -56,14 +57,16 @@ class CardArray extends Array<CardState> implements ArrayCardState { ...@@ -56,14 +57,16 @@ class CardArray extends Array<CardState> implements ArrayCardState {
id: number, id: number,
sequence: number, sequence: number,
position?: ygopro.CardPosition, position?: ygopro.CardPosition,
focus?: boolean focus?: boolean,
chainIndex?: number
) { ) {
const card = await this.genCard( const card = await this.genCard(
uuid, uuid,
this.getController(), this.getController(),
id, id,
position, position,
focus focus,
chainIndex
); );
this.splice(sequence, 0, card); this.splice(sequence, 0, card);
} }
......
...@@ -21,7 +21,8 @@ export interface DuelFieldState extends Array<CardState> { ...@@ -21,7 +21,8 @@ export interface DuelFieldState extends Array<CardState> {
id: number, id: number,
sequence: number, sequence: number,
position?: ygopro.CardPosition, position?: ygopro.CardPosition,
focus?: boolean focus?: boolean,
chainIndex?: number
) => Promise<void>; ) => Promise<void>;
/** 在末尾添加卡片 */ /** 在末尾添加卡片 */
add: ( add: (
......
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