private string GetArmorInfo(IItem item) { IArmor armor = item as IArmor; if (armor != null) { StringBuilder strBldr = new StringBuilder(); IShield shield = item as IShield; if (shield != null) { strBldr.AppendLine("ShieldNegateDamagePercent: " + shield.NegateDamagePercent); } strBldr.AppendLine(DiceInfo(armor.Dice)); foreach (DamageType damageType in Enum.GetValues(typeof(DamageType))) { strBldr.AppendLine(damageType.ToString() + ": " + armor.GetTypeModifier(damageType)); } strBldr.Append(EquipmentInfo(armor)); return(strBldr.ToString()); } return(""); }
public static IArmor ReadItem(uint id) { using (connection = new SQLiteConnection(ConnectionString)) { connection.Open(); IArmor armor = null; var query = $@" SELECT * FROM Armors WHERE Id = '{id}'"; var myCommand = new SQLiteCommand(query, connection); var reader = myCommand.ExecuteReader(); while (reader.Read()) { armor = ArmorFactory.CreateArmor(); armor.Id = (uint)reader.GetInt32(0); armor.Name = reader.GetString(1); armor.Type = (ArmorType)reader.GetInt32(2); armor.Price = (ulong)reader.GetInt32(3); armor.BaseArmor = (byte)reader.GetInt32(4); armor.MaxAgility = (byte)reader.GetInt32(5); armor.StrengthCap = (byte)reader.GetInt32(6); armor.StealthDisadvantage = reader.GetBoolean(7); armor.Weight = (byte)reader.GetInt32(8); } connection.Close(); return(armor); } }
protected IEnchantment EnchantArmor(IItem item) { IEnchantment enchantment = null; IArmor armor = item as IArmor; if (armor != null) { switch (GlobalReference.GlobalValues.Random.Next(2)) { case 0: enchantment = new DamageReceivedBeforeDefenseEnchantment(); enchantment.Effect = GetRandomDefenseEffect(); enchantment.Parameter.Dice = GlobalReference.GlobalValues.DefaultValues.DiceForArmorLevel(item.Level); break; case 1: enchantment = new DamageReceivedAfterDefenseEnchantment(); enchantment.Effect = new Effect.Damage(); Damage.Damage damage = new Damage.Damage(); damage.Dice = GlobalReference.GlobalValues.DefaultValues.DiceForWeaponLevel(item.Level); damage.Type = GetRandomDamageType(); break; } } return(enchantment); }
void Show_UpgradePanel() { if (selected != null) { Upgrade_Set(); RecipePanel.CraftPanel.SetActive(true); SlotItem item = new SlotItem(selected, 1); CreateInfoWindow(item); switch (selected.Category) { case ItemCategory.Armor: IArmor armor = new IArmor((IArmor)selected); armor.UpgradeItem(armor.Stage + 1); item = new SlotItem(armor, 1); CreateInfoWindow(item); break; case ItemCategory.Weapon: IWeapon W_selected = (IWeapon)selected; IWeapon weapon = new IWeapon(W_selected); weapon.UpgradeItem(weapon.Stage + 1); item = new SlotItem(weapon, 1); CreateInfoWindow(item); break; } } StartCoroutine(CooldownSpawn()); }
void CalculateItem(SlotItem item) { if (item != null) { switch (item.item.Category) { case ItemCategory.Armor: IArmor aItem = (IArmor)item.item; CalculateBase(aItem.Stats.Base); CalculateAbility(aItem.Stats.Ability); CalculateResistance(aItem.Stats.Resistance); CalculateOther(aItem.Stats.Other); CalculateBattle(aItem.Stats.Battle); break; case ItemCategory.Weapon: IWeapon wItem = (IWeapon)item.item; CalculateBase(wItem.Stats.Base); CalculateAbility(wItem.Stats.Ability); CalculateResistance(wItem.Stats.Resistance); CalculateOther(wItem.Stats.Other); CalculateBattle(wItem.Stats.Battle); break; case ItemCategory.Accessories: IAccessories acItem = (IAccessories)item.item; CalculateBase(acItem.Stats.Base); CalculateAbility(acItem.Stats.Ability); CalculateResistance(acItem.Stats.Resistance); CalculateOther(acItem.Stats.Other); CalculateBattle(acItem.Stats.Battle); break; } } }
public IArmor UnequipArmor() { IArmor result = m_armor; m_armor = null; return(result); }
public void SetRuneByOffer(int index, IRune rune) { int id_rune = -1; for (int i = 0; i < StaticValues.Items.Runes.Count; i++) { if (StaticValues.Items.Runes[i] == rune) { id_rune = i; break; } } if (id_rune >= 0) { switch (offer_item.Category) { case ItemCategory.Armor: IArmor armor = ((IArmor)offer_item); armor.Runes[index] = id_rune; break; case ItemCategory.Weapon: IWeapon weapon = ((IWeapon)offer_item); weapon.Runes[index] = id_rune; break; } } }
public bool IsProficient(IArmor armor) { bool passes = false; foreach (var prof in ProficiencyList) { ArmorType armorType; if (System.Enum.TryParse <ArmorType>(prof, true, out armorType)) { passes = armor.ArmorType == armorType; } else { passes = armor.Name.EqualsIgnoreCase(prof); } //Exit out if any pass if (passes) { return(passes); } } //Nothing should pass, force to false return(false); }
public ArmorsViewerItem(IArmor armor) { Name = armor.Name; Type = armor.Type.ToString(); BaseArmor = armor.BaseArmor.ToString(); Price = armor.Price.ToString(); }
void Upgrade_Set() { for (int i = 0; i < RecipePanel.Components.Length; i++) { RecipePanel.Components[i].SetActive(false); RecipePanel.Components[i].GetComponent <Slot>().Clear(); } List <IComponent> ListComponents = null; SlotItem item = null; switch (selected.Category) { case ItemCategory.Armor: IArmor armor = (IArmor)selected; item = new SlotItem(armor, 1); RecipePanel.Reward.GetComponent <Slot>().SetSlot(item); ListComponents = StaticValues.UpgradesItems.Armors[(int)armor.ACategory].Weight_Type[(int)armor.Weight].Stage[armor.Stage].Components; break; case ItemCategory.Weapon: IWeapon weapon = (IWeapon)selected; item = new SlotItem(weapon, 1); RecipePanel.Reward.GetComponent <Slot>().SetSlot(item); ListComponents = StaticValues.UpgradesItems.Weapons[(int)weapon.WCategory].Stage[weapon.Stage].Components; break; } for (int i = 0; i < ListComponents.Count; i++) { item = new SlotItem(SetItem(ListComponents[i]), ListComponents[i].amount); RecipePanel.Components[i].GetComponent <Slot>().SetSlot(item); RecipePanel.Components[i].SetActive(true); } CanUpgrade(ListComponents); }
public Gear(IWeapon weapon, IArmor chest, IArmor head, IArmor legs) { this.Weapon = weapon; this.Chest = chest; this.Head = head; this.Legs = legs; }
public void Craftsman_Build_Armor() { DateTime start = DateTime.Now; IResult result = craftsman.Build(npc.Object, pc.Object, AvalableItemPosition.Feet, 1, "keyword", "sentenceDescription", "shortDescription", "lookDescription", "examineDescription"); Assert.IsFalse(result.AllowAnotherCommand); Assert.AreEqual("", result.ResultMessage); Assert.AreEqual(1, craftsmanObjects.Count); ICraftsmanObject craftsmanObject = craftsmanObjects[0]; IArmor item = craftsmanObject.Item as IArmor; Assert.IsNotNull(item); Assert.AreEqual(AvalableItemPosition.Feet, item.ItemPosition); Assert.AreEqual(1, item.Level); Assert.AreEqual(1, item.KeyWords.Count); Assert.AreEqual("keyword", item.KeyWords[0]); Assert.AreEqual("sentenceDescription", item.SentenceDescription); Assert.AreEqual("shortDescription", item.ShortDescription); Assert.AreEqual("lookDescription", item.LookDescription); Assert.AreEqual("examineDescription", item.ExamineDescription); Assert.AreEqual(1, craftsmanObject.CraftsmanId.Zone); Assert.AreEqual(2, craftsmanObject.CraftsmanId.Id); DateTime end = DateTime.Now; Assert.IsTrue(start.AddMinutes(1) <= craftsmanObject.Completion); Assert.IsTrue(end.AddMinutes(1) >= craftsmanObject.Completion); }
public InventoryItem(int newID, IWeapon weapon, IArmor armor, ISpellBook spellBook, int quantity) { ID = newID; Weapon = weapon; Armor = armor; SpellBook = spellBook; Quantity = quantity; }
public Inventory(IWEapon startWeapon, IArmor startArmor) { CurrentWeapon = startWeapon; CurrentArmor = startArmor; //optional: m_items.Add(startWeapon); m_items.Add(startArmor); }
private IArmor Arms(int level) { IArmor armor = CreateArmor(AvalableItemPosition.Arms, level); armor.ExamineDescription = "The bracer has a intricate design of intersecting lines running up and down the length of the item."; armor.SentenceDescription = "bracer"; armor.KeyWords.Add("bracer"); return(armor); }
private IArmor Helmet(int level) { IArmor armor = CreateArmor(AvalableItemPosition.Head, level); armor.ExamineDescription = "The helmet's insides are padded with soft animal fur."; armor.SentenceDescription = "helmet"; armor.KeyWords.Add("helmet"); return(armor); }
private IArmor Feet(int level) { IArmor armor = CreateArmor(AvalableItemPosition.Feet, level); armor.ExamineDescription = "The boots still have some cob webs on them but otherwise look to be in good shape."; armor.SentenceDescription = "boots"; armor.KeyWords.Add("boots"); return(armor); }
private static void TestArmorFactory(IArmorFactory factory) { IArmor heavyArmor = factory.Create(ArmorType.Heavy); IArmor lightArmor = factory.Create(ArmorType.Light); IArmor mediumArmor = factory.Create(ArmorType.Medium); Console.WriteLine($"Heavy weapon: {heavyArmor}"); Console.WriteLine($"Light weapon: {lightArmor}"); Console.WriteLine($"Medium weapon: {mediumArmor}"); }
private IArmor Hand(int level) { IArmor armor = CreateArmor(AvalableItemPosition.Hand, level); armor.ExamineDescription = "The leather gloves have an emblem of a burning phoenix stamped into the back of each glove."; armor.SentenceDescription = "leather"; armor.KeyWords.Add("leather"); armor.KeyWords.Add("glove"); return(armor); }
public Swordsman( string id, string name, int healthPoints, IDamage damage, IArmor armor) : base(id, name, healthPoints, damage) { AttackHandlers.Add(armor); ArmorPoints = armor.ArmorPoints; }
/// <summary> /// 防具判定 /// </summary> /// <param name="p"></param> /// <param name="target"></param> /// <returns></returns> public bool CheckArmor(AbstractPlayer p, AbstractPlayer target) { // 判定防具 IArmor am = (IArmor)target.GetState().GetEquipment().GetArmor(); if (am == null || !am.Check(this, target)) { return(false); } return(true); }
/// <summary> /// Equips target armor /// </summary> /// <devnote> /// Custom equipment setter. /// Created to have more control on what's going on. /// </devnote> public void EquipArmor(IArmor armor, bool unequip = false) { if (!unequip) { Armor = armor; } else if (Armor?.Name == armor.Name) { Armor = default; } }
private IArmor Helmet() { IArmor armor = Armor(AvalableItemPosition.Head); armor.KeyWords.Add("helmet"); armor.ShortDescription = "A helmet made of silver."; armor.LookDescription = "The helmet is made to make the wearer look like a lioness."; armor.ExamineDescription = "This piece of armor appears to be made better than normal."; return(armor); }
private IArmor BreastPlate() { IArmor armor = Armor(AvalableItemPosition.Body); armor.KeyWords.Add("breastplate"); armor.ShortDescription = "A breastplate made of silver."; armor.LookDescription = "A female lion head is embossed across the front of the breastplate."; armor.ExamineDescription = "This piece of armor appears to be made better than normal."; return(armor); }
private IArmor Leg(int level) { IArmor armor = CreateArmor(AvalableItemPosition.Legs, level); armor.ExamineDescription = "The leather the design of fire going up each leg."; armor.SentenceDescription = "pants"; armor.KeyWords.Add("leather"); armor.KeyWords.Add("pants"); armor.KeyWords.Add("pant"); return(armor); }
private IArmor Waist() { IArmor armor = CreateArmor(AvalableItemPosition.Waist, 17, new Cloth()); armor.ExamineDescription = "The piece of rope looks unremarkable in every way."; armor.LookDescription = "A simple piece of rope for holding your trousers."; armor.ShortDescription = "A short piece of rope."; armor.SentenceDescription = "rope"; armor.KeyWords.Add("rope"); return(armor); }
public void RandomDropGenerator_GenerateRandomArmor_Feet() { random.Setup(e => e.Next(11)).Returns(9); IArmor armor = randomDropGenerator.GenerateRandomArmor(1, 1); Assert.AreEqual("Three pouches hang off the outside of each boot allowing you to have quick access to small items.", armor.ExamineDescription); Assert.AreEqual("Made of supple leather the boots are soft and easy to wear at the expense of some protection.", armor.LookDescription); Assert.AreEqual("A pair of leather boots.", armor.ShortDescription); Assert.AreEqual("boot", armor.SentenceDescription); Assert.IsTrue(armor.KeyWords.Contains("boot")); Assert.AreEqual(AvalableItemPosition.Feet, armor.ItemPosition); }
private IEquipment Bracer() { IArmor armor = CreateArmor(AvalableItemPosition.Arms, 15, new Leather()); armor.KeyWords.Add("leather"); armor.KeyWords.Add("bracer"); armor.ShortDescription = "A poorly made pair leather bracers."; armor.LookDescription = "The bracers extend up the wearers arm a good ways giving the user extra protection."; armor.SentenceDescription = "a pair of leather bracers"; armor.ExamineDescription = "The bracers are fairly plain but are poorly made."; return(armor); }
private IArmor Legs() { IArmor armor = CreateArmor(AvalableItemPosition.Legs, 17, new Steel()); armor.ExamineDescription = "Delicately carved gold inlays decorate this piece of museum quality piece of armor."; armor.LookDescription = "The steel leggings look to be more decorative than protective but will do the job when needed."; armor.ShortDescription = "A decorative pair of leggings."; armor.SentenceDescription = "leggings"; armor.KeyWords.Add("leggings"); armor.KeyWords.Add("decorative"); return(armor); }
private IArmor Neck() { IArmor armor = CreateArmor(AvalableItemPosition.Neck, 17, new Bone()); armor.ExamineDescription = "The necklace bones appear to be of small animals, birds, squirrels and mice."; armor.LookDescription = "The necklace looks like it once belonged to a shaman and has several animal bones strung on it."; armor.ShortDescription = "A bone necklace."; armor.SentenceDescription = "necklace"; armor.KeyWords.Add("necklace"); armor.KeyWords.Add("bone"); return(armor); }
private static double GetArmorCostPenality(IArmor armor) { const double StandardWeightPenality = .2; const double HeavyWeightPenality = .4; switch(armor.Weight) { case ArmorWeight.Standard: return StandardWeightPenality; case ArmorWeight.Heavy: return HeavyWeightPenality; case ArmorWeight.Light: default: return 0; } }
internal virtual bool ProvidesEquipment(IArmor armor) { return false; }
public void EquipArmor(IArmor armor, int slotIndex) { if (armor == null) { armor = Armor.EMPTY_ARMOR; } ArmorSlot slot = m_ArmorConfiguration [slotIndex]; if (armor != Armor.EMPTY_ARMOR && slot.position != armor.ArmorPosition) { Debug.Log ("Invalid armor position for armor item: " + armor.DisplayName); } slot.armor = armor; }
public ArmorCombatNode(IArmor armor) : base(armor) { }
public IList<EquipArmorReasons> CanNotEquipArmorReasons(IArmor armor) { List<EquipArmorReasons> reasonsList = new List<EquipArmorReasons>(); if (armor.Type == "Boots" && ChestArmor != null) { // If I'm equiping boots and have chest armor, check to that the armor doesn't prevent that type if (((Item)ChestArmor).ContainsAttribute("RobesPreventBoots")) reasonsList.Add(EquipArmorReasons.RobesPreventBoots); } if (armor.Type == "ChestArmor" && Boots != null) { // If I"m equipping chest armor that prevents wearing boots, make sure that I'm not already wearing some. if (((Item)armor).ContainsAttribute("RobesPreventBoots")) reasonsList.Add(EquipArmorReasons.BootsPreventRobes); } switch (armor.Weight) { case ArmorWeight.Light: break; case ArmorWeight.Standard: if (!HasAttribute("StandardArmorProficiency")) reasonsList.Add(EquipArmorReasons.Weight); break; case ArmorWeight.Heavy: if (!HasAttribute("HeavyArmorProficiency")) reasonsList.Add(EquipArmorReasons.Weight); break; default: throw new System.InvalidOperationException("CouldEquip doesn't know how to handle type - " + armor.Weight.ToString()); } return reasonsList; }
public bool CanEquipArmor(IArmor armor) { return CanNotEquipArmorReasons(armor).Count == 0; }
public bool ProvidesEquipment(IArmor armor) { return m_effectResult.ProvidesEquipment(armor); }
public void EquipArmor(IArmor armor) { if (armor == null) { return; } if (armor is Helmet) { this.Helmet = (Helmet)armor; } else if (armor is BodyArmor) { this.BodyArmor = (BodyArmor)armor; } else if (armor is Boots) { this.Boots = (Boots)armor; } else if (armor is Gloves) { this.Gloves = (Gloves)armor; } }