Skip to content

Commit

Permalink
✨ 特殊クールダウンが UI に反映されるように
Browse files Browse the repository at this point in the history
  • Loading branch information
ChenCMD committed Nov 11, 2024
1 parent fe8427b commit 42d8fbf
Show file tree
Hide file tree
Showing 7 changed files with 116 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,5 @@
# リセット
scoreboard players reset $Value Temporary
scoreboard players reset $Max Temporary
scoreboard players reset $NormalizedValue Temporary
data remove storage asset:artifact LCDs
data remove storage asset:artifact TCDs
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,30 @@
#
# @within function asset_manager:artifact/cooldown/

# 各スロットのCDを表示用に正規化する LCDs(normal) -> asset:artifact NormalizedLCDs(inverted)
function asset_manager:artifact/cooldown/mini_bar/normalize_lcds
# 各スロットについて、ローカルクールダウンと種別クールダウンのうちクールダウンが長いものを取得する
# LCDs(normal) + TCDs(normal) -> CDs(inverted)
function asset_manager:artifact/cooldown/mini_bar/choose_max_cds/
# 各スロットのCDを表示用に正規化する CDs(inverted) -> asset:artifact NormalizedCDs(normal)
function asset_manager:artifact/cooldown/mini_bar/normalize_cds

# 各スロットのCD表示を構築
data modify storage asset:artifact MiniBars.Offhand set from storage asset:artifact NormalizedLCDs[13]
data modify storage asset:artifact MiniBars.Feet set from storage asset:artifact NormalizedLCDs[12]
data modify storage asset:artifact MiniBars.Legs set from storage asset:artifact NormalizedLCDs[11]
data modify storage asset:artifact MiniBars.Chest set from storage asset:artifact NormalizedLCDs[10]
data modify storage asset:artifact MiniBars.Head set from storage asset:artifact NormalizedLCDs[9]
data modify storage asset:artifact MiniBars.Hotbar0 set from storage asset:artifact NormalizedLCDs[8]
data modify storage asset:artifact MiniBars.Hotbar1 set from storage asset:artifact NormalizedLCDs[7]
data modify storage asset:artifact MiniBars.Hotbar2 set from storage asset:artifact NormalizedLCDs[6]
data modify storage asset:artifact MiniBars.Hotbar3 set from storage asset:artifact NormalizedLCDs[5]
data modify storage asset:artifact MiniBars.Hotbar4 set from storage asset:artifact NormalizedLCDs[4]
data modify storage asset:artifact MiniBars.Hotbar5 set from storage asset:artifact NormalizedLCDs[3]
data modify storage asset:artifact MiniBars.Hotbar6 set from storage asset:artifact NormalizedLCDs[2]
data modify storage asset:artifact MiniBars.Hotbar7 set from storage asset:artifact NormalizedLCDs[1]
data modify storage asset:artifact MiniBars.Hotbar8 set from storage asset:artifact NormalizedLCDs[0]
data modify storage asset:artifact MiniBars.Offhand set from storage asset:artifact NormalizedCDs[0]
data modify storage asset:artifact MiniBars.Feet set from storage asset:artifact NormalizedCDs[1]
data modify storage asset:artifact MiniBars.Legs set from storage asset:artifact NormalizedCDs[2]
data modify storage asset:artifact MiniBars.Chest set from storage asset:artifact NormalizedCDs[3]
data modify storage asset:artifact MiniBars.Head set from storage asset:artifact NormalizedCDs[4]
data modify storage asset:artifact MiniBars.Hotbar0 set from storage asset:artifact NormalizedCDs[5]
data modify storage asset:artifact MiniBars.Hotbar1 set from storage asset:artifact NormalizedCDs[6]
data modify storage asset:artifact MiniBars.Hotbar2 set from storage asset:artifact NormalizedCDs[7]
data modify storage asset:artifact MiniBars.Hotbar3 set from storage asset:artifact NormalizedCDs[8]
data modify storage asset:artifact MiniBars.Hotbar4 set from storage asset:artifact NormalizedCDs[9]
data modify storage asset:artifact MiniBars.Hotbar5 set from storage asset:artifact NormalizedCDs[10]
data modify storage asset:artifact MiniBars.Hotbar6 set from storage asset:artifact NormalizedCDs[11]
data modify storage asset:artifact MiniBars.Hotbar7 set from storage asset:artifact NormalizedCDs[12]
data modify storage asset:artifact MiniBars.Hotbar8 set from storage asset:artifact NormalizedCDs[13]
function asset_manager:artifact/cooldown/mini_bar/construct_message.m with storage asset:artifact MiniBars

# リセット
data remove storage asset:artifact NormalizedCDs
data remove storage asset:artifact MiniBars
data remove storage asset:artifact CDs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#> asset_manager:artifact/cooldown/mini_bar/choose_max_cds/
#
#
#
# @within function asset_manager:artifact/cooldown/mini_bar/

# コピーしておく
data modify storage asset:artifact CopiedEquipmentCooldownTypes set from storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].EquipmentCooldownTypes

# CopiedEquipmentCooldownTypes(normal) + LCDs(normal) -> CDs(inverted)
function asset_manager:artifact/cooldown/mini_bar/choose_max_cds/foreach

# リセット
data remove storage asset:artifact CopiedEquipmentCooldownTypes
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#> asset_manager:artifact/cooldown/mini_bar/choose_max_cds/foreach
#
#
#
# @within function
# asset_manager:artifact/cooldown/mini_bar/choose_max_cds/
# asset_manager:artifact/cooldown/mini_bar/choose_max_cds/foreach

