Beispiel #1
0
 private static bool ShouldStopFindingProduce(ref Decorators.FarmAnimal moddedAnimal)
 {
     return(Random.Seed((int)(moddedAnimal.GetUniqueId() / 2L +
                              Game.GetDaysPlayed() +
                              Game.GetTimeOfDay())).NextDouble() >
            moddedAnimal.GetFriendship() / 1500.0);
 }
        private static bool HandleNightTimeRoutine(
            ref Decorators.FarmAnimal moddedAnimal,
            ref Location moddedLocation)
        {
            if (Game.GetTimeOfDay() < 1700 || !moddedLocation.IsOutdoors() || moddedAnimal.HasController() ||
                Random.NextDouble() >= 0.002)
            {
                return(false);
            }
            if (moddedLocation.AnyFarmers())
            {
                moddedLocation.RemoveAnimal(moddedAnimal.GetOriginal());
                moddedAnimal.ReturnHome();
                return(true);
            }

            if (Paritee.StardewValley.Core.Characters.FarmAnimal.UnderMaxPathFindingPerTick())
            {
                Paritee.StardewValley.Core.Characters.FarmAnimal.IncreasePathFindingThisTick();
                moddedAnimal.SetFindHomeDoorPathController(moddedLocation.GetOriginal());
            }

            return(false);
        }