Esempio n. 1
0
 public bool hasWorldStateID(string id)
 {
     return(worldStateIDs.Contains(id));
 }
Esempio n. 2
0
        public void newDay(int state, int fertilizer, int xTile, int yTile, GameLocation environment)
        {
            if ((bool)environment.isOutdoors && ((bool)dead || (!environment.SeedsIgnoreSeasonsHere() && !seasonsToGrowIn.Contains(environment.GetSeasonForLocation())) || (!environment.SeedsIgnoreSeasonsHere() && (int)indexOfHarvest == 90)))
            {
                Kill();
                return;
            }
            if (state == 1 || (int)indexOfHarvest == 771)
            {
                if (!fullyGrown)
                {
                    dayOfCurrentPhase.Value = Math.Min((int)dayOfCurrentPhase + 1, (phaseDays.Count > 0) ? phaseDays[Math.Min(phaseDays.Count - 1, currentPhase)] : 0);
                }
                else
                {
                    dayOfCurrentPhase.Value--;
                }
                if ((int)dayOfCurrentPhase >= ((phaseDays.Count > 0) ? phaseDays[Math.Min(phaseDays.Count - 1, currentPhase)] : 0) && (int)currentPhase < phaseDays.Count - 1)
                {
                    currentPhase.Value++;
                    dayOfCurrentPhase.Value = 0;
                }
                while ((int)currentPhase < phaseDays.Count - 1 && phaseDays.Count > 0 && phaseDays[currentPhase] <= 0)
                {
                    currentPhase.Value++;
                }
                if ((int)rowInSpriteSheet == 23 && (int)phaseToShow == -1 && (int)currentPhase > 0)
                {
                    phaseToShow.Value = Game1.random.Next(1, 7);
                }
                if (environment is Farm && (int)currentPhase == phaseDays.Count - 1 && ((int)indexOfHarvest == 276 || (int)indexOfHarvest == 190 || (int)indexOfHarvest == 254) && OneTimeRandom.GetDouble(Game1.uniqueIDForThisGame, Game1.stats.DaysPlayed, (ulong)xTile, (ulong)yTile) < 0.01)
                {
                    for (int x2 = xTile - 1; x2 <= xTile + 1; x2++)
                    {
                        for (int y = yTile - 1; y <= yTile + 1; y++)
                        {
                            Vector2 v2 = new Vector2(x2, y);
                            if (!environment.terrainFeatures.ContainsKey(v2) || !(environment.terrainFeatures[v2] is HoeDirt) || (environment.terrainFeatures[v2] as HoeDirt).crop == null || (environment.terrainFeatures[v2] as HoeDirt).crop.indexOfHarvest != indexOfHarvest)
                            {
                                return;
                            }
                        }
                    }
                    for (int x = xTile - 1; x <= xTile + 1; x++)
                    {
                        for (int y2 = yTile - 1; y2 <= yTile + 1; y2++)
                        {
                            Vector2 v3 = new Vector2(x, y2);
                            (environment.terrainFeatures[v3] as HoeDirt).crop = null;
                        }
                    }
                    (environment as Farm).resourceClumps.Add(new GiantCrop(indexOfHarvest, new Vector2(xTile - 1, yTile - 1)));
                }
            }
            if ((!fullyGrown || (int)dayOfCurrentPhase <= 0) && (int)currentPhase >= phaseDays.Count - 1 && (int)rowInSpriteSheet == 23)
            {
                Vector2 v      = new Vector2(xTile, yTile);
                string  season = Game1.currentSeason;
                switch ((int)whichForageCrop)
                {
                case 495:
                    season = "spring";
                    break;

                case 496:
                    season = "summer";
                    break;

                case 497:
                    season = "fall";
                    break;

                case 498:
                    season = "winter";
                    break;
                }
                if (environment.objects.ContainsKey(v))
                {
                    if (environment.objects[v] is IndoorPot)
                    {
                        (environment.objects[v] as IndoorPot).heldObject.Value   = new Object(v, getRandomWildCropForSeason(season), 1);
                        (environment.objects[v] as IndoorPot).hoeDirt.Value.crop = null;
                    }
                    else
                    {
                        environment.objects.Remove(v);
                    }
                }
                if (!environment.objects.ContainsKey(v))
                {
                    environment.objects.Add(v, new Object(v, getRandomWildCropForSeason(season), 1)
                    {
                        IsSpawnedObject = true,
                        CanBeGrabbed    = true
                    });
                }
                if (environment.terrainFeatures.ContainsKey(v) && environment.terrainFeatures[v] != null && environment.terrainFeatures[v] is HoeDirt)
                {
                    (environment.terrainFeatures[v] as HoeDirt).crop = null;
                }
            }
            updateDrawMath(new Vector2(xTile, yTile));
        }