Пример #1
0
        public override IEnumerable <Wait> RoutineUse(Creature user, object target)
        {
            Wallhach wallhach = user as Wallhach;

            if (target is Creature targetCreature)
            {
                Consume();
                ShowSkill(user);
                var chirality = user.GetStatusEffect <Chirality>();
                chirality?.AddBuildup(-8);
                if (wallhach != null)
                {
                    yield return(Scheduler.Instance.RunAndWait(wallhach.RoutineOpenWing(0.6f, 50, LerpHelper.Quadratic)));
                }
                user.VisualPose = user.FlickPose(CreaturePose.Cast, CreaturePose.Stand, 70);
                if (wallhach != null)
                {
                    Scheduler.Instance.Run(wallhach.RoutineFlashWing(15));
                }
                yield return(user.WaitSome(10));

                int         chiralStacks = user.GetStatusStacks <Chirality>();
                List <Wait> waits        = new List <Wait>();
                int         hands        = chiralStacks + 1;
                hands = 16;
                int timeLeft = hands + 90;
                for (int i = 0; i < hands; i++)
                {
                    List <Vector2> wingPositions = Wallhach.GetWingPositions(user.VisualTarget, 1.0f);
                    Vector2        velocity      = Util.AngleToVector(Random.NextFloat() * MathHelper.TwoPi) * 160;
                    Vector2        emitPos       = wingPositions.Pick(Random);
                    var            bullet        = new MissileHand(user.World, emitPos, targetCreature.VisualTarget, velocity, ColorMatrix.Tint(Color.Goldenrod), 60, timeLeft - i);
                    waits.Add(new WaitBullet(bullet));
                    yield return(user.WaitSome(1));
                }
                yield return(new WaitAll(waits));

                targetCreature.AddStatusEffect(new Wedlock(user)
                {
                    Duration = new Slider(float.PositiveInfinity),
                    Buildup  = 1.0,
                });
                if (wallhach != null)
                {
                    Scheduler.Instance.Run(wallhach.RoutineOpenWing(1f, 50, LerpHelper.Linear));
                }
                yield return(user.WaitSome(50));
            }
        }
Пример #2
0
        private IEnumerable <Wait> RoutineHand(Creature user, Creature target, int hits)
        {
            List <Vector2> wingPositions = Wallhach.GetWingPositions(user.VisualTarget, 1.0f);
            Vector2        velocity      = Util.AngleToVector(Random.NextFloat() * MathHelper.TwoPi) * 160;
            Vector2        emitPos       = wingPositions.Pick(Random);
            int            moveTime      = 30 + Random.Next(30);
            var            bullet        = new MissileHand(user.World, emitPos, target.VisualTarget, velocity, ColorMatrix.Tint(Color.Goldenrod), moveTime, moveTime);

            yield return(new WaitBullet(bullet));

            if (hits % 3 >= 2)
            {
                user.Attack(target, Vector2.Zero, AttackSlap);
            }
        }
Пример #3
0
        public EnemySpawner(SceneGame world, int time)
        {
            World = world;
            World.ActionQueue.Add(new TurnTakerSpawner(World.ActionQueue, this));
            Encounter     = new Slider(time);
            EncounterBoss = new Slider(time);

            BossDatabase.Add(new BossData(this, (tile) =>
            {
                var boss = new EnderErebizo(World);
                boss.MoveTo(tile, 0);
                boss.AddControlTurn();
                return(new[] { boss });
            })
                             .SetSlowChance(data => data.AliveBosses.Count < 2, 0.01)
                             .SetTile(tile => tile.Opaque, tile => {
                var rectangle  = new Rectangle(tile.X, tile.Y, 2, 2);
                var checkTiles = tile.GetNearby(rectangle, 0);
                return(checkTiles.All(t => t.Opaque));
            }));

            BossDatabase.Add(new BossData(this, (tile) =>
            {
                var boss = new Gashwal(World);
                boss.MoveTo(tile, 0);
                boss.AddControlTurn();
                return(new[] { boss });
            })
                             .SetSlowChance(data => data.AliveBosses.Count < 2, 0.2)
                             .SetTile(tile => !tile.Solid, tile => {
                var rectangle  = new Rectangle(tile.X, tile.Y, 2, 2);
                var checkTiles = tile.GetNearby(rectangle, 0);
                return(checkTiles.All(t => !t.Solid && t.Creatures.Empty()));
            }));

            BossDatabase.Add(new BossData(this, (tile) =>
            {
                var boss = new GashwalHairy(World);
                boss.MoveTo(tile, 0);
                boss.AddControlTurn();
                return(new[] { boss });
            })
                             .SetSlowChance(data => data.AliveBosses.Count < 2, 0.2)
                             .SetTile(tile => !tile.Solid, tile => {
                var rectangle  = new Rectangle(tile.X, tile.Y, 2, 2);
                var checkTiles = tile.GetNearby(rectangle, 0);
                return(checkTiles.All(t => !t.Solid && t.Creatures.Empty()));
            }));

            BossDatabase.Add(new BossData(this, (tile) =>
            {
                int radius  = 2;
                var tileSet = tile.GetNearby(radius).Where(x => GetSquareDistance(tile, x) <= radius * radius).Shuffle(Random);
                new HeavenRay(World, tile, 10);
                new TileExplosion(World, tileSet);
                var boss = new Wallhach(World);
                boss.MoveTo(tile, 0);
                boss.AddControlTurn();
                return(new[] { boss });
            })
                             .SetSlowChance(data => data.AliveBosses.Count < 2, 0.1)
                             .SetTile(tile => !tile.Opaque && !tile.Solid && tile.Creatures.Empty()));
        }