Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🧑‍💻 Triggerの並列化 #1489

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

#> ReturnTag
# @within function
# asset:artifact/*/*/2.check_condition
# asset:artifact/*/*/2.check_condition/**
# asset_manager:artifact/check/
# asset:artifact/*/*/**check_condition
# asset:artifact/*/*/**check_condition/**
# asset_manager:artifact/check/.m
# asset:artifact/common/use/*
#declare tag CanUsed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
# 発動可能な場合実行者に`CanUsed`のtagが付与されます。
#
# @output tag @s CanUsed
# @within function asset:artifact/*/*/2.check_condition
# @within function asset:artifact/*/**check_condition

data modify storage asset:artifact TargetSlot set value 'auto'
function asset_manager:artifact/check/
execute unless data storage asset:artifact Index run data modify storage asset:artifact Index set value 0
function asset_manager:artifact/check/.m with storage asset:artifact
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
# 発動可能な場合実行者に`CanUsed`のtagが付与されます。
#
# @output tag @s CanUsed
# @within function asset:artifact/*/*/2.check_condition
# @within function asset:artifact/*/**check_condition

data modify storage asset:artifact TargetSlot set value 'chest'
function asset_manager:artifact/check/
execute unless data storage asset:artifact Index run data modify storage asset:artifact Index set value 0
function asset_manager:artifact/check/.m with storage asset:artifact
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
# 発動可能な場合実行者に`CanUsed`のtagが付与されます。
#
# @output tag @s CanUsed
# @within function asset:artifact/*/*/2.check_condition
# @within function asset:artifact/*/**check_condition

data modify storage asset:artifact TargetSlot set value 'feet'
function asset_manager:artifact/check/
execute unless data storage asset:artifact Index run data modify storage asset:artifact Index set value 0
function asset_manager:artifact/check/.m with storage asset:artifact
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
# 発動可能な場合実行者に`CanUsed`のtagが付与されます。
#
# @output tag @s CanUsed
# @within function asset:artifact/*/*/2.check_condition
# @within function asset:artifact/*/*/**check_condition

data modify storage asset:artifact TargetSlot set value 'head'
function asset_manager:artifact/check/
execute unless data storage asset:artifact Index run data modify storage asset:artifact Index set value 0
function asset_manager:artifact/check/.m with storage asset:artifact
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
# 発動可能な場合実行者に`CanUsed`のtagが付与されます。
#
# @output tag @s CanUsed
# @within function asset:artifact/*/*/2.check_condition
# @within function asset:artifact/*/*/**check_condition

data modify storage asset:artifact TargetSlot set value 'hotbar'
function asset_manager:artifact/check/
execute unless data storage asset:artifact Index run data modify storage asset:artifact Index set value 0
function asset_manager:artifact/check/.m with storage asset:artifact
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
# 発動可能な場合実行者に`CanUsed`のtagが付与されます。
#
# @output tag @s CanUsed
# @within function asset:artifact/*/*/2.check_condition
# @within function asset:artifact/*/*/**check_condition

data modify storage asset:artifact TargetSlot set value 'legs'
function asset_manager:artifact/check/
execute unless data storage asset:artifact Index run data modify storage asset:artifact Index set value 0
function asset_manager:artifact/check/.m with storage asset:artifact
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
#
# @input as player
# @output tag @s CanUsed
# @within function asset:artifact/*/*/2.check_condition
# @within function asset:artifact/*/*/**check_condition

data modify storage asset:artifact TargetSlot set value 'mainhand'
function asset_manager:artifact/check/
execute unless data storage asset:artifact Index run data modify storage asset:artifact Index set value 0
function asset_manager:artifact/check/.m with storage asset:artifact
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
# 発動可能な場合実行者に`CanUsed`のtagが付与されます。
#
# @output tag @s CanUsed
# @within function asset:artifact/*/*/2.check_condition
# @within function asset:artifact/*/*/**check_condition

data modify storage asset:artifact TargetSlot set value 'offhand'
function asset_manager:artifact/check/
execute unless data storage asset:artifact Index run data modify storage asset:artifact Index set value 0
function asset_manager:artifact/check/.m with storage asset:artifact
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,18 @@
# Name : TextComponent
# Lore : TextComponent[]
# RemainingCount? : int
# Slot : Slot
# Trigger : Trigger
# Condition? : TextComponent
# AttackInfo? : Component
# MPCost : int
# MPRequire? : int
# CostText? : TextComponent
# LocalCooldown? : int
# SpecialCooldown? : int
# DisableCooldownMessage? : boolean
# DisableMPMessage? : boolean
# Triggers : Component[]
# ├ Slot : Slot
# ├ Trigger : Trigger
# ├ Condition? : TextComponent
# ├ AttackInfo? : Component
# ├ MPCost : int
# ├ MPRequire? : int
# ├ CostText? : TextComponent
# ├ LocalCooldown? : int
# ├ SpecialCooldown? : int
# ├ DisableCooldownMessage? : boolean
# └ DisableMPMessage? : boolean
# CanUsedGod : God[]
# @output item 神器
# @within function asset:artifact/*/give/2.give
Expand All @@ -27,14 +28,19 @@
# @private
#declare score_holder $InvSize

