TFMurphy
Level: Smitemaster
Rank Points: 3117
Registered: 06-11-2007
IP: Logged
|
Re: Slayer logic bug (+3)
Okay, after getting a bit more info from Someone Else on chat (since the demo did not demonstrate exactly what he wanted to show), I see what part of the code is doing this. It is, however, deliberate, so I don't think we'll be changing it.
Essentially, the Slayer has a bunch of defensive checks, but it won't run most of them if the Slayer is the following are both true:
1) The Slayer is more than 4 tiles away from the Player's Sword.
2) The number of turns it would take for the Slayer to face the player (via ArcTan1/2 method, so 10 tiles S and 1 tile W is treated as south) is less than the distance the Slayer is from the Player's Sword minus 2.
So in this case, where the Slayer is far enough away to feel safe, he will Extend the Wisp. This happens as usual. Now, since the Wisp is attached to the player, he makes a move to Advance along the Wisp.
However, there's one more defensive check to make. The Slayer considers the step he's about to take along the wisp. If, in the new position, the number of turns it would take the Slayer to face the player (using Sign method, so 10 tiles S and 1 tile W is treated as southwest) is greater than the distance from the Player's Sword minus 2, then the Slayer will *not* move along the Wisp, and will instead turn to face the player.
So in the example hold, the Slayer is 5 tiles away from the player's sword, and would need to take 2 turns to face south towards the player (which is less than the 5-2 calculation he makes), so he will want to extend the Wisp. The Wisp attaches itself to the player, so the Slayer will now want to advance along it. The next path along the Wisp is south, at which point he will be 4 tiles away from the player's sword, and would need to take 3 turns to face SW towards the player (which is greater than the 4-2 calculation he makes), so instead of advancing along the wisp at the same time as he's extending it, he will make a defensive move.
===
Considering he could already extend the wisp and *move* along it, this isn't a big thing. The only difference here is that he's considering a defensive move *along* the wisp, after having already considered defensive moves from his current position.
|