Opened 11 years ago

Closed 10 years ago

#645 closed bug (fixed (in master))

Incorrect handling of amnesia when computing spell fail rate

Reported by: anonymous Owned by:
Milestone: 3.1.1 beta Keywords:
Cc:

Description

Amnesia is supposed to make reading scrolls, activating objects and casting spells fail half of the time. For scrolls and objects, amnesia is handled correctly:

if ((rand_int(2) != 0) && p_ptr->timed[TMD_AMNESIA]) then fail

For spells, the following is used:

if (p_ptr->timed[TMD_AMNESIA]) chance *= 2;

Of course, this means that amnesia has absolutely no effect on spells with 0% fail rate, and that spells with a fail rate above 50% will always fail. The following would be more logical:

if ((rand_int(2) != 0) && p_ptr->timed[TMD_AMNESIA]) chance = 100;

Change History (6)

comment:1 follow-up: Changed 11 years ago by ChodTheWacko

I assume in the latter you meant:
if ((rand_int(2) != 0) && p_ptr->timed[TMD_AMNESIA]) chance = 0;

comment:2 in reply to: ↑ 1 Changed 11 years ago by anonymous

Replying to ChodTheWacko:

I assume in the latter you meant:
if ((rand_int(2) != 0) && p_ptr->timed[TMD_AMNESIA]) chance = 0;

No, it's 100 because the function returns the chance of failing the spell, not the chance of succeeding. And the line should be the last line of the function, since amnesia should bypass all other checks.

comment:3 Changed 10 years ago by takkaria

  • Milestone changed from 3.2.0 to 3.1.1 beta

comment:4 Changed 10 years ago by stefanor@…

Wouldn't it be even more logical to use if (p_ptr->timed[TMD_AMNESIA]) chance = 50 + chance / 2; so that the displayed failure rate is correct?

comment:5 Changed 10 years ago by magnate

If #665 is serious, this problem will go away ...

comment:6 Changed 10 years ago by takkaria

  • Resolution set to fixed
  • Status changed from new to closed

[a5cbb33] (SVN r1528)

Note: See TracTickets for help on using tickets.