# Triggerの並列化
execute unless data storage asset:artifact Triggers[0] run function asset:artifact/common/trigger/migrate

# storage検証
execute unless data storage asset:artifact ID run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"引数が足りません"},{"text":" ID","color":"red"}]
execute unless data storage asset:artifact Item run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"引数が足りません"},{"text":" Item","color":"red"}]
execute unless data storage asset:artifact Name run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"引数が足りません"},{"text":" Name","color":"red"}]
execute unless data storage asset:artifact Lore run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"引数が足りません"},{"text":" Lore","color":"red"}]
execute unless data storage asset:artifact Slot run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"引数が足りません"},{"text":" Slot","color":"red"}]
execute unless data storage asset:artifact Trigger run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"引数が足りません"},{"text":" Trigger","color":"red"}]
execute unless data storage asset:artifact MPCost run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"引数が足りません"},{"text":" MPCost","color":"red"}]
# execute unless data storage asset:artifact RemainingCount run
# execute unless data storage asset:artifact Triggers[0] run
execute if data storage asset:artifact Triggers[0] run data modify storage asset:temp Triggers set from storage asset:artifact Triggers
execute if data storage asset:artifact Triggers[0] run function asset:artifact/common/trigger/check
execute if data storage asset:artifact Triggers[0] run data remove storage asset:temp Triggers
execute unless data storage asset:artifact CanUsedGod run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"引数が足りません"},{"text":" CanUsedGod","color":"red"}]
# 各データ設定
function asset_manager:artifact/create/set_data
Expand All @@ -57,16 +63,6 @@
data remove storage asset:artifact Name
data remove storage asset:artifact Lore
data remove storage asset:artifact RemainingCount
data remove storage asset:artifact Slot
data remove storage asset:artifact Trigger
data remove storage asset:artifact Condition
data remove storage asset:artifact AttackInfo
data remove storage asset:artifact MPCost
data remove storage asset:artifact MPRequire
data remove storage asset:artifact CostText
data remove storage asset:artifact Triggers
data remove storage asset:artifact CanUsedGod
data remove storage asset:artifact CustomNBT
data remove storage asset:artifact LocalCooldown
data remove storage asset:artifact SpecialCooldown
data remove storage asset:artifact DisableCooldownMessage
data remove storage asset:artifact DisableMPMessage
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#> asset:artifact/common/trigger/check
# @within function
# asset:artifact/common/give
# asset:artifact/common/trigger/check

# validate
execute unless data storage asset:temp Triggers[-1].Slot run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"引数が足りません"},{"text":" Slot","color":"red"}]
execute unless data storage asset:temp Triggers[-1].Trigger run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"引数が足りません"},{"text":" Trigger","color":"red"}]
# execute unless data storage asset:temp Triggers[-1].Condition run
# execute unless data storage asset:temp Triggers[-1].AttackInfo run
execute unless data storage asset:temp Triggers[-1].MPCost run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"引数が足りません"},{"text":" MPCost","color":"red"}]
# execute unless data storage asset:temp Triggers[-1].MPRequire run
# execute unless data storage asset:temp Triggers[-1].CostText run
# execute unless data storage asset:temp Triggers[-1].LocalCooldown run
# execute unless data storage asset:temp Triggers[-1].SpecialCooldown run
# execute unless data storage asset:temp Triggers[-1].DisableCooldownMessage run
# execute unless data storage asset:temp Triggers[-1].DiableMPMessage run

# loop
data remove storage asset:temp Triggers[-1]
execute if data storage asset:temp Triggers[0] run function asset:artifact/common/trigger/check
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#> asset:artifact/common/trigger/migrate
# @within function asset:artifact/common/give

# validate
execute unless data storage asset:artifact Slot run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"引数が足りません"},{"text":" Slot","color":"red"}]
execute unless data storage asset:artifact Trigger run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"引数が足りません"},{"text":" Trigger","color":"red"}]
# execute unless data storage asset:artifact Condition run
# execute unless data storage asset:artifact AttackInfo run
execute unless data storage asset:artifact MPCost run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"引数が足りません"},{"text":" MPCost","color":"red"}]
# execute unless data storage asset:artifact MPRequire run
# execute unless data storage asset:artifact CostText run
# execute unless data storage asset:artifact LocalCooldown run
# execute unless data storage asset:artifact SpecialCooldown run
# execute unless data storage asset:artifact DisableCooldownMessage run
# execute unless data storage asset:artifact DiableMPMessage run

