Lost soul charging backwards

When hit by an attack, a lost soul that is charging will drift slowly away from the direction of the attack while remaining rather helplessly in its own attack state. This is, firstly, because the attack on the lost soul cancels out the forward motion of its charge. Secondly, since the lost soul 'floats', it will persistently drift away from the effect of the attack, rather than merely be pushed a short and limited distance.

Once commenced, the 'repulsed charging' will stop when:


 * The lost soul is hit by a different attacker, which becomes its new target.
 * The lost soul is stopped by an impassable or monster-blocking linedef.
 * The lost soul is stopped by a thing that is an 'obstacle' or by a collectible item.
 * The target of the lost soul, the one that caused the effect, is destroyed.

In the third case, if the object struck has hit points, it receives the normal attack damage (no matter which direction the lost soul is facing).

This behavior is caused by special coding in. When a lost soul starts charging, it has the flag set. A mobj that is damaged and that has this flag set has its momentum reduced to zero:

if ( target->flags & MF_SKULLFLY ) { 	target->momx = target->momy = target->momz = 0; }

Later in the function, the lost soul gets its momentum adjusted a bit as every damaged mobj is thrust away by the attack, depending on damage dealt and the mobj's mass (unless the damage was inflicted by a chainsaw. This part of the code is not specific to lost souls.

The second part of the special coding for charging lost souls in prevents the lost soul from getting put into its normal pain state, as if it had zero pain chance. if ( (P_Random < target->info->painchance) 	 && !(target->flags&MF_SKULLFLY) ) { 	target->flags |= MF_JUSTHIT;	// fight back! P_SetMobjState (target, target->info->painstate); }

The combination of these two special coding makes it so that a lost soul that is damaged during a charge stays in a charge, and therefore has to wait until it collides with something to start performing any new action, while being robbed of its original momentum.