public override bool performToolAction(Tool t, int damage, Vector2 tileLocation, GameLocation location) { if (t == null || !(t is Axe)) { return(false); } location.playSound("axchop"); int power = (int)t.upgradeLevel / 2 + 1; health.Value -= power; Game1.createRadialDebris(Game1.currentLocation, 12, (int)tileLocation.X + 1, (int)tileLocation.Y + 1, Game1.random.Next(4, 9), resource: false); if (t is Axe && t.hasEnchantmentOfType <ShavingEnchantment>() && Game1.random.NextDouble() <= (double)((float)power / 5f)) { Debris d = new Debris(parentSheetIndex, new Vector2(tileLocation.X * 64f + 96f, (tileLocation.Y + 0.5f) * 64f), new Vector2(Game1.player.getStandingX(), Game1.player.getStandingY())); d.Chunks[0].xVelocity.Value += (float)Game1.random.Next(-10, 11) / 10f; d.chunkFinalYLevel = (int)(tileLocation.Y * 64f + 128f); location.debris.Add(d); } if (shakeTimer <= 0f) { shakeTimer = 100f; base.NeedsUpdate = true; } if ((float)health <= 0f) { t.getLastFarmerToUse().gainExperience(5, 50 * (((int)t.getLastFarmerToUse().luckLevel + 1) / 2)); if (location.HasUnlockedAreaSecretNotes(t.getLastFarmerToUse())) { Object o = location.tryToCreateUnseenSecretNote(t.getLastFarmerToUse()); if (o != null) { Game1.createItemDebris(o, tileLocation * 64f, -1, location); } } int numChunks = 18; Random r; if (Game1.IsMultiplayer) { Game1.recentMultiplayerRandom = new Random((int)tileLocation.X * 1000 + (int)tileLocation.Y); r = Game1.recentMultiplayerRandom; } else { r = new Random((int)Game1.uniqueIDForThisGame + (int)Game1.stats.DaysPlayed + (int)tileLocation.X * 7 + (int)tileLocation.Y * 11); } numChunks = r.Next(15, 22); if (Game1.IsMultiplayer) { Game1.createMultipleObjectDebris(parentSheetIndex, (int)tileLocation.X + 1, (int)tileLocation.Y + 1, numChunks, t.getLastFarmerToUse().UniqueMultiplayerID, location); } else { Game1.createRadialDebris(location, parentSheetIndex, (int)tileLocation.X, (int)tileLocation.Y, numChunks, resource: false, -1, item: true); } Object tmp = new Object(Vector2.Zero, parentSheetIndex, 1); Game1.setRichPresence("giantcrop", tmp.Name); Game1.createRadialDebris(Game1.currentLocation, 12, (int)tileLocation.X, (int)tileLocation.Y, Game1.random.Next(4, 9), resource: false); location.playSound("stumpCrack"); Game1.multiplayer.broadcastSprites(location, new TemporaryAnimatedSprite(5, tileLocation * 64f, Color.White)); Game1.multiplayer.broadcastSprites(location, new TemporaryAnimatedSprite(5, (tileLocation + new Vector2(1f, 0f)) * 64f, Color.White, 8, flipped: false, 110f)); Game1.multiplayer.broadcastSprites(location, new TemporaryAnimatedSprite(5, (tileLocation + new Vector2(1f, 1f)) * 64f, Color.White, 8, flipped: true, 80f)); Game1.multiplayer.broadcastSprites(location, new TemporaryAnimatedSprite(5, (tileLocation + new Vector2(0f, 1f)) * 64f, Color.White, 8, flipped: false, 90f)); Game1.multiplayer.broadcastSprites(location, new TemporaryAnimatedSprite(5, tileLocation * 64f + new Vector2(32f, 32f), Color.White, 8, flipped: false, 70f)); Game1.multiplayer.broadcastSprites(location, new TemporaryAnimatedSprite(5, tileLocation * 64f, Color.White)); Game1.multiplayer.broadcastSprites(location, new TemporaryAnimatedSprite(5, (tileLocation + new Vector2(2f, 0f)) * 64f, Color.White, 8, flipped: false, 110f)); Game1.multiplayer.broadcastSprites(location, new TemporaryAnimatedSprite(5, (tileLocation + new Vector2(2f, 1f)) * 64f, Color.White, 8, flipped: true, 80f)); Game1.multiplayer.broadcastSprites(location, new TemporaryAnimatedSprite(5, (tileLocation + new Vector2(2f, 2f)) * 64f, Color.White, 8, flipped: false, 90f)); Game1.multiplayer.broadcastSprites(location, new TemporaryAnimatedSprite(5, tileLocation * 64f + new Vector2(96f, 96f), Color.White, 8, flipped: false, 70f)); Game1.multiplayer.broadcastSprites(location, new TemporaryAnimatedSprite(5, (tileLocation + new Vector2(0f, 2f)) * 64f, Color.White, 8, flipped: false, 110f)); Game1.multiplayer.broadcastSprites(location, new TemporaryAnimatedSprite(5, (tileLocation + new Vector2(1f, 2f)) * 64f, Color.White, 8, flipped: true, 80f)); return(true); } return(false); }
private List <SObject> GetForagedArtifactsFromArtifactSpot(GameLocation location, Vector2 tile) { // impl @ StardewValley::GameLocation::digUpArtifactSpot var artifacts = new List <SObject>(); var r = new Random((int)tile.X * 2000 + (int)tile.Y + (int)Game1.uniqueIDForThisGame / 2 + (int)Game1.stats.DaysPlayed); var hoe = Player.getToolFromName(Tools.Hoe); var archaeologyEnchant = hoe != null && hoe is Hoe && hoe.hasEnchantmentOfType <ArchaeologistEnchantment>(); var generousEnchant = hoe != null && hoe is Hoe && hoe.hasEnchantmentOfType <GenerousEnchantment>(); var artifactId = -1; string[] split; foreach (var pair in Game1.objectInformation) { split = pair.Value.Split('/'); if (split[3].Contains("Arch")) { string[] archSplit = split[6].Split(' '); for (int j = 0; j < archSplit.Length; j += 2) { if (archSplit[j].Equals(location.Name) && r.NextDouble() < (double)((!archaeologyEnchant) ? 1 : 2) * Convert.ToDouble(archSplit[j + 1], CultureInfo.InvariantCulture)) { artifactId = pair.Key; break; } } } if (artifactId != -1) { break; } } if (r.NextDouble() < 0.2 && !(location is Farm)) { artifactId = ItemIds.LostBook; } if (artifactId == ItemIds.LostBook && Game1.netWorldState.Value.LostBooksFound.Value >= 21) { artifactId = ItemIds.MixedSeeds; } if (artifactId != -1) { artifacts.Add(new SObject(artifactId, 1)); return(artifacts); } var season = Game1.GetSeasonForLocation(location); bool extraHarvest() => generousEnchant && r.NextDouble() < 0.5f; if (season == "winter" && r.NextDouble() < 0.5 && !(location is Desert)) { artifacts.Add(new SObject(r.NextDouble() < 0.4 ? ItemIds.SnowYam : ItemIds.WinterRoot, extraHarvest() ? 2 : 1)); return(artifacts); } if (Game1.random.NextDouble() <= 0.25 && Player.team.SpecialOrderRuleActive("DROP_QI_BEANS")) { artifacts.Add(new SObject(ItemIds.QiBeans, r.Next(2, 6))); } if (season == "spring" && r.NextDouble() < 0.0625 && !(location is Desert) && !(location is Beach)) { var extra = extraHarvest() ? r.Next(2, 6) : 0; artifacts.Add(new SObject(ItemIds.RiceShoot, extra + r.Next(2, 6))); return(artifacts); } var hasGuntherQuest = Game1.MasterPlayer.mailReceived.Contains("guntherBones") || Player.team.specialOrders.Any(order => order.questKey.Value == "Gunther"); if (Game1.random.NextDouble() <= 0.2 && hasGuntherQuest) { artifacts.Add(new SObject(ItemIds.GuntherBones, r.Next(2, 6))); } var locationData = Game1.content.Load <Dictionary <string, string> >("Data\\Locations"); if (!locationData.ContainsKey(location.Name)) { return(null); } var rawLocationData = locationData[location.Name].Split('/')[8].Split(' '); if (rawLocationData.Length == 0 || rawLocationData[0] == "-1") { return(null); } for (int i = 0; i < rawLocationData.Length; i += 2) { if (!(r.NextDouble() <= Convert.ToDouble(rawLocationData[i + 1]))) { continue; } artifactId = Convert.ToInt32(rawLocationData[i]); if (Game1.objectInformation.ContainsKey(artifactId) && (Game1.objectInformation[artifactId].Split('/').Contains("Arch") || artifactId == ItemIds.LostBook)) { if (artifactId == ItemIds.LostBook && Game1.netWorldState.Value.LostBooksFound.Value >= 21) { artifactId = ItemIds.MixedSeeds; } artifacts.Add(new SObject(artifactId, 1)); return(artifacts); } if (artifactId == ItemIds.Clay && location.HasUnlockedAreaSecretNotes(Player) && Game1.random.NextDouble() < 0.11) { var secretNote = location.tryToCreateUnseenSecretNote(Player); if (secretNote != null) { artifacts.Add(secretNote); return(artifacts); } } else if (artifactId == ItemIds.Clay && Game1.stats.daysPlayed > 28 && Game1.random.NextDouble() < 0.1) { artifacts.Add(new SObject(ItemIds.FarmTotem + Game1.random.Next(3), 1)); } var extra = extraHarvest() ? r.Next(1, 4) : 0; artifacts.Add(new SObject(artifactId, extra + r.Next(1, 4))); return(artifacts); } return(artifacts); }
public override bool performToolAction(Tool t, int damage, Vector2 tileLocation, GameLocation location) { if (t == null) { return(false); } int radialDebris = 12; switch ((int)parentSheetIndex) { case 600: if (t is Axe && (int)t.upgradeLevel < 1) { location.playSound("axe"); Game1.drawObjectDialogue(Game1.content.LoadString("Strings\\StringsFromCSFiles:ResourceClump.cs.13945")); Game1.player.jitterStrength = 1f; return(false); } if (!(t is Axe)) { return(false); } location.playSound("axchop"); break; case 602: if (t is Axe && (int)t.upgradeLevel < 2) { location.playSound("axe"); Game1.drawObjectDialogue(Game1.content.LoadString("Strings\\StringsFromCSFiles:ResourceClump.cs.13948")); Game1.player.jitterStrength = 1f; return(false); } if (!(t is Axe)) { return(false); } location.playSound("axchop"); break; case 622: if (t is Pickaxe && (int)t.upgradeLevel < 3) { location.playSound("clubhit"); location.playSound("clank"); Game1.drawObjectDialogue(Game1.content.LoadString("Strings\\StringsFromCSFiles:ResourceClump.cs.13952")); Game1.player.jitterStrength = 1f; return(false); } if (!(t is Pickaxe)) { return(false); } location.playSound("hammer"); radialDebris = 14; break; case 672: if (t is Pickaxe && (int)t.upgradeLevel < 2) { location.playSound("clubhit"); location.playSound("clank"); Game1.drawObjectDialogue(Game1.content.LoadString("Strings\\StringsFromCSFiles:ResourceClump.cs.13956")); Game1.player.jitterStrength = 1f; return(false); } if (!(t is Pickaxe)) { return(false); } location.playSound("hammer"); radialDebris = 14; break; case 752: case 754: case 756: case 758: if (!(t is Pickaxe)) { return(false); } location.playSound("hammer"); radialDebris = 14; shakeTimer = 500f; base.NeedsUpdate = true; break; } float power = Math.Max(1f, (float)((int)t.upgradeLevel + 1) * 0.75f); health.Value -= power; if (t is Axe && t.hasEnchantmentOfType <ShavingEnchantment>() && Game1.random.NextDouble() <= (double)(power / 12f) && ((int)parentSheetIndex == 602 || (int)parentSheetIndex == 600)) { Debris d = new Debris(709, new Vector2(tileLocation.X * 64f + 32f, (tileLocation.Y - 0.5f) * 64f + 32f), new Vector2(Game1.player.getStandingX(), Game1.player.getStandingY())); d.Chunks[0].xVelocity.Value += (float)Game1.random.Next(-10, 11) / 10f; d.chunkFinalYLevel = (int)(tileLocation.Y * 64f + 64f); location.debris.Add(d); } Game1.createRadialDebris(Game1.currentLocation, radialDebris, (int)tileLocation.X + Game1.random.Next((int)width / 2 + 1), (int)tileLocation.Y + Game1.random.Next((int)height / 2 + 1), Game1.random.Next(4, 9), resource: false); if ((float)health <= 0f) { if (t != null && location.HasUnlockedAreaSecretNotes(t.getLastFarmerToUse()) && Game1.random.NextDouble() < 0.05) { Object o = location.tryToCreateUnseenSecretNote(t.getLastFarmerToUse()); if (o != null) { Game1.createItemDebris(o, tileLocation * 64f, -1, location); } } if (Game1.IsMultiplayer) { _ = Game1.recentMultiplayerRandom; } else { new Random((int)((float)Game1.uniqueIDForThisGame + tileLocation.X * 7f + tileLocation.Y * 11f + (float)Game1.stats.DaysPlayed + (float)health)); } switch ((int)parentSheetIndex) { case 600: case 602: { if (t.getLastFarmerToUse() == Game1.player) { Game1.stats.StumpsChopped++; } t.getLastFarmerToUse().gainExperience(2, 25); int numChunks = (((int)parentSheetIndex == 602) ? 8 : 2); Random r; if (Game1.IsMultiplayer) { Game1.recentMultiplayerRandom = new Random((int)tileLocation.X * 1000 + (int)tileLocation.Y); r = Game1.recentMultiplayerRandom; } else { r = new Random((int)Game1.uniqueIDForThisGame + (int)Game1.stats.DaysPlayed + (int)tileLocation.X * 7 + (int)tileLocation.Y * 11); } if (t.getLastFarmerToUse().professions.Contains(12)) { if (numChunks == 8) { numChunks = 10; } else if (r.NextDouble() < 0.5) { numChunks++; } } if (Game1.IsMultiplayer) { Game1.createMultipleObjectDebris(709, (int)tileLocation.X, (int)tileLocation.Y, numChunks, t.getLastFarmerToUse().UniqueMultiplayerID); } else { Game1.createMultipleObjectDebris(709, (int)tileLocation.X, (int)tileLocation.Y, numChunks); } location.playSound("stumpCrack"); Game1.multiplayer.broadcastSprites(Game1.currentLocation, new TemporaryAnimatedSprite(23, tileLocation * 64f, Color.White, 4, flipped: false, 140f, 0, 128, -1f, 128)); Game1.multiplayer.broadcastSprites(Game1.currentLocation, new TemporaryAnimatedSprite("TileSheets\\animations", new Rectangle(385, 1522, 127, 79), 2000f, 1, 1, tileLocation * 64f + new Vector2(0f, 49f), flicker: false, flipped: false, 1E-05f, 0.016f, Color.White, 1f, 0f, 0f, 0f)); Game1.createRadialDebris(Game1.currentLocation, 34, (int)tileLocation.X, (int)tileLocation.Y, Game1.random.Next(4, 9), resource: false); if (r.NextDouble() < 0.1) { Game1.createMultipleObjectDebris(292, (int)tileLocation.X, (int)tileLocation.Y, 1); } if (Game1.random.NextDouble() <= 0.25 && Game1.player.team.SpecialOrderRuleActive("DROP_QI_BEANS")) { Game1.createObjectDebris(890, (int)tileLocation.X, (int)tileLocation.Y - 3, ((int)tileLocation.Y + 1) * 64, 0, 1f, location); } return(true); } case 672: case 752: case 754: case 756: case 758: { int numChunks = (((int)parentSheetIndex == 672) ? 15 : 10); if (Game1.IsMultiplayer) { Game1.recentMultiplayerRandom = new Random((int)tileLocation.X * 1000 + (int)tileLocation.Y); Random r = Game1.recentMultiplayerRandom; } else { Random r = new Random((int)Game1.uniqueIDForThisGame + (int)Game1.stats.DaysPlayed + (int)tileLocation.X * 7 + (int)tileLocation.Y * 11); } if (Game1.IsMultiplayer) { Game1.createMultipleObjectDebris(390, (int)tileLocation.X, (int)tileLocation.Y, numChunks, t.getLastFarmerToUse().UniqueMultiplayerID); } else { Game1.createRadialDebris(Game1.currentLocation, 390, (int)tileLocation.X, (int)tileLocation.Y, numChunks, resource: false, -1, item: true); } location.playSound("boulderBreak"); Game1.createRadialDebris(Game1.currentLocation, 32, (int)tileLocation.X, (int)tileLocation.Y, Game1.random.Next(6, 12), resource: false); Color c = Color.White; switch ((int)parentSheetIndex) { case 752: c = new Color(188, 119, 98); break; case 754: c = new Color(168, 120, 95); break; case 756: case 758: c = new Color(67, 189, 238); break; } Game1.multiplayer.broadcastSprites(Game1.currentLocation, new TemporaryAnimatedSprite(48, tileLocation * 64f, c, 5, flipped: false, 180f, 0, 128, -1f, 128) { alphaFade = 0.01f }); return(true); } case 622: { int numChunks = 6; if (Game1.IsMultiplayer) { Game1.recentMultiplayerRandom = new Random((int)tileLocation.X * 1000 + (int)tileLocation.Y); Random r = Game1.recentMultiplayerRandom; } else { Random r = new Random((int)Game1.uniqueIDForThisGame + (int)Game1.stats.DaysPlayed + (int)tileLocation.X * 7 + (int)tileLocation.Y * 11); } if (Game1.IsMultiplayer) { Game1.createMultipleObjectDebris(386, (int)tileLocation.X, (int)tileLocation.Y, numChunks, t.getLastFarmerToUse().UniqueMultiplayerID); Game1.createMultipleObjectDebris(390, (int)tileLocation.X, (int)tileLocation.Y, numChunks, t.getLastFarmerToUse().UniqueMultiplayerID); Game1.createMultipleObjectDebris(535, (int)tileLocation.X, (int)tileLocation.Y, 2, t.getLastFarmerToUse().UniqueMultiplayerID); } else { Game1.createMultipleObjectDebris(386, (int)tileLocation.X, (int)tileLocation.Y, numChunks); Game1.createMultipleObjectDebris(390, (int)tileLocation.X, (int)tileLocation.Y, numChunks); Game1.createMultipleObjectDebris(535, (int)tileLocation.X, (int)tileLocation.Y, 2); } location.playSound("boulderBreak"); Game1.createRadialDebris(Game1.currentLocation, 32, (int)tileLocation.X, (int)tileLocation.Y, Game1.random.Next(6, 12), resource: false); Game1.multiplayer.broadcastSprites(Game1.currentLocation, new TemporaryAnimatedSprite(5, tileLocation * 64f, Color.White)); Game1.multiplayer.broadcastSprites(Game1.currentLocation, new TemporaryAnimatedSprite(5, (tileLocation + new Vector2(1f, 0f)) * 64f, Color.White, 8, flipped: false, 110f)); Game1.multiplayer.broadcastSprites(Game1.currentLocation, new TemporaryAnimatedSprite(5, (tileLocation + new Vector2(1f, 1f)) * 64f, Color.White, 8, flipped: true, 80f)); Game1.multiplayer.broadcastSprites(Game1.currentLocation, new TemporaryAnimatedSprite(5, (tileLocation + new Vector2(0f, 1f)) * 64f, Color.White, 8, flipped: false, 90f)); Game1.multiplayer.broadcastSprites(Game1.currentLocation, new TemporaryAnimatedSprite(5, tileLocation * 64f + new Vector2(32f, 32f), Color.White, 8, flipped: false, 70f)); return(true); } } } else { shakeTimer = 100f; base.NeedsUpdate = true; } return(false); }
public void GetLoot() { #region Primary Table Loot int loot_primary = GetPrizeFromPrimaryTable(); if (loot_primary != -1) { Log.Trace($"Got [{loot_primary}] from Primary Table"); Game1.createObjectDebris(loot_primary, XLoc, YLoc, Who.UniqueMultiplayerID); Who.gainExperience(5, 25); return; } Log.Trace($"Got nothing from Primary Table, continuing"); #endregion #region Inter-Table Loot bool generousEnchant = this.HoeTool?.hasEnchantmentOfType <GenerousEnchantment>() == true; float generousChance = 0.5f; string season = Game1.GetSeasonForLocation(this.Loc); if (season == "winter" && RNG.NextDouble() < 0.5 && this.Loc is not Desert) { int winter_forage = RNG.NextDouble() < 0.4 ? ID_SNOW_YAM : ID_WINTER_ROOT; Log.Trace($"Got Winter Forage [{winter_forage}]"); Game1.createObjectDebris(winter_forage, XLoc, YLoc, Who.UniqueMultiplayerID); if (generousEnchant && RNG.NextDouble() < generousChance) { // Spawn second forage item Game1.createObjectDebris(winter_forage, XLoc, YLoc, Who.UniqueMultiplayerID); } return; } if (RNG.NextDouble() <= 0.25 && Game1.player.team.SpecialOrderRuleActive("DROP_QI_BEANS")) { Log.Trace($"Got Qi Bean [{ID_QI_BEAN}]"); Game1.createMultipleObjectDebris(ID_QI_BEAN, XLoc, YLoc, RNG.Next(2, 6), Who.UniqueMultiplayerID, Loc); } if (season == "spring" && RNG.NextDouble() < 0.0625 && Loc is not Desert && Loc is not Beach) { Log.Trace($"Got Rice Shoot [{ID_RICE_SHOOT}]"); int num = RNG.Next(2, 6); if (generousEnchant && RNG.NextDouble() < generousChance) { num += RNG.Next(2, 6); } Game1.createMultipleObjectDebris(ID_RICE_SHOOT, XLoc, YLoc, num, Who.UniqueMultiplayerID, Loc); return; } if ( RNG.NextDouble() <= 0.2 && ( Game1.MasterPlayer.mailReceived.Contains("guntherBones") || Game1.player.team.specialOrders.Where(spOrder => spOrder.questKey == "Gunther").Count() > 0 ) ) { Log.Trace($"Got Bone Fragments [{ID_BONE_FRAGMENT}] in addition"); Game1.createMultipleObjectDebris(ID_BONE_FRAGMENT, XLoc, YLoc, RNG.Next(2, 6), Who.UniqueMultiplayerID, Loc); } #endregion #region Secondary Table Loot int toDigUp = GetPrizeFromSecondaryTable(); // Failed to grab anything from secondary table if (toDigUp == -1) { Log.Trace($"Got nothing from Secondary Table, stopping."); return; } Log.Trace($"Got [{toDigUp}] from Secondary Table"); if (this.ArchObjects.ContainsKey(toDigUp) || toDigUp == ID_LOST_BOOKS) { if (toDigUp == ID_LOST_BOOKS && Game1.netWorldState.Value.LostBooksFound >= Constants.TOTAL_LOST_BOOKS) { Log.Trace($"Overridden to [{ID_MIXED_SEEDS}] Mixed Seeds"); toDigUp = ID_MIXED_SEEDS; } Game1.createObjectDebris(toDigUp, XLoc, YLoc, Who.UniqueMultiplayerID); return; } if (toDigUp == ID_CLAY && Loc.HasUnlockedAreaSecretNotes(Who) && RNG.NextDouble() < 0.11) { if (Loc.tryToCreateUnseenSecretNote(Who) is SObject secretNote) { Log.Trace($"Overridden: Secret Note replacing Clay"); Game1.createItemDebris(secretNote, new Vector2(XLoc + 0.5f, YLoc + 0.5f) * 64f, -1, Loc); return; } } else if (toDigUp == ID_CLAY && Game1.stats.DaysPlayed > 28 && RNG.NextDouble() < 0.1) { int totem = ID_WARP_TOTEM_BASE + RNG.Next(3); Log.Trace($"Bonus: Warp Totem [{totem}] in addition to Clay from Secondary Table"); Game1.createMultipleObjectDebris(totem, XLoc, YLoc, 1, Who.UniqueMultiplayerID); } Game1.createMultipleObjectDebris(toDigUp, XLoc, YLoc, RNG.Next(1, 4), Who.UniqueMultiplayerID); if (generousEnchant && RNG.NextDouble() < (double)generousChance) { Log.Trace($"Bonus: More [{toDigUp}] thanks to Generous Enchantment"); Game1.createMultipleObjectDebris(toDigUp, XLoc, YLoc, RNG.Next(1, 4), Who.UniqueMultiplayerID); } return; #endregion }
public override bool performToolAction(Tool t, int damage, Vector2 tileLocation, GameLocation location) { var Game1_multiplayer = Mod.instance.Helper.Reflection.GetField <Multiplayer>(typeof(Game1), "multiplayer").GetValue(); if (t is not Axe) { return(false); } location.playSound("axchop"); int power = (int)t.upgradeLevel / 2 + 1; this.health.Value -= power; Game1.createRadialDebris(Game1.currentLocation, 12, (int)tileLocation.X + 1, (int)tileLocation.Y + 1, Game1.random.Next(4, 9), resource: false); foreach (var drop in this.Data.GiantDrops) { if (t is Axe && t.hasEnchantmentOfType <ShavingEnchantment>() && Game1.random.NextDouble() <= (double)((float)power / 5f)) { var item = drop.Item.Choose(Game1.random).Create(); Debris d = new Debris(item, new Vector2(tileLocation.X * 64f + 96f, (tileLocation.Y + 0.5f) * 64f), new Vector2(Game1.player.getStandingX(), Game1.player.getStandingY())); d.Chunks[0].xVelocity.Value += (float)Game1.random.Next(-10, 11) / 10f; d.chunkFinalYLevel = (int)(tileLocation.Y * 64f + 128f); location.debris.Add(d); } } if (this.shakeTimer <= 0f) { this.shakeTimer = 100f; this.NeedsUpdate = true; } if ((float)this.health <= 0f) { t.getLastFarmerToUse().gainExperience(5, 50 * (((int)t.getLastFarmerToUse().luckLevel + 1) / 2)); if (location.HasUnlockedAreaSecretNotes(t.getLastFarmerToUse())) { StardewValley.Object o = location.tryToCreateUnseenSecretNote(t.getLastFarmerToUse()); if (o != null) { Game1.createItemDebris(o, tileLocation * 64f, -1, location); } } Random r; if (Game1.IsMultiplayer) { Game1.recentMultiplayerRandom = new Random((int)tileLocation.X * 1000 + (int)tileLocation.Y); r = Game1.recentMultiplayerRandom; } else { r = new Random((int)Game1.uniqueIDForThisGame + (int)Game1.stats.DaysPlayed + (int)tileLocation.X * 7 + (int)tileLocation.Y * 11); } foreach (var drop in this.Data.GiantDrops) { int numChunks = r.Next(drop.MininumHarvestedQuantity, drop.MaximumHarvestedQuantity + 1); while (r.NextDouble() <= Math.Min(0.9, drop.ExtraQuantityChance)) { ++numChunks; } if (Game1.IsMultiplayer) { for (int i = 0; i < numChunks; ++i) { location.debris.Add(new Debris(drop.Item.Choose(r).Create(), new Vector2((tileLocation.X + 1) * 64 + 32, (tileLocation.Y + 1) * 64 + 32), Game1.getFarmer(t.getLastFarmerToUse().UniqueMultiplayerID).getStandingPosition())); } //Game1.createMultipleObjectDebris( base.parentSheetIndex, ( int ) tileLocation.X + 1, ( int ) tileLocation.Y + 1, numChunks, t.getLastFarmerToUse().UniqueMultiplayerID, location ); } else { CustomGiantCrop.Game1_createRadialDebris(location, drop.Item.Choose(r).Create(), (int)tileLocation.X, (int)tileLocation.Y, numChunks, resource: false, -1, item: true); } } //Object tmp = new Object(Vector2.Zero, base.parentSheetIndex, 1); //Game1.setRichPresence( "giantcrop", tmp.Name ); Game1.createRadialDebris(Game1.currentLocation, 12, (int)tileLocation.X, (int)tileLocation.Y, Game1.random.Next(4, 9), resource: false); location.playSound("stumpCrack"); Game1_multiplayer.broadcastSprites(location, new TemporaryAnimatedSprite(5, tileLocation * 64f, Color.White)); Game1_multiplayer.broadcastSprites(location, new TemporaryAnimatedSprite(5, (tileLocation + new Vector2(1f, 0f)) * 64f, Color.White, 8, flipped: false, 110f)); Game1_multiplayer.broadcastSprites(location, new TemporaryAnimatedSprite(5, (tileLocation + new Vector2(1f, 1f)) * 64f, Color.White, 8, flipped: true, 80f)); Game1_multiplayer.broadcastSprites(location, new TemporaryAnimatedSprite(5, (tileLocation + new Vector2(0f, 1f)) * 64f, Color.White, 8, flipped: false, 90f)); Game1_multiplayer.broadcastSprites(location, new TemporaryAnimatedSprite(5, tileLocation * 64f + new Vector2(32f, 32f), Color.White, 8, flipped: false, 70f)); Game1_multiplayer.broadcastSprites(location, new TemporaryAnimatedSprite(5, tileLocation * 64f, Color.White)); Game1_multiplayer.broadcastSprites(location, new TemporaryAnimatedSprite(5, (tileLocation + new Vector2(2f, 0f)) * 64f, Color.White, 8, flipped: false, 110f)); Game1_multiplayer.broadcastSprites(location, new TemporaryAnimatedSprite(5, (tileLocation + new Vector2(2f, 1f)) * 64f, Color.White, 8, flipped: true, 80f)); Game1_multiplayer.broadcastSprites(location, new TemporaryAnimatedSprite(5, (tileLocation + new Vector2(2f, 2f)) * 64f, Color.White, 8, flipped: false, 90f)); Game1_multiplayer.broadcastSprites(location, new TemporaryAnimatedSprite(5, tileLocation * 64f + new Vector2(96f, 96f), Color.White, 8, flipped: false, 70f)); Game1_multiplayer.broadcastSprites(location, new TemporaryAnimatedSprite(5, (tileLocation + new Vector2(0f, 2f)) * 64f, Color.White, 8, flipped: false, 110f)); Game1_multiplayer.broadcastSprites(location, new TemporaryAnimatedSprite(5, (tileLocation + new Vector2(1f, 2f)) * 64f, Color.White, 8, flipped: true, 80f)); return(true); } return(false); }