public void removeThisCritter(Critter critter) { List <Critter> newCritterList = getAllActiveCritters(); newCritterList.Remove(critter); updateActiveCritters(newCritterList); }
public static Bug getBugFromCritterType(Critter critter) { var bug = new Bug(); BugModel data = createBugModelFromCritter(critter); bug = new Bug(data); return(bug); }
public static void getBugFromNet(GameLocation location, StardewValley.Farmer who) { Log.info($"Now the bug comes from the net"); CritterLocations critterLocations = new CritterLocations(location); critterLocations.removeThisCritter(CaughtCritter); who.addItemByMenuIfNecessary((Item)BugInNet.getOne()); who.AddCustomSkillExperience(BugCatchingMod.skill, BugInNet.bugModel.Price); Log.info("player experience: " + Game1.player.GetCustomSkillExperience(BugCatchingMod.skill).ToString()); CaughtCritter = (CustomCritter)null; }
public bool checkCatch(Critter critter, Rectangle catchZone) { caughtBug = false; Log.info($"checking the critter {critter.GetHashCode().ToString()}"); if (critter.getBoundingBox(0, 0).Intersects(catchZone)) { BugModel bug = BugApi.createBugModelFromCritter(critter); if (bug.Rarity < netModel.maxRarity) { CaughtCritter = critter; caughtBug = true; Log.info($"Caught a bug {bug.Name}"); } else { Game1.addHUDMessage(new HUDMessage($"The {bug.Name} escaped your {this.Name}")); //check for bugHasItem } } return(caughtBug); }
public static BugModel createBugModelFromCritter(Critter critter) { string bugName = critter.GetType().ToString().Split('.').Last(); if (AllKnownClassifications.Contains(bugName)) { BugModel bugModel = new BugModel(); if (bugName == "Floater") { Floater f = (Floater)critter; bugModel = AllBugs.Find(b => b.FullId == f.data.BugModel.FullId); } else { CustomCritter c = (CustomCritter)critter; bugModel = AllBugs.Find(b => b.FullId == c.data.BugModel.FullId); } return(bugModel); } int TileIndex = Helper.Reflection.GetField <int>(critter, "baseFrame").GetValue(); return(createPlainBugModel(bugName, TileIndex)); }
public void deactivateCritter(Critter critter) { removeThisCritter(critter); }