Skip to content

Commit 1da80df

Browse files
committed
🧑‍💻 スニーク時のフラグ処理を追加
1 parent d68c492 commit 1da80df

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+855
-4
lines changed

TheSkyBlessing/data/asset_manager/functions/artifact/_index.d.mcfunction

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@
3939
# asset_manager:artifact/check/**
4040
#declare tag CheckFailed
4141

42-
#> スニークの閾値用スコアホルダー
43-
# @within function asset_manager:artifact/triggers/sneak/*
44-
#declare score_holder $SneakThreshold
42+
#> スニーク用スコアホルダー
43+
# @within function asset_manager:artifact/triggers/*sneak*/*
44+
#declare score_holder $SneakTime
4545

4646
#> use_itemの誤検知対策タグ
4747
# @within function

TheSkyBlessing/data/asset_manager/functions/artifact/triggers/.mcfunction

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@
1818
execute if data storage asset:artifact {EquipmentChanges:[{_:{_:false}}]} run function asset_manager:artifact/triggers/equipments/update_cooldown/
1919
execute if data storage asset:artifact {EquipmentChanges:[{_:{_:false}}]} run function asset_manager:artifact/triggers/equipments/update_cooldown_type
2020
execute if data storage asset:artifact {EquipmentChanges:[{_:{_:false}}]} run function asset_manager:artifact/triggers/equipments/update_attribute/
21+
execute if data storage asset:artifact {EquipmentChanges:[{_:{_:false}}]} if entity @s[tag=TriggerFlag.Sneak] run function asset_manager:artifact/triggers/event/sneak/reset_when_change_item
2122
# 改宗時の更新処理
2223
execute if entity @s[tag=Believe.Changed] unless data storage asset:artifact {EquipmentChanges:[{_:{_:false}}]} run function asset_manager:artifact/triggers/equipments/update_attribute/
24+
execute if entity @s[tag=Believe.Changed] unless data storage asset:artifact {EquipmentChanges:[{_:{_:false}}]} run function asset_manager:artifact/triggers/event/sneak/reset
2325
# バニラ攻撃をしているならフラグを建てる
2426
execute if data storage asset:artifact ArtifactEvents.Attack[{Type:"vanilla_melee"}] run tag @s add ShouldVanillaAttack
2527
# 各神器にトリガー受けわたし
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#> asset_manager:artifact/triggers/event/sneak/get_sneak_time/
2+
#
3+
#
4+
#
5+
# @within function asset_manager:artifact/triggers/*sneak*/
6+
7+
execute if data storage asset:artifact TargetItem{Slot:"mainhand"} store result storage asset:context SneakTime int 1 run scoreboard players get @s Sneak.Mainhand
8+
execute if data storage asset:artifact TargetItem{Slot:"offhand"} store result storage asset:context SneakTime int 1 run scoreboard players get @s Sneak.Offhand
9+
execute if data storage asset:artifact TargetItem{Slot:"feet"} store result storage asset:context SneakTime int 1 run scoreboard players get @s Sneak.Feet
10+
execute if data storage asset:artifact TargetItem{Slot:"legs"} store result storage asset:context SneakTime int 1 run scoreboard players get @s Sneak.Legs
11+
execute if data storage asset:artifact TargetItem{Slot:"chest"} store result storage asset:context SneakTime int 1 run scoreboard players get @s Sneak.Chest
12+
execute if data storage asset:artifact TargetItem{Slot:"head"} store result storage asset:context SneakTime int 1 run scoreboard players get @s Sneak.Head
13+
execute if data storage asset:artifact TargetItem{Slot:"hotbar"} store result storage asset:context SneakTime int 1 run function asset_manager:artifact/triggers/event/sneak/get_sneak_time/hotbar.m with storage asset:artifact TargetItem
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#> asset_manager:artifact/triggers/event/sneak/get_sneak_time/hotbar.m
2+
#
3+
#
4+
#
5+
# @input args InvSlot : int
6+
# @within function asset_manager:artifact/triggers/event/sneak/get_sneak_time/
7+
8+
$return run scoreboard players get @s Sneak.Hotbar$(InvSlot)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#> asset_manager:artifact/triggers/event/sneak/reset
2+
#
3+
#
4+
#
5+
# @within function
6+
# core:tick/player/post
7+
# asset_manager:artifact/triggers/
8+
9+
scoreboard players reset @s Sneak.Mainhand
10+
scoreboard players reset @s Sneak.Offhand
11+
scoreboard players reset @s Sneak.Head
12+
scoreboard players reset @s Sneak.Chest
13+
scoreboard players reset @s Sneak.Legs
14+
scoreboard players reset @s Sneak.Feet
15+
scoreboard players reset @s Sneak.Hotbar0
16+
scoreboard players reset @s Sneak.Hotbar1
17+
scoreboard players reset @s Sneak.Hotbar2
18+
scoreboard players reset @s Sneak.Hotbar3
19+
scoreboard players reset @s Sneak.Hotbar4
20+
scoreboard players reset @s Sneak.Hotbar5
21+
scoreboard players reset @s Sneak.Hotbar6
22+
scoreboard players reset @s Sneak.Hotbar7
23+
scoreboard players reset @s Sneak.Hotbar8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#> asset_manager:artifact/triggers/event/sneak/reset_when_change_item
2+
#
3+
#
4+
#
5+
# @within function asset_manager:artifact/triggers/
6+
7+
execute if data storage asset:artifact EquipmentChanges[00]._{_:false} run scoreboard players set @s Sneak.Mainhand 1
8+
execute if data storage asset:artifact EquipmentChanges[01]._{_:false} run scoreboard players set @s Sneak.Offhand 1
9+
execute if data storage asset:artifact EquipmentChanges[02]._{_:false} run scoreboard players set @s Sneak.Head 1
10+
execute if data storage asset:artifact EquipmentChanges[03]._{_:false} run scoreboard players set @s Sneak.Chest 1
11+
execute if data storage asset:artifact EquipmentChanges[04]._{_:false} run scoreboard players set @s Sneak.Legs 1
12+
execute if data storage asset:artifact EquipmentChanges[05]._{_:false} run scoreboard players set @s Sneak.Feet 1
13+
execute if data storage asset:artifact EquipmentChanges[06]._{_:false} run scoreboard players set @s Sneak.Hotbar0 1
14+
execute if data storage asset:artifact EquipmentChanges[07]._{_:false} run scoreboard players set @s Sneak.Hotbar1 1
15+
execute if data storage asset:artifact EquipmentChanges[08]._{_:false} run scoreboard players set @s Sneak.Hotbar2 1
16+
execute if data storage asset:artifact EquipmentChanges[09]._{_:false} run scoreboard players set @s Sneak.Hotbar3 1
17+
execute if data storage asset:artifact EquipmentChanges[10]._{_:false} run scoreboard players set @s Sneak.Hotbar4 1
18+
execute if data storage asset:artifact EquipmentChanges[11]._{_:false} run scoreboard players set @s Sneak.Hotbar5 1
19+
execute if data storage asset:artifact EquipmentChanges[12]._{_:false} run scoreboard players set @s Sneak.Hotbar6 1
20+
execute if data storage asset:artifact EquipmentChanges[13]._{_:false} run scoreboard players set @s Sneak.Hotbar7 1
21+
execute if data storage asset:artifact EquipmentChanges[14]._{_:false} run scoreboard players set @s Sneak.Hotbar8 1
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#> asset_manager:artifact/triggers/keep_sneak/
2+
#
3+
# 各神器処理へデータ受け渡し
4+
#
5+
# @within function asset_manager:artifact/triggers/
6+
7+
# フラグが存在しているか確認する
8+
execute if entity @s[tag=!TriggerFlag.Sneak] run return fail
9+
# スニークしている時間を取得する
10+
function asset_manager:artifact/triggers/event/sneak/get_sneak_time/
11+
execute store result score $SneakTime Temporary run data get storage asset:context SneakTime
12+
# 使用条件を満たしているか確認する
13+
execute if score $SneakTime Temporary matches 1.. run function asset_manager:artifact/check/
14+
execute if score $SneakTime Temporary matches 1.. run function asset_manager:artifact/triggers/keep_sneak/check.m with storage asset:context
15+
# 条件を満たしていれば使用する
16+
execute if entity @s[tag=CanUsed] run function asset_manager:artifact/triggers/keep_sneak/use
17+
18+
# リセット
19+
scoreboard players reset $SneakTime Temporary
20+
tag @s remove CanUsed
21+
data remove storage asset:context SneakTime
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#> asset_manager:artifact/triggers/keep_sneak/check.m
2+
#
3+
#
4+
#
5+
# @input args id : int
6+
# @within function asset_manager:artifact/triggers/keep_sneak/
7+
8+
$function asset:artifact/alias/$(id)/keep_sneak/check
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#> asset_manager:artifact/triggers/keep_sneak/keep_sneak.m
2+
#
3+
#
4+
#
5+
# @input args id : int
6+
# @within function asset_manager:artifact/triggers/keep_sneak/use
7+
8+
$function asset:artifact/alias/$(id)/keep_sneak/
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#> asset_manager:artifact/triggers/keep_sneak/use
2+
#
3+
#
4+
#
5+
# @within function asset_manager:artifact/triggers/keep_sneak/
6+
7+
# 共通処理
8+
# アイテムを破壊するとBrokeItemが追加される
9+
function asset_manager:artifact/use/
10+
11+
# 処理対象の神器の重複数を取得する
12+
execute store result storage asset:context Count int 1 if data storage asset:artifact TargetItemList[]
13+
14+
# 神器を呼び出し
15+
function asset_manager:artifact/triggers/keep_sneak/keep_sneak.m with storage asset:context
16+
17+
# リセット
18+
data remove storage asset:context BrokeItem
19+
data remove storage asset:context Count

0 commit comments

Comments
 (0)