Attika,Sep 2 2005, 04:26 AM Wrote:The Phasing Spell, a Treatise
[right][snapback]87982[/snapback][/right]
Hi,
INteresting post. I took out my notes on the code for the spell and indeed, I have noted it as Rnd[3]+4 for the direction of x and y. In addition, there is two rnd[2] rolls to determine if the range (4-6) should be positive or negative in each direction. No idea why this has not ended up in my guide. Checking the guide though, I note that it really have NOTHING listed for how Phasing work. Oops.
As a note, the game will only try to find a valid tile to phaze you to 500 times, if all those 500 tiles it rolled for are occupied, it will abort the process or rather, it will then phase you to your current location, which should include costing mana.
For the target tile, there are three checks into various tables to see if the tile is "empty". Since I don't remember those tables by heart and not sure were the notes on memory addresses for tables are, I really can't tell all about those tests, however, one of the checks is the same array that keep monster locations (and which can have both negative and positive numbers for the monsters which casuses certain tohit checks go wrong). This must be "zero". I don't recall the exact details of moving monsters and how it set the location values, it is possible that in some directions a monster can be moving into a location while it is still listed as empty, but I can recall wrong, perhaps this is the reason you sometimes end up in the same location, no? One of the other seems to be the one that lists objects such as chests, sarcophgus and such. I would assume the final one is for walls and such but have not looked.
Finally after that, there are additional checks for things that I really need to go and look up more carefully for when the spell can be aborted, perhaps they aren't even used really, since I don't know the code that well withough checking thoroughly.
EDIT: Regarding the non randomness, I am not sure I follow you, You seem to indicate that if there is only one spot to teleport to and from the target only the spot you came from is free, then you teleport between them and that it is not random. Can't see the problem though.
As for the bug of costing mana even if you abort, no idea if intended or not. But I added the note above that if it finds no location in 500 attempts, it will basically phase you to your current location. Could that be it? This is deliberate, the game does not exit the phase function but just sets the relative X-Y coordinate to phase to to 0.
There are three types of people in the world. Those who can count and those who can't.