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
4
Merge Requests
4
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
ae30741c
Commit
ae30741c
authored
Jan 23, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add extraDeckSlice.ts
parent
7ac66454
Pipeline
#19770
passed with stages
in 5 minutes and 41 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
2 deletions
+47
-2
src/reducers/duel/extraDeckSlice.ts
src/reducers/duel/extraDeckSlice.ts
+41
-0
src/reducers/duel/handsSlice.ts
src/reducers/duel/handsSlice.ts
+1
-2
src/reducers/duel/mod.ts
src/reducers/duel/mod.ts
+5
-0
No files found.
src/reducers/duel/extraDeckSlice.ts
0 → 100644
View file @
ae30741c
import
{
ActionReducerMapBuilder
}
from
"
@reduxjs/toolkit
"
;
import
{
ygopro
}
from
"
../../api/ocgcore/idl/ocgcore
"
;
import
{
RootState
}
from
"
../../store
"
;
import
{
createAsyncRepeatedMetaThunk
,
DuelFieldState
}
from
"
./generic
"
;
import
{
DuelState
}
from
"
./mod
"
;
import
{
judgeSelf
}
from
"
./util
"
;
export
interface
ExtraDeckState
extends
DuelFieldState
{}
// 初始化额外卡组
export
const
initExtraDeckMeta
=
createAsyncRepeatedMetaThunk
(
"
duel/initExtraDeckMeta
"
);
export
const
extraDeckCase
=
(
builder
:
ActionReducerMapBuilder
<
DuelState
>
)
=>
{
builder
.
addCase
(
initExtraDeckMeta
.
pending
,
(
state
,
action
)
=>
{
const
player
=
action
.
meta
.
arg
.
controler
;
const
ids
=
action
.
meta
.
arg
.
codes
;
const
cards
=
ids
.
map
((
id
)
=>
{
return
{
occupant
:
{
id
,
data
:
{},
text
:
{}
},
location
:
{
controler
:
player
,
location
:
ygopro
.
CardZone
.
EXTRA
,
},
idleInteractivities
:
[],
};
});
if
(
judgeSelf
(
player
,
state
))
{
state
.
meExtraDeck
=
{
inner
:
cards
};
}
else
{
state
.
opExtraDeck
=
{
inner
:
cards
};
}
});
};
export
const
selectMeExtraDeck
=
(
state
:
RootState
)
=>
state
.
duel
.
meExtraDeck
||
{
inner
:
[]
};
export
const
selectOpExtraDeck
=
(
state
:
RootState
)
=>
state
.
duel
.
opExtraDeck
||
{
inner
:
[]
};
src/reducers/duel/handsSlice.ts
View file @
ae30741c
...
...
@@ -73,6 +73,7 @@ export const removeHandImpl: CaseReducer<
removeCard
(
hands
,
sequence
);
};
// 在特定位置增加手牌
export
const
insertHandMeta
=
createAsyncMetaThunk
(
"
duel/insertHandMeta
"
);
export
const
updateHandsMeta
=
createAsyncRepeatedMetaThunk
(
...
...
@@ -171,8 +172,6 @@ export const handsCase = (builder: ActionReducerMapBuilder<DuelState>) => {
});
};
// 在特定位置增加手牌
export
const
selectMeHands
=
(
state
:
RootState
)
=>
state
.
duel
.
meHands
||
{
inner
:
[]
};
export
const
selectOpHands
=
(
state
:
RootState
)
=>
...
...
src/reducers/duel/mod.ts
View file @
ae30741c
...
...
@@ -95,6 +95,7 @@ import {
clearAllIdleInteractivitiesImpl
,
clearAllPlaceInteractivitiesImpl
,
}
from
"
./commonSlice
"
;
import
{
ExtraDeckState
,
extraDeckCase
}
from
"
./extraDeckSlice
"
;
export
interface
DuelState
{
selfType
?:
number
;
...
...
@@ -119,6 +120,9 @@ export interface DuelState {
meDeck
?:
DeckState
;
// 自己的卡组状态
opDeck
?:
DeckState
;
// 对手的卡组状态
meExtraDeck
?:
ExtraDeckState
;
// 自己的额外卡组状态
opExtraDeck
?:
ExtraDeckState
;
// 对手的额外卡组状态
meTimeLimit
?:
TimeLimit
;
// 自己的计时
opTimeLimit
?:
TimeLimit
;
// 对手的计时
...
...
@@ -242,6 +246,7 @@ const duelSlice = createSlice({
magicCase
(
builder
);
cemeteryCase
(
builder
);
exclusionCase
(
builder
);
extraDeckCase
(
builder
);
checkCardModalCase
(
builder
);
YesNoModalCase
(
builder
);
optionModalCase
(
builder
);
...
...
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