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
9c6059bb
Commit
9c6059bb
authored
Dec 25, 2022
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update monster slice
parent
7842d7f8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
2 deletions
+53
-2
src/reducers/duel/mod.ts
src/reducers/duel/mod.ts
+10
-1
src/reducers/duel/monstersSlice.ts
src/reducers/duel/monstersSlice.ts
+43
-1
No files found.
src/reducers/duel/mod.ts
View file @
9c6059bb
...
...
@@ -23,7 +23,12 @@ import {
setCardModalImgUrlImpl
,
setCardModalInteractiviesImpl
,
}
from
"
./modalSlice
"
;
import
{
MonsterState
,
initMonstersImpl
}
from
"
./monstersSlice
"
;
import
{
MonsterState
,
initMonstersImpl
,
addMonsterPlaceSelectAbleImpl
,
clearMonsterSelectInfoImpl
,
}
from
"
./monstersSlice
"
;
export
interface
DuelState
{
selfType
?:
number
;
...
...
@@ -73,6 +78,8 @@ const duelSlice = createSlice({
// 怪兽区相关`Reducer`
initMonsters
:
initMonstersImpl
,
addMonsterPlaceSelectAble
:
addMonsterPlaceSelectAbleImpl
,
clearMonsterSelectInfo
:
clearMonsterSelectInfoImpl
,
// UI相关`Reducer`
setCardModalIsOpen
:
setCardModalIsOpenImpl
,
...
...
@@ -99,6 +106,8 @@ export const {
setCardModalImgUrl
,
setCardModalInteractivies
,
initMonsters
,
addMonsterPlaceSelectAble
,
clearMonsterSelectInfo
,
}
=
duelSlice
.
actions
;
export
const
selectDuelHsStart
=
(
state
:
RootState
)
=>
{
return
state
.
duel
.
meInitInfo
!=
null
;
...
...
src/reducers/duel/monstersSlice.ts
View file @
9c6059bb
import
{
judgeSelf
,
Monster
}
from
"
./util
"
;
import
{
judgeSelf
,
Monster
,
InteractType
}
from
"
./util
"
;
import
{
PayloadAction
,
CaseReducer
}
from
"
@reduxjs/toolkit
"
;
import
{
DuelState
}
from
"
./mod
"
;
import
{
ygopro
}
from
"
../../api/ocgcore/idl/ocgcore
"
;
export
interface
MonsterState
{
monsters
:
Monster
[];
...
...
@@ -36,3 +37,44 @@ export const initMonstersImpl: CaseReducer<DuelState, PayloadAction<number>> = (
};
}
};
export
const
addMonsterPlaceSelectAbleImpl
:
CaseReducer
<
DuelState
,
PayloadAction
<
[
number
,
number
]
>
>
=
(
state
,
action
)
=>
{
const
controler
=
action
.
payload
[
0
];
const
sequence
=
action
.
payload
[
1
];
const
monsters
=
judgeSelf
(
controler
,
state
)
?
state
.
meMonsters
:
state
.
opMonsters
;
if
(
monsters
)
{
for
(
const
monster
of
monsters
.
monsters
)
{
if
(
monster
.
sequence
==
sequence
)
{
monster
.
selectInfo
=
{
interactType
:
InteractType
.
PLACE_SELECTABLE
,
response
:
{
controler
,
zone
:
ygopro
.
CardZone
.
MZONE
,
sequence
,
},
};
}
}
}
};
export
const
clearMonsterSelectInfoImpl
:
CaseReducer
<
DuelState
,
PayloadAction
<
number
>
>
=
(
state
,
action
)
=>
{
const
player
=
action
.
payload
;
const
monsters
=
judgeSelf
(
player
,
state
)
?
state
.
meMonsters
:
state
.
opMonsters
;
if
(
monsters
)
{
monsters
.
monsters
=
[];
}
};
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