public static SpawnBehaviorEntry Forageable(double chance, int obj) { SpawnBehaviorEntry s = new SpawnBehaviorEntry(); s.Chance = chance; s.ObjectID = obj; return(s); }
public static SpawnBehaviorEntry Ore(double chance, int levelReq, int obj, int health) { SpawnBehaviorEntry s = new SpawnBehaviorEntry(); s.Chance = chance; s.MiningLevelRequirement = levelReq; s.ObjectID = obj; s.InitialStack = 10; s.OreHealth = health; return(s); }
public static SpawnBehaviorEntry chooseEntry(List <SpawnBehaviorEntry> entries) { SpawnBehaviorEntry ret = null; foreach (var entry in entries) { if (entry.OnlyTryIfNoneSelectedYet && ret != null) { continue; } if (Game1.player != null && Game1.player.miningLevel < entry.MiningLevelRequirement) { continue; } if (Game1.random.NextDouble() <= entry.Chance) { ret = entry; } } return(ret ?? entries.Last()); }