Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions data/entity/function/damage/apply/core/.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
@@ -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 _ _ += _ _
16 changes: 16 additions & 0 deletions data/entity/function/damage/apply/magic.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -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/

Expand Down
3 changes: 3 additions & 0 deletions data/entity/function/damage/apply/physical.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -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/

Expand Down
3 changes: 3 additions & 0 deletions data/entity/function/damage/apply/unreasonable.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -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/

Expand Down
5 changes: 5 additions & 0 deletions data/entity/tags/damage_type/magic.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"values": [
"entity:magic"
]
}
5 changes: 5 additions & 0 deletions data/entity/tags/damage_type/physical.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"values": [
"entity:physical"
]
}
5 changes: 5 additions & 0 deletions data/entity/tags/damage_type/unreasonable.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"values": [
"entity:unreasonable"
]
}
6 changes: 3 additions & 3 deletions data/minecraft/tags/damage_type/bypasses_armor.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"values": [
"tusb:unreasonable",
"tusb:magic"
"#entity:magic",
"#entity:unreasonable"
]
}
}
6 changes: 3 additions & 3 deletions data/minecraft/tags/damage_type/bypasses_cooldown.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"values": [
"entity:physical",
"entity:magic",
"entity:unreasonable"
"#entity:physical",
"#entity:magic",
"#entity:unreasonable"
]
}
5 changes: 3 additions & 2 deletions data/minecraft/tags/damage_type/bypasses_effects.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"values": [
"tusb:unreasonable"
"#entity:magic",
"#entity:unreasonable"
]
}
}
5 changes: 3 additions & 2 deletions data/minecraft/tags/damage_type/bypasses_enchantments.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"values": [
"tusb:unreasonable"
"#entity:magic",
"#entity:unreasonable"
]
}
}

This file was deleted.

5 changes: 3 additions & 2 deletions data/minecraft/tags/damage_type/bypasses_resistance.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"values": [
"tusb:unreasonable"
"#entity:magic",
"#entity:unreasonable"
]
}
}
4 changes: 2 additions & 2 deletions data/minecraft/tags/damage_type/bypasses_shield.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"values": [
"tusb:unreasonable"
"#entity:unreasonable"
]
}
}
6 changes: 3 additions & 3 deletions data/minecraft/tags/damage_type/no_knockback.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"values": [
"entity:physical",
"entity:magic",
"entity:unreasonable"
"#entity:physical",
"#entity:magic",
"#entity:unreasonable"
]
}