diff --git a/NaturalMergeSort/data/natural_merge_sort/functions/descend/.mcfunction b/NaturalMergeSort/data/natural_merge_sort/functions/descend/.mcfunction index acc547b7bd..43821ab720 100644 --- a/NaturalMergeSort/data/natural_merge_sort/functions/descend/.mcfunction +++ b/NaturalMergeSort/data/natural_merge_sort/functions/descend/.mcfunction @@ -1,8 +1,8 @@ ### Copyright © 2020 赤石愛 ### This software is released under the MIT License, see LICENSE. -#> natural_merge_sort:descend/ -# 渡された数値配列を、降順にソートします。 +#> natural_merge_sort:descend/ +# 渡された数値配列を、降順にソートします。 # Sort the specified int list in descending order. # @api # @input storage natural_merge_sort: List diff --git a/TheSkyBlessing/data/asset_manager/functions/artifact/create/set_lore/.mcfunction b/TheSkyBlessing/data/asset_manager/functions/artifact/create/set_lore/.mcfunction index 393445b3c7..339fd9ece0 100644 --- a/TheSkyBlessing/data/asset_manager/functions/artifact/create/set_lore/.mcfunction +++ b/TheSkyBlessing/data/asset_manager/functions/artifact/create/set_lore/.mcfunction @@ -10,10 +10,8 @@ execute if data storage asset:artifact Lore[0] run function asset_manager:artifact/create/set_lore/vanilla_lore # 装備時効果 # ステータス補正 - data modify storage asset:artifact CopiedModifiers set from storage asset:artifact Equipment.Modifiers - execute if data storage asset:artifact CopiedModifiers[0] if data storage asset:artifact Item.tag.display.Lore[0] run data modify storage asset:artifact Item.tag.display.Lore append value '""' - execute if data storage asset:artifact CopiedModifiers[0] run function asset_manager:artifact/create/set_lore/modifier/ - data remove storage asset:artifact CopiedModifiers + execute if data storage asset:artifact Equipment.Modifiers[0] if data storage asset:artifact Item.tag.display.Lore[0] run data modify storage asset:artifact Item.tag.display.Lore append value '""' + execute if data storage asset:artifact Equipment.Modifiers[0] run function asset_manager:artifact/create/set_lore/modifier/ # セット効果 execute if data storage asset:artifact Equipment.Effects[{Visible:true}] if data storage asset:artifact Item.tag.display.Lore[0] run data modify storage asset:artifact Item.tag.display.Lore append value '""' execute if data storage asset:artifact Equipment.Effects[0] run function asset_manager:artifact/create/set_lore/equipment/ diff --git a/TheSkyBlessing/data/asset_manager/functions/artifact/create/set_lore/modifier/.mcfunction b/TheSkyBlessing/data/asset_manager/functions/artifact/create/set_lore/modifier/.mcfunction index f9d5e6a84a..f5dd92c14d 100644 --- a/TheSkyBlessing/data/asset_manager/functions/artifact/create/set_lore/modifier/.mcfunction +++ b/TheSkyBlessing/data/asset_manager/functions/artifact/create/set_lore/modifier/.mcfunction @@ -2,102 +2,18 @@ # # 装備時効果の内容をLoreに追加 # -# @within function -# asset_manager:artifact/create/set_lore/ -# asset_manager:artifact/create/set_lore/modifier/ +# @within function asset_manager:artifact/create/set_lore/ -#> temp -# @private - #declare score_holder $AmountFrac - #declare score_holder $AmountFrac2 - #declare score_holder $AmountInt - #declare score_holder $CustomModifier +# 補正が2個以上ならソートする + execute if data storage asset:artifact Equipment.Modifiers[1] run function asset_manager:artifact/create/set_lore/modifier/sort -# 変数を用意 - scoreboard players set $CustomModifier Temporary 0 - data modify storage asset:artifact Modifier set from storage asset:artifact CopiedModifiers[0] - data modify storage asset:artifact Line set value ['{"text":"","color":"green","italic":false}','""','" +"','{"translate":"%s","with":[{"storage":"asset:artifact","nbt":"Amount.Int"}]}','""'] +# 補正が2個以上でないならソートされたものとする + execute unless data storage asset:artifact Equipment.Modifiers[1] run data modify storage asset:artifact SortedModifiers set from storage asset:artifact Equipment.Modifiers -# カスタムModifier - execute if data storage asset:artifact Modifier{Type:"attack/base"} run scoreboard players set $CustomModifier Temporary 1 - execute if data storage asset:artifact Modifier{Type:"attack/base"} run data modify storage asset:artifact Line[1] set value '"攻撃"' - execute if data storage asset:artifact Modifier{Type:"attack/fire"} run scoreboard players set $CustomModifier Temporary 1 - execute if data storage asset:artifact Modifier{Type:"attack/fire"} run data modify storage asset:artifact Line[1] set value '"火攻撃"' - execute if data storage asset:artifact Modifier{Type:"attack/magic"} run scoreboard players set $CustomModifier Temporary 1 - execute if data storage asset:artifact Modifier{Type:"attack/magic"} run data modify storage asset:artifact Line[1] set value '"魔法攻撃"' - execute if data storage asset:artifact Modifier{Type:"attack/physical"} run scoreboard players set $CustomModifier Temporary 1 - execute if data storage asset:artifact Modifier{Type:"attack/physical"} run data modify storage asset:artifact Line[1] set value '"物理攻撃"' - execute if data storage asset:artifact Modifier{Type:"attack/thunder"} run scoreboard players set $CustomModifier Temporary 1 - execute if data storage asset:artifact Modifier{Type:"attack/thunder"} run data modify storage asset:artifact Line[1] set value '"雷攻撃"' - execute if data storage asset:artifact Modifier{Type:"attack/water"} run scoreboard players set $CustomModifier Temporary 1 - execute if data storage asset:artifact Modifier{Type:"attack/water"} run data modify storage asset:artifact Line[1] set value '"水攻撃"' - execute if data storage asset:artifact Modifier{Type:"defense/base"} run scoreboard players set $CustomModifier Temporary 1 - execute if data storage asset:artifact Modifier{Type:"defense/base"} run data modify storage asset:artifact Line[1] set value '"耐性"' - execute if data storage asset:artifact Modifier{Type:"defense/fire"} run scoreboard players set $CustomModifier Temporary 1 - execute if data storage asset:artifact Modifier{Type:"defense/fire"} run data modify storage asset:artifact Line[1] set value '"火耐性"' - execute if data storage asset:artifact Modifier{Type:"defense/magic"} run scoreboard players set $CustomModifier Temporary 1 - execute if data storage asset:artifact Modifier{Type:"defense/magic"} run data modify storage asset:artifact Line[1] set value '"魔法耐性"' - execute if data storage asset:artifact Modifier{Type:"defense/physical"} run scoreboard players set $CustomModifier Temporary 1 - execute if data storage asset:artifact Modifier{Type:"defense/physical"} run data modify storage asset:artifact Line[1] set value '"物理耐性"' - execute if data storage asset:artifact Modifier{Type:"defense/thunder"} run scoreboard players set $CustomModifier Temporary 1 - execute if data storage asset:artifact Modifier{Type:"defense/thunder"} run data modify storage asset:artifact Line[1] set value '"雷耐性"' - execute if data storage asset:artifact Modifier{Type:"defense/water"} run scoreboard players set $CustomModifier Temporary 1 - execute if data storage asset:artifact Modifier{Type:"defense/water"} run data modify storage asset:artifact Line[1] set value '"水耐性"' - execute if data storage asset:artifact Modifier{Type:"fall_resistance"} run scoreboard players set $CustomModifier Temporary 1 - execute if data storage asset:artifact Modifier{Type:"fall_resistance"} run data modify storage asset:artifact Line[1] set value '"落下耐性"' - execute if data storage asset:artifact Modifier{Type:"heal"} run scoreboard players set $CustomModifier Temporary 1 - execute if data storage asset:artifact Modifier{Type:"heal"} run data modify storage asset:artifact Line[1] set value '"与回復量"' - execute if data storage asset:artifact Modifier{Type:"receive_heal"} run scoreboard players set $CustomModifier Temporary 1 - execute if data storage asset:artifact Modifier{Type:"receive_heal"} run data modify storage asset:artifact Line[1] set value '"被回復量"' - execute if data storage asset:artifact Modifier{Type:"mp_heal"} run scoreboard players set $CustomModifier Temporary 1 - execute if data storage asset:artifact Modifier{Type:"mp_heal"} run data modify storage asset:artifact Line[1] set value '"MP回復量"' - execute if data storage asset:artifact Modifier{Type:"max_mp"} run scoreboard players set $CustomModifier Temporary 1 - execute if data storage asset:artifact Modifier{Type:"max_mp"} run data modify storage asset:artifact Line[1] set value '"最大MP"' - execute if score $CustomModifier Temporary matches 0 run function asset_manager:artifact/create/set_lore/modifier/generic.m with storage asset:artifact Modifier - -# ノックバック耐性だけバニラに合わせて表示を10倍しておく - execute if data storage asset:artifact Modifier{Type:"generic.knockback_resistance"} store result storage asset:artifact Modifier.Amount double 0.1 run data get storage asset:artifact Modifier.Amount 100 - -# 数値チェック -# Operation == "add": -# $AmountInt = floor(abs(Amount)) -# $AmountFrac(e3) = abs(Amount) * e3 % e3 -# Operation != "add": -# $AmountInt(e2) = floor(abs(Amount) * e2) -# $AmountFrac(e5) = abs(Amount) * e5 % e3 - execute store result score $AmountFrac Temporary run data get storage asset:artifact Modifier.Amount 1000 - execute unless data storage asset:artifact Modifier{Operation:"add"} run data modify storage asset:artifact Line[4] set value '"%"' - execute unless data storage asset:artifact Modifier{Operation:"add"} run scoreboard players operation $AmountFrac Temporary *= $100 Const - execute unless score $AmountFrac Temporary matches 0.. run data modify storage asset:artifact Line[0] set value '{"text":"","color":"red","italic":false}' - execute unless score $AmountFrac Temporary matches 0.. run data modify storage asset:artifact Line[2] set value '" -"' - execute unless score $AmountFrac Temporary matches 0.. run scoreboard players operation $AmountFrac Temporary *= $-1 Const - scoreboard players operation $AmountInt Temporary = $AmountFrac Temporary - scoreboard players operation $AmountInt Temporary /= $1000 Const - scoreboard players operation $AmountFrac Temporary %= $1000 Const -# $AmountFrac % 10 == 0: -# $AmountFrac(e2|e4) = $AmountFrac(e3|e5) / e1 - scoreboard players operation $AmountFrac2 Temporary = $AmountFrac Temporary - scoreboard players operation $AmountFrac2 Temporary %= $10 Const - execute if score $AmountFrac2 Temporary matches 0 run scoreboard players operation $AmountFrac Temporary /= $10 Const - scoreboard players operation $AmountFrac2 Temporary = $AmountFrac Temporary - scoreboard players operation $AmountFrac2 Temporary %= $10 Const - execute if score $AmountFrac2 Temporary matches 0 run scoreboard players operation $AmountFrac Temporary /= $10 Const -# 文字列に代入 - execute store result storage asset:artifact Amount.Int int 1 run scoreboard players get $AmountInt Temporary - execute store result storage asset:artifact Amount.Frac int 1 run scoreboard players get $AmountFrac Temporary - execute if score $AmountFrac Temporary matches 1.. run data modify storage asset:artifact Line[3] set value '{"translate":"%s.%s","with":[{"storage":"asset:artifact","nbt":"Amount.Int"},{"storage":"asset:artifact","nbt":"Amount.Frac"}]}' -# Lore追加 - loot replace block 10000 0 10000 container.0 loot asset_manager:artifact/generate_lore/modifier - data modify storage asset:artifact Item.tag.display.Lore append from block 10000 0 10000 Items[0].tag.display.Lore[] +# 書き出し + function asset_manager:artifact/create/set_lore/modifier/write # リセット - scoreboard players reset $CustomModifier Temporary - scoreboard players reset $AmountInt Temporary - scoreboard players reset $AmountFrac Temporary - scoreboard players reset $AmountFrac2 Temporary - data remove storage asset:artifact Line - data remove storage asset:artifact Amount -# 残っていればループ - data remove storage asset:artifact Modifier - data remove storage asset:artifact CopiedModifiers[0] - execute if data storage asset:artifact CopiedModifiers[0] run function asset_manager:artifact/create/set_lore/modifier/ + data remove storage asset:artifact CopiedModifiers + data remove storage asset:artifact PrioritizedModifiers + data remove storage asset:artifact SortedModifiers diff --git a/TheSkyBlessing/data/asset_manager/functions/artifact/create/set_lore/modifier/generic.m.mcfunction b/TheSkyBlessing/data/asset_manager/functions/artifact/create/set_lore/modifier/generic.m.mcfunction index 1f3c536c3e..5a59b0d300 100644 --- a/TheSkyBlessing/data/asset_manager/functions/artifact/create/set_lore/modifier/generic.m.mcfunction +++ b/TheSkyBlessing/data/asset_manager/functions/artifact/create/set_lore/modifier/generic.m.mcfunction @@ -1,6 +1,6 @@ #> asset_manager:artifact/create/set_lore/modifier/generic.m # @input args # Type : string -# @within function asset_manager:artifact/create/set_lore/modifier/ +# @within function asset_manager:artifact/create/set_lore/modifier/write $data modify storage asset:artifact Line[1] set value '{"translate":"attribute.name.$(Type)"}' diff --git a/TheSkyBlessing/data/asset_manager/functions/artifact/create/set_lore/modifier/priority/define.mcfunction b/TheSkyBlessing/data/asset_manager/functions/artifact/create/set_lore/modifier/priority/define.mcfunction new file mode 100644 index 0000000000..806703ac01 --- /dev/null +++ b/TheSkyBlessing/data/asset_manager/functions/artifact/create/set_lore/modifier/priority/define.mcfunction @@ -0,0 +1,35 @@ +#> asset_manager:artifact/create/set_lore/modifier/priority/define +# +# 各補正の優先度を定義します +# +# @within function core:load_once + +# 攻撃 + data modify storage asset:artifact ModifierPriority.attack/base set value 255 + data modify storage asset:artifact ModifierPriority.attack/physical set value 254 + data modify storage asset:artifact ModifierPriority.attack/magic set value 253 + data modify storage asset:artifact ModifierPriority.attack/fire set value 252 + data modify storage asset:artifact ModifierPriority.attack/water set value 251 + data modify storage asset:artifact ModifierPriority.attack/thunder set value 250 + +# 耐性 + data modify storage asset:artifact ModifierPriority.defense/base set value 249 + data modify storage asset:artifact ModifierPriority.defense/physical set value 248 + data modify storage asset:artifact ModifierPriority.defense/magic set value 247 + data modify storage asset:artifact ModifierPriority.defense/fire set value 246 + data modify storage asset:artifact ModifierPriority.defense/water set value 245 + data modify storage asset:artifact ModifierPriority.defense/thunder set value 244 + +# その他のTSB固有の補正 + data modify storage asset:artifact ModifierPriority.heal set value 243 + data modify storage asset:artifact ModifierPriority.receive_heal set value 242 + data modify storage asset:artifact ModifierPriority.max_mp set value 241 + data modify storage asset:artifact ModifierPriority.mp_heal set value 240 + data modify storage asset:artifact ModifierPriority.fall_resistance set value 239 + +# バニラattribute + data modify storage asset:artifact ModifierPriority.generic.armor set value 127 + data modify storage asset:artifact ModifierPriority.generic.armor_toughness set value 126 + data modify storage asset:artifact ModifierPriority.generic.movement_speed set value 125 + data modify storage asset:artifact ModifierPriority.generic.max_health set value 124 + data modify storage asset:artifact ModifierPriority.generic.knockback_resistance set value 123 diff --git a/TheSkyBlessing/data/asset_manager/functions/artifact/create/set_lore/modifier/priority/set.m.mcfunction b/TheSkyBlessing/data/asset_manager/functions/artifact/create/set_lore/modifier/priority/set.m.mcfunction new file mode 100644 index 0000000000..2a4a796984 --- /dev/null +++ b/TheSkyBlessing/data/asset_manager/functions/artifact/create/set_lore/modifier/priority/set.m.mcfunction @@ -0,0 +1,31 @@ +#> asset_manager:artifact/create/set_lore/modifier/priority/set.m +# +# +# +# @within function asset_manager:artifact/create/set_lore/modifier/priority/set + +#> Private +# @private + #declare score_holder $Priority + #declare score_holder $Amount + +# Priorityを取得 + $execute store result score $Priority Temporary run data get storage asset:artifact ModifierPriority.$(Type) + +# 補正の量を取得 + execute store result score $Amount Temporary run data get storage asset:artifact Modifier.Amount 1000 + +# 補正がマイナスならPriorityをメチャクチャ落とす + execute if score $Amount Temporary matches ..-1 run scoreboard players remove $Priority Temporary 1024 + +# storageにPriorityを代入 +# lib:array/sort/compound用にweightとして代入する + execute store result storage asset:artifact Modifier.weight int 1 run scoreboard players get $Priority Temporary + +# 別のstorageへまとめて追加しておく + data modify storage asset:artifact PrioritizedModifiers append from storage asset:artifact Modifier + +# リセット + data remove storage asset:artifact Modifier + scoreboard players reset $Priority Temporary + scoreboard players reset $Amount Temporary diff --git a/TheSkyBlessing/data/asset_manager/functions/artifact/create/set_lore/modifier/priority/set.mcfunction b/TheSkyBlessing/data/asset_manager/functions/artifact/create/set_lore/modifier/priority/set.mcfunction new file mode 100644 index 0000000000..cc0c30fe70 --- /dev/null +++ b/TheSkyBlessing/data/asset_manager/functions/artifact/create/set_lore/modifier/priority/set.mcfunction @@ -0,0 +1,19 @@ +#> asset_manager:artifact/create/set_lore/modifier/priority/set +# +# +# +# @within function +# asset_manager:artifact/create/set_lore/modifier/sort +# asset_manager:artifact/create/set_lore/modifier/priority/set + +# 必要な変数を用意 + data modify storage asset:artifact Modifier set from storage asset:artifact CopiedModifiers[-1] + +# 優先度をセット + function asset_manager:artifact/create/set_lore/modifier/priority/set.m with storage asset:artifact Modifier + +# 最後尾の要素を削除 + data remove storage asset:artifact CopiedModifiers[-1] + +# 要素がまだあれば再帰 + execute if data storage asset:artifact CopiedModifiers[0] run function asset_manager:artifact/create/set_lore/modifier/priority/set diff --git a/TheSkyBlessing/data/asset_manager/functions/artifact/create/set_lore/modifier/sort.mcfunction b/TheSkyBlessing/data/asset_manager/functions/artifact/create/set_lore/modifier/sort.mcfunction new file mode 100644 index 0000000000..6aaa7e6bbd --- /dev/null +++ b/TheSkyBlessing/data/asset_manager/functions/artifact/create/set_lore/modifier/sort.mcfunction @@ -0,0 +1,17 @@ +#> asset_manager:artifact/create/set_lore/modifier/sort +# +# +# +# @within function asset_manager:artifact/create/set_lore/modifier/ + +# 各補正にPriorityを設定 + data modify storage asset:artifact CopiedModifiers set from storage asset:artifact Equipment.Modifiers + function asset_manager:artifact/create/set_lore/modifier/priority/set + +# ソート + function lib:array/session/open + data modify storage lib: Array set from storage asset:artifact PrioritizedModifiers + function lib:array/sort/compound/descend + data modify storage asset:artifact SortedModifiers set from storage lib: Array + function lib:array/session/close + diff --git a/TheSkyBlessing/data/asset_manager/functions/artifact/create/set_lore/modifier/write.mcfunction b/TheSkyBlessing/data/asset_manager/functions/artifact/create/set_lore/modifier/write.mcfunction new file mode 100644 index 0000000000..db988e9e69 --- /dev/null +++ b/TheSkyBlessing/data/asset_manager/functions/artifact/create/set_lore/modifier/write.mcfunction @@ -0,0 +1,103 @@ +#> asset_manager:artifact/create/set_lore/modifier/write +# +# +# +# @within function +# asset_manager:artifact/create/set_lore/modifier/ +# asset_manager:artifact/create/set_lore/modifier/write + +#> temp +# @private + #declare score_holder $AmountFrac + #declare score_holder $AmountFrac2 + #declare score_holder $AmountInt + #declare score_holder $CustomModifier + +# 変数を用意 + scoreboard players set $CustomModifier Temporary 0 + data modify storage asset:artifact Modifier set from storage asset:artifact SortedModifiers[0] + data modify storage asset:artifact Line set value ['{"text":"","color":"green","italic":false}','""','" +"','{"translate":"%s","with":[{"storage":"asset:artifact","nbt":"Amount.Int"}]}','""'] + +# カスタムModifier + execute if data storage asset:artifact Modifier{Type:"attack/base"} run scoreboard players set $CustomModifier Temporary 1 + execute if data storage asset:artifact Modifier{Type:"attack/base"} run data modify storage asset:artifact Line[1] set value '"攻撃"' + execute if data storage asset:artifact Modifier{Type:"attack/fire"} run scoreboard players set $CustomModifier Temporary 1 + execute if data storage asset:artifact Modifier{Type:"attack/fire"} run data modify storage asset:artifact Line[1] set value '"火攻撃"' + execute if data storage asset:artifact Modifier{Type:"attack/magic"} run scoreboard players set $CustomModifier Temporary 1 + execute if data storage asset:artifact Modifier{Type:"attack/magic"} run data modify storage asset:artifact Line[1] set value '"魔法攻撃"' + execute if data storage asset:artifact Modifier{Type:"attack/physical"} run scoreboard players set $CustomModifier Temporary 1 + execute if data storage asset:artifact Modifier{Type:"attack/physical"} run data modify storage asset:artifact Line[1] set value '"物理攻撃"' + execute if data storage asset:artifact Modifier{Type:"attack/thunder"} run scoreboard players set $CustomModifier Temporary 1 + execute if data storage asset:artifact Modifier{Type:"attack/thunder"} run data modify storage asset:artifact Line[1] set value '"雷攻撃"' + execute if data storage asset:artifact Modifier{Type:"attack/water"} run scoreboard players set $CustomModifier Temporary 1 + execute if data storage asset:artifact Modifier{Type:"attack/water"} run data modify storage asset:artifact Line[1] set value '"水攻撃"' + execute if data storage asset:artifact Modifier{Type:"defense/base"} run scoreboard players set $CustomModifier Temporary 1 + execute if data storage asset:artifact Modifier{Type:"defense/base"} run data modify storage asset:artifact Line[1] set value '"耐性"' + execute if data storage asset:artifact Modifier{Type:"defense/fire"} run scoreboard players set $CustomModifier Temporary 1 + execute if data storage asset:artifact Modifier{Type:"defense/fire"} run data modify storage asset:artifact Line[1] set value '"火耐性"' + execute if data storage asset:artifact Modifier{Type:"defense/magic"} run scoreboard players set $CustomModifier Temporary 1 + execute if data storage asset:artifact Modifier{Type:"defense/magic"} run data modify storage asset:artifact Line[1] set value '"魔法耐性"' + execute if data storage asset:artifact Modifier{Type:"defense/physical"} run scoreboard players set $CustomModifier Temporary 1 + execute if data storage asset:artifact Modifier{Type:"defense/physical"} run data modify storage asset:artifact Line[1] set value '"物理耐性"' + execute if data storage asset:artifact Modifier{Type:"defense/thunder"} run scoreboard players set $CustomModifier Temporary 1 + execute if data storage asset:artifact Modifier{Type:"defense/thunder"} run data modify storage asset:artifact Line[1] set value '"雷耐性"' + execute if data storage asset:artifact Modifier{Type:"defense/water"} run scoreboard players set $CustomModifier Temporary 1 + execute if data storage asset:artifact Modifier{Type:"defense/water"} run data modify storage asset:artifact Line[1] set value '"水耐性"' + execute if data storage asset:artifact Modifier{Type:"fall_resistance"} run scoreboard players set $CustomModifier Temporary 1 + execute if data storage asset:artifact Modifier{Type:"fall_resistance"} run data modify storage asset:artifact Line[1] set value '"落下耐性"' + execute if data storage asset:artifact Modifier{Type:"heal"} run scoreboard players set $CustomModifier Temporary 1 + execute if data storage asset:artifact Modifier{Type:"heal"} run data modify storage asset:artifact Line[1] set value '"与回復量"' + execute if data storage asset:artifact Modifier{Type:"receive_heal"} run scoreboard players set $CustomModifier Temporary 1 + execute if data storage asset:artifact Modifier{Type:"receive_heal"} run data modify storage asset:artifact Line[1] set value '"被回復量"' + execute if data storage asset:artifact Modifier{Type:"mp_heal"} run scoreboard players set $CustomModifier Temporary 1 + execute if data storage asset:artifact Modifier{Type:"mp_heal"} run data modify storage asset:artifact Line[1] set value '"MP回復量"' + execute if data storage asset:artifact Modifier{Type:"max_mp"} run scoreboard players set $CustomModifier Temporary 1 + execute if data storage asset:artifact Modifier{Type:"max_mp"} run data modify storage asset:artifact Line[1] set value '"最大MP"' + execute if score $CustomModifier Temporary matches 0 run function asset_manager:artifact/create/set_lore/modifier/generic.m with storage asset:artifact Modifier + +# ノックバック耐性だけバニラに合わせて表示を10倍しておく + execute if data storage asset:artifact Modifier{Type:"generic.knockback_resistance"} store result storage asset:artifact Modifier.Amount double 0.1 run data get storage asset:artifact Modifier.Amount 100 + +# 数値チェック +# Operation == "add": +# $AmountInt = floor(abs(Amount)) +# $AmountFrac(e3) = abs(Amount) * e3 % e3 +# Operation != "add": +# $AmountInt(e2) = floor(abs(Amount) * e2) +# $AmountFrac(e5) = abs(Amount) * e5 % e3 + execute store result score $AmountFrac Temporary run data get storage asset:artifact Modifier.Amount 1000 + execute unless data storage asset:artifact Modifier{Operation:"add"} run data modify storage asset:artifact Line[4] set value '"%"' + execute unless data storage asset:artifact Modifier{Operation:"add"} run scoreboard players operation $AmountFrac Temporary *= $100 Const + execute unless score $AmountFrac Temporary matches 0.. run data modify storage asset:artifact Line[0] set value '{"text":"","color":"red","italic":false}' + execute unless score $AmountFrac Temporary matches 0.. run data modify storage asset:artifact Line[2] set value '" -"' + execute unless score $AmountFrac Temporary matches 0.. run scoreboard players operation $AmountFrac Temporary *= $-1 Const + scoreboard players operation $AmountInt Temporary = $AmountFrac Temporary + scoreboard players operation $AmountInt Temporary /= $1000 Const + scoreboard players operation $AmountFrac Temporary %= $1000 Const +# $AmountFrac % 10 == 0: +# $AmountFrac(e2|e4) = $AmountFrac(e3|e5) / e1 + scoreboard players operation $AmountFrac2 Temporary = $AmountFrac Temporary + scoreboard players operation $AmountFrac2 Temporary %= $10 Const + execute if score $AmountFrac2 Temporary matches 0 run scoreboard players operation $AmountFrac Temporary /= $10 Const + scoreboard players operation $AmountFrac2 Temporary = $AmountFrac Temporary + scoreboard players operation $AmountFrac2 Temporary %= $10 Const + execute if score $AmountFrac2 Temporary matches 0 run scoreboard players operation $AmountFrac Temporary /= $10 Const +# 文字列に代入 + execute store result storage asset:artifact Amount.Int int 1 run scoreboard players get $AmountInt Temporary + execute store result storage asset:artifact Amount.Frac int 1 run scoreboard players get $AmountFrac Temporary + execute if score $AmountFrac Temporary matches 1.. run data modify storage asset:artifact Line[3] set value '{"translate":"%s.%s","with":[{"storage":"asset:artifact","nbt":"Amount.Int"},{"storage":"asset:artifact","nbt":"Amount.Frac"}]}' +# Lore追加 + loot replace block 10000 0 10000 container.0 loot asset_manager:artifact/generate_lore/modifier + data modify storage asset:artifact Item.tag.display.Lore append from block 10000 0 10000 Items[0].tag.display.Lore[] + +# リセット + scoreboard players reset $CustomModifier Temporary + scoreboard players reset $AmountInt Temporary + scoreboard players reset $AmountFrac Temporary + scoreboard players reset $AmountFrac2 Temporary + data remove storage asset:artifact Line + data remove storage asset:artifact Amount +# 残っていればループ + data remove storage asset:artifact Modifier + data remove storage asset:artifact SortedModifiers[0] + execute if data storage asset:artifact SortedModifiers[0] run function asset_manager:artifact/create/set_lore/modifier/write diff --git a/TheSkyBlessing/data/core/functions/load_once.mcfunction b/TheSkyBlessing/data/core/functions/load_once.mcfunction index 1f2d146a5e..be25a35532 100644 --- a/TheSkyBlessing/data/core/functions/load_once.mcfunction +++ b/TheSkyBlessing/data/core/functions/load_once.mcfunction @@ -182,6 +182,9 @@ team modify NoCollision collisionRule never bossbar set asset:special_cooldown color green bossbar set asset:special_cooldown style notched_10 + # 神器の補正の優先度を定義 + function asset_manager:artifact/create/set_lore/modifier/priority/define + #> AssetManager: Mob -Public # @public scoreboard objectives add MobID dummy {"text":"MobAssetのID"}