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
dd809f69
Commit
dd809f69
authored
Jan 12, 2023
by
chechunchi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update small
parent
0e175d8e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
42 deletions
+45
-42
src/reducers/duel/generic.ts
src/reducers/duel/generic.ts
+32
-1
src/reducers/duel/magicSlice.ts
src/reducers/duel/magicSlice.ts
+4
-21
src/reducers/duel/monstersSlice.ts
src/reducers/duel/monstersSlice.ts
+9
-20
No files found.
src/reducers/duel/generic.ts
View file @
dd809f69
...
...
@@ -2,7 +2,6 @@ import { AsyncThunk, createAsyncThunk } from "@reduxjs/toolkit";
import
{
CardMeta
}
from
"
../../api/cards
"
;
import
{
ygopro
}
from
"
../../api/ocgcore/idl/ocgcore
"
;
import
{
fetchCard
}
from
"
../../api/cards
"
;
import
{
DuelState
}
from
"
./mod
"
;
export
interface
DuelFieldState
{
inner
:
CardState
[];
...
...
@@ -122,3 +121,35 @@ export function extendMeta<T extends DuelFieldState>(
}
}
}
export
function
extendPlaceInteractivity
<
T
extends
DuelFieldState
>
(
state
:
T
|
undefined
,
controler
:
number
,
sequence
:
number
,
zone
:
ygopro
.
CardZone
)
{
if
(
state
)
{
for
(
let
item
of
state
.
inner
)
{
if
(
item
.
location
.
sequence
==
sequence
)
{
item
.
placeInteractivities
=
{
interactType
:
InteractType
.
PLACE_SELECTABLE
,
response
:
{
controler
,
zone
,
sequence
,
},
};
}
}
}
}
export
function
clearPlaceInteractivities
<
T
extends
DuelFieldState
>
(
state
:
T
|
undefined
)
{
if
(
state
)
{
for
(
let
item
of
state
.
inner
)
{
item
.
placeInteractivities
=
undefined
;
}
}
}
src/reducers/duel/magicSlice.ts
View file @
dd809f69
...
...
@@ -8,10 +8,11 @@ import { DuelState } from "./mod";
import
{
ygopro
}
from
"
../../api/ocgcore/idl/ocgcore
"
;
import
{
RootState
}
from
"
../../store
"
;
import
{
InteractType
,
createAsyncMetaThunk
,
DuelFieldState
,
extendOccupant
,
extendPlaceInteractivity
,
clearPlaceInteractivities
,
}
from
"
./generic
"
;
export
interface
MagicState
extends
DuelFieldState
{}
...
...
@@ -82,20 +83,7 @@ export const addMagicPlaceInteractivitiesImpl: CaseReducer<
const
sequence
=
action
.
payload
[
1
];
const
magics
=
judgeSelf
(
controler
,
state
)
?
state
.
meMagics
:
state
.
opMagics
;
if
(
magics
)
{
for
(
const
magic
of
magics
.
inner
)
{
if
(
magic
.
location
.
sequence
==
sequence
)
{
magic
.
placeInteractivities
=
{
interactType
:
InteractType
.
PLACE_SELECTABLE
,
response
:
{
controler
,
zone
:
ygopro
.
CardZone
.
SZONE
,
sequence
,
},
};
}
}
}
extendPlaceInteractivity
(
magics
,
controler
,
sequence
,
ygopro
.
CardZone
.
SZONE
);
};
export
const
clearMagicPlaceInteractivitiesImpl
:
CaseReducer
<
...
...
@@ -105,12 +93,7 @@ export const clearMagicPlaceInteractivitiesImpl: CaseReducer<
const
player
=
action
.
payload
;
const
magics
=
judgeSelf
(
player
,
state
)
?
state
.
meMagics
:
state
.
opMagics
;
if
(
magics
)
{
for
(
const
magic
of
magics
.
inner
)
{
magic
.
placeInteractivities
=
undefined
;
}
}
clearPlaceInteractivities
(
magics
);
};
// 增加魔法陷阱
...
...
src/reducers/duel/monstersSlice.ts
View file @
dd809f69
...
...
@@ -9,9 +9,10 @@ import { ygopro } from "../../api/ocgcore/idl/ocgcore";
import
{
RootState
}
from
"
../../store
"
;
import
{
DuelFieldState
,
InteractType
,
createAsyncMetaThunk
,
extendOccupant
,
extendPlaceInteractivity
,
clearPlaceInteractivities
,
}
from
"
./generic
"
;
export
interface
MonsterState
extends
DuelFieldState
{}
...
...
@@ -84,20 +85,12 @@ export const addMonsterPlaceInteractivitiesImpl: CaseReducer<
const
monsters
=
judgeSelf
(
controler
,
state
)
?
state
.
meMonsters
:
state
.
opMonsters
;
if
(
monsters
)
{
for
(
const
monster
of
monsters
.
inner
)
{
if
(
monster
.
location
.
sequence
==
sequence
)
{
monster
.
placeInteractivities
=
{
interactType
:
InteractType
.
PLACE_SELECTABLE
,
response
:
{
controler
,
zone
:
ygopro
.
CardZone
.
MZONE
,
sequence
,
},
};
}
}
}
extendPlaceInteractivity
(
monsters
,
controler
,
sequence
,
ygopro
.
CardZone
.
MZONE
);
};
export
const
clearMonsterPlaceInteractivitiesImpl
:
CaseReducer
<
...
...
@@ -110,11 +103,7 @@ export const clearMonsterPlaceInteractivitiesImpl: CaseReducer<
?
state
.
meMonsters
:
state
.
opMonsters
;
if
(
monsters
)
{
for
(
const
monster
of
monsters
.
inner
)
{
monster
.
placeInteractivities
=
undefined
;
}
}
clearPlaceInteractivities
(
monsters
);
};
// 增加怪兽
...
...
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