diff --git a/data/entity/function/damage/add/physical/melee.mcfunction b/data/entity/function/damage/add/physical/melee.mcfunction new file mode 100644 index 0000000000..a3e2d0bc94 --- /dev/null +++ b/data/entity/function/damage/add/physical/melee.mcfunction @@ -0,0 +1,4 @@ +#> entity:damage/add/physical/melee +### 与えた武器ダメージを取得 +execute store result score _ Damage run data get entity @e[tag=Enemy,nbt=!{AbsorptionAmount:2048f},limit=1] AbsorptionAmount -1 +execute store result storage entity: damage.physical int 1 run scoreboard players add _ Damage 2048 diff --git a/data/entity/function/damage/add/physical/projectile.mcfunction b/data/entity/function/damage/add/physical/projectile.mcfunction new file mode 100644 index 0000000000..e5a0118947 --- /dev/null +++ b/data/entity/function/damage/add/physical/projectile.mcfunction @@ -0,0 +1,22 @@ +#> entity:damage/add/physical/projectile +### 投射物の物理ダメージを計算・付与 +#Add +data modify storage calc: List set value [] +data modify storage calc: List append from storage item: Equipments[].components."minecraft:attribute_modifiers".modifiers[{type:"minecraft:generic.attack_damage",operation:"add_value"}].amount +execute store result score _ Damage run function calc:list/sum/x1 +#Increase +data modify storage calc: List set value [] +data modify storage calc: List append from storage item: Equipments[].components."minecraft:attribute_modifiers".modifiers[{type:"minecraft:generic.attack_damage",operation:"add_multiplied_base"}].amount +execute store result score _ Calc run function calc:list/sum/x100 +scoreboard players add _ Calc 100 +#More +data modify storage calc: List set value [] +data modify storage calc: List append from storage item: Equipments[].components."minecraft:attribute_modifiers".modifiers[{type:"minecraft:generic.attack_damage",operation:"add_multiplied_total"}].amount +execute store result score _ _ run function calc:list/product/x100 +scoreboard players add _ _ 100 +#合計 +scoreboard players operation _ Damage *= _ _ +scoreboard players set _ _ 100 +scoreboard players operation _ Damage /= _ _ +scoreboard players operation _ Damage *= _ Calc +execute store result storage entity: damage.physical int 1 run scoreboard players operation _ Damage /= _ _ diff --git a/data/player/advancement/trigger/hurt_entity.json b/data/player/advancement/trigger/hurt_entity.json new file mode 100644 index 0000000000..d9dcacd5c3 --- /dev/null +++ b/data/player/advancement/trigger/hurt_entity.json @@ -0,0 +1,287 @@ +{ + "criteria": { + "hit_projectile": { + "trigger": "minecraft:player_hurt_entity", + "conditions": { + "damage": { + "type": { + "tags": [ + { + "id": "minecraft:is_projectile", + "expected": true + } + ] + } + } + } + }, + "melee_attack": { + "trigger": "minecraft:player_hurt_entity", + "conditions": { + "player": [ + { + "condition": "minecraft:inverted", + "term": { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "equipment": { + "mainhand": { + "items": "#item:bows" + } + } + } + } + } + ], + "damage": { + "dealt": { + "min": 2 + }, + "type": { + "tags": [ + { + "id": "minecraft:is_explosion", + "expected": false + }, + { + "id": "minecraft:is_fire", + "expected": false + }, + { + "id": "minecraft:is_projectile", + "expected": false + }, + { + "id": "minecraft:bypasses_armor", + "expected": false + }, + { + "id": "minecraft:bypasses_effects", + "expected": false + }, + { + "id": "minecraft:bypasses_enchantments", + "expected": false + }, + { + "id": "minecraft:bypasses_resistance", + "expected": false + }, + { + "id": "player:thorns", + "expected": false + } + ] + } + } + } + }, + "melee_attack2": { + "trigger": "minecraft:player_hurt_entity", + "conditions": { + "player": [ + { + "condition": "minecraft:inverted", + "term": { + "condition": "minecraft:any_of", + "terms": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "equipment": { + "mainhand": { + "items": "#item:bows" + } + } + } + }, + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "equipment": { + "mainhand": { + "items": "#item:swords" + } + } + } + } + ] + } + } + ], + "damage": { + "dealt": { + "max": 1 + }, + "type": { + "tags": [ + { + "id": "minecraft:is_explosion", + "expected": false + }, + { + "id": "minecraft:is_fire", + "expected": false + }, + { + "id": "minecraft:is_projectile", + "expected": false + }, + { + "id": "minecraft:bypasses_armor", + "expected": false + }, + { + "id": "minecraft:bypasses_effects", + "expected": false + }, + { + "id": "minecraft:bypasses_enchantments", + "expected": false + }, + { + "id": "minecraft:bypasses_resistance", + "expected": false + }, + { + "id": "player:thorns", + "expected": false + } + ] + } + } + } + }, + "melee_bow_attack": { + "trigger": "minecraft:player_hurt_entity", + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "equipment": { + "mainhand": { + "items": "#item:bows" + } + } + } + } + ], + "damage": { + "dealt": { + "min": 2 + }, + "type": { + "tags": [ + { + "id": "minecraft:is_explosion", + "expected": false + }, + { + "id": "minecraft:is_fire", + "expected": false + }, + { + "id": "minecraft:is_projectile", + "expected": false + }, + { + "id": "minecraft:bypasses_armor", + "expected": false + }, + { + "id": "minecraft:bypasses_effects", + "expected": false + }, + { + "id": "minecraft:bypasses_enchantments", + "expected": false + }, + { + "id": "minecraft:bypasses_resistance", + "expected": false + }, + { + "id": "player:thorns", + "expected": false + } + ] + } + } + } + }, + "sword_attack_sweep": { + "trigger": "minecraft:player_hurt_entity", + "conditions": { + "player": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "equipment": { + "mainhand": { + "items": "#item:swords" + } + } + } + } + ], + "damage": { + "dealt": 1, + "type": { + "tags": [ + { + "id": "minecraft:is_explosion", + "expected": false + }, + { + "id": "minecraft:is_fire", + "expected": false + }, + { + "id": "minecraft:is_projectile", + "expected": false + }, + { + "id": "minecraft:bypasses_armor", + "expected": false + }, + { + "id": "minecraft:bypasses_effects", + "expected": false + }, + { + "id": "minecraft:bypasses_enchantments", + "expected": false + }, + { + "id": "minecraft:bypasses_resistance", + "expected": false + }, + { + "id": "player:thorns", + "expected": false + } + ] + } + } + } + } + }, + "requirements": [ + [ + "hit_projectile", + "melee_attack", + "melee_attack2", + "melee_bow_attack", + "sword_attack_sweep" + ] + ], + "rewards": { + "function": "player:trigger/hurt_entity/" + } +} diff --git a/data/player/function/trigger/hurt_entity/.mcfunction b/data/player/function/trigger/hurt_entity/.mcfunction new file mode 100644 index 0000000000..6bd097e4bd --- /dev/null +++ b/data/player/function/trigger/hurt_entity/.mcfunction @@ -0,0 +1,20 @@ +#> player:trigger/hurt_entity/ +### モブへのダメージトリガー + +#モブの位置をマーク +execute at @e[tag=Enemy,nbt=!{AbsorptionAmount:2048f}] run function calc:geometry/tp_00002 +#分岐 +execute if entity @s[advancements={player:trigger/hurt_entity={hit_projectile=true}}] run function player:trigger/hurt_entity/hit_projectile +execute if entity @s[advancements={player:trigger/hurt_entity={melee_attack=true}}] run function player:trigger/hurt_entity/melee_attack +execute if entity @s[advancements={player:trigger/hurt_entity={melee_attack2=true}}] run function player:trigger/hurt_entity/melee_attack +execute if entity @s[advancements={player:trigger/hurt_entity={melee_bow_attack=true}}] run function player:trigger/hurt_entity/melee_bow_attack +execute if entity @s[advancements={player:trigger/hurt_entity={sword_attack_sweep=true}}] run function player:trigger/hurt_entity/sword_attack_sweep + +##AbsorptionAmountリセット +execute at 0-0-0-0-2 as @e[tag=Enemy,nbt=!{AbsorptionAmount:2048f},distance=0] run function enemy:damage/update_health + +#トリガーリセット +advancement revoke @s only player:trigger/hurt_entity + +#マーカー返却 +execute as 0-0-0-0-2 run function calc:geometry/return_marker diff --git a/data/player/function/trigger/hurt_entity/hit_projectile.mcfunction b/data/player/function/trigger/hurt_entity/hit_projectile.mcfunction new file mode 100644 index 0000000000..8b9352bbf1 --- /dev/null +++ b/data/player/function/trigger/hurt_entity/hit_projectile.mcfunction @@ -0,0 +1,12 @@ +#> player:trigger/hurt_entity/hit_projectile +### 投射物による攻撃 + +#投射物からロード +execute at 0-0-0-0-2 as @e[type=#entity:projectiles,limit=1,sort=nearest] run function player:trigger/projectile/load + +#物理ダメージ付与 +data modify storage entity: damage.hit set value 1b +execute at 0-0-0-0-2 as @e[tag=Enemy,nbt=!{AbsorptionAmount:2048f},distance=0] run function entity:damage/apply/physical + +#狩人バースト用フラグ +tag @s add BurstArrow diff --git a/data/player/function/trigger/hurt_entity/melee_attack.mcfunction b/data/player/function/trigger/hurt_entity/melee_attack.mcfunction new file mode 100644 index 0000000000..61ab36a6d5 --- /dev/null +++ b/data/player/function/trigger/hurt_entity/melee_attack.mcfunction @@ -0,0 +1,24 @@ +#> player:trigger/hurt_entity/melee_attack +### 近接攻撃 + +#装備を取得 +function player:load_equipments +#物理ダメージ取得 +data remove storage entity: damage +function entity:damage/add/physical/melee +### 黒魔導士<ライトニングブロー> +# execute if score @s LightningBlow matches 1.. run function skill:act/black_mage/lightning_blow/hit + +#スキル用装備リスト +function skill:equipments_to_items +data remove storage item: Item +data modify storage item: Item set from storage item: Items[{components:{"minecraft:custom_data":{Skill:{Trigger:"近接攻撃する"}}}}] + +### 忍者<連舞> +# execute if score @s TsuremaiLevel matches 1.. run function skill:act/ninja/tsuremai/trigger/attack + +#近接スキルの場合、物理ダメージはスキル側で計算するため0にする +execute if data storage item: Item.components."minecraft:custom_data".Skill.Damage{Melee:1b} at 0-0-0-0-2 run data modify entity @e[tag=Enemy,nbt=!{AbsorptionAmount:2048f},distance=0,limit=1] AbsorptionAmount set value 2048f + +### スキル +execute if data storage item: Item.components."minecraft:custom_data".Skill{Trigger:"近接攻撃する"} run function skill:practice/ diff --git a/data/player/function/trigger/hurt_entity/melee_bow_attack.mcfunction b/data/player/function/trigger/hurt_entity/melee_bow_attack.mcfunction new file mode 100644 index 0000000000..79c3f33852 --- /dev/null +++ b/data/player/function/trigger/hurt_entity/melee_bow_attack.mcfunction @@ -0,0 +1,5 @@ +#> player:trigger/hurt_entity/melee_bow_attack +### 弓による近接攻撃 + +#ダメージを1にする +execute at 0-0-0-0-2 run data modify entity @e[tag=Enemy,nbt=!{AbsorptionAmount:2048f},distance=0,limit=1] AbsorptionAmount set value 2047f diff --git a/data/player/function/trigger/hurt_entity/sword_attack_sweep.mcfunction b/data/player/function/trigger/hurt_entity/sword_attack_sweep.mcfunction new file mode 100644 index 0000000000..72a143a710 --- /dev/null +++ b/data/player/function/trigger/hurt_entity/sword_attack_sweep.mcfunction @@ -0,0 +1,2 @@ +#> player:trigger/hurt_entity/sword_attack_sweep +### 剣の薙ぎ払い攻撃 diff --git a/data/player/function/trigger/projectile/load.mcfunction b/data/player/function/trigger/projectile/load.mcfunction index ae9df35447..2d8ffac9ed 100644 --- a/data/player/function/trigger/projectile/load.mcfunction +++ b/data/player/function/trigger/projectile/load.mcfunction @@ -5,7 +5,7 @@ data modify storage item: SelectedItem set from storage oh_my_dat: _[-4][-4][-4] data modify storage item: Equipments set from storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].Equipments #ダメージをロード -function skill:damage/load +function entity:damage/load ### スキル execute if entity @s[tag=Skill] run function player:trigger/projectile/skill diff --git a/data/player/function/trigger/projectile/save.mcfunction b/data/player/function/trigger/projectile/save.mcfunction index 7ab1306c38..4ee67f12bf 100644 --- a/data/player/function/trigger/projectile/save.mcfunction +++ b/data/player/function/trigger/projectile/save.mcfunction @@ -5,4 +5,4 @@ data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].SelectedItem se data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].Equipments set from storage item: Equipments #ダメージを保存 -function skill:damage/save +function entity:damage/save diff --git a/data/player/function/trigger/use/bow.mcfunction b/data/player/function/trigger/use/bow.mcfunction index 1c2ccf4e5c..bcfb6d0deb 100644 --- a/data/player/function/trigger/use/bow.mcfunction +++ b/data/player/function/trigger/use/bow.mcfunction @@ -4,11 +4,10 @@ function player:load_equipments #メインハンドがトリガーのアイテムでなければ交換 execute unless data storage item: SelectedItem{id:"minecraft:bow"} run function player:trigger/use/if_not_mainhand #物理ダメージ取得 -function skill:damage/add/physical/projectile -#属性ダメージ取得 -function skill:damage/add/elemental +data remove storage entity: damage +function entity:damage/add/physical/projectile #ピアッシングエイム適用 -execute if score @s PiercingAim matches 1.. run function skill:act/hunter/piercing_aim/apply0 +# execute if score @s PiercingAim matches 1.. run function skill:act/hunter/piercing_aim/apply0 #スキル function skill:equipments_to_items data remove storage item: Item diff --git a/data/player/function/trigger/use/crossbow.mcfunction b/data/player/function/trigger/use/crossbow.mcfunction index 75beee32fc..1474e5701f 100644 --- a/data/player/function/trigger/use/crossbow.mcfunction +++ b/data/player/function/trigger/use/crossbow.mcfunction @@ -4,11 +4,10 @@ function player:load_equipments #メインハンドがトリガーのアイテムでなければ交換 execute unless data storage item: SelectedItem{id:"minecraft:crossbow"} run function player:trigger/use/if_not_mainhand #物理ダメージ取得 -function skill:damage/add/physical/projectile -#属性ダメージ取得 -function skill:damage/add/elemental +data remove storage entity: damage +function entity:damage/add/physical/projectile #ピアッシングエイム適用 -execute if score @s PiercingAim matches 1.. run function skill:act/hunter/piercing_aim/apply0 +# execute if score @s PiercingAim matches 1.. run function skill:act/hunter/piercing_aim/apply0 #スキル function skill:equipments_to_items data remove storage item: Item diff --git a/data/player/function/trigger/use/trident.mcfunction b/data/player/function/trigger/use/trident.mcfunction index 053afe9b4e..846a0d6211 100644 --- a/data/player/function/trigger/use/trident.mcfunction +++ b/data/player/function/trigger/use/trident.mcfunction @@ -4,9 +4,8 @@ function player:load_equipments #メインハンドがトリガーのアイテムでなければ交換 execute unless data storage item: SelectedItem{id:"minecraft:trident"} run function player:trigger/use/if_not_mainhand #物理ダメージ取得 -function skill:damage/add/physical/projectile -#属性ダメージ取得 -function skill:damage/add/elemental +data remove storage entity: damage +function entity:damage/add/physical/projectile ##ダメージと装備を保存 execute as @e[type=#minecraft:impact_projectiles,tag=!Initialized,distance=..2] run function player:trigger/projectile/save #トリガーリセット