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
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
Pipeline
#18847
passed with stages
in 3 minutes and 2 seconds
Changes
2
Pipelines
1
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 {
...
@@ -23,7 +23,12 @@ import {
setCardModalImgUrlImpl
,
setCardModalImgUrlImpl
,
setCardModalInteractiviesImpl
,
setCardModalInteractiviesImpl
,
}
from
"
./modalSlice
"
;
}
from
"
./modalSlice
"
;
import
{
MonsterState
,
initMonstersImpl
}
from
"
./monstersSlice
"
;
import
{
MonsterState
,
initMonstersImpl
,
addMonsterPlaceSelectAbleImpl
,
clearMonsterSelectInfoImpl
,
}
from
"
./monstersSlice
"
;
export
interface
DuelState
{
export
interface
DuelState
{
selfType
?:
number
;
selfType
?:
number
;
...
@@ -73,6 +78,8 @@ const duelSlice = createSlice({
...
@@ -73,6 +78,8 @@ const duelSlice = createSlice({
// 怪兽区相关`Reducer`
// 怪兽区相关`Reducer`
initMonsters
:
initMonstersImpl
,
initMonsters
:
initMonstersImpl
,
addMonsterPlaceSelectAble
:
addMonsterPlaceSelectAbleImpl
,
clearMonsterSelectInfo
:
clearMonsterSelectInfoImpl
,
// UI相关`Reducer`
// UI相关`Reducer`
setCardModalIsOpen
:
setCardModalIsOpenImpl
,
setCardModalIsOpen
:
setCardModalIsOpenImpl
,
...
@@ -99,6 +106,8 @@ export const {
...
@@ -99,6 +106,8 @@ export const {
setCardModalImgUrl
,
setCardModalImgUrl
,
setCardModalInteractivies
,
setCardModalInteractivies
,
initMonsters
,
initMonsters
,
addMonsterPlaceSelectAble
,
clearMonsterSelectInfo
,
}
=
duelSlice
.
actions
;
}
=
duelSlice
.
actions
;
export
const
selectDuelHsStart
=
(
state
:
RootState
)
=>
{
export
const
selectDuelHsStart
=
(
state
:
RootState
)
=>
{
return
state
.
duel
.
meInitInfo
!=
null
;
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
{
PayloadAction
,
CaseReducer
}
from
"
@reduxjs/toolkit
"
;
import
{
DuelState
}
from
"
./mod
"
;
import
{
DuelState
}
from
"
./mod
"
;
import
{
ygopro
}
from
"
../../api/ocgcore/idl/ocgcore
"
;
export
interface
MonsterState
{
export
interface
MonsterState
{
monsters
:
Monster
[];
monsters
:
Monster
[];
...
@@ -36,3 +37,44 @@ export const initMonstersImpl: CaseReducer<DuelState, PayloadAction<number>> = (
...
@@ -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