Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

モブへの攻撃時処理を追加 #677

Draft
wants to merge 1 commit into
base: 1-21-1-dev
Choose a base branch
from
Draft
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
287 changes: 287 additions & 0 deletions data/player/advancement/trigger/hurt_entity.json
Original file line number Diff line number Diff line change
@@ -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/"
}
}
20 changes: 20 additions & 0 deletions data/player/function/trigger/hurt_entity/.mcfunction
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#> 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 skill: Damage set value {Hit:1b}
execute at 0-0-0-0-2 as @e[tag=Enemy,nbt=!{AbsorptionAmount:2048f},distance=0] run function skill:damage/apply/

### エンチャント
#波動
execute if data storage item: SelectedItem.components."minecraft:enchantments".levels."tusb:波動" at 0-0-0-0-2 run function skill:enchant/wave_of_element/
#血吸
execute if data storage item: SelectedItem.components."minecraft:enchantments".levels."tusb:血吸" run function skill:enchant/life_leech
#魔吸
execute if data storage item: SelectedItem.components."minecraft:enchantments".levels."tusb:魔吸" run function skill:enchant/mana_leech

#狩人バースト用フラグ
tag @s add BurstArrow
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#> player:trigger/hurt_entity/melee_attack
### 近接攻撃

#装備を取得
function player:load_equipments
#物理ダメージ取得
function skill: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

#属性ダメージ付与
execute unless data storage item: Item.components."minecraft:custom_data".Skill.Damage{Melee:1b} run data modify storage skill: Damage set value {Hit:1b}
execute unless data storage item: Item.components."minecraft:custom_data".Skill.Damage{Melee:1b} at 0-0-0-0-2 as @e[tag=Enemy,nbt=!{AbsorptionAmount:2048f},distance=0] run function skill:damage/apply/elemental

### エンチャント
#波動
execute if data storage item: SelectedItem.components."minecraft:enchantments".levels."tusb:波動" at 0-0-0-0-2 run function skill:enchant/wave_of_element/
#血吸
execute if data storage item: SelectedItem.components."minecraft:enchantments".levels."tusb:血吸" run function skill:enchant/life_leech
#魔吸
execute if data storage item: SelectedItem.components."minecraft:enchantments".levels."tusb:魔吸" run function skill:enchant/mana_leech

### スキル
execute if data storage item: Item.components."minecraft:custom_data".Skill{Trigger:"近接攻撃する"} run function skill:practice/

#近接スキルの場合、物理ダメージはスキル側で計算するため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: SelectedItem.components."minecraft:enchantments".levels."tusb:剣能" run function skill:enchant/sweeping/init
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#> player:trigger/hurt_entity/sword_attack_sweep
### 剣の薙ぎ払い攻撃

### エンチャント
#剣能
execute if data storage item: SelectedItem.components."minecraft:enchantments".levels."tusb:剣能" run function skill:enchant/sweeping/apply
Loading