public void TestChangeChestplate()//Probamos crear una nueva armadura para luego cambiarla { Chestplate chestplate2 = new Chestplate("Armadura de prueba", 2, 50); dwarf1.ChangeChestplate(chestplate2); Assert.AreEqual("Armadura de prueba", dwarf1.Armor.GetName()); }
public void Setup() { this.dwarfAxe = new Axe("Dorada", 10, 0); this.dwarfChestplate = new Chestplate("Malla Plata", 0, 10); this.dwarf1 = new Dwarf("Kili", 100, dwarfAxe, dwarfChestplate, 20, 15, 50); this.dwarf2 = new Dwarf("Thorin", 50, dwarfAxe, dwarfChestplate, 50, 20, 500); }
public String Information() { return(ToString() + "\n-------------------------" + "\nHelmet: " + (Helmet == null ? "none" : Helmet.ToString()) + "\nChestplate: " + (Chestplate == null ? "none" : Chestplate.ToString()) + "\nLeggings: " + (Leggins == null ? "none" : Leggins.ToString()) + "\nRightHand: " + (RightHand == null ? "none" : RightHand.ToString()) + "\nLeftHand: " + (LeftHand == null ? "none" : LeftHand.ToString())); }
public void SetChestplate(Chestplate value) { if (chestplate != null) { attack -= chestplate.attack; dextery -= chestplate.dextery; defense -= chestplate.defense; resistance -= chestplate.resistance; Bag.Instance.PutInBag(chestplate); } if (value != null) { attack += value.attack; dextery += value.dextery; defense += value.defense; resistance += value.resistance; Bag.Instance.RemoveFromBag(value); } chestplate = value; }
private void CreateChestplates() { Chestplate newChestplate = new Chestplate(); newChestplate.name = "Nothing"; newChestplate.description = "You got no shirt mate"; newChestplate.defense = 0; chestplateList.Add(newChestplate); // newChestplate = new Chestplate(); newChestplate.name = "Ender's Cloak"; newChestplate.description = "Easily can poke holes through"; newChestplate.defense = 3; chestplateList.Add(newChestplate); // newChestplate = new Chestplate(); newChestplate.name = "Taffy's star chestplate"; newChestplate.description = "A fine linen cloth crafted by the hands of a bound eastern man"; newChestplate.defense = 15; chestplateList.Add(newChestplate); }
static void Main(string[] args) { Axe DurinAxe = new Axe("Durin's Axe", 120, 5); Chestplate CitadelPlate = new Chestplate("Citadel Plate", 0, 80); Dwarf Thorin = new Dwarf("Thorin Oakenshield", 150, DurinAxe, CitadelPlate, 10, 60, 15); Bow RivendellBow = new Bow("Rivendell Bow", 140, 0); Shield RoundShield = new Shield("Round Shield", 5, 65); Elf Legolas = new Elf("Legolas", 80, RivendellBow, RoundShield, 60, 20, 30); Staff RadagastStaff = new Staff("Radagast's Staff", 30, 50, 40); Robe BrownRobe = new Robe("BrownRobe", 0, 20, 60); Spell ForceOfNature = new Spell("Force of Nature", 0, 0, 20); Spell WindShield = new Spell("Wind Shield", 0, 60, 0); Spell Firestorm = new Spell("Firestorm", 120, 0, 0); ArrayList SpellList = new ArrayList(); SpellBook RadagastBook = new SpellBook("Radagast's SpellBook", SpellList); Wizard Radagast = new Wizard("Radagast the Brown", 100, RadagastStaff, BrownRobe, RadagastBook, 10, 10, 30); Console.WriteLine("Radagast está aprendiendo Force Of Nature"); Radagast.LearnSpell(ForceOfNature); Console.WriteLine("Radagast aprendió Force Of Nature"); Console.WriteLine("Radagast está aprendiendo WindShield"); Radagast.LearnSpell(WindShield); Console.WriteLine("Radagast aprendió WindShield"); Console.WriteLine("Radagast está aprendiendo Firestorm"); Radagast.LearnSpell(Firestorm); Console.WriteLine("Radagast aprendió Firestorm"); Console.WriteLine($"La vida de Legolas es {Legolas.GetHP()}"); Console.WriteLine($"La vida de Thorin es {Thorin.GetHP()}"); Legolas.AttackDwarf(Thorin); Console.WriteLine($"Legolas ataca a Thorin, la vida de Thorin ahora es {Thorin.GetHP()}"); Thorin.AttackElf(Legolas); Console.WriteLine($"Thorin le devuelve el golpe a Legolas, la vida de Legolas ahora es {Legolas.GetHP()}"); Radagast.HealDwarf(Thorin); Radagast.HealElf(Legolas); Console.WriteLine($"Radagast cura a Thorin, la vida de Thorin es {Thorin.GetHP()}"); Console.WriteLine($"Radagast cura a Legolas, la vida de Legolas es {Legolas.GetHP()}"); }
public void SpawnEquipements() { for (int i = 0; i < 3; i++) { int choice = Random.Range(1, 7); if (choice == 1) { Equipment currentEquipment = new Staff(); Debug.Log("-- Equipement -- : " + currentEquipment.getEquipmentInfo.nom); Debug.Log("Attaque physique :" + currentEquipment.getEquipmentInfo.physical_attack); Debug.Log("Attaque magique :" + currentEquipment.getEquipmentInfo.magic_attack); Debug.Log("Défense :" + currentEquipment.getEquipmentInfo.defense); InventorySlot AddItem(Equipment Staff); Inventory AddItem(Equipment Staff); } if (choice == 2) { Equipment currentEquipment = new Dagger(); Debug.Log("-- Equipement -- : " + currentEquipment.getEquipmentInfo.nom); Debug.Log("Attaque physique :" + currentEquipment.getEquipmentInfo.physical_attack); Debug.Log("Attaque magique :" + currentEquipment.getEquipmentInfo.magic_attack); Debug.Log("Défense :" + currentEquipment.getEquipmentInfo.defense); InventorySlot AddItem(Equipment Dagger); Inventory AddItem(Equipment Dagger); } if (choice == 3) { Equipment currentEquipment = new Sword(); Debug.Log("-- Equipement -- : " + currentEquipment.getEquipmentInfo.nom); Debug.Log("Attaque physique :" + currentEquipment.getEquipmentInfo.physical_attack); Debug.Log("Attaque magique :" + currentEquipment.getEquipmentInfo.magic_attack); Debug.Log("Défense :" + currentEquipment.getEquipmentInfo.defense); InventorySlot AddItem(Equipment Sword); Inventory AddItem(Equipment Sword); } if (choice == 4) { Equipment currentEquipment = new Chestplate(); Debug.Log("-- Equipement -- : " + currentEquipment.getEquipmentInfo.nom); Debug.Log("Attaque physique :" + currentEquipment.getEquipmentInfo.physical_attack); Debug.Log("Attaque magique :" + currentEquipment.getEquipmentInfo.magic_attack); Debug.Log("Défense :" + currentEquipment.getEquipmentInfo.defense); InventorySlot AddItem(Equipment Chestplate); Inventory AddItem(Equipment Chestplate); } if (choice == 5) { Equipment currentEquipment = new Mantle(); Debug.Log("-- Equipement -- : " + currentEquipment.getEquipmentInfo.nom); Debug.Log("Attaque physique :" + currentEquipment.getEquipmentInfo.physical_attack); Debug.Log("Attaque magique :" + currentEquipment.getEquipmentInfo.magic_attack); Debug.Log("Défense :" + currentEquipment.getEquipmentInfo.defense); InventorySlot AddItem(Equipment Mantle); Inventory AddItem(Equipment Mantle); } if (choice == 6) { Equipment currentEquipment = new Shield(); Debug.Log("-- Equipement -- : " + currentEquipment.getEquipmentInfo.nom); Debug.Log("Attaque physique :" + currentEquipment.getEquipmentInfo.physical_attack); Debug.Log("Attaque magique :" + currentEquipment.getEquipmentInfo.magic_attack); Debug.Log("Défense :" + currentEquipment.getEquipmentInfo.defense); InventorySlot AddItem(Equipment Shield); Inventory AddItem(Equipment Shield); } } }
public override string GenerateJson(bool topLevel) { var b = new StringBuilder(base.GenerateJson(topLevel)); if (!string.IsNullOrWhiteSpace(CustomName)) { b.AppendFormat("CustomName:\"{0}\",", CustomName.EscapeJsonString()); } if (!string.IsNullOrWhiteSpace(CustomName) && CustomNameVisible) { b.Append("CustomNameVisible:1b,"); } if (CanPickUpLoot) { b.Append("CanPickUpLoot:1b,"); } if (PersistanceRequired) { b.Append("PersistanceRequired:1b,"); } if (NoAi) { b.Append("NoAI:1b,"); } var holding = Holding.GenerateJson(false); var boots = Boots.GenerateJson(false); var leggings = Leggings.GenerateJson(false); var chest = Chestplate.GenerateJson(false); var helm = Helmet.GenerateJson(false); if (holding != string.Empty) { holding = holding.Remove(holding.Length - 1, 1); } if (boots != string.Empty) { boots = boots.Remove(boots.Length - 1, 1); } if (leggings != string.Empty) { leggings = leggings.Remove(leggings.Length - 1, 1); } if (chest != string.Empty) { chest = chest.Remove(chest.Length - 1, 1); } if (helm != string.Empty) { helm = helm.Remove(helm.Length - 1, 1); } if (holding != string.Empty || boots != string.Empty || leggings != string.Empty || chest != string.Empty || helm != string.Empty) { b.AppendFormat("Equipment:[0:{{{0}}},1:{{{1}}},2:{{{2}}},3:{{{3}}},4:{{{4}}}],", holding, boots, leggings, chest, helm); } if (DefaultHealth.HasValue && Health != DefaultHealth) { b.AppendFormat("HealF:{0}f,", Health); } StringBuilder aBuilder; if (PotionEffects.Count > 0) { aBuilder = new StringBuilder(); for (var i = 0; i < PotionEffects.Count; i++) { var attribute = PotionEffects[i]; var generateJson = attribute.GenerateJson(false); if (!string.IsNullOrWhiteSpace(generateJson)) { aBuilder.AppendFormat("{0}:{{{1}}},", i, generateJson); } } aBuilder.Remove(aBuilder.Length - 1, 1); if (aBuilder.Length > 0) { b.AppendFormat("ActiveEffects:[{0}],", aBuilder); } } if (Attributes.Count > 0) { aBuilder = new StringBuilder(); for (var i = 0; i < Attributes.Count; i++) { var attribute = Attributes[i]; var generateJson = attribute.GenerateJson(false); if (!string.IsNullOrWhiteSpace(generateJson)) { aBuilder.AppendFormat("{0}:{{{1}}},", i, generateJson); } } aBuilder.Remove(aBuilder.Length - 1, 1); if (aBuilder.Length > 0) { b.AppendFormat("Attributes:[{0}],", aBuilder); } } if (Math.Abs(DropChanceFloats[0].Value) > 0.001 || Math.Abs(DropChanceFloats[1].Value) > 0.001 || Math.Abs(DropChanceFloats[2].Value) > 0.001 || Math.Abs(DropChanceFloats[3].Value) > 0.001 || Math.Abs(DropChanceFloats[4].Value) > 0.001) { b.AppendFormat("DropChances:[0:{0:0.##}f,1:{1:0.##}f,2:{2:0.##}f,3:{3:0.##}f,4:{4:0.##}f],", DropChanceFloats[0].Value, DropChanceFloats[1].Value, DropChanceFloats[2].Value, DropChanceFloats[3].Value, DropChanceFloats[4].Value); } return(b.ToString()); }
public Item GenerateItem(CraftableItem mould) { if (CanCraftItem(mould)) { if (mould.MyCraftedItemType == CraftedItemType.WEAPON) { Weapon ret = null; switch ((mould as CraftedWeapon).tarType) { case (WeaponType.RECURVEBOW): ret = new RecurveBow(ALib); break; case (WeaponType.SWORD): ret = new Sword(ALib); break; case (WeaponType.CENSER): ret = new Censer(ALib); break; case (WeaponType.STAFF): ret = new Staff(ALib); break; case (WeaponType.SACRIFICIALKNIFE): ret = new SacrificialKnife(ALib); break; case (WeaponType.VESSEL): ret = new Vessel(ALib); break; } ret.CopyStats(mould as CraftedWeapon); Player_Accessor_Script.SkillsScript.AddExperience(mould.RequiredProfession, mould.RewardedExp); return(ret); } else if (mould.MyCraftedItemType == CraftedItemType.ARMOR) { Armor ret = null; switch ((mould as CraftedArmor).tarType) { case (ArmorType.CHESTPLATE): ret = new Chestplate(); ret.MyItemType = ItemType.CHESTPLATE; break; case (ArmorType.PLATELEGS): ret = new Platelegs(); ret.MyItemType = ItemType.PLATELEGS; break; case (ArmorType.HELMET): ret = new Helmet(); ret.MyItemType = ItemType.HELMET; break; case (ArmorType.CHESTGUARD): ret = new Chestguard(); ret.MyItemType = ItemType.CHESTGUARD; break; case (ArmorType.CHAPS): ret = new Chaps(); ret.MyItemType = ItemType.CHAPS; break; case (ArmorType.COIF): ret = new Coif(); ret.MyItemType = ItemType.COIF; break; case (ArmorType.ROBE): ret = new Robe(); ret.MyItemType = ItemType.ROBE; break; case (ArmorType.TROUSERS): ret = new Trousers(); ret.MyItemType = ItemType.TROUSERS; break; case (ArmorType.HAT): ret = new Hat(); ret.MyItemType = ItemType.HAT; break; } ret.CopyStats(mould as CraftedArmor); Player_Accessor_Script.SkillsScript.AddExperience(mould.RequiredProfession, mould.RewardedExp); return(ret); } else if (mould.MyCraftedItemType == CraftedItemType.REAGENT) { print("Reagent Type: " + mould.ItemName); Reagent newReagent = new Reagent(); newReagent.ReagentName = mould.ItemName; newReagent.ReagentQuantity = 1; newReagent.ReagentSprite = mould.SpritePath; Player_Accessor_Script.InventoryScript.AddResourceType(newReagent, newReagent.ReagentQuantity); Player_Accessor_Script.SkillsScript.AddExperience(mould.RequiredProfession, mould.RewardedExp); } else { print("Unknown crafting type"); } } return(null); }