예제 #1
0
 public virtual void OnRequestGourmandCheck()
 {
     if (Game1.IsMasterGame)
     {
         string     gourmand_response = "";
         IslandWest island_farm       = Game1.getLocationFromName("IslandWest") as IslandWest;
         foreach (Vector2 key in island_farm.terrainFeatures.Keys)
         {
             TerrainFeature feature = island_farm.terrainFeatures[key];
             if (feature is HoeDirt)
             {
                 HoeDirt dirt = feature as HoeDirt;
                 if (dirt.crop != null)
                 {
                     bool harvestable = (int)dirt.crop.currentPhase >= dirt.crop.phaseDays.Count - 1 && (!dirt.crop.fullyGrown || (int)dirt.crop.dayOfCurrentPhase <= 0);
                     if (dirt.crop.indexOfHarvest.Value == IndexForRequest(gourmandRequestsFulfilled.Value))
                     {
                         if (harvestable)
                         {
                             Point target_tile      = new Point((int)key.X, (int)key.Y);
                             Point player_tile      = FindNearbyUnoccupiedTileThatFitsCharacter(island_farm, target_tile.X, target_tile.Y);
                             Point gourmand_tile    = FindNearbyUnoccupiedTileThatFitsCharacter(island_farm, target_tile.X, target_tile.Y, 2, player_tile);
                             int   farmer_direction = GetRelativeDirection(player_tile, target_tile);
                             gourmandResponseEvent.Fire(key.X + " " + key.Y + " " + player_tile.X + " " + player_tile.Y + " " + farmer_direction + " " + gourmand_tile.X + " " + gourmand_tile.Y + " 2");
                             return;
                         }
                         gourmand_response = "inProgress";
                     }
                 }
             }
         }
         gourmandResponseEvent.Fire(gourmand_response);
     }
 }
예제 #2
0
 public override void TransferDataFromSavedLocation(GameLocation l)
 {
     if (l is IslandWest)
     {
         IslandWest location = l as IslandWest;
         farmhouseRestored.Value       = location.farmhouseRestored;
         farmhouseMailbox.Value        = location.farmhouseMailbox;
         farmObelisk.Value             = location.farmObelisk.Value;
         sandDuggy.Value.whacked.Value = location.sandDuggy.Value.whacked.Value;
         List <ResourceClump> clumps = new List <ResourceClump>(location.resourceClumps);
         location.resourceClumps.Clear();
         resourceClumps.Set(clumps);
     }
     base.TransferDataFromSavedLocation(l);
 }