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
605950a6
Commit
605950a6
authored
Dec 30, 2022
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add magic slice
parent
e1e017de
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
1 deletion
+55
-1
src/reducers/duel/magicSlice.ts
src/reducers/duel/magicSlice.ts
+42
-0
src/reducers/duel/mod.ts
src/reducers/duel/mod.ts
+8
-0
src/reducers/duel/util.ts
src/reducers/duel/util.ts
+5
-1
No files found.
src/reducers/duel/magicSlice.ts
0 → 100644
View file @
605950a6
import
{
judgeSelf
,
Magic
,
InteractType
}
from
"
./util
"
;
import
{
PayloadAction
,
CaseReducer
}
from
"
@reduxjs/toolkit
"
;
import
{
DuelState
}
from
"
./mod
"
;
import
{
ygopro
}
from
"
../../api/ocgcore/idl/ocgcore
"
;
import
{
RootState
}
from
"
../../store
"
;
export
interface
MagicState
{
magics
:
Magic
[];
}
// 初始化自己的魔法陷阱区状态
export
const
initMagicsImpl
:
CaseReducer
<
DuelState
,
PayloadAction
<
number
>>
=
(
state
,
action
)
=>
{
const
player
=
action
.
payload
;
const
magics
=
{
magics
:
[
{
sequence
:
0
,
},
{
sequence
:
1
,
},
{
sequence
:
2
,
},
{
sequence
:
3
,
},
{
sequence
:
4
,
},
],
};
if
(
judgeSelf
(
player
,
state
))
{
state
.
meMagics
=
magics
;
}
else
{
state
.
opMagics
=
magics
;
}
};
src/reducers/duel/mod.ts
View file @
605950a6
...
...
@@ -29,6 +29,7 @@ import {
addMonsterPlaceSelectAbleImpl
,
clearMonsterSelectInfoImpl
,
}
from
"
./monstersSlice
"
;
import
{
MagicState
,
initMagicsImpl
}
from
"
./magicSlice
"
;
export
interface
DuelState
{
selfType
?:
number
;
...
...
@@ -41,6 +42,9 @@ export interface DuelState {
meMonsters
?:
MonsterState
;
// 自己的怪兽区状态
opMonsters
?:
MonsterState
;
// 对手的怪兽区状态
meMagics
?:
MagicState
;
// 自己的魔法陷阱区状态
opMagics
?:
MagicState
;
// 对手的魔法陷阱区状态
meTimeLimit
?:
TimeLimit
;
// 自己的计时
opTimeLimit
?:
TimeLimit
;
// 对手的计时
...
...
@@ -81,6 +85,9 @@ const duelSlice = createSlice({
addMonsterPlaceSelectAble
:
addMonsterPlaceSelectAbleImpl
,
clearMonsterSelectInfo
:
clearMonsterSelectInfoImpl
,
// 魔法陷阱区相关`Reducer`
initMagics
:
initMagicsImpl
,
// UI相关`Reducer`
setCardModalIsOpen
:
setCardModalIsOpenImpl
,
setCardModalText
:
setCardModalTextImpl
,
...
...
@@ -108,6 +115,7 @@ export const {
initMonsters
,
addMonsterPlaceSelectAble
,
clearMonsterSelectInfo
,
initMagics
,
}
=
duelSlice
.
actions
;
export
const
selectDuelHsStart
=
(
state
:
RootState
)
=>
{
return
state
.
duel
.
meInitInfo
!=
null
;
...
...
src/reducers/duel/util.ts
View file @
605950a6
...
...
@@ -72,7 +72,7 @@ export interface Interactivity<T> {
response
:
T
;
}
export
interface
Monster
{
export
interface
SlotState
{
sequence
:
number
;
occupant
?:
CardMeta
;
selectInfo
?:
Interactivity
<
{
...
...
@@ -81,3 +81,7 @@ export interface Monster {
sequence
:
number
;
}
>
;
}
export
type
Monster
=
SlotState
;
export
type
Magic
=
SlotState
;
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