Exemple #1
0
        public override void DayUpdate(int dayOfMonth)
        {
            int waters     = 0;
            int startIndex = Game1.random.Next(waterSpots.Length);

            for (int i = 0; i < waterSpots.Length; i++)
            {
                if (waterSpots[(i + startIndex) % waterSpots.Length] && waters * 5 < characters.Count)
                {
                    waters++;
                    waterSpots[(i + startIndex) % waterSpots.Length] = false;
                }
            }
            for (int j = objects.Count() - 1; j >= 0; j--)
            {
                if (objects.Pairs.ElementAt(j).Value.IsSprinkler())
                {
                    foreach (Vector2 v in objects.Pairs.ElementAt(j).Value.GetSprinklerTiles())
                    {
                        if (v.X == 16f && v.Y >= 6f && v.Y <= 9f)
                        {
                            waterSpots[(int)v.Y - 6] = true;
                        }
                    }
                }
            }
            for (int numSlimeBalls = Math.Min(characters.Count / 5, waters); numSlimeBalls > 0; numSlimeBalls--)
            {
                int     tries = 50;
                Vector2 tile  = getRandomTile();
                while ((!isTileLocationTotallyClearAndPlaceable(tile) || doesTileHaveProperty((int)tile.X, (int)tile.Y, "NPCBarrier", "Back") != null || tile.Y >= 12f) && tries > 0)
                {
                    tile = getRandomTile();
                    tries--;
                }
                if (tries > 0)
                {
                    objects.Add(tile, new Object(tile, 56));
                }
            }
            while ((int)slimeMatingsLeft > 0)
            {
                if (characters.Count > 1 && !isFull())
                {
                    NPC mate4 = characters[Game1.random.Next(characters.Count)];
                    if (mate4 is GreenSlime)
                    {
                        GreenSlime mate3 = mate4 as GreenSlime;
                        if ((int)mate3.ageUntilFullGrown <= 0)
                        {
                            for (int distance = 1; distance < 10; distance++)
                            {
                                GreenSlime mate2 = (GreenSlime)Utility.checkForCharacterWithinArea(mate3.GetType(), mate4.Position, this, new Rectangle((int)mate3.Position.X - 64 * distance, (int)mate3.Position.Y - 64 * distance, 64 * (distance * 2 + 1), 64 * (distance * 2 + 1)));
                                if (mate2 != null && mate2.cute != mate3.cute && (int)mate2.ageUntilFullGrown <= 0)
                                {
                                    mate3.mateWith(mate2, this);
                                    break;
                                }
                            }
                        }
                    }
                }
                slimeMatingsLeft.Value--;
            }
            slimeMatingsLeft.Value = characters.Count / 5 + 1;
            base.DayUpdate(dayOfMonth);
        }
