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
4dfc118d
Commit
4dfc118d
authored
Jul 17, 2024
by
chechunchi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor fetchEsHintMeta
parent
58f1d87a
Pipeline
#28460
passed with stages
in 10 minutes and 36 seconds
Changes
19
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
175 additions
and
99 deletions
+175
-99
src/service/duel/attack.ts
src/service/duel/attack.ts
+10
-2
src/service/duel/attackDisable.ts
src/service/duel/attackDisable.ts
+8
-3
src/service/duel/chaining.ts
src/service/duel/chaining.ts
+5
-2
src/service/duel/draw.ts
src/service/duel/draw.ts
+10
-3
src/service/duel/flipSummoned.ts
src/service/duel/flipSummoned.ts
+8
-3
src/service/duel/flipSummoning.ts
src/service/duel/flipSummoning.ts
+8
-2
src/service/duel/gameMsg.ts
src/service/duel/gameMsg.ts
+14
-14
src/service/duel/hint.ts
src/service/duel/hint.ts
+9
-7
src/service/duel/posChange.ts
src/service/duel/posChange.ts
+7
-2
src/service/duel/set.ts
src/service/duel/set.ts
+5
-3
src/service/duel/spSummoned.ts
src/service/duel/spSummoned.ts
+8
-3
src/service/duel/spSummoning.ts
src/service/duel/spSummoning.ts
+8
-2
src/service/duel/summoned.ts
src/service/duel/summoned.ts
+8
-3
src/service/duel/summoning.ts
src/service/duel/summoning.ts
+8
-2
src/service/duel/swap.ts
src/service/duel/swap.ts
+8
-3
src/service/duel/updateHp.ts
src/service/duel/updateHp.ts
+8
-4
src/service/duel/util.ts
src/service/duel/util.ts
+42
-0
src/stores/cardStore.ts
src/stores/cardStore.ts
+0
-3
src/stores/matStore/methods/fetchHint.ts
src/stores/matStore/methods/fetchHint.ts
+1
-38
No files found.
src/service/duel/attack.ts
View file @
4dfc118d
import
{
ygopro
}
from
"
@/api
"
;
import
{
ygopro
}
from
"
@/api
"
;
import
{
Container
}
from
"
@/container
"
;
import
{
AudioActionType
,
playEffect
}
from
"
@/infra/audio
"
;
import
{
AudioActionType
,
playEffect
}
from
"
@/infra/audio
"
;
import
{
cardStore
,
fetchEsHintMeta
}
from
"
@/stores
"
;
import
{
cardStore
}
from
"
@/stores
"
;
import
{
callCardAttack
}
from
"
@/ui/Duel/PlayMat/Card
"
;
import
{
callCardAttack
}
from
"
@/ui/Duel/PlayMat/Card
"
;
export
default
async
(
attack
:
ygopro
.
StocGameMessage
.
MsgAttack
)
=>
{
import
{
fetchEsHintMeta
}
from
"
./util
"
;
export
default
async
(
container
:
Container
,
attack
:
ygopro
.
StocGameMessage
.
MsgAttack
,
)
=>
{
const
context
=
container
.
context
;
fetchEsHintMeta
({
fetchEsHintMeta
({
context
,
originMsg
:
"
「[?]」攻击时
"
,
originMsg
:
"
「[?]」攻击时
"
,
location
:
attack
.
attacker_location
,
location
:
attack
.
attacker_location
,
});
});
...
...
src/service/duel/attackDisable.ts
View file @
4dfc118d
import
{
ygopro
}
from
"
@/api
"
;
import
{
ygopro
}
from
"
@/api
"
;
import
{
fetchEsHintMeta
}
from
"
@/stores
"
;
import
{
Container
}
from
"
@/container
"
;
export
default
(
_
:
ygopro
.
StocGameMessage
.
MsgAttackDisabled
)
=>
{
import
{
fetchEsHintMeta
}
from
"
./util
"
;
fetchEsHintMeta
({
originMsg
:
"
攻击被无效时
"
});
export
default
(
container
:
Container
,
_
:
ygopro
.
StocGameMessage
.
MsgAttackDisabled
,
)
=>
{
fetchEsHintMeta
({
context
:
container
.
context
,
originMsg
:
"
攻击被无效时
"
});
};
};
src/service/duel/chaining.ts
View file @
4dfc118d
import
{
fetchCard
,
ygopro
}
from
"
@/api
"
;
import
{
fetchCard
,
ygopro
}
from
"
@/api
"
;
import
{
Container
}
from
"
@/container
"
;
import
{
Container
}
from
"
@/container
"
;
import
{
AudioActionType
,
playEffect
}
from
"
@/infra/audio
"
;
import
{
AudioActionType
,
playEffect
}
from
"
@/infra/audio
"
;
import
{
cardStore
,
fetchEsHintMeta
,
matStore
}
from
"
@/stores
"
;
import
{
cardStore
,
matStore
}
from
"
@/stores
"
;
import
{
callCardFocus
}
from
"
@/ui/Duel/PlayMat/Card
"
;
import
{
callCardFocus
}
from
"
@/ui/Duel/PlayMat/Card
"
;
import
{
fetchEsHintMeta
}
from
"
./util
"
;
export
default
async
(
export
default
async
(
container
:
Container
,
container
:
Container
,
chaining
:
ygopro
.
StocGameMessage
.
MsgChaining
,
chaining
:
ygopro
.
StocGameMessage
.
MsgChaining
,
)
=>
{
)
=>
{
playEffect
(
AudioActionType
.
SOUND_ACTIVATE
);
playEffect
(
AudioActionType
.
SOUND_ACTIVATE
);
const
context
=
container
.
context
;
fetchEsHintMeta
({
fetchEsHintMeta
({
context
,
originMsg
:
"
「[?]」被发动时
"
,
originMsg
:
"
「[?]」被发动时
"
,
cardID
:
chaining
.
code
,
cardID
:
chaining
.
code
,
});
});
const
context
=
container
.
context
;
const
location
=
chaining
.
location
;
const
location
=
chaining
.
location
;
// 将`location`添加到连锁栈
// 将`location`添加到连锁栈
...
...
src/service/duel/draw.ts
View file @
4dfc118d
import
{
fetchCard
,
ygopro
}
from
"
@/api
"
;
import
{
fetchCard
,
ygopro
}
from
"
@/api
"
;
import
{
Container
}
from
"
@/container
"
;
import
{
AudioActionType
,
playEffect
}
from
"
@/infra/audio
"
;
import
{
AudioActionType
,
playEffect
}
from
"
@/infra/audio
"
;
import
{
cardStore
,
fetchEsHintMeta
}
from
"
@/stores
"
;
import
{
cardStore
}
from
"
@/stores
"
;
import
{
callCardMove
}
from
"
@/ui/Duel/PlayMat/Card
"
;
import
{
callCardMove
}
from
"
@/ui/Duel/PlayMat/Card
"
;
export
default
async
(
draw
:
ygopro
.
StocGameMessage
.
MsgDraw
)
=>
{
import
{
fetchEsHintMeta
}
from
"
./util
"
;
fetchEsHintMeta
({
originMsg
:
"
玩家抽卡时
"
});
export
default
async
(
container
:
Container
,
draw
:
ygopro
.
StocGameMessage
.
MsgDraw
,
)
=>
{
const
context
=
container
.
context
;
fetchEsHintMeta
({
context
,
originMsg
:
"
玩家抽卡时
"
});
const
drawLength
=
draw
.
cards
.
length
;
const
drawLength
=
draw
.
cards
.
length
;
...
...
src/service/duel/flipSummoned.ts
View file @
4dfc118d
import
{
ygopro
}
from
"
@/api
"
;
import
{
ygopro
}
from
"
@/api
"
;
import
{
fetchEsHintMeta
}
from
"
@/stores
"
;
import
{
Container
}
from
"
@/container
"
;
export
default
(
_
:
ygopro
.
StocGameMessage
.
MsgFlipSummoned
)
=>
{
import
{
fetchEsHintMeta
}
from
"
./util
"
;
fetchEsHintMeta
({
originMsg
:
1608
});
export
default
(
container
:
Container
,
_
:
ygopro
.
StocGameMessage
.
MsgFlipSummoned
,
)
=>
{
fetchEsHintMeta
({
context
:
container
.
context
,
originMsg
:
1608
});
};
};
src/service/duel/flipSummoning.ts
View file @
4dfc118d
import
{
ygopro
}
from
"
@/api
"
;
import
{
ygopro
}
from
"
@/api
"
;
import
{
fetchEsHintMeta
}
from
"
@/stores
"
;
import
{
Container
}
from
"
@/container
"
;
export
default
(
flipSummoning
:
ygopro
.
StocGameMessage
.
MsgFlipSummoning
)
=>
{
import
{
fetchEsHintMeta
}
from
"
./util
"
;
export
default
(
container
:
Container
,
flipSummoning
:
ygopro
.
StocGameMessage
.
MsgFlipSummoning
,
)
=>
{
// playEffect(AudioActionType.SOUND_FILP);
// playEffect(AudioActionType.SOUND_FILP);
fetchEsHintMeta
({
fetchEsHintMeta
({
context
:
container
.
context
,
originMsg
:
"
「[?]」反转召唤宣言时
"
,
originMsg
:
"
「[?]」反转召唤宣言时
"
,
cardID
:
flipSummoning
.
code
,
cardID
:
flipSummoning
.
code
,
});
});
...
...
src/service/duel/gameMsg.ts
View file @
4dfc118d
...
@@ -119,7 +119,7 @@ export default async function handleGameMsg(
...
@@ -119,7 +119,7 @@ export default async function handleGameMsg(
break
;
break
;
}
}
case
"
draw
"
:
{
case
"
draw
"
:
{
await
onMsgDraw
(
msg
.
draw
);
await
onMsgDraw
(
container
,
msg
.
draw
);
break
;
break
;
}
}
...
@@ -134,7 +134,7 @@ export default async function handleGameMsg(
...
@@ -134,7 +134,7 @@ export default async function handleGameMsg(
break
;
break
;
}
}
case
"
hint
"
:
{
case
"
hint
"
:
{
await
onMsgHint
(
msg
.
hint
);
await
onMsgHint
(
container
,
msg
.
hint
);
break
;
break
;
}
}
...
@@ -188,7 +188,7 @@ export default async function handleGameMsg(
...
@@ -188,7 +188,7 @@ export default async function handleGameMsg(
break
;
break
;
}
}
case
"
pos_change
"
:
{
case
"
pos_change
"
:
{
await
onMsgPosChange
(
msg
.
pos_change
);
await
onMsgPosChange
(
container
,
msg
.
pos_change
);
break
;
break
;
}
}
...
@@ -203,7 +203,7 @@ export default async function handleGameMsg(
...
@@ -203,7 +203,7 @@ export default async function handleGameMsg(
break
;
break
;
}
}
case
"
update_hp
"
:
{
case
"
update_hp
"
:
{
onMsgUpdateHp
(
msg
.
update_hp
);
onMsgUpdateHp
(
container
,
msg
.
update_hp
);
break
;
break
;
}
}
...
@@ -253,22 +253,22 @@ export default async function handleGameMsg(
...
@@ -253,22 +253,22 @@ export default async function handleGameMsg(
break
;
break
;
}
}
case
"
set
"
:
{
case
"
set
"
:
{
onMsgSet
(
msg
.
set
);
onMsgSet
(
container
,
msg
.
set
);
break
;
break
;
}
}
case
"
swap
"
:
{
case
"
swap
"
:
{
onMsgSwap
(
msg
.
swap
);
onMsgSwap
(
container
,
msg
.
swap
);
break
;
break
;
}
}
case
"
attack
"
:
{
case
"
attack
"
:
{
await
onMsgAttack
(
msg
.
attack
);
await
onMsgAttack
(
container
,
msg
.
attack
);
break
;
break
;
}
}
case
"
attack_disable
"
:
{
case
"
attack_disable
"
:
{
onMsgAttackDisable
(
msg
.
attack_disable
);
onMsgAttackDisable
(
container
,
msg
.
attack_disable
);
break
;
break
;
}
}
...
@@ -287,32 +287,32 @@ export default async function handleGameMsg(
...
@@ -287,32 +287,32 @@ export default async function handleGameMsg(
break
;
break
;
}
}
case
"
summoning
"
:
{
case
"
summoning
"
:
{
onMsgSummoning
(
msg
.
summoning
);
onMsgSummoning
(
container
,
msg
.
summoning
);
break
;
break
;
}
}
case
"
summoned
"
:
{
case
"
summoned
"
:
{
onMsgSummoned
(
msg
.
summoned
);
onMsgSummoned
(
container
,
msg
.
summoned
);
break
;
break
;
}
}
case
"
flip_summoning
"
:
{
case
"
flip_summoning
"
:
{
onMsgFlipSummoning
(
msg
.
flip_summoning
);
onMsgFlipSummoning
(
container
,
msg
.
flip_summoning
);
break
;
break
;
}
}
case
"
flip_summoned
"
:
{
case
"
flip_summoned
"
:
{
onMsgFilpSummoned
(
msg
.
flip_summoned
);
onMsgFilpSummoned
(
container
,
msg
.
flip_summoned
);
break
;
break
;
}
}
case
"
sp_summoning
"
:
{
case
"
sp_summoning
"
:
{
onMsgSpSummoning
(
msg
.
sp_summoning
);
onMsgSpSummoning
(
container
,
msg
.
sp_summoning
);
break
;
break
;
}
}
case
"
sp_summoned
"
:
{
case
"
sp_summoned
"
:
{
onMsgSpSummoned
(
msg
.
sp_summoned
);
onMsgSpSummoned
(
container
,
msg
.
sp_summoned
);
break
;
break
;
}
}
...
...
src/service/duel/hint.ts
View file @
4dfc118d
import
{
ygopro
}
from
"
@/api
"
;
import
{
ygopro
}
from
"
@/api
"
;
import
{
import
{
fetchCommonHintMeta
,
fetchSelectHintMeta
}
from
"
@/stores
"
;
fetchCommonHintMeta
,
fetchEsHintMeta
,
fetchSelectHintMeta
,
}
from
"
@/stores
"
;
import
MsgHint
=
ygopro
.
StocGameMessage
.
MsgHint
;
import
MsgHint
=
ygopro
.
StocGameMessage
.
MsgHint
;
import
{
Container
}
from
"
@/container
"
;
export
default
async
(
hint
:
MsgHint
)
=>
{
import
{
fetchEsHintMeta
}
from
"
./util
"
;
export
default
async
(
container
:
Container
,
hint
:
MsgHint
)
=>
{
switch
(
hint
.
hint_type
)
{
switch
(
hint
.
hint_type
)
{
case
MsgHint
.
HintType
.
HINT_EVENT
:
{
case
MsgHint
.
HintType
.
HINT_EVENT
:
{
await
fetchEsHintMeta
({
originMsg
:
hint
.
hint_data
});
await
fetchEsHintMeta
({
context
:
container
.
context
,
originMsg
:
hint
.
hint_data
,
});
break
;
break
;
}
}
case
MsgHint
.
HintType
.
HINT_MESSAGE
:
{
case
MsgHint
.
HintType
.
HINT_MESSAGE
:
{
...
...
src/service/duel/posChange.ts
View file @
4dfc118d
import
{
ygopro
}
from
"
@/api
"
;
import
{
ygopro
}
from
"
@/api
"
;
import
MsgPosChange
=
ygopro
.
StocGameMessage
.
MsgPosChange
;
import
MsgPosChange
=
ygopro
.
StocGameMessage
.
MsgPosChange
;
import
{
cardStore
,
fetchEsHintMeta
}
from
"
@/stores
"
;
import
{
Container
}
from
"
@/container
"
;
import
{
cardStore
}
from
"
@/stores
"
;
import
{
callCardMove
}
from
"
@/ui/Duel/PlayMat/Card
"
;
import
{
callCardMove
}
from
"
@/ui/Duel/PlayMat/Card
"
;
export
default
async
(
posChange
:
MsgPosChange
)
=>
{
import
{
fetchEsHintMeta
}
from
"
./util
"
;
export
default
async
(
container
:
Container
,
posChange
:
MsgPosChange
)
=>
{
const
context
=
container
.
context
;
const
{
location
,
controller
,
sequence
}
=
posChange
.
card_info
;
const
{
location
,
controller
,
sequence
}
=
posChange
.
card_info
;
const
target
=
cardStore
.
at
(
location
,
controller
,
sequence
);
const
target
=
cardStore
.
at
(
location
,
controller
,
sequence
);
...
@@ -17,6 +21,7 @@ export default async (posChange: MsgPosChange) => {
...
@@ -17,6 +21,7 @@ export default async (posChange: MsgPosChange) => {
}
}
fetchEsHintMeta
({
fetchEsHintMeta
({
context
,
originMsg
:
1600
,
originMsg
:
1600
,
});
});
};
};
src/service/duel/set.ts
View file @
4dfc118d
import
{
ygopro
}
from
"
@/api
"
;
import
{
ygopro
}
from
"
@/api
"
;
import
{
fetchEsHintMeta
}
from
"
@/stores
"
;
import
{
Container
}
from
"
@/container
"
;
export
default
(
_set
:
ygopro
.
StocGameMessage
.
MsgSet
)
=>
{
import
{
fetchEsHintMeta
}
from
"
./util
"
;
fetchEsHintMeta
({
originMsg
:
1601
});
export
default
(
container
:
Container
,
_set
:
ygopro
.
StocGameMessage
.
MsgSet
)
=>
{
fetchEsHintMeta
({
context
:
container
.
context
,
originMsg
:
1601
});
};
};
src/service/duel/spSummoned.ts
View file @
4dfc118d
import
{
ygopro
}
from
"
@/api
"
;
import
{
ygopro
}
from
"
@/api
"
;
import
{
fetchEsHintMeta
}
from
"
@/stores
"
;
import
{
Container
}
from
"
@/container
"
;
export
default
(
_
:
ygopro
.
StocGameMessage
.
MsgSpSummoned
)
=>
{
import
{
fetchEsHintMeta
}
from
"
./util
"
;
fetchEsHintMeta
({
originMsg
:
1606
});
export
default
(
container
:
Container
,
_
:
ygopro
.
StocGameMessage
.
MsgSpSummoned
,
)
=>
{
fetchEsHintMeta
({
context
:
container
.
context
,
originMsg
:
1606
});
};
};
src/service/duel/spSummoning.ts
View file @
4dfc118d
import
{
ygopro
}
from
"
@/api
"
;
import
{
ygopro
}
from
"
@/api
"
;
import
{
fetchEsHintMeta
}
from
"
@/stores
"
;
import
{
Container
}
from
"
@/container
"
;
export
default
(
spSummoning
:
ygopro
.
StocGameMessage
.
MsgSpSummoning
)
=>
{
import
{
fetchEsHintMeta
}
from
"
./util
"
;
export
default
(
container
:
Container
,
spSummoning
:
ygopro
.
StocGameMessage
.
MsgSpSummoning
,
)
=>
{
// const card = fetchCard(spSummoning.code);
// const card = fetchCard(spSummoning.code);
// if (card.data.type && card.data.type & TYPE_TOKEN) {
// if (card.data.type && card.data.type & TYPE_TOKEN) {
// playEffect(AudioActionType.SOUND_TOKEN);
// playEffect(AudioActionType.SOUND_TOKEN);
...
@@ -9,6 +14,7 @@ export default (spSummoning: ygopro.StocGameMessage.MsgSpSummoning) => {
...
@@ -9,6 +14,7 @@ export default (spSummoning: ygopro.StocGameMessage.MsgSpSummoning) => {
// playEffect(AudioActionType.SOUND_SPECIAL_SUMMON);
// playEffect(AudioActionType.SOUND_SPECIAL_SUMMON);
// }
// }
fetchEsHintMeta
({
fetchEsHintMeta
({
context
:
container
.
context
,
originMsg
:
"
「[?]」特殊召唤宣言时
"
,
originMsg
:
"
「[?]」特殊召唤宣言时
"
,
cardID
:
spSummoning
.
code
,
cardID
:
spSummoning
.
code
,
});
});
...
...
src/service/duel/summoned.ts
View file @
4dfc118d
import
{
ygopro
}
from
"
@/api
"
;
import
{
ygopro
}
from
"
@/api
"
;
import
{
fetchEsHintMeta
}
from
"
@/stores
"
;
import
{
Container
}
from
"
@/container
"
;
export
default
(
_
:
ygopro
.
StocGameMessage
.
MsgSummoned
)
=>
{
import
{
fetchEsHintMeta
}
from
"
./util
"
;
fetchEsHintMeta
({
originMsg
:
1604
});
export
default
(
container
:
Container
,
_
:
ygopro
.
StocGameMessage
.
MsgSummoned
,
)
=>
{
fetchEsHintMeta
({
context
:
container
.
context
,
originMsg
:
1604
});
};
};
src/service/duel/summoning.ts
View file @
4dfc118d
import
{
ygopro
}
from
"
@/api
"
;
import
{
ygopro
}
from
"
@/api
"
;
import
{
fetchEsHintMeta
}
from
"
@/stores
"
;
import
{
Container
}
from
"
@/container
"
;
export
default
(
summoning
:
ygopro
.
StocGameMessage
.
MsgSummoning
)
=>
{
import
{
fetchEsHintMeta
}
from
"
./util
"
;
export
default
(
container
:
Container
,
summoning
:
ygopro
.
StocGameMessage
.
MsgSummoning
,
)
=>
{
/* 因为现在Neos动画架构的问题,这里播放音效的话会滞后于移动动画,
/* 因为现在Neos动画架构的问题,这里播放音效的话会滞后于移动动画,
* 因此这里先注释掉,等解决掉上述问题后再加上召唤的音效。
* 因此这里先注释掉,等解决掉上述问题后再加上召唤的音效。
* */
* */
// playEffect(AudioActionType.SOUND_SUMMON);
// playEffect(AudioActionType.SOUND_SUMMON);
fetchEsHintMeta
({
fetchEsHintMeta
({
context
:
container
.
context
,
originMsg
:
"
「[?]」通常召唤宣言时
"
,
originMsg
:
"
「[?]」通常召唤宣言时
"
,
cardID
:
summoning
.
code
,
cardID
:
summoning
.
code
,
});
});
...
...
src/service/duel/swap.ts
View file @
4dfc118d
import
{
ygopro
}
from
"
@/api
"
;
import
{
ygopro
}
from
"
@/api
"
;
import
{
fetchEsHintMeta
}
from
"
@/stores
"
;
import
{
Container
}
from
"
@/container
"
;
export
default
(
_swap
:
ygopro
.
StocGameMessage
.
MsgSwap
)
=>
{
import
{
fetchEsHintMeta
}
from
"
./util
"
;
fetchEsHintMeta
({
originMsg
:
1602
});
export
default
(
container
:
Container
,
_swap
:
ygopro
.
StocGameMessage
.
MsgSwap
,
)
=>
{
fetchEsHintMeta
({
context
:
container
.
context
,
originMsg
:
1602
});
};
};
src/service/duel/updateHp.ts
View file @
4dfc118d
import
{
ygopro
}
from
"
@/api
"
;
import
{
ygopro
}
from
"
@/api
"
;
import
{
fetchEsHintMeta
,
matStore
}
from
"
@/stores
"
;
import
{
matStore
}
from
"
@/stores
"
;
import
MsgUpdateHp
=
ygopro
.
StocGameMessage
.
MsgUpdateHp
;
import
MsgUpdateHp
=
ygopro
.
StocGameMessage
.
MsgUpdateHp
;
import
{
Container
}
from
"
@/container
"
;
import
{
AudioActionType
,
changeScene
,
playEffect
}
from
"
@/infra/audio
"
;
import
{
AudioActionType
,
changeScene
,
playEffect
}
from
"
@/infra/audio
"
;
export
default
(
msgUpdateHp
:
MsgUpdateHp
)
=>
{
import
{
fetchEsHintMeta
}
from
"
./util
"
;
export
default
(
container
:
Container
,
msgUpdateHp
:
MsgUpdateHp
)
=>
{
const
context
=
container
.
context
;
if
(
msgUpdateHp
.
type_
===
MsgUpdateHp
.
ActionType
.
DAMAGE
)
{
if
(
msgUpdateHp
.
type_
===
MsgUpdateHp
.
ActionType
.
DAMAGE
)
{
playEffect
(
AudioActionType
.
SOUND_DAMAGE
);
playEffect
(
AudioActionType
.
SOUND_DAMAGE
);
fetchEsHintMeta
({
originMsg
:
"
玩家收到伤害时
"
});
// TODO: i18n
fetchEsHintMeta
({
context
,
originMsg
:
"
玩家收到伤害时
"
});
// TODO: i18n
matStore
.
initInfo
.
of
(
msgUpdateHp
.
player
).
life
-=
msgUpdateHp
.
value
;
matStore
.
initInfo
.
of
(
msgUpdateHp
.
player
).
life
-=
msgUpdateHp
.
value
;
}
else
if
(
msgUpdateHp
.
type_
===
MsgUpdateHp
.
ActionType
.
RECOVER
)
{
}
else
if
(
msgUpdateHp
.
type_
===
MsgUpdateHp
.
ActionType
.
RECOVER
)
{
playEffect
(
AudioActionType
.
SOUND_RECOVER
);
playEffect
(
AudioActionType
.
SOUND_RECOVER
);
fetchEsHintMeta
({
originMsg
:
"
玩家生命值回复时
"
});
// TODO: i18n
fetchEsHintMeta
({
context
,
originMsg
:
"
玩家生命值回复时
"
});
// TODO: i18n
matStore
.
initInfo
.
of
(
msgUpdateHp
.
player
).
life
+=
msgUpdateHp
.
value
;
matStore
.
initInfo
.
of
(
msgUpdateHp
.
player
).
life
+=
msgUpdateHp
.
value
;
}
}
if
(
matStore
.
initInfo
.
me
.
life
>
matStore
.
initInfo
.
op
.
life
*
2
)
{
if
(
matStore
.
initInfo
.
me
.
life
>
matStore
.
initInfo
.
op
.
life
*
2
)
{
...
...
src/service/duel/util.ts
View file @
4dfc118d
import
{
ygopro
}
from
"
@/api
"
;
import
{
ygopro
}
from
"
@/api
"
;
const
{
MZONE
,
SZONE
,
HAND
}
=
ygopro
.
CardZone
;
const
{
MZONE
,
SZONE
,
HAND
}
=
ygopro
.
CardZone
;
import
{
fetchStrings
}
from
"
@/api
"
;
import
{
Region
}
from
"
@/api
"
;
import
{
fetchCard
}
from
"
@/api/cards
"
;
import
{
Context
}
from
"
@/container
"
;
export
function
isAllOnField
(
locations
:
ygopro
.
CardLocation
[]):
boolean
{
export
function
isAllOnField
(
locations
:
ygopro
.
CardLocation
[]):
boolean
{
const
isOnField
=
(
location
:
ygopro
.
CardLocation
)
=>
{
const
isOnField
=
(
location
:
ygopro
.
CardLocation
)
=>
{
...
@@ -53,3 +57,41 @@ export function argmax<T>(arr: T[], getValue: (item: T) => number): number {
...
@@ -53,3 +57,41 @@ export function argmax<T>(arr: T[], getValue: (item: T) => number): number {
return
maxIndex
;
return
maxIndex
;
}
}
export
const
fetchEsHintMeta
=
async
({
context
,
originMsg
,
location
,
cardID
,
}:
{
context
:
Context
;
originMsg
:
string
|
number
;
location
?:
ygopro
.
CardLocation
;
cardID
?:
number
;
})
=>
{
const
newOriginMsg
=
typeof
originMsg
===
"
string
"
?
originMsg
:
fetchStrings
(
Region
.
System
,
originMsg
);
const
cardMeta
=
cardID
?
fetchCard
(
cardID
)
:
undefined
;
let
esHint
=
newOriginMsg
;
if
(
cardMeta
?.
text
.
name
)
{
esHint
=
esHint
.
replace
(
"
[?]
"
,
cardMeta
.
text
.
name
);
}
if
(
location
)
{
const
fieldMeta
=
context
.
cardStore
.
at
(
location
.
zone
,
location
.
controller
,
location
.
sequence
,
);
if
(
fieldMeta
?.
meta
.
text
.
name
)
{
esHint
=
esHint
.
replace
(
"
[?]
"
,
fieldMeta
.
meta
.
text
.
name
);
}
}
context
.
matStore
.
hint
.
esHint
=
esHint
;
};
src/stores/cardStore.ts
View file @
4dfc118d
...
@@ -94,6 +94,3 @@ export class CardStore implements NeosStore {
...
@@ -94,6 +94,3 @@ export class CardStore implements NeosStore {
}
}
export
const
cardStore
=
proxy
(
new
CardStore
());
export
const
cardStore
=
proxy
(
new
CardStore
());
// @ts-ignore
window
.
cardStore
=
cardStore
;
src/stores/matStore/methods/fetchHint.ts
View file @
4dfc118d
import
{
Region
,
type
ygopro
}
from
"
@/api
"
;
import
{
Region
}
from
"
@/api
"
;
import
{
DESCRIPTION_LIMIT
,
fetchStrings
,
getStrings
}
from
"
@/api
"
;
import
{
DESCRIPTION_LIMIT
,
fetchStrings
,
getStrings
}
from
"
@/api
"
;
import
{
fetchCard
}
from
"
@/api/cards
"
;
import
{
fetchCard
}
from
"
@/api/cards
"
;
import
{
cardStore
}
from
"
@/stores/cardStore
"
;
import
{
matStore
}
from
"
../store
"
;
import
{
matStore
}
from
"
../store
"
;
...
@@ -38,39 +37,3 @@ export const fetchSelectHintMeta = ({
...
@@ -38,39 +37,3 @@ export const fetchSelectHintMeta = ({
matStore
.
hint
.
esHint
=
esHint
;
matStore
.
hint
.
esHint
=
esHint
;
}
}
};
};
export
const
fetchEsHintMeta
=
async
({
originMsg
,
location
,
cardID
,
}:
{
originMsg
:
string
|
number
;
location
?:
ygopro
.
CardLocation
;
cardID
?:
number
;
})
=>
{
const
newOriginMsg
=
typeof
originMsg
===
"
string
"
?
originMsg
:
fetchStrings
(
Region
.
System
,
originMsg
);
const
cardMeta
=
cardID
?
fetchCard
(
cardID
)
:
undefined
;
let
esHint
=
newOriginMsg
;
if
(
cardMeta
?.
text
.
name
)
{
esHint
=
esHint
.
replace
(
"
[?]
"
,
cardMeta
.
text
.
name
);
}
if
(
location
)
{
const
fieldMeta
=
cardStore
.
at
(
location
.
zone
,
location
.
controller
,
location
.
sequence
,
);
if
(
fieldMeta
?.
meta
.
text
.
name
)
{
esHint
=
esHint
.
replace
(
"
[?]
"
,
fieldMeta
.
meta
.
text
.
name
);
}
}
matStore
.
hint
.
esHint
=
esHint
;
};
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