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 "p_enemy.h"
|
|
|
|
#include "a_action.h"
|
|
|
|
#include "a_sharedglobal.h"
|
|
|
|
#include "gstrings.h"
|
|
|
|
|
|
|
|
static FRandom pr_dripblood ("DripBlood");
|
|
|
|
static FRandom pr_knightatk ("KnightAttack");
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC A_DripBlood
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void A_DripBlood (AActor *actor)
|
|
|
|
{
|
|
|
|
AActor *mo;
|
|
|
|
fixed_t x, y;
|
|
|
|
|
|
|
|
x = actor->x + (pr_dripblood.Random2 () << 11);
|
|
|
|
y = actor->y + (pr_dripblood.Random2 () << 11);
|
2006-11-29 10:03:35 +00:00
|
|
|
mo = Spawn ("Blood", x, y, actor->z, ALLOW_REPLACE);
|
2006-02-24 04:48:15 +00:00
|
|
|
mo->momx = pr_dripblood.Random2 () << 10;
|
|
|
|
mo->momy = 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
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void A_KnightAttack (AActor *actor)
|
|
|
|
{
|
|
|
|
if (!actor->target)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (actor->CheckMeleeRange ())
|
|
|
|
{
|
|
|
|
int damage = pr_knightatk.HitDice (3);
|
2006-10-31 14:53:21 +00:00
|
|
|
P_DamageMobj (actor->target, actor, actor, damage, NAME_Melee);
|
2006-02-24 04:48:15 +00:00
|
|
|
P_TraceBleed (damage, actor->target, actor);
|
|
|
|
S_Sound (actor, CHAN_BODY, "hknight/melee", 1, ATTN_NORM);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// Throw axe
|
2008-06-15 02:25:09 +00:00
|
|
|
S_Sound (actor, CHAN_BODY, actor->AttackSound, 1, ATTN_NORM);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (actor->flags & MF_SHADOW || pr_knightatk () < 40)
|
|
|
|
{ // Red axe
|
2008-07-21 17:03:30 +00:00
|
|
|
P_SpawnMissileZ (actor, actor->z + 36*FRACUNIT, actor->target, PClass::FindClass("RedAxe"));
|
2006-02-24 04:48:15 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
// Green axe
|
2008-07-21 17:03:30 +00:00
|
|
|
P_SpawnMissileZ (actor, actor->z + 36*FRACUNIT, actor->target, PClass::FindClass("KnightAxe"));
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|