Ticket #37481

武器匠の命中率計算バグ

Open Date: 2017-09-01 23:27 Last Update: 2020-12-29 00:11

Reporter:
Owner:
Type:
Status:
Closed
Component:
(None)
Priority:
5 - Medium
Severity:
5 - Medium
Resolution:
Fixed
File:
None

Details

IRCにて、bldg.c のhit_chance中でchance値の5%確定計算はchance = 100 - ((ac * 75) / meichuu);中で行わないといけないという指摘を受ける。

static int hit_chance(int to_h, int ac)
{
	int chance = 0;
	int meichuu = p_ptr->skill_thn + (p_ptr->to_h[0] + to_h) * BTH_PLUS_ADJ;

	if (meichuu <= 0) return 5;

	chance = 100 - ((ac * 75) / meichuu);

	if (chance > 95) chance = 95;
	if (chance < 5) chance = 5;
	if (p_ptr->pseikaku == SEIKAKU_NAMAKE)
		chance = (chance * 19 + 9) / 20;
	return chance;
}

検証、確認の上修正する。

Ticket History (3/4 Histories)

2017-09-01 23:27 Updated by: deskull
  • New Ticket "武器匠の命中率計算バグ" created
2018-12-23 18:23 Updated by: deskull
  • Details Updated
Comment

この件、度々修正がかかっていながらよく間違えている&これから何か新要素を加える毎に別途手を加えないといけないというのは面倒すぎるのでDRYの思想にのっとって誤差がなるべく内容に統合する。

2018-12-23 19:23 Updated by: deskull
  • Status Update from Open to Closed
  • Status Update from Open to Closed
  • Status Update from Open to Closed
Comment

リファクタリングの余地そのものはまだ色々あるが、本件については解決したと見なし、チケット完了とする。

2020-12-29 00:11 Updated by: deskull

Attachment File List

No attachments

Edit

Please login to add comment to this ticket » Login