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

💥 Artifact Assetのトリガーのマクロ化 #1621

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
82639d3
:technologist: asset:common/context/**のwithinを修正
haiiro2gou Nov 17, 2024
a9c0b84
:technologist: 神器の生成処理を再構築する
haiiro2gou Nov 22, 2024
10ac5c8
:technologist: 落下耐性Attributeを正負反転して処理するように
haiiro2gou Nov 22, 2024
c0b8660
:fire: トリガー処理を一旦削除
haiiro2gou Nov 23, 2024
5ea14cd
:truck: ArtifactEvents.Killed -> ArtifactEvents.Kill
haiiro2gou Nov 23, 2024
02d4c5a
:truck: LocalCoolDown -> LocalCooldown
haiiro2gou Nov 23, 2024
0f0498e
:truck: NewとOldをasset:contextから外す
haiiro2gou Nov 23, 2024
395ca63
:technologist: Slot <-> Indexの変換処理を実装
haiiro2gou Nov 23, 2024
74799f8
:technologist: トリガー処理を再実装
haiiro2gou Nov 23, 2024
bbcea6f
:technologist: トリガーの呼び出し処理を実装
haiiro2gou Nov 23, 2024
232e35a
:recycle: 使用条件を確認する処理をリファクタリング
haiiro2gou Nov 23, 2024
6a24299
:recycle: 神器を使用する処理をリファクタリング
haiiro2gou Nov 23, 2024
06c9fc2
:technologist: 攻撃時のトリガー処理を実装
haiiro2gou Nov 23, 2024
b63cd36
:technologist: 被ダメージ時のトリガー処理を実装
haiiro2gou Nov 23, 2024
06e2c16
:technologist: 敵撃破時のトリガー処理を実装
haiiro2gou Nov 23, 2024
a1dc7dc
:technologist: スニーク時のトリガー処理を実装
haiiro2gou Nov 23, 2024
94813a1
:technologist: 回復時のトリガー処理を実装
haiiro2gou Nov 23, 2024
2cc2606
:technologist: アイテム使用時のトリガー処理を実装
haiiro2gou Nov 23, 2024
551ea12
:technologist: その他のトリガー処理を実装
haiiro2gou Nov 23, 2024
c19bec5
:technologist: example神器を実装
haiiro2gou Nov 23, 2024
8c01713
:technologist: 装備変更時のステータス変動処理を内部化
haiiro2gou Nov 23, 2024
6f4011a
:bug: 信仰変更時に装備データが更新されないのを修正
haiiro2gou Nov 23, 2024
8c9819d
Merge branch 'master' into rework/haiiro_artifact-trigger
haiiro2gou Nov 28, 2024
ffe2c8a
Merge branch 'master' into rework/haiiro_artifact-trigger
haiiro2gou Nov 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,10 @@

# validate
execute unless data storage api: Argument.ID run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"引数が足りません","color":"white"},{"text":" ID","color":"red"}]
# 既存にasset:context idが存在する場合に備えて退避させる
function asset_manager:common/context/id/stash
# 代入
data modify storage asset:context id set from storage api: Argument.ID
data modify storage asset:context Type set value "box"
execute unless data storage api: Argument.ID run return fail
# 呼び出し
execute if data storage api: Argument.ID run function #asset:artifact/give
# 退避させたasset:context idを戻す
function asset_manager:common/context/id/pop
data modify storage api: Argument.Type set value "box"
function api:artifact/core/from_id
# リセット
data remove storage api: Argument.ID
data remove storage api: Argument.Type
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@

# validate
execute unless data storage api: Argument.Rarity run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"引数が足りません","color":"white"},{"text":" Rarity","color":"red"}]
execute unless data storage api: Argument.Rarity run return fail
# 呼び出し
data modify storage asset:context Type set value "box"
execute if data storage api: Argument.Rarity run function asset_manager:artifact/give/
data modify storage api: Argument.Type set value "box"
function api:artifact/core/from_rarity/
# リセット
data remove storage api: Argument.Rarity
data remove storage api: Argument.Type
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#> api:artifact/core/from_id
# @within function
# api:artifact/*/from_id
# api:artifact/core/from_rarity/foreach

