Inheritance: Health
Example #1
0
 //need to check if the armoury is full for both armour info and swordinfo method
 void DisplayArmourInfo()
 {
     string name = ItemName("Armour of");
     int str = Random.Range(5, 15) * level;
     Armour armour = new Armour(str, name, null);
     stat.text = "Strength: " + str;
     GameManager.getInstance().armoury.Add(armour);
 }
Example #2
0
 public void PrintArmour(Armour armour)
 {
     print (armour.name
         + " - "
         + armour.defenceBoost
         + " Defence boost, Buy price: "
         + armour.price
         + ", Sell price: "
         + armour.sellPrice ());
 }
Example #3
0
    public void AddArmour(Armour armour)
    {
        armour.ramp = ramp;
        armour.CalculateDefenceBoost ();
        armour.sellFraction = sellFraction;
        CalculatePrice (armour);

        itemManager.allItems.Add (armour);
        allArmour.Add (armour);
    }
Example #4
0
    public void RemoveItem(Item item)
    {
        if (item is Armour) {

            Armour armour = item as Armour;

            if (armour.type == ArmourType.Helmet) helmet = null;
            else if (armour.type == ArmourType.Chest) chest = null;
            else if (armour.type == ArmourType.Legs) legs = null;
            else if (armour.type == ArmourType.Boots) boots = null;
        }
    }
Example #5
0
    protected void CreateArmourSet(string name, int level)
    {
        Armour armour;

        armour = new Armour (name + " Boots", ArmourType.Boots, level);
        AddArmour (armour);
        armour = new Armour (name + " Chestplate", ArmourType.Chest, level);
        AddArmour (armour);
        armour = new Armour (name + " Helmet", ArmourType.Helmet, level);
        AddArmour (armour);
        armour = new Armour (name + " Legs", ArmourType.Legs, level);
        AddArmour (armour);
    }
Example #6
0
        public Character(string Name, int Experience, Weapon Weapon, Armour Armour)
        {
            this.Name = Name;
            this.DisplayName = Name;
            CharInfo = Globals.Instance.Content.Load<CharacterData>("Character\\" + Name);
            Direction = Direction.South;
            AnimationState = 0;
            AddStandardCharacterIdleAnimations();
            AddStandardCharacterWalkingAnimations();
            ResetAnimation(false);

            Level = 1;
            this.Experience = Experience;
            this.Weapon = Weapon;
            this.Armour = Armour;
            this.ATB = 0;
            HP = MaxHP;
            MP = MaxMP;
            Skills = new List<Skill>();
        }
