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
baichixing
Neos
Commits
16aaeaa3
Commit
16aaeaa3
authored
May 28, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add block state in matStore
parent
4691e0ef
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
1 deletion
+56
-1
src/service/duel/start.ts
src/service/duel/start.ts
+38
-1
src/stores/matStore/types.ts
src/stores/matStore/types.ts
+18
-0
No files found.
src/service/duel/start.ts
View file @
16aaeaa3
...
...
@@ -7,8 +7,11 @@ import { fetchCard, ygopro } from "@/api";
import
{
cardStore
,
CardType
,
playerStore
,
store
}
from
"
@/stores
"
;
const
{
matStore
}
=
store
;
const
TOKEN_SIZE
=
13
;
// 每人场上最多就只可能有13个token
const
MZONE_SIZE
=
7
;
// 普通怪兽区 + 额外怪兽区
const
SZONE_SIZE
=
6
;
// 普通魔陷区 + 场地区
export
default
(
start
:
ygopro
.
StocGameMessage
.
MsgStart
)
=>
{
// 先初始化`matStore`
matStore
.
selfType
=
start
.
playerType
;
const
opponent
=
start
.
playerType
==
ygopro
.
StocGameMessage
.
MsgStart
.
PlayerType
.
FirstStrike
...
...
@@ -31,7 +34,41 @@ export default (start: ygopro.StocGameMessage.MsgStart) => {
extraSize
:
start
.
extraSize2
,
});
// 下面是cardStore的初始化
for
(
let
sequence
=
0
;
sequence
<
MZONE_SIZE
;
sequence
++
)
{
matStore
.
blocks
.
push
({
location
:
{
zone
:
ygopro
.
CardZone
.
MZONE
,
controller
:
0
,
sequence
,
},
});
matStore
.
blocks
.
push
({
location
:
{
zone
:
ygopro
.
CardZone
.
MZONE
,
controller
:
1
,
sequence
,
},
});
}
for
(
let
sequence
=
0
;
sequence
<
SZONE_SIZE
;
sequence
++
)
{
matStore
.
blocks
.
push
({
location
:
{
zone
:
ygopro
.
CardZone
.
SZONE
,
controller
:
0
,
sequence
,
},
});
matStore
.
blocks
.
push
({
location
:
{
zone
:
ygopro
.
CardZone
.
SZONE
,
controller
:
1
,
sequence
,
},
});
}
// 再初始化`cardStore`
const
cards
=
flatten
(
[
...
...
src/stores/matStore/types.ts
View file @
16aaeaa3
...
...
@@ -16,6 +16,8 @@ export interface MatState {
set
:
(
controller
:
number
,
obj
:
Partial
<
InitInfo
>
)
=>
void
;
};
// 双方的初始化信息
blocks
:
BlockState
[];
// 场上`Block`信息,比如怪兽区,墓地等
chains
:
ygopro
.
CardLocation
[];
// 连锁的卡片位置
timeLimits
:
BothSide
<
number
>
&
{
...
...
@@ -38,6 +40,22 @@ export interface MatState {
isMe
:
(
player
:
number
)
=>
boolean
;
}
export
interface
BlockState
{
// `Block`的位置
location
:
{
controller
:
number
;
zone
:
ygopro
.
CardZone
;
sequence
:
number
;
};
// 位置选择信息,如果当前`Block`可以被选择作为
// 怪兽召唤/发动魔陷的位置时,该字段会被设置
selectInfo
?:
Interactivity
<
{
controler
:
number
;
zone
:
ygopro
.
CardZone
;
sequence
:
number
;
}
>
;
}
export
interface
InitInfo
{
masterRule
?:
string
;
name
:
string
;
...
...
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