# 既存にasset:context idが存在する場合に備えて退避させる
function asset_manager:common/context/id/stash

# ID
data modify storage asset:context id set from storage api: Argument.ID
# データ登録
function asset_manager:artifact/give/register.m with storage asset:context
# validate
execute unless data storage asset:artifact ID run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"このIDの神器は存在しません "},{"storage":"api:","nbt":"Argument.ID","color":"red"}]
# データをfill
execute if data storage asset:artifact ID run data modify storage asset:context Type set from storage api: Argument.Type
execute if data storage asset:artifact ID if data storage asset:context {Type:"drop"} run data modify storage asset:context Important set from storage api: Argument.Important
# 神器をgive
execute if data storage asset:artifact ID run function asset_manager:artifact/give/

# 退避させたasset:context idを戻す
function asset_manager:common/context/id/pop
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#> api:artifact/core/from_rarity/
#
#
#
# @within function api:artifact/*/from_rarity

#> For calc
# @private
#declare score_holder $CandidateLength
#declare score_holder $Argument.Index
#declare score_holder $Pulls

# セッション開ける
function lib:array/session/open
# 該当レアリティのデータを取得
execute if data storage api: Argument{Rarity:1} run data modify storage lib: Array set from storage asset:artifact ShardPool[1]
execute if data storage api: Argument{Rarity:2} run data modify storage lib: Array set from storage asset:artifact ShardPool[2]
execute if data storage api: Argument{Rarity:3} run data modify storage lib: Array set from storage asset:artifact ShardPool[3]
execute if data storage api: Argument{Rarity:4} run data modify storage lib: Array set from storage asset:artifact ShardPool[4]
# データサイズを取得
execute store result score $CandidateLength Temporary if data storage lib: Array[]
# 対象Indexを決定
execute if data storage api: Argument{Rarity:1} run data modify storage lib: Args.key set value "artifact_lv-1"
execute if data storage api: Argument{Rarity:2} run data modify storage lib: Args.key set value "artifact_lv-2"
execute if data storage api: Argument{Rarity:3} run data modify storage lib: Args.key set value "artifact_lv-3"
execute if data storage api: Argument{Rarity:4} run data modify storage lib: Args.key set value "artifact_lv-4"
execute store result storage lib: Args.max int 1 run scoreboard players get $CandidateLength Temporary
execute store result storage lib: Args.scarcity_history_size int 0.35 run scoreboard players get $CandidateLength Temporary
execute store result score $Argument.Index Lib run function lib:random/with_biased/manual.m with storage lib: Args
# 候補データを操作して対象Indexを-1に持ってくる
function lib:array/move
# 一旦リセット
data modify storage asset:artifact Picks set from storage lib: Array[-1]
function lib:array/session/close
# 候補データの再設定
function lib:array/session/open
data modify storage lib: Array set from storage asset:artifact Picks
# プル数を乱数により設定
# $Pulls = floor( $CandidateLength * 0.30~0.70(e2) ) / e2
execute store result score $CandidateLength Temporary if data storage lib: Array[]
scoreboard players remove $CandidateLength Temporary 1
execute store result score $Pulls Temporary run function lib:random/
scoreboard players operation $Pulls Temporary %= $41 Const
scoreboard players add $Pulls Temporary 30
scoreboard players operation $Pulls Temporary *= $CandidateLength Temporary
scoreboard players operation $Pulls Temporary /= $100 Const
# シャッフルして取り出す
scoreboard players add $CandidateLength Temporary 1
execute if data storage lib: Array[0] run function api:artifact/core/from_rarity/foreach
# リセット
function lib:array/session/close
scoreboard players reset $CandidateLength Temporary
scoreboard players reset $Pulls Temporary
data remove storage lib: Args
data remove storage asset:artifact Picks
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,17 @@
#declare score_holder $Argument.Index
#declare score_holder $Pulls

