1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
/**
Shrapnel
Fragment of the iron bomb.
@author Ringwaul
*/
public func ProjectileDamage() { return 3; }
public func TumbleStrength() { return 100; }
public func FlightTime() { return 4; }
protected func Initialize()
{
SetAction("Flight");
AddEffect("Fade", this, 1, 1, this);
}
public func Launch(int shooter)
{
SetController(shooter);
AddEffect("HitCheck", this, 1, 1, nil, nil);
}
protected func FxFadeTimer(object target, proplist effect, int timer)
{
if (timer > FlightTime())
RemoveObject();
return FX_OK;
}
protected func Hit()
{
ShakeFree(6);
RemoveEffect("HitCheck", this);
Sound("Objects::Weapons::Blunderbuss::BulletHitGround?");
CreateParticle("StarSpark", 0, 0, PV_Random(-20, 20), PV_Random(-20, 20), PV_Random(10, 20), Particles_Glimmer(), 3);
return RemoveObject();
}
public func HitObject(object obj)
{
Sound("Hits::ProjectileHitLiving?");
if (WeaponCanHit(obj))
{
obj->~OnProjectileHit(this);
WeaponDamage(obj, this->ProjectileDamage(), FX_Call_EngObjHit);
WeaponTumble(obj, this->TumbleStrength());
}
return RemoveObject();
}
public func TrailColor(int time)
{
return RGBa(100, 100, 100, 240 * Max(0, FlightTime() - time) / FlightTime());
}
local ActMap = {
Fly = {
Prototype = Action,
Name = "Fly",
Procedure = DFA_FLIGHT,
NextAction = "Fly",
Delay = 1,
Length = 1,
}
};
|