Announcement: Be excellent to each other.


Caravel Forum : DROD Boards : Bugs : Another weird thing... (Also around disarm tokens.)
New Topic New Poll Post Reply
Poster Message
Rheb
Level: Smitemaster
Avatar
Rank Points: 1211
Registered: 08-04-2006
IP: Logged

File: Bug.hold (829 bytes)
Downloaded 24 times.
License: Public Domain
icon Another weird thing... (+1)  
I have no idea why, but a clone gets his sword back one turn later when a mimic steps on a disarm token.

____________________________
Voligner is my very own DROD-like game. Please check it out!
10-13-2007 at 08:28 PM
View Profile Send Private Message to User Send Email to User Show all user's posts High Scores This architect's holds Quote Reply
TFMurphy
Level: Smitemaster
Rank Points: 3117
Registered: 06-11-2007
IP: Logged
icon Re: Another weird thing... (+3)  
Think I've finally tracked down the logic thread behind this.

There's two important variables regarding sword use: bSwordSheathed and bNoSword.

bNoSword is used by Disarm Tokens, and is toggled on the player and then all his doubles are set to what the player's bNoSword status.

bSwordSheathed is more general use, and it's set in a variety of circumstances. But normally for Player Doubles, it's set if they're standing on Oremites only.

On their turn, player doubles will use the subroutine SetSwordSheathed, which is primarily based around bSwordSheathed and whether to turn it on or off. Clones do the exact same things as Mimics do here... but they also check something more. They check if any of the following is true:
* The player is in a player role that does not carry a sword.
* The player has had bSwordOff set to true. This is based around the script command "Set player sword On/Off".
* The player currently has bNoSword (Disarm Token) set.

If any of the following is true, the clone will set its bSwordSheathed to true.

So what happens is that the Mimics haven't set bSwordSheathed (correctly, because they're not on Oremites), but the Clone has. Movement order then plays a factor here: your Mimic steps on the Disarm Token *after* the Clone has moved (and already called SetSwordSheathed). The Clone won't run that routine - and thus turn off its bSwordSheathed setting - until the next turn. But the Mimics were only using bNoSword, so their weapon comes back by the end of the turn.

Anyways, not sure how best to fix that, since the *underlying* cause is some confusion in variable use there. An easy fix would just be to recall SetSwordSheathed for all doubles in the SwordDisarm case in CDbRoom::ActivateToken, though.

EDIT: A better fix would probably revolve around moving some of those checks into HasSword, but I haven't verified that everything ideally checks the right things already. As stated, it's a confusing series of variables and functions, and it's going to take some work to pick it apart properly.

[Last edited by TFMurphy at 10-13-2007 10:54 PM]
10-13-2007 at 10:45 PM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
Rheb
Level: Smitemaster
Avatar
Rank Points: 1211
Registered: 08-04-2006
IP: Logged

File: Bug.hold (1 KB)
Downloaded 25 times.
License: Public Domain
icon Re: Another weird thing... (0)  
Here's another weird behaviour I found. I'm not sure if it's a bug, but I really don't want to end up in another Troshian Tower scenario... :P

(Just walk down.)

____________________________
Voligner is my very own DROD-like game. Please check it out!

[Last edited by Rheb at 10-14-2007 12:47 PM]
10-14-2007 at 12:47 PM
View Profile Send Private Message to User Send Email to User Show all user's posts High Scores This architect's holds Quote Reply
mrimer
Level: Legendary Smitemaster
Avatar
Rank Points: 5056
Registered: 02-04-2003
IP: Logged
icon Re: Another weird thing... (0)  
TFMurphy wrote:
EDIT: A better fix would probably revolve around moving some of those checks into HasSword, but I haven't verified that everything ideally checks the right things already. As stated, it's a confusing series of variables and functions, and it's going to take some work to pick it apart properly.
If you feel like rewriting any of this code for better readability/maintainability, I don't have any problems with it adding these changes.

____________________________
Gandalf? Yes... That's what they used to call me.
Gandalf the Grey. That was my name.
I am Gandalf the White.
And I come back to you now at the turn of the tide.
10-14-2007 at 05:57 PM
View Profile Send Private Message to User Send Email to User Show all user's posts High Scores This architect's holds Quote Reply
TFMurphy
Level: Smitemaster
Rank Points: 3117
Registered: 06-11-2007
IP: Logged
icon Re: Another weird thing... (+2)  
Rheb wrote:
Here's another weird behaviour I found. I'm not sure if it's a bug, but I really don't want to end up in another Troshian Tower scenario... :P

Still not a bug, I'm afraid. It's back down to movement order.

For a sword to register a hit, the entity with the sword must have it at the end of their move. (The only exception is the Player in some rather unique circumstances.) A Mimic moving onto a Disarm Token would lose their sword (a little like stepping on Oremites) and thus not kill the roach. Getting their sword back before the end of the turn (but after they've already made their move) doesn't give them an extra hit.

mrimer wrote:
If you feel like rewriting any of this code for better readability/maintainability, I don't have any problems with it adding these changes.

Yeah, I'll probably try mapping out how things go together during the week and see if I can come up with anything.




[Last edited by TFMurphy at 10-14-2007 07:58 PM]
10-14-2007 at 07:56 PM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
Rheb
Level: Smitemaster
Avatar
Rank Points: 1211
Registered: 08-04-2006
IP: Logged

File: Bug.hold (1.4 KB)
Downloaded 21 times.
License: Public Domain
icon Re: Another weird thing... (0)  
I'm not sure if this is exactly what you're working on (I'm not very good at these things:blush ). But there's some difference between a decoy/mimic that's already placed, and a decoy/mimic you place.

____________________________
Voligner is my very own DROD-like game. Please check it out!
10-16-2007 at 08:40 PM
View Profile Send Private Message to User Send Email to User Show all user's posts High Scores This architect's holds Quote Reply
TFMurphy
Level: Smitemaster
Rank Points: 3117
Registered: 06-11-2007
IP: Logged
icon Re: Another weird thing... (+1)  
Heh.

Sorry. Movement order again.

Starting with no sword, Beethro moves north. He steps on a disarm token. All player doubles regain their sword.

Decoy #1 (#1 in Monster Movement Order, since it's a Player Double and you put it in the room first) has a sword, and if it's resting on an adder, the adder dies.

The Mimic (#2 in Monster Movement Order, since it's a Player Double and you put it in the room second) follows Beethro's move, and steps on his own disarm token. All player doubles lose their sword.

Decoy #2 (#3 in Monster Movement Order, since it's a Player Double and Beethro places it in the room after the first two are already there) no longer has a sword. He can't kill anything.

So yeah, no bug there.

[Last edited by TFMurphy at 10-16-2007 08:55 PM]
10-16-2007 at 08:54 PM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
New Topic New Poll Post Reply
Caravel Forum : DROD Boards : Bugs : Another weird thing... (Also around disarm tokens.)
Surf To:


Forum Rules:
Can I post a new topic? No
Can I reply? No
Can I read? Yes
HTML Enabled? No
UBBC Enabled? Yes
Words Filter Enable? No

Contact Us | CaravelGames.com

Powered by: tForum tForumHacks Edition b0.98.8
Originally created by Toan Huynh (Copyright © 2000)
Enhanced by the tForumHacks team and the Caravel team.