# HG changeset patch # User John "Elwin" Edwards # Date 1429620920 14400 # Node ID e6179860cb76813270dbb0f1ea3a722370058e33 # Parent d10fc4a065ac7e84ca38edf2bd2b27cef07db59f Import XRogue 8.0 from the Roguelike Restoration Project (r1490) diff -r d10fc4a065ac -r e6179860cb76 xrogue/LICENSE.TXT --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xrogue/LICENSE.TXT Tue Apr 21 08:55:20 2015 -0400 @@ -0,0 +1,178 @@ +Copyright (C) 1991 Robert Pietkivitch +Portions Copyright (C) 1985 Michael Morgan, Ken Dalka and AT&T +Portions Copyright (C) 1981 Michael Toy, Ken Arnold and Glenn Wichman +Portions Copyright (C) 2000 Nicholas J. Kisseberth +Portions Copyright (C) 1994 David Burren +All rights reserved. + +=========================================================================== + +XRogue: Expeditions into the Dungeons of Doom +Copyright (C) 1991 Robert Pietkivitch +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. Neither the name(s) of the author(s) nor the names of other contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. +4. The name "XRogue" must not be used to endorse or promote products + derived from this software without prior written permission. +5. Products derived from this software may not be called "XRogue", + nor may "XRogue" appear in their name, without prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +=========================================================================== + +Portions of this software are based on the work of Michael Morgan and +Ken Dalka. Used under license: + +Advanced Rogue +Copyright (C) 1984, 1985 Michael Morgan, Ken Dalka and AT&T +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. Neither the name(s) of the author(s) nor the names of other contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. +4. The name "Advanced Rogue" and "ARogue" must not be used to endorse or + promote products derived from this software without prior written + permission. +5. Products derived from this software may not be called "Advanced Rogue" or + "ARogue", nor may "Advanced Rogue" or "ARogue" appear in their name, + without prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +=========================================================================== + +Portions of this software are based on the work of Michael Toy, Ken Arnold +and Glenn Wichman. Used under license: + +Rogue: Exploring the Dungeons of Doom +Copyright (C) 1980, 1981 Michael Toy, Ken Arnold and Glenn Wichman +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. Neither the name(s) of the author(s) nor the names of other contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +=========================================================================== + +Portions of this software (save/restore game state) are based on the work +of Nicholas J. Kisseberth. Used under license: + +Copyright (C) 2000 Nicholas J. Kisseberth + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. Neither the name(s) of the author(s) nor the names of other contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +=========================================================================== + +Portions of this software (encryption) are based on the work +of David Burren. Used under license: + +FreeSec: libcrypt + +Copyright (C) 1994 David Burren +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. Neither the name(s) of the author(s) nor the names of other contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. diff -r d10fc4a065ac -r e6179860cb76 xrogue/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xrogue/Makefile Tue Apr 21 08:55:20 2015 -0400 @@ -0,0 +1,115 @@ +# XRogue: Expeditions into the Dungeons of Doom +# Copyright (C) 1991 Robert Pietkivitch +# All rights reserved. +# +# Based on "Advanced Rogue" +# Copyright (C) 1984, 1985 Michael Morgan, Ken Dalka and AT&T +# All rights reserved. +# +# Based on "Rogue: Exploring the Dungeons of Doom" +# Copyright (C) 1980, 1981 Michael Toy, Ken Arnold and Glenn Wichman +# All rights reserved. +# +# See the file LICENSE.TXT for full copyright and licensing information. + +DISTNAME=xrogue8.0.3 +PROGRAM=xrogue + +O=o + +HDRS = rogue.h mach_dep.h network.h + +OBJS1 = vers.$(O) actions.$(O) bolt.$(O) chase.$(O) command.$(O) daemon.$(O) \ + daemons.$(O) eat.$(O) effects.$(O) fight.$(O) encumb.$(O) help.$(O) \ + init.$(O) io.$(O) list.$(O) main.$(O) maze.$(O) misc.$(O) monsters.$(O) +OBJS2 = mons_def.$(O) move.$(O) n_level.$(O) options.$(O) outside.$(O) pack.$(O) \ + passages.$(O) player.$(O) potions.$(O) rings.$(O) rip.$(O) rooms.$(O) \ + save.$(O) scrolls.$(O) sticks.$(O) things.$(O) trader.$(O) util.$(O) \ + weapons.$(O) wear.$(O) wizard.$(O) rogue.$(O) state.$(O) xcrypt.$(O) +OBJS = $(OBJS1) $(OBJS2) + +CFILES= vers.c actions.c bolt.c chase.c command.c daemon.c daemons.c eat.c \ + effects.c fight.c encumb.c help.c init.c io.c list.c main.c maze.c \ + misc.c monsters.c mons_def.c move.c n_level.c options.c outside.c \ + pack.c passages.c player.c potions.c rings.c rip.c rooms.c save.c \ + scrolls.c sticks.c things.c trader.c util.c weapons.c wear.c wizard.c \ + rogue.c state.c xcrypt.c + +MISC = Makefile README.TXT LICENSE.TXT $(PROGRAM).sln $(PROGRAM).vcproj + +CC = gcc +CFLAGS= -O3 +CRLIB = -lcurses +RM = rm -f +TAR = tar +.SUFFIXES: .obj + +.c.obj: + $(CC) $(CFLAGS) /c $*.c + +$(PROGRAM): $(HDRS) $(OBJS) + $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(CRLIB) -o $@ + +clean: + $(RM) $(OBJS1) + $(RM) $(OBJS2) + $(RM) core a.exe a.out a.exe.stackdump $(PROGRAM) $(PROGRAM).exe $(PROGRAM).tar $(PROGRAM).tar.gz $(PROGRAM).zip + +dist.src: + make clean + tar cf $(DISTNAME)-src.tar $(CFILES) $(HDRS) $(MISC) + gzip -f $(DISTNAME)-src.tar + +dist.irix: + make clean + make CC=cc CFLAGS="-woff 1116 -O3" $(PROGRAM) + tar cf $(DISTNAME)-irix.tar $(PROGRAM) README.TXT LICENSE.TXT + gzip -f $(DISTNAME)-irix.tar + +dist.aix: + make clean + make CC=xlc CFLAGS="-qmaxmem=16768 -O3 -qstrict" $(PROGRAM) + tar cf $(DISTNAME)-aix.tar $(PROGRAM) README.TXT LICENSE.TXT + gzip -f $(DISTNAME)-aix.tar + +dist.linux: + make clean + make $(PROGRAM) + tar cf $(DISTNAME)-linux.tar $(PROGRAM) README.TXT LICENSE.TXT + gzip -f $(DISTNAME)-linux.tar + +dist.interix: + make clean + make $(PROGRAM) + tar cf $(DISTNAME)-interix.tar $(PROGRAM) README.TXT LICENSE.TXT + gzip -f $(DISTNAME)-interix.tar + +dist.cygwin: + make clean + make $(PROGRAM) + tar cf $(DISTNAME)-cygwin.tar $(PROGRAM).exe README.TXT LICENSE.TXT + gzip -f $(DISTNAME)-cygwin.tar + +dist.mingw32: + $(MAKE) RM="cmd /c del" clean + $(MAKE) CRLIB="-lpdcurses -lWs2_32" $(PROGRAM) + cmd /c del $(DISTNAME)-mingw32.zip + zip $(DISTNAME)-mingw32.zip $(PROGRAM).exe README.TXT LICENSE.TXT + +dist.msys: + $(MAKE) clean + $(MAKE) CRLIB="-lcurses -lWs2_32" $(PROGRAM) + tar cf $(DISTNAME)-msys.tar $(PROGRAM).exe README.TXT LICENSE.TXT + gzip -f $(DISTNAME)-msys.tar + +dist.djgpp: + make clean + make LDFLAGS="-L$(DJDIR)/LIB" CRLIB="-lpdcurses" $(PROGRAM) + rm -f $(DISTNAME)-djgpp.zip + zip $(DISTNAME)-djgpp.zip $(PROGRAM) README.TXT LICENSE.TXT + +dist.win32: + nmake O="obj" RM="-del" clean + nmake O="obj" CC="CL" CRLIB="..\pdcurses.lib shell32.lib user32.lib Advapi32.lib Ws2_32.lib" CFLAGS="-DPDC_STATIC_BUILD -nologo -I.. -Ox -wd4033 -wd4716" $(PROGRAM) + -del $(DISTNAME)-win32.zip + zip $(DISTNAME)-win32.zip $(PROGRAM).exe README.TXT LICENSE.TXT diff -r d10fc4a065ac -r e6179860cb76 xrogue/README.TXT --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xrogue/README.TXT Tue Apr 21 08:55:20 2015 -0400 @@ -0,0 +1,646 @@ + Welcome to XRogue + http://roguelike.sourceforge.net/xrogue + + XRogue: Expeditions into the Dungeons of Doom + Copyright (C) 1991 Robert Pietkivitch + All rights reserved. + + Based on "Advanced Rogue" + Copyright (C) 1984, 1985 Michael Morgan, Ken Dalka and AT&T + All rights reserved. + + Based on "Rogue: Exploring the Dungeons of Doom" + Copyright (C) 1980, 1981 Michael Toy, Ken Arnold and Glenn Wichman + All rights reserved. + + See the file LICENSE.TXT for full copyright and licensing information. + + +XRogue: Expeditions into the Dungeons of Doom +--------------------------------------------- + +Introduction: + +Rogue was introduced at the University of California at Berkeley as a +screen-oriented fantasy game. The game had 26 types of monsters that +the player could meet while exploring a Dungeon generated by the computer. +Scrolls, potions, rings, wands, staves, armor, and weapons helped the +player to battle these monsters and to gain gold, the basis for scoring. + +The version of rogue described in this guide has been expanded to include +over 200 monsters with many new capabilities and has been renamed xrogue. +Many of the monsters are intelligent and they, like the player, must avoid +traps and decide when it is better to fight or to run. There are also a +number of new commands in this version not found in previous versions. + +The game contains monsters, spells, weapons, armor, potions, and other +magical items that you will discover during your quest. The Dungeon's +geography changes with every game and although many magical items have +certain identifiable properties, such as turning the player invisible, +the physical manifestation of the magic changes each game. A red potion, +for example, will cause the same reaction throughout a given game but +it may be a completely different potion in a new game. + +Entering the Dungeon with only a little food, armor, and a weapon, the +player must develop a good strategy of when to fight, when to run, and +how to best use any magical item found in the Dungeon. To make things +interesting the player has a quest to return one of several unique and +magical artifacts which are rumored to lie deep within the Dungeon. +Returning with this artifact to the surface brings great honor. + +However, after finding the artifact, the player may wish to continue +his quest deeper into the Dungeon to match wits with an arch-devil, a +demon-prince, or perhaps Charon the Boatman. Defeating such a creature +will gain the player many experience points which is the basis for +scoring in xrogue. It is very difficult to return from the Dungeons +of Doom alive. Very few players have won this game. + +Character Classes: + +Before placing the player in the Dungeon, the game requests that you +select what type of character they would like to be: Fighter, Paladin, +Ranger, Magic-User, Cleric, Thief, Assassin, Druid, or Monk. + + The Fighter + +A Fighter has the best odds at winning battles with monsters. At high +experience levels, the Fighter is able to attack his opponent multiple +times in a single turn. Strength is the main attribute of the Fighter. + + The Magic-User + +A Magic-User is able to cast spells. Intelligence is the main attribute. +The number of spells a Magic-User can cast increases as he gains in +experience points and in intelligence. His spell casting ability allows +him to identify any item in the Dungeon. 16 spells. + + The Cleric + +A Cleric is able to pray for assistance in battle. Wisdom is the main +attribute. The number of prayers granted to the Cleric increases as he +gains in experience points and in wisdom. Clerics can affect (turn) the +undead monsters to avoid battle. Ie., zombies, ghouls, etc. If the +Cleric is very powerful relative to the undead monster, turning it will +utterly destroy it. 16 prayers. + + The Paladin + +A Paladin is a type of holy warrior, being a cross between a Cleric +and a Fighter. He is able to pray and affect the undead like the Cleric +and fight like the Fighter, but both to a lesser extent. He is on the +side of all that is righteous and good and would never attack a monster +that has not attacked him first. If he happens to kill such a monster, +inadvertantly or otherwise, he will begin to feel increasingly uneasy. +If he kills too many such monsters, he will face karmic retaliation and +be reduced to a mere Fighter, minus all of the Cleric's ability. +Charisma is the main attribute with Wisdom second. + + The Ranger + +A Ranger is a type of mystical warrior, being a cross between the +Magic-User and Fighter. Like the Paladin, he is on the side of all +that is righteous and good and would never attack a monster that +has not attacked him first. A Ranger is able to cast spells like the +Magic-User and fight like the Fighter, but both to a lesser extent. +Charisma is the main attribute with Intelligence second. + + The Thief + +A Thief is exceptionally dexterous and has great skill at being able +to set a traps for and/or rob (steal) items from monsters. Thieves have +the ability to detect all the gold and hidden traps on each level of +the Dungeon. Their dexterous nature gives Thieves the ability to move +very quietly, so they are not as likely as to wake up sleeping monsters +as are the other character types. If a Thief manages to sneak up on a +creature without waking it he may be able to backstab the monster. The +damage from a backstab is greatly increased based upon the experience +level. Dexterity is the main attribute. + + The Assassin + +An Assassin is a person trained in the art of killing monsters by +surprise. He has some of the abilities of the Thief, but he cannot +sense traps or backstab. Instead, the Assassin has the chance to kill +an opponent outright with one deadly blow. He can recognize and use +poison found in the Dungeon on his weapon, thereby, making his next +attack exceptionally lethal. Dexterity is the main attribute. + + The Druid + +A Druid is a type of magical warrior, being a cross between the Cleric +and the Magic-User. A Druid can chant both spells and prayers plus a +few of his own. The number of chants available to the Druid increases +as he gains in experience points and in Wisdom. Wisdom is the main +attribute. 16 chants. + + The Monk + +A Monk is trained in the martial arts. He wears no armor and does not +need a weapon (although using them is not forbidden). As the Monk gains +in experience points his natural defense or ability to dodge attackers +increases. The Mong is a cross between the Druid and Fighter, so he +can chant and also fight like the Fighter, but both to a lesser extent. +Constitution is the main attribute, with wisdom second. + +Attributes Of The Charaters: + +Strength - The primary attribute for encumberance. + +Intelligence - The primary attribute for casting spells. + +Wisdom - The primary attribute for prayers and chanting. + +Dexterity - The primary attribute for stealthiness. + +Charisma - The primary attribute for good will. High Charisma also + affects the cost of objects when making transactions. + +Constitution - The primary attribute for health. High Constitution + affects the amount of hit points you receive when + moving up in experience levels. + +Note: The Ranger, Paladin, and Monk do not receive their "special" +magical abilities until they have advanced a few experience levels. + +Experience Levels: + +Characters gain experience points mostly from killing monsters. Other +actions, such as stealing items from monsters, backstabbing, and turning +monsters, also add extra experience points. Each character type gains +experience points and moves up in experience levels at different rates. +Moving up in experience levels adds extra hit points to the character +which determines how many "hits" he can take before being killed. + +Allocating Attribute Points To The Characters: + +A player starts with 75 attribute points to distribute in to the character +he has chosen to play. When you are prompted to distribute the attribute +points, the screen displays the minimum and maximum allowable values for +that particular attribute. The player can type a backspace (Ctrl-H) to go +back and change a previous value and typing an escape (ESC) sets all the +remaining attributes to the maximum value possible, given the number of +remaining attribute points to be distributed. + +THE SCREEN + +During the normal course of play, the screen consists of three separate +sections: the top line, the bottom two lines, and the remaining screen +in the middle. The top line reports actions which occur during the game, +the middle section depicts the Dungeon, and the bottom two lines describe +the player's current condition. + +Whenever anything happens to the player, such as finding a scroll, hitting +a monster, or being hit by a monster, a short report appears on the top +line of the screen. When you see the word 'More' on the top line, that +means you must press the space key to continue. + +The following items may be found within the Dungeon. Some of them have +more than one interpretation, depending upon whether your character +recognizes them or not. + +| A wall of a room. +- A wall of a room. +* A pile of gold. +% A way to another level. ++ A doorway. +. The floor in a room. +# The floor in a passageway. + Solid rock (denoted by a space). +^ The entrance to a Trading Post +@ The player. +_ The player, when invisible. +: Some food. +! A flask containing a potion. +? A sealed scroll. += A ring. +) A weapon. +] Some armor. +; A miscellaneous magic item +, An artifact +/ A wand or a staff. + > A trapdoor leading to the next level +{ An arrow trap +$ A sleeping gas trap +} A beartrap +~ A trap that teleports you somewhere else +` A poison dart trap +" A shimmering magic pool +' An entrance to a maze +$ Any magical item. (During magic detection) + > A blessed magical item. (During magic detection) +< A cursed magical item. (During magic detection) + +Monsters are depicted as letters of the alphabet. Note that all letters +denote multiple monsters, depending on which level of the Dungeon you are +on. The player may identify a current monster by using the identify +command ('/') or the clarify command ('='). + +The bottom two lines of the screen describe the player's current status. +The first line gives the player's characteristics: + +Intelligence, Strength, Wisdom, Dexterity, Charisma, and Constitution +all have a normal maximum value of 50 points, but they can go higher if +augmented by a ring. Encumberance is a measurement of how much the player +can carry versus how much he is currently carrying. The more you carry +relative to your maximum encumberance causes you to use more food. The +attribute of Strength fortifies one's encumberance. + +The player's current number of hit points are denoted as (Hp) and it is +followed in parentheses by the player's current maximum hit points. Hit +points express the player's survivability. As a player heals by resting, +using potions, or spells, the player's current hit points gradually increase +until they reach the current maximum. This maximum number will be increased +each time a player goes up an experience level. If the player's current hit +points reach 0, the player becomes "metabolically challenged". + +The player's armor class is denoted as (Ac). This number describes the +amount of protection provided by the armor, cloaks, and/or rings currently +worn by the player. It is also affected by high or low dexterity. Wearing +no armor is equivalent to an armor class of 10 (Monk excepted). The lower +the armor class number, the better. + +The player's current experience level is denoted as (Exp), followed by +the player's experience points. A new experience level brings extra hit +points and possibly added abilities, such as new spells for a Magic-user, +new prayers for a Cleric, and new chants for a Druid. There are a total +of 26 experience levels per character. + +Commands: + +A player can invoke most commands by typing in a single character. +Some commands, however, require a direction, in which case the player +types the command character followed by a directional letter. Many +commands can be prefaced by a number, indicating how many times the +command should be executed. + +When the player invokes a command referring to an item in the player's +pack (such as reading a scroll), the game prompts for the item. The +player can then type the letter associated with the item. Typing a '*' +will produce a list of eligible items. + +A list of basic games commands: + +? Preceding a command by a '?' produces a brief explanation of the + command. The command '?*' gives an explanation of all the commands. + A '?@' gives information on things you encounter (rock, forest, etc). +/ Preceding a symbol by a '/' identifies the symbol. += Clarify. After typing an '=' sign, the player can use the movement + keys to position the cursor anywhere on the current level. As long + as the player can normally see the selected position, the game will + identify whatever is there. +h Move one position to the left. +j Move one position down. +k Move one position up. +l Move one position to the right. +y Move one position to the top left. +u Move one position to the top right. +b Move one position to the bottom left. +n Move one position to the bottom right. +H Run to the left until reaching something interesting. +J Run down until reaching something interesting. +K Run up until reaching something interesting. +L Run to the right until reaching something interesting. +Y Run to the top left until reaching something interesting. +U Run to the top right until reaching something interesting. +B Run to the bottom left until reaching something interesting. +N Run to the bottom right until reaching something interesting. + + > Go down the stairs to the next level or enter the outer region if you + are standing upon the wormhole trap (must be "flying" for this to work). +< Go up the stairs to the next level or enter the outer region if you are + standing upon the wormhole trap (must be "flying" for this to work). + +* Count the gold in the player's pack. +! Escape to the shell level. +$ Price an item at the Trading Post. +# Buy an item at the Trading Post. +% Sell an item at the Trading Post. +. This command (a period) causes the player to rest one turn. +^ This command sets traps and is limited to Thieves and Assassins. If the + command is successful the game will ask the player for the trap type and + sets it where the player is standing. +a Affect the undead. This command is restricted to Clerics and Paladins + and must be followed by a directional letter. +A Choose your quest item (at game startup only!). +c This command is restricted to Druids and Monks and it produces a list of + available chants. The player can select one of the displayed chants and + if the player's energy level is sufficiently high, "chant" it. The more + complicated the spell, the more energy it will take. +C This command is restricted to Magic-Users and Rangers and it produces a + list of available spells. The player can select one of the displayed + spells and if the player's energy level is sufficiently high, "cast" it. + The more complicated the spell, the more energy it will take. +d Drop an item from the player's pack. +D Dip something into a magic pool. +e Eat some food from the player's pack. +f When this command is preceded with a directional command, the player will + move in the specified direction until he crosses something interesting. +F Frighten a monster. Not available to all characters. This command + loses it's power at around level 10. +g Give away or trade a slime-mold for food with a monster. +G This command is restricted to Thieves and Assassins. It causes the game + to display all of the gold on the current level. +i Display an inventory of the player's pack. +I This command prompts for an item from the player's pack and displays + the inventory information for that item. +m When the player types this command, you are prompted to mark an item + with a one-line name. +o Typing this command causes the game to display all the settable options. + The player can then examine them or change (some of) them +O Display your current character type and quest item. +p This command is restricted to Clerics and Paladins and it produces a + list of available prayers. The player can then select one of the + displayed prayers and if the player's energy level is sufficiently high, + "pray" it. The more complicated the prayer, the more energy it will +take. +P Pick up the items currently under the player. +q Quaff a potion from the player's pack. +Q Quit without saving the game. +r Read a scroll from the player's pack. +s Search for a secret door or a trap in the circle surrounding the player. +S Save your game to play at a later time. +t This command prompts for an object from the players pack. The player + then can throw the object in the specified direction. +T Take off whatever the player is wearing. +v Print the current xrogue version number. +w Wield a weapon from the player's pack. +W Wear some armor, ring, or a miscellaneous magic item from the player's + pack. The player can wear a maximum of 8 rings. +X This command is restricted to Thieves only. It causes the game to +display + all of the hidden traps on the current level. +z This command prompts for a wand or staff from the player's pack and zaps + it in the specified direction. ++ Fortune cookie! (Note: if you play xrogue over a modem, typing three + consecutive '+' will tell your modem to enter "command" mode. See your + modem manual on how to return from this mode). + +Escape Pressing the Escape key will cancel the current command. +Ctrl-B Check your current score. Scoring is based on experience points + and gold. However, gold is not that important and 10% is hacked + off if a player is killed. +Ctrl-E Check your current food level. This command is used when you want + to see just how much food you have remaining in your stomach. A + full stomach is measured to be about 2000(2100). As you play the + game, this level drops until you become hungry at about 200(2100). + A food level over 2000(2100) makes the character satiated, and a + level under 200(2100) makes the character hungry, then weak, and + finally fainting. A level of 2000(2100) is the most the character + can eat, a full, satisfied stomach! +Ctrl-L Redraw the screen. +Ctrl-N When the player types this command, the game prompts you to type a + one-line name for a monster or for an item in the player's pack + To name a monster, position the cursor over the desired monster and + rename it. +Ctrl-O Display the current "affects" on the player (such as slow, phased, + confused, extra sight, flying, dancing, etc.). +Ctrl-R Repeat last message displayed on the top line of the screen. +Ctrl-T This command is restricted to Thieves and Assassins. It must be + followed by a directional letter. If a monster is standing next to + the player in the specified direction, the effect is to steal an + item from the monster's pack. If successful, the monster does not + notice anything, but if the player is unsuccessful, there is a +chance + the monster will suddenly wake up and attack. +Ctrl-U Use a magic item in the player's pack. + +There is no explicit attack command. If a player wishes to do battle with a +monster, the player simply moves onto the spot where the monster is +standing. +Whatever the player is wielding will be used as the player's weapon. + +As the player moves across items, the game automatically picks them up and +places them into the player's pack. If there is no room left in the pack, +the item is left on the floor. Setting the "pickup" option to "NO" will +allow the player to pick up items at will using the 'P' command. + +All actions except for bookkeeping commands, such as taking an inventory, +take time. The amount of time varies with the command. Swinging a weapon, +for example, takes more time than simply moving; so a monster could move +several spaces in the time it takes the player to make one attack. The +time it takes to swing a weapon also varies based on the bulk of the weapon, +and the time it takes to simply move one space varies with the type of armor +worn and the player's level of encumberance. Movement is always faster when +the player is "flying". + +Actions also take time and some of them can be disrupted. If the player is +casting a spell for example, and gets hit before finishing it, the spell is +lost. Similarly, the player might choke if hit while trying to eat. These +same rules apply to monsters as well. + +Some of the rooms in the Dungeon possess a natural light source. In most +other rooms and in corridors, the player can see only those things within +a one-space radius around the player. Dark rooms can be lit with magical +light or by fire beetles and other monsters. + +The player can wield only one weapon at a time. When a player attacks +a monster, the amount of damage depends on the particular weapon he is +wielding. To fire a projectile weapon, such as a crossbow or a short bow, +the player should wield the bow and throw the bolt or arrow at the monster. + +A weapon may be cursed or blessed which will affect the likelihood of you +hitting a monster with it and the damage that it will inflict on the +monster. +If the player has identified the weapon he is using, the "to hit" and the +"to damage" bonuses appear (in that order) before the weapons name in the +inventory listing. A positive bonus indicates a blessed weapon, and a +negative bonus usually indicates a cursed or misguided weapon. A player +cannot release a cursed weapon until a remove curse scroll is read or cast +by magical means. + +After the player has identified a suit of armor, the protection bonus +appears +before the armors name in the inventory listing. If the bonus is positive +the armor is blessed but if it is negative, the armor is probably cursed. +The player cannot remove a cursed suit of armor until a remove curse scroll +is read or cast by magical means. + +Some monsters can corrode your armor! If such a monster hits a player +when the player is wearing metal armor, the armor will lose some of its +protective value. This same corrosive property also applies to weapons +when a player hits a monster with this ability. Search for a scroll of +"protection" to guard against corrosion of your armor and weapon. + +A player will find many potions and scrolls in the Dungeon. Reading a +scroll or quaffing a potion will usually cause some magical occurrence. +Potions and scrolls may be either cursed or blessed. In this version of +xrogue, Monster Confusion scrolls will turn your hands a variety of colors. +A blessed Magic Mapping scroll shows very detailed maps. A scroll of +Genocide works within the dungeon as well as in the outer region. A +scroll of blessed Teleportation will teleport you "upward" a few levels. +Blessed Remove Curse will cause certain monsters to panic if the scroll +is read near them. Charm Monster will let you charm several monsters. + +The player can wear a maximum of eight rings. Some of them have a magical +effect on the player as long as they are worn. Some rings also speed up +the player's metabolism, making the player require food more often. Rings +can be cursed or blessed and the player cannot remove a cursed ring until +a remove curse scroll is read or cast. + +Wands, rods, and staves help a player in battle and affect the Dungeon. +A player uses the "z" (zap) command to use a wand either to shoot at a +monster, teleport, or to light up a dark room. Wands can be cursed or +blessed. + +A player must be frugal with his food. Both moving and searching through +the Dungeon, and fighting monsters, consumes energy. Starving results in +the player's fainting for increasingly longer periods of time, during which +any nearby monster can attack the player at will. Food comes in the form +of standard rations and as a variety of berries. Some berries have side +effects in addition to satisfying one's hunger. Slime-Molds are monster +food and if you have one, you may be able to trade it for a regular food +ration, if the monster is of "friendly" persuasion. + +Gold has a couple of uses in the Dungeon. The first use of gold is to buy +things, either at a Trading Post or from a Quartermaster. The Trading Post +when found, is entered via the '>' command, like going down a stairway. +A Quartermaster ('q') is a Dungeon vendor who appears at certain times and +will try to sell the player some of his wares. The Quartermaster's wares +are never cursed but they can be blessed, though blessed goods do cost more +than normal goods. If the player chooses to buy something offered by a +Quartermaster, he will make the transaction for the specified amount of gold +and then disappear. Attacking a Quartermaster causes him to vanish in +haste! You can sometimes find gold at the bottom of "magic pools". Use +the ">" command to dive for the gold, but be careful you don't drown! + +When beginning a new game, a player is placed in the Trading Post with +an allotment of gold based upon the type of character chosen to play. +There are some restrictions on the use of certain items by character. +For example, only Fighters, Paladins, and Rangers can wield two-handed +swords while Thieves and Assassins can not wear certain types of armor. +However, the Trading Post (and Quartermaster) will happily sell a player +anything that he can afford, whether you need it or not. + +Miscellaneous magical items such as a Pair of Boots or a Book are numerous +within the Dungeon. These items are usually used to a player's advantage, +assuming they are not cursed. Some of these items can be worn, such as a +Cloak, while others are to be used, such as a Book, Beaker, or Ointment. +The Medicine Crystal will heal you, remove all curses, heal you, and may +cause panic in some monsters. + +There are a number of unique monsters deep within the depths of the Dungeon +that carry very special magical items or artifacts. When you begin the +game, +you are asked to choose a "quest item" to retrieve from the Dungeon. Most +of these items can be used to the player's advantage, even if they are not +one's own personal quest item during the game. However, care must be taken +when handling some of them for they have intelligence and some will reject +mishandling or abuse. These items consume your food (and your gold) so +carrying them around results in increased food use. Some of these items +will +kill you outright if you happen to pick them up while wielding another +artifact as your weapon. Don't be too greedy with the artifacts! Quest +items begin appearing in xrogue between levels 40-50. The less traumatic +quest items appear earlier while the more severe ones appear later. Once +a unique monster is killed, you will not encounter another one like it in +the Dungeon. + +A variety of traps exist within the Dungeon, including trap doors, bear +traps, and sleeping traps. Sometimes they are hidden from sight until +sprung by a monster or by the player. A sprung trap continues to function, +but since it is visible, an intelligent monster is not likely to tread on +it. +A trap called the Wormhole trap, will transport you to the "outer region" +of the dungeon. There you will fight strange dinosaurs until you can make +your way back to a starwell, and promptly return from whence you came. + +Each monster except for the Quartermaster appears in a limited range of +Dungeon levels. All monsters of the same type share the same abilities. +All giant rats, for example, can give the player a disease, and all +jackalweres can put the player to sleep. Monsters of the same type will +vary however, in strength and intelligence. For example, one kobold may +be much more difficult to kill off than another. In general, the more +difficult it is to kill a monster, the more experience points the monster +is worth. + +Most monsters attack by biting and clawing, but some monsters carry weapons +and can use their breath as a weapon. Some monsters can even use magical +items, such as wands and artifacts. Monsters with distance weapons or magic +can sometimes attack a player from across a room or from down a corridor. + +Some monsters are more intelligent than others, and the more intelligent +a monster is, the more likely it will run away if it is about to die. +A fleeing monster will not attack the player unless it is cornered. + +It is sometimes possible to enlist a monster's aid. Reading a charm monster +scroll, for example, or singing a charm monster chants can make a monster +believe that the player is its friend. A charmed monster will fight hostile +monsters for the player as long as they are not of its own race. Be sure +your charmed monsters are in the same room with you when you enter the next +level, or they will be lost. + +Options: + +The game has several options, some of which can only be set by the player +at the beginning of the game and others during the course of play. + + default - Play the character with "default" attribute settings. + terse - Shorten messages at top of screen. + jump - Speed up the display of the player's movement + step - Lists all inventories one line at a time. + overlay - Allows listings of inventories to overlay the currnt screen. + flush - Supposed to flush all typed-ahead characters. + askme - Prompt the player to name new types of scrolls, potions, +etc. + pickup - Pick up items automatically as you move across them + name - The player's name. + file - Saved game filename. Defaults to xrogue.sav. + score - Identifies the location of the game scorefile. + type - Specifies the character type (unchangable). +quested item - Set at start up (unchangeable). + +A player can set the game options at the beginning of a game via the +ROGUEOPTS environment variable. + +Some examples: + + ROGUEOPTS="default nopickup, nooverlay, name=Corwin, class=magician" + ROGUEOPTS="pickup, overlay, file=xrg.sav, score=/home/games/scorefile" + +The player may change an option at any time during the game via the 'o' +(option) command. On the options menu, typing a new value changes the +option and a RETURN moves to the next option in the list. Typing an '-' +moves you to the previous option and an ESCAPE returns you to the Dungeon. + +A new option called "default" was added in xrogue. When you put the word +"default" into your ROGUEOPTS environment variable your character will be +created with "default" attribute settings, armor, weapon, quest item, and +some food. + +Setting "default" will force the game to skip over the beginning screen +where you can choose/distribute your attribute points and it also skips +over the beginning "equippage screen" where you can choose your armor, +weapon, quest item, and etc. + +If you use the "class" option with "default" in ROGUEOPTS, you will +start the game immediately at level 1 with the default selections +for your character. + +Here is a list of the main and secondary attributes, special ability, +and quest item ("default" settings) for each character type: + + Character Main Attr. Secondary Specialties Def. Quest Item + ------------------------------------------------------------------------- + Fighter strength constitution sense gold Axe of Aklad + Ranger charisma intelligence cast spells Mandolin of Brian + Paladin charisma wisdom affect undead Ankh of Heil + Cleric wisdom dexterity prayer spells Horn of Geryon + Magician intelligence dexterity cast spells Stonebones Amulet + Thief dexterity strength sense traps Musty Daggers + Assassin dexterity strength steal/use poison Eye of Vecna + Druid wisdom dexterity chant spells Quill of Nagrom + Monk constitution dexterity chant spells Emori Cloak + +A different quest item may be chosen ONLY while you are in the beginning +Trading Post (if you have NOT set the "default" option via ROGUEOPTS). + +When a player is killed, his score will be equal to the amount of his +experience points gained, plus his gold (minus 10%). A player that +quits the game will not lose 10% of his gold. If a player makes it back +up and out of the Dungeon alive, his score will be equal to the amount +of experience points, plus the gold, plus additional gold received from +selling all of the items in his pack. + +The game maintains a top-twenty player scorefile. As an installation +option, the game may be compiled so as to record only three entries per +character type and name. diff -r d10fc4a065ac -r e6179860cb76 xrogue/actions.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xrogue/actions.c Tue Apr 21 08:55:20 2015 -0400 @@ -0,0 +1,1074 @@ +/* + actions.c - functions for dealing with monster actions + + XRogue: Expeditions into the Dungeons of Doom + Copyright (C) 1991 Robert Pietkivitch + All rights reserved. + + Based on "Advanced Rogue" + Copyright (C) 1984, 1985 Michael Morgan, Ken Dalka and AT&T + All rights reserved. + + Based on "Rogue: Exploring the Dungeons of Doom" + Copyright (C) 1980, 1981 Michael Toy, Ken Arnold and Glenn Wichman + All rights reserved. + + See the file LICENSE.TXT for full copyright and licensing information. +*/ + +#include +#include +#include +#include "rogue.h" + +int mf_count = 0; /* move_free counter - see actions.c(m_act()) */ +int mf_jmpcnt = 0; /* move_free counter for # of jumps */ + +/* + * Did we disrupt a spell? + */ +dsrpt_monster(tp, always, see_him) +register struct thing *tp; +bool always, see_him; +{ + switch (tp->t_action) { + case A_SUMMON: + case A_MISSILE: + case A_SLOW: + tp->t_action = A_NIL; /* Just make the old fellow start over again */ + tp->t_no_move = movement(tp); + tp->t_using = NULL; /* Just to be on the safe side */ + turn_on(*tp, WASDISRUPTED); + if (see_him) + msg("%s's spell has been disrupted.",prname(monster_name(tp),TRUE)); + /* + * maybe choose something else to do next time since player + * is disrupting us + */ + tp->t_summon *= 2; + tp->t_cast /= 2; + return; + } + + /* We may want to disrupt other actions, too */ + if (always) { + tp->t_action = A_NIL; /* Just make the old fellow start over again */ + tp->t_no_move = movement(tp); + tp->t_using = NULL;/* Just to be on the safe side */ + } +} + +dsrpt_player() +{ + int which, action; + struct linked_list *item; + struct object *obj; + + action = player.t_action; + which = player.t_selection; + + switch (action) { + case C_CAST: /* Did we disrupt a spell? */ + case C_PRAY: + case C_CHANT: + { + msg("Your %s was disrupted!", action == C_CAST ? "spell" : "prayer"); + + /* Charge him 1/4 anyway */ + if (action == C_CAST) + spell_power += magic_spells[which].s_cost / 4; + else if (action == C_PRAY) + pray_time += cleric_spells[which].s_cost / 4; + else if (action == C_CHANT) + chant_time += druid_spells[which].s_cost / 4; + } + when C_COUNT: /* counting of gold? */ + { + if (purse > 0) { + msg("Your gold goes flying everywhere!"); + do { + item = spec_item(GOLD, NULL, NULL, NULL); + obj = OBJPTR(item); + obj->o_count = min(purse, rnd(20)+1); + purse -= obj->o_count; + obj->o_pos = hero; + fall(item, FALSE); + } while (purse > 0 && rnd(25) != 1); + } + } + when C_EAT: + msg("Ack! You gag on your food for a moment. "); + del_pack(player.t_using); + + when A_PICKUP: + msg("You drop what you are picking up! "); + + when C_SEARCH: /* searching for traps and secret doors... */ + msg("Ouch! You decide to stop searching. "); + count = 0; /* don't search again */ + + when C_SETTRAP: + msg("Ouch! You can't set a trap right now. "); + + when A_NIL: + default: + return; + } + player.t_no_move = movement(&player); /* disoriented for a while */ + player.t_action = A_NIL; + player.t_selection = 0; +} + +/* + * m_act: + * If the critter isn't doing anything, choose an action for it. + * Otherwise, let it perform its chosen action. + */ + +m_act(tp) +register struct thing *tp; +{ + struct object *obj; + bool flee; /* Are we scared? */ + + /* What are we planning to do? */ + switch (tp->t_action) { + default: + /* An unknown action! */ + msg("Unknown monster action (%d)", tp->t_action); + + /* Fall through */ + + case A_NIL: + /* If the monster is fairly intelligent and about to die, it + * may turn tail and run. But if we are a FRIENDLY creature + * in the hero's service, don't run. + */ + if (off(*tp, ISFLEE) && + tp->t_stats.s_hpt < tp->maxstats.s_hpt && + tp->t_stats.s_hpt < max(10, tp->maxstats.s_hpt/6) && + (off(*tp, ISFRIENDLY) || tp->t_dest != &hero) && + rnd(25) < tp->t_stats.s_intel) { + turn_on(*tp, ISFLEE); + + /* It is okay to turn tail */ + tp->t_oldpos = tp->t_pos; + } + + /* Should the monster run away? */ + flee = on(*tp, ISFLEE) || + ((tp->t_dest == &hero) && on(player, ISINWALL) && + off(*tp, CANINWALL)); + + m_select(tp, flee); /* Select an action */ + return; + + when A_ATTACK: + /* + * We're trying to attack the player or monster at t_newpos + * if the prey moved, do nothing + */ + obj = tp->t_using ? OBJPTR(tp->t_using) : NULL; + if (ce(tp->t_newpos, hero)) { + attack(tp, obj, FALSE); + } + else if (mvwinch(mw, tp->t_newpos.y, tp->t_newpos.x) && + step_ok(tp->t_newpos.y, tp->t_newpos.x, FIGHTOK, tp)) { + skirmish(tp, &tp->t_newpos, obj, FALSE); + } + + when A_SELL: + /* Is the quartermaster still next to us? */ + if (ce(tp->t_newpos, hero)) sell(tp); + + /* The quartermaster moved away */ + else if (off(player, ISBLIND) && cansee(unc(tp->t_pos)) && + (off(*tp, ISINVIS) || on(player, CANSEE)) && + (off(*tp, ISSHADOW) || on(player, CANSEE)) && + (off(*tp, CANSURPRISE) || ISWEARING(R_ALERT)) && + (rnd(12) < 4)) + msg("%s grunts with frustration",prname(monster_name(tp),TRUE)); + + when A_MOVE: + /* Let's try to move */ + do_chase(tp); + + /* If t_no_move > 0, we found that we have to fight! */ + if (tp->t_no_move > 0) return; + + when A_BREATHE: + /* Breathe on the critter */ + m_breathe(tp); + + when A_SLOW: + /* make him move slower */ + add_slow(); + turn_off(*tp, CANSLOW); + + when A_MISSILE: + /* Start up a magic missile spell */ + m_spell(tp); + + when A_SONIC: + /* Let out a sonic blast! */ + m_sonic(tp); + + when A_THROW: + /* We're throwing something (like an arrow) */ + missile(tp->t_newpos.y, tp->t_newpos.x, tp->t_using, tp); + + when A_SUMMON: + /* We're summoning help */ + m_summon(tp); + + when A_USERELIC: + /* Use our relic */ + m_use_relic(tp); + + when A_USEWAND: + /* use the wand we have */ + m_use_wand(tp); + } + + /* Can we in fact move? (we might have solidified in solid rock) */ + if (!step_ok(hero.y, hero.x, NOMONST, &player)) { + + if (move_free > 1) goto jump_over; /* avoid messages */ + if (mf_count > 2) goto jump_over; /* limit messages */ + + if (pstats.s_hpt < 1) { + pstats.s_hpt = -1; + msg("You have merged into the surroundings! --More--"); + wait_for(' '); + death(D_PETRIFY); + } + else { + mf_count += 1; /* count number of times we are here */ + pstats.s_hpt -= rnd(2)+1; + if (pstats.s_hpt < 1) { + pstats.s_hpt = -1; + msg("You have merged into the surroundings! --More--"); + wait_for(' '); + death(D_PETRIFY); + } + } + switch (rnd(51)) { + case 0: msg("Arrrggghhhhh!! "); + when 5: msg("You can't move! "); + when 10: msg("You motion angrily! "); + when 15: msg("You feel so weird! "); + when 20: msg("If only you could phase. "); + when 25: msg("The rock maggots are closing in! "); + when 30: msg("You wrench and wrench and wrench... "); + when 35: msg("You wish you could teleport out of here! "); + when 40: msg("Your feel your life force ebbing away... "); + when 45: msg("You partially regain your senses. "); + when 50: msg("The rock maggots have found you!!! "); + otherwise: pstats.s_hpt -= rnd(4)+1; + } + if (pstats.s_hpt < 1) { + pstats.s_hpt = -1; + msg("You lose the urge to live... --More--"); + wait_for(' '); + death(D_PETRIFY); + } + jump_over: + mf_jmpcnt++; /* count this jump */ + if (mf_jmpcnt > 9) { /* take a few turns, then reset it */ + mf_jmpcnt = 0; + mf_count = 0; + } + } + + /* No action now */ + tp->t_action = A_NIL; + tp->t_using = NULL; +} + +/* + * m_breathe: + * Breathe in the chosen direction. + */ + +m_breathe(tp) +register struct thing *tp; +{ + register int damage; + register char *breath = NULL; + + damage = tp->t_stats.s_hpt; + turn_off(*tp, CANSURPRISE); + + /* Will it breathe at random */ + if (on(*tp, CANBRANDOM)) { + /* Turn off random breath */ + turn_off(*tp, CANBRANDOM); + + /* Select type of breath */ + switch (rnd(10)) { + case 0: breath = "acid"; + turn_on(*tp, NOACID); + when 1: breath = "flame"; + turn_on(*tp, NOFIRE); + when 2: breath = "lightning bolt"; + turn_on(*tp, NOBOLT); + when 3: breath = "chlorine gas"; + turn_on(*tp, NOGAS); + when 4: breath = "ice"; + turn_on(*tp, NOCOLD); + when 5: breath = "nerve gas"; + turn_on(*tp, NOPARALYZE); + when 6: breath = "sleeping gas"; + turn_on(*tp, NOSLEEP); + when 7: breath = "slow gas"; + turn_on(*tp, NOSLOW); + when 8: breath = "confusion gas"; + turn_on(*tp, ISCLEAR); + when 9: breath = "fear gas"; + turn_on(*tp, NOFEAR); + } + } + + /* Or can it breathe acid? */ + else if (on(*tp, CANBACID)) { + turn_off(*tp, CANBACID); + breath = "acid"; + } + + /* Or can it breathe fire */ + else if (on(*tp, CANBFIRE)) { + turn_off(*tp, CANBFIRE); + breath = "flame"; + } + + /* Or can it breathe electricity? */ + else if (on(*tp, CANBBOLT)) { + turn_off(*tp, CANBBOLT); + breath = "lightning bolt"; + } + + /* Or can it breathe gas? */ + else if (on(*tp, CANBGAS)) { + turn_off(*tp, CANBGAS); + breath = "chlorine gas"; + } + + /* Or can it breathe ice? */ + else if (on(*tp, CANBICE)) { + turn_off(*tp, CANBICE); + breath = "ice"; + } + + else if (on(*tp, CANBPGAS)) { + turn_off(*tp, CANBPGAS); + breath = "nerve gas"; + } + + /* can it breathe sleeping gas */ + else if (on(*tp, CANBSGAS)) { + turn_off(*tp, CANBSGAS); + breath = "sleeping gas"; + } + + /* can it breathe slow gas */ + else if (on(*tp, CANBSLGAS)) { + turn_off(*tp, CANBSLGAS); + breath = "slow gas"; + } + + /* can it breathe confusion gas */ + else if (on(*tp, CANBCGAS)) { + turn_off(*tp, CANBCGAS); + breath = "confusion gas"; + } + + /* can it breathe fear gas */ + else { + turn_off(*tp, CANBFGAS); + breath = "fear gas"; + } + + /* Now breathe */ + shoot_bolt(tp, tp->t_pos, tp->t_newpos, FALSE, + tp->t_index, breath, damage); + + running = FALSE; + if (fight_flush) flushinp(); +} + +/* + * m_select: + * Select an action for the monster. + */ + +m_select(th, flee) +register struct thing *th; +register bool flee; /* True if running away or player is inaccessible in wall */ +{ + register struct room *rer, *ree; /* room of chaser, room of chasee */ + int dist = INT_MIN; + int mindist = INT_MAX, maxdist = INT_MIN; + bool rundoor; /* TRUE means run to a door */ + char sch; + coord *last_door=0, /* Door we just came from */ + this; /* Temporary destination for chaser */ + + rer = roomin(&th->t_pos); /* Find room of chaser */ + ree = roomin(th->t_dest); /* Find room of chasee */ + + /* First see if we want to use an ability or weapon */ + if (m_use_it(th, flee, rer, ree)) return; + + /* + * We don't count monsters on doors as inside rooms here because when + * a monster is in a room and the player is not in that room, the + * monster looks for the best door out. If we counted doors as part + * of the room, the monster would already be on the best door out; + * so he would never move. + */ + if ((sch = mvwinch(stdscr, th->t_pos.y, th->t_pos.x)) == DOOR || + sch == SECRETDOOR || sch == PASSAGE) { + rer = NULL; + } + this = *th->t_dest; + + /* + * If we are in a room heading for the player and the player is not + * in the room with us, we run to the "best" door. + * If we are in a room fleeing from the player, then we run to the + * "best" door if he IS in the same room. + * + * Note: We don't bother with doors in mazes or if we can walk + * through walls. + */ + if (rer != NULL && levtype != MAZELEV && off(*th, CANINWALL)) { + if (flee) rundoor = (rer == ree); + else rundoor = (rer != ree); + } + else rundoor = FALSE; + + if (rundoor) { + register struct linked_list *exitptr; /* For looping through exits */ + coord *exit, /* A particular door */ + *entrance; /* Place just inside doorway */ + int exity, exitx; /* Door's coordinates */ + char dch='\0'; /* Door character */ + + if ((th->t_doorgoal.x != -1) && (th->t_doorgoal.y != -1)) + dch = mvwinch(stdscr, th->t_doorgoal.y, th->t_doorgoal.x); + + /* Do we have a valid goal? */ + if ((dch == PASSAGE || dch == DOOR) && /* A real door */ + (!flee || !ce(th->t_doorgoal, *th->t_dest))) { /* Prey should not + * be at door if + * we are running + * away + */ + /* Make sure the player is not in the doorway, either */ + entrance = doorway(rer, &th->t_doorgoal); + if (!flee || entrance == NULL || !ce(*entrance, *th->t_dest)) { + this = th->t_doorgoal; + dist = 0; /* Indicate that we have our door */ + } + } + + /* Go through all the doors */ + else for (exitptr = rer->r_exit; exitptr; exitptr = next(exitptr)) { + exit = DOORPTR(exitptr); + exity = exit->y; + exitx = exit->x; + + /* Make sure it is a real door */ + dch = mvwinch(stdscr, exity, exitx); + if (dch == PASSAGE || dch == DOOR) { + /* Don't count a door if we are fleeing from someone and + * he is standing on it. Also, don't count it if he is + * standing in the doorway. + */ + if (flee) { + if (ce(*exit, *th->t_dest)) continue; + + entrance = doorway(rer, exit); + if (entrance != NULL && ce(*entrance, *th->t_dest)) + continue; + } + + /* Were we just on this door? */ + if (ce(*exit, th->t_oldpos)) last_door = exit; + + else { + dist = DISTANCE(th->t_dest->y, th->t_dest->x, exity, exitx); + + /* If fleeing, we want to maximize distance from door to + * what we flee, and minimize distance from door to us. + */ + if (flee) + dist -= DISTANCE(th->t_pos.y, th->t_pos.x, exity, exitx); + + /* Maximize distance if fleeing, otherwise minimize it */