Opened 11 years ago

Closed 8 years ago

#572 closed bug (fixed (in master))

Avoid unavoidable deaths

Reported by: takkaria Owned by: magnate
Milestone: 3.4.0 Keywords: magic
Cc:

Attachments (1)

1000.Chrisc (48.4 KB) - added by magnate 10 years ago.
Savefile just after reading unIDd Summon Undead scroll

Download all attachments as: .zip

Change History (28)

comment:1 Changed 10 years ago by magnate

Is this a duplicate of #792, or is there more to it than that?

comment:2 Changed 10 years ago by magnate

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

Actually #792 was the duplicate, but since it was already marked fixed ...

comment:3 Changed 10 years ago by magnate

  • Resolution duplicate deleted
  • Status changed from closed to reopened

I remembered the reason that I didn't originally mark #792 a duplicate. Although the forum thread was about arriving on new levels, this title should include the instadeath-from-summoning issue.

Currently, summoned monsters can move before the player gets a move, which can mean unavoidable death. To avoid this, all summons (by monsters, scrolls or traps) should ensure that the player has the next move, before any of the summonees move.

comment:4 Changed 10 years ago by anonymous

You mean that when a monster summons, that the other monsters might get an action too, right? I feel like those deaths are at least somewhat avoidable--you get a chance to avoid the monster, or teleport, or whatever, before it gets a chance to summon. If the monster gets an action and kills you with mana storm, it's not that different from a monster getting an action and killing you by summoning greater undead.

Or am I missing something?

comment:5 Changed 10 years ago by anonymous

To anony above:
I think I agree. On the one hand, no single attack does more than 500ish damage to someone with resistances, IIRC. If you were to enter the LOS of a master Q and it summons Pit Fiends and they act before you get another turn, then you're facing much more damage than any single mana storm or breath weapon could do. OTOH, if you're guaranteed a turn against summoned monsters it means 'Q's aren't very threatening and they're one of the few serious dangers to someone with telepathy or detect monsters.

comment:6 Changed 10 years ago by magnate

Ok, if Takkaria agrees with you two, we at least have to fix instadeath from reading unID'd summon scrolls. We're trying to encourage ID-by-use here, and instadeath somewhat discourages it.

So I'd be ok if monster and trap summons could still get a move, as long as scroll (and staff) summons didn't.

comment:7 Changed 10 years ago by d_m

  • Owner set to d_m
  • Status changed from reopened to assigned

I can probably get this working for staves and scrolls (I was the 1st anonymous poster--still getting the hang of logging into trac).

comment:8 Changed 10 years ago by d_m

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

OK, this is mostly closed in [f43c11d] (SVN r1556). Until monsters can have negative energy (or get a boolean added to types.h) we can't fully fix this, since the player often has low energy after reading a scroll and a monsters still might get the jump on him or her.

However, this is a lot better than it was before, so I'm marking it fixed. There's a comment in the source about improving it later.

Changed 10 years ago by magnate

Savefile just after reading unIDd Summon Undead scroll

comment:9 Changed 10 years ago by magnate

  • Keywords magic added
  • Milestone changed from 3.1.1 beta to 3.1.2 beta
  • Resolution fixed deleted
  • Status changed from closed to reopened

I just got biffed by two zombified orcs after reading an unIDd scroll of Summon Undead. Very keen to see a full fix to this - instead of introducing negative energy, how about we just set the player's energy to 99 at the same time as setting the summonees' energy to 0? That would be a one-line fix, unless it's not as simple as that!

comment:10 Changed 10 years ago by magnate

  • Milestone changed from 3.1.2 beta to 3.1.3

See also #1058 for more monster energy weirdness.

comment:11 Changed 10 years ago by d_m

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

The weird thing about Magnate's proposed fix is that it would mean that the player might go again before a monster that was already in the room. Consider:

Orcs are hitting player. Player reads un-ID'd scroll. Undead appear. Player gets another turn to do something else.

It seems strange to me that the orcs would lose a turn.

comment:12 Changed 10 years ago by d_m

  • Resolution fixed deleted
  • Status changed from closed to reopened

I didn't mean to close this, just to comment on it.

comment:13 follow-up: Changed 10 years ago by eddiegrove@…

