private void SetBigUi() { try { ConsoleRect.TransferValuesFrom(C_RestTransform2); //C_RestTransform2.ApplyTo(ConsoleRect); BorderText.TransferValuesFrom(B_Text2); MessageRect.TransferValuesFrom(M_RectTransfrom2); PointATrans.position = PointA_Pos2.GetComponent <Transform>().position; PointBTrans.position = PointB_Pos2.GetComponent <Transform>().position; //PointATrans.TransferValuesFrom(PointA_Pos2); //PointBTrans.TransferValuesFrom(PointB_Pos2); FloorRect.TransferValuesFrom(Floor_Rect2); TileRect.TransferValuesFrom(Tile_Rect2); EffectRect.TransferValuesFrom(Effect_Rect2); ItemName.TransferValuesFrom(item_Name2); ItemType.TransferValuesFrom(item_Type2); ItemRareness.TransferValuesFrom(item_Rareness2); ItemEffects.TransferValuesFrom(item_Effects2); } catch { } }
private string[] GenerateDescription(ItemRareness rareness, ItemMaterial material) { return(new[] { GetMaterialDescription(material), GetRarenessDescription(rareness) }); }
public IItem Generate(ItemRareness rareness) { var color = RandomHelper.GetRandomEnumValue <PotionColor>(); var type = GameData.Current.PotionsPattern[color]; var size = GetSize(rareness); return(new Potion(color, type, size, rareness)); }
private string GetRarenessDescription(ItemRareness rareness) { var textConfig = configuration.DescriptionConfiguration.RarenessDescription.FirstOrDefault(config => config.Rareness == rareness); if (textConfig == null) throw new ApplicationException($"Text configuration not found for shield rareness: {rareness}"); return RandomHelper.GetRandomElement(textConfig.Text); }
public ShieldItem GenerateShield(ItemRareness rareness) { if (GetIfRarenessExceedMax(rareness)) { throw new ArgumentException("Item generator cannot generate epic items."); } return(shieldGenerator.GenerateShield(rareness)); }
public ArmorItem GenerateArmor(ItemRareness rareness, ArmorClass armorClass) { if (GetIfRarenessExceedMax(rareness)) { throw new ArgumentException("Item generator cannot generate epic items."); } return(armorGenerator.GenerateArmor(rareness, armorClass)); }
public SpellBook GenerateSpellBook(ItemRareness rareness) { if (GetIfRarenessExceedMax(rareness)) { throw new ArgumentException("Item generator cannot generate epic items."); } return(spellBookGenerator.GenerateSpellBook(rareness)); }
public IItem GenerateResource(ItemRareness rareness) { if (GetIfRarenessExceedMax(rareness)) { throw new ArgumentException("Item generator cannot generate epic items."); } return(resourceItemsGenerator.GenerateResourceItem(rareness)); }
public IItem GenerateResourceItem(ItemRareness rareness) { if (rareness == ItemRareness.Common) { return(new BlankScroll()); } return(null); }
private IShieldRarenessConfiguration GetRarenessConfiguration(IShieldConfiguration config, ItemRareness rareness) { var result = config.RarenessConfiguration.FirstOrDefault(conf => conf.Rareness == rareness); if (result == null) throw new ApplicationException($"No shield rareness configuration for rareness: {rareness}"); return result; }
private IWeaponRarenessConfiguration GetRarenessConfiguration(ItemRareness rareness) { var result = configuration.RarenessConfiguration.FirstOrDefault(config => config.Rareness == rareness); if (result == null) { throw new ApplicationException($"No {baseName} rareness configuration for rareness: {rareness}"); } return(result); }
public IItem GenerateUsableItem(ItemRareness rareness) { var type = GetRandomItemType(); if (generators.ContainsKey(type)) { return(generators[type].Generate(rareness)); } throw new ArgumentException($"Unknown usable item type: {type}"); }
private ISpellBookRarenessConfiguration GetConfiguration(ItemRareness rareness) { var result = configuration.Configuration.FirstOrDefault(config => config.Rareness == rareness); if (result == null) { throw new ApplicationException($"Rareness configuration not found for spell book rareness: {rareness}"); } return(result); }
private IArmorRarenessConfiguration GetRarenessConfiguration(IArmorPieceConfiguration config, ItemRareness rareness) { var result = config.RarenessConfigurations.FirstOrDefault(c => c.Rareness == rareness); if (result == null) { throw new ApplicationException($"Rareness config not found for armor rareness {rareness}"); } return(result); }
public WeaponItem GenerateWeapon(ItemRareness rareness) { if (GetIfRarenessExceedMax(rareness)) { throw new ArgumentException("Item generator cannot generate epic items."); } var weaponType = GetRandomWeaponType(); var generator = weaponGenerators[weaponType]; return(generator.GenerateWeapon(rareness)); }
public Potion(PotionColor color, PotionType type, PotionSize size, ItemRareness rareness) : base(new ItemConfiguration { Key = GetKey(color), Name = "Potion", Rareness = rareness, Weight = GetWeight(size) }) { this.color = color; this.type = type; this.size = size; potionData = DataFactory.GetPotionData(type, size); }
public ShieldItem GenerateShield(ItemRareness rareness) { var config = RandomHelper.GetRandomElement( configuration.SmallShieldConfiguration, configuration.MediumShieldConfiguration, configuration.BigShieldConfiguration); var rarenessConfig = GetRarenessConfiguration(config, rareness); var material = RandomHelper.GetRandomElement(rarenessConfig.Materials); var name = GenerateName(material, config.Name); var inventoryImage = GenerateInventoryImage(config, material); var worldImage = GetMaterialColoredImage(config.WorldImage, material); var equippedImageRight = GetMaterialColoredImage(config.EquippedImageRight, material); var equippedImageLeft = GetMaterialColoredImage(config.EquippedImageLeft, material); var bonusesCount = GetIntervalRandomValue(rarenessConfig.Bonuses); var weightConfiguration = GetWeightConfiguration(config, material); var maxDurability = weightConfiguration.Durability; var blocksDamage = GetIntervalRandomValue(rarenessConfig.BlocksDamage); var protectChance = GetIntervalRandomValue(rarenessConfig.ProtectChance); var hitChancePenalty = - GetIntervalRandomValue(rarenessConfig.HitChancePenalty); // Negative value var description = GenerateDescription(rareness, material); var itemConfig = new ShieldItemConfiguration { Name = name, Key = Guid.NewGuid().ToString(), Rareness = rareness, InventoryImage = inventoryImage, WorldImage = worldImage, EquippedImageRight = equippedImageRight, EquippedImageLeft = equippedImageLeft, Weight = weightConfiguration.Weight, MaxDurability = maxDurability, BlocksDamage = blocksDamage, ProtectChance = protectChance, HitChancePenalty = hitChancePenalty, Description = description }; bonusesGenerator.GenerateBonuses(itemConfig, bonusesCount); var durabilityPercent = RandomHelper.GetRandomValue(MinDurabilityPercent, MaxDurabilityPercent); var durability = Math.Min(itemConfig.MaxDurability, (int)Math.Round(itemConfig.MaxDurability * (durabilityPercent / 100d))); itemConfig.Durability = durability; return new ShieldItem(itemConfig); }
private static PotionSize GetSize(ItemRareness rareness) { switch (rareness) { case ItemRareness.Common: return(PotionSize.Small); case ItemRareness.Uncommon: return(PotionSize.Medium); case ItemRareness.Rare: return(PotionSize.Big); default: throw new ArgumentOutOfRangeException(nameof(rareness), rareness, null); } }
private IItem GenerateScroll(ItemRareness rareness, BookSpell[] spells, int minDamage, int maxDamage) { var spell = RandomHelper.GetRandomElement(spells); var damage = RandomHelper.GetRandomValue(minDamage, maxDamage); var name = GetName(spell); return(new AncientScroll(new AncientScrollItemConfiguration { Name = $"{name} Scroll", Code = spell.Code, Mana = spell.ManaCost, DamagePercent = damage, Key = Guid.NewGuid().ToString(), Rareness = rareness, SpellName = name })); }
public WeaponItem GenerateWeapon(ItemRareness rareness) { var rarenessConfiguration = GetRarenessConfiguration(rareness); var material = RandomHelper.GetRandomElement(rarenessConfiguration.Materials); var inventoryImage = GenerateImage(material); var worldImage = GetMaterialColoredImage(worldImageName, material); var equippedRightImage = GetMaterialColoredImage(configuration.EquippedImageRight, material); var equippedLeftImage = GetMaterialColoredImage(configuration.EquippedImageLeft, material); var maxDamage = GenerateMaxDamage(rarenessConfiguration); var minDamage = maxDamage.ToDictionary(pair => pair.Key, pair => pair.Value - rarenessConfiguration.MinMaxDamageDifference); var hitChance = RandomHelper.GetRandomValue(rarenessConfiguration.MinHitChance, rarenessConfiguration.MaxHitChance); var weightConfiguration = GetWeightConfiguration(material); var name = GenerateName(material); var description = GenerateDescription(rareness, material); var bonusesCount = RandomHelper.GetRandomValue(rarenessConfiguration.MinBonuses, rarenessConfiguration.MaxBonuses); var maxDurability = weightConfiguration.Durability; var itemConfig = new WeaponItemConfiguration { Name = name, Key = Guid.NewGuid().ToString(), Description = description, Rareness = rareness, Weight = weightConfiguration.Weight, MaxDamage = maxDamage, MinDamage = minDamage, HitChance = hitChance, InventoryImage = inventoryImage, WorldImage = worldImage, EquippedImageRight = equippedRightImage, EquippedImageLeft = equippedLeftImage, MaxDurability = maxDurability }; bonusesGenerator.GenerateBonuses(itemConfig, bonusesCount); var durabilityPercent = RandomHelper.GetRandomValue(MinDurabilityPercent, MaxDurabilityPercent); var durability = Math.Min(itemConfig.MaxDurability, (int)Math.Round(itemConfig.MaxDurability * (durabilityPercent / 100d))); itemConfig.Durability = durability; return(new WeaponItem(itemConfig)); }
public IItem Generate(ItemRareness rareness) { switch (rareness) { case ItemRareness.Trash: case ItemRareness.Common: return(null); case ItemRareness.Uncommon: return(GenerateScroll(rareness, spellsProvider.GetUncommonSpells(), UncommonMinDamage, UncommonMaxDamage)); case ItemRareness.Rare: return(GenerateScroll(rareness, spellsProvider.GetRareSpells(), RareMinDamage, RareMaxDamage)); case ItemRareness.Epic: throw new ArgumentException("Scrolls generator cannot generate scroll with Epic rareness."); default: throw new ArgumentException($"Unknown rareness: {rareness}"); } }
public ArmorItem GenerateArmor(ItemRareness rareness, ArmorClass armorClass) { var armorType = GenerateArmorType(); var config = GetSpecificConfiguration(armorType, armorClass); var rarenessConfig = GetRarenessConfiguration(config, rareness); var material = RandomHelper.GetRandomElement(rarenessConfig.Materials); var inventoryImage = GetArmorImage(config, material); var worldImage = GetWorldImage(material, armorType); var equippedImage = GetEquippedImage(material, config); var protection = GenerateProtection(rarenessConfig.Protection); var name = GenerateName(material, config.TypeName, armorType); var description = GenerateDescription(rareness, material); var weightConfig = GetWeightConfiguration(config, material); var maxDurability = weightConfig.Durability; var bonusesCount = RandomHelper.GetRandomValue(rarenessConfig.MinBonuses, rarenessConfig.MaxBonuses); var itemConfig = new ArmorItemConfiguration { Name = name, Key = Guid.NewGuid().ToString(), ArmorType = armorType, Description = description, InventoryImage = inventoryImage, WorldImage = worldImage, EquippedImage = equippedImage, Protection = protection, Rareness = rareness, Weight = weightConfig.Weight, MaxDurability = maxDurability }; bonusesGenerator.GenerateBonuses(itemConfig, bonusesCount); var durabilityPercent = RandomHelper.GetRandomValue(MinDurabilityPercent, MaxDurabilityPercent); var durability = Math.Min(itemConfig.MaxDurability, (int)Math.Round(itemConfig.MaxDurability * (durabilityPercent / 100d))); itemConfig.Durability = durability; return(new ArmorItem(itemConfig)); }
public static Color GetRarenessColor(ItemRareness rareness) { switch (rareness) { case ItemRareness.Trash: return(Color.Gray); case ItemRareness.Common: return(Color.White); case ItemRareness.Uncommon: return(Color.Lime); case ItemRareness.Rare: return(Color.FromArgb(0, 102, 255)); case ItemRareness.Epic: return(Color.Violet); default: throw new ArgumentOutOfRangeException(); } }
public SpellBook GenerateSpellBook(ItemRareness rareness) { var config = GetConfiguration(rareness); var spellsCount = RandomHelper.GetRandomValue(config.MinSpells, config.MaxSpells); var bonusesCount = RandomHelper.GetRandomValue(config.MinBonuses, config.MaxBonuses); var inventoryImage = GenerateImage(out var mainColor); var worldImage = GetWorldImage(mainColor); var itemConfig = new SpellBookConfiguration { Name = DefaultName, Key = Guid.NewGuid().ToString(), Description = GenerateDescription(config), Size = spellsCount, InventoryImage = inventoryImage, WorldImage = worldImage, Weight = configuration.Weight, Rareness = rareness }; bonusesGenerator.GenerateBonuses(itemConfig, bonusesCount); return(new SpellBook(itemConfig)); }
private IBonusConfiguration[] GetConfiguration(ItemRareness rareness, string groupName) { var configurations = CollectGroupConfiguration(groupName); return(configurations.Where(conf => conf.Rareness == rareness).SelectMany(conf => conf.Bonuses).ToArray()); }
private IItem GenerateArmor(IItemsGenerator generator, ItemRareness rareness, Chance <ArmorClass>[] classSettings) { var armorClass = GenerateValue(classSettings); return(generator.GenerateArmor(rareness, armorClass)); }
private static bool GetIfRarenessExceedMax(ItemRareness rareness) { return(rareness == ItemRareness.Epic); }
public IMapObject CreateOreWall(ItemRareness rareness) { throw new InvalidOperationException("Ore walls are not supported for dungeon maps"); }