static void SpawnBoss(Level level, SeedOptions seedOptions, int vanillaBossId)
        {
            if (!level.GameSave.GetSettings().BossRando.Value || TargetBossId == -1 || !level.GameSave.GetSaveBool("IsFightingBoss"))
            {
                return;
            }

            BossAttributes vanillaBossInfo  = BestiaryManager.GetBossAttributes(level, vanillaBossId);
            BossAttributes replacedBossInfo = BestiaryManager.GetReplacedBoss(level, vanillaBossId);

            level.JukeBox.StopSong();
            level.PlayCue(Timespinner.GameAbstractions.ESFX.FoleyWarpGyreIn);

            if (seedOptions.GasMaw && (vanillaBossId == (int)EBossID.Maw || (vanillaBossId == (int)EBossID.FelineSentry && level.GameSave.GetSaveBool("TSRando_IsVileteSaved"))))
            {
                FillRoomWithGas(level);
            }

            if (replacedBossInfo.ShouldSpawn)
            {
                ObjectTileSpecification bossTile = new ObjectTileSpecification();
                bossTile.Category = EObjectTileCategory.Enemy;
                bossTile.Layer    = ETileLayerType.Objects;
                bossTile.ObjectID = replacedBossInfo.TileId;
                bossTile.Argument = replacedBossInfo.Argument;
                bossTile.IsFlippedHorizontally = !replacedBossInfo.IsFacingLeft;

                var boss = replacedBossInfo.BossType.CreateInstance(false, replacedBossInfo.Position, level, replacedBossInfo.Sprite, -1, bossTile);
                level.AsDynamic().RequestAddObject(boss);
            }

            level.JukeBox.StopSong();
            level.JukeBox.PlaySong(vanillaBossInfo.Song);
            TargetBossId = -1;
        }
Example #2
0
        public Mobile Spawn(Level level, ObjectTileSpecification specification)
        {
            var itemDropPickupType = TimeSpinnerType.Get("Timespinner.GameObjects.Items.ItemDropPickup");
            var itemPosition       = new Point(specification.X * 16 + 8, specification.Y * 16 + 16);

            return((Item)Activator.CreateInstance(itemDropPickupType, ItemInfo.BestiaryItemDropSpecification, level, itemPosition, -1));
        }
Example #3
0
        public RequestButtonPressTrigger(Level inLevel, Point position, ObjectTileSpecification objectSpec, Action action)
            : base(inLevel, position, -1, objectSpec)
        {
            this.action = action;

            EventType = EEventTileType.TransitionWarpEvent;
            Bbox      = new Rectangle(0, 0, 48, 32);
        }
Example #4
0
        public Mobile Spawn(Level level, ObjectTileSpecification specification)
        {
            var timeSpinnerType = TimeSpinnerType.Get("Timespinner.GameObjects.Events.Treasure.OrbPedestalEvent");
            var point           = new Point(specification.X * 16 + 8, specification.Y * 16 + 16);
            var gameEvent       = (GameEvent)Activator.CreateInstance(timeSpinnerType, level, point, -1, specification);

            gameEvent.AsDynamic().DoesSpawnDespiteBeingOwned = true;

            return(gameEvent);
        }
        static void SpawnCirclePlatform(Level level, int x, int y, bool isClockwise)
        {
            var position = new Point(x, y);
            ObjectTileSpecification platformTile = new ObjectTileSpecification();

            if (!isClockwise)
            {
                platformTile.Argument = 1;
            }
            var platform = CirclePlatformType.CreateInstance(false, level, position, -1, platformTile);

            level.AsDynamic().RequestAddObject(platform);
        }
        static void SpawnTreasureChest(Level level, bool flipHorizontally, int x, int y)
        {
            var itemPosition  = new Point(x, y);
            var specification = new ObjectTileSpecification {
                IsFlippedHorizontally = flipHorizontally, Layer = ETileLayerType.Objects
            };
            var treasureChest = new TreasureChestEvent(level, itemPosition, -1, specification);

            var chest = treasureChest.AsDynamic();

            chest.Initialize();

            var levelReflected = level.AsDynamic();

            levelReflected.RequestAddObject(treasureChest);
        }
        static void CreateSimpleOneWayWarp(Level level, int destinationLevelId, int destinationRoomId)
        {
            var dynamicLevel = level.AsDynamic();

            Dictionary <int, GameEvent> events = dynamicLevel._levelEvents;
            var warpTrigger = events.Values.FirstOrDefault(e => e.GetType() == TransitionWarpEventType);

            if (warpTrigger == null)
            {
                var specification = new ObjectTileSpecification
                {
                    Category = EObjectTileCategory.Event,
                    ID       = 468,
                    Layer    = ETileLayerType.Objects,
                    ObjectID = 13,
                    X        = 12,
                    Y        = 12
                };
                var point = new Point(specification.X * 16 + 8, specification.Y * 16 + 16);
                warpTrigger = (GameEvent)TransitionWarpEventType.CreateInstance(false, level, point, -1, specification);

                dynamicLevel.RequestAddObject(warpTrigger);
            }

            var dynamicWarpTrigger = warpTrigger.AsDynamic();

            var backToTheFutureWarp =
                new RequestButtonPressTrigger(level, warpTrigger.Position, dynamicWarpTrigger._objectSpec, (Action) delegate
            {
                dynamicWarpTrigger.StartWarpSequence(new LevelChangeRequest
                {
                    LevelID                   = destinationLevelId,
                    PreviousLevelID           = level.ID,
                    RoomID                    = destinationRoomId,
                    IsUsingWarp               = true,
                    IsUsingWhiteFadeOut       = true,
                    AdditionalBlackScreenTime = 0.25f,
                    FadeOutTime               = 0.25f,
                    FadeInTime                = 1f
                });
            });

            dynamicLevel.RequestAddObject(backToTheFutureWarp);
        }
        static void SpawnOrbPredestal(Level level, int x, int y)
        {
            var orbPedestalEventType  = TimeSpinnerType.Get("Timespinner.GameObjects.Events.Treasure.OrbPedestalEvent");
            var itemPosition          = new Point(x, y);
            var pedistalSpecification = new TileSpecification
            {
                Argument = (int)EInventoryOrbType.Monske,
                ID       = 480,           //orb pedestal
                Layer    = ETileLayerType.Objects,
            };
            var orbPedestalEvent = Activator.CreateInstance(orbPedestalEventType, level, itemPosition, -1, ObjectTileSpecification.FromTileSpecification(pedistalSpecification));

            var pedestal = orbPedestalEvent.AsDynamic();

            pedestal.DoesSpawnDespiteBeingOwned = true;
            pedestal.Initialize();

            var levelReflected = level.AsDynamic();

            levelReflected.RequestAddObject((GameEvent)orbPedestalEvent);
        }