Skip to content

Commit 19fe581

Browse files
committed
全ての最大体力取得処理をattributeから直接取得するように
1 parent 26ca41a commit 19fe581

11 files changed

Lines changed: 21 additions & 40 deletions

File tree

TheSkyBlessing/data/api/functions/entity/player/get_health_per.mcfunction

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
execute store result score $Health Temporary run data get storage api: Health 10000
1616

1717
# 最大体力を取得
18-
function api:modifier/max_health/get
19-
execute store result score $MaxHealth Temporary run data get storage api: Return.MaxHealth 10
18+
execute store result score $MaxHealth Temporary run attribute @s generic.max_health get 10
2019

2120
# 計算結果を api: Return.HealthPer
2221
execute store result storage api: Return.HealthPer double 0.001 run scoreboard players operation $Health Temporary /= $MaxHealth Temporary

TheSkyBlessing/data/asset_manager/functions/artifact/create/set_lore/modifier/.mcfunction

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@
5151
execute if data storage asset:artifact Modifier{Type:"receive_heal"} run data modify storage asset:artifact Line[1] set value '"被回復量"'
5252
execute if data storage asset:artifact Modifier{Type:"mp_regen"} run scoreboard players set $CustomModifier Temporary 1
5353
execute if data storage asset:artifact Modifier{Type:"mp_regen"} run data modify storage asset:artifact Line[1] set value '"MP回復量"'
54-
execute if data storage asset:artifact Modifier{Type:"max_health"} run scoreboard players set $CustomModifier Temporary 1
55-
execute if data storage asset:artifact Modifier{Type:"max_health"} run data modify storage asset:artifact Line[1] set value '"最大体力"'
5654
execute if data storage asset:artifact Modifier{Type:"max_mp"} run scoreboard players set $CustomModifier Temporary 1
5755
execute if data storage asset:artifact Modifier{Type:"max_mp"} run data modify storage asset:artifact Line[1] set value '"最大MP"'
5856
execute if score $CustomModifier Temporary matches 0 run function asset_manager:artifact/create/set_lore/modifier/generic.m with storage asset:artifact Modifier

TheSkyBlessing/data/core/functions/handler/respawn.mcfunction

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
# 最大体力 attribute を復元させる
1212
scoreboard players set @s STMHBackup 200000
1313
# 体力を最大体力の 50% まで回復させる
14-
function api:modifier/max_health/get
15-
execute store result score $Set Lib run data get storage api: Return.MaxHealth 100
14+
execute store result score $Set Lib run attribute @s generic.max_health get 100
1615
function lib:score_to_health_wrapper/set
1716
# リスポーン時の満腹度調整
1817
function player_manager:adjust_hunger/respawn
Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
#> debug:modify_health/add.m
22
# @input args
3-
# Amount: int
3+
# Amount: float
44
# @private
55
# @user
66

77
function debug:modify_health/remove
88

9-
data modify storage api: Argument.UUID set value [I; -1,0,0,0]
10-
$data modify storage api: Argument.Amount set value $(Amount)
11-
data modify storage api: Argument.Operation set value "add"
12-
13-
function api:modifier/max_health/add
9+
$attribute @s generic.max_health modifier add ffffffff-0000-0000-0000-000000000000 "DebugModifyHealth" $(Amount) add

TheSkyBlessing/data/debug/functions/modify_health/remove.mcfunction

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@
22
# @within function debug:modify_health/add.m
33
# @user
44

5-
data modify storage api: Argument.UUID set value [I; -1,0,0,0]
6-
function api:modifier/max_health/remove
5+
attribute @s generic.max_health modifier remove ffffffff-0000-0000-0000-000000000000

TheSkyBlessing/data/lib/functions/score_to_health_wrapper/proc.mcfunction

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
execute unless score @s ScoreToHealth matches -2147483648..2147483647 run function api:data_get/health
1111
execute unless score @s ScoreToHealth matches -2147483648..2147483647 store result score @s ScoreToHealth run data get storage api: Health 100
1212
# 最大体力を定義
13-
function api:modifier/max_health/get
14-
execute store result score $MaxHealth Temporary run data get storage api: Return.MaxHealth 100
13+
execute store result score $MaxHealth Temporary run attribute @s generic.max_health get 100
1514
# 体力>=1 & 差分<=-1: ダメージ演出
1615
execute if score @s ScoreToHPFluc matches ..-1 if score @s ScoreToHealth matches 1.. if data storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].DamageVfx{_:true} run summon area_effect_cloud ~ ~ ~ {Duration:6,Age:4,effects:[{id:"unluck",amplifier:127b,duration:1,show_particles:0b},{id:"resistance",amplifier:127b,duration:1,show_particles:0b},{id:"instant_damage",amplifier:0b,duration:1,show_particles:0b}]}
1716
# ダメージの場合は金ハートを消費する

TheSkyBlessing/data/mob_manager/functions/processing_tag/common_tag/anti_void_action/damage.mcfunction

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,12 @@
44
#
55
# @within function mob_manager:processing_tag/common_tag/anti_void_action/
66

