diff --git a/data/entity/function/damage/apply/core/.mcfunction b/data/entity/function/damage/apply/core/.mcfunction index 0ccde728d4..ba3cd67d29 100644 --- a/data/entity/function/damage/apply/core/.mcfunction +++ b/data/entity/function/damage/apply/core/.mcfunction @@ -9,10 +9,6 @@ execute if data storage entity:_ damage{value:0d} 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 diff --git a/data/entity/function/damage/apply/core/get_magic_defense.mcfunction b/data/entity/function/damage/apply/core/get_magic_defense.mcfunction new file mode 100644 index 0000000000..86bb08042a --- /dev/null +++ b/data/entity/function/damage/apply/core/get_magic_defense.mcfunction @@ -0,0 +1,12 @@ +#> entity:damage/apply/core/get_magic_defense + +execute unless entity @s[type=player] run return run scoreboard players get @s MagicDefense + +# プレイヤーの魔法防御力はエンチャントから計算する +function player:load_equipments + +data modify storage calc: List set value [] +# data modify storage calc: List append from storage item: Equipments[].components."minecraft:enchantments".levels +execute store result score _ _ run function calc:list/sum/x1 +# 2倍にして魔法防御力とする +return run scoreboard players operation _ _ += _ _ diff --git a/data/entity/function/damage/apply/magic.mcfunction b/data/entity/function/damage/apply/magic.mcfunction index d2929d9101..6245edb919 100644 --- a/data/entity/function/damage/apply/magic.mcfunction +++ b/data/entity/function/damage/apply/magic.mcfunction @@ -5,6 +5,22 @@ data modify storage entity:_ damage set value {type:"entity:magic"} data modify storage entity:_ damage.value set from storage entity: damage.magic +# ダメージ値が割合設定ならば解決する +execute if data storage entity:_ damage.value{} run function entity:damage/apply/core/resolve_percentage_damage/ + +# 軽減率を計算 +execute store result score _ MagicDefense run function entity:damage/apply/core/get_magic_defense +# 75=軽減率調整用の数値 100倍で計算 +scoreboard players add _ MagicDefense 75 +scoreboard players set _ _ 7500 +scoreboard players operation _ _ /= _ MagicDefense + +execute store result score _ Calc run data get storage entity:_ damage.value 100 + +# Shieldの処理を入れる +# scoreboard players operation _ Calc -= @s Sheild? +execute store result storage entity:_ damage.value double 0.0001 run scoreboard players operation _ Calc *= _ _ + # core処理を実行 function entity:damage/apply/core/ diff --git a/data/entity/function/damage/apply/physical.mcfunction b/data/entity/function/damage/apply/physical.mcfunction index b63c717e2e..4176e5697f 100644 --- a/data/entity/function/damage/apply/physical.mcfunction +++ b/data/entity/function/damage/apply/physical.mcfunction @@ -5,6 +5,9 @@ data modify storage entity:_ damage set value {type:"entity:physical"} data modify storage entity:_ damage.value set from storage entity: damage.physical +# ダメージ値が割合設定ならば解決する +execute if data storage entity:_ damage.value{} run function entity:damage/apply/core/resolve_percentage_damage/ + # core処理を実行 function entity:damage/apply/core/ diff --git a/data/entity/function/damage/apply/unreasonable.mcfunction b/data/entity/function/damage/apply/unreasonable.mcfunction index f68ba92d8c..0d62e4b3ce 100644 --- a/data/entity/function/damage/apply/unreasonable.mcfunction +++ b/data/entity/function/damage/apply/unreasonable.mcfunction @@ -5,6 +5,9 @@ data modify storage entity:_ damage set value {type:"entity:unreasonable"} data modify storage entity:_ damage.value set from storage entity: damage.unreasonable +# ダメージ値が割合設定ならば解決する +execute if data storage entity:_ damage.value{} run function entity:damage/apply/core/resolve_percentage_damage/ + # core処理を実行 function entity:damage/apply/core/ diff --git a/data/entity/tags/damage_type/magic.json b/data/entity/tags/damage_type/magic.json new file mode 100644 index 0000000000..63e0d0f023 --- /dev/null +++ b/data/entity/tags/damage_type/magic.json @@ -0,0 +1,5 @@ +{ + "values": [ + "entity:magic" + ] +} diff --git a/data/entity/tags/damage_type/physical.json b/data/entity/tags/damage_type/physical.json new file mode 100644 index 0000000000..cbaebdedb5 --- /dev/null +++ b/data/entity/tags/damage_type/physical.json @@ -0,0 +1,5 @@ +{ + "values": [ + "entity:physical" + ] +} diff --git a/data/entity/tags/damage_type/unreasonable.json b/data/entity/tags/damage_type/unreasonable.json new file mode 100644 index 0000000000..23738716f6 --- /dev/null +++ b/data/entity/tags/damage_type/unreasonable.json @@ -0,0 +1,5 @@ +{ + "values": [ + "entity:unreasonable" + ] +} diff --git a/data/minecraft/tags/damage_type/bypasses_armor.json b/data/minecraft/tags/damage_type/bypasses_armor.json index 86a03f9f3c..d2c0e9c955 100644 --- a/data/minecraft/tags/damage_type/bypasses_armor.json +++ b/data/minecraft/tags/damage_type/bypasses_armor.json @@ -1,6 +1,6 @@ { "values": [ - "tusb:unreasonable", - "tusb:magic" + "#entity:magic", + "#entity:unreasonable" ] -} \ No newline at end of file +} diff --git a/data/minecraft/tags/damage_type/bypasses_cooldown.json b/data/minecraft/tags/damage_type/bypasses_cooldown.json index c1b11a642d..7ad7bad5ce 100644 --- a/data/minecraft/tags/damage_type/bypasses_cooldown.json +++ b/data/minecraft/tags/damage_type/bypasses_cooldown.json @@ -1,7 +1,7 @@ { "values": [ - "entity:physical", - "entity:magic", - "entity:unreasonable" + "#entity:physical", + "#entity:magic", + "#entity:unreasonable" ] } diff --git a/data/minecraft/tags/damage_type/bypasses_effects.json b/data/minecraft/tags/damage_type/bypasses_effects.json index f1777f1ef7..d2c0e9c955 100644 --- a/data/minecraft/tags/damage_type/bypasses_effects.json +++ b/data/minecraft/tags/damage_type/bypasses_effects.json @@ -1,5 +1,6 @@ { "values": [ - "tusb:unreasonable" + "#entity:magic", + "#entity:unreasonable" ] -} \ No newline at end of file +} diff --git a/data/minecraft/tags/damage_type/bypasses_enchantments.json b/data/minecraft/tags/damage_type/bypasses_enchantments.json index f1777f1ef7..d2c0e9c955 100644 --- a/data/minecraft/tags/damage_type/bypasses_enchantments.json +++ b/data/minecraft/tags/damage_type/bypasses_enchantments.json @@ -1,5 +1,6 @@ { "values": [ - "tusb:unreasonable" + "#entity:magic", + "#entity:unreasonable" ] -} \ No newline at end of file +} diff --git a/data/minecraft/tags/damage_type/bypasses_invulnerability.json b/data/minecraft/tags/damage_type/bypasses_invulnerability.json deleted file mode 100644 index f1777f1ef7..0000000000 --- a/data/minecraft/tags/damage_type/bypasses_invulnerability.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "tusb:unreasonable" - ] -} \ No newline at end of file diff --git a/data/minecraft/tags/damage_type/bypasses_resistance.json b/data/minecraft/tags/damage_type/bypasses_resistance.json index f1777f1ef7..d2c0e9c955 100644 --- a/data/minecraft/tags/damage_type/bypasses_resistance.json +++ b/data/minecraft/tags/damage_type/bypasses_resistance.json @@ -1,5 +1,6 @@ { "values": [ - "tusb:unreasonable" + "#entity:magic", + "#entity:unreasonable" ] -} \ No newline at end of file +} diff --git a/data/minecraft/tags/damage_type/bypasses_shield.json b/data/minecraft/tags/damage_type/bypasses_shield.json index f1777f1ef7..7eb276e06c 100644 --- a/data/minecraft/tags/damage_type/bypasses_shield.json +++ b/data/minecraft/tags/damage_type/bypasses_shield.json @@ -1,5 +1,5 @@ { "values": [ - "tusb:unreasonable" + "#entity:unreasonable" ] -} \ No newline at end of file +} diff --git a/data/minecraft/tags/damage_type/no_knockback.json b/data/minecraft/tags/damage_type/no_knockback.json index c1b11a642d..7ad7bad5ce 100644 --- a/data/minecraft/tags/damage_type/no_knockback.json +++ b/data/minecraft/tags/damage_type/no_knockback.json @@ -1,7 +1,7 @@ { "values": [ - "entity:physical", - "entity:magic", - "entity:unreasonable" + "#entity:physical", + "#entity:magic", + "#entity:unreasonable" ] }