r1443 Rod Bug

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sirridan
    Knight
    • May 2009
    • 560

    r1443 Rod Bug

    When I use a rod of light, then hit the repeat command 'n', the light fires immediately. This can be done as many times as I want, and the duration of the charge is incremented by 9 (then decremented by 1 because one turn passes).

    Experiments as follows:

    1. Zapped once, waited 9 turns, rod recharges.
    2. Zapped 4 times, waited 33 turns after the last zap, rod recharges. (36 turns, but 3 turns from firing effectively hide 3 of the charging turns)

    I'm attaching a savefile in case you want to verify with it.

    I'm betting this works with other rods too, I'll check it out.
    Attached Files
  • Sirridan
    Knight
    • May 2009
    • 560

    #2
    Checked with Rod of Frost Bolts, same result.

    Comment

    • geoff_tewierik
      Adept
      • Mar 2009
      • 140

      #3
      Damn that's an easily abused bug.

      Comment

      • Sirridan
        Knight
        • May 2009
        • 560

        #4
        Yeah it really is, blew away some uniques with it, I can imagine with a heal rod you could easily recall + healspam to escape anything, or Dig long tunnels... all kinds of crazy things.

        Comment

        • ajps
          Apprentice
          • May 2007
          • 50

          #5
          That should be fixed in svn now, you'll all be pleased (?) to hear.

          The repeat command was recently changed, so it now bypasses the normal UI checks for which items you can select to perform actions on - I wouldn't be surprised if there are more exploits like this still lurking, so please do keep your eyes peeled if you're a habitual 'n' user.

          As always, thanks for the report.

          Comment

          • Sirridan
            Knight
            • May 2009
            • 560

            #6
            Upgraded, fix works. Next thing I need to check is if I can still use 'n' to zap several rods in a stack.

            Side note: I was actually hoping to abuse this bug to kill a grape and rot jelly that were in the way of a piece of treasure I Was after. I mean there was no risk to me, just more of a time saver kind of thing, but no I had to 's' my way for each shot this time around... *grumble*

            One more thing, are there any descriptions of where to find various functions and such for the angband source code? I was going through it earlier trying to track down the bug and couldn't find where the rod was checked or where 'n' was implemented.

            Comment

            • d_m
              Angband Devteam member
              • Aug 2008
              • 1517

              #7
              Originally posted by Sirridan
              Upgraded, fix works. Next thing I need to check is if I can still use 'n' to zap several rods in a stack.
              I can confirm that you can use repeat to zap a stack of rods, up until all the rods are recharging.
              linux->xterm->screen->pmacs

              Comment

              • ajps
                Apprentice
                • May 2007
                • 50

                #8
                Originally posted by Sirridan
                One more thing, are there any descriptions of where to find various functions and such for the angband source code? I was going through it earlier trying to track down the bug and couldn't find where the rod was checked or where 'n' was implemented.
                I don't think there's any source guide that's accurate any more, mostly we get a feel for the bits we actually work on through prolonged exposure, I think.

                In this case, you might have been thrown by the fact the repeat command is actually '^V' (i.e. Ctrl-V) and not 'n', or you might have found that the translation of '^V' to CMD_REPEAT is handled in cmd0.c, and the actual implementation of CMD_REPEAT to redo the last command now happens in game-cmd.c. The command to zap a rod is implemented in cmd-obj.c, which is where the extra check was needed for charging rods.

                The problem here was that historically things like macros and the repeat command have been implemented as the game saving and replaying the series of keypresses that led to the previous result, so that if the item selection UI for zapping a rod didn't allow you to choose one because they were being charged it was equally impossible to choose one using 'n'. I'm in the process of changing this, so that the 'n' command and macros will instead directly issue actions to the game, which generally means having to check selections at the point the action is going to be carried out instead of relying on the UI to filter out all illegal behaviour beforehand. With rods I hadn't noticed the check was needed.

                Comment

                • PowerDiver
                  Prophet
                  • Mar 2008
                  • 2820

                  #9
                  This isn't directly related, but are you disabling 'n' after every pack reordering, including but not limited to a slot being emptied? IMO you should.

                  Comment

                  • ajps
                    Apprentice
                    • May 2007
                    • 50

                    #10
                    I'm not, but it does indeed sound like a sensible thing to do.

                    Comment

                    • ajps
                      Apprentice
                      • May 2007
                      • 50

                      #11
                      As of revision 1448, the repeat command won't work after the pack has been reordered.

                      Comment

                      • Sirridan
                        Knight
                        • May 2009
                        • 560

                        #12
                        Originally posted by ajps
                        As of revision 1448, the repeat command won't work after the pack has been reordered.
                        Nice, works well for using Id scrolls or enchant scrolls... often happened to me until I started inscribing things with !*

                        Comment

                        Working...
                        😀
                        😂
                        🥰
                        😘
                        🤢
                        😎
                        😞
                        😡
                        👍
                        👎