A_GauntletAttack

From ZDoom Wiki
Jump to navigation Jump to search

A_GauntletAttack (int power)

Shakes the weapon sprites randomly by moving it up to two units to the left and to the bottom. The actual attack depends on whether power is true or not.

In "normal" mode, it performs a melee attack with a wide spread and using GauntletPuff1 as the puff. In "power" mode, the attack has a greater range (up to 256 map units), narrower spread, and using GauntletPuff2 instead. In either mode, the attack deals 2d8 points of damage, but in "power" mode, the player is given half the damage as health (this sum is not affected by any damage factor or armor absorption the target might have).

If the player has no target, there is a 25% chance that the player's extra light intensity (as affected by the A_Light codepointers) is inverted, being set to 0 if it was positive or to 1 if it was null. In addition, the sound "weapons/gauntletson" is played on the AUTO channel, and the function stops here.

If there was a target, it is either the sound "weapons/gauntletshit" (normal mode) or "weapons/gauntletspowhit" (power mode) that is played on the AUTO channel. The weapon flickers randomly when using this codepointer, there is 25% chance the extra light intensity is set to 0, 37.5% that is is set to 1, and 37.5% that it is set to 2. The player using the calling weapon also turns by up to 4.5° to face the target, and is given the MF_JUSTATTACKED flag.

This codepointer is restricted to Gauntlets and derived classes.

Examples

This example is taken straight from the Gauntlets from Heretic.

 Fire:
   GAUN B 4 A_PlayWeaponSound("weapons/gauntletsuse")
   GAUN C 4
   //Intentional fall-through
 Hold:
   GAUN DEF 4 Bright A_GauntletAttack(0)
   GAUN C 4 A_ReFire
   GAUN B 4 A_Light0
   Goto Ready