Go Back   Angband Forums > Angband > Development

Thread Tools Display Modes
Old December 24, 2019, 06:34   #1
Join Date: Dec 2019
Location: Mexico, undisclosed location
Posts: 79
eastwind is on a distinguished road
summon monster type 0

I was playing around with the summon random monster command debug mode (^as), trying to test something I was working on. I thought it was supposed to summon ordinary monsters, and ^an was for uniques. I was surprised when I kept getting uniques from ^as, so I debugged into it.

If I'm not mistaken it looks like the top level call in wiz-debug.c:
effect_simple(EF_SUMMON, source_player(), "1", 0, 0, 0, 0, 0, NULL);
is passing a literal zero for the 4th parameter, which eventually gets written to summon_specific_type as the type to summon. There was probably once an assumption that type 0 meant ANY.

But because (I think) the parser is reversing the entries from summon.txt as it writes them to the fixed-size summons array, entry zero is not ANY as it probably used to be. Rather it's the last entry in summons.txt, UNIQUE. The result is that the code above always summons a unique as all the regular monsters get zero for their prob2 and prob3 values.

It's not clear to me how many other places in the code there is an assumption that type 0 means ANY, since I can't find any #defines for this, and there aren't any calls anywhere to summon_name_to_idx("ANY").

It looks from grepping like there's at least one: chests with a summon-monster trap might always summon uniques too. That would probably count as a bug (assuming anything having to do with debug mode could be blown off as working-as-coded).

A cheap and sleazy fix would be to move the ANY entry in summons.txt to the bottom and put in a comment saying it must be last. Or of course the parse could be changed to not reverse the entries by filling in the permanent array last-to-first as is done for some other things (and then add a comment to summon.txt saying ANY must be first).
eastwind is offline   Reply With Quote
Old December 24, 2019, 07:07   #2
Vanilla maintainer
Nick's Avatar
Join Date: Apr 2007
Location: Canberra, Australia
Age: 55
Posts: 8,760
Donated: $60
Nick will become famous soon enough
Thanks, bug filed.
One for the Dark Lord on his dark throne
In the Land of Mordor where the Shadows lie.
Nick is offline   Reply With Quote

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Charm / Friendly Summon Mark Vanilla 1 April 14, 2019 14:56
read scroll of Summon Maintainer Sky Vanilla 5 October 24, 2017 11:55
Double height tiles: which type of cursor? PowerWyrm Development 9 July 26, 2012 13:52
I'm thinking some type of bug? Anyone agree? Rei Tei Vanilla 3 July 1, 2011 06:15
Blast! Killed by a "summon monster" trap Wraitheist Vanilla 10 April 27, 2008 18:36

All times are GMT +1. The time now is 14:50.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.