coppro wrote:
While I don't have the code in front of me, couldn't you just add a virtual method called bSwordOnHalfTurn or something similar to determine whether the hit is processed?
Well, isn't that just the same than a check at the beginning of ProcessSwordHit? The difficulty isn't where to put the main code that bans a sword from hitting - it's deciding how to mark swords that *should* still activate on half-turns. Still, it's possibly a good idea to create a seperate bSwordOnHalfTurn method just to keep the checks self-contained and readable, especially given what checks should be made aren't quite set in stone.
The problem, I think, is that although hasted roles should definitely cause damage on half-turns (and in the patch I wrote, I classed that as the player and his Mimics), there are many places where a sword should still cause damage on a half-turn, simply because it's just appeared and didn't cause damage on the full turn. If the player deploys a Decoy, or a character with a sword appears right on top of a bomb, these really need to be handled.
So the exception is "
when a sword moves to a place it wasn't before"
. There's two ways this can happen: either something with a sword has moved during the half-turn, or a new sword has appeared (either a new role appeared or a sword was unsheathed).
The first (movement) possibly needs to be caught somehow, but I don't know how to do it. More to the point, I can't think of a current way for anything but the player and his mimics to move on a half-turn. Even characters will wait until the next full turn to do move commands. And even if one could without being hasted itself, we'd need a way of checking that they moved during the half-turn. I don't think things like sword orientation or prevX/Y work in this instance, since they don't get updated on half-turns if the monster doesn't move. So perhaps another boolean? Or maybe cross that bridge when we actually come to it....
The second was the one I was trying to focus on: the appearance of a sword where one wasn't before. This means retaining data of what state the sword was at the start of the half-turn or the end of the preceding full-turn. It also means catching things like characters using Appear or AppearAt and placing doubles. I'm not sure I caught all the possibilities though, hence some of the problems.