Skip to content

Commit

Permalink
🧑‍💻 新仕様に即した装備時効果のシステムを実装
Browse files Browse the repository at this point in the history
  • Loading branch information
haiiro2gou committed Nov 10, 2024
1 parent 5838ffd commit f89f450
Show file tree
Hide file tree
Showing 25 changed files with 202 additions and 133 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
# データを用意する
data modify storage asset:artifact New.ItemData set value []
# idを取得する
data modify storage lib: Array append from storage asset:artifact New.id.mainhand
data modify storage lib: Array append from storage asset:artifact New.id.offhand
data modify storage lib: Array append from storage asset:artifact New.id.feet
data modify storage lib: Array append from storage asset:artifact New.id.legs
data modify storage lib: Array append from storage asset:artifact New.id.chest
data modify storage lib: Array append from storage asset:artifact New.id.head
data modify storage lib: Array[] append from storage asset:artifact New.id.hotbar[]
data modify storage lib: Array append from storage asset:artifact New.Items.mainhand.tag.TSB
data modify storage lib: Array append from storage asset:artifact New.Items.offhand.tag.TSB
data modify storage lib: Array append from storage asset:artifact New.Items.feet.tag.TSB
data modify storage lib: Array append from storage asset:artifact New.Items.legs.tag.TSB
data modify storage lib: Array append from storage asset:artifact New.Items.chest.tag.TSB
data modify storage lib: Array append from storage asset:artifact New.Items.head.tag.TSB
data modify storage lib: Array append from storage asset:artifact New.Items.hotbar[].tag.TSB
# 反転
function lib:array/reverse
# id毎にデータを取得する
scoreboard players set $SlotIndex Temporary 15
scoreboard players set $SlotIndex Temporary 0
function asset_manager:artifact/data/new/fetch_data/foreach
# リセット
scoreboard players reset $SlotIndex Temporary
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,29 @@
#> private
# @private
#declare score_holder $ID
#declare score_holder $InvalidSlot

# キーチェック
execute store result score $ID Temporary run data get storage lib: Array[-1]
# IDが正しければプルする
execute if score $ID Temporary matches 1.. run function asset_manager:artifact/data/new/fetch_data/fetch
execute unless score $ID Temporary matches 1.. run data modify storage asset:artifact New.ItemData append value {ID:-2,Triggers:[],EquipID:-2,Modifiers:[],CanUsedGod:[]}
execute store result score $ID Temporary run data get storage lib: Array[-1].ID
# スロットチェック
# 今のslotを取得する
execute store result storage asset:artifact Enum.Index int 1 run scoreboard players add $SlotIndex Temporary 1
function asset:artifact/enum/index/.m with storage asset:artifact Enum
# autoを処理しておく
data modify storage asset:artifact TargetSlot set from storage lib: Array[-1].Slot
execute if data storage asset:artifact {TargetSlot:"auto"} if data storage asset:artifact Enum{Slot:"mainhand"} run data modify storage lib: Array[-1].Slot set from storage asset:artifact Enum.Slot
execute if data storage asset:artifact {TargetSlot:"auto"} if data storage asset:artifact Enum{Slot: "offhand"} run data modify storage lib: Array[-1].Slot set from storage asset:artifact Enum.Slot
data remove storage asset:artifact TargetSlot
# Slotが一致しているか確認する
execute store success score $InvalidSlot Temporary run data modify storage lib: Array[-1].Slot set from storage asset:artifact Enum.Slot
# tellraw @a [{"score":{"name":"$InvalidSlot","objective":"Temporary"}}]
# データが正しそうなら引っ張り出す
data modify storage asset:artifact New.ItemData append value {}
execute if score $ID Temporary matches 0..65535 unless score $InvalidSlot Temporary matches 1.. run data modify storage asset:artifact New.ItemData[-1] set from storage lib: Array[-1]
# データが正しくなさそうならさようなら
execute if score $ID Temporary matches ..-1 run data modify storage asset:artifact New.ItemData[-1] set from storage lib: Array[-1]
execute unless data storage asset:artifact New.ItemData[-1].ID run data modify storage asset:artifact New.ItemData[-1] set value {ID:-1,UUID:-1}
# 要素を削除し、残っていたら再帰する
scoreboard players reset $InvalidSlot Temporary
data remove storage lib: Array[-1]
execute if data storage lib: Array[0] run function asset_manager:artifact/data/new/fetch_data/foreach

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# IDの代入
function asset_manager:artifact/data/old/init
function asset_manager:artifact/data/new/init
# 装備のデータ取り出し
# 装備のデータの絞り込み
function asset_manager:artifact/data/new/fetch_data/
# イベント情報を取得
data modify storage asset:artifact ArtifactEvents set from storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].ArtifactEvents
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
# @within function asset_manager:artifact/triggers/