Example #7
0
    public Description GetDescription()
    {
        Description res = new Description();

        if (!Empty)
        {
            string          desc;
            DescriptionItem d;

            List <DescriptionItem> constraints = new List <DescriptionItem>();

            if (!canReformToFhalanx)
            {
                d = new DescriptionItem()
                {
                    Name           = LocalizedStrings.attention,
                    Description    = LocalizedStrings.weaponConstraint_cantReformPhalanx,
                    ItPositiveDesc = canReformToFhalanx
                };
                constraints.Add(d);
            }
            else
            {
                if (!canReformToPhalanxInFight)
                {
                    d = new DescriptionItem()
                    {
                        Name           = LocalizedStrings.attention,
                        Description    = LocalizedStrings.weaponConstraint_cantReformPhalanxInFight,
                        ItPositiveDesc = canReformToPhalanxInFight
                    };
                    constraints.Add(d);
                }
            }

            if (!canUseWithShield)
            {
                d = new DescriptionItem()
                {
                    Name           = LocalizedStrings.attention,
                    Description    = LocalizedStrings.weaponConstraint_cantUseShield,
                    ItPositiveDesc = canUseWithShield
                };
                constraints.Add(d);
            }



            List <DescriptionItem> stats = new List <DescriptionItem>();

            d = new DescriptionItem()
            {
                Name           = LocalizedStrings.mass,
                Description    = Mass.ToString(StringFormats.floatNumber),
                ItPositiveDesc = true
            };
            stats.Add(d);

            if (AttackDistance > 0)
            {
                d = new DescriptionItem()
                {
                    Name           = LocalizedStrings.attackDistance,
                    Description    = AttackDistance.ToString(StringFormats.floatNumber),
                    ItPositiveDesc = true
                };
                stats.Add(d);
            }

            if (AddAttack != 0)
            {
                d = new DescriptionItem()
                {
                    Name           = LocalizedStrings.attack,
                    Description    = AddAttack.ToString(StringFormats.floatSignNumberPercent) + LocalizedStrings.baseValue,
                    ItPositiveDesc = AddAttack > 0
                };
                stats.Add(d);
            }

            if (AddDefence != 0)
            {
                d = new DescriptionItem()
                {
                    Name           = LocalizedStrings.defence,
                    Description    = AddDefence.ToString(StringFormats.floatSignNumberPercent) + LocalizedStrings.baseValue,
                    ItPositiveDesc = AddDefence > 0
                };
                stats.Add(d);
            }

            if (AddDefenceHalfSector != 0)
            {
                d = new DescriptionItem()
                {
                    Name           = LocalizedStrings.defenceHalfSector,
                    Description    = AddDefenceHalfSector.ToString(StringFormats.floatSignNumberPercent) + LocalizedStrings.baseValue,
                    ItPositiveDesc = AddDefenceHalfSector > 0
                };
                stats.Add(d);
            }

            if (AddSpeed != 0)
            {
                d = new DescriptionItem()
                {
                    Name           = LocalizedStrings.speed,
                    Description    = AddSpeed.ToString(StringFormats.floatSignNumberPercent) + LocalizedStrings.baseValue,
                    ItPositiveDesc = AddSpeed > 0
                };
                stats.Add(d);
            }

            if (AddAcceleretion != 0)
            {
                d = new DescriptionItem()
                {
                    Name           = LocalizedStrings.acceleration,
                    Description    = AddAcceleretion.ToString(StringFormats.floatSignNumberPercent) + LocalizedStrings.baseValue,
                    ItPositiveDesc = AddAcceleretion > 0
                };
                stats.Add(d);
            }

            if (AddRotationSpeed != 0)
            {
                d = new DescriptionItem()
                {
                    Name           = LocalizedStrings.rotationSpeed,
                    Description    = AddRotationSpeed.ToString(StringFormats.floatSignNumberPercent) + LocalizedStrings.baseValue,
                    ItPositiveDesc = AddRotationSpeed > 0
                };
                stats.Add(d);
            }

            if (ChargeImpact != 0)
            {
                d = new DescriptionItem()
                {
                    Name           = LocalizedStrings.chargeImpact,
                    Description    = ChargeImpact.ToString(StringFormats.floatSignNumberPercent) + LocalizedStrings.baseValue,
                    ItPositiveDesc = ChargeImpact > 0
                };
                stats.Add(d);
            }

            if (ChargeDeflect != 0)
            {
                d = new DescriptionItem()
                {
                    Name           = LocalizedStrings.chargeDeflect,
                    Description    = ChargeDeflect.ToString(StringFormats.floatSignNumberPercent) + LocalizedStrings.baseValue,
                    ItPositiveDesc = ChargeDeflect > 0
                };
                stats.Add(d);
            }

            if (Armour > 0)
            {
                d = new DescriptionItem()
                {
                    Name           = LocalizedStrings.armour,
                    Description    = Armour.ToString(StringFormats.floatNumber),
                    ItPositiveDesc = true
                };
                stats.Add(d);
            }

            if (Damag.BaseDamage > 0)
            {
                d = new DescriptionItem()
                {
                    Name           = LocalizedStrings.baseDamage,
                    Description    = Damag.BaseDamage.ToString(StringFormats.floatNumber),
                    ItPositiveDesc = true
                };
                stats.Add(d);
            }

            if (Damag.ArmourDamage > 0)
            {
                d = new DescriptionItem()
                {
                    Name           = LocalizedStrings.armourDamage,
                    Description    = Damag.ArmourDamage.ToString(StringFormats.floatNumber),
                    ItPositiveDesc = true
                };
                stats.Add(d);
            }

            if (MissileBlock != 0)
            {
                d = new DescriptionItem()
                {
                    Name           = LocalizedStrings.missileBlock,
                    Description    = MissileBlock.ToString(StringFormats.floatNumberPercent),
                    ItPositiveDesc = MissileBlock > 0
                };
                stats.Add(d);
            }

            if (AddChargeDamage != 0)
            {
                d = new DescriptionItem()
                {
                    Name           = LocalizedStrings.chargeDamage,
                    Description    = AddChargeDamage.ToString(StringFormats.floatSignNumberPercent) + LocalizedStrings.baseValue,
                    ItPositiveDesc = AddChargeDamage > 0
                };
                stats.Add(d);
            }

            EquipmentStats st = this;
            res.Condition = new Description.ConditionsInfo()
            {
                Name  = Tools.Extensions.GetNameLocalise(ItemDurability),
                Value = (Description.ConditionsInfo.Conditions)Enum.GetNames(typeof(Durability)).ToList().FindIndex((s) => { return(Enum.GetName(typeof(Durability), st.ItemDurability) == s); })
            };
            res.Cost = new Description.CostInfo()
            {
                CostPerOne = Cost
            };
            res.Constraints = constraints.ToArray();
            res.Stats       = stats.ToArray();
        }

        return(res);
    }