# asset:context idがある場合は退避
function asset_manager:common/context/id/stash
# 配列をランダムに動かす
execute store result score $Argument.Index Lib run function lib:random/
scoreboard players operation $Argument.Index Lib %= $CandidateLength Temporary
function lib:array/move
# 引数に代入
data modify storage asset:context id set from storage lib: Array[-1]
data modify storage asset:context Type set from storage asset:artifact Type
data modify storage api: Argument.ID set from storage lib: Array[-1]
# 呼び出し
function #asset:artifact/give
# asset:context idを戻す
function asset_manager:common/context/id/pop
function api:artifact/core/from_id

# リセット&ループ
data remove storage lib: Array[-1]
scoreboard players remove $CandidateLength Temporary 1
scoreboard players remove $Pulls Temporary 1
execute if score $Pulls Temporary matches 0.. if data storage lib: Array[0] run function asset_manager:artifact/give/candidates
execute if score $Pulls Temporary matches 0.. if data storage lib: Array[0] run function api:artifact/core/from_rarity/foreach
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,10 @@

# validate
execute unless data storage api: Argument.ID run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"引数が足りません","color":"white"},{"text":" ID","color":"red"}]
# 既存にasset:context idが存在する場合に備えて退避させる
function asset_manager:common/context/id/stash
# 代入
data modify storage asset:context id set from storage api: Argument.ID
data modify storage asset:context Type set value "give"
execute unless data storage api: Argument.ID run return fail
# 呼び出し
execute if data storage api: Argument.ID run function #asset:artifact/give
# 退避させたasset:context idを戻す
function asset_manager:common/context/id/pop
data modify storage api: Argument.Type set value "give"
function api:artifact/core/from_id
# リセット
data remove storage api: Argument.ID
data remove storage api: Argument.Type
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@

# validate
execute unless data storage api: Argument.Rarity run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"引数が足りません","color":"white"},{"text":" Rarity","color":"red"}]
execute unless data storage api: Argument.Rarity run return fail
# 呼び出し
data modify storage asset:context Type set value "give"
execute if data storage api: Argument.Rarity run function asset_manager:artifact/give/
data modify storage api: Argument.Type set value "give"
function api:artifact/core/from_rarity/
# リセット
data remove storage api: Argument.Rarity
data remove storage api: Argument.Type
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,18 @@
# 神器Assetの入手処理を叩く処理
#
# @input storage api:
# Argument.ID
# Argument.Slot
# Argument.ID : int
# Argument.Slot? : string (default: "mainhand")
# @api

# validate
execute unless data storage api: Argument.ID run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"引数が足りません","color":"white"},{"text":" ID","color":"red"}]
# 既存にasset:context idが存在する場合に備えて退避させる
function asset_manager:common/context/id/stash
# 代入
data modify storage asset:context id set from storage api: Argument.ID
execute if data storage api: Argument.Slot run data modify storage asset:context Slot set from storage api: Argument.Slot
data modify storage asset:context Type set value "replace"
execute unless data storage api: Argument.ID run return fail
execute unless data storage api: Argument.Slot run data modify storage api: Argument.Slot set value "mainhand"
# 呼び出し
execute if data storage api: Argument.ID run function #asset:artifact/give
# 退避させたasset:context idを戻す
function asset_manager:common/context/id/pop
data modify storage api: Argument.Type set value "replace"
function api:artifact/core/from_id
# リセット
data remove storage api: Argument.ID
data remove storage api: Argument.Slot
data remove storage api: Argument.Type
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@
#
# 神器Assetの入手処理を叩く処理
#
# @input storage api: Argument.Rarity
# @input storage api:
# Argument.Rarity : (1 | 2 | 3 | 4)
# Argument.Slot? : string (default: "mainhand")
# @api