# () -> TCD
data modify storage asset:artifact CooldownType.Type set from storage asset:artifact CopiedEquipmentCooldownTypes[-1]
function asset_manager:artifact/cooldown/mini_bar/choose_max_cds/get_tcd with storage asset:artifact CooldownType

# TCD が存在する場合、LCD と TCD のうちクールダウン最大値が大きい方を CDs に入れる
execute if data storage asset:artifact TCD run function asset_manager:artifact/cooldown/mini_bar/choose_max_cds/push_compare_result
# TCD が null の場合、問答無用で LCD を入れる
execute unless data storage asset:artifact TCD run data modify storage asset:artifact CDs append from storage asset:artifact LCDs[-1]

# 末尾削除
data remove storage asset:artifact CopiedEquipmentCooldownTypes[-1]
data remove storage asset:artifact LCDs[-1]
# リセット
data remove storage asset:artifact CooldownType
data remove storage asset:artifact TCD
# 要素がまだあるなら再帰
execute if data storage asset:artifact LCDs[0] run function asset_manager:artifact/cooldown/mini_bar/choose_max_cds/foreach
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset_manager:artifact/cooldown/mini_bar/choose_max_cds/get_tcd
#
#
# @input args
# Type: string
# @within function asset_manager:artifact/cooldown/mini_bar/choose_max_cds/foreach

$data modify storage asset:artifact TCD set from storage asset:artifact TCDs[{Type:$(Type)}]
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#> asset_manager:artifact/cooldown/mini_bar/choose_max_cds/push_compare_result
#
#
#
# @within function asset_manager:artifact/cooldown/mini_bar/choose_max_cds/foreach

# #> Private
# # @private
# #declare score_holder $LCDMax
# #declare score_holder $LCD
# #declare score_holder $TCDMax

# # スコアに移す (TCD は null の可能性があるためデフォルト値として -1 を入れる)
# execute store result score $LCD Temporary run data get storage asset:artifact LCDs[-1].Value
# execute store result score $LCDMax Temporary run data get storage asset:artifact LCDs[-1].Max
# execute store result score $TCDMax Temporary run data get storage asset:artifact TCD.Max
# # 比較して追加
# execute if score $LCD Temporary matches 1.. if score $LCDMax Temporary > $TCDMax Temporary run data modify storage asset:artifact CDs append from storage asset:artifact LCDs[-1]
# execute if score $LCD Temporary matches 1.. if score $LCDMax Temporary <= $TCDMax Temporary run data modify storage asset:artifact CDs append from storage asset:artifact TCD
# execute if score $LCD Temporary matches ..0 run data modify storage asset:artifact CDs append from storage asset:artifact TCD
# # リセット
# scoreboard players reset $LCDMax Temporary
# scoreboard players reset $TCDMax Temporary


#> Private
# @private
#declare score_holder $LCD
#declare score_holder $TCD

# スコアに移す (TCD は null の可能性があるためデフォルト値として -1 を入れる)
execute store result score $LCD Temporary run data get storage asset:artifact LCDs[-1].Value
execute store result score $TCD Temporary run data get storage asset:artifact TCD.Value
# 比較して追加
execute if score $LCD Temporary > $TCD Temporary run data modify storage asset:artifact CDs append from storage asset:artifact LCDs[-1]
execute if score $LCD Temporary <= $TCD Temporary run data modify storage asset:artifact CDs append from storage asset:artifact TCD
# リセット
scoreboard players reset $LCD Temporary
scoreboard players reset $TCD Temporary
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#> asset_manager:artifact/cooldown/mini_bar/normalize_lcds
#> asset_manager:artifact/cooldown/mini_bar/normalize_cds
#
#
#
# @within function
# asset_manager:artifact/cooldown/mini_bar/
# asset_manager:artifact/cooldown/mini_bar/normalize_lcds
# asset_manager:artifact/cooldown/mini_bar/normalize_cds

#! MiniBar
# \u1000 16/16
Expand All @@ -27,8 +27,8 @@
# \u9999 null

# 取得
execute store result score $Value Temporary run data get storage asset:artifact LCDs[-1].Value
execute store result score $Max Temporary run data get storage asset:artifact LCDs[-1].Max
execute store result score $Value Temporary run data get storage asset:artifact CDs[-1].Value
execute store result score $Max Temporary run data get storage asset:artifact CDs[-1].Max

# 0除算回避の為に0なら1にする
execute if score $Max Temporary matches 0 run scoreboard players set $Max Temporary 1
Expand All @@ -44,11 +44,11 @@
# ゼロパディングの代わりに+1000する
scoreboard players add $NormalizedValue Temporary 1000

# NormalizedLCDsに追加
data modify storage asset:artifact NormalizedLCDs append value 9999
execute unless score $Value Temporary matches -15 store result storage asset:artifact NormalizedLCDs[-1] int 1 run scoreboard players get $NormalizedValue Temporary
# NormalizedCDsに追加
data modify storage asset:artifact NormalizedCDs append value 9999
execute unless score $Value Temporary matches -15 store result storage asset:artifact NormalizedCDs[-1] int 1 run scoreboard players get $NormalizedValue Temporary

# 末尾削除
data remove storage asset:artifact LCDs[-1]
data remove storage asset:artifact CDs[-1]
# 要素があれば再帰
execute if data storage asset:artifact LCDs[0] run function asset_manager:artifact/cooldown/mini_bar/normalize_lcds
execute if data storage asset:artifact CDs[0] run function asset_manager:artifact/cooldown/mini_bar/normalize_cds

0 comments on commit 42d8fbf

Please sign in to comment.