Skip to content

Commit

Permalink
🧑‍💻 攻撃時処理を作成
Browse files Browse the repository at this point in the history
  • Loading branch information
haiiro2gou committed Nov 17, 2024
1 parent d2a75db commit 41c599a
Show file tree
Hide file tree
Showing 10 changed files with 165 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#> asset_manager:artifact/triggers/attack_melee/
#
#
#
# @within function asset_manager:artifact/triggers/trigger/foreach/call.m

# フラグが存在しているか確認する
execute unless data storage asset:artifact ArtifactEvents.Attack[{Type:"vanilla_melee"}] run return fail
# イベントを取得する
data modify storage asset:artifact Events append from storage asset:artifact ArtifactEvents.Attack[{Type:"vanilla_melee"}]
# それぞれについて処理する
function asset_manager:artifact/triggers/attack_melee/foreach

# リセット
data remove storage asset:artifact Events
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset_manager:artifact/triggers/attack_melee/attack.m
#
#
#
# @input args id : int
# @within function asset_manager:artifact/triggers/attack_melee/use

$function asset:artifact/alias/$(id)/attack/
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset_manager:artifact/triggers/attack_melee/check.m
#
#
#
# @input args id : int
# @within function asset_manager:artifact/triggers/attack_melee/foreach

$function asset:artifact/alias/$(id)/attack/check
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#> asset_manager:artifact/triggers/attack_melee/foreach
#
#
#
# @within function asset_manager:artifact/triggers/attack_melee/*

# バニラ攻撃はなかったことにする
tag @s remove ShouldVanillaAttack

# イベントデータ処理
# データを取得
data modify storage asset:context Attack set from storage asset:artifact Events[-1]
# 攻撃先を取得し、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
# MPを命中回数分回復する
function asset_manager:artifact/triggers/event/attack/mp_heal

# 使用条件を満たしているか確認する
function asset_manager:artifact/check/
function asset_manager:artifact/triggers/attack_melee/check.m with storage asset:context
# 条件を満たしていれば使用する
execute if entity @s[tag=CanUsed] run function asset_manager:artifact/triggers/attack_melee/use

# リセット
tag @s remove CanUsed
data remove storage asset:artifact Events[-1]
# 要素が残っているなら再帰
execute if data storage asset:artifact Events[0] run function asset_manager:artifact/triggers/attack_melee/foreach
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#> asset_manager:artifact/triggers/attack_melee/use
#
#
#
# @within function asset_manager:artifact/triggers/attack_melee/foreach

# 共通処理
# アイテムを破壊するとBrokeItemが追加される
function asset_manager:artifact/use/

# 処理対象の神器の重複数を取得する
execute store result storage asset:context Count int 1 if data storage asset:artifact TargetItemList[]

# 神器を呼び出し
function asset_manager:artifact/triggers/attack_melee/attack.m with storage asset:context

# リセット
tag @e[type=#lib:living,type=!player,tag=Victim] remove Victim
data remove storage asset:context BrokeItem
data remove storage asset:context Attack
data remove storage asset:context Count
data remove storage asset:artifact AttackTargets
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#> asset_manager:artifact/triggers/attack_projectile/
#
#
#
# @within function asset_manager:artifact/triggers/trigger/foreach/call.m

# フラグが存在しているか確認する
execute unless data storage asset:artifact ArtifactEvents.Attack[{Type:"vanilla_melee"}] run return fail
# イベントを取得する
data modify storage asset:artifact Events append from storage asset:artifact ArtifactEvents.Attack[{Type:"vanilla_melee"}]
# それぞれについて処理する
function asset_manager:artifact/triggers/attack_projectile/foreach

# リセット
data remove storage asset:artifact Events
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset_manager:artifact/triggers/attack_projectile/attack.m
#
#
#
# @input args id : int
# @within function asset_manager:artifact/triggers/attack_projectile/use

$function asset:artifact/alias/$(id)/attack/
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset_manager:artifact/triggers/attack_projectile/check.m
#
#
#
# @input args id : int
# @within function asset_manager:artifact/triggers/attack_projectile/foreach

$function asset:artifact/alias/$(id)/attack/check
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#> asset_manager:artifact/triggers/attack_projectile/foreach
#
#
#
# @within function asset_manager:artifact/triggers/attack_projectile/*

# イベントデータ処理
# データを取得
data modify storage asset:context Attack set from storage asset:artifact Events[-1]
# 攻撃先を取得し、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
# MPを命中回数分回復する
function asset_manager:artifact/triggers/event/attack/mp_heal

# 使用条件を満たしているか確認する
function asset_manager:artifact/check/
function asset_manager:artifact/triggers/attack_projectile/check.m with storage asset:context
# 条件を満たしていれば使用する
execute if entity @s[tag=CanUsed] run function asset_manager:artifact/triggers/attack_projectile/use

# リセット
tag @s remove CanUsed
data remove storage asset:artifact Events[-1]
# 要素が残っているなら再帰
execute if data storage asset:artifact Events[0] run function asset_manager:artifact/triggers/attack_projectile/foreach
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#> asset_manager:artifact/triggers/attack_projectile/use
#
#
#
# @within function asset_manager:artifact/triggers/attack_projectile/foreach

# 共通処理
# アイテムを破壊するとBrokeItemが追加される
function asset_manager:artifact/use/

# 処理対象の神器の重複数を取得する
execute store result storage asset:context Count int 1 if data storage asset:artifact TargetItemList[]

# 神器を呼び出し
function asset_manager:artifact/triggers/attack_projectile/attack.m with storage asset:context

# リセット
tag @e[type=#lib:living,type=!player,tag=Victim] remove Victim
data remove storage asset:context BrokeItem
data remove storage asset:context Attack
data remove storage asset:context Count
data remove storage asset:artifact AttackTargets

0 comments on commit 41c599a

Please sign in to comment.