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
6359fec3
Commit
6359fec3
authored
Jan 17, 2023
by
chechunchi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update move service
parent
e615ed1f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
1 deletion
+51
-1
src/reducers/duel/cemeretySlice.ts
src/reducers/duel/cemeretySlice.ts
+12
-0
src/reducers/duel/exclusionSlice.ts
src/reducers/duel/exclusionSlice.ts
+12
-0
src/reducers/duel/mod.ts
src/reducers/duel/mod.ts
+11
-1
src/service/duel/move.ts
src/service/duel/move.ts
+16
-0
No files found.
src/reducers/duel/cemeretySlice.ts
View file @
6359fec3
...
...
@@ -12,6 +12,7 @@ import {
DuelFieldState
,
extendState
,
extendMeta
,
removeCard
,
}
from
"
./generic
"
;
export
interface
CemeteryState
extends
DuelFieldState
{}
...
...
@@ -67,6 +68,17 @@ export const cemeteryCase = (builder: ActionReducerMapBuilder<DuelState>) => {
});
};
// 删除墓地
export
const
removeCemeteryImpl
:
CaseReducer
<
DuelState
,
PayloadAction
<
{
controler
:
number
;
sequence
:
number
}
>
>
=
(
state
,
action
)
=>
{
const
cemetery
=
judgeSelf
(
action
.
payload
.
controler
,
state
)
?
state
.
meCemetery
:
state
.
opCemetery
;
removeCard
(
cemetery
,
action
.
payload
.
sequence
);
};
export
const
selectMeCemetery
=
(
state
:
RootState
)
=>
state
.
duel
.
meCemetery
||
{
inner
:
[]
};
export
const
selectOpCemetery
=
(
state
:
RootState
)
=>
...
...
src/reducers/duel/exclusionSlice.ts
View file @
6359fec3
...
...
@@ -12,6 +12,7 @@ import {
DuelFieldState
,
extendState
,
extendMeta
,
removeCard
,
}
from
"
./generic
"
;
export
interface
ExclusionState
extends
DuelFieldState
{}
...
...
@@ -69,6 +70,17 @@ export const exclusionCase = (builder: ActionReducerMapBuilder<DuelState>) => {
});
};
// 删除除外区
export
const
removeExclusionImpl
:
CaseReducer
<
DuelState
,
PayloadAction
<
{
controler
:
number
;
sequence
:
number
}
>
>
=
(
state
,
action
)
=>
{
const
exclusion
=
judgeSelf
(
action
.
payload
.
controler
,
state
)
?
state
.
meExclusion
:
state
.
opExclusion
;
removeCard
(
exclusion
,
action
.
payload
.
sequence
);
};
export
const
selectMeExclusion
=
(
state
:
RootState
)
=>
state
.
duel
.
meExclusion
||
{
inner
:
[]
};
export
const
selectopExclusion
=
(
state
:
RootState
)
=>
...
...
src/reducers/duel/mod.ts
View file @
6359fec3
...
...
@@ -69,10 +69,16 @@ import {
setMagicPositionImpl
,
magicCase
,
}
from
"
./magicSlice
"
;
import
{
CemeteryState
,
initCemeteryImpl
,
cemeteryCase
}
from
"
./cemeretySlice
"
;
import
{
CemeteryState
,
initCemeteryImpl
,
removeCemeteryImpl
,
cemeteryCase
,
}
from
"
./cemeretySlice
"
;
import
{
ExclusionState
,
initExclusionImpl
,
removeExclusionImpl
,
exclusionCase
,
}
from
"
./exclusionSlice
"
;
import
{
DeckState
,
initDeckImpl
}
from
"
./deckSlice
"
;
...
...
@@ -172,9 +178,11 @@ const duelSlice = createSlice({
// 墓地相关`Reducer`
initCemetery
:
initCemeteryImpl
,
removeCemetery
:
removeCemeteryImpl
,
// 除外区相关`Reducer`
initExclusion
:
initExclusionImpl
,
removeExclusion
:
removeExclusionImpl
,
// 卡组相关`Reducer`
initDeck
:
initDeckImpl
,
...
...
@@ -256,6 +264,7 @@ export const {
removeMagic
,
removeHand
,
initCemetery
,
removeCemetery
,
setCardListModalIsOpen
,
setCardListModalInfo
,
setCheckCardModalIsOpen
,
...
...
@@ -272,6 +281,7 @@ export const {
resetOptionModal
,
initDeck
,
initExclusion
,
removeExclusion
,
initField
,
clearFieldPlaceInteractivities
,
addFieldPlaceInteractivities
,
...
...
src/service/duel/move.ts
View file @
6359fec3
...
...
@@ -3,6 +3,8 @@ import MsgMove = ygopro.StocGameMessage.MsgMove;
import
{
AppDispatch
}
from
"
../../store
"
;
import
{
fetchMonsterMeta
}
from
"
../../reducers/duel/monstersSlice
"
;
import
{
removeCemetery
,
removeExclusion
,
removeHand
,
removeMagic
,
removeMonster
,
...
...
@@ -38,6 +40,20 @@ export default (move: MsgMove, dispatch: AppDispatch) => {
break
;
}
case
ygopro
.
CardZone
.
GRAVE
:
{
dispatch
(
removeCemetery
({
controler
:
from
.
controler
,
sequence
:
from
.
sequence
})
);
break
;
}
case
ygopro
.
CardZone
.
REMOVED
:
{
dispatch
(
removeExclusion
({
controler
:
from
.
controler
,
sequence
:
from
.
sequence
})
);
break
;
}
default
:
{
console
.
log
(
`Unhandled zone type
${
from
.
location
}
`
);
break
;
...
...
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