# validate
execute unless data storage api: Argument.Rarity run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"引数が足りません","color":"white"},{"text":" Rarity","color":"red"}]
execute unless data storage api: Argument.Rarity run return fail
execute unless data storage api: Argument.Slot run data modify storage api: Argument.Slot set value "mainhand"
# 呼び出し
data modify storage asset:context Type set value "replace"
execute if data storage api: Argument.Rarity run function asset_manager:artifact/give/
data modify storage api: Argument.Type set value "replace"
function api:artifact/core/from_rarity/
# リセット
data remove storage api: Argument.Rarity
data remove storage api: Argument.Slot
data remove storage api: Argument.Type
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,18 @@
# 神器Assetの入手処理を叩く処理
#
# @input storage api:
# Argument.Rarity : (1 | 2 | 3 | 4)
# Argument.Important : boolean
# Argument.ID : int
# Argument.Important? : boolean (default: false)
# @api

# validate
execute unless data storage api: Argument.ID run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"引数が足りません","color":"white"},{"text":" ID","color":"red"}]
# 既存にasset:context idが存在する場合に備えて退避させる
function asset_manager:common/context/id/stash
# 代入
data modify storage asset:context id set from storage api: Argument.ID
data modify storage asset:context Type set value "drop"
data modify storage asset:context Important set from storage api: Argument.Important
execute unless data storage api: Argument.ID run return fail
execute unless data storage api: Argument.Important run data modify storage api: Argument.Important set value false
# 呼び出し
execute if data storage api: Argument.ID run function #asset:artifact/give
# 退避させたasset:context idを戻す
function asset_manager:common/context/id/pop
data modify storage api: Argument.Type set value "drop"
function api:artifact/core/from_id
# リセット
data remove storage asset:context Important
data remove storage api: Argument.ID
data remove storage api: Argument.Important
data remove storage api: Argument.Type
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@
#
# @input storage api:
# Argument.Rarity : (1 | 2 | 3 | 4)
# Argument.Important : boolean
# Argument.Important? : boolean (default: false)
# @api

# validate
execute unless data storage api: Argument.Rarity run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"引数が足りません","color":"white"},{"text":" Rarity","color":"red"}]
execute unless data storage api: Argument.Rarity run return fail
execute unless data storage api: Argument.Important run data modify storage api: Argument.Important set value false
# 呼び出し
data modify storage asset:context Type set value "drop"
data modify storage asset:context Important set from storage api: Argument.Important
execute if data storage api: Argument.Rarity run function asset_manager:artifact/give/
data modify storage api: Argument.Type set value "drop"
function api:artifact/core/from_rarity/
# リセット
data remove storage asset:context Important
data remove storage api: Argument.Rarity
data remove storage api: Argument.Important
data remove storage api: Argument.Type
2 changes: 0 additions & 2 deletions TheSkyBlessing/data/api/functions/damage/.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
# └ Argument.BypassDifficulty? : boolean
# Argument.ReduceEnchantment? : id(minecraft:enchantment) | { id: id(minecraft:enchantment), modifier?: int }
# Argument.DeathMessage? : TextComponent || TextComponent[]
# Argument.AdditionalMPHeal? : int (default: PersistentArgument.AdditionalMPHeal)
# Argument.DisableLog? : boolean (default: false)
# Argument.Metadata? : any
# @api
Expand All @@ -42,7 +41,6 @@
execute unless data storage api: Argument.BypassEnchantments run data modify storage api: Argument.BypassEnchantments set value false
execute unless data storage api: Argument.BypassResistance run data modify storage api: Argument.BypassResistance set value false
execute unless data storage api: Argument.BypassDifficulty run data modify storage api: Argument.BypassDifficulty set value false
execute unless data storage api: Argument.AdditionalMPHeal run data modify storage api: Argument.AdditionalMPHeal set from storage api: PersistentArgument.AdditionalMPHeal
execute unless data storage api: Argument.DisableLog run data modify storage api: Argument.DisableLog set value false