# 装備が変更されている箇所を抽出
# 信仰が正しいかも拾う
data modify storage asset:artifact CopiedChanges set from storage asset:artifact EquipmentChanges
data modify storage asset:artifact CopiedOldItemData set from storage asset:artifact Old.ItemData
data modify storage asset:artifact CopiedNewItemData set from storage asset:artifact New.ItemData
function asset_manager:artifact/triggers/equipments/update_attribute/extract_changes
# 古いModifierを削除
data modify storage asset:artifact CopiedModifiers set from storage asset:artifact MaskedOldItemData[].Modifiers
function asset_manager:artifact/triggers/equipments/update_attribute/remove/
# 新しいModifierを付与
data modify storage asset:artifact CopiedModifiers set from storage asset:artifact MaskedNewItemData[].Modifiers
function asset_manager:artifact/triggers/equipments/update_attribute/add/
# セット装備効果の更新
function asset_manager:artifact/triggers/equipments/update_attribute/attire/
Expand All @@ -22,4 +21,5 @@
data remove storage asset:artifact CopiedChanges
data remove storage asset:artifact CopiedOldItemData
data remove storage asset:artifact CopiedNewItemData
data remove storage asset:artifact CopiedModifiers
data remove storage asset:artifact MaskedOldItemData
data remove storage asset:artifact MaskedNewItemData
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#> custom modifier
# @within function asset_manager:artifact/triggers/equipments/update_attribute/**
#declare score_holder $CustomModifier
#declare score_holder $CheckBelieve

#> dec to hex
# @within function asset_manager:artifact/triggers/equipments/update_attribute/dec_to_hex/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,11 @@
# asset_manager:artifact/triggers/equipments/update_attribute/
# asset_manager:artifact/triggers/equipments/update_attribute/add/

# データを取得
data modify storage asset:artifact Modifier set from storage asset:artifact CopiedModifiers[-1]
# Modifierを切り出す
function asset_manager:artifact/triggers/equipments/update_attribute/add/stack/

# データを整える
execute if data storage asset:artifact Modifier{Slot:"hotbar"} run function asset_manager:artifact/triggers/equipments/update_attribute/add/calc_effective
data modify storage asset:artifact Modifier.UUID set value [I;1,1,-1,-1]
data modify storage asset:artifact Modifier.UUID[2] set from storage asset:artifact Modifier.ID
function asset_manager:artifact/triggers/equipments/update_attribute/get_slot_id
# Modifierがあれば処理する
execute if data storage asset:artifact MaskedModifiers[0] run function asset_manager:artifact/triggers/equipments/update_attribute/add/process

# apiに移す
data modify storage api: Argument.UUID set from storage asset:artifact Modifier.UUID
data modify storage api: Argument.Amount set from storage asset:artifact Modifier.Amount
data modify storage api: Argument.Operation set from storage asset:artifact Modifier.Operation
# カスタムModifierで処理
scoreboard players set $CustomModifier Temporary 0
function asset_manager:artifact/triggers/equipments/update_attribute/add/custom.m with storage asset:artifact Modifier
# バニラModifierで処理
execute unless score $CustomModifier Temporary matches 1 run function asset_manager:artifact/triggers/equipments/update_attribute/dec_to_hex/
execute unless score $CustomModifier Temporary matches 1 run function asset_manager:artifact/triggers/equipments/update_attribute/add/generic.m with storage asset:artifact Modifier

