✨ HealAPIで超過回復量・回復前の体力を取得できるように#2174
Open
Lapis-LJA wants to merge 15 commits into
Open
Conversation
haiiro2gou
requested changes
May 20, 2026
Member
haiiro2gou
left a comment
There was a problem hiding this comment.
隕石を落とさなくても済むような手があるんじゃなかろうかという気持ちがあったりなかったり
Comment on lines
+7
to
+13
| # 体力割合が99.9%以上なら、体力を100%として扱ってreturn | ||
| # ダメだったらレビューで弾いてくれ~ | ||
| function api:entity/player/get_health_per | ||
| execute store result score $HealthPer Temporary run data get storage api: Return.HealthPer 1000 | ||
| execute if score $HealthPer Temporary matches 999.. store result score $OverHeal Temporary run data get storage api: Argument.Fluctuation 100 | ||
| execute if score $HealthPer Temporary matches 999.. run return run scoreboard players reset $HealthPer Temporary | ||
|
|
Contributor
There was a problem hiding this comment.
Pull request overview
HealAPI のヒールイベントで「超過回復量(OverHeal)」と「回復前の体力(PreviousHealth)」を取得できるようにし、神器トリガー側でも最大値を扱えるようにする変更です。イベントのデータ構造が Amount/Base/Over 等に再編されており、PR説明の通り破壊的変更を含みます。
Changes:
- 超過回復量を算出する
calc_over_healを追加し、ReceiveHeal/Heal イベントへOverとPreviousHealthを格納 - Healer 側イベントの Amounts を
Base/Overに分離し、push ロジックをfrom_healer/配下へ分割 - 神器トリガー側で最大ヒール量/最大オーバーヒール量を計算して
Heal.Amount.Base/Heal.Amount.Overに格納
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| TheSkyBlessing/data/asset_manager/functions/artifact/triggers/heal/foreach.mcfunction | 神器トリガーの Heal コンテキストを Base/Over 前提に更新し、それぞれの最大値を計算 |
| TheSkyBlessing/data/api/functions/heal/core/push_heal_events/.mcfunction | ReceiveHeal イベントに Base/Over/PreviousHealth を追加し、Healer 側 push を別関数へ委譲 |
| TheSkyBlessing/data/api/functions/heal/core/push_heal_events/from_healer/push.mcfunction | Healer 側 Heal イベントへ Base/Over/PreviousHealth を配列で追加するよう拡張 |
| TheSkyBlessing/data/api/functions/heal/core/push_heal_events/from_healer/.mcfunction | 「回復した側」へイベントを push するディスパッチ関数を新設 |
| TheSkyBlessing/data/api/functions/heal/core/push_heal_events/calc_over_heal.mcfunction | 超過回復量の計算処理を新規追加 |
| TheSkyBlessing/data/api/functions/heal/_index.d.mcfunction | 超過回復計算で使うスコアホルダーを宣言に追加 |
Comments suppressed due to low confidence (1)
TheSkyBlessing/data/api/functions/heal/core/push_heal_events/from_healer/push.mcfunction:24
- Healer 側イベントの
Amounts.Base[-1]がset from storage api: Argument.Fluctuationなので、小数4桁の値が入り得ますが、max 計算側(lib:array/math/max)は scale 100 で2桁丸めで比較するため、Heal.Amount.Base(最大値)とHeal.Amounts.Baseの最大要素が一致しないことがあります。Base の格納精度/型を Over と同様に 0.01 に揃えるなど、集計と生データのスケールを一致させてください。
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+7
to
+12
| # 体力割合が99.9%以上なら、体力を100%として扱ってreturn | ||
| # ダメだったらレビューで弾いてくれ~ | ||
| function api:entity/player/get_health_per | ||
| execute store result score $HealthPer Temporary run data get storage api: Return.HealthPer 1000 | ||
| execute if score $HealthPer Temporary matches 999.. store result score $OverHeal Temporary run data get storage api: Argument.Fluctuation 100 | ||
| execute if score $HealthPer Temporary matches 999.. run return run scoreboard players reset $HealthPer Temporary |
Comment on lines
+7
to
+8
| # 体力割合が99.9%以上なら、体力を100%として扱ってreturn | ||
| # ダメだったらレビューで弾いてくれ~ |
Comment on lines
15
to
+18
| data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].ArtifactEvents.ReceiveHeal append value {} | ||
| execute store result storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].ArtifactEvents.ReceiveHeal[-1].Amount double 0.01 run data get storage api: Argument.Fluctuation 100 | ||
| data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].ArtifactEvents.ReceiveHeal[-1].Amount.Base set from storage api: Argument.Fluctuation | ||
| execute store result storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].ArtifactEvents.ReceiveHeal[-1].Amount.Over float 0.01 run scoreboard players get $OverHeal Temporary | ||
| data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].ArtifactEvents.ReceiveHeal[-1].PreviousHealth set from storage api: Health |
Comment on lines
+9
to
+12
| function api:entity/player/get_health_per | ||
| execute store result score $HealthPer Temporary run data get storage api: Return.HealthPer 1000 | ||
| execute if score $HealthPer Temporary matches 999.. store result score $OverHeal Temporary run data get storage api: Argument.Fluctuation 100 | ||
| execute if score $HealthPer Temporary matches 999.. run return run scoreboard players reset $HealthPer Temporary |
Comment on lines
+10
to
+11
| # 現在体力を回復前の体力用に取得 | ||
| function api:data_get/health |
| data modify storage lib: Array set from storage asset:context Heal.Amounts.Base | ||
| function lib:array/math/max | ||
| data modify storage asset:context Heal.Amount set from storage lib: MaxResult | ||
| data modify storage asset:context Heal.Amount.Base set from storage lib: MaxResult |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix #1681
因みにこれマージすると回復量取得する神器が壊れるので破壊的変更でもある