2008-09-15 14:11:05 +00:00
|
|
|
/*
|
2006-02-24 04:48:15 +00:00
|
|
|
#include "actor.h"
|
|
|
|
#include "info.h"
|
|
|
|
#include "m_random.h"
|
|
|
|
#include "s_sound.h"
|
|
|
|
#include "p_local.h"
|
|
|
|
#include "a_action.h"
|
|
|
|
#include "a_sharedglobal.h"
|
|
|
|
#include "gstrings.h"
|
2008-08-10 20:48:55 +00:00
|
|
|
#include "thingdef/thingdef.h"
|
2008-09-15 14:11:05 +00:00
|
|
|
*/
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
static FRandom pr_dripblood ("DripBlood");
|
|
|
|
static FRandom pr_knightatk ("KnightAttack");
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC A_DripBlood
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_DripBlood)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
AActor *mo;
|
|
|
|
fixed_t x, y;
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
x = self->x + (pr_dripblood.Random2 () << 11);
|
|
|
|
y = self->y + (pr_dripblood.Random2 () << 11);
|
|
|
|
mo = Spawn ("Blood", x, y, self->z, ALLOW_REPLACE);
|
2009-06-30 20:57:51 +00:00
|
|
|
mo->velx = pr_dripblood.Random2 () << 10;
|
|
|
|
mo->vely = pr_dripblood.Random2 () << 10;
|
2007-01-20 14:27:44 +00:00
|
|
|
mo->gravity = FRACUNIT/8;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC A_KnightAttack
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_KnightAttack)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
if (!self->target)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2008-08-10 20:48:55 +00:00
|
|
|
if (self->CheckMeleeRange ())
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
int damage = pr_knightatk.HitDice (3);
|
2008-08-10 20:48:55 +00:00
|
|
|
P_DamageMobj (self->target, self, self, damage, NAME_Melee);
|
|
|
|
P_TraceBleed (damage, self->target, self);
|
|
|
|
S_Sound (self, CHAN_BODY, "hknight/melee", 1, ATTN_NORM);
|
2006-02-24 04:48:15 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
// Throw axe
|
2008-08-10 20:48:55 +00:00
|
|
|
S_Sound (self, CHAN_BODY, self->AttackSound, 1, ATTN_NORM);
|
|
|
|
if (self->flags & MF_SHADOW || pr_knightatk () < 40)
|
2006-02-24 04:48:15 +00:00
|
|
|
{ // Red axe
|
2008-08-10 20:48:55 +00:00
|
|
|
P_SpawnMissileZ (self, self->z + 36*FRACUNIT, self->target, PClass::FindClass("RedAxe"));
|
2006-02-24 04:48:15 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
// Green axe
|
2008-08-10 20:48:55 +00:00
|
|
|
P_SpawnMissileZ (self, self->z + 36*FRACUNIT, self->target, PClass::FindClass("KnightAxe"));
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|