Example #8
0
        //type is here so that I might need to change the html removal for each page and to tell which class to build as (some urls will use the same class)
        public void ProcessData(string url, int type)
        {
            string data = GetHtml(url);

            //maybe 404 or just nothing there or whatever
            if (data.Trim() == "")
            {
                return;
            }

            //I didn't think this trough well and I hate this idea but for each td assign a count and based on that set the properties
            //next plan might be to replace the newlines in between <td> and then can do a for loop on them for each line
            int ArmCount  = 0;
            int CurrCount = 0;
            int JewCount  = 0;
            int PSCount   = 0;
            int SkiCount  = 0;
            int WeaCount  = 0;

            string FilteredData = RemoveHTML(data).Replace("\n", "~1~").Replace("\t", "");            //use my own place holders instead of \n or \t

            foreach (string s in FilteredData.Split(new string[] { "~1~" }, StringSplitOptions.None)) //I would have thought \r\n but apparently not
            {
                if (s.Trim() == "")
                {
                    continue;
                }
                else if (s.Trim().Contains("<tr>") == true) //yeah i know... i just like to be explicit and clear
                {
                    //start next object, complete last object
                    switch (type)
                    {
                    case 1:       //Prefix
                        SaveClass(type);
                        CurrPS = new PSMods();
                        break;

                    case 2:       //Suffix
                        SaveClass(type);
                        CurrPS = new PSMods();
                        break;

                    case 3:     //Weapon
                        break;

                    case 4:     //Armour
                        CurrArm = new Armour();
                        break;

                    case 5:     //Jewelry
                        CurrJew = new Jewelry();
                        break;

                    case 6:     //Currency
                        SaveClass(type);
                        CurrCurr = new Currency();
                        break;

                    case 7:     //Skills
                        CurrSkills = new Skills();
                        break;

                    default:
                        break;
                    }
                }
                else if (s.Trim().Contains("<td>") == true)
                {
                    //fill current object
                    switch (type)
                    {
                    case 1:     //Prefix
                        PSCount++;
                        switch (PSCount)
                        {
                        case 1:
                            CurrPS.Name = s.Replace("<td>", "").Replace("</td>", "");
                            break;

                        case 2:
                            CurrPS.Level = s.Replace("<td>", "").Replace("</td>", "");
                            break;

                        case 3:
                            CurrPS.Stat = s.Replace("<td>", "").Replace("</td>", "");
                            break;

                        case 4:
                            CurrPS.Value = s.Replace("<td>", "").Replace("</td>", "");
                            break;

                        default:
                            CurrPS.Type = "prefix";
                            PSCount     = 0;
                            break;
                        }
                        break;

                    case 2:     //Suffix
                        PSCount++;
                        switch (PSCount)
                        {
                        case 1:
                            CurrPS.Name = s.Replace("<td>", "").Replace("</td>", "");
                            break;

                        case 2:
                            CurrPS.Level = s.Replace("<td>", "").Replace("</td>", "");
                            break;

                        case 3:
                            CurrPS.Stat = s.Replace("<td>", "").Replace("</td>", "");
                            break;

                        case 4:
                            CurrPS.Value = s.Replace("<td>", "").Replace("</td>", "");
                            break;

                        default:
                            CurrPS.Type = "suffix";
                            PSCount     = 0;
                            break;
                        }
                        break;

                    case 3:     //Weapon
                        WeaCount++;
                        switch (WeaCount)
                        {
                        case 1:
                            //image
                            break;

                        case 2:
                            CurrWeap.Name = s.Replace("<td>", "").Replace("</td>", "");
                            break;

                        case 3:
                            CurrWeap.Level = s.Replace("<td>", "").Replace("</td>", "");
                            break;

                        case 4:
                            CurrWeap.Damage = s.Replace("<td>", "").Replace("</td>", "");
                            break;

                        case 5:
                            CurrWeap.APS = s.Replace("<td>", "").Replace("</td>", "");
                            break;

                        case 6:
                            CurrWeap.DPS = s.Replace("<td>", "").Replace("</td>", "");
                            break;

                        case 7:
                            CurrWeap.ReqStr = s.Replace("<td>", "").Replace("</td>", "");
                            break;

                        case 8:
                            CurrWeap.ReqDex = s.Replace("<td>", "").Replace("</td>", "");
                            break;

                        case 9:
                            CurrWeap.ReqInt = s.Replace("<td>", "").Replace("</td>", "");
                            break;

                        case 10:
                            CurrWeap.Implicit = s.Replace("<td>", "").Replace("</td>", "");
                            break;

                        case 11:
                            CurrWeap.ImplicitValue = s.Replace("<td>", "").Replace("</td>", "");
                            break;

                        default:
                            WeaCount = 0;

                            SaveClass(type);
                            CurrWeap = new Weapon();

                            break;
                        }
                        break;

                    case 4:     //Armour
                        ArmCount++;
                        switch (ArmCount)
                        {
                        case 1:         //image
                            break;

                        case 2:
                            CurrArm.Name = s.Replace("<td>", "").Replace("</td>", "");
                            break;

                        case 3:
                            CurrArm.Level = s.Replace("<td>", "").Replace("</td>", "");
                            break;

                        case 4:
                            CurrArm.AR = s.Replace("<td>", "").Replace("</td>", "");
                            break;

                        case 5:
                            CurrArm.EV = s.Replace("<td>", "").Replace("</td>", "");
                            break;

                        case 6:
                            CurrArm.ES = s.Replace("<td>", "").Replace("</td>", "");
                            break;

                        case 7:
                            CurrArm.ReqStr = s.Replace("<td>", "").Replace("</td>", "");
                            break;

                        case 8:
                            CurrArm.ReqDex = s.Replace("<td>", "").Replace("</td>", "");
                            break;

                        case 9:
                            CurrArm.ReqInt = s.Replace("<td>", "").Replace("</td>", "");
                            break;

                        case 10:
                            CurrArm.Implicit = s.Replace("<td>", "").Replace("</td>", "");
                            break;

                        case 11:
                            CurrArm.ImplicitValue = s.Replace("<td>", "").Replace("</td>", "");
                            break;

                        default:
                            ArmCount = 0;

                            SaveClass(type);
                            CurrArm = new Armour();
                            break;
                        }
                        break;

                    case 5:     //Jewelry
                        JewCount++;
                        switch (JewCount)
                        {
                        case 1:         //image
                            break;

                        case 2:
                            CurrJew.Name = s.Replace("<td>", "").Replace("</td>", "");
                            break;

                        case 3:
                            CurrJew.Level = s.Replace("<td>", "").Replace("</td>", "");
                            break;

                        case 4:
                            CurrJew.Implicit = s.Replace("<td>", "").Replace("</td>", "");
                            break;

                        case 5:
                            CurrJew.ImplicitValue = s.Replace("<td>", "").Replace("</td>", "");
                            break;

                        default:
                            JewCount = 0;
                            SaveClass(type);
                            CurrJew = new Jewelry();
                            break;
                        }
                        break;

                    case 6:     //Currency
                        CurrCount++;
                        switch (CurrCount)
                        {
                        case 1:         //image
                            break;

                        case 2:
                            CurrCurr.Name = s.Replace("<td>", "").Replace("</td>", "");
                            break;

                        case 3:
                            CurrCurr.StackSize = s.Replace("<td>", "").Replace("</td>", "");
                            break;

                        case 4:
                            CurrCurr.Description = s.Replace("<td>", "").Replace("</td>", "");
                            break;

                        default:
                            CurrCount = 0;
                            break;
                        }
                        break;

                    case 7:     //Skills
                        SkiCount++;
                        switch (SkiCount)
                        {
                        case 1:
                            break;

                        case 2:
                            break;

                        case 3:
                            break;

                        case 4:
                            break;

                        default:
                            break;
                        }
                        break;

                    default:
                        break;
                    }
                }
                else
                {
                    //omg what is this!?
                    continue;
                }
            }
        }
Example #9
0
    public void Init(int value, Armour.PossibleArmourSlots slotName)
    {
        this.ArmourValue = value;
        this.ArmourSlot  = slotName;

        if (value == 0)
        {
            armourType = Armour.ArmourType.Cloth;
        }
        else
        {
            var slotArmourValue = Armour.GetArmourValue(slotName);

            if ((float)value / slotArmourValue < 0.25)
            {
                armourType = Armour.ArmourType.Light;
            }
            else if ((float)value / slotArmourValue < 0.75)
            {
                armourType = Armour.ArmourType.Medium;
            }
            else if ((float)value / slotArmourValue < 1)
            {
                armourType = Armour.ArmourType.Heavy;
            }
        }

        Strength  = RandomNumberGenerator.GetRandom(6);
        Intellect = RandomNumberGenerator.GetRandom(6);
        Stamina   = RandomNumberGenerator.GetRandom(6);

        var attributesSum = Strength + Intellect + Stamina;

        if (attributesSum <= 5)
        {
            rarity = Armour.Rarity.Common;
        }
        else if (attributesSum <= 10)
        {
            rarity = Armour.Rarity.Rare;
        }
        else if (attributesSum <= 14)
        {
            rarity = Armour.Rarity.Epic;
        }
        else
        {
            rarity = Armour.Rarity.Legendary;
        }

        name = string.Format("{0:9} {1:8} {2:10}", rarity.ToString(), armourType.ToString(), ArmourSlot.ToString());

        var path = "images/" + ArmourSlot.ToString().ToLower();

        icon = Resources.Load <Sprite>(path);

        if (icon == null)
        {
            Debug.Log(path);
        }
    }
Example #10
0
 public Character(string Name, Weapon Weapon, Armour Armour)
     : this(Name, 0, Weapon, Armour)
 {
 }
Example #11
0
    public void Equip(Armour armour)
    {
        switch (armour.Type)
        {
            case ArmourType.Hat:
            case ArmourType.Helmet:
                if (Gear.Head != null)
                    base.Stats -= Gear.Head.Stats;

                Gear.Head = armour;
                base.Stats += Gear.Head.Stats;
                break;
            case ArmourType.Armlet:
            case ArmourType.Gauntlet:
                if (Gear.Arm != null)
                    base.Stats -= Gear.Arm.Stats;

                Gear.Arm = armour;
                base.Stats += Gear.Arm.Stats;
                break;
            case ArmourType.LightArmour:
            case ArmourType.HeavyArmour:
            case ArmourType.Robe:
                if (Gear.Body != null)
                    base.Stats -= Gear.Body.Stats;

                Gear.Body = armour;
                base.Stats += Gear.Body.Stats;
                break;
            case ArmourType.AddOn:
                if (Gear.AddOn != null)
                    base.Stats -= Gear.AddOn.Stats;

                Gear.AddOn = armour;
                base.Stats += Gear.AddOn.Stats;
                break;
        }
    }
Example #12
0
        // Add the item to the drop list
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            int dropChance;

            int.TryParse(textBoxItemOdds.Text, out dropChance);

            if (dropChance < 1)
            {
                dropChance = 1;
            }

            string quest = QuestOnlyCheckBox.Checked ? "Q" : "";

            try
            {
                switch (tabControlSeperateItems.SelectedTab.Tag.ToString())
                {
                case "Weapon":
                    Weapon.Add(new DropItem {
                        Name = listBoxWeapon.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Armour":
                    Armour.Add(new DropItem {
                        Name = listBoxArmour.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Helmet":
                    Helmet.Add(new DropItem {
                        Name = listBoxHelmet.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Necklace":
                    Necklace.Add(new DropItem {
                        Name = listBoxNecklace.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Bracelet":
                    Bracelet.Add(new DropItem {
                        Name = listBoxBracelet.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Ring":
                    Ring.Add(new DropItem {
                        Name = listBoxRing.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Amulet":
                    Amulet.Add(new DropItem {
                        Name = listBoxAmulet.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Belt":
                    Belt.Add(new DropItem {
                        Name = listBoxBelt.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Boots":
                    Boot.Add(new DropItem {
                        Name = listBoxBoot.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Stone":
                    Stone.Add(new DropItem {
                        Name = listBoxStone.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Torch":
                    Torch.Add(new DropItem {
                        Name = listBoxTorch.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Potion":
                    Potion.Add(new DropItem {
                        Name = listBoxPotion.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Ore":
                    Ore.Add(new DropItem {
                        Name = listBoxOre.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Meat":
                    Meat.Add(new DropItem {
                        Name = listBoxMeat.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "CraftingMaterial":
                    CraftingMaterial.Add(new DropItem {
                        Name = listBoxCraftingMaterial.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance)
                    });
                    break;

                case "Scroll":
                    Scrolls.Add(new DropItem {
                        Name = listBoxScroll.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Gem":
                    Gem.Add(new DropItem {
                        Name = listBoxGem.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Mount":
                    Mount.Add(new DropItem {
                        Name = listBoxMount.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Book":
                    Book.Add(new DropItem {
                        Name = listBoxBook.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Nothing":
                    Nothing.Add(new DropItem {
                        Name = listBoxNothing.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Script":
                    Script.Add(new DropItem {
                        Name = listBoxScript.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Reins":
                    Reins.Add(new DropItem {
                        Name = listBoxReins.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Bells":
                    Bells.Add(new DropItem {
                        Name = listBoxBells.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Saddle":
                    Saddle.Add(new DropItem {
                        Name = listBoxSaddle.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Ribbon":
                    Ribbon.Add(new DropItem {
                        Name = listBoxRibbon.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Mask":
                    Mask.Add(new DropItem {
                        Name = listBoxMask.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Food":
                    Food.Add(new DropItem {
                        Name = listBoxFood.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Hook":
                    Hook.Add(new DropItem {
                        Name = listBoxHook.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", textBoxItemOdds.Text), Quest = quest
                    });
                    break;

                case "Float":
                    Float.Add(new DropItem {
                        Name = listBoxFloat.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", textBoxItemOdds.Text), Quest = quest
                    });
                    break;

                case "Bait":
                    Bait.Add(new DropItem {
                        Name = listBoxBait.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", textBoxItemOdds.Text), Quest = quest
                    });
                    break;

                case "Finder":
                    Finder.Add(new DropItem {
                        Name = listBoxFinder.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", textBoxItemOdds.Text), Quest = quest
                    });
                    break;

                case "Reel":
                    Reel.Add(new DropItem {
                        Name = listBoxReel.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", textBoxItemOdds.Text), Quest = quest
                    });
                    break;

                case "Fish":
                    Fish.Add(new DropItem {
                        Name = listBoxFish.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", textBoxItemOdds.Text), Quest = quest
                    });
                    break;

                case "Quest":
                    Quest.Add(new DropItem {
                        Name = listBoxQuest.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", textBoxItemOdds.Text), Quest = quest
                    });
                    break;

                case "Awakening":
                    Awakening.Add(new DropItem {
                        Name = listBoxAwakening.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", textBoxItemOdds.Text), Quest = quest
                    });
                    break;

                case "Pets":
                    Pets.Add(new DropItem {
                        Name = listBoxPets.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", textBoxItemOdds.Text), Quest = quest
                    });
                    break;

                case "Transform":
                    Transform.Add(new DropItem {
                        Name = listBoxTransform.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", textBoxItemOdds.Text), Quest = quest
                    });
                    break;
                }

                UpdateDropFile();
            }
            catch
            {
                //No item selected when trying to add an item to the drop
            }
        }
Example #13
0
        /// <summary>
        /// Perform a melee attack
        /// </summary>
        /// <param name="EntityAttacking"></param>
        /// <param name="EntityDefending"></param>
        /// <param name="EntityManager"></param>
        public static void MeleeAttack(int EntityAttacking, int EntityDefending, EntityManager EntityManager) {
            // Get the weapon of the attacker
            if(EntityManager.GetComponent(EntityAttacking, EntityManager.ComponentIndex.Weapon, out Component component)) {
                // The message to display at the end
                string message = "";

                Weapon weapon = (Weapon)component;
                // Get the armour of the defender. The rating will be the default if there's no armour
                int ArmourRating = 1;
                int EvasionRating = 1;
                if(EntityManager.GetComponent(EntityDefending, EntityManager.ComponentIndex.Armour, out component)) {
                    Armour armour = (Armour)component;
                    ArmourRating = ArmourRating + armour.ArmourRating;
                    EvasionRating = EvasionRating + armour.EvasionRating;
                }

                // Create a random object to help determine damage done
                Random random = new Random();

                // Determine if the attack will hit
                int chanceToEvade = EvasionRating * 5;
                if(random.Next(0, 100) > chanceToEvade) {
                    // Determine damage done
                    int damage = random.Next(weapon.MinAttack, weapon.MaxAttack);

                    // Deal damage if the entity has a HP component
                    if(EntityManager.GetComponent(EntityDefending, EntityManager.ComponentIndex.Health, out component)) {
                        Health health = (Health)component;
                        health.CurrentHP -= damage;

                        // Determine if it's the player attacking in order to pass appropriate message
                        if(EntityAttacking == AscensionGame.Player) {
                            // Details about an entity's name
                            EntityManager.GetComponent(EntityDefending, EntityManager.ComponentIndex.Biography, out component);
                            Biography bio = (Biography)component;
                            message += "You deal " + damage + " damage to the " + bio.Name;
                        } else {
                            // Details about an entity's name
                            EntityManager.GetComponent(EntityAttacking, EntityManager.ComponentIndex.Biography, out component);
                            Biography bio = (Biography)component;
                            message += "The " + bio.Name + " deals " + damage + " damage";
                        }

                        // Kill the entity if hp reaches 0
                        if(health.CurrentHP <= 0) {
                            // Details about an entity's name
                            EntityManager.GetComponent(EntityDefending, EntityManager.ComponentIndex.Biography, out component);
                            Biography bio = (Biography)component;
                            message += ". The " + bio.Name + " Dies";

                            EntityManager.DeleteEntity(EntityDefending);
                        }
                    }
                } else {
                    // Determine if it's the player attacking in order to pass appropriate message
                    if(EntityAttacking == AscensionGame.Player) {
                        // Details about an entity's name
                        EntityManager.GetComponent(EntityDefending, EntityManager.ComponentIndex.Biography, out component);
                        Biography bio = (Biography)component;
                        message += "The " + bio.Name + " evades";
                    } else {
                        // Details about an entity's name
                        EntityManager.GetComponent(EntityAttacking, EntityManager.ComponentIndex.Biography, out component);
                        Biography bio = (Biography)component;
                        message += "You evade the " + bio.Name + "'s attack";
                    }
                }
                AscensionGame.Messages.Enqueue(message);
            }
        }
Example #14
0
        //public static Dictionary<string, Action> commandList { get; set; }
        public static Dictionary <string, Action> Commands(string commandOptions, string commandKey, PlayerSetup.Player playerData, Room.Room room)
        {
            var commandList = new Dictionary <String, Action>
            {
                { "north", () => Movement.Move(playerData, room, "North") },
                { "south", () => Movement.Move(playerData, room, "South") },
                { "east", () => Movement.Move(playerData, room, "East") },
                { "west", () => Movement.Move(playerData, room, "West") },
                { "down", () => Movement.Move(playerData, room, "Down") },
                { "up", () => Movement.Move(playerData, room, "Up") },
                { "look", () => LoadRoom.ReturnRoom(playerData, room, commandOptions, "look") },
                { "l in", () => LoadRoom.ReturnRoom(playerData, room, commandOptions, "look in") },
                { "look in", () => LoadRoom.ReturnRoom(playerData, room, commandOptions, "look in") },
                { "examine", () => LoadRoom.ReturnRoom(playerData, room, commandOptions, "examine") },
                { "touch", () => LoadRoom.ReturnRoom(playerData, room, commandOptions, "touch") },
                { "smell", () => LoadRoom.ReturnRoom(playerData, room, commandOptions, "smell") },
                { "taste", () => LoadRoom.ReturnRoom(playerData, room, commandOptions, "taste") },
                { "score", () => Score.ReturnScore(playerData) },
                { "inventory", () => Inventory.ReturnInventory(playerData.Inventory, playerData) },
                { "equipment", () => Equipment.ShowEquipment(playerData) },
                { "garb", () => Equipment.ShowEquipment(playerData) },
                { "get", () => ManipulateObject.GetItem(room, playerData, commandOptions, commandKey, "item") },
                { "take", () => ManipulateObject.GetItem(room, playerData, commandOptions, commandKey, "item") },
                { "drop", () => ManipulateObject.DropItem(room, playerData, commandOptions, commandKey) },
                { "give", () => ManipulateObject.GiveItem(room, playerData, commandOptions, commandKey, "killable") },
                { "put", () => ManipulateObject.DropItem(room, playerData, commandOptions, commandKey) },
                { "save", () => Save.UpdatePlayer(playerData) },
                { "'", () => Communicate.Say(commandOptions, playerData, room) },
                { "newbie", () => Communicate.NewbieChannel(commandOptions, playerData) },
                { "gossip", () => Communicate.GossipChannel(commandOptions, playerData) },
                { "ooc", () => Communicate.OocChannel(commandOptions, playerData) },
                { "say", () => Communicate.Say(commandOptions, playerData, room) },
                { "sayto", () => Communicate.SayTo(commandOptions, room, playerData) },
                { ">", () => Communicate.SayTo(commandOptions, room, playerData) },
                { "talkto", () => Talk.TalkTo(commandOptions, room, playerData) },
                { "emote", () => Emote.EmoteActionToRoom(commandOptions, playerData) },
                { "quit", () => HubContext.Quit(playerData.HubGuid, room) },
                { "wear", () => Equipment.WearItem(playerData, commandOptions) },
                { "remove", () => Equipment.RemoveItem(playerData, commandOptions) },
                { "doff", () => Equipment.RemoveItem(playerData, commandOptions) },
                { "wield", () => Equipment.WearItem(playerData, commandOptions, true) },
                { "unwield", () => Equipment.RemoveItem(playerData, commandOptions, false, true) },
                { "kill", () => Fight2.PerpareToFight(playerData, room, commandOptions) },
                { "flee", () => Flee.fleeCombat(playerData, room) },

                //spells
                { "c magic missile", () => MagicMissile.StartMagicMissile(playerData, room, commandOptions) },
                { "cast magic missile", () => MagicMissile.StartMagicMissile(playerData, room, commandOptions) },
                { "c armour", () => Armour.StartArmour(playerData, room, commandOptions) },
                { "cast armour", () => Armour.StartArmour(playerData, room, commandOptions) },
                { "c armor", () => Armour.StartArmour(playerData, room, commandOptions) },
                { "cast armor", () => Armour.StartArmour(playerData, room, commandOptions) },

                //skills
                { "punch", () => Punch.StartPunch(playerData, room) },
                { "kick", () => Kick.StartKick(playerData, room) },

                //
                { "unlock", () => ManipulateObject.UnlockItem(room, playerData, commandOptions, commandKey) },
                { "lock", () => ManipulateObject.LockItem(room, playerData, commandOptions, commandKey) },
                { "open", () => ManipulateObject.Open(room, playerData, commandOptions, commandKey) },
                { "close", () => ManipulateObject.Close(room, playerData, commandOptions, commandKey) },
                { "help", () => Help.ShowHelp(commandOptions, playerData) },
                { "time", Update.Time.ShowTime },
                { "clock", Update.Time.ShowTime },
                { "skills", () => ShowSkills.ShowPlayerSkills(playerData, commandOptions) },
                { "skills all", () => ShowSkills.ShowPlayerSkills(playerData, commandOptions) },
                { "practice", () => Trainer.Practice(playerData, room, commandOptions) },
                { "list", () => Shop.listItems(playerData, room) },
                { "buy", () => Shop.buyItems(playerData, room, commandOptions) },
                { "quest log", () => Quest.QuestLog(playerData) },
                { "qlog", () => Quest.QuestLog(playerData) },
                { "wake", () => Status.WakePlayer(playerData, room) },
                { "sleep", () => Status.SleepPlayer(playerData, room) },
                { "greet", () => Greet.GreetMob(playerData, room, commandOptions) },
                { "who", () => Who.Connected(playerData) }
            };


            return(commandList);
        }
 public void SwapArmour(Armour newArmour)
 {
     armour = newArmour;
     CalculateCost();
     CalculateName();
 }
Example #16
0
 protected void CalculatePrice(Armour armour)
 {
     armour.price = armour.defenceBoost * 20;
 }
Example #17
0
 public void RemoveArmour(Armour armour)
 {
     itemManager.allItems.Remove (armour);
     allArmour.Remove (armour);
 }
Example #18
0
 internal static DamageToArmour Get([NotNull] Damage d, [NotNull] Armour a)
 {
     return(GlobalStore.GetDamageToArmourMod(d, a));
 }
    private static Armour LoadArmour(XmlNode node)
    {
        GameManager manager = GameManager.getInstance();
        int str = Int32.Parse(node.Attributes["Strength"].InnerText);
        string aName = node.InnerText;
        int index = Int32.Parse(node.Attributes["CrewIndex"].InnerText);
        CrewMemberData cmd = null;

        if (index >= 0 && index < manager.crewMembers.Count)
        {
            cmd = manager.crewMembers[index];

        }
        Armour armour = new Armour(str, aName, cmd);
        return armour;
    }
Example #20
0
        public static PlayerClass ClericClass()
        {
            var cleric = new PlayerClass
            {
                Name               = "Cleric",
                IsBaseClass        = true,
                ExperienceModifier = 2000,
                HelpText           = new Help(),
                Skills             = new List <Skill>(),
                ReclassOptions     = new List <PlayerClass>(),
                MaxHpGain          = 15,
                MinHpGain          = 10,
                MaxManaGain        = 15,
                MinManaGain        = 10,
                MaxEnduranceGain   = 15,
                MinEnduranceGain   = 11,
                StatBonusStr       = 1,
                StatBonusCon       = 1
            };

            #region  Lvl 1 skills

            var blunt = BluntWeapons.BluntWeaponsAb();
            blunt.Learned     = true;
            blunt.Proficiency = 25;
            cleric.Skills.Add(blunt);



            var causeLight = CauseLight.causeLightAb();
            causeLight.Learned     = true;
            causeLight.Proficiency = 50;
            cleric.Skills.Add(causeLight);


            #endregion

            #region  Lvl 2 skills


            var cureLight = CureLight.CureLightAb();
            cureLight.Learned     = true;
            cureLight.Proficiency = 50;
            cleric.Skills.Add(cureLight);


            #endregion

            #region  Lvl 3 skills


            var detectInvis = DetectInvis.DetectInvisAb();
            detectInvis.Learned     = true;
            detectInvis.Proficiency = 50;
            cleric.Skills.Add(detectInvis);


            #endregion


            #region  Lvl 5 skills


            var armour = Armour.ArmourAb();
            armour.Learned       = true;
            armour.LevelObtained = 1;
            armour.Proficiency   = 50;
            cleric.Skills.Add(armour);

            var flail = Flail.FlailAb();
            flail.Learned       = true;
            flail.LevelObtained = 1;
            flail.Proficiency   = 50;
            cleric.Skills.Add(flail);

            var mount = Mount.MountAb();
            mount.Learned       = true;
            mount.LevelObtained = 1;
            mount.Proficiency   = 50;
            cleric.Skills.Add(mount);


            #endregion


            #region  Lvl 6 skills


            var cureBlind = CureBlindness.CureBlindnessAb();
            cureBlind.Learned       = true;
            cureBlind.LevelObtained = 1;
            cureBlind.Proficiency   = 50;
            cleric.Skills.Add(cureBlind);


            #endregion

            cleric.ReclassOptions.Add(Ranger.RangerClass());

            return(cleric);
        }
Example #21
0
 public MenuEntryArmour(Armour Item, int Count)
     : base((Item)Item, Count)
 {
 }
Example #22
0
        // Load the monster.txt drop file.
        private void LoadDropFile(bool edit)
        {
            var lines = (edit == false) ? File.ReadAllLines(GetPathOfSelectedItem()) : textBoxDropList.Lines;

            for (int i = 0; i < lines.Length; i++)
            {
                if (lines[i].StartsWith(";Gold"))
                {
                    if (lines[i + 1].StartsWith("1/"))
                    {
                        var workingLine = lines[i + 1].Split(' ');
                        GoldOdds = workingLine[0].Remove(0, 2);
                        Gold     = workingLine[2];
                        break;
                    }
                    else
                    {
                        GoldOdds = "0";
                        Gold     = "0";
                    }
                }
            }

            string[] Headers = new string[37]
            {
                ";Weapons",
                ";Armours",
                ";Helmets",
                ";Necklaces",
                ";Bracelets",
                ";Rings",
                ";Amulets",
                ";Belts",
                ";Boots",
                ";Stones",
                ";Torches",
                ";Potions",
                ";Ores",
                ";Meat",
                ";Crafting Materials",
                ";Scrolls",
                ";Gems",
                ";Mount",
                ";Books",
                ";Nothing",
                ";Script",
                ";Reins",
                ";Bells",
                ";Saddle",
                ";Ribbon",
                ";Mask",
                ";Food",
                ";Hook",
                ";Float",
                ";Bait",
                ";Finder",
                ";Reel",
                ";Fish",
                ";Quest",
                ";Awakening",
                ";Pets",
                ";Transform"
            };

            for (int i = 0; i < Headers.Length; i++)
            {
                for (int j = 0; j < lines.Length; j++)
                {
                    if (lines[j].StartsWith(Headers[i]))
                    {
                        for (int k = j + 1; k < lines.Length; k++)
                        {
                            if (lines[k].StartsWith(";"))
                            {
                                break;
                            }

                            var workingLine = lines[k].Split(' ');
                            if (workingLine.Length < 2)
                            {
                                continue;
                            }

                            var quest = "";

                            if (workingLine.Length > 2 && workingLine[2] == "Q")
                            {
                                quest = workingLine[2];
                            }

                            DropItem newDropItem = new DropItem {
                                Odds = workingLine[0], Name = workingLine[1], Quest = quest
                            };
                            switch (i)
                            {
                            case 0:
                                Weapon.Add(newDropItem);
                                break;

                            case 1:
                                Armour.Add(newDropItem);
                                break;

                            case 2:
                                Helmet.Add(newDropItem);
                                break;

                            case 3:
                                Necklace.Add(newDropItem);
                                break;

                            case 4:
                                Bracelet.Add(newDropItem);
                                break;

                            case 5:
                                Ring.Add(newDropItem);
                                break;

                            case 6:
                                Amulet.Add(newDropItem);
                                break;

                            case 7:
                                Belt.Add(newDropItem);
                                break;

                            case 8:
                                Boot.Add(newDropItem);
                                break;

                            case 9:
                                Stone.Add(newDropItem);
                                break;

                            case 10:
                                Torch.Add(newDropItem);
                                break;

                            case 11:
                                Potion.Add(newDropItem);
                                break;

                            case 12:
                                Ore.Add(newDropItem);
                                break;

                            case 13:
                                Meat.Add(newDropItem);
                                break;

                            case 14:
                                CraftingMaterial.Add(newDropItem);
                                break;

                            case 15:
                                Scrolls.Add(newDropItem);
                                break;

                            case 16:
                                Gem.Add(newDropItem);
                                break;

                            case 17:
                                Mount.Add(newDropItem);
                                break;

                            case 18:
                                Book.Add(newDropItem);
                                break;

                            case 19:
                                Nothing.Add(newDropItem);
                                break;

                            case 20:
                                Script.Add(newDropItem);
                                break;

                            case 21:
                                Reins.Add(newDropItem);
                                break;

                            case 22:
                                Bells.Add(newDropItem);
                                break;

                            case 23:
                                Saddle.Add(newDropItem);
                                break;

                            case 24:
                                Ribbon.Add(newDropItem);
                                break;

                            case 25:
                                Mask.Add(newDropItem);
                                break;

                            case 26:
                                Food.Add(newDropItem);
                                break;

                            case 27:
                                Hook.Add(newDropItem);
                                break;

                            case 28:
                                Float.Add(newDropItem);
                                break;

                            case 29:
                                Bait.Add(newDropItem);
                                break;

                            case 30:
                                Finder.Add(newDropItem);
                                break;

                            case 31:
                                Reel.Add(newDropItem);
                                break;

                            case 32:
                                Fish.Add(newDropItem);
                                break;

                            case 33:
                                Quest.Add(newDropItem);
                                break;

                            case 34:
                                Awakening.Add(newDropItem);
                                break;

                            case 35:
                                Pets.Add(newDropItem);
                                break;

                            case 36:
                                Transform.Add(newDropItem);
                                break;

                            default:
                                break;
                            }
                        }
                    }
                }
            }
        }
Example #23
0
 public void AddItem(Armour armour) => AddItem(Armours, armour);
Example #24
0
        public void DrawSelectArmourCharacterInfo(Point Position, Point Size, Color BackgroundColor, Character Info, Armour Armour)
        {
            int MDefChange = Info.MagicDefense;
            int DefChange = Info.Defense;
            Armour backup = Info.Armour;
            Info.Armour = Armour;
            MDefChange = Info.MagicDefense - MDefChange;
            DefChange = Info.Defense - DefChange;
            Info.Armour = backup;

            Vector2 Pos = new Vector2(Position.X + 215, Position.Y + 15);
            Point BarBorder = new Point(2, 2);
            Point BarSize = new Point(150, 10);
            DrawWindow(Position, Size, BackgroundColor);
            if (Info.CharInfo.CharacterPicture == null)
            {
                Globals.Instance.SpriteBatch.Draw(Globals.Instance.PixelWhite, new Rectangle(Position.X + 13, Position.Y + 13, 200, 150), Color.Black);
                Globals.Instance.SpriteBatch.Draw(Globals.Instance.PixelWhite, new Rectangle(Position.X + 15, Position.Y + 15, 196, 146), Color.White);
            }
            else
            {
                Globals.Instance.SpriteBatch.Draw(Info.CharInfo.CharacterPicture, new Rectangle(Position.X + 13, Position.Y + 13, 200, 150), Color.White);
            }
            DrawText(Info.DisplayName, Pos, Color.White, true, Color.Black);
            Pos.X += 200;
            DrawText("Lv. " + Info.Level, Pos, Color.White, true, Color.Black);
            Pos.Y += 25;
            DrawText("MAtk: " + Info.MagicAttack, Pos, Color.White, true, Color.Black);
            Pos.X -= 200;
            DrawText("Atk: " + Info.Attack, Pos, Color.White, true, Color.Black);
            Pos.Y += 25;
            string Def = "Def: " + Info.Defense + " ";
            int w = (int)Globals.Instance.SpriteFont.MeasureString(Def).X;
            DrawText(Def, Pos, Color.White, true, Color.Black);
            Pos.X += w;
            if (DefChange > 0)
                DrawText("(+" + DefChange + ")", Pos, Color.Green, true, Color.Black);
            else if (DefChange < 0)
                DrawText("(" + DefChange + ")", Pos, Color.Red, true, Color.Black);
            Pos.X -= w;
            Pos.X += 200;
            string MDef = "MDef: " + Info.MagicDefense + " ";
            w = (int)Globals.Instance.SpriteFont.MeasureString(MDef).X;
            DrawText(MDef, Pos, Color.White, true, Color.Black);
            Pos.X += w;
            if (MDefChange > 0)
                DrawText("(+" + MDefChange + ")", Pos, Color.Green, true, Color.Black);
            else if (MDefChange < 0)
                DrawText("(" + MDefChange + ")", Pos, Color.Red, true, Color.Black);
            Pos.X -= w;
        }
Example #25
0
 public void RemoveItem(Armour armour) => RemoveItem(Armours, armour);
Example #26
0
 public bool Contains(Armour armour) => Armours.Contains(armour);
Example #27
0
    public void AddItemToInvetory()
    {
        if (playerItems == null)
        {
            this.Awake();
        }

        var         slotToAddTo = playerItems.gameObject.GetComponentsInChildren <MyInventorySlot>()[Armour.GetSlotIndex(item.ArmourSlot)];
        ArmourPiece itemBackup  = slotToAddTo.GetArmourPiece();

        if (slotToAddTo != null)
        {
            slotToAddTo.AddItem(this.item);
        }
        else
        {
            Debug.Log("ERROR!");
        }

        if (itemBackup != null)
        {
            this.item = itemBackup;
            UpdateSlot();
        }
        else
        {
            Object.Destroy(this.gameObject);
        }
    }