7-
# 最大体力を取得
8-
function api:modifier/max_health/get
9-
107
# 引数設定 - ダメージ
11-
execute if entity @s[distance=..5] store result storage api: Argument.Damage float 0.020 run data get storage api: Return.MaxHealth 10
12-
execute if entity @s[distance=..4] store result storage api: Argument.Damage float 0.035 run data get storage api: Return.MaxHealth 10
13-
execute if entity @s[distance=..3] store result storage api: Argument.Damage float 0.050 run data get storage api: Return.MaxHealth 10
14-
execute if entity @s[distance=..2] store result storage api: Argument.Damage float 0.065 run data get storage api: Return.MaxHealth 10
15-
execute if entity @s[distance=..1] store result storage api: Argument.Damage float 0.080 run data get storage api: Return.MaxHealth 10
8+
execute if entity @s[distance=..5] store result storage api: Argument.Damage float 0.020 run attribute @s generic.max_health get 10
9+
execute if entity @s[distance=..4] store result storage api: Argument.Damage float 0.035 run attribute @s generic.max_health get 10
10+
execute if entity @s[distance=..3] store result storage api: Argument.Damage float 0.050 run attribute @s generic.max_health get 10
11+
execute if entity @s[distance=..2] store result storage api: Argument.Damage float 0.065 run attribute @s generic.max_health get 10
12+
execute if entity @s[distance=..1] store result storage api: Argument.Damage float 0.080 run attribute @s generic.max_health get 10
1613
# 引数設定 - その他
1714
data modify storage api: Argument.AttackType set value "Physical"
1815
data modify storage api: Argument.ElementType set value "None"

TheSkyBlessing/data/player_manager/functions/fall_damage/deal_damage/get_vars.mcfunction

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
#declare score_holder $YVec
1010

1111
# 最大体力取得
12-
function api:modifier/max_health/get
13-
execute store result score $MaxHealth Temporary run data get storage api: Return.MaxHealth 100
12+
execute store result score $MaxHealth Temporary run attribute @s generic.max_health get 100
1413

1514
# 1tick前のFallDistance取得
1615
execute store result score $FallDistance Temporary run scoreboard players get @s OldFallDistance

TheSkyBlessing/data/player_manager/functions/health/regen/do.mcfunction

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,17 @@
1919
function api:data_get/food_level
2020
execute store result score $FoodLevel Temporary run data get storage api: foodLevel
2121

22-
# 最大体力を取得
23-
function api:modifier/max_health/get
24-
2522
# 回復する
2623
# 戦闘時かつ満腹度が6以下なら回復しない
2724
# 戦闘時
28-
execute if predicate lib:in_battle if score $FoodLevel Temporary matches 20 store result storage api: Argument.Fluctuation double 0.0025 run data get storage api: Return.MaxHealth 10
29-
execute if predicate lib:in_battle if score $FoodLevel Temporary matches 18..19 store result storage api: Argument.Fluctuation double 0.002 run data get storage api: Return.MaxHealth 10
30-
execute if predicate lib:in_battle if score $FoodLevel Temporary matches 7..17 store result storage api: Argument.Fluctuation double 0.0005 run data get storage api: Return.MaxHealth 10
25+
execute if predicate lib:in_battle if score $FoodLevel Temporary matches 20 store result storage api: Argument.Fluctuation double 0.0025 run attribute @s generic.max_health get 10
26+
execute if predicate lib:in_battle if score $FoodLevel Temporary matches 18..19 store result storage api: Argument.Fluctuation double 0.002 run attribute @s generic.max_health get 10
27+
execute if predicate lib:in_battle if score $FoodLevel Temporary matches 7..17 store result storage api: Argument.Fluctuation double 0.0005 run attribute @s generic.max_health get 10
3128
# 非戦闘時
32-
execute unless predicate lib:in_battle if score $FoodLevel Temporary matches 20 store result storage api: Argument.Fluctuation double 0.004 run data get storage api: Return.MaxHealth 10
33-
execute unless predicate lib:in_battle if score $FoodLevel Temporary matches 18..19 store result storage api: Argument.Fluctuation double 0.003 run data get storage api: Return.MaxHealth 10
34-
execute unless predicate lib:in_battle if score $FoodLevel Temporary matches 7..17 store result storage api: Argument.Fluctuation double 0.0015 run data get storage api: Return.MaxHealth 10
35-
execute unless predicate lib:in_battle if score $FoodLevel Temporary matches ..6 store result storage api: Argument.Fluctuation double 0.0005 run data get storage api: Return.MaxHealth 10
29+
execute unless predicate lib:in_battle if score $FoodLevel Temporary matches 20 store result storage api: Argument.Fluctuation double 0.004 run attribute @s generic.max_health get 10
30+
execute unless predicate lib:in_battle if score $FoodLevel Temporary matches 18..19 store result storage api: Argument.Fluctuation double 0.003 run attribute @s generic.max_health get 10
31+
execute unless predicate lib:in_battle if score $FoodLevel Temporary matches 7..17 store result storage api: Argument.Fluctuation double 0.0015 run attribute @s generic.max_health get 10
32+
execute unless predicate lib:in_battle if score $FoodLevel Temporary matches ..6 store result storage api: Argument.Fluctuation double 0.0005 run attribute @s generic.max_health get 10
3633
execute if data storage api: Argument.Fluctuation run data modify storage api: Argument.DisableLog set value true
3734
execute if data storage api: Argument.Fluctuation run function lib:score_to_health_wrapper/fluctuation
3835

TheSkyBlessing/data/player_manager/functions/set_team_and_per_health.mcfunction

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
scoreboard players operation $Health Temporary = @s Health
1414
scoreboard players operation $Health Temporary *= $1000 Const
1515
# 最大体力取得
16-
function api:modifier/max_health/get
17-
execute store result score $MaxHealth Temporary run data get storage api: Return.MaxHealth 10
16+
execute store result score $MaxHealth Temporary run attribute @s generic.max_health get 10
1817
# 割合を計算する
1918
scoreboard players operation $Health Temporary /= $MaxHealth Temporary
2019
# 割合をもとにチーム振り分け

0 commit comments

Comments
 (0)