# リセット&ループ
scoreboard players reset $CustomModifier Temporary
data remove storage asset:artifact Modifier
data remove storage asset:artifact CopiedModifiers[-1]
execute if data storage asset:artifact CopiedModifiers[0] run function asset_manager:artifact/triggers/equipments/update_attribute/add/
# リセット
data remove storage asset:artifact MaskedModifiers
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#> asset_manager:artifact/triggers/equipments/update_attribute/add/calc_effective
# @within function asset_manager:artifact/triggers/equipments/update_attribute/add/
# @within function asset_manager:artifact/triggers/equipments/update_attribute/add/process

#> Private
# @private
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#> asset_manager:artifact/triggers/equipments/update_attribute/add/custom.m
# @input args
# Type : string
# @within function asset_manager:artifact/triggers/equipments/update_attribute/add/
# @within function asset_manager:artifact/triggers/equipments/update_attribute/add/process

$function api:modifier/$(Type)/add
$execute store success score $CustomModifier Temporary run schedule function api:modifier/$(Type)/add 2147483647t
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
# SlotID : int
# Amount : double
# Operation : string
# @within function asset_manager:artifact/triggers/equipments/update_attribute/add/
# @within function asset_manager:artifact/triggers/equipments/update_attribute/add/process

$attribute @s $(Type) modifier add 1-0-1-0-$(ArtifactID)0000000$(SlotID) "$(ID).$(Type)" $(Amount) $(Operation)
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#> asset_manager:artifact/triggers/equipments/update_attribute/add/process
# @within function asset_manager:artifact/triggers/equipments/update_attribute/add/*

# データを取得
data modify storage asset:artifact Modifier set from storage asset:artifact MaskedModifiers[-1]

# データを整える
execute if data storage asset:artifact Modifier{Slot:"hotbar"} run function asset_manager:artifact/triggers/equipments/update_attribute/add/calc_effective
data modify storage asset:artifact Modifier.UUID set value [I;1,1,-1,-1]
data modify storage asset:artifact Modifier.UUID[2] set from storage asset:artifact Modifier.ID
data modify storage asset:artifact Enum.Slot set from storage asset:artifact Modifier.Slot
execute store result storage asset:artifact Modifier.UUID[3] int 1 run function asset:artifact/enum/slot/.m with storage asset:artifact Enum

# apiに移す
data modify storage api: Argument.UUID set from storage asset:artifact Modifier.UUID
data modify storage api: Argument.Amount set from storage asset:artifact Modifier.Amount
data modify storage api: Argument.Operation set from storage asset:artifact Modifier.Operation
# カスタムModifierで処理
scoreboard players set $CustomModifier Temporary 0
function asset_manager:artifact/triggers/equipments/update_attribute/add/custom.m with storage asset:artifact Modifier
# バニラModifierで処理
execute unless score $CustomModifier Temporary matches 1 run function asset_manager:artifact/triggers/equipments/update_attribute/dec_to_hex/
execute unless score $CustomModifier Temporary matches 1 run function asset_manager:artifact/triggers/equipments/update_attribute/add/generic.m with storage asset:artifact Modifier

# リセット&ループ
scoreboard players reset $CustomModifier Temporary
data remove storage asset:artifact Modifier
data remove storage asset:artifact MaskedModifiers[-1]
execute if data storage asset:artifact MaskedModifiers[0] run function asset_manager:artifact/triggers/equipments/update_attribute/add/process
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#> asset_manager:artifact/triggers/equipments/update_attribute/add/stack/
# @within function
# asset_manager:artifact/triggers/equipments/update_attribute/add/
# asset_manager:artifact/triggers/equipments/update_attribute/add/stack/

# Modifier一覧を切り出す
execute if data storage asset:artifact MaskedNewItemData[-1].Modifiers[0] run data modify storage asset:artifact MaskedNewItemData[-1].Modifiers[].ID set from storage asset:artifact MaskedNewItemData[-1].ID
execute if data storage asset:artifact MaskedNewItemData[-1].Modifiers[0] run data modify storage asset:artifact MaskedNewItemData[-1].Modifiers[].Slot set from storage asset:artifact MaskedNewItemData[-1].Slot
data modify storage asset:artifact Modifiers append from storage asset:artifact MaskedNewItemData[-1].Modifiers[]

