-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
145 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"exhaustion": 0, | ||
"scaling": "never", | ||
"message_id": "tusb:magic" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"exhaustion": 0, | ||
"scaling": "never", | ||
"message_id": "tusb:physical" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"exhaustion": 0, | ||
"scaling": "never", | ||
"message_id": "tusb:unreasonable" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#> entity:damage/apply/ | ||
# 設定された物理、魔法、理外のダメージを実行者に与える。 | ||
|
||
# 物理ダメージ | ||
function entity:damage/apply/physical | ||
|
||
# 魔法ダメージ | ||
function entity:damage/apply/magic | ||
|
||
# 理外ダメージ | ||
function entity:damage/apply/unreasonable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#> entity:damage/apply/core/ | ||
|
||
## ダメージ処理の実行チェック | ||
# ダメージ値が指定されていなければ中断 | ||
execute unless data storage entity:_ damage.value run return fail | ||
# 実行者が死亡していれば中断 | ||
execute if predicate entity:damage/check_death run return fail | ||
|
||
|
||
# ダメージ値が割合設定ならば解決する | ||
execute if data storage entity:_ damage.value{} run function entity:damage/apply/core/resolve_percentage_damage/ | ||
|
||
# 実行者のentity_typeによって処理を変更する | ||
execute if entity @s[type=player] run function entity:damage/apply/core/player | ||
execute unless entity @s[type=player] run function entity:damage/apply/core/mob |
3 changes: 3 additions & 0 deletions
3
data/entity/function/damage/apply/core/apply.macro.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#> entity:damage/apply/core/apply.macro | ||
# 受け取ったダメージ属性とダメージ値からdamageコマンドを実行する | ||
$damage @s $(value) $(type) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#> entity:damage/apply/core/mob | ||
# モブへダメージを与える | ||
|
||
# damageコマンドを実行する | ||
function entity:damage/apply/core/apply.macro with storage entity:_ damage | ||
|
||
# HPを更新する | ||
function enemy:damage/update_health | ||
|
||
# Hitダメージフラグを付与 | ||
execute if data storage entity: damage{hit:1b} run tag @s add HitDamageTaken |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#> entity:damage/apply/core/player | ||
# プレイヤーへダメージを与える | ||
|
||
# カスタム死亡ログがあればそれを表示するためにデフォルト死亡ログを非表示 | ||
execute if data storage entity: damage.deathcause run gamerule showDeathMessages false | ||
|
||
# damageコマンドを実行する | ||
function entity:damage/apply/core/apply.macro with storage entity:_ damage | ||
|
||
# カスタム死亡ログがあって死亡すればログを表示 | ||
execute if data storage entity: damage.deathcause if data entity @s {Health:0f} run tellraw @a {"storage":"entity:","nbt":"damage.deathcause","interpret":true} | ||
execute if data storage entity: damage.deathcause run gamerule showDeathMessages true |
12 changes: 12 additions & 0 deletions
12
data/entity/function/damage/apply/core/resolve_percentage_damage/.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#> entity:damage/apply/core/resolve_percentage_damage/ | ||
# 割合ダメージを実際のダメージへ計算する | ||
|
||
# 計算に必要な数値をentity_typeに合わせて取得する | ||
execute if entity @s[type=player] run function entity:damage/apply/core/resolve_percentage_damage/player | ||
execute unless entity @s[type=player] run function entity:damage/apply/core/resolve_percentage_damage/mob | ||
|
||
# 計算 | ||
execute store result score _ _ run data get storage entity:_ damage.value.percent 100 | ||
scoreboard players operation _ HP *= _ _ | ||
data modify storage entity:_ damage.value set value 0d | ||
execute store result storage entity:_ damage.value double 0.01 run scoreboard players get _ HP |
6 changes: 6 additions & 0 deletions
6
data/entity/function/damage/apply/core/resolve_percentage_damage/mob.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#> entity:damage/apply/core/resolve_percentage_damage/mob | ||
|
||
# 現在HPを取得 | ||
execute if data storage entity:_ damage.value{select:"current"} run scoreboard players operation _ HP = @s HP | ||
# 最大HPを取得 | ||
execute if data storage entity:_ damage.value{select:"max"} run scoreboard players operation _ HP = @s HPMax |
6 changes: 6 additions & 0 deletions
6
data/entity/function/damage/apply/core/resolve_percentage_damage/player.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#> entity:damage/apply/core/resolve_percentage_damage/player | ||
|
||
# 現在HPを取得 | ||
execute if data storage entity:_ damage.value{select:"current"} store result score _ HP run data get entity @s Health | ||
# 最大HPを取得 | ||
execute if data storage entity:_ damage.value{select:"max"} store result score _ HP run attribute @s generic.max_health get |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#> entity:damage/apply/magic | ||
# 設定された魔法ダメージを実行者に与える | ||
|
||
# このダメージについての指定 | ||
data modify storage entity:_ damage set value {type:"entity:magic"} | ||
data modify storage entity:_ damage.value set from storage entity: damage.magic | ||
|
||
# core処理を実行 | ||
function entity:damage/apply/core/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#> entity:damage/apply/physical | ||
# 設定された物理ダメージを実行者に与える | ||
|
||
# このダメージについての指定 | ||
data modify storage entity:_ damage set value {type:"entity:physical"} | ||
data modify storage entity:_ damage.value set from storage entity: damage.physical | ||
|
||
# core処理を実行 | ||
function entity:damage/apply/core/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#> entity:damage/apply/unreasonable | ||
# 設定された理外ダメージを実行者に与える | ||
|
||
# このダメージについての指定 | ||
data modify storage entity:_ damage set value {type:"entity:unreasonable"} | ||
data modify storage entity:_ damage.value set from storage entity: damage.unreasonable | ||
|
||
# core処理を実行 | ||
function entity:damage/apply/core/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"condition": "any_of", | ||
"terms": [ | ||
{ | ||
"condition": "entity_properties", | ||
"entity": "this", | ||
"predicate": { | ||
"nbt": "{Health:0f}" | ||
} | ||
}, | ||
{ | ||
"condition": "entity_properties", | ||
"entity": "this", | ||
"predicate": { | ||
"nbt": "{Tags:[Garbage]}" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"values": [ | ||
"tusb:unreasonable", | ||
"tusb:magic", | ||
"tusb:physics" | ||
"entity:physical", | ||
"entity:magic", | ||
"entity:unreasonable" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"values": [ | ||
"tusb:unreasonable", | ||
"tusb:magic", | ||
"tusb:physics" | ||
"entity:physical", | ||
"entity:magic", | ||
"entity:unreasonable" | ||
] | ||
} | ||
} |