1 /*
2 #include "actor.h"
3 #include "info.h"
4 #include "m_random.h"
5 #include "s_sound.h"
6 #include "p_local.h"
7 #include "p_enemy.h"
8 #include "a_action.h"
9 #include "gstrings.h"
10 #include "thingdef/thingdef.h"
11 */
12 
13 static FRandom pr_wizatk3 ("WizAtk3");
14 
15 //----------------------------------------------------------------------------
16 //
17 // PROC A_GhostOff
18 //
19 //----------------------------------------------------------------------------
20 
DEFINE_ACTION_FUNCTION(AActor,A_GhostOff)21 DEFINE_ACTION_FUNCTION(AActor, A_GhostOff)
22 {
23 	self->RenderStyle = STYLE_Normal;
24 	self->flags3 &= ~MF3_GHOST;
25 }
26 
27 //----------------------------------------------------------------------------
28 //
29 // PROC A_WizAtk1
30 //
31 //----------------------------------------------------------------------------
32 
DEFINE_ACTION_FUNCTION(AActor,A_WizAtk1)33 DEFINE_ACTION_FUNCTION(AActor, A_WizAtk1)
34 {
35 	A_FaceTarget (self);
36 	CALL_ACTION(A_GhostOff, self);
37 }
38 
39 //----------------------------------------------------------------------------
40 //
41 // PROC A_WizAtk2
42 //
43 //----------------------------------------------------------------------------
44 
DEFINE_ACTION_FUNCTION(AActor,A_WizAtk2)45 DEFINE_ACTION_FUNCTION(AActor, A_WizAtk2)
46 {
47 	A_FaceTarget (self);
48 	self->alpha = HR_SHADOW;
49 	self->RenderStyle = STYLE_Translucent;
50 	self->flags3 |= MF3_GHOST;
51 }
52 
53 //----------------------------------------------------------------------------
54 //
55 // PROC A_WizAtk3
56 //
57 //----------------------------------------------------------------------------
58 
DEFINE_ACTION_FUNCTION(AActor,A_WizAtk3)59 DEFINE_ACTION_FUNCTION(AActor, A_WizAtk3)
60 {
61 	AActor *mo;
62 
63 	CALL_ACTION(A_GhostOff, self);
64 	if (!self->target)
65 	{
66 		return;
67 	}
68 	S_Sound (self, CHAN_WEAPON, self->AttackSound, 1, ATTN_NORM);
69 	if (self->CheckMeleeRange())
70 	{
71 		int damage = pr_wizatk3.HitDice (4);
72 		int newdam = P_DamageMobj (self->target, self, self, damage, NAME_Melee);
73 		P_TraceBleed (newdam > 0 ? newdam : damage, self->target, self);
74 		return;
75 	}
76 	const PClass *fx = PClass::FindClass("WizardFX1");
77 	mo = P_SpawnMissile (self, self->target, fx);
78 	if (mo != NULL)
79 	{
80 		P_SpawnMissileAngle(self, fx, mo->angle-(ANG45/8), mo->velz);
81 		P_SpawnMissileAngle(self, fx, mo->angle+(ANG45/8), mo->velz);
82 	}
83 }
84