예제 #1
0
        public bool PerformAction(Farm farm, Vector2 pos, JunimoHarvester junimo, Chest chest)
        {
            Vector2 up    = new Vector2(pos.X, pos.Y + 1);
            Vector2 right = new Vector2(pos.X + 1, pos.Y);
            Vector2 down  = new Vector2(pos.X, pos.Y - 1);
            Vector2 left  = new Vector2(pos.X - 1, pos.Y);

            int direction = 0;

            Vector2[] positions = { up, right, down, left };
            foreach (Vector2 nextPos in positions)
            {
                if (farm.terrainFeatures.ContainsKey(nextPos) && IsHarvestableTree(farm.terrainFeatures[nextPos]))
                {
                    junimo.faceDirection(direction);

                    //farm.terrainFeatures[nextPos].performUseAction(pos, junimo.currentLocation);
                    UseToolOnTile(FakeAxe, nextPos, Game1.player, Game1.currentLocation);

                    return(true);
                }
                direction++;
            }
            return(false);
        }
        public bool PerformAction(Farm farm, Vector2 pos, JunimoHarvester junimo, Chest chest)
        {
            Vector2 up    = new Vector2(pos.X, pos.Y + 1);
            Vector2 right = new Vector2(pos.X + 1, pos.Y);
            Vector2 down  = new Vector2(pos.X, pos.Y - 1);
            Vector2 left  = new Vector2(pos.X - 1, pos.Y);

            int direction = 0;

            Vector2[] positions = { up, right, down, left };
            foreach (Vector2 nextPos in positions)
            {
                if (farm.objects.ContainsKey(nextPos) && farm.objects[nextPos].isForage(farm))
                {
                    junimo.faceDirection(direction);
                    SetForageQuality(farm, nextPos);

                    StardewValley.Object item = farm.objects[nextPos];
                    Util.AddItemToChest(farm, chest, item);

                    Util.SpawnParticles(nextPos);
                    farm.objects.Remove(nextPos);
                    return(true);
                }
                direction++;
            }

            return(false);
        }
예제 #3
0
        public bool PerformAction(GameLocation location, Vector2 pos, JunimoHarvester junimo, Guid guid)
        {
            var chest = Util.GetHutFromId(guid).output.Value;

            var(x, y) = pos;
            var up    = new Vector2(x, y + 1);
            var right = new Vector2(x + 1, y);
            var down  = new Vector2(x, y - 1);
            var left  = new Vector2(x - 1, y);

            var direction = 0;

            Vector2[] positions = { up, right, down, left };
            foreach (var nextPos in positions)
            {
                if (!Util.IsWithinRadius(location, Util.GetHutFromId(guid), nextPos))
                {
                    continue;
                }
                if (DebrisIndexAtTile(nextPos) > 0)
                {
                    junimo.faceDirection(direction);
                    return(MoveDebrisFromTileToChest(nextPos, location, chest));
                }
                direction++;
            }
            return(false);
        }
예제 #4
0
        private bool HarvestForageCrop(Guid id, Vector2 pos, JunimoHarvester junimo)
        {
            Farm farm = Game1.getFarm();

            Vector2 up    = new Vector2(pos.X, pos.Y + 1);
            Vector2 right = new Vector2(pos.X + 1, pos.Y);
            Vector2 down  = new Vector2(pos.X, pos.Y - 1);
            Vector2 left  = new Vector2(pos.X - 1, pos.Y);

            int direction = 0;

            Vector2[] positions = { up, right, down, left };
            foreach (Vector2 nextPos in positions)
            {
                if (farm.objects.ContainsKey(nextPos) && farm.objects[nextPos].isForage(farm))
                {
                    junimo.faceDirection(direction);
                    SetForageQuality(farm, nextPos);

                    SObject item = farm.objects[nextPos];
                    Util.AddItemToHut(id, item);

                    Util.SpawnParticles(nextPos);
                    farm.objects.Remove(nextPos);
                    return(true);
                }
                direction++;
            }

            return(false);
        }
        public bool PerformAction(GameLocation location, Vector2 pos, JunimoHarvester junimo, Guid guid)
        {
            var up    = new Vector2(pos.X, pos.Y + 1);
            var right = new Vector2(pos.X + 1, pos.Y);
            var down  = new Vector2(pos.X, pos.Y - 1);
            var left  = new Vector2(pos.X - 1, pos.Y);

            var direction = 0;

            Vector2[] positions = { up, right, down, left };
            foreach (var nextPos in positions)
            {
                if (!Util.IsWithinRadius(location, Util.GetHutFromId(guid), nextPos))
                {
                    continue;
                }
                if (location.terrainFeatures.ContainsKey(nextPos) && IsHarvestableFruitTree(location.terrainFeatures[nextPos]))
                {
                    var tree = location.terrainFeatures[nextPos] as FruitTree;

                    junimo.faceDirection(direction);

                    return(HarvestFromTree(pos, junimo, tree));
                }
                direction++;
            }

            return(false);
        }
        public bool PerformAction(Farm farm, Vector2 pos, JunimoHarvester junimo, Chest chest)
        {
            Vector2 up    = new Vector2(pos.X, pos.Y + 1);
            Vector2 right = new Vector2(pos.X + 1, pos.Y);
            Vector2 down  = new Vector2(pos.X, pos.Y - 1);
            Vector2 left  = new Vector2(pos.X - 1, pos.Y);

            int direction = 0;

            Vector2[] positions = { up, right, down, left };
            foreach (Vector2 nextPos in positions)
            {
                if (farm.terrainFeatures.ContainsKey(nextPos) && IsHarvestableFruitTree(farm.terrainFeatures[nextPos]))
                {
                    FruitTree tree = farm.terrainFeatures[nextPos] as FruitTree;

                    junimo.faceDirection(direction);

                    return(HarvestFromTree(farm, pos, junimo, chest, tree));
                }
                direction++;
            }

            return(false);
        }
        public bool PerformAction(GameLocation location, Vector2 pos, JunimoHarvester junimo, Guid guid)
        {
            Chest chest = Util.GetHutFromId(guid).output.Value;

            Vector2 up    = new Vector2(pos.X, pos.Y + 1);
            Vector2 right = new Vector2(pos.X + 1, pos.Y);
            Vector2 down  = new Vector2(pos.X, pos.Y - 1);
            Vector2 left  = new Vector2(pos.X - 1, pos.Y);

            int direction = 0;

            Vector2[] positions = { up, right, down, left };
            foreach (Vector2 nextPos in positions)
            {
                if (location.objects.ContainsKey(nextPos) && location.objects[nextPos].isForage(location))
                {
                    junimo.faceDirection(direction);
                    SetForageQuality(location, nextPos);

                    StardewValley.Object item = location.objects[nextPos];
                    Util.AddItemToChest(location, chest, item);

                    Util.SpawnParticles(nextPos);
                    location.objects.Remove(nextPos);

                    // calculate the forage experience from this harvest
                    if (!BetterJunimos.Config.JunimoPayment.GiveExperience)
                    {
                        return(true);
                    }
                    Game1.player.gainExperience(2, 7);

                    return(true);
                }
                direction++;
            }

            return(false);
        }
