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
2f9bcd60
Commit
2f9bcd60
authored
Mar 20, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
finish reloadFieldImpl
parent
212b9fc9
Pipeline
#20823
passed with stages
in 17 minutes and 8 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
84 additions
and
2 deletions
+84
-2
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/reloadField.ts
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/reloadField.ts
+2
-0
src/reducers/duel/commonSlice.ts
src/reducers/duel/commonSlice.ts
+76
-0
src/reducers/duel/mod.ts
src/reducers/duel/mod.ts
+3
-0
src/service/duel/reloadField.ts
src/service/duel/reloadField.ts
+3
-2
No files found.
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/reloadField.ts
View file @
2f9bcd60
...
@@ -54,6 +54,7 @@ export default (data: Uint8Array) => {
...
@@ -54,6 +54,7 @@ export default (data: Uint8Array) => {
new
MsgReloadField
.
ZoneAction
({
new
MsgReloadField
.
ZoneAction
({
zone
:
ygopro
.
CardZone
.
DECK
,
zone
:
ygopro
.
CardZone
.
DECK
,
sequence
,
sequence
,
position
:
ygopro
.
CardPosition
.
FACEDOWN_ATTACK
,
})
})
);
);
}
}
...
@@ -94,6 +95,7 @@ export default (data: Uint8Array) => {
...
@@ -94,6 +95,7 @@ export default (data: Uint8Array) => {
new
MsgReloadField
.
ZoneAction
({
new
MsgReloadField
.
ZoneAction
({
zone
:
ygopro
.
CardZone
.
EXTRA
,
zone
:
ygopro
.
CardZone
.
EXTRA
,
sequence
,
sequence
,
position
:
ygopro
.
CardPosition
.
FACEDOWN_ATTACK
,
})
})
);
);
}
}
...
...
src/reducers/duel/commonSlice.ts
View file @
2f9bcd60
...
@@ -4,6 +4,7 @@ import {
...
@@ -4,6 +4,7 @@ import {
clearIdleInteractivities
,
clearIdleInteractivities
,
clearPlaceInteractivities
,
clearPlaceInteractivities
,
DuelReducer
,
DuelReducer
,
reloadFieldMeta
,
updateCardData
,
updateCardData
,
}
from
"
./generic
"
;
}
from
"
./generic
"
;
import
{
judgeSelf
}
from
"
./util
"
;
import
{
judgeSelf
}
from
"
./util
"
;
...
@@ -129,9 +130,84 @@ export const updateFieldDataImpl: DuelReducer<MsgUpdateData> = (
...
@@ -129,9 +130,84 @@ export const updateFieldDataImpl: DuelReducer<MsgUpdateData> = (
export
const
reloadFieldImpl
:
DuelReducer
<
MsgReloadField
>
=
(
state
,
action
)
=>
{
export
const
reloadFieldImpl
:
DuelReducer
<
MsgReloadField
>
=
(
state
,
action
)
=>
{
const
_duel_rule
=
action
.
payload
.
duel_rule
;
const
_duel_rule
=
action
.
payload
.
duel_rule
;
// 初始化`DuelState`
state
.
meDeck
=
{
inner
:
[]
};
state
.
opDeck
=
{
inner
:
[]
};
state
.
meExtraDeck
=
{
inner
:
[]
};
state
.
opExtraDeck
=
{
inner
:
[]
};
state
.
meMonsters
=
{
inner
:
[]
};
state
.
opMonsters
=
{
inner
:
[]
};
state
.
meMagics
=
{
inner
:
[]
};
state
.
opMagics
=
{
inner
:
[]
};
state
.
meCemetery
=
{
inner
:
[]
};
state
.
opCemetery
=
{
inner
:
[]
};
state
.
meExclusion
=
{
inner
:
[]
};
state
.
opExclusion
=
{
inner
:
[]
};
state
.
meHands
=
{
inner
:
[]
};
state
.
opHands
=
{
inner
:
[]
};
for
(
const
reload
of
action
.
payload
.
actions
)
{
for
(
const
reload
of
action
.
payload
.
actions
)
{
const
player
=
reload
.
player
;
const
player
=
reload
.
player
;
// DECK
const
deck
=
judgeSelf
(
player
,
state
)
?
state
.
meDeck
:
state
.
opDeck
;
reloadFieldMeta
(
deck
,
reload
.
zone_actions
.
filter
((
item
)
=>
item
.
zone
==
ygopro
.
CardZone
.
DECK
),
player
);
// EXTRA_DECK
const
extraDeck
=
judgeSelf
(
player
,
state
)
?
state
.
meExtraDeck
:
state
.
opExtraDeck
;
reloadFieldMeta
(
extraDeck
,
reload
.
zone_actions
.
filter
((
item
)
=>
item
.
zone
==
ygopro
.
CardZone
.
EXTRA
),
player
);
// MZONE
// MZONE
const
monster
=
judgeSelf
(
player
,
state
)
?
state
.
meMonsters
:
state
.
opMonsters
;
reloadFieldMeta
(
monster
,
reload
.
zone_actions
.
filter
((
item
)
=>
item
.
zone
==
ygopro
.
CardZone
.
MZONE
),
player
);
// SZONE
const
magics
=
judgeSelf
(
player
,
state
)
?
state
.
meMagics
:
state
.
opMagics
;
reloadFieldMeta
(
magics
,
reload
.
zone_actions
.
filter
((
item
)
=>
item
.
zone
==
ygopro
.
CardZone
.
SZONE
),
player
);
// GRAVE
const
cemetery
=
judgeSelf
(
player
,
state
)
?
state
.
meCemetery
:
state
.
opCemetery
;
reloadFieldMeta
(
cemetery
,
reload
.
zone_actions
.
filter
((
item
)
=>
item
.
zone
==
ygopro
.
CardZone
.
GRAVE
),
player
);
// REMOVED
const
exclusion
=
judgeSelf
(
player
,
state
)
?
state
.
meExclusion
:
state
.
opExclusion
;
reloadFieldMeta
(
exclusion
,
reload
.
zone_actions
.
filter
(
(
item
)
=>
item
.
zone
==
ygopro
.
CardZone
.
REMOVED
),
player
);
// HANDS
const
hands
=
judgeSelf
(
player
,
state
)
?
state
.
meHands
:
state
.
opHands
;
reloadFieldMeta
(
hands
,
reload
.
zone_actions
.
filter
((
item
)
=>
item
.
zone
==
ygopro
.
CardZone
.
HAND
),
player
);
}
}
};
};
src/reducers/duel/mod.ts
View file @
2f9bcd60
...
@@ -96,6 +96,7 @@ import {
...
@@ -96,6 +96,7 @@ import {
clearAllIdleInteractivitiesImpl
,
clearAllIdleInteractivitiesImpl
,
clearAllPlaceInteractivitiesImpl
,
clearAllPlaceInteractivitiesImpl
,
updateFieldDataImpl
,
updateFieldDataImpl
,
reloadFieldImpl
,
}
from
"
./commonSlice
"
;
}
from
"
./commonSlice
"
;
import
{
import
{
ExtraDeckState
,
ExtraDeckState
,
...
@@ -258,6 +259,7 @@ const duelSlice = createSlice({
...
@@ -258,6 +259,7 @@ const duelSlice = createSlice({
clearAllIdleInteractivities
:
clearAllIdleInteractivitiesImpl
,
clearAllIdleInteractivities
:
clearAllIdleInteractivitiesImpl
,
clearAllPlaceInteractivities
:
clearAllPlaceInteractivitiesImpl
,
clearAllPlaceInteractivities
:
clearAllPlaceInteractivitiesImpl
,
updateFieldData
:
updateFieldDataImpl
,
updateFieldData
:
updateFieldDataImpl
,
reloadField
:
reloadFieldImpl
,
// 对局结果`Reducer`
// 对局结果`Reducer`
setResult
:
(
state
,
action
:
PayloadAction
<
MsgWin
.
ActionType
>
)
=>
{
setResult
:
(
state
,
action
:
PayloadAction
<
MsgWin
.
ActionType
>
)
=>
{
...
@@ -355,6 +357,7 @@ export const {
...
@@ -355,6 +357,7 @@ export const {
setWaiting
,
setWaiting
,
setUnimplemented
,
setUnimplemented
,
updateFieldData
,
updateFieldData
,
reloadField
,
}
=
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/service/duel/reloadField.ts
View file @
2f9bcd60
import
{
ygopro
}
from
"
../../api/ocgcore/idl/ocgcore
"
;
import
{
ygopro
}
from
"
../../api/ocgcore/idl/ocgcore
"
;
import
{
reloadField
}
from
"
../../reducers/duel/mod
"
;
import
{
AppDispatch
}
from
"
../../store
"
;
import
{
AppDispatch
}
from
"
../../store
"
;
import
MsgReloadField
=
ygopro
.
StocGameMessage
.
MsgReloadField
;
import
MsgReloadField
=
ygopro
.
StocGameMessage
.
MsgReloadField
;
export
default
(
reloadF
ield
:
MsgReloadField
,
dispatch
:
AppDispatch
)
=>
{
export
default
(
f
ield
:
MsgReloadField
,
dispatch
:
AppDispatch
)
=>
{
console
.
log
(
reloadField
);
dispatch
(
reloadField
(
field
)
);
};
};
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