diff --git a/TheSkyBlessing/data/asset_manager/functions/artifact/_index.d.mcfunction b/TheSkyBlessing/data/asset_manager/functions/artifact/_index.d.mcfunction index bf4bd98ad0..e8e99c6a66 100644 --- a/TheSkyBlessing/data/asset_manager/functions/artifact/_index.d.mcfunction +++ b/TheSkyBlessing/data/asset_manager/functions/artifact/_index.d.mcfunction @@ -28,8 +28,9 @@ #> バニラの攻撃を扱う用 # @within function -# asset_manager:artifact/check/ -# asset_manager:artifact/triggers/attack_melee/** +# asset_manager:artifact/triggers/ +# asset_manager:artifact/triggers/vanilla/ +# asset_manager:artifact/triggers/attack_melee/foreach #declare tag ShouldVanillaAttack #> check用の失敗フラグ diff --git a/TheSkyBlessing/data/asset_manager/functions/artifact/triggers/.mcfunction b/TheSkyBlessing/data/asset_manager/functions/artifact/triggers/.mcfunction index 7a7a197731..76d2219382 100644 --- a/TheSkyBlessing/data/asset_manager/functions/artifact/triggers/.mcfunction +++ b/TheSkyBlessing/data/asset_manager/functions/artifact/triggers/.mcfunction @@ -20,8 +20,12 @@ execute if data storage asset:artifact {EquipmentChanges:[{_:{_:false}}]} run function asset_manager:artifact/triggers/equipments/update_attribute/ # 改宗時の更新処理 execute if entity @s[tag=Believe.Changed] unless data storage asset:artifact {EquipmentChanges:[{_:{_:false}}]} run function asset_manager:artifact/triggers/equipments/update_attribute/ +# バニラ攻撃をしているならフラグを建てる + execute if data storage asset:artifact ArtifactEvents.Attack[{Type:"vanilla_melee"}] run tag @s add ShouldVanillaAttack # 各神器にトリガー受けわたし function asset_manager:artifact/triggers/trigger/ +# 神器でバニラ攻撃を処理していないならダメージを与える + execute if entity @s[tag=ShouldVanillaAttack] run function asset_manager:artifact/triggers/vanilla/ # EntityStorageにデータ突っ込む function asset_manager:artifact/data/new/stash_to_entity_storage # リセット diff --git a/TheSkyBlessing/data/asset_manager/functions/artifact/triggers/event/attack/add_tag_each_victim.mcfunction b/TheSkyBlessing/data/asset_manager/functions/artifact/triggers/event/attack/add_tag_each_victim.mcfunction index 0b51cf8974..c4a4c014a5 100644 --- a/TheSkyBlessing/data/asset_manager/functions/artifact/triggers/event/attack/add_tag_each_victim.mcfunction +++ b/TheSkyBlessing/data/asset_manager/functions/artifact/triggers/event/attack/add_tag_each_victim.mcfunction @@ -3,6 +3,7 @@ # # # @within function +# asset_manager:artifact/triggers/vanilla/ # asset_manager:artifact/triggers/attack*/foreach # asset_manager:artifact/triggers/event/attack/add_tag_each_victim diff --git a/TheSkyBlessing/data/asset_manager/functions/artifact/triggers/event/attack/get_max_amount.mcfunction b/TheSkyBlessing/data/asset_manager/functions/artifact/triggers/event/attack/get_max_amount.mcfunction index 3643c4fd8c..0db0a2f186 100644 --- a/TheSkyBlessing/data/asset_manager/functions/artifact/triggers/event/attack/get_max_amount.mcfunction +++ b/TheSkyBlessing/data/asset_manager/functions/artifact/triggers/event/attack/get_max_amount.mcfunction @@ -2,7 +2,9 @@ # # # -# @within function asset_manager:artifact/triggers/attack*/foreach +# @within function +# asset_manager:artifact/triggers/vanilla/ +# asset_manager:artifact/triggers/attack*/foreach function lib:array/session/open data modify storage lib: Array set from storage asset:context Attack.Amounts diff --git a/TheSkyBlessing/data/asset_manager/functions/artifact/triggers/vanilla/.mcfunction b/TheSkyBlessing/data/asset_manager/functions/artifact/triggers/vanilla/.mcfunction new file mode 100644 index 0000000000..4438d2a460 --- /dev/null +++ b/TheSkyBlessing/data/asset_manager/functions/artifact/triggers/vanilla/.mcfunction @@ -0,0 +1,29 @@ +#> asset_manager:artifact/triggers/vanilla/ +# +# バニラ攻撃を処理する +# +# @within function asset_manager:artifact/triggers/ + +#> Private +# @within asset_manager:artifact/triggers/vanilla/* + #declare score_holder $Damage + +# イベントデータ処理 + # データを取得 + data modify storage asset:context Attack set from storage asset:artifact ArtifactEvents.Attack[{Type:"vanilla_melee"}] + # 攻撃先を取得し、Victim を付与する + data modify storage asset:artifact AttackTargets set from storage asset:context Attack.To + execute if data storage asset:artifact AttackTargets[0] run function asset_manager:artifact/triggers/event/attack/add_tag_each_victim + # 最大ダメージの計算 + function asset_manager:artifact/triggers/event/attack/get_max_amount + +# 各mobにダメージを与える + execute store result score $Damage Temporary run data get storage asset:context Attack.Amount -100 + execute as @e[type=#lib:living,type=!player,tag=Victim,distance=..8] at @s run function asset_manager:artifact/triggers/vanilla/damage + +# リセット + scoreboard players reset $Damage Temporary + data remove storage asset:context Attack + data remove storage asset:artifact AttackTargets + tag @s remove ShouldVanillaAttack + tag @e[type=#lib:living,type=!player,tag=Victim] remove Victim diff --git a/TheSkyBlessing/data/asset_manager/functions/artifact/triggers/vanilla/damage.mcfunction b/TheSkyBlessing/data/asset_manager/functions/artifact/triggers/vanilla/damage.mcfunction new file mode 100644 index 0000000000..2a8b409265 --- /dev/null +++ b/TheSkyBlessing/data/asset_manager/functions/artifact/triggers/vanilla/damage.mcfunction @@ -0,0 +1,18 @@ +#> asset_manager:artifact/triggers/vanilla/damage +# +# バニラ攻撃を処理する +# +# @within function asset_manager:artifact/triggers/vanilla/ + +#> Private +# @private + #declare score_holder $Fluctuation + +# 減算 + scoreboard players operation @s MobHealth += $Damage Temporary +# ダメージ表示 + scoreboard players operation $Fluctuation Lib = $Damage Temporary + execute unless score $Fluctuation Lib matches 0 run function lib:status_log/show_health +# 代入 / kill + execute if score @s MobHealth matches ..0 run tag @s add Death + execute if score @s MobHealth matches ..0 run function asset_manager:artifact/triggers/vanilla/push_kill_and_death_event diff --git a/TheSkyBlessing/data/asset_manager/functions/artifact/triggers/vanilla/push_kill_and_death_event.mcfunction b/TheSkyBlessing/data/asset_manager/functions/artifact/triggers/vanilla/push_kill_and_death_event.mcfunction new file mode 100644 index 0000000000..57c455506d --- /dev/null +++ b/TheSkyBlessing/data/asset_manager/functions/artifact/triggers/vanilla/push_kill_and_death_event.mcfunction @@ -0,0 +1,14 @@ +#> asset_manager:artifact/triggers/attack/vanilla/push_kill_and_death_event +# +# +# +# @within function asset_manager:artifact/triggers/attack/vanilla/ + +# プレイヤーにイベントを追加する + execute as @p[tag=this] run function oh_my_dat:please + data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].ArtifactEvents.Killed append from storage asset:context Attack +# Mob にもイベントを追加する + function oh_my_dat:please + data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].MobEvents.Death append from storage asset:context Attack + data remove storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].MobEvents.Death[-1].To + 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 @p[tag=this] UserID diff --git a/TheSkyBlessing/data/lib/functions/status_log/show_health.mcfunction b/TheSkyBlessing/data/lib/functions/status_log/show_health.mcfunction index f64cf0fe00..83040dee6e 100644 --- a/TheSkyBlessing/data/lib/functions/status_log/show_health.mcfunction +++ b/TheSkyBlessing/data/lib/functions/status_log/show_health.mcfunction @@ -6,7 +6,7 @@ # api:damage/core/health_subtract/non-player/ # api:heal/core/non-player # lib:score_to_health_wrapper/fluctuation -# asset_manager:artifact/triggers/attack/vanilla/ +# asset_manager:artifact/triggers/vanilla/damage # mob_manager:fix_health #> For Init