public static int GetProductBuyPrize(Product product) { int i = (int)(product.Level * 5 * GetDifficultyMultiplier(true)); if (actualPlanet == GameManager.PlayerCapital) return i; int lvlDiff = LevelManager.ActualLevel(actualPlanet.PlanetSettlement.CommerceLevel) - LevelManager.ActualLevel(GameManager.PlayerCapital.PlanetSettlement.CommerceLevel); if (lvlDiff <= 0) i /= 2; else i *= 2; if (GameManager.ActualSystemOwner.EmpireName == GameManager.PlayerEmpire.EmpireName) i /= 4; if (GameManager.ActualSystemOwner.ShowRelationWithPlayer().RelationPoints < 0) i *= 2; else i /= 2; if (i <= 0) i = 1; return i; }
static Tuple<Texture2D, string> ReturnProductTupleFromType(Product.ProductType type) { string productType = ""; Texture2D txt = foodIcon; switch (type) { case Product.ProductType.FOOD: productType = "Cibo"; txt = foodIcon; break; case Product.ProductType.TECNO: productType = "Tecnologia"; txt = tecnoIcon; break; case Product.ProductType.TOOL: default: productType = "Strumenti"; txt = toolIcon; break; } return new Tuple<Texture2D, string>(txt, productType); }
public uint ProduceAndConsume() { int needs = (inhabitants / LevelManager.ActualLevel(scienceLevel)) / 2048; int food = needs / 2; int tecno = needs / 4; int tool = needs / 4; uint retNeeds = (uint)needs; int i = 0; do { if (i >= Products.Count) { Product p1 = new Product(Product.ProductType.FOOD, food / 4, LevelManager.ActualLevel(scienceLevel)); Product p2 = new Product(Product.ProductType.TECNO, tecno / 4, LevelManager.ActualLevel(tecnoLevel)); Product p3 = new Product(Product.ProductType.TOOL, tool / 4, LevelManager.ActualLevel(tecnoLevel)); needs = 0; products.Add(p1); products.Add(p2); products.Add(p3); } else { if(products[i].Type == Product.ProductType.FOOD) { if(food > products[i].Quantity) { food -= products[i].Quantity; needs -= products[i].Quantity; products[i].Quantity = 0; } else { products[i].Quantity -= food; needs -= food; food = 0; } } else if (products[i].Type == Product.ProductType.TECNO) { if (tecno > products[i].Quantity) { tecno -= products[i].Quantity; needs -= products[i].Quantity; products[i].Quantity = 0; } else { products[i].Quantity -= tecno; needs -= tecno; tecno = 0; } int diff = products[i].Level - LevelManager.ActualLevel(tecnoLevel); if (diff > 0) tecnoLevel += 0.3f * diff; } else { if (tool > products[i].Quantity) { tool -= products[i].Quantity; needs -= products[i].Quantity; products[i].Quantity = 0; } else { products[i].Quantity -= tool; needs -= tool; food = 0; } int diff = products[i].Level - LevelManager.ActualLevel(tecnoLevel); if (diff > 0) tecnoLevel += 0.3f * diff; } } i++; } while (needs != 0); for (int j = products.Count - 1; j >= 0; j--) { if (products[j].Quantity == 0) products.RemoveAt(j); } return retNeeds; }
public static int GetProductSellPrize(Product product) { int i = (int)(product.Level * 5 * GetDifficultyMultiplier(false)); int planetLevel = 1; if (product.Type == Product.ProductType.FOOD) planetLevel = LevelManager.ActualLevel(actualPlanet.PlanetSettlement.CommerceLevel); else if (product.Type == Product.ProductType.TECNO) planetLevel = LevelManager.ActualLevel(actualPlanet.PlanetSettlement.TecnoLevel); else //productType == TOOL planetLevel = LevelManager.ActualLevel(actualPlanet.PlanetSettlement.ScienceLevel); int lvlDiff = planetLevel - product.Level; if (lvlDiff <= 0) i *= 2; else i /= 2; if (GameManager.ActualSystemOwner.EmpireName == GameManager.PlayerEmpire.EmpireName) i /= 2; if (GameManager.ActualSystemOwner.ShowRelationWithPlayer().RelationPoints < 0) i *= 2; if (i <= 0) i = 1; return i; }