# migrate
data modify storage asset:artifact Triggers append value {}
data modify storage asset:artifact Triggers[0].Slot set from storage asset:artifact Slot
data modify storage asset:artifact Triggers[0].Trigger set from storage asset:artifact Trigger
data modify storage asset:artifact Triggers[0].Condition set from storage asset:artifact Condition
data modify storage asset:artifact Triggers[0].AttackInfo set from storage asset:artifact AttackInfo
data modify storage asset:artifact Triggers[0].MPCost set from storage asset:artifact MPCost
data modify storage asset:artifact Triggers[0].MPRequire set from storage asset:artifact MPRequire
data modify storage asset:artifact Triggers[0].CostText set from storage asset:artifact CostText
data modify storage asset:artifact Triggers[0].LocalCooldown set from storage asset:artifact LocalCooldown
data modify storage asset:artifact Triggers[0].SpecialCooldown set from storage asset:artifact SpecialCooldown
data modify storage asset:artifact Triggers[0].DisableCooldownMessage set from storage asset:artifact DisableCooldownMessage
data modify storage asset:artifact Triggers[0].DisableMPMessage set from storage asset:artifact DisableMPMessage

# reset
data remove storage asset:artifact Slot
data remove storage asset:artifact Trigger
data remove storage asset:artifact Condition
data remove storage asset:artifact AttackInfo
data remove storage asset:artifact MPCost
data remove storage asset:artifact MPRequire
data remove storage asset:artifact CostText
data remove storage asset:artifact LocalCooldown
data remove storage asset:artifact SpecialCooldown
data remove storage asset:artifact DisableCooldownMessage
data remove storage asset:artifact DisableMPMessage
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
#
# 神器の使用時共通処理を実行します
#
# @within function asset:artifact/*/*/3.main
# @within function asset:artifact/*/**main

data modify storage asset:artifact TargetSlot set value 'auto'
function asset_manager:artifact/use/
tag @s remove CanUsed
execute unless data storage asset:artifact Index run data modify storage asset:artifact Index set value 0
function asset_manager:artifact/use/.m with storage asset:artifact
tag @s remove CanUsed
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
#
# チェストプレートの神器の使用時共通処理を実行します
#
# @within function asset:artifact/*/*/3.main
# @within function asset:artifact/*/**main

data modify storage asset:artifact TargetSlot set value 'chest'
function asset_manager:artifact/use/
tag @s remove CanUsed
execute unless data storage asset:artifact Index run data modify storage asset:artifact Index set value 0
function asset_manager:artifact/use/.m with storage asset:artifact
tag @s remove CanUsed
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
#
# ブーツの神器の使用時共通処理を実行します
#
# @within function asset:artifact/*/*/3.main
# @within function asset:artifact/*/**main

data modify storage asset:artifact TargetSlot set value 'feet'
function asset_manager:artifact/use/
tag @s remove CanUsed
execute unless data storage asset:artifact Index run data modify storage asset:artifact Index set value 0
function asset_manager:artifact/use/.m with storage asset:artifact
tag @s remove CanUsed
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
#
# ヘルメットの神器の使用時共通処理を実行します
#
# @within function asset:artifact/*/*/3.main
# @within function asset:artifact/*/**main

data modify storage asset:artifact TargetSlot set value 'head'
function asset_manager:artifact/use/
tag @s remove CanUsed
execute unless data storage asset:artifact Index run data modify storage asset:artifact Index set value 0
function asset_manager:artifact/use/.m with storage asset:artifact
tag @s remove CanUsed
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
#
# チェストプレートの神器の使用時共通処理を実行します
#
# @within function asset:artifact/*/*/3.main
# @within function asset:artifact/*/**main

data modify storage asset:artifact TargetSlot set value 'hotbar'
function asset_manager:artifact/use/
tag @s remove CanUsed
execute unless data storage asset:artifact Index run data modify storage asset:artifact Index set value 0
function asset_manager:artifact/use/.m with storage asset:artifact
tag @s remove CanUsed
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
#
# レギンスの神器の使用時共通処理を実行します
#
# @within function asset:artifact/*/*/3.main
# @within function asset:artifact/*/**main

data modify storage asset:artifact TargetSlot set value 'legs'
function asset_manager:artifact/use/
tag @s remove CanUsed
execute unless data storage asset:artifact Index run data modify storage asset:artifact Index set value 0
function asset_manager:artifact/use/.m with storage asset:artifact
tag @s remove CanUsed
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
#
# メインハンドの神器の使用時共通処理を実行します
#
# @within function asset:artifact/*/*/3.main
# @within function asset:artifact/*/**main

data modify storage asset:artifact TargetSlot set value 'mainhand'
function asset_manager:artifact/use/
tag @s remove CanUsed
execute unless data storage asset:artifact Index run data modify storage asset:artifact Index set value 0
function asset_manager:artifact/use/.m with storage asset:artifact
tag @s remove CanUsed
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
#
# オフハンドの神器の使用時共通処理を実行します
#
# @within function asset:artifact/*/*/3.main
# @within function asset:artifact/*/**main

data modify storage asset:artifact TargetSlot set value 'offhand'
function asset_manager:artifact/use/
tag @s remove CanUsed
execute unless data storage asset:artifact Index run data modify storage asset:artifact Index set value 0
function asset_manager:artifact/use/.m with storage asset:artifact
tag @s remove CanUsed
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#> 特殊クールダウン
# @within function
# asset_manager:artifact/check/check_special_cooldown
# asset_manager:artifact/use/
# asset_manager:artifact/check/.m
# asset_manager:artifact/tick/
# core:tick/
#declare score_holder $ArtifactSpecialCooldown
Expand Down
Loading
Loading