public void ResetMaterial(Material material) { stats.Clear(); stats.Add(new NameValue("Cost", GameInfo.CostOf(material).ToString() + "c")); stats.Add(new NameValue("Sell Value", GameInfo.SellValueOf(material).ToString() + "c")); name = material.ToString().AddSpaces(); desc = Utilities.GetDescOf(material); Position(); }
public MaterialInfoHover(Material material, SpriteFont font, GraphicsDevice graphics, int windowWidth) : base(graphics, font, material.ToString().AddSpaces(), Utilities.GetDescOf(material), new List <NameValue>(), windowWidth) { stats.Add(new NameValue("Cost", GameInfo.CostOf(material).ToString())); stats.Add(new NameValue("Sell Value", GameInfo.SellValueOf(material).ToString())); for (int i = 0; i < stats.Count; i++) { statLocs.Add(new Vector2()); } Position(); }
public static List <Material> MaterialsForType(GiftType type) { List <Material> returnVal = new List <Material>(); // Helps us randomly iterate through all the materials, not just the ones that are first // This prevents gifts from being biased towards the first materials in the enum List <Material> materials = Enum.GetValues(typeof(Material)).Cast <Material>().ToList(); materials.Shuffle(); int groups = MaterialGroupsFor(type); int valuePerGroup = GiftWorthFor(type) / groups; for (int i = 0; i < groups && i < materials.Count; i++) { int materialWorth = GameInfo.CostOf(materials[i]); if (materialWorth * 2 < valuePerGroup) { int counts = valuePerGroup / materialWorth; returnVal.AddRange(Enumerable.Repeat(materials[i], counts)); } } return(returnVal); // Old gift code (from pre-1.1) //int giftWorth = GiftWorthFor(type); //for (int i = 0; i < materials.Count && returnVal.Count < (int)type + 15; i++) //{ // int worth = GameInfo.CostOf(materials[i]); // int percentChance = giftWorth - worth; // while (percentChance >= 100) // { // returnVal.Add(materials[i]); // percentChance -= Utilities.Rand.Next(10, 15); // } // if (Utilities.Rand.Next(100) + 1 <= percentChance && // percentChance < 100) // { // returnVal.Add(materials[i]); // } //} }