Example #1
0
        public static void Strike(IDescription d, bool finisher, int stamina, int balance, int damage)
        {
            LivingEntity le = d as LivingEntity;

            if (le != null)
            {
                LivingEntity t = le.Target;
                le.stamina -= stamina;
                t.Hit(le, finisher, balance, damage);
            }
        }
Example #2
0
        public void Hit(Description2D hitter, bool finisher, int balanceDiff, int damage)
        {
            if (this is Enemy)
            {
                this.Target = hitter as LivingEntity;
            }

            LivingEntity leHitter = hitter as LivingEntity;

            if (leHitter != null && ActiveSkill != null)
            {
                if (ActiveSkill.Name == "block")
                {
                    Program.Frame.PlaySound("Sounds.GAME_MENU_SCORE_SFX001755.wav");
                    ActiveSkill.Cooldown();
                    if (balanceDiff != 100)
                    {
                        ActiveSkill = null;
                        health     -= damage;
                        leHitter.animations.Queue(new AnimationChain(AnimationManager.Instance["blocked"].MakeInterruptable().MakePausing()));

                        return;
                    }
                }
                else if (ActiveSkill.Name == "counter")
                {
                    ActiveSkill.Cooldown();
                    leHitter.Hit(this, true, 100, damage);
                    ActiveSkill = null;
                    return;
                }
            }

            Program.Frame.PlaySound("Sounds.GAME_MENU_SCORE_SFX001771.wav");
            this.PreppedSkill = null;
            this.skillActivation?.Reset();
            stun        = 15;
            DrawOffsetX = 0;
            DrawOffsetY = 0;
            if (animations.Any() && animations.Peek().Peek().IsInterruptable())
            {
                animations.Pop();
                combo.Reset();
            }

            ActiveSkill = null;
            health     -= damage;
            balance    -= balanceDiff;
            if (balance <= 0 || IsDead())
            {
                if (animations.Any())
                {
                    animations.Pop();
                }

                if (!IsDead())
                {
                    animations.Push(new AnimationChain(AnimationManager.Instance["getup"].MakeInterruptable().MakePausing()));
                }

                animations.Push(new AnimationChain(AnimationManager.Instance[finisher || IsDead() ? "knockback" : "slideback"].MakeInterruptable().MakePausing()));
                knockbackFrom = hitter.Position;
                stun          = 0;
            }
        }