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
85203ea0
Commit
85203ea0
authored
Mar 25, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix/zero' into 'main'
Fix/zero See merge request
mycard/Neos!153
parents
8fb09d50
8aca524f
Pipeline
#20921
passed with stages
in 21 minutes and 19 seconds
Changes
8
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
48 additions
and
27 deletions
+48
-27
src/reducers/duel/modal/checkCardModalSlice.ts
src/reducers/duel/modal/checkCardModalSlice.ts
+6
-12
src/reducers/duel/modal/checkCardModalV2Slice.ts
src/reducers/duel/modal/checkCardModalV2Slice.ts
+15
-3
src/reducers/duel/modal/checkCardModalV3Slice.ts
src/reducers/duel/modal/checkCardModalV3Slice.ts
+9
-0
src/reducers/duel/util.ts
src/reducers/duel/util.ts
+5
-3
src/service/duel/selectCard.ts
src/service/duel/selectCard.ts
+1
-3
src/service/duel/selectChain.ts
src/service/duel/selectChain.ts
+1
-1
src/service/duel/selectTribute.ts
src/service/duel/selectTribute.ts
+1
-0
src/service/duel/selectUnselectCard.ts
src/service/duel/selectUnselectCard.ts
+10
-5
No files found.
src/reducers/duel/modal/checkCardModalSlice.ts
View file @
85203ea0
...
...
@@ -55,22 +55,21 @@ export const setCheckCardModalCancelResponseImpl: CaseReducer<
export
const
fetchCheckCardMeta
=
createAsyncThunk
(
"
duel/fetchCheckCardMeta
"
,
async
(
param
:
{
controler
:
number
;
tagName
:
string
;
option
:
{
code
:
number
;
zone
?:
ygopro
.
CardZone
;
sequence
?:
number
;
location
:
ygopro
.
CardLocation
;
response
:
number
;
effectDescCode
?:
number
;
};
})
=>
{
// FIXME: 这里如果传的`controler`如果是对手,对应的`code`会为零,这时候就无法更新对应的`Meta`信息了,后续需要修复。`fetchCheckCardMetaV2`和`fetchCheckCardMetaV3`同理
const
meta
=
await
fetchCard
(
param
.
option
.
code
,
true
);
const
effectDesc
=
param
.
option
.
effectDescCode
?
getCardStr
(
meta
,
param
.
option
.
effectDescCode
&
0xf
)
:
undefined
;
const
response
=
{
controler
:
param
.
controler
,
controler
:
param
.
option
.
location
.
controler
,
tagName
:
param
.
tagName
,
meta
:
{
code
:
meta
.
id
,
...
...
@@ -88,11 +87,10 @@ export const checkCardModalCase = (
builder
:
ActionReducerMapBuilder
<
DuelState
>
)
=>
{
builder
.
addCase
(
fetchCheckCardMeta
.
pending
,
(
state
,
action
)
=>
{
const
controler
=
action
.
meta
.
arg
.
controler
;
const
tagName
=
action
.
meta
.
arg
.
tagName
;
const
code
=
action
.
meta
.
arg
.
option
.
code
;
const
zone
=
action
.
meta
.
arg
.
option
.
zone
;
const
sequence
=
action
.
meta
.
arg
.
option
.
sequence
;
const
location
=
action
.
meta
.
arg
.
option
.
location
;
const
controler
=
location
.
controler
;
const
response
=
action
.
meta
.
arg
.
option
.
response
;
const
combinedTagName
=
judgeSelf
(
controler
,
state
)
...
...
@@ -100,11 +98,7 @@ export const checkCardModalCase = (
:
`对方的
${
tagName
}
`
;
const
newID
=
code
!=
0
?
code
:
zone
&&
sequence
?
findCardByLocation
(
state
,
controler
,
zone
,
sequence
)?.
occupant
?.
id
:
undefined
;
code
!=
0
?
code
:
findCardByLocation
(
state
,
location
)?.
occupant
?.
id
||
0
;
if
(
newID
)
{
for
(
const
tag
of
state
.
modalState
.
checkCardModal
.
tags
)
{
...
...
src/reducers/duel/modal/checkCardModalV2Slice.ts
View file @
85203ea0
...
...
@@ -7,6 +7,8 @@ import {
}
from
"
@reduxjs/toolkit
"
;
import
{
fetchCard
}
from
"
../../../api/cards
"
;
import
{
RootState
}
from
"
../../../store
"
;
import
{
ygopro
}
from
"
../../../api/ocgcore/idl/ocgcore
"
;
import
{
findCardByLocation
}
from
"
../util
"
;
// 更新打开状态
export
const
setCheckCardModalV2IsOpenImpl
:
DuelReducer
<
boolean
>
=
(
...
...
@@ -53,9 +55,12 @@ export const setCheckCardModalV2ResponseAbleImpl: DuelReducer<boolean> = (
export
const
fetchCheckCardMetasV2
=
createAsyncThunk
(
"
duel/fetchCheckCardMetaV2
"
,
async
(
param
:
{
controler
:
number
;
selected
:
boolean
;
options
:
{
code
:
number
;
response
:
number
}[];
options
:
{
code
:
number
;
location
:
ygopro
.
CardLocation
;
response
:
number
;
}[];
})
=>
{
const
metas
=
await
Promise
.
all
(
param
.
options
.
map
(
async
(
option
)
=>
{
...
...
@@ -63,7 +68,6 @@ export const fetchCheckCardMetasV2 = createAsyncThunk(
})
);
const
response
=
{
controler
:
param
.
controler
,
selected
:
param
.
selected
,
metas
,
};
...
...
@@ -79,6 +83,14 @@ export const checkCardModalV2Case = (
const
selected
=
action
.
meta
.
arg
.
selected
;
const
options
=
action
.
meta
.
arg
.
options
;
for
(
const
option
of
options
)
{
if
(
option
.
code
==
0
)
{
const
newCode
=
findCardByLocation
(
state
,
option
.
location
)?.
occupant
?.
id
||
0
;
option
.
code
=
newCode
;
}
}
if
(
selected
)
{
state
.
modalState
.
checkCardModalV2
.
selectedOptions
=
options
;
}
else
{
...
...
src/reducers/duel/modal/checkCardModalV3Slice.ts
View file @
85203ea0
...
...
@@ -7,6 +7,8 @@ import {
}
from
"
@reduxjs/toolkit
"
;
import
{
CardMeta
,
fetchCard
}
from
"
../../../api/cards
"
;
import
{
RootState
}
from
"
../../../store
"
;
import
{
ygopro
}
from
"
../../../api/ocgcore/idl/ocgcore
"
;
import
{
findCardByLocation
}
from
"
../util
"
;
// 更新打开状态
export
const
setCheckCardModalV3IsOpenImpl
:
DuelReducer
<
boolean
>
=
(
...
...
@@ -64,6 +66,7 @@ export const fetchCheckCardMetasV3 = createAsyncThunk(
mustSelect
:
boolean
;
options
:
{
code
:
number
;
location
:
ygopro
.
CardLocation
;
level1
:
number
;
level2
:
number
;
response
:
number
;
...
...
@@ -89,6 +92,12 @@ export const checkCardModalV3Case = (
builder
.
addCase
(
fetchCheckCardMetasV3
.
pending
,
(
state
,
action
)
=>
{
const
mustSelect
=
action
.
meta
.
arg
.
mustSelect
;
const
options
=
action
.
meta
.
arg
.
options
.
map
((
option
)
=>
{
if
(
option
.
code
==
0
)
{
const
newCode
=
findCardByLocation
(
state
,
option
.
location
)?.
occupant
?.
id
||
0
;
option
.
code
=
newCode
;
}
return
{
meta
:
{
id
:
option
.
code
,
data
:
{},
text
:
{}
},
level1
:
option
.
level1
,
...
...
src/reducers/duel/util.ts
View file @
85203ea0
...
...
@@ -29,10 +29,12 @@ export function judgeSelf(player: number, state: Draft<DuelState>): boolean {
* 通过`controler`,`zone`和`sequence`获取卡牌状态*/
export
function
findCardByLocation
(
state
:
Draft
<
DuelState
>
,
controler
:
number
,
zone
:
ygopro
.
CardZone
,
sequence
:
number
location
:
ygopro
.
CardLocation
):
CardState
|
undefined
{
const
controler
=
location
.
controler
;
const
zone
=
location
.
location
;
const
sequence
=
location
.
sequence
;
const
finder
=
(
_
:
any
,
idx
:
number
)
=>
idx
==
sequence
;
switch
(
zone
)
{
...
...
src/service/duel/selectCard.ts
View file @
85203ea0
...
...
@@ -25,12 +25,10 @@ export default (selectCard: MsgSelectCard, dispatch: AppDispatch) => {
const
tagName
=
CardZoneToChinese
(
card
.
location
.
location
);
dispatch
(
fetchCheckCardMeta
({
controler
:
card
.
location
.
controler
,
tagName
,
option
:
{
code
:
card
.
code
,
zone
:
card
.
location
.
location
,
sequence
:
card
.
location
.
sequence
,
location
:
card
.
location
,
response
:
card
.
response
,
},
})
...
...
src/service/duel/selectChain.ts
View file @
85203ea0
...
...
@@ -73,10 +73,10 @@ export default (selectChain: MsgSelectChain, dispatch: AppDispatch) => {
const
tagName
=
CardZoneToChinese
(
chain
.
location
.
location
);
dispatch
(
fetchCheckCardMeta
({
controler
:
chain
.
location
.
controler
,
tagName
,
option
:
{
code
:
chain
.
code
,
location
:
chain
.
location
,
response
:
chain
.
response
,
effectDescCode
:
chain
.
effect_description
,
},
...
...
src/service/duel/selectTribute.ts
View file @
85203ea0
...
...
@@ -25,6 +25,7 @@ export default (selectTribute: MsgSelectTribute, dispatch: AppDispatch) => {
options
:
selectTribute
.
selectable_cards
.
map
((
card
)
=>
{
return
{
code
:
card
.
code
,
location
:
card
.
location
,
level1
:
card
.
level
,
level2
:
card
.
level
,
response
:
card
.
response
,
...
...
src/service/duel/selectUnselectCard.ts
View file @
85203ea0
...
...
@@ -14,7 +14,6 @@ export default (
selectUnselectCard
:
MsgSelectUnselectCard
,
dispatch
:
AppDispatch
)
=>
{
const
controler
=
selectUnselectCard
.
player
;
const
finishable
=
selectUnselectCard
.
finishable
;
const
cancelable
=
selectUnselectCard
.
cancelable
;
const
min
=
selectUnselectCard
.
min
;
...
...
@@ -29,20 +28,26 @@ export default (
dispatch
(
fetchCheckCardMetasV2
({
controler
,
selected
:
false
,
options
:
selectableCards
.
map
((
card
)
=>
{
return
{
code
:
card
.
code
,
response
:
card
.
response
};
return
{
code
:
card
.
code
,
location
:
card
.
location
,
response
:
card
.
response
,
};
}),
})
);
dispatch
(
fetchCheckCardMetasV2
({
controler
,
selected
:
true
,
options
:
selectedCards
.
map
((
card
)
=>
{
return
{
code
:
card
.
code
,
response
:
card
.
response
};
return
{
code
:
card
.
code
,
location
:
card
.
location
,
response
:
card
.
response
,
};
}),
})
);
...
...
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