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
373c746c
Commit
373c746c
authored
Dec 30, 2022
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update magic slice
parent
605950a6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
1 deletion
+50
-1
src/reducers/duel/magicSlice.ts
src/reducers/duel/magicSlice.ts
+40
-0
src/reducers/duel/mod.ts
src/reducers/duel/mod.ts
+10
-1
No files found.
src/reducers/duel/magicSlice.ts
View file @
373c746c
...
...
@@ -40,3 +40,43 @@ export const initMagicsImpl: CaseReducer<DuelState, PayloadAction<number>> = (
state
.
opMagics
=
magics
;
}
};
export
const
addMagicPlaceSelectAbleImpl
:
CaseReducer
<
DuelState
,
PayloadAction
<
[
number
,
number
]
>
>
=
(
state
,
action
)
=>
{
const
controler
=
action
.
payload
[
0
];
const
sequence
=
action
.
payload
[
1
];
const
magics
=
judgeSelf
(
controler
,
state
)
?
state
.
meMagics
:
state
.
opMagics
;
if
(
magics
)
{
for
(
const
magic
of
magics
.
magics
)
{
if
(
magic
.
sequence
==
sequence
)
{
magic
.
selectInfo
=
{
interactType
:
InteractType
.
PLACE_SELECTABLE
,
response
:
{
controler
,
zone
:
ygopro
.
CardZone
.
SZONE
,
sequence
,
},
};
}
}
}
};
export
const
clearMagicSelectInfoImpl
:
CaseReducer
<
DuelState
,
PayloadAction
<
number
>
>
=
(
state
,
action
)
=>
{
const
player
=
action
.
payload
;
const
magics
=
judgeSelf
(
player
,
state
)
?
state
.
meMagics
:
state
.
opMagics
;
if
(
magics
)
{
magics
.
magics
=
[];
}
};
export
const
selectMeMagics
=
(
state
:
RootState
)
=>
state
.
duel
.
meMagics
||
{
magics
:
[]
};
src/reducers/duel/mod.ts
View file @
373c746c
...
...
@@ -29,7 +29,12 @@ import {
addMonsterPlaceSelectAbleImpl
,
clearMonsterSelectInfoImpl
,
}
from
"
./monstersSlice
"
;
import
{
MagicState
,
initMagicsImpl
}
from
"
./magicSlice
"
;
import
{
MagicState
,
initMagicsImpl
,
addMagicPlaceSelectAbleImpl
,
clearMagicSelectInfoImpl
,
}
from
"
./magicSlice
"
;
export
interface
DuelState
{
selfType
?:
number
;
...
...
@@ -87,6 +92,8 @@ const duelSlice = createSlice({
// 魔法陷阱区相关`Reducer`
initMagics
:
initMagicsImpl
,
addMagicPlaceSelectAble
:
addMagicPlaceSelectAbleImpl
,
clearMagicSelectInfo
:
clearMagicSelectInfoImpl
,
// UI相关`Reducer`
setCardModalIsOpen
:
setCardModalIsOpenImpl
,
...
...
@@ -116,6 +123,8 @@ export const {
addMonsterPlaceSelectAble
,
clearMonsterSelectInfo
,
initMagics
,
addMagicPlaceSelectAble
,
clearMagicSelectInfo
,
}
=
duelSlice
.
actions
;
export
const
selectDuelHsStart
=
(
state
:
RootState
)
=>
{
return
state
.
duel
.
meInitInfo
!=
null
;
...
...
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