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