示例#1
0
        public override IEnumerable <Wait> RoutineUse(Creature user, object target)
        {
            if (target is Creature targetCreature)
            {
                yield return(user.CurrentHits);

                Consume();
                new ChaosSplash(user.World, new Vector2(user.X * 16 + 8, user.Y * 16 + 8), Vector2.Zero, 0, 15);
                user.VisualColor = user.Static(Color.Transparent);
                EmitFlare(user, 10);
                var nearbyTiles = targetCreature.Tile.GetNearby(4).Where(tile => !tile.Solid && !tile.Creatures.Any()).ToList();
                user.MoveTo(nearbyTiles.Pick(Random), 0);
                EmitFlare(user, 10);
                user.VisualColor = user.Flick(user.Flash(user.Static(Color.Transparent), user.Static(ColorMatrix.Chaos()), 1, 1), user.Static(Color.White), 10);
                var             impact      = user.Tile.GetAllNeighbors();
                SpriteReference chaosBall   = SpriteLoader.Instance.AddSprite("content/projectile_chaos");
                List <Creature> targets     = new List <Creature>();
                List <Tile>     targetTiles = new List <Tile>();
                int             emitTime    = 15;
                int             ballTime    = 5;
                foreach (var tile in impact)
                {
                    if (tile.Creatures.Any())
                    {
                        new ProjectileEmitter(user.World, () => user.VisualTarget, () => tile.VisualTarget, emitTime, (start, end) => new Ball(user.World, chaosBall, start, end, LerpHelper.Linear, ballTime));
                        targets.AddRange(tile.Creatures);
                        targetTiles.Add(tile);
                    }
                }
                if (targets.Any())
                {
                    yield return(user.WaitSome(emitTime + ballTime));
                }
                foreach (var blastTarget in targets)
                {
                    user.Attack(blastTarget, SkillUtil.SafeNormalize(blastTarget.VisualTarget - user.VisualTarget), ExplosionAttack);
                    EmitFlare(blastTarget, 10);
                }
                foreach (var targetTile in targetTiles)
                {
                    new FireExplosion(user.World, targetTile.VisualTarget, Vector2.Zero, 0, 12);
                }
                if (targets.Any())
                {
                    new ScreenShakeRandom(user.World, 5, 10, LerpHelper.Linear);
                    yield return(user.WaitSome(20));
                }
            }
        }