Skip to content

✨ HealAPIで超過回復量・回復前の体力を取得できるように#2174

Open
Lapis-LJA wants to merge 15 commits into
masterfrom
dev/lapis_heal_api_over_heal
Open

✨ HealAPIで超過回復量・回復前の体力を取得できるように#2174
Lapis-LJA wants to merge 15 commits into
masterfrom
dev/lapis_heal_api_over_heal

Conversation

@Lapis-LJA
Copy link
Copy Markdown
Contributor

Fix #1681
因みにこれマージすると回復量取得する神器が壊れるので破壊的変更でもある

@Lapis-LJA Lapis-LJA changed the title ✨ HealAPIで超過回復量を取得できるように ✨ HealAPIで超過回復量・回復前の体力を取得できるように Jan 28, 2026
Copy link
Copy Markdown
Member

@haiiro2gou haiiro2gou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

隕石を落とさなくても済むような手があるんじゃなかろうかという気持ちがあったりなかったり

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MUST: 焼こう

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

HealAPI のヒールイベントで「超過回復量(OverHeal)」と「回復前の体力(PreviousHealth)」を取得できるようにし、神器トリガー側でも最大値を扱えるようにする変更です。イベントのデータ構造が Amount/Base/Over 等に再編されており、PR説明の通り破壊的変更を含みます。

Changes:

  • 超過回復量を算出する calc_over_heal を追加し、ReceiveHeal/Heal イベントへ OverPreviousHealth を格納
  • 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HealAPIで超過回復数値を取得できるようにする

3 participants