public void Run()
        {
            Random random  = new Random();
            var    world   = Origin.GetWorld();
            var    alive   = Target.GetBehavior <BehaviorAlive>();
            var    grapple = Origin.GetBehavior <BehaviorGrapplingHook>();

            Target.GetFlashHelper()?.AddFlash(ColorMatrix.Flat(Color.White), 20);
            Target.GetShakeHelper()?.AddShakeRandom(3, LerpHelper.QuadraticOut, 30);

            if (!Target.IsHeartless())
            {
                var delta = Vector2.Normalize(Origin.GetVisualTarget() - Target.GetVisualTarget());
                alive.SetDamage(alive.HP);
                SkillUtil.CreateSpatter(world, Target.GetVisualTarget(), 5, delta * 24, 2, Random);

                if (grapple != null)
                {
                    grapple.HasHeart = true;
                }
                if (Origin == world.PlayerCurio)
                {
                    world.RunStats.HeartsRipped += 1;
                }
                Blood.Play(1, 0, 0);
                new TimeFade(world, 0.01f, LerpHelper.ExponentialIn, 60);
                Behavior.Apply(new BehaviorHeartless(Target));
            }
        }
Ejemplo n.º 2
0
        public void Run()
        {
            Random random    = new Random();
            var    world     = Origin.GetWorld();
            var    alive     = Target.GetBehavior <BehaviorAlive>();
            var    sword     = Origin.GetBehavior <BehaviorSword>();
            var    bloodfire = Origin.GetBehavior <BehaviorSkillBloodfireBlade>();

            bloodfire.Extinguish();

            new TimeFade(world, 0.05f, LerpHelper.ExponentialIn, 40);

            Target.GetFlashHelper()?.AddFlash(ColorMatrix.Flat(Color.White), 5);
            Target.GetShakeHelper()?.AddShakeRandom(3, LerpHelper.QuadraticOut, 5);
            new HitStop(world, 0, 5);

            alive.SetDamage(alive.HP);

            Target.GetFlashHelper()?.AddFlash(ColorMatrix.Translate(new Color(255, 64, 16)), LerpHelper.Invert(LerpHelper.QuadraticOut), (int)ExplosionTime.EndTime, false);
            Target.GetShakeHelper()?.AddShakeRandom(3, LerpHelper.Invert(LerpHelper.QuadraticOut), (int)ExplosionTime.EndTime, false);

            if (alive.CurrentDead)
            {
                if (Origin == world.PlayerCurio)
                {
                    world.RunStats.Kills += 1;
                }
            }

            if (sword != null)
            {
                sword.HasBlood = false;
            }
        }
Ejemplo n.º 3
0
        public void Run()
        {
            Random random = new Random();
            var    world  = Origin.GetWorld();
            var    alive  = Target.GetBehavior <BehaviorAlive>();
            var    sword  = Origin.GetBehavior <BehaviorSword>();

            Target.GetFlashHelper()?.AddFlash(ColorMatrix.Flat(Color.White), 20);
            Target.GetShakeHelper()?.AddShakeRandom(3, LerpHelper.QuadraticOut, 30);

            if (!Target.IsHeartless())
            {
                alive.SetDamage(alive.HP);
                SkillUtil.CreateSpatter(world, Target.GetVisualTarget(), 5, Util.AngleToVector(sword.Angle) * 24, 2, Random);

                if (sword != null)
                {
                    sword.HasBlood = true;
                    sword.HasHeart = true;
                }
                if (Origin == world.PlayerCurio)
                {
                    world.RunStats.HeartsRipped += 1;
                }
                Blood.Play(1, 0.5f, 0);
                Behavior.Apply(new BehaviorHeartless(Target));
            }
        }
