Пример #1
0
        public override Item getOne()
        {
            FlowerBomb one = new FlowerBomb(data)
            {
                TileLocation = Vector2.Zero,
                name         = name, Price = price, Quality = quality
            };

            if (heldObject.Value != null)
            {
                one.heldObject.Value = (SObject)heldObject.Value.getOne();
            }
            return(one);
        }
Пример #2
0
        private void onUpdateTicked(object _sender, UpdateTickedEventArgs e)
        {
            if (!e.IsMultipleOf(5) || !Context.IsMainPlayer ||
                Game1.currentLocation == null)
            {
                return;
            }

            foreach (var projectile in Game1.currentLocation.projectiles
                     .OfType <BasicProjectile> ())
            {
                FlowerBomb.FixProjectile(projectile);
            }
        }
Пример #3
0
        private void onButtonPressed(object _sender, ButtonPressedEventArgs e)
        {
            // Only respond if the world is ready and the player can interact.
            if (!Context.IsWorldReady || Game1.dialogueUp ||
                (Game1.eventUp && !Game1.isFestival()) ||
                Game1.player.UsingTool || Game1.IsChatting)
            {
                return;
            }

            // Check for a Flower Bomb that can handle the action.
            if (FlowerBomb.HandleButtonPress(e))
            {
                Helper.Input.Suppress(e.Button);
            }
        }
Пример #4
0
        private static void OnProjectileCollision(GameLocation location,
                                                  int xPosition, int yPosition, Character _who)
        {
            // If a tile near the collision point is suitable, place the Flower
            // Bomb on that tile.
            FlowerBomb     bomb  = new FlowerBomb(EmptyData);
            List <Vector2> tiles = Utility.recursiveFindOpenTiles(location,
                                                                  new Vector2(xPosition / 64, yPosition / 64), maxIterations: 2);
            Vector2 tile = tiles.FirstOrDefault((tile) =>
                                                IsSuitableTile(location, tile, bomb));

            if (tile != Vector2.Zero)
            {
                bomb.TileLocation      = tile;
                location.objects[tile] = bomb;
            }
        }
Пример #5
0
        private void cmdDetonateFlowerBombs(string _command, string[] _args)
        {
            try
            {
                if (!Context.IsMainPlayer)
                {
                    throw new Exception("Cannot detonate Flower Bombs without an active save as host.");
                }
                FlowerBomb.DetonateAll();
            }
            catch (Exception e)
            {
                Monitor.Log($"detonate_flower_bombs failed: {e.Message}", LogLevel.Error);
#if DEBUG
                Monitor.Log(e.StackTrace, LogLevel.Trace);
#endif
            }
        }
Пример #6
0
        private void onGameLaunched(object _sender, GameLaunchedEventArgs _e)
        {
            // Set up Generic Mod Config Menu, if it is available.
            ModConfig.SetUpMenu();

            // Register PyTK custom objects.
            FlowerBomb.Register();

            // Hook into Save Anywhere for compatibility with it.
            var SaveAnywhere = Helper.ModRegistry.GetApi
                               <Omegasis.SaveAnywhere.Framework.ISaveAnywhereAPI>
                                   ("Omegasis.SaveAnywhere");

            if (SaveAnywhere != null)
            {
                SaveAnywhere.BeforeSave += onSaving;
                SaveAnywhere.AfterSave  += onSaved;
                SaveAnywhere.AfterLoad  += onSaveLoaded;
            }
        }
Пример #7
0
        private SObject attach(SObject seed)
        {
            Game1.playSound("seeds");

            SObject seedReturn = null;

            if (seed.Stack == 1)
            {
                Game1.player.removeItemFromInventory(seed);
                seed.NetFields.Parent = null;
            }
            else
            {
                --seed.Stack;
                seedReturn = seed;
                seed       = (SObject)seed.getOne();
            }

            if (Stack == 1)
            {
                heldObject.Value = seed;
                appearsFull      = true;
                return(seedReturn);
            }
            else
            {
                FlowerBomb fusion = (FlowerBomb)getOne();
                --Stack;
                fusion.heldObject.Value = seed;
                fusion.appearsFull      = true;
                if (seedReturn != null)
                {
                    Game1.player.addItemToInventory(seedReturn);
                }
                return(fusion);
            }
        }