# Healthを持つ干渉可能なEntityかつ死んでいなければ実行
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,5 @@
# @within
# function
# api:damage/core/health_subtract/non-player/*
# asset_manager:artifact/triggers/attack/vanilla
# mob_manager:entity_finder/player_hurt_entity/on_attack
#declare tag AttackedByApi
#declare tag AttackedByProjectile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,3 @@
# リセット
scoreboard players reset $Health Temporary
scoreboard players reset $Damage Temporary

# MP 回復
execute if data storage api: Argument.AdditionalMPHeal if entity @s[type=!player] as @a if score @s UserID = $LatestModifiedUser UserID run function api:damage/core/mp_heal

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ data remove storage api: Argument.BypassResistance
data remove storage api: Argument.BypassDifficulty
data remove storage api: Argument.DisableParticle
data remove storage api: Argument.ReduceEnchantment
data remove storage api: Argument.AdditionalMPHeal
data remove storage api: Argument.DisableLog
data remove storage api: Argument.Metadata

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
execute store result storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].MobEvents.Death[-1].From int 1 run scoreboard players get @s UserID
# プレイヤーにイベントを追加する
function oh_my_dat:please
data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].ArtifactEvents.Killed append value {Type: "api",IsVanilla:false}
execute store result storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].ArtifactEvents.Killed[-1].To int 1 run scoreboard players get $DamagerUUID Temporary
execute store result storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].ArtifactEvents.Killed[-1].Amount double 0.01 run scoreboard players get $Damage Temporary
data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].ArtifactEvents.Killed[-1].AttackType set from storage api: Argument.AttackType
data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].ArtifactEvents.Killed[-1].ElementType set from storage api: Argument.ElementType
data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].ArtifactEvents.Killed[-1].Metadata set from storage api: Argument.Metadata
data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].ArtifactEvents.Kill append value {Type: "api",IsVanilla:false}
execute store result storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].ArtifactEvents.Kill[-1].To int 1 run scoreboard players get $DamagerUUID Temporary
execute store result storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].ArtifactEvents.Kill[-1].Amount double 0.01 run scoreboard players get $Damage Temporary
data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].ArtifactEvents.Kill[-1].AttackType set from storage api: Argument.AttackType
data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].ArtifactEvents.Kill[-1].ElementType set from storage api: Argument.ElementType
data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].ArtifactEvents.Kill[-1].Metadata set from storage api: Argument.Metadata
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# 新しいModifierを追加する
data modify storage api: Modifiers append value {}
data modify storage api: Modifiers[-1].UUID set from storage api: Argument.UUID
data modify storage api: Modifiers[-1].Amount set from storage api: Argument.Amount
execute store result storage api: Modifiers[-1].Amount double -0.001 run data get storage api: Argument.Amount 1000
data modify storage api: Modifiers[-1].Operation set from storage api: Argument.Operation
data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].Attributes.Modifier.FallDamage set from storage api: Modifiers
# データを更新
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
data remove storage api: Removed
# フィルタ
function api:modifier/core/common/remove_modifier
# 削除されたデータの加工
execute store result storage api: Removed.Amount double -0.001 run data get storage api: Removed.Amount 1000
# 新しい配列を戻す
data modify storage api: Modifiers set from storage api: NewModifiers
data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].Attributes.Modifier.FallDamage set from storage api: Modifiers
Expand Down
6 changes: 6 additions & 0 deletions TheSkyBlessing/data/asset/functions/_index.d.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#> asset:_index.d
# @private

#> 処理用一時storage
# @within * asset:**
#declare storage asset:temp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset:artifact/alias/65535/attack/
#
# 神器の攻撃時の処理のエイリアス
#
# @within asset_manager:artifact/triggers/attack/attack.m

# 元の登録処理を呼び出す
function asset:artifact/example/attack/
Loading