Ejemplo n.º 4
0
        public override void Activate(Creature creature)
        {
            var damageSpark = SpriteLoader.Instance.AddSprite("content/damage_spark");

            creature.FlashHelper.AddFlash(ColorMatrix.Flat(Color.White), 5);

            if (creature == World.Player)
            {
                new ScreenShakeRandom(World, 2, 5, LerpHelper.QuadraticIn);
                new ScreenFlashSimple(World, ColorMatrix.Flat(Color.IndianRed, 0.25f), LerpHelper.Linear, 5);
            }

            for (int i = 0; i < 4; i++)
            {
                new ParticleSpark(World, 20)
                {
                    Sprite       = damageSpark,
                    Position     = creature.VisualTarget,
                    Target       = creature.VisualTarget + Util.AngleToVector(MathHelper.PiOver4 + i * MathHelper.PiOver2) * 240,
                    VelocityLerp = LerpHelper.QuadraticOut,
                    Angle        = i * MathHelper.PiOver2,
                    Color        = new Color(192, 64, 192),
                    ColorEnd     = new Color(64, 128, 255),
                    ColorLerp    = LerpHelper.QuadraticOut,
                    Pass         = DrawPass.EffectAdditive,
                };
            }
        }
Ejemplo n.º 5
0
        public override IEnumerable <Wait> RoutineDie(Vector2 dir)
        {
            var pos = new Vector2(Tile.X * 16, Tile.Y * 16);

            VisualPosition = Slide(pos, pos + new Vector2(dir.X * 8, dir.Y * 8), LerpHelper.Linear, 20);
            VisualPose     = Static(CreaturePose.Stand);
            VisualColor    = SoftFlash(ColorMatrix.Identity, ColorMatrix.Flat(Color.White), LerpHelper.QuadraticOut, 10);
            DeadWait       = new WaitTime(200);
            yield return(Scheduler.Instance.RunAndWait(RoutineOpenWing(0.8f, 50, LerpHelper.Quadratic)));

            new BossExplosion(World, this, (position, velocity, angle, time) => new FireExplosion(World, position, velocity, angle, time));
        }
Ejemplo n.º 6
0
        public void Run()
        {
            Random random = new Random();
            var    world  = Origin.GetWorld();
            var    alive  = Target.GetBehavior <BehaviorAlive>();

            Target.GetFlashHelper()?.AddFlash(ColorMatrix.Flat(Color.White), 20);
            Target.GetShakeHelper()?.AddShakeRandom(3, LerpHelper.QuadraticOut, 30);
            new HitStop(world, 0, 5);
            new ScreenShakeRandom(world, 10, 10, LerpHelper.QuadraticOut);
            new ScreenFlashSimple(world, ColorMatrix.Greyscale() * ColorMatrix.Tint(new Color(215, 63, 36)), LerpHelper.QuadraticOut, 10);
            HitSound.Play(1, Random.NextFloat(-0.5f, +0.5f), 0);

            alive.TakeDamage(Damage);
        }
Ejemplo n.º 7
0
        public void Run()
        {
            Random random = new Random();
            var    world  = Origin.GetWorld();
            var    sword  = Origin.GetBehavior <BehaviorSword>();

            Target.GetFlashHelper()?.AddFlash(ColorMatrix.Flat(Color.White), 20);
            Target.GetShakeHelper()?.AddShakeRandom(3, LerpHelper.QuadraticOut, 30);
            new HitStop(world, 0, 5);
            HitSound.Play(1f, Random.NextFloat(-0.3f, +0.3f), 0);

            if (sword != null)
            {
                sword.HasBlood = true;
            }
        }
Ejemplo n.º 8
0
        public void Tick(SceneGame scene)
        {
            var  orientable = Origin.GetBehavior <BehaviorOrientable>();
            var  grapple    = Origin.GetBehavior <BehaviorGrapplingHook>();
            bool shouldReel = !GrappleTime.Done;

            GrappleTime += scene.TimeModCurrent;
            if (GrappleTime.Done)
            {
                var tile     = Target.GetMainTile();
                var offset   = (-Direction).ToTileOffset();
                var neighbor = tile.GetNeighborOrNull(offset.X, offset.Y);

                if (shouldReel)
                {
                    var player = Origin.GetBehavior <BehaviorPlayer>();
                    var camera = Origin.GetCamera();

                    if (neighbor != null && !neighbor.IsSolid())
                    {
                        Origin.MoveTo(neighbor, LerpHelper.CubicOut, ReelTime);
                        camera?.MoveTo(neighbor, LerpHelper.QuadraticOut, ReelTime);
                        grapple.ReelTowards(Target.GetVisualTarget(), ReelTime);
                    }
                    else
                    {
                        grapple.ReelIn(Target.GetVisualTarget(), LerpHelper.QuadraticIn, ReelTime);
                        grapple.OrientTo(-3, LerpHelper.ExponentialOut, ReelTime);
                    }
                    SoundSwish.Play(1, 0, 0);
                }
                bool shouldGrip = !ReelTime.Done;
                ReelTime += scene.TimeModCurrent;
                if (ReelTime.Done && shouldGrip && neighbor != null && !neighbor.IsSolid())
                {
                    Origin.GetFlashHelper()?.AddFlash(ColorMatrix.Flat(Color.White), 5);
                    grapple.GripDirection = offset;
                    orientable.OrientTo(Util.VectorToAngle(offset.ToVector2()));
                    SoundClack.Play(1, -1.0f, 0);
                }
            }
        }
