Skip to content

🐛 HealAPIでの補正の際に計算精度の影響で回復量が低下する問題を修正#2278

Open
Lapis-LJA wants to merge 3 commits into
masterfrom
fix/lapis_heal_api_double
Open

🐛 HealAPIでの補正の際に計算精度の影響で回復量が低下する問題を修正#2278
Lapis-LJA wants to merge 3 commits into
masterfrom
fix/lapis_heal_api_double

Conversation

@Lapis-LJA

Copy link
Copy Markdown
Contributor

No description provided.

@EllaCoat EllaCoat left a comment

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.

[IMO or MUST]
from_healer/push.mcfunction L21-23 辺りにてリストが float 定義されているのでこのままだと爆発する気がする。確認しておいて。

[WANT]

  • heal/.mcfunction
  • heal/modifier.mcfunction
    辺りの @input とか @output は型が変わるんじゃないか? 確認しといてー。

[WANT]

  • heal/core/push_heal_events/.mcfunction L17 : Amount.Over float 0.01 run scoreboard players get $OverHeal Temporary
  • heal/core/push_heal_events/from_healer/push.mcfunction L24 : Amounts.Over[-1] ... float 0.01 run scoreboard players get $OverHeal Temporary

この辺りとかが float なのも、直感的にまずい気がするんだけど、どうかな?

@Lapis-LJA

Copy link
Copy Markdown
Contributor Author

説あるので直します

@Lapis-LJA Lapis-LJA requested a review from EllaCoat June 16, 2026 03:41
@@ -21,7 +21,7 @@
data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].ArtifactEvents.Heal[-1].Amounts.Base append value -1f

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.

これを見てください!
素晴らしいと思いませんか!?

要するに 1f と予め、float 型の数値が代入されている箇所もあるので見逃さないでー

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.

というか、これのせいで型不整合で代入できずに爆発する可能性が高い

execute store result storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].ArtifactEvents.Heal[-1].Amounts.Over[-1] float 0.01 run scoreboard players get $OverHeal Temporary
data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].ArtifactEvents.Heal[-1].PreviousHealth append value -1f
execute store result storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].ArtifactEvents.Heal[-1].Amounts.Over[-1] double 0.01 run scoreboard players get $OverHeal Temporary
data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].ArtifactEvents.Heal[-1].PreviousHealth append value -1d

@EllaCoat EllaCoat Jun 16, 2026

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]

  • api: Healthdata_get/health.mcfunction:13DataCache.Data.Health から set from

であるため、float 型のはず。
なのでコイツを変えてはならない。
double と float が混在するのはいささか気持ち悪いが……これ、大丈夫かなぁ。

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

そ~いやHealthはfloatか~~~
どうしよう

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.

そもそも、double にしようとした理由ってどこの計算過程でバグが発生するからなんだ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ネクターの再生エフェクトを使ってて、回復量が4.2のはずが4.1になって、キモイな~~~~となった

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.

どこでそのズレが発生しているのかを調査した方が良さそう、知らんけど

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

今のとこだけど、floatをスコアに変えるときに誤差が発生する

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.

2 participants