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
75a1a49e
Commit
75a1a49e
authored
Jan 15, 2023
by
chechunchi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add removeOccupant
parent
5e1e0834
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
1 deletion
+46
-1
src/reducers/duel/generic.ts
src/reducers/duel/generic.ts
+21
-0
src/reducers/duel/mod.ts
src/reducers/duel/mod.ts
+3
-0
src/reducers/duel/monstersSlice.ts
src/reducers/duel/monstersSlice.ts
+14
-0
src/service/duel/move.ts
src/service/duel/move.ts
+8
-1
No files found.
src/reducers/duel/generic.ts
View file @
75a1a49e
...
@@ -149,3 +149,24 @@ export function clearPlaceInteractivities<T extends DuelFieldState>(
...
@@ -149,3 +149,24 @@ export function clearPlaceInteractivities<T extends DuelFieldState>(
}
}
}
}
}
}
export
function
removeCard
<
T
extends
DuelFieldState
>
(
state
:
T
|
undefined
,
sequence
:
number
)
{
if
(
state
)
{
state
.
inner
=
state
.
inner
.
filter
((
_
,
idx
)
=>
idx
!=
sequence
);
}
}
export
function
removeOccupant
<
T
extends
DuelFieldState
>
(
state
:
T
|
undefined
,
sequence
:
number
)
{
if
(
state
)
{
const
target
=
state
.
inner
.
find
((
_
,
idx
)
=>
idx
==
sequence
);
if
(
target
)
{
target
.
occupant
=
undefined
;
}
}
}
src/reducers/duel/mod.ts
View file @
75a1a49e
...
@@ -46,6 +46,7 @@ import {
...
@@ -46,6 +46,7 @@ import {
initMonstersImpl
,
initMonstersImpl
,
addMonsterPlaceInteractivitiesImpl
,
addMonsterPlaceInteractivitiesImpl
,
clearMonsterPlaceInteractivitiesImpl
,
clearMonsterPlaceInteractivitiesImpl
,
removeMonsterImpl
,
monsterCase
,
monsterCase
,
}
from
"
./monstersSlice
"
;
}
from
"
./monstersSlice
"
;
import
{
import
{
...
@@ -135,6 +136,7 @@ const duelSlice = createSlice({
...
@@ -135,6 +136,7 @@ const duelSlice = createSlice({
initMonsters
:
initMonstersImpl
,
initMonsters
:
initMonstersImpl
,
addMonsterPlaceInteractivities
:
addMonsterPlaceInteractivitiesImpl
,
addMonsterPlaceInteractivities
:
addMonsterPlaceInteractivitiesImpl
,
clearMonsterPlaceInteractivities
:
clearMonsterPlaceInteractivitiesImpl
,
clearMonsterPlaceInteractivities
:
clearMonsterPlaceInteractivitiesImpl
,
removeMonster
:
removeMonsterImpl
,
// 魔法陷阱区相关`Reducer`
// 魔法陷阱区相关`Reducer`
initMagics
:
initMagicsImpl
,
initMagics
:
initMagicsImpl
,
...
@@ -201,6 +203,7 @@ export const {
...
@@ -201,6 +203,7 @@ export const {
initMonsters
,
initMonsters
,
addMonsterPlaceInteractivities
,
addMonsterPlaceInteractivities
,
clearMonsterPlaceInteractivities
,
clearMonsterPlaceInteractivities
,
removeMonster
,
initMagics
,
initMagics
,
addMagicPlaceInteractivities
,
addMagicPlaceInteractivities
,
clearMagicPlaceInteractivities
,
clearMagicPlaceInteractivities
,
...
...
src/reducers/duel/monstersSlice.ts
View file @
75a1a49e
...
@@ -13,6 +13,7 @@ import {
...
@@ -13,6 +13,7 @@ import {
extendOccupant
,
extendOccupant
,
extendPlaceInteractivity
,
extendPlaceInteractivity
,
clearPlaceInteractivities
,
clearPlaceInteractivities
,
removeOccupant
,
}
from
"
./generic
"
;
}
from
"
./generic
"
;
export
interface
MonsterState
extends
DuelFieldState
{}
export
interface
MonsterState
extends
DuelFieldState
{}
...
@@ -137,6 +138,19 @@ export const monsterCase = (builder: ActionReducerMapBuilder<DuelState>) => {
...
@@ -137,6 +138,19 @@ export const monsterCase = (builder: ActionReducerMapBuilder<DuelState>) => {
});
});
};
};
export
const
removeMonsterImpl
:
CaseReducer
<
DuelState
,
PayloadAction
<
{
controler
:
number
;
sequence
:
number
}
>
>
=
(
state
,
action
)
=>
{
const
controler
=
action
.
payload
.
controler
;
const
monsters
=
judgeSelf
(
controler
,
state
)
?
state
.
meMonsters
:
state
.
opMonsters
;
removeOccupant
(
monsters
,
action
.
payload
.
sequence
);
};
export
const
selectMeMonsters
=
(
state
:
RootState
)
=>
export
const
selectMeMonsters
=
(
state
:
RootState
)
=>
state
.
duel
.
meMonsters
||
{
inner
:
[]
};
state
.
duel
.
meMonsters
||
{
inner
:
[]
};
export
const
selectOpMonsters
=
(
state
:
RootState
)
=>
export
const
selectOpMonsters
=
(
state
:
RootState
)
=>
...
...
src/service/duel/move.ts
View file @
75a1a49e
...
@@ -2,7 +2,7 @@ import { ygopro } from "../../api/ocgcore/idl/ocgcore";
...
@@ -2,7 +2,7 @@ import { ygopro } from "../../api/ocgcore/idl/ocgcore";
import
MsgMove
=
ygopro
.
StocGameMessage
.
MsgMove
;
import
MsgMove
=
ygopro
.
StocGameMessage
.
MsgMove
;
import
{
AppDispatch
}
from
"
../../store
"
;
import
{
AppDispatch
}
from
"
../../store
"
;
import
{
fetchMonsterMeta
}
from
"
../../reducers/duel/monstersSlice
"
;
import
{
fetchMonsterMeta
}
from
"
../../reducers/duel/monstersSlice
"
;
import
{
removeHand
}
from
"
../../reducers/duel/mod
"
;
import
{
removeHand
,
removeMonster
}
from
"
../../reducers/duel/mod
"
;
import
{
fetchMagicMeta
}
from
"
../../reducers/duel/magicSlice
"
;
import
{
fetchMagicMeta
}
from
"
../../reducers/duel/magicSlice
"
;
import
{
fetchCemeteryMeta
}
from
"
../../reducers/duel/cemeretySlice
"
;
import
{
fetchCemeteryMeta
}
from
"
../../reducers/duel/cemeretySlice
"
;
...
@@ -18,6 +18,13 @@ export default (move: MsgMove, dispatch: AppDispatch) => {
...
@@ -18,6 +18,13 @@ export default (move: MsgMove, dispatch: AppDispatch) => {
break
;
break
;
}
}
case
ygopro
.
CardZone
.
MZONE
:
{
dispatch
(
removeMonster
({
controler
:
from
.
controler
,
sequence
:
from
.
sequence
})
);
break
;
}
default
:
{
default
:
{
console
.
log
(
`Unhandled zone type
${
from
.
location
}
`
);
console
.
log
(
`Unhandled zone type
${
from
.
location
}
`
);
break
;
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