Ejemplo n.º 9
0
        public override void Activate(Creature creature)
        {
            var particle = SpriteLoader.Instance.AddSprite("content/rock");

            for (int i = 0; i < 12; i++)
            {
                float angle       = Random.NextFloat() * MathHelper.TwoPi;
                float distance    = 4 + Random.NextFloat() * 12;
                int   time        = Random.Next(10) + 10;
                var   iceParticle = new ParticleThrow(World, particle, creature.VisualTarget + Util.AngleToVector(angle) * 2, creature.VisualTarget + Util.AngleToVector(angle) * distance, 4 + Random.NextFloat() * 8, LerpHelper.Linear, LerpHelper.QuadraticOut, time, 0.7f)
                {
                    SubImage    = Random.Next(particle.SubImageCount),
                    Angle       = Random.NextAngle(),
                    ColorMatrix = ColorMatrix.TwoColorLight(Color.Blue, Color.White),
                    Pass        = DrawPass.EffectAdditive,
                };
            }
            creature.FlashHelper.AddFlash(ColorMatrix.Flat(Color.White), LerpHelper.QuadraticOut, 5);
            creature.FlashHelper.AddFlash(ColorMatrix.TwoColorLight(Color.SkyBlue, Color.White), 10);
        }
Ejemplo n.º 10
0
        public void Run()
        {
            var world = Origin.GetWorld();

            Origin.GetFlashHelper()?.AddFlash(ColorMatrix.Flat(Color.White), 20);
            Origin.GetShakeHelper()?.AddShakeRandom(3, LerpHelper.QuadraticOut, 30);
            SoundImpact.Play(1, Random.NextFloat(-0.5f, +0.5f), 0);
            var alive  = Origin.GetBehavior <BehaviorAlive>();
            var damage = 1;

            if (Collision.IsSpiky())
            {
                SoundSpikes.Play(1, Random.NextFloat(-0.5f, +0.5f), 0);
                damage = 2;
            }
            if (alive != null)
            {
                alive.TakeDamage(damage);
            }
        }
Ejemplo n.º 11
0
        public void Run()
        {
            Random random = new Random();
            var    world  = Origin.GetWorld();
            var    alive  = Target.GetBehavior <BehaviorAlive>();
            var    sword  = Origin.GetBehavior <BehaviorSword>();

            Target.GetFlashHelper()?.AddFlash(ColorMatrix.Flat(Color.White), 20);
            Target.GetShakeHelper()?.AddShakeRandom(3, LerpHelper.QuadraticOut, 30);
            new HitStop(world, 0, 5);
            HitSound.Play(1f, Random.NextFloat(-0.3f, +0.3f), 0);
            SkillUtil.CreateSpatter(world, Target.GetVisualTarget(), Blood, Vector2.Zero, 1, Random);
            if (Score > 0)
            {
                world.AddWorldScore(Score, Target.GetVisualTarget(), ScoreType.Small);
            }

            if (Blood > 0)
            {
                SkillUtil.CreateBloodCircle(world, Target.GetVisualTarget(), 30, 32, Random);
            }

            alive.TakeDamage(Damage);

            if (alive.CurrentDead)
            {
                //DeathSound.Play(1, 0, 0);
                if (Origin == world.PlayerCurio)
                {
                    world.RunStats.Kills += 1;
                }
            }

            if (sword != null && Blood > 0)
            {
                sword.HasBlood = true;
            }
        }
Ejemplo n.º 12
0
 public override void Activate(Creature creature)
 {
     creature.FlashHelper.AddFlash(ColorMatrix.Flat(Color.White), 5);
 }