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
7307fd14
Commit
7307fd14
authored
Jan 16, 2023
by
chechunchi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add select battle cmd adapter and service
parent
084d4c3b
Pipeline
#19616
passed with stages
in 7 minutes and 3 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
95 additions
and
28 deletions
+95
-28
src/api/ocgcore/ocgAdapter/protoDecl.ts
src/api/ocgcore/ocgAdapter/protoDecl.ts
+1
-0
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/mod.ts
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/mod.ts
+6
-0
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/selectBattleCmd.ts
...pi/ocgcore/ocgAdapter/stoc/stocGameMsg/selectBattleCmd.ts
+61
-0
src/service/duel/gameMsg.ts
src/service/duel/gameMsg.ts
+20
-28
src/service/duel/selectBattleCmd.ts
src/service/duel/selectBattleCmd.ts
+7
-0
No files found.
src/api/ocgcore/ocgAdapter/protoDecl.ts
View file @
7307fd14
...
...
@@ -39,3 +39,4 @@ export const MSG_SELECT_CHAIN = 16;
export
const
MSG_SELECT_EFFECTYN
=
12
;
export
const
MSG_SELECT_POSITION
=
19
;
export
const
MSG_SELECT_OPTION
=
14
;
export
const
MSG_SELECT_BATTLE_CMD
=
10
;
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/mod.ts
View file @
7307fd14
...
...
@@ -18,6 +18,7 @@ import MsgSelectChainAdapter from "./selectChain";
import
MsgSelectEffectYnAdapter
from
"
./selectEffectYn
"
;
import
MsgSelectPositionAdapter
from
"
./selectPosition
"
;
import
MsgSelectOptionAdapter
from
"
./selectOption
"
;
import
MsgSelectBattleCmdAdapter
from
"
./selectBattleCmd
"
;
import
PENETRATE
from
"
./penetrate
"
;
/*
...
...
@@ -105,6 +106,11 @@ export default class GameMsgAdapter implements StocAdapter {
break
;
}
case
GAME_MSG
.
MSG_SELECT_BATTLE_CMD
:
{
gameMsg
.
select_battle_cmd
=
MsgSelectBattleCmdAdapter
(
gameData
);
break
;
}
default
:
{
console
.
log
(
"
Unhandled GameMessage function=
"
,
func
);
...
...
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/selectBattleCmd.ts
0 → 100644
View file @
7307fd14
import
{
ygopro
}
from
"
../../../idl/ocgcore
"
;
import
{
BufferReader
}
from
"
../../bufferIO
"
;
import
MsgSelectBattleCmd
=
ygopro
.
StocGameMessage
.
MsgSelectBattleCmd
;
/*
* Msg Select Battle Command
*
* @param - see: https://code.mycard.moe/mycard/neos-protobuf/-/blob/main/idl/ocgcore.proto
*
* @usage - 玩家在战斗阶段可选择的操作
* */
export
default
(
data
:
Uint8Array
)
=>
{
const
reader
=
new
BufferReader
(
data
,
true
);
const
msg
=
new
MsgSelectBattleCmd
({});
msg
.
player
=
reader
.
readUint8
();
// 可发动效果
const
activateCmd
=
new
MsgSelectBattleCmd
.
BattleCmd
({
battle_type
:
MsgSelectBattleCmd
.
BattleCmd
.
BattleType
.
ACTIVATE
,
battle_datas
:
[],
});
const
activateCount
=
reader
.
readUint8
();
for
(
let
i
=
0
;
i
<
activateCount
;
i
++
)
{
const
cardInfo
=
reader
.
readCardInfo
();
const
effectDescription
=
reader
.
readUint32
();
const
activateData
=
new
MsgSelectBattleCmd
.
BattleCmd
.
BattleData
({
card_info
:
cardInfo
,
effect_description
:
effectDescription
,
response
:
i
<<
(
16
+
0
),
});
activateCmd
.
battle_datas
.
push
(
activateData
);
}
// 可攻击
const
attackCmd
=
new
MsgSelectBattleCmd
.
BattleCmd
({
battle_type
:
MsgSelectBattleCmd
.
BattleCmd
.
BattleType
.
ATTACK
,
battle_datas
:
[],
});
const
attackCount
=
reader
.
readUint8
();
for
(
let
i
=
0
;
i
<
attackCount
;
i
++
)
{
const
cardInfo
=
reader
.
readCardInfo
();
const
directAttackAble
=
reader
.
readUint8
();
const
attackData
=
new
MsgSelectBattleCmd
.
BattleCmd
.
BattleData
({
card_info
:
cardInfo
,
direct_attackable
:
directAttackAble
==
1
,
response
:
i
<<
(
16
+
1
),
});
attackCmd
.
battle_datas
.
push
(
attackData
);
}
msg
.
battle_cmds
=
[
activateCmd
,
attackCmd
];
// 是否可进入M2阶段
msg
.
enable_m2
=
reader
.
readUint8
()
==
1
;
//时是否可结束回合
msg
.
enable_ep
=
reader
.
readUint8
()
==
1
;
return
msg
;
};
src/service/duel/gameMsg.ts
View file @
7307fd14
...
...
@@ -14,6 +14,7 @@ import onMsgSelectEffectYn from "./selectEffectYn";
import
onMsgSelectPosition
from
"
./selectPosition
"
;
import
onMsgSelectOption
from
"
./selectOption
"
;
import
onMsgShuffleHand
from
"
./shuffleHand
"
;
import
onMsgSelectBattleCmd
from
"
./selectBattleCmd
"
;
export
default
function
handleGameMsg
(
pb
:
ygopro
.
YgoStocMsg
)
{
const
dispatch
=
store
.
dispatch
;
...
...
@@ -21,86 +22,77 @@ export default function handleGameMsg(pb: ygopro.YgoStocMsg) {
switch
(
msg
.
gameMsg
)
{
case
"
start
"
:
{
const
start
=
msg
.
start
;
onMsgStart
(
start
,
dispatch
);
onMsgStart
(
msg
.
start
,
dispatch
);
break
;
}
case
"
draw
"
:
{
const
draw
=
msg
.
draw
;
onMsgDraw
(
draw
,
dispatch
);
onMsgDraw
(
msg
.
draw
,
dispatch
);
break
;
}
case
"
new_turn
"
:
{
const
newTurn
=
msg
.
new_turn
;
onMsgNewTurn
(
newTurn
,
dispatch
);
onMsgNewTurn
(
msg
.
new_turn
,
dispatch
);
break
;
}
case
"
new_phase
"
:
{
const
newPhase
=
msg
.
new_phase
;
onMsgNewPhase
(
newPhase
,
dispatch
);
onMsgNewPhase
(
msg
.
new_phase
,
dispatch
);
break
;
}
case
"
hint
"
:
{
const
hint
=
msg
.
hint
;
onMsgHint
(
hint
,
dispatch
);
onMsgHint
(
msg
.
hint
,
dispatch
);
break
;
}
case
"
select_idle_cmd
"
:
{
const
selectIdleCmd
=
msg
.
select_idle_cmd
;
onMsgSelectIdleCmd
(
selectIdleCmd
,
dispatch
);
onMsgSelectIdleCmd
(
msg
.
select_idle_cmd
,
dispatch
);
break
;
}
case
"
select_place
"
:
{
const
selectPlace
=
msg
.
select_place
;
onMsgSelectPlace
(
selectPlace
,
dispatch
);
onMsgSelectPlace
(
msg
.
select_place
,
dispatch
);
break
;
}
case
"
move
"
:
{
const
move
=
msg
.
move
;
onMsgMove
(
move
,
dispatch
);
onMsgMove
(
msg
.
move
,
dispatch
);
break
;
}
case
"
select_card
"
:
{
const
selectCard
=
msg
.
select_card
;
onMsgSelectCard
(
selectCard
,
dispatch
);
onMsgSelectCard
(
msg
.
select_card
,
dispatch
);
break
;
}
case
"
select_chain
"
:
{
const
selectChain
=
msg
.
select_chain
;
onMsgSelectChain
(
selectChain
,
dispatch
);
onMsgSelectChain
(
msg
.
select_chain
,
dispatch
);
break
;
}
case
"
select_effect_yn
"
:
{
const
selectEffectYn
=
msg
.
select_effect_yn
;
onMsgSelectEffectYn
(
selectEffectYn
,
dispatch
);
onMsgSelectEffectYn
(
msg
.
select_effect_yn
,
dispatch
);
break
;
}
case
"
select_position
"
:
{
const
selectPosition
=
msg
.
select_position
;
onMsgSelectPosition
(
selectPosition
,
dispatch
);
onMsgSelectPosition
(
msg
.
select_position
,
dispatch
);
break
;
}
case
"
select_option
"
:
{
const
selectOption
=
msg
.
select_option
;
onMsgSelectOption
(
selectOption
,
dispatch
);
onMsgSelectOption
(
msg
.
select_option
,
dispatch
);
break
;
}
case
"
shuffle_hand
"
:
{
const
shuffleHand
=
msg
.
shuffle_hand
;
onMsgShuffleHand
(
shuffleHand
,
dispatch
);
onMsgShuffleHand
(
msg
.
shuffle_hand
,
dispatch
);
break
;
}
case
"
select_battle_cmd
"
:
{
onMsgSelectBattleCmd
(
msg
.
select_battle_cmd
,
dispatch
);
break
;
}
...
...
src/service/duel/selectBattleCmd.ts
0 → 100644
View file @
7307fd14
import
{
ygopro
}
from
"
../../api/ocgcore/idl/ocgcore
"
;
import
{
AppDispatch
}
from
"
../../store
"
;
import
MsgSelectBattleCmd
=
ygopro
.
StocGameMessage
.
MsgSelectBattleCmd
;
export
default
(
selectBattleCmd
:
MsgSelectBattleCmd
,
dispatch
:
AppDispatch
)
=>
{
console
.
log
(
selectBattleCmd
);
};
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