I agree with d_m. What's wrong with negative energy? You want a value that, when you add 200 [or maybe 240] to it you get at most 100. It seems to me that the problem is designed for negative energy.

comment:14 in reply to: ↑ 13 ; follow-up: Changed 10 years ago by magnate

Replying to eddiegrove@…:

I agree with d_m. What's wrong with negative energy?

Nothing, if you're sure there are no places in the code where energy is assumed to be positive. I just thought it might be simpler to add (99 - p_ptr->energy) to the energy of all creatures (player + monsters) when a summonee arrives. Then you set the summonee's energy to 0 and you're guaranteed that it doesn't get to biff the player before the player gets a turn. So IDing scrolls and staves of summoning by use suddenly becomes non-lethal.

comment:15 in reply to: ↑ 14 ; follow-up: Changed 10 years ago by eddiegrove@…

I just thought it might be simpler to add (99 - p_ptr->energy) to the energy of all creatures (player + monsters) when a summonee arrives.

That is unfair to fast monsters. In the time the player would have gotten, e.g., +50 energy, a double speed monster would have gotten +100 but it only gets +50. Or vice versa for fast players.

comment:16 in reply to: ↑ 15 Changed 10 years ago by magnate

Replying to eddiegrove@…:

That is unfair to fast monsters. In the time the player would have gotten, e.g., +50 energy, a double speed monster would have gotten +100 but it only gets +50. Or vice versa for fast players.

Hmm. I see your point: the player would get a move before a faster monster, which would otherwise have moved first. I guess negative energy is a better solution. d_m: that's quite a bit of checking, so feel free to reassign the ticket to me if you don't fancy it!

comment:17 Changed 9 years ago by magnate

  • Milestone changed from 3.2.0 to 3.3.0

Punting to 3.3: non-urgent bug or change.

comment:18 Changed 9 years ago by magnate

  • Status changed from reopened to confirmed

comment:19 Changed 9 years ago by magnate

  • Keywords loadsave added

Adding keyword to ensure that this is co-ordinated with savefile changes (as monster energy will go from u8b to s16b)

comment:20 Changed 9 years ago by magnate

Perhaps we don't need to use negative energy after all. An alternative approach would be to change the effect of MFLAG_NICE. Currently this prevents monsters in certain situations from casting spells before the player has had a chance to move. It could also be coded to prevent adjacent monsters from meleeing the player.

comment:21 Changed 8 years ago by magnate

  • Keywords loadsave removed
  • Milestone changed from 3.3.0 to 3.4.0

Punting to 3.4 as agreed with d_m on IRC. Removing loadsave keyword as negative energy seems like a really bad idea. We should use MFLAG_NICE (or similar) instead.

comment:22 Changed 8 years ago by magnate

I just had a brainwave. How about making unIDd summonings take 0 energy? This would avoid all the tricky issues associated with messing with other people's energy - the summons, the other monsters, etc. It effectively just gives the player a free turn, but now s/he's surrounded by (more) monsters. Seems like the safest way to ensure that IDing a summon scroll/staff by use does not kill you, and doesn't take much to implement (we just test for OF_SAFE and set p_ptr->energy_use to 0). Thoughts?

comment:23 Changed 8 years ago by magnate

On second thoughts, setting p_ptr->energy_use to 0 is no different from the proposals above in that orcs whaling on the player will still miss a turn while s/he gets to move again. Never mind, back to MFLAG_NICE as the answer ...

comment:24 Changed 8 years ago by magnate

  • Owner changed from d_m to magnate
  • Status changed from confirmed to assigned

Bother. MFLAG_NICE is removed in process_player, after the player's turn but before anything else. So by the time the new summons get to move, it's gone. Dammit, it was a one-line fix! Back to the drawing board ...

comment:25 Changed 8 years ago by magnate

Finally, Narvius offers the solution that's been eluding me: check that summons are not faster than @, if we're using it unIDd. This should be possible in summon_specific(_okay) ...

comment:26 Changed 8 years ago by magnate

Buzzkill suggests allowing faster summons, but if (faster && id) setting MON_TMD_SLOW for one turn so that they don't move before @ (unless they are >10 faster, which is unlikely).

comment:27 Changed 8 years ago by magnate

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

Fixed in [r318dbfd].

Note: See TracTickets for help on using tickets.