Exemple #2
0
        public override void DayUpdate(int dayOfMonth)
        {
            int num = 0;

            for (int i = 0; i < this.waterSpots.Length; i++)
            {
                if (this.waterSpots[i] && num * 5 < this.characters.Count)
                {
                    num++;
                    this.waterSpots[i] = false;
                    base.setMapTileIndex(16, 6 + i, 2134, "Buildings", 0);
                }
            }
            for (int j = Math.Min(this.characters.Count / 5, num); j > 0; j--)
            {
                int     num2       = 50;
                Vector2 randomTile = base.getRandomTile();
                while ((!this.isTileLocationTotallyClearAndPlaceable(randomTile) || base.doesTileHaveProperty((int)randomTile.X, (int)randomTile.Y, "NPCBarrier", "Back") != null || randomTile.Y >= 12f) && num2 > 0)
                {
                    randomTile = base.getRandomTile();
                    num2--;
                }
                if (num2 > 0)
                {
                    this.objects.Add(randomTile, new Object(randomTile, 56, false));
                }
            }
            while (this.slimeMatingsLeft > 0)
            {
                if (this.characters.Count > 1 && !this.isFull())
                {
                    NPC nPC = this.characters[Game1.random.Next(this.characters.Count)];
                    if (nPC is GreenSlime)
                    {
                        GreenSlime greenSlime = nPC as GreenSlime;
                        if (greenSlime.ageUntilFullGrown <= 0)
                        {
                            for (int k = 1; k < 10; k++)
                            {
                                GreenSlime greenSlime2 = (GreenSlime)Utility.checkForCharacterWithinArea(greenSlime.GetType(), nPC.position, this, new Rectangle((int)greenSlime.position.X - Game1.tileSize * k, (int)greenSlime.position.Y - Game1.tileSize * k, Game1.tileSize * (k * 2 + 1), Game1.tileSize * (k * 2 + 1)));
                                if (greenSlime2 != null && greenSlime2.cute != greenSlime.cute && greenSlime2.ageUntilFullGrown <= 0)
                                {
                                    greenSlime.mateWith(greenSlime2, this);
                                    break;
                                }
                            }
                        }
                    }
                }
                this.slimeMatingsLeft--;
            }
            this.slimeMatingsLeft = this.characters.Count / 5 + 1;
            base.DayUpdate(dayOfMonth);
        }
        // Token: 0x06000132 RID: 306 RVA: 0x0000C914 File Offset: 0x0000AB14
        public override void DayUpdate(int dayOfMonth)
        {
            int waters = 0;

            for (int i = 0; i < this.waterSpots.Length; i++)
            {
                if (this.waterSpots[i] && waters * 5 < this.characters.Count)
                {
                    waters++;
                    this.waterSpots[i] = false;
                    base.setMapTileIndex(16, 6 + i, 2134, "Buildings", 0);
                }
            }
            for (int numSlimeBalls = Math.Min(this.characters.Count / 5, waters); numSlimeBalls > 0; numSlimeBalls--)
            {
                int     tries = 50;
                Vector2 tile  = base.getRandomTile();
                while ((!this.isTileLocationTotallyClearAndPlaceable(tile) || base.doesTileHaveProperty((int)tile.X, (int)tile.Y, "NPCBarrier", "Back") != null || tile.Y >= 12f) && tries > 0)
                {
                    tile = base.getRandomTile();
                    tries--;
                }
                if (tries > 0)
                {
                    this.objects.Add(tile, new Object(tile, 56, false));
                }
            }
            while (this.slimeMatingsLeft > 0)
            {
                if (this.characters.Count > 1 && !this.isFull())
                {
                    NPC mate = this.characters[Game1.random.Next(this.characters.Count)];
                    if (mate is GreenSlime)
                    {
                        GreenSlime mate2 = mate as GreenSlime;
                        if (mate2.ageUntilFullGrown <= 0)
                        {
                            for (int distance = 1; distance < 10; distance++)
                            {
                                GreenSlime mate3 = (GreenSlime)Utility.checkForCharacterWithinArea(mate2.GetType(), mate.position, this, new Rectangle((int)mate2.position.X - Game1.tileSize * distance, (int)mate2.position.Y - Game1.tileSize * distance, Game1.tileSize * (distance * 2 + 1), Game1.tileSize * (distance * 2 + 1)));
                                if (mate3 != null && mate3.cute != mate2.cute && mate3.ageUntilFullGrown <= 0)
                                {
                                    mate2.mateWith(mate3, this);
                                    break;
                                }
                            }
                        }
                    }
                }
                this.slimeMatingsLeft--;
            }
            this.slimeMatingsLeft = this.characters.Count / 5 + 1;
            base.DayUpdate(dayOfMonth);
        }
Exemple #4
0
        public override void DayUpdate(int dayOfMonth)
        {
            int val2 = 0;

            for (int index = 0; index < this.waterSpots.Length; ++index)
            {
                if (this.waterSpots[index] && val2 * 5 < this.characters.Count)
                {
                    ++val2;
                    this.waterSpots[index] = false;
                    this.setMapTileIndex(16, 6 + index, 2134, "Buildings", 0);
                }
            }
            for (int index = Math.Min(this.characters.Count / 5, val2); index > 0; --index)
            {
                int     num = 50;
                Vector2 randomTile;
                for (randomTile = this.getRandomTile(); (!this.isTileLocationTotallyClearAndPlaceable(randomTile) || this.doesTileHaveProperty((int)randomTile.X, (int)randomTile.Y, "NPCBarrier", "Back") != null || (double)randomTile.Y >= 12.0) && num > 0; --num)
                {
                    randomTile = this.getRandomTile();
                }
                if (num > 0)
                {
                    this.objects.Add(randomTile, new Object(randomTile, 56, false));
                }
            }
            for (; this.slimeMatingsLeft > 0; this.slimeMatingsLeft = this.slimeMatingsLeft - 1)
            {
                if (this.characters.Count > 1 && !this.isFull())
                {
                    NPC character = this.characters[Game1.random.Next(this.characters.Count)];
                    if (character is GreenSlime)
                    {
                        GreenSlime greenSlime = character as GreenSlime;
                        if (greenSlime.ageUntilFullGrown <= 0)
                        {
                            for (int index = 1; index < 10; ++index)
                            {
                                GreenSlime mateToPursue = (GreenSlime)Utility.checkForCharacterWithinArea(greenSlime.GetType(), character.position, (GameLocation)this, new Rectangle((int)greenSlime.position.X - Game1.tileSize * index, (int)greenSlime.position.Y - Game1.tileSize * index, Game1.tileSize * (index * 2 + 1), Game1.tileSize * (index * 2 + 1)));
                                if (mateToPursue != null && mateToPursue.cute != greenSlime.cute && mateToPursue.ageUntilFullGrown <= 0)
                                {
                                    greenSlime.mateWith(mateToPursue, (GameLocation)this);
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            this.slimeMatingsLeft = this.characters.Count / 5 + 1;
            base.DayUpdate(dayOfMonth);
        }