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
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
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
MyCard
Neos
Commits
57c0f0c1
Commit
57c0f0c1
authored
May 17, 2024
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make some operation to be automated
parent
ec460b80
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
9 deletions
+26
-9
src/service/duel/selectCard.ts
src/service/duel/selectCard.ts
+7
-1
src/service/duel/selectOption.ts
src/service/duel/selectOption.ts
+5
-0
src/service/duel/selectUnselectCard.ts
src/service/duel/selectUnselectCard.ts
+4
-8
src/service/duel/util.ts
src/service/duel/util.ts
+10
-0
No files found.
src/service/duel/selectCard.ts
View file @
57c0f0c1
import
{
ygopro
}
from
"
@/api
"
;
import
{
sendSelectMultiResponse
,
ygopro
}
from
"
@/api
"
;
import
MsgSelectCard
=
ygopro
.
StocGameMessage
.
MsgSelectCard
;
import
{
displaySelectActionsModal
}
from
"
@/ui/Duel/Message/SelectActionsModal
"
;
...
...
@@ -10,6 +10,12 @@ export default async (selectCard: MsgSelectCard) => {
// TODO: handle release_param
if
(
!
cancelable
&&
cards
.
length
===
1
)
{
// auto send
sendSelectMultiResponse
([
cards
[
0
].
response
]);
return
;
}
const
{
selecteds
,
mustSelects
,
selectables
}
=
await
fetchCheckCardMeta
(
cards
,
);
...
...
src/service/duel/selectOption.ts
View file @
57c0f0c1
...
...
@@ -13,6 +13,11 @@ export default async (selectOption: ygopro.StocGameMessage.MsgSelectOption) => {
sendSelectOptionResponse
(
0
);
return
;
}
if
(
options
.
length
===
1
)
{
sendSelectOptionResponse
(
options
[
0
].
response
);
return
;
}
await
displayOptionModal
(
fetchStrings
(
Region
.
System
,
556
),
options
.
map
(({
code
,
response
})
=>
({
...
...
src/service/duel/selectUnselectCard.ts
View file @
57c0f0c1
...
...
@@ -3,8 +3,8 @@ import { cardStore, matStore } from "@/stores";
import
{
displaySelectActionsModal
}
from
"
@/ui/Duel/Message/SelectActionsModal
"
;
import
{
fetchCheckCardMeta
}
from
"
../utils
"
;
import
{
isAllOnField
}
from
"
./util
"
;
type
MsgSelectUnselectCard
=
ygopro
.
StocGameMessage
.
MsgSelectUnselectCard
;
const
{
MZONE
,
SZONE
,
HAND
}
=
ygopro
.
CardZone
;
export
default
async
({
finishable
,
...
...
@@ -15,9 +15,9 @@ export default async ({
selected_cards
:
selectedCards
,
}:
MsgSelectUnselectCard
)
=>
{
if
(
selectableCards
.
concat
(
selectedCards
)
.
find
((
info
)
=>
!
isOnField
(
info
.
location
))
===
undefined
isAllOnField
(
selectableCards
.
concat
(
selectedCards
).
map
((
info
)
=>
info
.
location
),
)
)
{
// 所有可选卡和已选卡都是在场上或手牌
// 通过让玩家点击场上的卡来进行选择
...
...
@@ -65,7 +65,3 @@ export default async ({
});
}
};
function
isOnField
(
location
:
ygopro
.
CardLocation
):
boolean
{
return
[
MZONE
,
SZONE
,
HAND
].
includes
(
location
.
zone
);
}
src/service/duel/util.ts
0 → 100644
View file @
57c0f0c1
import
{
ygopro
}
from
"
@/api
"
;
const
{
MZONE
,
SZONE
,
HAND
}
=
ygopro
.
CardZone
;
export
function
isAllOnField
(
locations
:
ygopro
.
CardLocation
[]):
boolean
{
const
isOnField
=
(
location
:
ygopro
.
CardLocation
)
=>
{
return
[
MZONE
,
SZONE
,
HAND
].
includes
(
location
.
zone
);
};
return
locations
.
find
((
location
)
=>
!
isOnField
(
location
))
===
undefined
;
}
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