public Character(string _name, Class _class, int _level, int _expToNext, int _maxHealth, int _currentHealth, int _maxMana, int _currentMana, int _money, int _strength, int _agility, int _intelligence, int _speed, IDictionary<string, Ability> _abilities, ICollection<ItemStack> _inventory, Weapon _weapon, Armour _chest, Armour _helm, Armour _gloves, Armour _boots, Armour _legs) { name = _name; charClass = _class; level = _level; expToNext = _expToNext; maxHealth = _maxHealth; currentHealth = _currentHealth; maxMana = _maxMana; currentMana = _currentMana; money = _money; strength = _strength; agility = _agility; intelligence = _intelligence; speed = _speed; type = _class.type; abilities = new Dictionary<string, Ability>(_abilities); inventory = new List<ItemStack>(_inventory); weapon = _weapon; chest = _chest; helm = _helm; gloves = _gloves; boots = _boots; legs = _legs; dice = new D20(); buffs = new Effect(); }
public Armour(int _id, Armour armour, int _level) { id = _id; name = Equipment.equipmentPrefixes[_level - 1] + armour.name; description = armour.description; value = armour.value; type = armour.type; stackable = false; icon = armour.icon; stats = new EquipmentEffect(armour.stats); stats.modifyEffect(1 + (_level - 1) * ItemSet.levelMultipler); level = _level; }
public Class(StatModifier initialModifier, StatModifier levelModifier, ClassType ctype, string description, Uri imageSource, IDictionary<string, Ability> _abilities, Weapon _startingWeapon, Armour _startingHelm, Armour _startingChest, Armour _startingGloves, Armour _startingBoots, Armour _startingLegs) { this.initialModifier = initialModifier; this.levelModifier = levelModifier; _type = ctype; _description = description; this.imageSource = imageSource; abilities = _abilities; startingWeapon = _startingWeapon; startingHelm = _startingHelm; startingChest = _startingChest; startingGloves = _startingGloves; startingBoots = _startingBoots; startingLegs = _startingLegs; }
public static void constructItemBase() { Consumable healthPot; Consumable manaPot; for (uint i = 1; i <= Consumable.consumablePrefixes.LongCount(); i++) { string prefix = Consumable.consumablePrefixes[i - 1]; healthPot = new Consumable((int)i, prefix + "healing potion", "Regenerates health", Consumable.healthPotionBaseValue * i, ConsumableType.health, (int)(Consumable.healthPotionBaseRegen * i), new Uri("Images/Items/rune-long.png", UriKind.Relative)); ItemSet.addItem(healthPot); manaPot = new Consumable((int)(i + Consumable.consumablePrefixes.LongCount()), prefix + "mana potion", "Regenerates mana", Consumable.manaPotionBaseValue * i, ConsumableType.mana, (int)(Consumable.manaPotionBaseRegen * i), new Uri("Images/Items/rune-long.png", UriKind.Relative)); ItemSet.addItem(manaPot); } Weapon.populateWeaponTypeEffects(); Weapon w = new Weapon(101, "Magic stick", "A magical staff", 50, WeaponType.STAFF, 1, new Uri("Images/Items/addy-scim.png", UriKind.Relative)); ItemSet.addItem(w); w = new Weapon(100, "Broadsword", "Large two handed sword", 50, WeaponType.TWOHANDEDSWORD, 1, new Uri("Images/Items/addy-mace.png", UriKind.Relative)); ItemSet.addItem(w); w = new Weapon(102, "Shortsword", "A short blade", 50, WeaponType.ONEHANDEDSWORD, 1, new Uri("Images/Items/addy-baxe.png", UriKind.Relative)); ItemSet.addItem(w); Armour a = new Armour(200, "Long robe", "A cotton robe", 50, ArmourType.CHEST, new EquipmentEffect(0, 0, 10, 0, 0, 50), 1, new Uri("Images/Items/rune-lsword.png", UriKind.Relative)); ItemSet.addItem(a); a = new Armour(300, "Soft hood", "A nice hood", 30, ArmourType.HELM, new EquipmentEffect(-2, 0, 5, 0, 0, 20), 1, new Uri("Images/Items/addy-scim.png", UriKind.Relative)); ItemSet.addItem(a); a = new Armour(400, "Woven gloves", "Handknitted gloves", 20, ArmourType.GLOVES, new EquipmentEffect(-1, 0, 4, 0, 0, 15), 1, new Uri("Images/Items/addy-scim.png", UriKind.Relative)); ItemSet.addItem(a); a = new Armour(500, "Mystic treads", "Very reliable pair of shoes", 20, ArmourType.BOOTS, new EquipmentEffect(-2, 1, 3, 0, 0, 15), 1, new Uri("Images/Items/addy-mace.png", UriKind.Relative)); ItemSet.addItem(a); a = new Armour(600, "Damp britches", "These have seen better days", 20, ArmourType.LEGS, new EquipmentEffect(-1, 0, 2, 0, 0, 10), 1, new Uri("Images/Items/addy-baxe.png", UriKind.Relative)); ItemSet.addItem(a); }
public void endBattle() { if (char_1.currentHealth == 0) { //Player has lost return; } else { int progress = char_1.expToNext - char_2.expValue; if (progress <= 0) { char_1.levelUp(); char_1.expToNext += progress; } else { char_1.expToNext -= progress; } Random rnd = new Random(); int lootTableSize = char_2.lootTable.Count; int lootRand = rnd.Next(1, ((int)Math.Sqrt(lootTableSize) + lootTableSize) / 2); int n = lootTableSize; int i = 0; while (n < lootRand) { n += (n - 1); i++; } Item loot = char_2.lootTable.ToArray()[i]; if (loot is Armour) { lootRand = rnd.Next(1, ((int)Math.Sqrt(Equipment.NUMBEROFLEVELS) + Equipment.NUMBEROFLEVELS) / 2); int j = Equipment.NUMBEROFLEVELS; int k = 0; while (j < lootRand) { j += (j - 1); k++; } loot = new Armour(loot.id, loot as Armour, k); } else if (loot is Weapon) { lootRand = rnd.Next(1, ((int)Math.Sqrt(Equipment.NUMBEROFLEVELS) + Equipment.NUMBEROFLEVELS) / 2); int j = Equipment.NUMBEROFLEVELS; int k = 0; while (j < lootRand) { j += (j - 1); k++; } loot = new Weapon(loot.id, loot as Weapon, k); } //Setup loot screen char_1.resetStats(); char_1.money += char_2.expValue; } }