public override void drawInMenu(SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, bool drawStackNumber) { IridiumTiles.toolDrawInMenu(spriteBatch, location + new Vector2(0.0f, (float)(-Game1.tileSize / 4 + 4)), scaleSize, transparency, layerDepth, drawStackNumber, this); if (!drawStackNumber) { return; } spriteBatch.Draw(Game1.mouseCursors, location + new Vector2(4f, (float)(Game1.tileSize - 20)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(297, 420, 14, 5)), Color.White * transparency, 0.0f, Vector2.Zero, 4f, SpriteEffects.None, layerDepth + 0.0001f); spriteBatch.Draw(Game1.staminaRect, new Microsoft.Xna.Framework.Rectangle((int)location.X + 8, (int)location.Y + Game1.tileSize - 16, (int)((double)this.waterLeft / (double)this.waterCanMax * 48.0), 8), Color.DodgerBlue * 0.7f * transparency); }
public override void draw(SpriteBatch b) { if (Game1.player.toolPower <= 0 || !Game1.player.canReleaseTool) { return; } foreach (Vector2 vector2 in IridiumTiles.AFTiles(Game1.player.GetToolLocation(false) / (float)Game1.tileSize, Game1.player.toolPower, Game1.player)) { b.Draw(Game1.mouseCursors, Game1.GlobalToLocal(new Vector2((float)((int)vector2.X * Game1.tileSize), (float)((int)vector2.Y * Game1.tileSize))), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(194, 388, 16, 16)), Color.White, 0.0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 0.01f); } }
public override void DoFunction(GameLocation location, int x, int y, int power, StardewValley.Farmer who) { this.lastUser = who; //base.DoFunction(location, x, y, power, who); power = who.toolPower; who.stopJittering(); List <Vector2> source = IridiumTiles.AFTiles(new Vector2((float)(x / Game1.tileSize), (float)(y / Game1.tileSize)), power, who); if (location.doesTileHaveProperty(x / Game1.tileSize, y / Game1.tileSize, "Water", "Back") != null || location.doesTileHaveProperty(x / Game1.tileSize, y / Game1.tileSize, "WaterSource", "Back") != null || location is BuildableGameLocation && (location as BuildableGameLocation).getBuildingAt(source.First <Vector2>()) != null && ((location as BuildableGameLocation).getBuildingAt(source.First <Vector2>()).buildingType.Equals("Well") && (location as BuildableGameLocation).getBuildingAt(source.First <Vector2>()).daysOfConstructionLeft <= 0)) { who.jitterStrength = 0.5f; switch (this.upgradeLevel) { case 0: this.waterCanMax = 40; break; case 1: this.waterCanMax = 55; break; case 2: this.waterCanMax = 70; break; case 3: this.waterCanMax = 85; break; case 4: this.waterCanMax = 100; break; } this.waterLeft = this.waterCanMax; Game1.playSound("slosh"); DelayedAction.playSoundAfterDelay("glug", 250); } else if (this.waterLeft > 0) { who.Stamina -= (float)(2 * (power + 1)) - (float)who.FarmingLevel * 0.1f; int num = 0; foreach (Vector2 index in source) { //UP function in process if (location.terrainFeatures.ContainsKey(index)) { if (location.terrainFeatures.ContainsKey(index) && location.terrainFeatures[index].GetType() == typeof(HoeDirt)) { HoeDirt joeDirt = new HoeDirt(); if (location.terrainFeatures.ContainsKey(index) && location.terrainFeatures[index].GetType() == typeof(HoeDirt)) { joeDirt = (HoeDirt)location.terrainFeatures[index]; } IridiumTiles.perfWaterAction(this, 0, index, (GameLocation)null, joeDirt); } location.terrainFeatures[index].performToolAction((Tool)this, 0, index, (GameLocation)null); } if (location.objects.ContainsKey(index)) { location.Objects[index].performToolAction((Tool)this); } location.performToolAction((Tool)this, (int)index.X, (int)index.Y); location.temporarySprites.Add(new TemporaryAnimatedSprite(13, new Vector2(index.X * (float)Game1.tileSize, index.Y * (float)Game1.tileSize), Color.White, 10, Game1.random.NextDouble() < 0.5, 70f, 0, Game1.tileSize, (float)(((double)index.Y * (double)Game1.tileSize + (double)(Game1.tileSize / 2)) / 10000.0 - 0.00999999977648258), -1, 0) { delayBeforeAnimationStart = 200 + num * 10 }); ++num; } this.waterLeft -= power + 1; Vector2 vector2 = new Vector2(who.position.X - (float)(Game1.tileSize / 2) - (float)Game1.pixelZoom, who.position.Y - (float)(Game1.tileSize / 4) - (float)Game1.pixelZoom); switch (who.facingDirection) { case 0: vector2 = Vector2.Zero; break; case 1: vector2.X += (float)(Game1.tileSize * 2 + Game1.pixelZoom * 2); break; case 2: vector2.X += (float)(Game1.tileSize + Game1.pixelZoom * 2); vector2.Y += (float)(Game1.tileSize / 2 + Game1.pixelZoom * 3); break; } if (vector2.Equals(Vector2.Zero)) { return; } for (int index = 0; index < 30; ++index) { location.temporarySprites.Add(new TemporaryAnimatedSprite(Game1.staminaRect, new Microsoft.Xna.Framework.Rectangle(0, 0, 1, 1), 999f, 1, 999, vector2 + new Vector2((float)(Game1.random.Next(-3, 0) * Game1.pixelZoom), (float)(Game1.random.Next(2) * Game1.pixelZoom)), false, false, (float)(who.GetBoundingBox().Bottom + Game1.tileSize / 2) / 10000f, 0.04f, Game1.random.NextDouble() < 0.5 ? Color.DeepSkyBlue : Color.LightBlue, (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false) { delayBeforeAnimationStart = index * 15, motion = new Vector2((float)Game1.random.Next(-10, 11) / 100f, 0.5f), acceleration = new Vector2(0.0f, 0.1f) }); } } else { who.doEmote(4); Game1.showRedMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:WateringCan.cs.14335")); } }
public override void DoFunction(GameLocation location, int x, int y, int power, StardewValley.Farmer who) { this.lastUser = who; if (location.Name.Equals("UndergroundMine")) { power = 1; } who.Stamina -= (float)(2 * power) - (float)who.FarmingLevel * 0.1f; power = who.toolPower; who.stopJittering(); Game1.playSound("woodyHit"); Vector2 vector2 = new Vector2((float)(x / Game1.tileSize), (float)(y / Game1.tileSize)); List <Vector2> vector2List = IridiumTiles.AFTiles(vector2, power, who); foreach (Vector2 index in vector2List) { index.Equals(vector2); if (location.terrainFeatures.ContainsKey(index)) { //terrainfeatures.performToolAction apparently always returns false if (location.terrainFeatures[index].performToolAction((Tool)this, 0, index, (GameLocation)null)) { location.terrainFeatures.Remove(index); } } else { //Test of object[index].performToolAction StardewValley.Object obj = null; if (location.Objects.ContainsKey(index)) { obj = location.Objects[index]; } //if (location.objects.ContainsKey(index) && location.Objects[index].performToolAction((Tool)this)) if (location.objects.ContainsKey(index) && IridiumTiles.perfHoeAtion(this, obj)) { if (location.Objects[index].type.Equals("Crafting") && location.Objects[index].fragility != 2) { List <Debris> debris1 = location.debris; int objectIndex = location.Objects[index].bigCraftable ? -location.Objects[index].ParentSheetIndex : location.Objects[index].ParentSheetIndex; Vector2 toolLocation = who.GetToolLocation(false); Microsoft.Xna.Framework.Rectangle boundingBox = who.GetBoundingBox(); double x1 = (double)boundingBox.Center.X; boundingBox = who.GetBoundingBox(); double y1 = (double)boundingBox.Center.Y; Vector2 playerPosition = new Vector2((float)x1, (float)y1); Debris debris2 = new Debris(objectIndex, toolLocation, playerPosition); debris1.Add(debris2); } location.Objects[index].performRemoveAction(index, location); location.Objects.Remove(index); } if (location.doesTileHaveProperty((int)index.X, (int)index.Y, "Diggable", "Back") != null) { if (location.Name.Equals("UndergroundMine") && !location.isTileOccupied(index, "")) { if (Game1.mine.mineLevel < 40 || Game1.mine.mineLevel >= 80) { location.terrainFeatures.Add(index, (TerrainFeature) new HoeDirt()); Game1.playSound("hoeHit"); } else if (Game1.mine.mineLevel < 80) { location.terrainFeatures.Add(index, (TerrainFeature) new HoeDirt()); Game1.playSound("hoeHit"); } Game1.removeSquareDebrisFromTile((int)index.X, (int)index.Y); location.checkForBuriedItem((int)index.X, (int)index.Y, false, false); location.temporarySprites.Add(new TemporaryAnimatedSprite(12, new Vector2(vector2.X * (float)Game1.tileSize, vector2.Y * (float)Game1.tileSize), Color.White, 8, Game1.random.NextDouble() < 0.5, 50f, 0, -1, -1f, -1, 0)); if (vector2List.Count > 2) { location.temporarySprites.Add(new TemporaryAnimatedSprite(6, new Vector2(index.X * (float)Game1.tileSize, index.Y * (float)Game1.tileSize), Color.White, 8, Game1.random.NextDouble() < 0.5, Vector2.Distance(vector2, index) * 30f, 0, -1, -1f, -1, 0)); } } else if (!location.isTileOccupied(index, "") && location.isTilePassable(new Location((int)index.X, (int)index.Y), Game1.viewport)) { location.makeHoeDirt(index); Game1.playSound("hoeHit"); Game1.removeSquareDebrisFromTile((int)index.X, (int)index.Y); location.temporarySprites.Add(new TemporaryAnimatedSprite(12, new Vector2(index.X * (float)Game1.tileSize, index.Y * (float)Game1.tileSize), Color.White, 8, Game1.random.NextDouble() < 0.5, 50f, 0, -1, -1f, -1, 0)); if (vector2List.Count > 2) { location.temporarySprites.Add(new TemporaryAnimatedSprite(6, new Vector2(index.X * (float)Game1.tileSize, index.Y * (float)Game1.tileSize), Color.White, 8, Game1.random.NextDouble() < 0.5, Vector2.Distance(vector2, index) * 30f, 0, -1, -1f, -1, 0)); } location.checkForBuriedItem((int)index.X, (int)index.Y, false, false); } ++Game1.stats.DirtHoed; } } } }