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
b15537c1
Commit
b15537c1
authored
May 14, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add attack effect
parent
247ad7f3
Pipeline
#21665
passed with stages
in 11 minutes and 2 seconds
Changes
9
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
68 additions
and
10 deletions
+68
-10
src/api/ocgcore/ocgAdapter/protoDecl.ts
src/api/ocgcore/ocgAdapter/protoDecl.ts
+1
-0
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/attack.ts
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/attack.ts
+36
-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/penetrate.json
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/penetrate.json
+0
-6
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/penetrate.ts
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/penetrate.ts
+0
-1
src/service/duel/attack.ts
src/service/duel/attack.ts
+5
-1
src/service/onSocketMessage.ts
src/service/onSocketMessage.ts
+2
-0
src/stores/matStore/types.ts
src/stores/matStore/types.ts
+1
-1
src/ui/Duel/PlayMat/Mat.tsx
src/ui/Duel/PlayMat/Mat.tsx
+17
-1
No files found.
src/api/ocgcore/ocgAdapter/protoDecl.ts
View file @
b15537c1
...
...
@@ -56,3 +56,4 @@ export const MSG_ADD_COUNTER = 101;
export
const
MSG_REMOVE_COUNTER
=
102
;
export
const
MSG_SELECT_COUNTER
=
22
;
export
const
MSG_SORT_CARD
=
25
;
export
const
MSG_ATTACK
=
110
;
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/attack.ts
0 → 100644
View file @
b15537c1
import
{
ygopro
}
from
"
@/api/ocgcore/idl/ocgcore
"
;
import
{
BufferReaderExt
}
from
"
../../bufferIO
"
;
import
MsgAttack
=
ygopro
.
StocGameMessage
.
MsgAttack
;
/*
* Msg Attack
*
* @param attacker_location - 攻击者位置
* @param target_location - 攻击目标位置,可能为空
* @param direct_attack - 是否直接攻击玩家
* */
export
default
(
data
:
Uint8Array
)
=>
{
const
reader
=
new
BufferReaderExt
(
data
);
const
attacker_location
=
reader
.
readCardLocation
();
const
target_location
=
reader
.
readCardLocation
();
if
(
target_location
.
controler
==
0
&&
target_location
.
location
==
0
&&
target_location
.
sequence
==
0
)
{
// 全零表示直接攻击玩家
return
new
MsgAttack
({
attacker_location
,
direct_attack
:
true
,
});
}
else
{
return
new
MsgAttack
({
attacker_location
,
target_location
,
direct_attack
:
false
,
});
}
};
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/mod.ts
View file @
b15537c1
...
...
@@ -7,6 +7,7 @@ import { ygopro } from "../../../idl/ocgcore";
import
{
StocAdapter
,
YgoProPacket
}
from
"
../../packet
"
;
import
*
as
GAME_MSG
from
"
../../protoDecl
"
;
import
MsgAddCounter
from
"
./addCounter
"
;
import
MsgAttack
from
"
./attack
"
;
import
MsgDamage
from
"
./damage
"
;
import
MsgDrawAdapter
from
"
./draw
"
;
import
MsgHintAdapter
from
"
./hint
"
;
...
...
@@ -190,6 +191,11 @@ export default class GameMsgAdapter implements StocAdapter {
break
;
}
case
GAME_MSG
.
MSG_ATTACK
:
{
gameMsg
.
attack
=
MsgAttack
(
gameData
);
break
;
}
default
:
{
gameMsg
.
unimplemented
=
new
ygopro
.
StocGameMessage
.
MsgUnimplemented
({
command
:
func
,
...
...
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/penetrate.json
View file @
b15537c1
...
...
@@ -106,12 +106,6 @@
{
"fieldName"
:
"location"
,
"fieldType"
:
"CardLocation"
}
]
},
"110"
:
{
"protoType"
:
"attack"
,
"fields"
:
[
{
"fieldName"
:
"location"
,
"fieldType"
:
"CardLocation"
}
]
},
"112"
:
{
"protoType"
:
"attack_disable"
,
"fields"
:
[]
...
...
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/penetrate.ts
View file @
b15537c1
...
...
@@ -29,7 +29,6 @@ const MsgConstructorMap: Map<string, Constructor> = new Map([
[
"
sp_summoning
"
,
ygopro
.
StocGameMessage
.
MsgSpSummoning
],
[
"
sp_summoned
"
,
ygopro
.
StocGameMessage
.
MsgSpSummoned
],
[
"
chaining
"
,
ygopro
.
StocGameMessage
.
MsgChaining
],
[
"
attack
"
,
ygopro
.
StocGameMessage
.
MsgAttack
],
[
"
attack_disable
"
,
ygopro
.
StocGameMessage
.
MsgAttackDisabled
],
[
"
chain_solved
"
,
ygopro
.
StocGameMessage
.
MsgChainSolved
],
]);
...
...
src/service/duel/attack.ts
View file @
b15537c1
...
...
@@ -24,7 +24,11 @@ export default (attack: ygopro.StocGameMessage.MsgAttack) => {
.
at
(
attack
.
target_location
.
sequence
);
if
(
target
)
{
attacker
.
attackTarget
=
target
;
attacker
.
attackTarget
=
{
sequence
:
attack
.
target_location
.
sequence
,
opponent
:
matStore
.
isMe
(
attack
.
target_location
.
controler
),
...
target
,
};
setTimeout
(()
=>
(
attacker
.
attackTarget
=
undefined
),
500
);
}
...
...
src/service/onSocketMessage.ts
View file @
b15537c1
...
...
@@ -126,6 +126,8 @@ function handleDelay(stoc: ygopro.YgoStocMsg): number {
matStore
.
delay
=
NeosConfig
.
ui
.
moveDelay
+
500
;
}
else
if
(
stoc
.
stoc_game_msg
.
gameMsg
==
"
chaining
"
)
{
matStore
.
delay
=
NeosConfig
.
ui
.
chainingDelay
;
}
else
if
(
stoc
.
stoc_game_msg
.
gameMsg
==
"
attack
"
)
{
matStore
.
delay
=
500
+
500
;
}
}
...
...
src/stores/matStore/types.ts
View file @
b15537c1
...
...
@@ -133,7 +133,7 @@ export interface CardState {
focus
:
boolean
;
// 用于实现动画效果,当这个字段为true时,该张卡片会被放大并在屏幕中央展示
chaining
:
boolean
;
// 是否在连锁中
directAttack
:
boolean
;
// 是否正在直接攻击为玩家
attackTarget
?:
CardState
;
// 攻击目标。(嵌套结构可行么?)
attackTarget
?:
CardState
&
{
sequence
:
number
;
opponent
:
boolean
}
;
// 攻击目标。(嵌套结构可行么?)
idleInteractivities
:
Interactivity
<
number
>
[];
// IDLE状态下的互动信息
placeInteractivity
?:
Interactivity
<
{
controler
:
number
;
...
...
src/ui/Duel/PlayMat/Mat.tsx
View file @
b15537c1
...
...
@@ -107,7 +107,11 @@ export const Mat = () => {
card
.
focus
||
(
card
.
chaining
&&
card
.
location
.
zone
==
YgoZone
.
HAND
)
}
fly=
{
card
.
chaining
&&
card
.
location
.
zone
!=
YgoZone
.
HAND
}
fly=
{
(
card
.
chaining
&&
card
.
location
.
zone
!=
YgoZone
.
HAND
)
||
card
.
attackTarget
!==
undefined
||
card
.
directAttack
}
opponent=
{
card
.
opponent
}
onClick=
{
card
.
location
.
zone
==
YgoZone
.
SZONE
||
...
...
@@ -128,6 +132,18 @@ export const Mat = () => {
function
cardStateToRow
(
state
:
RenderCard
):
number
{
if
(
state
.
focus
)
return
2
;
if
(
state
.
directAttack
)
{
// 正在直接攻击玩家
if
(
state
.
opponent
)
{
return
4.5
;
}
else
{
return
-
0.5
;
}
}
if
(
state
.
attackTarget
)
{
// 正在攻击怪兽
return
cardStateToRow
(
state
.
attackTarget
)
-
0.5
*
(
state
.
opponent
?
1
:
-
1
);
}
if
(
state
.
opponent
)
{
switch
(
state
.
location
.
zone
)
{
case
YgoZone
.
EXTRA
:
...
...
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