internal static ConsumableAbstract CreateConsumable(int type, int specials, int level, int quality, string name) { int difficulty = StateHandler.Difficulty; ConsumableAbstract CTemp = new ConsumableAbstract(); CTemp.Name = name; int itemLevel = level; itemLevel /= 15; itemLevel += (difficulty - 3); itemLevel += (quality - 3); if (itemLevel < 1) { itemLevel = 1; } CTemp.Power = itemLevel; if (type > 0) { CTemp.Type = type; } else { int chance = Globals.Random(0, 100); if (chance < 10) { CTemp.Type = Globals.TYPE_CONSUMABLE_FIRE; } else if (chance < 20) { CTemp.Type = Globals.TYPE_CONSUMABLE_NATURE; } else if (chance < 30) { CTemp.Type = Globals.TYPE_CONSUMABLE_WATER; } else if (chance < 40) { CTemp.Type = Globals.TYPE_CONSUMABLE_PHYSICAL; } else if (chance < 50) { CTemp.Type = Globals.TYPE_CONSUMABLE_PHYSICAL + Globals.TYPE_CONSUMABLE_FIRE; } else { CTemp.Type = Globals.TYPE_CONSUMABLE_POTION; } } return(CTemp); }
internal static ConsumableAbstract CreateConsumable(int type, int specials, int level, int quality, string name) { int difficulty = StateHandler.Difficulty; ConsumableAbstract CTemp = new ConsumableAbstract(); CTemp.Name = name; int itemLevel = level; itemLevel /= 15; itemLevel += (difficulty-3); itemLevel += (quality-3); if (itemLevel < 1) itemLevel = 1; CTemp.Power = itemLevel; if (type > 0) { CTemp.Type = type; } else { int chance = Globals.Random(0, 100); if (chance < 10) CTemp.Type = Globals.TYPE_CONSUMABLE_FIRE; else if (chance < 20) CTemp.Type = Globals.TYPE_CONSUMABLE_NATURE; else if (chance < 30) CTemp.Type = Globals.TYPE_CONSUMABLE_WATER; else if (chance < 40) CTemp.Type = Globals.TYPE_CONSUMABLE_PHYSICAL; else if (chance < 50) CTemp.Type = Globals.TYPE_CONSUMABLE_PHYSICAL + Globals.TYPE_CONSUMABLE_FIRE; else CTemp.Type = Globals.TYPE_CONSUMABLE_POTION; } return CTemp; }