Esempio n. 1
0
        void OnAttack(Character attacker, Character target, HitDefinition hitdef, Boolean blocked)
        {
            if (attacker == null)
            {
                throw new ArgumentNullException("attacker");
            }
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }
            if (hitdef == null)
            {
                throw new ArgumentNullException("hitdef");
            }

            target.DefensiveInfo.OnHit(hitdef, attacker, blocked);

            HitDefinition myhitdef = target.DefensiveInfo.HitDef;

            attacker.OffensiveInfo.OnHit(myhitdef, target, blocked);

            SetFacing(attacker, target, myhitdef);

            if (blocked == false)
            {
                DoEnvShake(myhitdef, attacker.Engine.EnvironmentShake);
                PlaySound(attacker, target, myhitdef.HitSoundId, myhitdef.PlayerSound);
                MakeSpark(attacker, target, myhitdef.SparkAnimation, myhitdef.SparkStartPosition, myhitdef.PlayerSpark);
            }
            else
            {
                PlaySound(attacker, target, myhitdef.GuardSoundId, myhitdef.GuardPlayerSound);
                MakeSpark(attacker, target, myhitdef.GuardSparkAnimation, myhitdef.SparkStartPosition, myhitdef.GuardPlayerSpark);
            }

            HitOverride hitoverride = target.DefensiveInfo.GetOverride(myhitdef);

            if (hitoverride != null)
            {
                if (hitoverride.ForceAir == true)
                {
                    myhitdef.Fall = true;
                }

                target.StateManager.ForeignManager = null;
                target.StateManager.ChangeState(hitoverride.StateNumber);
            }
            else
            {
                if (blocked == false)
                {
                    OnAttackHit(attacker, target, myhitdef);
                }
                else
                {
                    OnAttackBlock(attacker, target, myhitdef);
                }
            }
        }
Esempio n. 2
0
        void OnAttack(Projectile projectile, Character target, HitDefinition hitdef, Boolean blocked)
        {
            if (projectile == null)
            {
                throw new ArgumentNullException("projectile");
            }
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }
            if (hitdef == null)
            {
                throw new ArgumentNullException("hitdef");
            }

            Character attacker = projectile.Creator;

            target.DefensiveInfo.OnHit(hitdef, projectile.Creator, blocked);

            hitdef = target.DefensiveInfo.HitDef;

            projectile.TotalHits   += 1;
            projectile.HitCountdown = projectile.Data.TimeBetweenHits;

            if (blocked == true)
            {
                attacker.BasePlayer.Power += hitdef.P1GuardPowerAdjustment;
                attacker.BasePlayer.OffensiveInfo.ProjectileInfo.Set(projectile.Data.ProjectileId, ProjectileDataType.Guarded);

                projectile.HitPauseCountdown = hitdef.GuardPauseTime;

                PlaySound(attacker, target, hitdef.GuardSoundId, hitdef.GuardPlayerSound);
                MakeSpark(projectile, target, hitdef.GuardSparkAnimation, hitdef.SparkStartPosition, hitdef.GuardPlayerSpark);
            }
            else
            {
                attacker.BasePlayer.Power += hitdef.P1HitPowerAdjustment;
                attacker.BasePlayer.OffensiveInfo.ProjectileInfo.Set(projectile.Data.ProjectileId, ProjectileDataType.Hit);

                projectile.HitPauseCountdown = hitdef.PauseTime;

                DoEnvShake(hitdef, attacker.Engine.EnvironmentShake);
                PlaySound(attacker, target, hitdef.HitSoundId, hitdef.PlayerSound);
                MakeSpark(projectile, target, hitdef.SparkAnimation, hitdef.SparkStartPosition, hitdef.PlayerSpark);
            }

            HitOverride hitoverride = target.DefensiveInfo.GetOverride(hitdef);

            if (hitoverride != null)
            {
                if (hitoverride.ForceAir == true)
                {
                    hitdef.Fall = true;
                }

                target.StateManager.ForeignManager = null;
                target.StateManager.ChangeState(hitoverride.StateNumber);
            }
            else
            {
                if (blocked == false)
                {
                    OnAttackHit(attacker, target, hitdef);
                }
                else
                {
                    OnAttackBlock(attacker, target, hitdef);
                }
            }
        }