Example #1
0
        protected override void OnDamage(BaseAspect aspect, Mobile target, ref int damage)
        {
            base.OnDamage(aspect, target, ref damage);

            if (Utility.RandomBool())
            {
                int x = 0, y = 0;

                Movement.Movement.Offset(aspect.GetDirectionTo(target), ref x, ref y);

                var loc = target.Clone3D(x, y, target.Map.GetTopZ(target.Clone2D(x, y)));

                if (target.Map.CanSpawnMobile(loc))
                {
                    ScreenFX.LightFlash.Send(target);

                    target.Location = loc;

                    if (target.PlayDamagedAnimation())
                    {
                        target.PlayHurtSound();
                    }
                }
            }
        }