예제 #8
0
        public bool PerformAction(Farm farm, Vector2 pos, JunimoHarvester junimo, Chest chest) {
            Vector2 up = new Vector2(pos.X, pos.Y + 1);
            Vector2 right = new Vector2(pos.X + 1, pos.Y);
            Vector2 down = new Vector2(pos.X, pos.Y - 1);
            Vector2 left = new Vector2(pos.X - 1, pos.Y);

            int direction = 0;
            Vector2[] positions = { up, right, down, left };
            foreach (Vector2 nextPos in positions) {
                if (farm.objects.ContainsKey(nextPos) && IsDebris(farm.objects[nextPos])) {

                    junimo.faceDirection(direction);
                    // SetForageQuality(farm, nextPos);

                    SObject item = farm.objects[nextPos];
                    GameLocation location = Game1.currentLocation;

                    if (IsStone(item)) {
                        UseToolOnTile(FakePickaxe, nextPos, Game1.player, Game1.currentLocation);
                    }

                    if (IsTwig(item)) {
                        UseToolOnTile(FakeAxe, nextPos, Game1.player, Game1.currentLocation);
                    }

                    if (IsWeed(item)) {
                        UseToolOnTile(Scythe, nextPos, Game1.player, location);
                        item.performToolAction(Scythe, Game1.currentLocation);
                        location.removeObject(nextPos, false);
                    }
                    return true;
                }
                direction++;
            }

            return false;
        }
        public bool PerformAction(Farm farm, Vector2 pos, JunimoHarvester junimo, Chest chest)
        {
            Vector2 up    = new Vector2(pos.X, pos.Y + 1);
            Vector2 right = new Vector2(pos.X + 1, pos.Y);
            Vector2 down  = new Vector2(pos.X, pos.Y - 1);
            Vector2 left  = new Vector2(pos.X - 1, pos.Y);

            int direction = 0;
            int index     = -1;

            Vector2[] positions = { up, right, down, left };
            foreach (Vector2 nextPos in positions)
            {
                index = DebrisIndexAtTile(nextPos);
                if (index > 0)
                {
                    junimo.faceDirection(direction);
                    Monitor.Log($"Want to grab object {nextPos}");
                    return(MoveDebrisFromTileToChest(nextPos, farm, chest));
                }
                direction++;
            }
            return(false);
        }
        public bool PerformAction(Farm farm, Vector2 pos, JunimoHarvester junimo, Chest chest)
        {
            Vector2 up    = new Vector2(pos.X, pos.Y + 1);
            Vector2 right = new Vector2(pos.X + 1, pos.Y);
            Vector2 down  = new Vector2(pos.X, pos.Y - 1);
            Vector2 left  = new Vector2(pos.X - 1, pos.Y);

            int direction = 0;

            Vector2[] positions = { up, right, down, left };
            foreach (Vector2 nextPos in positions)
            {
                if (IsFruitTreeEdge(farm, nextPos))
                {
                    junimo.faceDirection(direction);
                    UseToolOnTile(FakeHoe, nextPos, Game1.player, Game1.currentLocation);
                    Monitor.Log($"    PerformAction hoed the crap out of [{nextPos.X} {nextPos.Y}]", LogLevel.Debug);
                    return(true);
                }
                direction++;
            }

            return(false);
        }