2008-09-15 14:11:05 +00:00
|
|
|
/*
|
2006-02-24 04:48:15 +00:00
|
|
|
#include "actor.h"
|
|
|
|
#include "a_action.h"
|
|
|
|
#include "a_strifeglobal.h"
|
|
|
|
#include "m_random.h"
|
|
|
|
#include "p_local.h"
|
|
|
|
#include "s_sound.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
|
|
|
|
|
|
|
// Loremaster (aka Priest) --------------------------------------------------
|
|
|
|
|
|
|
|
class ALoreShot : public AActor
|
|
|
|
{
|
2008-08-06 22:59:24 +00:00
|
|
|
DECLARE_CLASS (ALoreShot, AActor)
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
2015-01-24 13:04:06 +00:00
|
|
|
int DoSpecialDamage (AActor *victim, int damage, FName damagetype);
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
2008-08-06 22:59:24 +00:00
|
|
|
IMPLEMENT_CLASS (ALoreShot)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2015-01-24 13:04:06 +00:00
|
|
|
int ALoreShot::DoSpecialDamage (AActor *victim, int damage, FName damagetype)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2007-02-24 12:09:36 +00:00
|
|
|
|
2015-01-24 13:04:06 +00:00
|
|
|
if (victim != NULL && target != NULL && !(victim->flags7 & MF7_DONTTHRUST))
|
2007-02-24 12:09:36 +00:00
|
|
|
{
|
2016-01-19 10:50:07 +00:00
|
|
|
fixedvec3 fixthrust = victim->Vec3To(target);
|
|
|
|
TVector3<double> thrust(fixthrust.x, fixthrust.y, fixthrust.z);
|
|
|
|
|
2007-02-24 12:09:36 +00:00
|
|
|
thrust.MakeUnit();
|
2016-01-19 10:50:07 +00:00
|
|
|
thrust *= double((255*50*FRACUNIT) / (victim->Mass ? victim->Mass : 1));
|
2007-02-24 12:09:36 +00:00
|
|
|
|
2015-01-24 13:04:06 +00:00
|
|
|
victim->velx += fixed_t(thrust.X);
|
|
|
|
victim->vely += fixed_t(thrust.Y);
|
|
|
|
victim->velz += fixed_t(thrust.Z);
|
2007-02-24 12:09:36 +00:00
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
return damage;
|
|
|
|
}
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_LoremasterChain)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2010-02-12 06:04:57 +00:00
|
|
|
PARAM_ACTION_PROLOGUE;
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
S_Sound (self, CHAN_BODY, "loremaster/active", 1, ATTN_NORM);
|
2016-01-19 10:50:07 +00:00
|
|
|
Spawn("LoreShot2", self->Pos(), ALLOW_REPLACE);
|
|
|
|
Spawn("LoreShot2", self->Vec3Offset(-(self->velx >> 1), -(self->vely >> 1), -(self->velz >> 1)), ALLOW_REPLACE);
|
|
|
|
Spawn("LoreShot2", self->Vec3Offset(-self->velx, -self->vely, -self->velz), ALLOW_REPLACE);
|
2010-02-12 06:04:57 +00:00
|
|
|
return 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|