Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
N
Neos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
love_飞影
Neos
Commits
2106d11a
Commit
2106d11a
authored
May 28, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix small
parent
870910b1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
17 deletions
+28
-17
src/service/duel/chainSolved.ts
src/service/duel/chainSolved.ts
+1
-1
src/service/duel/draw.ts
src/service/duel/draw.ts
+13
-12
src/service/duel/shuffleHand.ts
src/service/duel/shuffleHand.ts
+14
-4
No files found.
src/service/duel/chainSolved.ts
View file @
2106d11a
...
...
@@ -19,7 +19,7 @@ export default async (chainSolved: ygopro.StocGameMessage.MsgChainSolved) => {
if
(
target
)
{
target
.
chainIndex
=
undefined
;
}
else
{
console
.
log
(
`<ChainSolved>target from
${
location
}
is null`
);
console
.
warn
(
`<ChainSolved>target from
${
location
}
is null`
);
}
}
else
{
console
.
warn
(
...
...
src/service/duel/draw.ts
View file @
2106d11a
...
...
@@ -8,21 +8,22 @@ export default async (draw: ygopro.StocGameMessage.MsgDraw) => {
// 将卡从卡组移到手牌:设置zone、occupant、sequence
const
handsLength
=
cardStore
.
at
(
ygopro
.
CardZone
.
HAND
,
draw
.
player
).
length
;
cardStore
c
onst
newHands
=
c
ardStore
.
at
(
ygopro
.
CardZone
.
DECK
,
draw
.
player
)
.
slice
(
-
drawLength
)
.
forEach
(
async
(
card
,
idx
)
=>
{
const
code
=
draw
.
cards
[
idx
];
const
meta
=
await
fetchCard
(
code
);
card
.
code
=
code
;
card
.
meta
=
meta
;
card
.
zone
=
ygopro
.
CardZone
.
HAND
;
card
.
sequence
=
idx
+
handsLength
;
});
.
slice
(
-
drawLength
);
for
(
const
idx
in
newHands
)
{
const
card
=
newHands
[
Number
(
idx
)];
const
code
=
draw
.
cards
[
idx
];
const
meta
=
await
fetchCard
(
code
);
card
.
code
=
code
;
card
.
meta
=
meta
;
card
.
zone
=
ygopro
.
CardZone
.
HAND
;
card
.
sequence
=
Number
(
idx
)
+
handsLength
;
}
// 抽卡动画
cardStore
.
at
(
ygopro
.
CardZone
.
HAND
,
draw
.
player
)
.
forEach
((
card
)
=>
eventBus
.
emit
(
Report
.
Move
,
card
.
uuid
));
// FIXME: `eventBus.emit`的方式能保证动画完成后才进行下一次msg的处理么
// 如果下一次msg来得很快,可能会有动画冲突?
};
src/service/duel/shuffleHand.ts
View file @
2106d11a
...
...
@@ -14,10 +14,20 @@ export default (shuffleHand: MsgShuffleHand) => {
t
[
code
].
push
(
sequence
);
});
hands
.
forEach
((
hand
)
=>
{
const
sequence
=
t
[
hand
.
code
].
shift
();
if
(
sequence
===
undefined
)
{
throw
new
Error
(
"
手牌数量和洗牌后的数量不一致
"
);
const
target
=
t
[
hand
.
code
];
if
(
target
!==
undefined
)
{
const
sequence
=
target
.
shift
();
if
(
sequence
)
{
hand
.
sequence
=
sequence
;
}
else
{
console
.
warn
(
`<ShuffleHand>sequence shift from target is null, controller=
${
controller
}
hands=
${
hands
}
, codes=
${
codes
}
`
);
}
}
else
{
console
.
warn
(
`<ShuffleHand>target from records is null, controller=
${
controller
}
hands=
${
hands
}
, codes=
${
codes
}
`
);
}
hand
.
sequence
=
sequence
;
});
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment