A_Srcr2Decide

From ZDoom Wiki
Jump to navigation Jump to search

A_Srcr2Decide
(no parameters)

Decides if the calling actor teleports or not. The probability a teleportation happens increases as the actor's health decreases:

Health fraction Hit point range Teleportation chance
8/8 or more 3500+ 0%
7/8 3063—3499 6.25%
6/8 2625—3062 12.5%
4/8 1750—2624 25%
1/8 438—1749 46.875%
Less than 1/8 1—437 75%

The hit point range is indicative only, corresponding to the results for D'Sparil's standard starting health of 3500. The function itself uses fractions of the actor's spawning health, whatever that is.

If the actor does teleport, then a BossSpot at least 128 map units away is randomly selected, if available. If no such spots are available, the teleportation is cancelled. Otherwise, the calling actor is teleported to the spot and in its stead a Sorcerer2Telefade is spawned. Both the calling actor and the spawned telefade actor play the "misc/teleport" on their respective BODY channels, the calling actor's velocity is annuled and it is put in its Teleport state.

This codepointer is restricted to Sorcerer2 and derived classes.