# Modifierのスタック処理
execute if data storage asset:artifact Modifiers[0] run function asset_manager:artifact/triggers/equipments/update_attribute/add/stack/foreach

# 要素を削除して、残っているならば再帰
data remove storage asset:artifact Modifiers
data remove storage asset:artifact MaskedNewItemData[-1]
execute if data storage asset:artifact MaskedNewItemData[0] run function asset_manager:artifact/triggers/equipments/update_attribute/add/stack/
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#> asset_manager:artifact/triggers/equipments/update_attribute/add/stack/calc.m
# @input args
# ID : int
# Type : string
# @within function asset_manager:artifact/triggers/equipments/update_attribute/add/stack/foreach

#> Private
# @private
#declare score_holder $SameModifier
#declare score_holder $ModifierStack

# 同一スロット、タイプ、IDのものがないかチェック
$execute store result score $SameModifier Temporary if data storage asset:artifact MaskedModifiers[{ID:$(ID),Type:"$(Type)"}]
# 一致しているものがあればスタック追加
$execute if score $SameModifier Temporary matches 1.. store result score $ModifierStack Temporary run data get storage asset:artifact MaskedModifiers[{ID:$(ID),Type:"$(Type)"}].Stack
execute if score $SameModifier Temporary matches 1.. run scoreboard players add $ModifierStack Temporary 1
$execute if score $SameModifier Temporary matches 1.. store result storage asset:artifact MaskedModifiers[{ID:$(ID),Type:"$(Type)"}].Stack int 1 run scoreboard players get $ModifierStack Temporary
# 一致しているものがなければ追加
execute if score $SameModifier Temporary matches 0 run data modify storage asset:artifact MaskedModifiers append from storage asset:artifact Modifier
execute if score $SameModifier Temporary matches 0 run data modify storage asset:artifact MaskedModifiers[-1].Stack set value 1
# リセット
scoreboard players reset $SameModifier Temporary
scoreboard players reset $ModifierStack Temporary
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#> asset_manager:artifact/triggers/equipments/update_attribute/add/stack/foreach
# @within function asset_manager:artifact/triggers/equipments/update_attribute/add/stack/*

# Modifierを切り出す
data modify storage asset:artifact Modifier set from storage asset:artifact Modifiers[-1]

# Modifierのスタックを行う
function asset_manager:artifact/triggers/equipments/update_attribute/add/stack/calc.m with storage asset:artifact Modifier

# 要素を削除して、残っているならば再帰
data remove storage asset:artifact Modifier
data remove storage asset:artifact Modifiers[-1]
execute if data storage asset:artifact Modifiers[0] run function asset_manager:artifact/triggers/equipments/update_attribute/add/stack/foreach
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#> asset_manager:artifact/triggers/equipments/update_attribute/check_religion
#
#
#
# @within function asset_manager:artifact/triggers/equipments/update_attribute/extract_changes

execute if data storage asset:artifact {CanUsedGod:["Flora"]} if predicate player_manager:is_believe/flora run scoreboard players set $CheckBelieve Temporary 1
execute if data storage asset:artifact {CanUsedGod:["Nyaptov"]} if predicate player_manager:is_believe/nyaptov run scoreboard players set $CheckBelieve Temporary 1
execute if data storage asset:artifact {CanUsedGod:["Rumor"]} if predicate player_manager:is_believe/rumor run scoreboard players set $CheckBelieve Temporary 1
execute if data storage asset:artifact {CanUsedGod:["Urban"]} if predicate player_manager:is_believe/urban run scoreboard players set $CheckBelieve Temporary 1
execute if data storage asset:artifact {CanUsedGod:["Wi-ki"]} if predicate player_manager:is_believe/wi-ki run scoreboard players set $CheckBelieve Temporary 1
Loading

0 comments on commit f89f450

Please sign in to comment.