Skip to content

Commit

Permalink
🧑‍💻 回復フラグの処理を追加
Browse files Browse the repository at this point in the history
  • Loading branch information
haiiro2gou committed Nov 17, 2024
1 parent 904af1d commit eb239f8
Show file tree
Hide file tree
Showing 11 changed files with 183 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#> asset_manager:artifact/triggers/heal/
#
#
#
# @within function asset_manager:artifact/triggers/trigger/foreach/call.m

# フラグが存在しているか確認する
execute unless data storage asset:artifact ArtifactEvents.Heal[0] run return fail
# イベントを取得する
data modify storage asset:artifact Events append from storage asset:artifact ArtifactEvents.Heal[]
# それぞれについて処理する
function asset_manager:artifact/triggers/heal/foreach

# リセット
data remove storage asset:artifact Events
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#> asset_manager:artifact/triggers/heal/add_tag_each_receiver
#
#
#
# @within function
# asset_manager:artifact/triggers/heal/foreach
# asset_manager:artifact/triggers/heal/add_tag_each_receiver

#> Private
# @private
#declare score_holder $HealTarget

execute store result score $HealTarget Temporary run data get storage asset:artifact HealTargets[-1]
data remove storage asset:artifact HealTargets[-1]

execute as @a if score @s UserID = $HealTarget Temporary run tag @s add Receiver

scoreboard players reset $HealTarget Temporary
execute if data storage asset:artifact HealTargets[0] run function asset_manager:artifact/triggers/heal/add_tag_each_receiver
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset_manager:artifact/triggers/heal/check.m
#
#
#
# @input args id : int
# @within function asset_manager:artifact/triggers/heal/foreach

$function asset:artifact/alias/$(id)/heal/check
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#> asset_manager:artifact/triggers/heal/foreach
#
#
#
# @within function asset_manager:artifact/triggers/heal/*

# イベントデータ処理
# データを取得
data modify storage asset:context Heal set from storage asset:artifact Events[-1]
# ヒール先を取得し、Receiver を付与する (null の可能性もある)
data modify storage asset:artifact HealTargets set from storage asset:context Heal.To
function asset_manager:artifact/triggers/heal/add_tag_each_receiver
# 最大ヒール量の計算
function lib:array/session/open
data modify storage lib: Array set from storage asset:context Heal.Amounts
function lib:array/math/max
data modify storage asset:context Heal.Amount set from storage lib: MaxResult
function lib:array/session/close

# 使用条件を満たしているか確認する
function asset_manager:artifact/check/
function asset_manager:artifact/triggers/heal/check.m with storage asset:context
# 条件を満たしていれば使用する
execute if entity @s[tag=CanUsed] run function asset_manager:artifact/triggers/heal/use

# リセット
tag @a[tag=Receiver] remove Receiver
tag @s remove CanUsed
data remove storage asset:context Heal
data remove storage asset:artifact HealTargets
data remove storage asset:artifact Events[-1]
# 要素が残っているなら再帰
execute if data storage asset:artifact Events[0] run function asset_manager:artifact/triggers/heal/foreach
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset_manager:artifact/triggers/heal/heal.m
#
#
#
# @input args id : int
# @within function asset_manager:artifact/triggers/heal/use

$function asset:artifact/alias/$(id)/heal/
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#> asset_manager:artifact/triggers/heal/use
#
#
#
# @within function asset_manager:artifact/triggers/heal/foreach

# 共通処理
# アイテムを破壊するとBrokeItemが追加される
function asset_manager:artifact/use/

# 処理対象の神器の重複数を取得する
execute store result storage asset:context Count int 1 if data storage asset:artifact TargetItemList[]

# 神器を呼び出し
function asset_manager:artifact/triggers/heal/heal.m with storage asset:context

# リセット
data remove storage asset:context BrokeItem
data remove storage asset:context Count
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#> asset_manager:artifact/triggers/receive_heal/
#
#
#
# @within function asset_manager:artifact/triggers/trigger/foreach/call.m

# フラグが存在しているか確認する
execute unless data storage asset:artifact ArtifactEvents.ReceiveHeal[0] run return fail
# イベントを取得する
data modify storage asset:artifact Events append from storage asset:artifact ArtifactEvents.ReceiveHeal[]
# それぞれについて処理する
function asset_manager:artifact/triggers/receive_heal/foreach

# リセット
data remove storage asset:artifact Events
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset_manager:artifact/triggers/receive_heal/check.m
#
#
#
# @input args id : int
# @within function asset_manager:artifact/triggers/receive_heal/foreach

$function asset:artifact/alias/$(id)/receive_heal/check
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#> asset_manager:artifact/triggers/receive_heal/foreach
#
#
#
# @within function asset_manager:artifact/triggers/receive_heal/*

#> Private
# @private
#declare score_holder $HealedFrom

# イベントデータ処理
# データを取得
data modify storage asset:context ReceiveHeal set from storage asset:artifact Events[-1]
# ヒール元を取得し、Healer を付与する (null の可能性もある)
execute if data storage asset:context ReceiveHeal.From store result score $HealedFrom Temporary run data get storage asset:context ReceiveHeal.From
execute if data storage asset:context ReceiveHeal.From as @a if score @s UserID = $HealedFrom Temporary run tag @s add Healer
scoreboard players reset $HealedFrom Temporary

# 使用条件を満たしているか確認する
function asset_manager:artifact/check/
function asset_manager:artifact/triggers/receive_heal/check.m with storage asset:context
# 条件を満たしていれば使用する
execute if entity @s[tag=CanUsed] run function asset_manager:artifact/triggers/receive_heal/use

# リセット
tag @a[tag=Healer] remove Healer
tag @s remove CanUsed
data remove storage asset:context ReceiveHeal
data remove storage asset:artifact Events[-1]
# 要素が残っているなら再帰
execute if data storage asset:artifact Events[0] run function asset_manager:artifact/triggers/receive_heal/foreach
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset_manager:artifact/triggers/receive_heal/receive_heal.m
#
#
#
# @input args id : int
# @within function asset_manager:artifact/triggers/receive_heal/use

$function asset:artifact/alias/$(id)/receive_heal/
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#> asset_manager:artifact/triggers/receive_heal/use
#
#
#
# @within function asset_manager:artifact/triggers/receive_heal/foreach

# 共通処理
# アイテムを破壊するとBrokeItemが追加される
function asset_manager:artifact/use/

# 処理対象の神器の重複数を取得する
execute store result storage asset:context Count int 1 if data storage asset:artifact TargetItemList[]

# 神器を呼び出し
function asset_manager:artifact/triggers/receive_heal/receive_heal.m with storage asset:context

# リセット
data remove storage asset:context BrokeItem
data remove storage asset:context Count

0 comments on commit eb239f8

Please sign in to comment.