예제 #1
0
 private void SetCurrent(Weapon weapon, Quality quality = Quality.None, WeaponQuality wq = WeaponQuality.None)
 {
     if (weapon == null)
     {
         Current = null;
     }
     else if (weapon is NovaCannon)
     {
         Current = new NovaCannon(weapon.Name, weapon.HullTypes, weapon.RawPower, weapon.RawSpace, weapon.RawSP, weapon.RawDamage, weapon.RawRange, weapon.Origin, weapon.PageNumber, weapon.RawSpecial,
                                  quality, wq, weapon.ComponentOrigin, weapon.Condition, ((NovaCannon)weapon).Ammo);
     }
     else if (weapon is LandingBay)
     {
         Current = new LandingBay(weapon.Name, weapon.HullTypes, weapon.Slots, weapon.RawPower, weapon.RawSpace, weapon.RawSP, weapon.RawStrength, weapon.Origin, weapon.PageNumber, quality, wq,
                                  weapon.RawSpecial, weapon.ComponentOrigin, weapon.Condition);
     }
     else if (weapon is TorpedoTubes)
     {
         Current = new TorpedoTubes(weapon.Name, weapon.HullTypes, weapon.RawPower, weapon.RawSpace, weapon.RawSP, weapon.RawStrength, ((TorpedoTubes)weapon).Capacity, weapon.Origin, weapon.PageNumber,
                                    quality, wq, weapon.RawSpecial, weapon.ComponentOrigin, weapon.Condition);
     }
     else
     {
         Current = new Weapon(weapon.Name, weapon.Type, weapon.HullTypes, weapon.Slots, weapon.RawPower, weapon.RawSpace, weapon.RawSP, weapon.RawStrength, weapon.RawDamage, weapon.RawCrit, weapon.RawRange,
                              weapon.Origin, weapon.PageNumber, quality, wq, weapon.RawSpecial, Quality.None, weapon.ComponentOrigin, weapon.Condition);
     }
     UpdateCurrent();
 }
예제 #2
0
 private void QualityChoice_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (QualityChoice.SelectedItem != null)
     {
         CurrentQuality = (Quality)QualityChoice.SelectedItem;
     }
     //QualityChoice.Text = CurrentQuality + " Quality";
     if (CurrentQuality == Quality.Common)                                                                                            //If moving to Common (nothing set)
     {
         SpaceCheck.IsChecked = StrengthCheck.IsChecked = DamageCheck.IsChecked = RangeCheck.IsChecked = CritCheck.IsChecked = false; //uncheck all for common
     }
     else if (CurrentQuality == Quality.Good)                                                                                         //If Good(Less can be set than poor or best)
     {
         StrengthCheck.IsChecked = CritCheck.IsChecked = false;                                                                       //uncheck disallowed options for good quality
     }
     if ((Type == WeaponType.LandingBay || Type == WeaponType.TorpedoTube))
     {
         SpaceCheck.IsChecked = CurrentQuality != Quality.Common;
         CurrentWQ            = WeaponQuality.Space;
         if (CurrentQuality == Quality.Poor || CurrentQuality == Quality.Best)
         {
             StrengthCheck.IsChecked = true;//Only two options available so auto check them
             CurrentWQ |= WeaponQuality.Strength;
         }
         SpaceCheck.IsEnabled = StrengthCheck.IsEnabled = DamageCheck.IsEnabled = RangeCheck.IsEnabled = CritCheck.IsEnabled = false;//disable all sinc there is only one valid permutation
         SetValues();
     }
     else
     {
         CheckEnables();
     }
 }
예제 #3
0
 /// <summary>
 /// Create a new Landing Bay
 /// </summary>
 /// <param name="name">name of the landing bay</param>
 /// <param name="hulls">class fo ship that can mount this weapon</param>
 /// <param name="slots">locatiosn where this weapon can be mounted</param>
 /// <param name="power">power used by this weapon</param>
 /// <param name="space">space used by this method</param>
 /// <param name="sp">cost of this weapon</param>
 /// <param name="str">strength of the weapon</param>
 /// <param name="capacity">total ammo capacity of the torpedo tube</param>
 /// <param name="origin">rulebook containing this weapon</param>
 /// <param name="page">page this weapon can be found on</param>
 /// <param name="quality">quality of this weapon</param>
 /// <param name="wq">enum declaring which qualities to be adjusted</param>
 /// <param name="special">special rules of this weapon</param>
 public LandingBay(string name, HullType hulls, WeaponSlot slots, int power, int space, int sp, int str,
     RuleBook origin, byte page, Quality quality = Quality.Common, WeaponQuality wq = WeaponQuality.None,
     string special = null, ComponentOrigin comp = ComponentOrigin.Standard, Condition cond = Condition.Intact)
     : base(name, WeaponType.LandingBay, hulls, slots, power, space, sp, str, default(DiceRoll), 0, 0, origin, page, quality, wq, special, Quality.None, comp, cond)
 {
     Squadrons = new List<Squadron>(Strength * 3);
 }
예제 #4
0
파일: Weapon.cs 프로젝트: hooperk/Starship
 /// <summary>
 /// Create a new weapon
 /// </summary>
 /// <param name="name">name of the weapon</param>
 /// <param name="type">class of weapon</param>
 /// <param name="hulls">class fo ship that can mount this weapon</param>
 /// <param name="slots">locatiosn where this weapon can be mounted</param>
 /// <param name="power">power used by this weapon</param>
 /// <param name="space">space used by this method</param>
 /// <param name="sp">cost of this weapon</param>
 /// <param name="str">strength of the weapon</param>
 /// <param name="damage">damage of the weapon</param>
 /// <param name="crit">crit rating of the weapon</param>
 /// <param name="range">range of the weapon</param>
 /// <param name="origin">rulebook containing this weapon</param>
 /// <param name="page">page this weapon can be found on</param>
 /// <param name="quality">quality of this weapon</param>
 /// <param name="wq">enum declaring which qualities to be adjusted</param>
 /// <param name="special">special rules of this weapon</param>
 /// <param name="turbo">Quality of turboweapon battery upgrade if applicable</param>
 public Weapon(string name, WeaponType type, HullType hulls, WeaponSlot slots, int power, int space, 
     int sp, int str, string damage, int crit, int range, RuleBook origin, byte page, Quality quality = Quality.Common,
     WeaponQuality wq = WeaponQuality.None, string special = null, Quality turbo = Quality.None, ComponentOrigin comp = ComponentOrigin.Standard, Condition cond = Condition.Intact)
     : this(name, type, hulls, slots, power, space, sp, str, new DiceRoll(damage), crit, range, 
     origin, page, quality, wq, special, turbo, comp, cond)
 {
 }
예제 #5
0
        /// <summary>
        /// Uses grammar rewriting to generate the model for this weapon
        /// </summary>
        /// <param name="quality"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public GameObject GenerateModel(WeaponQuality quality, WeaponType type)
        {
            GameObject model;

            switch (type)
            {
            case WeaponType.Sword:
                model = Instantiate(Music.Utils.ChooseList(SwordStarters));
                break;

            case WeaponType.Axe:
                model = Instantiate(Music.Utils.ChooseList(AxeStarters));
                break;

            case WeaponType.Hammer:
                model = Instantiate(Music.Utils.ChooseList(SwordStarters));
                break;

            default:
                model = Instantiate(Music.Utils.ChooseList(SwordStarters));
                break;
            }

            GrammarEngine.enabled = true;
            GrammarEngine.RewriteSpecificAtom(model);
            return(model);
        }
예제 #6
0
        public WeaponData GenerateWeaponData(WeaponQuality quality, WeaponType type)
        {
            //Generate the range of damage this weapon type can do
            Vector2i damageRange = DMGRange[(int)type, (int)quality];
            int      dmgLow      = UnityEngine.Random.Range((int)damageRange.X, (int)damageRange.Z);
            int      dmgHi       = dmgLow;

            if (dmgHi != damageRange.Z)
            {
                dmgHi = UnityEngine.Random.Range(dmgLow, dmgLow + 1 + QualityMaxStep[(int)type, (int)quality]);
            }

            //detmine the speed of the weapon (capped to 0.05 steps)
            float      speedVariantMax      = TypeSpeedVariant[(int)type, (int)quality];
            float      speedVariantSelected = UnityEngine.Random.Range(0, speedVariantMax);
            float      stepSize             = 0.05f;
            int        numSteps             = (int)Math.Floor(speedVariantSelected / stepSize);
            float      speedVariant         = numSteps * stepSize;
            WeaponData newWeaponData        = new WeaponData();

            newWeaponData.Quality     = quality;
            newWeaponData.Type        = type;
            newWeaponData.DamageRange = new Utils.Vector2i(dmgLow, dmgHi);
            newWeaponData.Speed       = 1.0f + speedVariant;

            return(newWeaponData);
        }
예제 #7
0
 /// <summary>
 /// Create a new weapon
 /// </summary>
 /// <param name="name">name of the weapon</param>
 /// <param name="type">class of weapon</param>
 /// <param name="hulls">class fo ship that can mount this weapon</param>
 /// <param name="slots">locatiosn where this weapon can be mounted</param>
 /// <param name="power">power used by this weapon</param>
 /// <param name="space">space used by this method</param>
 /// <param name="sp">cost of this weapon</param>
 /// <param name="str">strength of the weapon</param>
 /// <param name="damage">damage of the weapon</param>
 /// <param name="crit">crit rating of the weapon</param>
 /// <param name="range">range of the weapon</param>
 /// <param name="origin">rulebook containing this weapon</param>
 /// <param name="page">page this weapon can be found on</param>
 /// <param name="quality">quality of this weapon</param>
 /// <param name="wq">enum declaring which qualities to be adjusted</param>
 /// <param name="special">special rules of this weapon</param>
 /// <param name="turbo">Quality of turboweapon battery upgrade if applicable</param>
 public Weapon(string name, WeaponType type, HullType hulls, WeaponSlot slots, int power, int space,
               int sp, int str, string damage, int crit, int range, RuleBook origin, byte page, Quality quality = Quality.Common,
               WeaponQuality wq = WeaponQuality.None, string special = null, Quality turbo = Quality.None, ComponentOrigin comp = ComponentOrigin.Standard, Condition cond = Condition.Intact)
     : this(name, type, hulls, slots, power, space, sp, str, new DiceRoll(damage), crit, range,
            origin, page, quality, wq, special, turbo, comp, cond)
 {
 }
예제 #8
0
 public NovaCannon(String name, HullType hulls, int power, int space, int sp,
                   DiceRoll damage, int range, RuleBook origin, byte page, string special = null, Quality quality = Quality.Common,
                   WeaponQuality wq = WeaponQuality.None, ComponentOrigin comp = ComponentOrigin.Standard, Condition cond = Condition.Intact, int ammo = 0)
     : base(name, WeaponType.NovaCannon, hulls, WeaponSlot.Prow, power, space, sp, 0, damage, 0, range, origin, page, quality, wq, special, Quality.None, comp, cond)
 {
     this.Ammo = ammo;
 }
    public static SpecificWeapon CreateRandom(EnumValue powerLevel, WeaponQualityConstraintsMatrix matrix, FloatRange budgetRange)
    {
        SpecificWeapon newSpecificWeapon = CreateInstance <SpecificWeapon>();

        newSpecificWeapon.powerLevel = powerLevel;
        float budget = budgetRange.Random();

        matrix.AssignRandomWeapon(ref budget, newSpecificWeapon);

        while (budget > 0)
        {
            if (!matrix.AddRandomWeaponQuality(ref budget, newSpecificWeapon))
            {
                break;
            }
        }

        if (newSpecificWeapon.specialMaterial == null)
        {
            newSpecificWeapon.specialMaterial = WeaponQuality.CreateBlank(matrix.itemCollection.rarities, matrix.itemCollection.books);
        }
        if (newSpecificWeapon.enhancementBonus == null)
        {
            newSpecificWeapon.enhancementBonus = WeaponQuality.CreateBlank(matrix.itemCollection.rarities, matrix.itemCollection.books);
        }

        newSpecificWeapon.CalculateCost();
        newSpecificWeapon.CalculateName();

        return(newSpecificWeapon);
    }
예제 #10
0
        public void createCharacter(int points, string name)
        {
            currentCharacter = new Character(points, name);
            textBoxName.Text = name;

            //textBoxStr.Text = "10";
            //textBoxStrBonus.Text = "+0";
            //textBoxStrPB.Text = "0";

            //textBoxDex.Text = "10";
            //textBoxDexBonus.Text = "+0";
            //textBoxDexPB.Text = "0";

            //textBoxCon.Text = "10";
            //textBoxConBonus.Text = "+0";
            //textBoxConPB.Text = "0";

            //textBoxInt.Text = "10";
            //textBoxIntBonus.Text = "+0";
            //textBoxIntPB.Text = "0";

            //textBoxWis.Text = "10";
            //textBoxWisBonus.Text = "+0";
            //textBoxWisPB.Text = "0";

            //textBoxCha.Text = "10";
            //textBoxChaBonus.Text = "+0";
            //textBoxChaPB.Text = "0";

            //textBoxPoints.Text = points.ToString();

            Skill.initializeSkills();
            Race.prepareRace();
            List <Race> races = Race.getRaces();

            foreach (Race race in races)
            {
                comboBoxRace.Items.Add(race.getName());
            }
            currentCharacter.setSkills(Skill.getSkills());
            string[] classNames = Directory.GetFiles("CharacterClasses/BaseClasses", "*.txt");
            foreach (string className in classNames)
            {
                string classFileOutput = File.ReadAllText(className);
                Class.addBaseClass(Class.unpackClass(classFileOutput));
            }
            string weaponQualities = File.ReadAllText("WeaponDetails/WeaponQualities.txt");

            WeaponQuality.initializeQualities(weaponQualities);
            string weapons = File.ReadAllText("WeaponDetails/Weapons.txt");

            Weapon.initializeWeapons(weapons);
            string armour = File.ReadAllText("WeaponDetails/Armours.txt");

            Armour.prepareArmours(armour);
            currentCharacter.updateAC();
            refreshSheet();
            refreshSkill(true);
        }
예제 #11
0
 /// <summary>
 /// Create a new Torpedo Tube
 /// </summary>
 /// <param name="name">name of the torpedo tube</param>
 /// <param name="hulls">class of ship that can mount this weapon</param>
 /// <param name="slots">locatiosn where this weapon can be mounted</param>
 /// <param name="power">power used by this weapon</param>
 /// <param name="space">space used by this method</param>
 /// <param name="sp">cost of this weapon</param>
 /// <param name="str">strength of the weapon</param>
 /// <param name="capacity">total ammo capacity of the torpedo tube</param>
 /// <param name="origin">rulebook containing this weapon</param>
 /// <param name="page">page this weapon can be found on</param>
 /// <param name="quality">quality of this weapon</param>
 /// <param name="wq">enum declaring which qualities to be adjusted</param>
 /// <param name="special">special rules of this weapon</param>
 public TorpedoTubes(string name, HullType hulls, int power, int space, int sp, int str,
     int capacity, RuleBook origin, byte page, Quality quality = Quality.Common, WeaponQuality wq = WeaponQuality.None,
     string special = null, ComponentOrigin comp = ComponentOrigin.Standard, Condition cond = Condition.Intact)
     : base(name, WeaponType.TorpedoTube, hulls, WeaponSlot.Prow | WeaponSlot.Keel, power, space, sp, str, default(DiceRoll), 0, 0, origin, page, 
         quality, wq, special, Quality.None, comp, cond)
 {
     this.Capacity = capacity;
     Ammo = new List<Torpedo>(Capacity);
     Tubes = new Torpedo[Strength];
 }
예제 #12
0
        public string GenerateName(WeaponQuality quality, WeaponType type)
        {
            var sb = new StringBuilder();

            sb.Append(quality.ToString());
            sb.Append(" ");
            sb.Append(type.ToString());
            sb.Append(" ");
            sb.Append("of Testing");
            return(sb.ToString());
        }
예제 #13
0
 public void AddSpecialAbility(WeaponQuality newSpecialAbility)
 {
     WeaponQuality[] newSpecialAbilities = new WeaponQuality[specialAbilities.Length + 1];
     for (int i = 0; i < specialAbilities.Length; i++)
     {
         newSpecialAbilities[i] = specialAbilities[i];
     }
     newSpecialAbilities[specialAbilities.Length] = newSpecialAbility;
     specialAbilities = newSpecialAbilities;
     CalculateCost();
     CalculateName();
 }
예제 #14
0
    public void GenerateWeaponQuality()
    {
        WeaponQuality = sf.RandomEnumValue <WeaponQuality>();
        if (weaponQuality == WeaponQuality.UNIQUE)
        {
            weaponQuality = WeaponQuality.MAGNIFICENT;
        }
        WeaponPrefix         = sf.RandomEnumValue <WeaponPrefix>();
        WeaponProjectileType = sf.RandomEnumValue <WeaponProjectileType>();

        ItemName = weaponQuality + " " + weaponPrefix + " " + weaponType + " " + ", with " + weaponProjectileType + " rounds.";
    }
예제 #15
0
        private void CheckEnables()
        {
            int count = 0;

            CurrentWQ = WeaponQuality.None;
            if (SpaceCheck.IsChecked ?? false)
            {
                count++;
                CurrentWQ |= WeaponQuality.Space;
            }
            if (StrengthCheck.IsChecked ?? false)
            {
                count++;
                CurrentWQ |= WeaponQuality.Strength;
            }
            if (DamageCheck.IsChecked ?? false)
            {
                count++;
                CurrentWQ |= WeaponQuality.Damage;
            }
            if (RangeCheck.IsChecked ?? false)
            {
                count++;
                CurrentWQ |= WeaponQuality.Range;
            }
            if (CritCheck.IsChecked ?? false)
            {
                count++;
                CurrentWQ |= WeaponQuality.Crit;
            }
            int allowed;

            if (CurrentQuality == Quality.Good)
            {
                allowed = 1;
            }
            else if (CurrentQuality == Quality.Common)
            {
                allowed = 0;
            }
            else
            {
                allowed = 2;
            }
            SpaceCheck.IsEnabled    = ((SpaceCheck.IsChecked ?? true) || count < allowed);
            StrengthCheck.IsEnabled = (CurrentQuality != Quality.Good && ((StrengthCheck.IsChecked ?? true) || count < allowed));
            DamageCheck.IsEnabled   = (Type != WeaponType.LandingBay && Type != WeaponType.TorpedoTube && ((DamageCheck.IsChecked ?? true) || count < allowed));                               //Landing bays and Torpedoes don't have Damage
            RangeCheck.IsEnabled    = (Type != WeaponType.LandingBay && Type != WeaponType.TorpedoTube && ((RangeCheck.IsChecked ?? true) || count < allowed));                                //Landing bays and torpedoes don't have range
            CritCheck.IsEnabled     = (CurrentQuality != Quality.Good && (Type == WeaponType.Macrobattery || Type == WeaponType.Lance) && ((CritCheck.IsChecked ?? true) || count < allowed)); //Only Macrobatteries and Lances have crit
            SetValues();
        }
예제 #16
0
 /// <summary>
 /// Create a new weapon
 /// </summary>
 /// <param name="name">name of the weapon</param>
 /// <param name="type">class of weapon</param>
 /// <param name="hulls">class fo ship that can mount this weapon</param>
 /// <param name="slots">locatiosn where this weapon can be mounted</param>
 /// <param name="power">power used by this weapon</param>
 /// <param name="space">space used by this method</param>
 /// <param name="sp">cost of this weapon</param>
 /// <param name="str">strength of the weapon</param>
 /// <param name="damage">damage of the weapon</param>
 /// <param name="crit">crit rating of the weapon</param>
 /// <param name="range">range of the weapon</param>
 /// <param name="origin">rulebook containing this weapon</param>
 /// <param name="page">page this weapon can be found on</param>
 /// <param name="quality">quality of this weapon</param>
 /// <param name="wq">enum declaring which qualities to be adjusted</param>
 /// <param name="special">special rules of this weapon</param>
 /// <param name="turbo">Quality of turboweapon battery upgrade if applicable</param>
 public Weapon(string name, WeaponType type, HullType hulls, WeaponSlot slots, int power, int space, int sp, int str,
               DiceRoll damage, int crit, int range, RuleBook origin, byte page, Quality quality = Quality.Common,
               WeaponQuality wq = WeaponQuality.None, string special = null, Quality turbo = Quality.None, ComponentOrigin comp = ComponentOrigin.Standard, Condition cond = Condition.Intact)
     : base(name, sp, power, space, special, origin, page, hulls, quality, comp, cond)
 {
     this.Type          = type;
     this.Slots         = slots;
     this.Strength      = str;
     this.Damage        = damage;
     this.Crit          = crit;
     this.Range         = range;
     this.WeaponQuality = wq;
     this.TurboWeapon   = turbo;
 }
예제 #17
0
 public WeaponQualityChooser(WeaponType type, Quality last, WeaponQuality lastwq)
 {
     this.Type = type;
     this.CurrentQuality = this.OriginalQuality = last;
     this.CurrentWQ = this.OriginalWQ = lastwq;
     InitializeComponent();
     SpaceCheck.IsChecked = (CurrentWQ & WeaponQuality.Space) != 0;
     StrengthCheck.IsChecked = (CurrentWQ & WeaponQuality.Strength) != 0;
     DamageCheck.IsChecked = (CurrentWQ & WeaponQuality.Damage) != 0;
     RangeCheck.IsChecked = (CurrentWQ & WeaponQuality.Range) != 0;
     CritCheck.IsChecked = (CurrentWQ & WeaponQuality.Crit) != 0;
     QualityChoice.ItemsSource = new List<Quality>() { Quality.Poor, Quality.Common, Quality.Good, Quality.Best };
     QualityChoice.SelectedItem = CurrentQuality;
 }
예제 #18
0
파일: Weapon.cs 프로젝트: hooperk/Starship
 /// <summary>
 /// Create a new weapon
 /// </summary>
 /// <param name="name">name of the weapon</param>
 /// <param name="type">class of weapon</param>
 /// <param name="hulls">class fo ship that can mount this weapon</param>
 /// <param name="slots">locatiosn where this weapon can be mounted</param>
 /// <param name="power">power used by this weapon</param>
 /// <param name="space">space used by this method</param>
 /// <param name="sp">cost of this weapon</param>
 /// <param name="str">strength of the weapon</param>
 /// <param name="damage">damage of the weapon</param>
 /// <param name="crit">crit rating of the weapon</param>
 /// <param name="range">range of the weapon</param>
 /// <param name="origin">rulebook containing this weapon</param>
 /// <param name="page">page this weapon can be found on</param>
 /// <param name="quality">quality of this weapon</param>
 /// <param name="wq">enum declaring which qualities to be adjusted</param>
 /// <param name="special">special rules of this weapon</param>
 /// <param name="turbo">Quality of turboweapon battery upgrade if applicable</param>
 public Weapon(string name, WeaponType type, HullType hulls, WeaponSlot slots, int power, int space, int sp, int str,
     DiceRoll damage, int crit, int range, RuleBook origin, byte page, Quality quality = Quality.Common,
     WeaponQuality wq = WeaponQuality.None, string special = null, Quality turbo = Quality.None, ComponentOrigin comp = ComponentOrigin.Standard, Condition cond = Condition.Intact)
     : base(name, sp, power, space, special, origin, page, hulls, quality, comp, cond)
 {
     this.Type = type;
     this.Slots = slots;
     this.Strength = str;
     this.Damage = damage;
     this.Crit = crit;
     this.Range = range;
     this.WeaponQuality = wq;
     this.TurboWeapon = turbo;
 }
예제 #19
0
 public WeaponQualityChooser(WeaponType type, Quality last, WeaponQuality lastwq)
 {
     this.Type           = type;
     this.CurrentQuality = this.OriginalQuality = last;
     this.CurrentWQ      = this.OriginalWQ = lastwq;
     InitializeComponent();
     SpaceCheck.IsChecked      = (CurrentWQ & WeaponQuality.Space) != 0;
     StrengthCheck.IsChecked   = (CurrentWQ & WeaponQuality.Strength) != 0;
     DamageCheck.IsChecked     = (CurrentWQ & WeaponQuality.Damage) != 0;
     RangeCheck.IsChecked      = (CurrentWQ & WeaponQuality.Range) != 0;
     CritCheck.IsChecked       = (CurrentWQ & WeaponQuality.Crit) != 0;
     QualityChoice.ItemsSource = new List <Quality>()
     {
         Quality.Poor, Quality.Common, Quality.Good, Quality.Best
     };
     QualityChoice.SelectedItem = CurrentQuality;
 }
예제 #20
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 1:
            {
                m_Crafter = reader.ReadMobile();
                m_Quality = (WeaponQuality)reader.ReadInt();
                m_Uses    = reader.ReadInt();
                break;
            }
            }
        }
예제 #21
0
    protected override void SetupFromSplitJsonString(string[] splitJsonString)
    {
        name       = splitJsonString[0];
        powerLevel = EnumValue.CreateFromJsonString(splitJsonString[1]);
        cost       = Wrapper <float> .CreateFromJsonString(splitJsonString[2]);

        notes            = CreateStringFromSafeJson(splitJsonString[3]);
        weapon           = Weapon.CreateFromJsonString(splitJsonString[4]);
        enhancementBonus = WeaponQuality.CreateFromJsonString(splitJsonString[5]);
        specialMaterial  = WeaponQuality.CreateFromJsonString(splitJsonString[6]);

        specialAbilities = new WeaponQuality[splitJsonString.Length - 7];
        for (int i = 0; i < specialAbilities.Length; i++)
        {
            specialAbilities[i] = WeaponQuality.CreateFromJsonString(splitJsonString[i + 8]);
        }
    }
예제 #22
0
    public void RemoveSpecialAbility(int removeAt)
    {
        WeaponQuality[] newSpecialAbilities = new WeaponQuality[specialAbilities.Length - 1];
        int             oldIndex            = 0;
        int             newIndex            = 0;

        for (; oldIndex < specialAbilities.Length; oldIndex++, newIndex++)
        {
            if (oldIndex == removeAt)
            {
                oldIndex++;
            }
            newSpecialAbilities[newIndex] = specialAbilities[oldIndex];
        }
        specialAbilities = newSpecialAbilities;
        CalculateCost();
        CalculateName();
    }
예제 #23
0
 private void CheckEnables()
 {
     int count = 0;
     CurrentWQ = WeaponQuality.None;
     if (SpaceCheck.IsChecked ?? false)
     {
         count++;
         CurrentWQ |= WeaponQuality.Space;
     }
     if (StrengthCheck.IsChecked ?? false) {
         count++;
     CurrentWQ |= WeaponQuality.Strength;
     }
     if (DamageCheck.IsChecked ?? false)
     {
         count++;
         CurrentWQ |= WeaponQuality.Damage;
     }
     if (RangeCheck.IsChecked ?? false)
     {
         count++;
         CurrentWQ |= WeaponQuality.Range;
     }
     if (CritCheck.IsChecked ?? false)
     {
         count++;
         CurrentWQ |= WeaponQuality.Crit;
     }
     int allowed;
     if (CurrentQuality == Quality.Good)
         allowed = 1;
     else if (CurrentQuality == Quality.Common)
         allowed = 0;
     else
         allowed = 2;
     SpaceCheck.IsEnabled = ((SpaceCheck.IsChecked ?? true) || count < allowed);
     StrengthCheck.IsEnabled = (CurrentQuality != Quality.Good && ((StrengthCheck.IsChecked ?? true) || count < allowed));
     DamageCheck.IsEnabled = (Type != WeaponType.LandingBay && Type != WeaponType.TorpedoTube && ((DamageCheck.IsChecked ?? true) || count < allowed));//Landing bays and Torpedoes don't have Damage
     RangeCheck.IsEnabled = (Type != WeaponType.LandingBay && Type != WeaponType.TorpedoTube && ((RangeCheck.IsChecked ?? true) || count < allowed));//Landing bays and torpedoes don't have range
     CritCheck.IsEnabled = (CurrentQuality != Quality.Good && (Type == WeaponType.Macrobattery || Type == WeaponType.Lance) && ((CritCheck.IsChecked ?? true) || count < allowed));//Only Macrobatteries and Lances have crit
     SetValues();
 }
예제 #24
0
    protected override string ConvertToJsonString(string[] jsonSplitter)
    {
        string jsonString = "";

        jsonString += name + jsonSplitter[0];
        jsonString += EnumValue.GetJsonString(powerLevel) + jsonSplitter[0];
        jsonString += Wrapper <float> .GetJsonString(cost) + jsonSplitter[0];

        jsonString += GetSafeJsonFromString(notes) + jsonSplitter[0];
        jsonString += Weapon.GetJsonString(weapon) + jsonSplitter[0];
        jsonString += WeaponQuality.GetJsonString(enhancementBonus) + jsonSplitter[0];
        jsonString += WeaponQuality.GetJsonString(specialMaterial) + jsonSplitter[0];

        for (int i = 0; i < specialAbilities.Length; i++)
        {
            jsonString += WeaponQuality.GetJsonString(specialAbilities[i]) + jsonSplitter[0];
        }

        return(jsonString);
    }
예제 #25
0
    private void CalculateCost()
    {
        cost  = 0;
        cost += weapon.cost;
        cost += specialMaterial.cost;

        int bonus = (int)enhancementBonus.bonusEquivalent;

        for (int i = 0; i < specialAbilities.Length; i++)
        {
            if (specialAbilities[i].bonusEquivalent == 0)
            {
                cost += specialAbilities[i].cost;
            }
            else
            {
                bonus += (int)specialAbilities[i].bonusEquivalent;
            }
        }
        cost += WeaponQuality.BonusToCost(bonus);
    }
예제 #26
0
        /// <summary>
        /// Handles generating the stats (data) and model for this object
        /// </summary>
        /// <param name="quality"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public GameObject Generate(WeaponQuality quality, WeaponType type)
        {
            //create weapon model
            var weaponObj = GenerateModel(quality, type);

            weaponObj.transform.position = this.transform.position;

            //generate weapon stats
            Weapon weaponComponent = weaponObj.AddComponent <Weapon>();

            weaponComponent.tag = "Weapon";
            var data = _dataGenerator.GenerateWeaponData(quality, type);

            weaponComponent.Data = data;
            weaponComponent.Name = GenerateName(quality, type);
            weaponObj.name       = weaponComponent.name;
            var rb = weaponObj.AddComponent <Rigidbody>();

            rb.mass       = 0.1f;
            rb.useGravity = true;
            return(weaponObj);
        }
예제 #27
0
    public static Weapon CreateWeapon(WeaponType type, WeaponQuality quality = WeaponQuality.Factory)
    {
        var weapon = new Weapon()
        {
            Guid    = Guid.NewGuid(),
            Type    = type,
            Quality = quality
        };

        var values = Enum.GetValues(typeof(WeaponType)).Cast <int>();
        var index  = Enum.GetNames(typeof(WeaponType)).ToList().IndexOf(type.ToString()); // ugh

        var price = values.ElementAt(index);

        values = Enum.GetValues(typeof(WeaponQuality)).Cast <int>();
        index  = Enum.GetNames(typeof(WeaponQuality)).ToList().IndexOf(quality.ToString()); // ugh

        price *= values.ElementAt(index);

        weapon.Price = price;
        weapon.Name  = type.ToString();

        return(weapon);
    }
예제 #28
0
    public static Weapon CreateWeapon(WeaponType type, WeaponQuality quality = WeaponQuality.Factory)
    {
        var weapon = new Weapon()
        {
            Guid = Guid.NewGuid(),
            Type = type,
            Quality = quality
        };

        var values = Enum.GetValues(typeof(WeaponType)).Cast<int>();
        var index = Enum.GetNames(typeof(WeaponType)).ToList().IndexOf(type.ToString()); // ugh

        var price = values.ElementAt(index);

        values = Enum.GetValues(typeof(WeaponQuality)).Cast<int>();
        index = Enum.GetNames(typeof(WeaponQuality)).ToList().IndexOf(quality.ToString()); // ugh

        price *= values.ElementAt(index);

        weapon.Price = price;
        weapon.Name = type.ToString();

        return weapon;
    }
예제 #29
0
		public BaseWeapon( int itemID ) : base( itemID )
		{
			Layer = (Layer)ItemData.Quality;

			m_Quality = WeaponQuality.Regular;
			m_StrReq = -1;
			m_DexReq = -1;
			m_IntReq = -1;
			m_MinDamage = -1;
			m_MaxDamage = -1;
			m_HitSound = -1;
			m_MissSound = -1;
			m_Speed = -1;
			m_MaxRange = -1;
			m_Skill = (SkillName)(-1);
			m_Type = (WeaponType)(-1);
			m_Animation = (WeaponAnimation)(-1);

			m_Hits = m_MaxHits = Utility.RandomMinMax( InitMinHits, InitMaxHits );

			m_Resource = CraftResource.Iron;

			m_AosAttributes = new AosAttributes( this );
			m_AosWeaponAttributes = new AosWeaponAttributes( this );
            m_AosSkillBonuses = new AosSkillBonuses(this);

            // mod to randomly add sockets and socketability features to weapons. These settings will yield
            // 2% drop rate of socketed/socketable items
            // 0.1% chance of 5 sockets
            // 0.5% of 4 sockets
            // 3% chance of 3 sockets
            // 15% chance of 2 sockets
            // 50% chance of 1 socket
            // the remainder will be 0 socket (31.4% in this case)
            // uncomment the next line to prevent artifacts from being socketed
            // if(ArtifactRarity == 0)
            XmlSockets.ConfigureRandom(this, 2.0, 0.1, 0.5, 3.0, 15.0, 50.0);
			m_AosElementDamages = new AosElementAttributes( this );
		}
예제 #30
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
			{
				case 8:
				case 7:
				case 6:
				case 5:
				{
					SaveFlag flags = (SaveFlag)reader.ReadInt();

					if ( GetSaveFlag( flags, SaveFlag.DamageLevel ) )
					{
						m_DamageLevel = (WeaponDamageLevel)reader.ReadInt();

						if ( m_DamageLevel > WeaponDamageLevel.Vanq )
							m_DamageLevel = WeaponDamageLevel.Ruin;
					}

					if ( GetSaveFlag( flags, SaveFlag.AccuracyLevel ) )
					{
						m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt();

						if ( m_AccuracyLevel > WeaponAccuracyLevel.Supremely )
							m_AccuracyLevel = WeaponAccuracyLevel.Accurate;
					}

					if ( GetSaveFlag( flags, SaveFlag.DurabilityLevel ) )
					{
						m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt();

						if ( m_DurabilityLevel > WeaponDurabilityLevel.Indestructible )
							m_DurabilityLevel = WeaponDurabilityLevel.Durable;
					}

					if ( GetSaveFlag( flags, SaveFlag.Quality ) )
						m_Quality = (WeaponQuality)reader.ReadInt();
					else
						m_Quality = WeaponQuality.Regular;

					if ( GetSaveFlag( flags, SaveFlag.Hits ) )
						m_Hits = reader.ReadInt();

					if ( GetSaveFlag( flags, SaveFlag.MaxHits ) )
						m_MaxHits = reader.ReadInt();

					if ( GetSaveFlag( flags, SaveFlag.Slayer ) )
						m_Slayer = (SlayerName)reader.ReadInt();

					if ( GetSaveFlag( flags, SaveFlag.Poison ) )
						m_Poison = Poison.Deserialize( reader );

					if ( GetSaveFlag( flags, SaveFlag.PoisonCharges ) )
						m_PoisonCharges = reader.ReadInt();

					if ( GetSaveFlag( flags, SaveFlag.Crafter ) )
						m_Crafter = reader.ReadMobile();

					if ( GetSaveFlag( flags, SaveFlag.Identified ) )
						m_Identified = ( version >= 6 || reader.ReadBool() );

					if ( GetSaveFlag( flags, SaveFlag.StrReq ) )
						m_StrReq = reader.ReadInt();
					else
						m_StrReq = -1;

					if ( GetSaveFlag( flags, SaveFlag.DexReq ) )
						m_DexReq = reader.ReadInt();
					else
						m_DexReq = -1;

					if ( GetSaveFlag( flags, SaveFlag.IntReq ) )
						m_IntReq = reader.ReadInt();
					else
						m_IntReq = -1;

					if ( GetSaveFlag( flags, SaveFlag.MinDamage ) )
						m_MinDamage = reader.ReadInt();
					else
						m_MinDamage = -1;

					if ( GetSaveFlag( flags, SaveFlag.MaxDamage ) )
						m_MaxDamage = reader.ReadInt();
					else
						m_MaxDamage = -1;

					if ( GetSaveFlag( flags, SaveFlag.HitSound ) )
						m_HitSound = reader.ReadInt();
					else
						m_HitSound = -1;

					if ( GetSaveFlag( flags, SaveFlag.MissSound ) )
						m_MissSound = reader.ReadInt();
					else
						m_MissSound = -1;

					if ( GetSaveFlag( flags, SaveFlag.Speed ) )
						m_Speed = reader.ReadInt();
					else
						m_Speed = -1;

					if ( GetSaveFlag( flags, SaveFlag.MaxRange ) )
						m_MaxRange = reader.ReadInt();
					else
						m_MaxRange = -1;

					if ( GetSaveFlag( flags, SaveFlag.Skill ) )
						m_Skill = (SkillName)reader.ReadInt();
					else
						m_Skill = (SkillName)(-1);

					if ( GetSaveFlag( flags, SaveFlag.Type ) )
						m_Type = (WeaponType)reader.ReadInt();
					else
						m_Type = (WeaponType)(-1);

					if ( GetSaveFlag( flags, SaveFlag.Animation ) )
						m_Animation = (WeaponAnimation)reader.ReadInt();
					else
						m_Animation = (WeaponAnimation)(-1);

					if ( GetSaveFlag( flags, SaveFlag.Resource ) )
						m_Resource = (CraftResource)reader.ReadInt();
					else
						m_Resource = CraftResource.Iron;

					if ( GetSaveFlag( flags, SaveFlag.xAttributes ) )
						m_AosAttributes = new AosAttributes( this, reader );
					else
						m_AosAttributes = new AosAttributes( this );

					if ( GetSaveFlag( flags, SaveFlag.xWeaponAttributes ) )
						m_AosWeaponAttributes = new AosWeaponAttributes( this, reader );
					else
						m_AosWeaponAttributes = new AosWeaponAttributes( this );

					if ( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile )
					{
						m_SkillMod = new DefaultSkillMod( AccuracySkill, true, (int)m_AccuracyLevel * 5 );
						((Mobile)Parent).AddSkillMod( m_SkillMod );
					}

					if ( version < 7 && m_AosWeaponAttributes.MageWeapon != 0 )
						m_AosWeaponAttributes.MageWeapon = 30 - m_AosWeaponAttributes.MageWeapon;

					if ( Core.AOS && m_AosWeaponAttributes.MageWeapon != 0 && m_AosWeaponAttributes.MageWeapon != 30 && Parent is Mobile )
					{
						m_MageMod = new DefaultSkillMod( SkillName.Magery, true, -30 + m_AosWeaponAttributes.MageWeapon );
						((Mobile)Parent).AddSkillMod( m_MageMod );
					}

					if ( GetSaveFlag( flags, SaveFlag.PlayerConstructed ) )
						m_PlayerConstructed = true;

					if( GetSaveFlag( flags, SaveFlag.SkillBonuses ) )
						m_AosSkillBonuses = new AosSkillBonuses( this, reader );
					else
                        m_AosSkillBonuses = new AosSkillBonuses(this);

                    // mod to randomly add sockets and socketability features to weapons. These settings will yield
                    // 2% drop rate of socketed/socketable items
                    // 0.1% chance of 5 sockets
                    // 0.5% of 4 sockets
                    // 3% chance of 3 sockets
                    // 15% chance of 2 sockets
                    // 50% chance of 1 socket
                    // the remainder will be 0 socket (31.4% in this case)
                    // uncomment the next line to prevent artifacts from being socketed
                    // if(ArtifactRarity == 0)
                    XmlSockets.ConfigureRandom(this, 2.0, 0.1, 0.5, 3.0, 15.0, 50.0);

					if( GetSaveFlag( flags, SaveFlag.Slayer2 ) )
						m_Slayer2 = (SlayerName)reader.ReadInt();

					if( GetSaveFlag( flags, SaveFlag.ElementalDamages ) )
						m_AosElementDamages = new AosElementAttributes( this, reader );
					else
						m_AosElementDamages = new AosElementAttributes( this );

					break;
				}
				case 4:
				{
					m_Slayer = (SlayerName)reader.ReadInt();

					goto case 3;
				}
				case 3:
				{
					m_StrReq = reader.ReadInt();
					m_DexReq = reader.ReadInt();
					m_IntReq = reader.ReadInt();

					goto case 2;
				}
				case 2:
				{
					m_Identified = reader.ReadBool();

					goto case 1;
				}
				case 1:
				{
					m_MaxRange = reader.ReadInt();

					goto case 0;
				}
				case 0:
				{
					if ( version == 0 )
						m_MaxRange = 1; // default

					if ( version < 5 )
					{
						m_Resource = CraftResource.Iron;
						m_AosAttributes = new AosAttributes( this );
						m_AosWeaponAttributes = new AosWeaponAttributes( this );
						m_AosElementDamages = new AosElementAttributes( this );
                        m_AosSkillBonuses = new AosSkillBonuses(this);

                        // mod to randomly add sockets and socketability features to weapons. These settings will yield
                        // 2% drop rate of socketed/socketable items
                        // 0.1% chance of 5 sockets
                        // 0.5% of 4 sockets
                        // 3% chance of 3 sockets
                        // 15% chance of 2 sockets
                        // 50% chance of 1 socket
                        // the remainder will be 0 socket (31.4% in this case)
                        // uncomment the next line to prevent artifacts from being socketed
                        // if(ArtifactRarity == 0)
                        XmlSockets.ConfigureRandom(this, 2.0, 0.1, 0.5, 3.0, 15.0, 50.0);
					}

					m_MinDamage = reader.ReadInt();
					m_MaxDamage = reader.ReadInt();

					m_Speed = reader.ReadInt();

					m_HitSound = reader.ReadInt();
					m_MissSound = reader.ReadInt();

					m_Skill = (SkillName)reader.ReadInt();
					m_Type = (WeaponType)reader.ReadInt();
					m_Animation = (WeaponAnimation)reader.ReadInt();
					m_DamageLevel = (WeaponDamageLevel)reader.ReadInt();
					m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt();
					m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt();
					m_Quality = (WeaponQuality)reader.ReadInt();

					m_Crafter = reader.ReadMobile();

					m_Poison = Poison.Deserialize( reader );
					m_PoisonCharges = reader.ReadInt();

					if ( m_StrReq == OldStrengthReq )
						m_StrReq = -1;

					if ( m_DexReq == OldDexterityReq )
						m_DexReq = -1;

					if ( m_IntReq == OldIntelligenceReq )
						m_IntReq = -1;

					if ( m_MinDamage == OldMinDamage )
						m_MinDamage = -1;

					if ( m_MaxDamage == OldMaxDamage )
						m_MaxDamage = -1;

					if ( m_HitSound == OldHitSound )
						m_HitSound = -1;

					if ( m_MissSound == OldMissSound )
						m_MissSound = -1;

					if ( m_Speed == OldSpeed )
						m_Speed = -1;

					if ( m_MaxRange == OldMaxRange )
						m_MaxRange = -1;

					if ( m_Skill == OldSkill )
						m_Skill = (SkillName)(-1);

					if ( m_Type == OldType )
						m_Type = (WeaponType)(-1);

					if ( m_Animation == OldAnimation )
						m_Animation = (WeaponAnimation)(-1);

					if ( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile )
					{
						m_SkillMod = new DefaultSkillMod( AccuracySkill, true, (int)m_AccuracyLevel * 5);
						((Mobile)Parent).AddSkillMod( m_SkillMod );
					}

					break;
				}
			}

			if ( Core.AOS && Parent is Mobile )
				m_AosSkillBonuses.AddTo( (Mobile)Parent );

			int strBonus = m_AosAttributes.BonusStr;
			int dexBonus = m_AosAttributes.BonusDex;
			int intBonus = m_AosAttributes.BonusInt;

			if ( this.Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0) )
			{
				Mobile m = (Mobile)this.Parent;

				string modName = this.Serial.ToString();

				if ( strBonus != 0 )
					m.AddStatMod( new StatMod( StatType.Str, modName + "Str", strBonus, TimeSpan.Zero ) );

				if ( dexBonus != 0 )
					m.AddStatMod( new StatMod( StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero ) );

				if ( intBonus != 0 )
					m.AddStatMod( new StatMod( StatType.Int, modName + "Int", intBonus, TimeSpan.Zero ) );
			}

			if ( Parent is Mobile )
				((Mobile)Parent).CheckStatTimers();

			if ( m_Hits <= 0 && m_MaxHits <= 0 )
			{
				m_Hits = m_MaxHits = Utility.RandomMinMax( InitMinHits, InitMaxHits );
			}

			if ( version < 6 )
				m_PlayerConstructed = true; // we don't know, so, assume it's crafted
		}
예제 #31
0
        public BaseWeapon(int itemID)
            : base(itemID)
        {
            Layer = (Layer)ItemData.Quality;

            m_Quality = WeaponQuality.Regular;
            m_StrReq = -1;
            m_DexReq = -1;
            m_IntReq = -1;
            m_MinDamage = -1;
            m_MaxDamage = -1;
            m_HitSound = -1;
            m_MissSound = -1;
            m_Speed = -1;
            m_MaxRange = -1;
            m_Skill = (SkillName)(-1);
            m_Type = (WeaponType)(-1);
            m_Animation = (WeaponAnimation)(-1);

            m_Hits = m_MaxHits = Utility.RandomMinMax(InitMinHits, InitMaxHits);

            m_Resource = CraftResource.Iron;

            m_AosAttributes = new AosAttributes(this);
            m_AosWeaponAttributes = new AosWeaponAttributes(this);
            m_AosSkillBonuses = new AosSkillBonuses(this);
            m_AosElementDamages = new AosElementAttributes(this);
            #region SA
			m_SAAbsorptionAttributes = new SAAbsorptionAttributes( this );
			#endregion

            #region Mondain's Legacy Sets
            m_SetAttributes = new AosAttributes(this);
            m_SetSkillBonuses = new AosSkillBonuses(this);
            #endregion

		ItemValue = GearScore.GetItemValue( this );
        }
예제 #32
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            switch ( version )
            {
                case 6: m_OldJewel = reader.ReadBool(); goto case 5;
                case 5: m_Seal = reader.ReadString(); goto case 4;
                case 4:
                case 3:
                {
                    m_Crafter = reader.ReadMobile();
                    m_CraftersOriginalName = reader.ReadString();
                    m_Quality = (WeaponQuality)reader.ReadInt();
                    goto case 2;
                }
                case 2:
                {
                    m_Resource = (CraftResource)reader.ReadEncodedInt();
                    m_GemType = (GemType)reader.ReadEncodedInt();

                    goto case 1;
                }
                case 1:
                {
                    m_AosAttributes = new AosAttributes( this, reader );
                    m_AosResistances = new AosElementAttributes( this, reader );
                    m_AosSkillBonuses = new AosSkillBonuses( this, reader );

                    if ( Core.AOS && Parent is Mobile )
                        m_AosSkillBonuses.AddTo( (Mobile)Parent );

                    int strBonus = m_AosAttributes.BonusStr;
                    int dexBonus = m_AosAttributes.BonusDex;
                    int intBonus = m_AosAttributes.BonusInt;

                    if ( Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0) )
                    {
                        Mobile m = (Mobile)Parent;

                        string modName = Serial.ToString();

                        if ( strBonus != 0 )
                            m.AddStatMod( new StatMod( StatType.Str, modName + "Str", strBonus, TimeSpan.Zero ) );

                        if ( dexBonus != 0 )
                            m.AddStatMod( new StatMod( StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero ) );

                        if ( intBonus != 0 )
                            m.AddStatMod( new StatMod( StatType.Int, modName + "Int", intBonus, TimeSpan.Zero ) );
                    }

                    if ( Parent is Mobile )
                        ((Mobile)Parent).CheckStatTimers();

                    break;
                }
                case 0:
                {
                    m_AosAttributes = new AosAttributes( this );
                    m_AosResistances = new AosElementAttributes( this );
                    m_AosSkillBonuses = new AosSkillBonuses( this );

                    break;
                }
            }

            if ( version < 2 )
            {
                m_Resource = CraftResource.Iron;
                m_GemType = GemType.None;
            }

            if( version < 4 )
                Hue = 0;

            if (!String.IsNullOrEmpty(m_Seal) && !Seals.Contains(m_Seal))
                Seals.Add(m_Seal);
        }
예제 #33
0
 public void SwapSpecialMaterial(WeaponQuality newMaterial)
 {
     specialMaterial = newMaterial;
     CalculateCost();
     CalculateName();
 }
예제 #34
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();
			SaveFlag flags = (SaveFlag)reader.ReadInt();

			switch ( version )
			{
				case 8:
				{
					// turnned off AOS attributes
					goto case 7;
				}
				case 7:
				{
					goto case 6;
				}
				case 6:
				{
					goto case 5;
				}
				case 5:
				{
					if ( GetSaveFlag( flags, SaveFlag.DamageLevel ) )
						m_DamageLevel = (WeaponDamageLevel)reader.ReadInt();

					if ( GetSaveFlag( flags, SaveFlag.AccuracyLevel ) )
						m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt();

					if ( GetSaveFlag( flags, SaveFlag.DurabilityLevel ) )
						m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt();

					if ( GetSaveFlag( flags, SaveFlag.Quality ) )
						m_Quality = (WeaponQuality)reader.ReadInt();
					else
						m_Quality = WeaponQuality.Regular;

					if ( GetSaveFlag( flags, SaveFlag.Hits ) )
						m_Hits = reader.ReadInt();

					if ( GetSaveFlag( flags, SaveFlag.MaxHits ) )
						m_MaxHits = reader.ReadInt();

					if ( GetSaveFlag( flags, SaveFlag.Slayer ) )
						m_Slayer = (SlayerName)reader.ReadInt();

					if ( GetSaveFlag( flags, SaveFlag.Poison ) )
						m_Poison = Poison.Deserialize( reader );

					if ( GetSaveFlag( flags, SaveFlag.PoisonCharges ) )
						m_PoisonCharges = reader.ReadInt();

					if ( GetSaveFlag( flags, SaveFlag.Crafter ) )
						m_Crafter = reader.ReadMobile();

					if ( GetSaveFlag( flags, SaveFlag.Identified ) )
						m_Identified = ( version >= 6 || reader.ReadBool() );

					if ( GetSaveFlag( flags, SaveFlag.StrReq ) )
						m_StrReq = reader.ReadInt();
					else
						m_StrReq = -1;

					if ( GetSaveFlag( flags, SaveFlag.DexReq ) )
						m_DexReq = reader.ReadInt();
					else
						m_DexReq = -1;

					if ( GetSaveFlag( flags, SaveFlag.IntReq ) )
						m_IntReq = reader.ReadInt();
					else
						m_IntReq = -1;

					if ( GetSaveFlag( flags, SaveFlag.MinDamage ) )
						m_MinDamage = reader.ReadInt();
					else
						m_MinDamage = -1;

					if ( GetSaveFlag( flags, SaveFlag.MaxDamage ) )
						m_MaxDamage = reader.ReadInt();
					else
						m_MaxDamage = -1;

					if ( GetSaveFlag( flags, SaveFlag.HitSound ) )
						m_HitSound = reader.ReadInt();
					else
						m_HitSound = -1;

					if ( GetSaveFlag( flags, SaveFlag.MissSound ) )
						m_MissSound = reader.ReadInt();
					else
						m_MissSound = -1;

					if ( GetSaveFlag( flags, SaveFlag.Speed ) )
						m_Speed = reader.ReadInt();
					else
						m_Speed = -1;

					if ( GetSaveFlag( flags, SaveFlag.MaxRange ) )
						m_MaxRange = reader.ReadInt();
					else
						m_MaxRange = -1;

					if ( GetSaveFlag( flags, SaveFlag.Skill ) )
						m_Skill = (SkillName)reader.ReadInt();
					else
						m_Skill = (SkillName)(-1);

					if ( GetSaveFlag( flags, SaveFlag.Type ) )
						m_Type = (WeaponType)reader.ReadInt();
					else
						m_Type = (WeaponType)(-1);

					if ( GetSaveFlag( flags, SaveFlag.Animation ) )
						m_Animation = (WeaponAnimation)reader.ReadInt();
					else
						m_Animation = (WeaponAnimation)(-1);

					if ( GetSaveFlag( flags, SaveFlag.Resource ) )
						m_Resource = (CraftResource)reader.ReadInt();
					else
						m_Resource = CraftResource.Iron;

					// obsolete from version 8 on
					if (version < 8)
					{
						AosAttributes dmy_AosAttributes;
						AosWeaponAttributes dmy_AosWeaponAttributes;

						if ( GetSaveFlag( flags, SaveFlag.xAttributes ) )
							dmy_AosAttributes = new AosAttributes( this, reader );
						//else
							//dmy_AosAttributes = new AosAttributes( this );

						if ( GetSaveFlag( flags, SaveFlag.xWeaponAttributes ) )
							dmy_AosWeaponAttributes = new AosWeaponAttributes( this, reader );
						//else
							//dmy_AosWeaponAttributes = new AosWeaponAttributes( this );
					}

					if ( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile )
					{
						m_SkillMod = new DefaultSkillMod( SkillName.Tactics, true, (int)m_AccuracyLevel * 5 );
						((Mobile)Parent).AddSkillMod( m_SkillMod );
					}

					/*if ( Core.AOS && m_AosWeaponAttributes.MageWeapon != 0 && Parent is Mobile )
					{
						m_MageMod = new DefaultSkillMod( SkillName.Magery, true, -m_AosWeaponAttributes.MageWeapon );
						((Mobile)Parent).AddSkillMod( m_MageMod );
					}*/

                    // erl: made obsolete by PlayerCrafted in version 9
            		//if (version < 9)
					//{
						//if ( GetSaveFlag( flags, SaveFlag.PlayerConstructed ) )
							//PlayerCrafted = true;
					//}

					break;
				}
				case 4:
				{
					m_Slayer = (SlayerName)reader.ReadInt();

					goto case 3;
				}
				case 3:
				{
					m_StrReq = reader.ReadInt();
					m_DexReq = reader.ReadInt();
					m_IntReq = reader.ReadInt();

					goto case 2;
				}
				case 2:
				{
					m_Identified = reader.ReadBool();

					goto case 1;
				}
				case 1:
				{
					m_MaxRange = reader.ReadInt();

					goto case 0;
				}
				case 0:
				{
					if ( version == 0 )
						m_MaxRange = 1; // default

					if ( version < 5 )
					{
						m_Resource = CraftResource.Iron;
						//m_AosAttributes = new AosAttributes( this );
						//m_AosWeaponAttributes = new AosWeaponAttributes( this );
					}

					m_MinDamage = reader.ReadInt();
					m_MaxDamage = reader.ReadInt();

					m_Speed = reader.ReadInt();

					m_HitSound = reader.ReadInt();
					m_MissSound = reader.ReadInt();

					m_Skill = (SkillName)reader.ReadInt();
					m_Type = (WeaponType)reader.ReadInt();
					m_Animation = (WeaponAnimation)reader.ReadInt();
					m_DamageLevel = (WeaponDamageLevel)reader.ReadInt();
					m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt();
					m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt();
					m_Quality = (WeaponQuality)reader.ReadInt();

					m_Crafter = reader.ReadMobile();

					m_Poison = Poison.Deserialize( reader );
					m_PoisonCharges = reader.ReadInt();

					if ( m_StrReq == OldStrengthReq )
						m_StrReq = -1;

					if ( m_DexReq == OldDexterityReq )
						m_DexReq = -1;

					if ( m_IntReq == OldIntelligenceReq )
						m_IntReq = -1;

					if ( m_MinDamage == OldMinDamage )
						m_MinDamage = -1;

					if ( m_MaxDamage == OldMaxDamage )
						m_MaxDamage = -1;

					if ( m_HitSound == OldHitSound )
						m_HitSound = -1;

					if ( m_MissSound == OldMissSound )
						m_MissSound = -1;

					if ( m_Speed == OldSpeed )
						m_Speed = -1;

					if ( m_MaxRange == OldMaxRange )
						m_MaxRange = -1;

					if ( m_Skill == OldSkill )
						m_Skill = (SkillName)(-1);

					if ( m_Type == OldType )
						m_Type = (WeaponType)(-1);

					if ( m_Animation == OldAnimation )
						m_Animation = (WeaponAnimation)(-1);

					if ( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile )
					{
						m_SkillMod = new DefaultSkillMod( SkillName.Tactics, true, (int)m_AccuracyLevel * 5);
						((Mobile)Parent).AddSkillMod( m_SkillMod );
					}

					break;
				}
			}
/*
			int strBonus = m_AosAttributes.BonusStr;
			int dexBonus = m_AosAttributes.BonusDex;
			int intBonus = m_AosAttributes.BonusInt;

			if ( this.Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0) )
			{
				Mobile m = (Mobile)this.Parent;

				string modName = this.Serial.ToString();

				if ( strBonus != 0 )
					m.AddStatMod( new StatMod( StatType.Str, modName + "Str", strBonus, TimeSpan.Zero ) );

				if ( dexBonus != 0 )
					m.AddStatMod( new StatMod( StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero ) );

				if ( intBonus != 0 )
					m.AddStatMod( new StatMod( StatType.Int, modName + "Int", intBonus, TimeSpan.Zero ) );
			}
*/
			if ( Parent is Mobile )
				((Mobile)Parent).CheckStatTimers();

			if ( m_Hits <= 0 && m_MaxHits <= 0 )
			{
				m_Hits = m_MaxHits = Utility.RandomMinMax( InitMinHits, InitMaxHits );
			}

			//if ( version < 6 )
				//PlayerCrafted = true; // we don't know, so, assume it's crafted
		}
예제 #35
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
                case 11:
                {
                    OriginalItemID = reader.ReadInt();
                    OriginalHue = reader.ReadInt();
                    OriginalAnimation = (WeaponAnimation)reader.ReadInt();
                        goto case 10;
                    }
                case 10:
                {
                    var flags2 = (SaveFlag2) reader.ReadInt();

                    if (GetSaveFlag(flags2, SaveFlag2.Aesthetic)) // Alan Mod
                    {
                        m_Aesthetic = true;
                    }

                    m_DiceDamage = new[] {-1, -1, -1};

                    if (GetSaveFlag(flags2, SaveFlag2.DiceDamage))
                    {
                        m_DiceDamage[0] = reader.ReadEncodedInt();
                        m_DiceDamage[1] = reader.ReadEncodedInt();
                        m_DiceDamage[2] = reader.ReadEncodedInt();
                    }

                    goto case 9;
                }
                case 9:
                case 8:
                case 7:
                case 6:
                case 5:
                {
                    var flags = (SaveFlag) reader.ReadInt();


                    if (GetSaveFlag(flags, SaveFlag.DamageLevel))
                    {
                        m_DamageLevel = (WeaponDamageLevel) reader.ReadInt();

                        if (m_DamageLevel > WeaponDamageLevel.Vanq)
                        {
                            m_DamageLevel = WeaponDamageLevel.Ruin;
                        }
                    }

                    if (GetSaveFlag(flags, SaveFlag.AccuracyLevel))
                    {
                        m_AccuracyLevel = (WeaponAccuracyLevel) reader.ReadInt();

                        if (m_AccuracyLevel > WeaponAccuracyLevel.Supremely)
                        {
                            m_AccuracyLevel = WeaponAccuracyLevel.Accurate;
                        }
                    }

                    if (GetSaveFlag(flags, SaveFlag.DurabilityLevel))
                    {
                        m_DurabilityLevel = (WeaponDurabilityLevel) reader.ReadInt();

                        if (m_DurabilityLevel > WeaponDurabilityLevel.Indestructible)
                        {
                            m_DurabilityLevel = WeaponDurabilityLevel.Durable;
                        }
                    }

                    if (GetSaveFlag(flags, SaveFlag.Quality))
                    {
                        m_Quality = (WeaponQuality) reader.ReadInt();
                    }
                    else
                    {
                        m_Quality = WeaponQuality.Regular;
                    }

                    if (GetSaveFlag(flags, SaveFlag.Hits))
                    {
                        m_Hits = reader.ReadInt();
                    }

                    if (GetSaveFlag(flags, SaveFlag.MaxHits))
                    {
                        m_MaxHits = reader.ReadInt();
                    }

                    if (GetSaveFlag(flags, SaveFlag.Slayer))
                    {
                        m_Slayer = (SlayerName) reader.ReadInt();
                    }

                    if (GetSaveFlag(flags, SaveFlag.Poison))
                    {
                        m_Poison = Poison.Deserialize(reader);
                    }

                    if (GetSaveFlag(flags, SaveFlag.PoisonCharges))
                    {
                        m_PoisonCharges = reader.ReadInt();
                    }

                    if (GetSaveFlag(flags, SaveFlag.Crafter))
                    {
                        m_Crafter = reader.ReadMobile();
                    }

                    if (GetSaveFlag(flags, SaveFlag.Identified))
                    {
                        m_Identified = (version >= 6 || reader.ReadBool());
                    }

                    if (GetSaveFlag(flags, SaveFlag.StrReq))
                    {
                        m_StrReq = reader.ReadInt();
                    }
                    else
                    {
                        m_StrReq = -1;
                    }

                    if (GetSaveFlag(flags, SaveFlag.DexReq))
                    {
                        m_DexReq = reader.ReadInt();
                    }
                    else
                    {
                        m_DexReq = -1;
                    }

                    if (GetSaveFlag(flags, SaveFlag.IntReq))
                    {
                        m_IntReq = reader.ReadInt();
                    }
                    else
                    {
                        m_IntReq = -1;
                    }

                    if (GetSaveFlag(flags, SaveFlag.MinDamage))
                    {
                        m_DamageMin = reader.ReadInt();
                    }
                    else
                    {
                        m_DamageMin = -1;
                    }

                    if (GetSaveFlag(flags, SaveFlag.MaxDamage))
                    {
                        m_DamageMax = reader.ReadInt();
                    }
                    else
                    {
                        m_DamageMax = -1;
                    }

                    if (GetSaveFlag(flags, SaveFlag.HitSound))
                    {
                        m_HitSound = reader.ReadInt();
                    }
                    else
                    {
                        m_HitSound = -1;
                    }

                    if (GetSaveFlag(flags, SaveFlag.MissSound))
                    {
                        m_MissSound = reader.ReadInt();
                    }
                    else
                    {
                        m_MissSound = -1;
                    }

                    if (GetSaveFlag(flags, SaveFlag.Speed))
                    {
                        if (version < 9)
                        {
                            m_Speed = reader.ReadInt();
                        }
                        else
                        {
                            m_Speed = reader.ReadFloat();
                        }
                    }
                    else
                    {
                        m_Speed = -1;
                    }

                    if (GetSaveFlag(flags, SaveFlag.MaxRange))
                    {
                        m_MaxRange = reader.ReadInt();
                    }
                    else
                    {
                        m_MaxRange = -1;
                    }

                    if (GetSaveFlag(flags, SaveFlag.Skill))
                    {
                        m_Skill = (SkillName) reader.ReadInt();
                    }
                    else
                    {
                        m_Skill = (SkillName) (-1);
                    }

                    if (GetSaveFlag(flags, SaveFlag.Type))
                    {
                        m_Type = (WeaponType) reader.ReadInt();
                    }
                    else
                    {
                        m_Type = (WeaponType) (-1);
                    }

                    if (GetSaveFlag(flags, SaveFlag.Animation))
                    {
                        m_Animation = (WeaponAnimation) reader.ReadInt();
                    }
                    else
                    {
                        m_Animation = (WeaponAnimation) (-1);
                    }

                    if (GetSaveFlag(flags, SaveFlag.Resource))
                    {
                        m_Resource = (CraftResource) reader.ReadInt();
                    }
                    else
                    {
                        m_Resource = CraftResource.Iron;
                    }

                    if (GetSaveFlag(flags, SaveFlag.xAttributes)) //obsolete
                    {
                        new AosAttributes(this, reader);
                    }
                    //else
                    //	m_AosAttributes = new AosAttributes( this );

                    if (GetSaveFlag(flags, SaveFlag.xWeaponAttributes)) //obsolete
                    {
                        new AosWeaponAttributes(this, reader);
                    }
                    //else
                    //	m_AosWeaponAttributes = new AosWeaponAttributes( this );

                    if (UseSkillMod && m_Identified && m_AccuracyLevel != WeaponAccuracyLevel.Regular &&
                        Parent is Mobile)
                    {
                        m_SkillMod = new DefaultSkillMod(AccuracySkill, true, (int) m_AccuracyLevel * 5);
                        ((Mobile) Parent).AddSkillMod(m_SkillMod);
                    }

                    //if ( version < 7 && m_AosWeaponAttributes.MageWeapon != 0 )
                    //	m_AosWeaponAttributes.MageWeapon = 30 - m_AosWeaponAttributes.MageWeapon;

                    if (GetSaveFlag(flags, SaveFlag.PlayerConstructed))
                    {
                        m_PlayerConstructed = true;
                    }

                    if (GetSaveFlag(flags, SaveFlag.SkillBonuses)) //obsolete
                    {
                        new AosSkillBonuses(this, reader);
                    }
                    //else
                    //	m_AosSkillBonuses = new AosSkillBonuses( this );

                    if (GetSaveFlag(flags, SaveFlag.Slayer2))
                    {
                        m_Slayer2 = (SlayerName) reader.ReadInt();
                    }

                    if (GetSaveFlag(flags, SaveFlag.ElementalDamages)) //obsolete
                    {
                        new AosElementAttributes(this, reader);
                    }
                    //else
                    //	m_AosElementDamages = new AosElementAttributes( this );

                    if (GetSaveFlag(flags, SaveFlag.EngravedText))
                    {
                        m_EngravedText = reader.ReadString();
                    }

                    if (version < 10)
                    {
                        m_DiceDamage = new[] {-1, -1, -1};
                    }

                    break;
                }
                case 4:
                {
                    m_Slayer = (SlayerName) reader.ReadInt();

                    goto case 3;
                }
                case 3:
                {
                    m_StrReq = reader.ReadInt();
                    m_DexReq = reader.ReadInt();
                    m_IntReq = reader.ReadInt();

                    goto case 2;
                }
                case 2:
                {
                    m_Identified = reader.ReadBool();

                    goto case 1;
                }
                case 1:
                {
                    m_MaxRange = reader.ReadInt();

                    goto case 0;
                }
                case 0:
                {
                    if (version == 0)
                    {
                        m_MaxRange = 1; // default
                    }

                    if (version < 5)
                    {
                        //m_Resource = CraftResource.Iron;
                        //m_AosAttributes = new AosAttributes( this );
                        //m_AosWeaponAttributes = new AosWeaponAttributes( this );
                        //m_AosElementDamages = new AosElementAttributes( this );
                        //m_AosSkillBonuses = new AosSkillBonuses( this );
                    }

                    m_DamageMin = reader.ReadInt();
                    m_DamageMax = reader.ReadInt();

                    m_Speed = reader.ReadInt();

                    m_HitSound = reader.ReadInt();
                    m_MissSound = reader.ReadInt();

                    m_Skill = (SkillName) reader.ReadInt();
                    m_Type = (WeaponType) reader.ReadInt();
                    m_Animation = (WeaponAnimation) reader.ReadInt();
                    m_DamageLevel = (WeaponDamageLevel) reader.ReadInt();
                    m_AccuracyLevel = (WeaponAccuracyLevel) reader.ReadInt();
                    m_DurabilityLevel = (WeaponDurabilityLevel) reader.ReadInt();
                    m_Quality = (WeaponQuality) reader.ReadInt();

                    m_Crafter = reader.ReadMobile();

                    m_Poison = Poison.Deserialize(reader);
                    m_PoisonCharges = reader.ReadInt();

                    if (m_StrReq == OldStrengthReq)
                    {
                        m_StrReq = -1;
                    }

                    if (m_DexReq == OldDexterityReq)
                    {
                        m_DexReq = -1;
                    }

                    if (m_IntReq == OldIntelligenceReq)
                    {
                        m_IntReq = -1;
                    }

                    if (m_DamageMin == NewMinDamage)
                    {
                        m_DamageMin = -1;
                    }

                    if (m_DamageMax == NewMaxDamage)
                    {
                        m_DamageMax = -1;
                    }

                    if (m_HitSound == OldHitSound)
                    {
                        m_HitSound = -1;
                    }

                    if (m_MissSound == OldMissSound)
                    {
                        m_MissSound = -1;
                    }

                    if (m_Speed == OldSpeed)
                    {
                        m_Speed = -1;
                    }

                    if (m_MaxRange == OldMaxRange)
                    {
                        m_MaxRange = -1;
                    }

                    if (m_Skill == OldSkill)
                    {
                        m_Skill = (SkillName) (-1);
                    }

                    if (m_Type == OldType)
                    {
                        m_Type = (WeaponType) (-1);
                    }

                    if (m_Animation == OldAnimation)
                    {
                        m_Animation = (WeaponAnimation) (-1);
                    }

                    if (UseSkillMod && m_Identified && m_AccuracyLevel != WeaponAccuracyLevel.Regular &&
                        Parent is Mobile)
                    {
                        m_SkillMod = new DefaultSkillMod(AccuracySkill, true, (int) m_AccuracyLevel * 5);
                        ((Mobile) Parent).AddSkillMod(m_SkillMod);
                    }

                    break;
                }
            }

            if (Parent is Mobile)
            {
                ((Mobile) Parent).CheckStatTimers();
            }

            if (m_Hits <= 0 && m_MaxHits <= 0)
            {
                m_Hits = m_MaxHits = Utility.RandomMinMax(InitMinHits, InitMaxHits);
            }

            if (version < 6)
            {
                m_PlayerConstructed = true; // we don't know, so, assume it's crafted
            }
        }
예제 #36
0
		public BaseWeapon( int itemID ) : base( itemID )
		{
			Layer = (Layer)ItemData.Quality;

			m_Quality = WeaponQuality.Regular;
			m_StrReq = -1;
			m_DexReq = -1;
			m_IntReq = -1;
			m_MinDamage = -1;
			m_MaxDamage = -1;
			m_HitSound = -1;
			m_MissSound = -1;
			m_Speed = -1;
			m_MaxRange = -1;
			m_Skill = (SkillName)(-1);
			m_Type = (WeaponType)(-1);
			m_Animation = (WeaponAnimation)(-1);

			m_Hits = m_MaxHits = Utility.RandomMinMax( InitMinHits, InitMaxHits );

			m_Resource = CraftResource.Iron;

			m_AosAttributes = new AosAttributes( this );
			m_AosWeaponAttributes = new AosWeaponAttributes( this );
			m_AosSkillBonuses = new AosSkillBonuses( this );
			m_AosElementDamages = new AosElementAttributes( this );

			#region GeNova: Mondain's Legacy
			m_SetAttributes = new AosAttributes( this );
			m_SetWeaponAttributes = new AosWeaponAttributes( this );
			m_SetSkillBonuses = new AosSkillBonuses( this );
			
			m_LastEquipped = false;
			#endregion
		}
예제 #37
0
        public virtual int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue)
        {
            Quality = (WeaponQuality)quality;

            if (makersMark) // Add to CraftItem.cs mark table
                Crafter = from;

            Type resourceType = typeRes;

            if (resourceType == null)
                resourceType = craftItem.Resources.GetAt(0).ItemType;

            if (!craftItem.ForceNonExceptional)
                Resource = CraftResources.GetFromType(resourceType);

            CraftContext context = craftSystem.GetContext(from);

            if (context != null && context.DoNotColor)
                Hue = 0;

            if (craftItem != null)
            {
                if (tool is BaseRunicTool)
                    ((BaseRunicTool)tool).ApplyAttributesTo(this);

                CraftResourceInfo resInfo = CraftResources.GetInfo(m_Resource);

                if (resInfo == null)
                    return quality;

                CraftAttributeInfo attrInfo = resInfo.AttributeInfo;

                if (attrInfo == null)
                    return quality;

                if (m_Resource != CraftResource.Heartwood)
                {
                    m_AosAttributes.WeaponDamage += attrInfo.WeaponDamage;
                    m_AosAttributes.WeaponSpeed += attrInfo.WeaponSwingSpeed;
                    m_AosAttributes.AttackChance += attrInfo.WeaponHitChance;
                    m_AosAttributes.RegenHits += attrInfo.WeaponRegenHits;
                }
                else
                {
                    switch (Utility.Random(6))
                    {
                        case 0: m_AosAttributes.WeaponDamage += attrInfo.WeaponDamage; break;
                        case 1: m_AosAttributes.WeaponSpeed += attrInfo.WeaponSwingSpeed; break;
                        case 2: m_AosAttributes.AttackChance += attrInfo.WeaponHitChance; break;
                        case 3: m_AosAttributes.Luck += attrInfo.WeaponLuck; break;
                    }
                }

                if ((m_Resource == CraftResource.Frostwood || m_Resource == CraftResource.Heartwood) && m_AosAttributes.SpellChanneling == 0)
                {
                    Attributes.SpellChanneling = 1;
                    Attributes.CastSpeed -= 1;
                }
            }

            return quality;
        }
예제 #38
0
 /// <summary>
 /// Create a new Landing Bay
 /// </summary>
 /// <param name="name">name of the landing bay</param>
 /// <param name="hulls">class fo ship that can mount this weapon</param>
 /// <param name="slots">locatiosn where this weapon can be mounted</param>
 /// <param name="power">power used by this weapon</param>
 /// <param name="space">space used by this method</param>
 /// <param name="sp">cost of this weapon</param>
 /// <param name="str">strength of the weapon</param>
 /// <param name="capacity">total ammo capacity of the torpedo tube</param>
 /// <param name="origin">rulebook containing this weapon</param>
 /// <param name="page">page this weapon can be found on</param>
 /// <param name="quality">quality of this weapon</param>
 /// <param name="wq">enum declaring which qualities to be adjusted</param>
 /// <param name="special">special rules of this weapon</param>
 public LandingBay(string name, HullType hulls, WeaponSlot slots, int power, int space, int sp, int str,
                   RuleBook origin, byte page, Quality quality = Quality.Common, WeaponQuality wq = WeaponQuality.None,
                   string special = null, ComponentOrigin comp = ComponentOrigin.Standard, Condition cond = Condition.Intact)
     : base(name, WeaponType.LandingBay, hulls, slots, power, space, sp, str, default(DiceRoll), 0, 0, origin, page, quality, wq, special, Quality.None, comp, cond)
 {
     Squadrons = new List <Squadron>(Strength * 3);
 }
예제 #39
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch (version)
			{
				case 1:
				{
					m_Crafter = reader.ReadMobile();
					m_Quality = (WeaponQuality)reader.ReadInt();
					m_Uses = reader.ReadInt();
					break;
				}
			}
		}
예제 #40
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch( version )
            {
                case 11:
                case 10:
                case 9:
                case 8:
                    {
                        if( version <= 9 )
                        {
                            reader.ReadMobile();
                            reader.ReadString();
                            reader.ReadMobile();
                        }

                        goto case 7;
                    }
                case 7:
                case 6:
                case 5:
                    {
                        SaveFlag flags = (SaveFlag)reader.ReadInt();

                        if( GetSaveFlag(flags, SaveFlag.DamageLevel) )
                        {
                            m_DamageLevel = (WeaponDamageLevel)reader.ReadInt();

                            if( m_DamageLevel > WeaponDamageLevel.Vanq )
                                m_DamageLevel = WeaponDamageLevel.Ruin;
                        }

                        if( GetSaveFlag(flags, SaveFlag.AccuracyLevel) )
                        {
                            m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt();

                            if( m_AccuracyLevel > WeaponAccuracyLevel.Supremely )
                                m_AccuracyLevel = WeaponAccuracyLevel.Accurate;
                        }

                        if( GetSaveFlag(flags, SaveFlag.DurabilityLevel) )
                        {
                            m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt();

                            if( m_DurabilityLevel > WeaponDurabilityLevel.Indestructible )
                                m_DurabilityLevel = WeaponDurabilityLevel.Durable;
                        }

                        if( GetSaveFlag(flags, SaveFlag.Quality) )
                            m_Quality = (WeaponQuality)reader.ReadInt();
                        else
                            m_Quality = WeaponQuality.Regular;

                        if( GetSaveFlag(flags, SaveFlag.Hits) )
                            m_Hits = reader.ReadInt();

                        if( GetSaveFlag(flags, SaveFlag.MaxHits) )
                            m_MaxHits = reader.ReadInt();

                        if( GetSaveFlag(flags, SaveFlag.Slayer) )
                            m_Slayer = (SlayerName)reader.ReadInt();

                        if( GetSaveFlag(flags, SaveFlag.Poison) )
                            m_Poison = Poison.Deserialize(reader);

                        if( GetSaveFlag(flags, SaveFlag.PoisonCharges) )
                            m_PoisonCharges = reader.ReadInt();

                        if( GetSaveFlag(flags, SaveFlag.Crafter) )
                            m_Crafter = reader.ReadMobile();

                        if( GetSaveFlag(flags, SaveFlag.Identified) )
                        {
                            if( version <= 10 )
                                m_Identified = true;
                            else
                                m_Identified = reader.ReadBool();
                        }

                        if( GetSaveFlag(flags, SaveFlag.StrReq) )
                            m_StrReq = reader.ReadInt();
                        else
                            m_StrReq = -1;

                        if( GetSaveFlag(flags, SaveFlag.DexReq) )
                            m_DexReq = reader.ReadInt();
                        else
                            m_DexReq = -1;

                        if( GetSaveFlag(flags, SaveFlag.IntReq) )
                            m_IntReq = reader.ReadInt();
                        else
                            m_IntReq = -1;

                        if( GetSaveFlag(flags, SaveFlag.MinDamage) )
                            m_MinDamage = reader.ReadInt();
                        else
                            m_MinDamage = -1;

                        if( GetSaveFlag(flags, SaveFlag.MaxDamage) )
                            m_MaxDamage = reader.ReadInt();
                        else
                            m_MaxDamage = -1;

                        if( GetSaveFlag(flags, SaveFlag.HitSound) )
                            m_HitSound = reader.ReadInt();
                        else
                            m_HitSound = -1;

                        if( GetSaveFlag(flags, SaveFlag.MissSound) )
                            m_MissSound = reader.ReadInt();
                        else
                            m_MissSound = -1;

                        if( GetSaveFlag(flags, SaveFlag.Speed) )
                        {
                            if( version < 9 )
                                m_Speed = reader.ReadInt();
                            else
                                m_Speed = reader.ReadFloat();
                        }
                        else
                            m_Speed = -1;

                        if( GetSaveFlag(flags, SaveFlag.MaxRange) )
                            m_MaxRange = reader.ReadInt();
                        else
                            m_MaxRange = -1;

                        if( GetSaveFlag(flags, SaveFlag.Skill) )
                            m_Skill = (SkillName)reader.ReadInt();
                        else
                            m_Skill = (SkillName)(-1);

                        if( GetSaveFlag(flags, SaveFlag.Type) )
                            m_Type = (WeaponType)reader.ReadInt();
                        else
                            m_Type = (WeaponType)(-1);

                        if( GetSaveFlag(flags, SaveFlag.Animation) )
                            m_Animation = (WeaponAnimation)reader.ReadInt();
                        else
                            m_Animation = (WeaponAnimation)(-1);

                        if( GetSaveFlag(flags, SaveFlag.Resource) )
                            m_Resource = (CraftResource)reader.ReadInt();
                        else
                            m_Resource = CraftResource.Iron;

                        if( GetSaveFlag(flags, SaveFlag.xAttributes) )
                            m_AosAttributes = new AosAttributes(this, reader);
                        else
                            m_AosAttributes = new AosAttributes(this);

                        if( GetSaveFlag(flags, SaveFlag.xWeaponAttributes) )
                            m_AosWeaponAttributes = new AosWeaponAttributes(this, reader);
                        else
                            m_AosWeaponAttributes = new AosWeaponAttributes(this);

                        if( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile )
                        {
                            m_SkillMod = new DefaultSkillMod(AccuracySkill, true, (int)m_AccuracyLevel * 5);
                            ((Mobile)Parent).AddSkillMod(m_SkillMod);
                        }

                        if( version < 7 && m_AosWeaponAttributes.MageWeapon != 0 )
                            m_AosWeaponAttributes.MageWeapon = 30 - m_AosWeaponAttributes.MageWeapon;

                        if( Core.SE && m_AosWeaponAttributes.MageWeapon != 0 && m_AosWeaponAttributes.MageWeapon != 30 && Parent is Mobile )
                        {
                            m_MageMod = new DefaultSkillMod(SkillName.Magery, true, -30 + m_AosWeaponAttributes.MageWeapon);
                            ((Mobile)Parent).AddSkillMod(m_MageMod);
                        }

                        if( GetSaveFlag(flags, SaveFlag.PlayerConstructed) )
                            m_PlayerConstructed = true;

                        if( GetSaveFlag(flags, SaveFlag.SkillBonuses) )
                            m_AosSkillBonuses = new AosSkillBonuses(this, reader);
                        else
                            m_AosSkillBonuses = new AosSkillBonuses(this);

                        if( GetSaveFlag(flags, SaveFlag.Slayer2) )
                            m_Slayer2 = (SlayerName)reader.ReadInt();

                        break;
                    }
                case 4:
                    {
                        m_Slayer = (SlayerName)reader.ReadInt();

                        goto case 3;
                    }
                case 3:
                    {
                        m_StrReq = reader.ReadInt();
                        m_DexReq = reader.ReadInt();
                        m_IntReq = reader.ReadInt();

                        goto case 2;
                    }
                case 2:
                    {
                        m_Identified = reader.ReadBool();

                        goto case 1;
                    }
                case 1:
                    {
                        m_MaxRange = reader.ReadInt();

                        goto case 0;
                    }
                case 0:
                    {
                        if( version == 0 )
                            m_MaxRange = 1; // default

                        if( version < 5 )
                        {
                            m_Resource = CraftResource.Iron;
                            m_AosAttributes = new AosAttributes(this);
                            m_AosWeaponAttributes = new AosWeaponAttributes(this);
                            m_AosSkillBonuses = new AosSkillBonuses(this);
                        }

                        m_MinDamage = reader.ReadInt();
                        m_MaxDamage = reader.ReadInt();

                        m_Speed = reader.ReadInt();

                        m_HitSound = reader.ReadInt();
                        m_MissSound = reader.ReadInt();

                        m_Skill = (SkillName)reader.ReadInt();
                        m_Type = (WeaponType)reader.ReadInt();
                        m_Animation = (WeaponAnimation)reader.ReadInt();
                        m_DamageLevel = (WeaponDamageLevel)reader.ReadInt();
                        m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt();
                        m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt();
                        m_Quality = (WeaponQuality)reader.ReadInt();

                        m_Crafter = reader.ReadMobile();

                        m_Poison = Poison.Deserialize(reader);
                        m_PoisonCharges = reader.ReadInt();

                        if( m_StrReq == OldStrengthReq )
                            m_StrReq = -1;

                        if( m_DexReq == OldDexterityReq )
                            m_DexReq = -1;

                        if( m_IntReq == OldIntelligenceReq )
                            m_IntReq = -1;

                        if( m_MinDamage == OldMinDamage )
                            m_MinDamage = -1;

                        if( m_MaxDamage == OldMaxDamage )
                            m_MaxDamage = -1;

                        if( m_HitSound == OldHitSound )
                            m_HitSound = -1;

                        if( m_MissSound == OldMissSound )
                            m_MissSound = -1;

                        if( m_Speed == OldSpeed )
                            m_Speed = -1;

                        if( m_MaxRange == OldMaxRange )
                            m_MaxRange = -1;

                        if( m_Skill == OldSkill )
                            m_Skill = (SkillName)(-1);

                        if( m_Type == OldType )
                            m_Type = (WeaponType)(-1);

                        if( m_Animation == OldAnimation )
                            m_Animation = (WeaponAnimation)(-1);

                        if( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile )
                        {
                            m_SkillMod = new DefaultSkillMod(AccuracySkill, true, (int)m_AccuracyLevel * 5);
                            ((Mobile)Parent).AddSkillMod(m_SkillMod);
                        }

                        break;
                    }
            }

            if( Core.AOS && Parent is Mobile )
                m_AosSkillBonuses.AddTo((Mobile)Parent);

            int strBonus = m_AosAttributes.BonusStr;
            int dexBonus = m_AosAttributes.BonusDex;
            int intBonus = m_AosAttributes.BonusInt;

            if( this.Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0) )
            {
                Mobile m = (Mobile)this.Parent;

                string modName = this.Serial.ToString();

                if( strBonus != 0 )
                    m.AddStatMod(new StatMod(StatType.Str, modName + "Str", strBonus, TimeSpan.Zero));

                if( dexBonus != 0 )
                    m.AddStatMod(new StatMod(StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero));

                if( intBonus != 0 )
                    m.AddStatMod(new StatMod(StatType.Int, modName + "Int", intBonus, TimeSpan.Zero));
            }

            if( Parent is Mobile )
                ((Mobile)Parent).CheckStatTimers();

            if( m_Hits <= 0 && m_MaxHits <= 0 )
            {
                m_Hits = m_MaxHits = Utility.RandomMinMax(InitMinHits, InitMaxHits);
            }

            if( version < 6 )
                m_PlayerConstructed = true; // we don't know, so, assume it's crafted
        }
예제 #41
0
 public void SwapSpecialAbility(int oldAbilityIndex, WeaponQuality newSpecialAbility)
 {
     specialAbilities[oldAbilityIndex] = newSpecialAbility;
     CalculateCost();
     CalculateName();
 }
예제 #42
0
        public BaseWeapon(int itemID)
            : base(itemID)
        {
            Layer = (Layer) ItemData.Quality;

            m_Quality = WeaponQuality.Regular;
            m_StrReq = -1;
            m_DexReq = -1;
            m_IntReq = -1;
            m_DamageMin = -1;
            m_DamageMax = -1;
            m_HitSound = -1;
            m_MissSound = -1;
            m_Speed = -1;
            m_MaxRange = -1;
            m_Skill = (SkillName) (-1);
            m_Type = (WeaponType) (-1);
            m_Animation = (WeaponAnimation) (-1);

            m_DiceDamage = new[] {-1, -1, -1};

            m_Hits = m_MaxHits = Utility.RandomMinMax(InitMinHits, InitMaxHits);

            m_Resource = CraftResource.Iron;
        }
예제 #43
0
 public NovaCannon(String name, HullType hulls, int power, int space, int sp,
                   int range, RuleBook origin, byte page, string damage = null, string special = null, Quality quality    = Quality.Common,
                   WeaponQuality wq = WeaponQuality.None, ComponentOrigin comp = ComponentOrigin.Standard, Condition cond = Condition.Intact, int ammo = 0)
     : this(name, hulls, power, space, sp, new DiceRoll(damage), range, origin, page, special, quality, wq, comp, cond, ammo)
 {
 }
예제 #44
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
			{
				case 9:
				case 8:
				case 7:
				case 6:
				case 5:
				{
					SaveFlag flags = (SaveFlag)reader.ReadInt();

					if ( GetSaveFlag( flags, SaveFlag.DamageLevel ) )
					{
						m_DamageLevel = (WeaponDamageLevel)reader.ReadInt();

						if ( m_DamageLevel > WeaponDamageLevel.Vanq )
							m_DamageLevel = WeaponDamageLevel.Ruin;
					}

					if ( GetSaveFlag( flags, SaveFlag.AccuracyLevel ) )
					{
						m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt();

						if ( m_AccuracyLevel > WeaponAccuracyLevel.Supremely )
							m_AccuracyLevel = WeaponAccuracyLevel.Accurate;
					}

					if ( GetSaveFlag( flags, SaveFlag.DurabilityLevel ) )
					{
						m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt();

						if ( m_DurabilityLevel > WeaponDurabilityLevel.Indestructible )
							m_DurabilityLevel = WeaponDurabilityLevel.Durable;
					}

					if ( GetSaveFlag( flags, SaveFlag.Quality ) )
						m_Quality = (WeaponQuality)reader.ReadInt();
					else
						m_Quality = WeaponQuality.Regular;

					if ( GetSaveFlag( flags, SaveFlag.Hits ) )
						m_Hits = reader.ReadInt();

					if ( GetSaveFlag( flags, SaveFlag.MaxHits ) )
						m_MaxHits = reader.ReadInt();

					if ( GetSaveFlag( flags, SaveFlag.Slayer ) )
						m_Slayer = (SlayerName)reader.ReadInt();

					if ( GetSaveFlag( flags, SaveFlag.Poison ) )
						m_Poison = Poison.Deserialize( reader );

					if ( GetSaveFlag( flags, SaveFlag.PoisonCharges ) )
						m_PoisonCharges = reader.ReadInt();

					if ( GetSaveFlag( flags, SaveFlag.Crafter ) )
						m_Crafter = reader.ReadMobile();

					if ( GetSaveFlag( flags, SaveFlag.Identified ) )
						m_Identified = ( version >= 6 || reader.ReadBool() );

					if ( GetSaveFlag( flags, SaveFlag.StrReq ) )
						m_StrReq = reader.ReadInt();
					else
						m_StrReq = -1;

					if ( GetSaveFlag( flags, SaveFlag.DexReq ) )
						m_DexReq = reader.ReadInt();
					else
						m_DexReq = -1;

					if ( GetSaveFlag( flags, SaveFlag.IntReq ) )
						m_IntReq = reader.ReadInt();
					else
						m_IntReq = -1;

					if ( GetSaveFlag( flags, SaveFlag.MinDamage ) )
						m_MinDamage = reader.ReadInt();
					else
						m_MinDamage = -1;

					if ( GetSaveFlag( flags, SaveFlag.MaxDamage ) )
						m_MaxDamage = reader.ReadInt();
					else
						m_MaxDamage = -1;

					if ( GetSaveFlag( flags, SaveFlag.HitSound ) )
						m_HitSound = reader.ReadInt();
					else
						m_HitSound = -1;

					if ( GetSaveFlag( flags, SaveFlag.MissSound ) )
						m_MissSound = reader.ReadInt();
					else
						m_MissSound = -1;

					if ( GetSaveFlag( flags, SaveFlag.Speed ) )
					{
						if ( version < 9 )
							m_Speed = reader.ReadInt();
						else
							m_Speed = reader.ReadFloat();
					}
					else
						m_Speed = -1;

					if ( GetSaveFlag( flags, SaveFlag.MaxRange ) )
						m_MaxRange = reader.ReadInt();
					else
						m_MaxRange = -1;

					if ( GetSaveFlag( flags, SaveFlag.Skill ) )
						m_Skill = (SkillName)reader.ReadInt();
					else
						m_Skill = (SkillName)(-1);

					if ( GetSaveFlag( flags, SaveFlag.Type ) )
						m_Type = (WeaponType)reader.ReadInt();
					else
						m_Type = (WeaponType)(-1);

					if ( GetSaveFlag( flags, SaveFlag.Animation ) )
						m_Animation = (WeaponAnimation)reader.ReadInt();
					else
						m_Animation = (WeaponAnimation)(-1);

					if ( GetSaveFlag( flags, SaveFlag.Resource ) )
						m_Resource = (CraftResource)reader.ReadInt();
					else
						m_Resource = CraftResource.Iron;

					if ( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile )
					{
						m_SkillMod = new DefaultSkillMod( AccuracySkill, true, (int)m_AccuracyLevel * 5 );
						((Mobile)Parent).AddSkillMod( m_SkillMod );
					}

					if ( GetSaveFlag( flags, SaveFlag.PlayerConstructed ) )
						m_PlayerConstructed = true;

					if( GetSaveFlag( flags, SaveFlag.Slayer2 ) )
						m_Slayer2 = (SlayerName)reader.ReadInt();

					if( GetSaveFlag( flags, SaveFlag.EngravedText ) )
						m_EngravedText = reader.ReadString();

					break;
				}
				case 4:
				{
					m_Slayer = (SlayerName)reader.ReadInt();

					goto case 3;
				}
				case 3:
				{
					m_StrReq = reader.ReadInt();
					m_DexReq = reader.ReadInt();
					m_IntReq = reader.ReadInt();

					goto case 2;
				}
				case 2:
				{
					m_Identified = reader.ReadBool();

					goto case 1;
				}
				case 1:
				{
					m_MaxRange = reader.ReadInt();

					goto case 0;
				}
				case 0:
				{
					if ( version == 0 )
						m_MaxRange = 1; // default

					if ( version < 5 )
					{
						m_Resource = CraftResource.Iron;
					}

					m_MinDamage = reader.ReadInt();
					m_MaxDamage = reader.ReadInt();

					m_Speed = reader.ReadInt();

					m_HitSound = reader.ReadInt();
					m_MissSound = reader.ReadInt();

					m_Skill = (SkillName)reader.ReadInt();
					m_Type = (WeaponType)reader.ReadInt();
					m_Animation = (WeaponAnimation)reader.ReadInt();
					m_DamageLevel = (WeaponDamageLevel)reader.ReadInt();
					m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt();
					m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt();
					m_Quality = (WeaponQuality)reader.ReadInt();

					m_Crafter = reader.ReadMobile();

					m_Poison = Poison.Deserialize( reader );
					m_PoisonCharges = reader.ReadInt();

					if ( m_StrReq == OldStrengthReq )
						m_StrReq = -1;

					if ( m_DexReq == OldDexterityReq )
						m_DexReq = -1;

					if ( m_IntReq == OldIntelligenceReq )
						m_IntReq = -1;

					if ( m_MinDamage == OldMinDamage )
						m_MinDamage = -1;

					if ( m_MaxDamage == OldMaxDamage )
						m_MaxDamage = -1;

					if ( m_HitSound == OldHitSound )
						m_HitSound = -1;

					if ( m_MissSound == OldMissSound )
						m_MissSound = -1;

					if ( m_Speed == OldSpeed )
						m_Speed = -1;

					if ( m_MaxRange == OldMaxRange )
						m_MaxRange = -1;

					if ( m_Skill == OldSkill )
						m_Skill = (SkillName)(-1);

					if ( m_Type == OldType )
						m_Type = (WeaponType)(-1);

					if ( m_Animation == OldAnimation )
						m_Animation = (WeaponAnimation)(-1);

					if ( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile )
					{
						m_SkillMod = new DefaultSkillMod( AccuracySkill, true, (int)m_AccuracyLevel * 5);
						((Mobile)Parent).AddSkillMod( m_SkillMod );
					}

					break;
				}
			}

			if ( Parent is Mobile )
				((Mobile)Parent).CheckStatTimers();

			if ( m_Hits <= 0 && m_MaxHits <= 0 )
			{
				m_Hits = m_MaxHits = Utility.RandomMinMax( InitMinHits, InitMaxHits );
			}

			if ( version < 6 )
				m_PlayerConstructed = true; // we don't know, so, assume it's crafted
		}
예제 #45
0
 private void QualityChoice_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (QualityChoice.SelectedItem != null)
         CurrentQuality = (Quality)QualityChoice.SelectedItem;
     //QualityChoice.Text = CurrentQuality + " Quality";
     if (CurrentQuality == Quality.Common)//If moving to Common (nothing set)
         SpaceCheck.IsChecked = StrengthCheck.IsChecked = DamageCheck.IsChecked = RangeCheck.IsChecked = CritCheck.IsChecked = false;//uncheck all for common
     else if (CurrentQuality == Quality.Good)//If Good(Less can be set than poor or best)
         StrengthCheck.IsChecked = CritCheck.IsChecked = false;//uncheck disallowed options for good quality
     if ((Type == WeaponType.LandingBay || Type == WeaponType.TorpedoTube))
     {
         SpaceCheck.IsChecked = CurrentQuality != Quality.Common;
         CurrentWQ = WeaponQuality.Space;
         if (CurrentQuality == Quality.Poor || CurrentQuality == Quality.Best)
         {
             StrengthCheck.IsChecked = true;//Only two options available so auto check them
             CurrentWQ |= WeaponQuality.Strength;
         }
         SpaceCheck.IsEnabled = StrengthCheck.IsEnabled = DamageCheck.IsEnabled = RangeCheck.IsEnabled = CritCheck.IsEnabled = false;//disable all sinc there is only one valid permutation
         SetValues();
     }
     else
         CheckEnables();
 }
예제 #46
0
 private void SetCurrent(Weapon weapon, Quality quality = Quality.None, WeaponQuality wq = WeaponQuality.None)
 {
     if (weapon == null)
         Current = null;
     else if (weapon is NovaCannon)
         Current = new NovaCannon(weapon.Name, weapon.HullTypes, weapon.RawPower, weapon.RawSpace, weapon.RawSP, weapon.RawDamage, weapon.RawRange, weapon.Origin, weapon.PageNumber, weapon.RawSpecial,
             quality, wq, weapon.ComponentOrigin, weapon.Condition, ((NovaCannon)weapon).Ammo);
     else if (weapon is LandingBay)
         Current = new LandingBay(weapon.Name, weapon.HullTypes, weapon.Slots, weapon.RawPower, weapon.RawSpace, weapon.RawSP, weapon.RawStrength, weapon.Origin, weapon.PageNumber, quality, wq,
             weapon.RawSpecial, weapon.ComponentOrigin, weapon.Condition);
     else if (weapon is TorpedoTubes)
         Current = new TorpedoTubes(weapon.Name, weapon.HullTypes, weapon.RawPower, weapon.RawSpace, weapon.RawSP, weapon.RawStrength, ((TorpedoTubes)weapon).Capacity, weapon.Origin, weapon.PageNumber,
             quality, wq, weapon.RawSpecial, weapon.ComponentOrigin, weapon.Condition);
     else
         Current = new Weapon(weapon.Name, weapon.Type, weapon.HullTypes, weapon.Slots, weapon.RawPower, weapon.RawSpace, weapon.RawSP, weapon.RawStrength, weapon.RawDamage, weapon.RawCrit, weapon.RawRange,
         weapon.Origin, weapon.PageNumber, quality, wq, weapon.RawSpecial, Quality.None, weapon.ComponentOrigin, weapon.Condition);
     UpdateCurrent();
 }
예제 #47
0
 public void SwapEnhancement(WeaponQuality newEnhancement)
 {
     enhancementBonus = newEnhancement;
     CalculateCost();
     CalculateName();
 }
예제 #48
0
 /// <summary>
 /// Create a new Torpedo Tube
 /// </summary>
 /// <param name="name">name of the torpedo tube</param>
 /// <param name="hulls">class of ship that can mount this weapon</param>
 /// <param name="slots">locatiosn where this weapon can be mounted</param>
 /// <param name="power">power used by this weapon</param>
 /// <param name="space">space used by this method</param>
 /// <param name="sp">cost of this weapon</param>
 /// <param name="str">strength of the weapon</param>
 /// <param name="capacity">total ammo capacity of the torpedo tube</param>
 /// <param name="origin">rulebook containing this weapon</param>
 /// <param name="page">page this weapon can be found on</param>
 /// <param name="quality">quality of this weapon</param>
 /// <param name="wq">enum declaring which qualities to be adjusted</param>
 /// <param name="special">special rules of this weapon</param>
 public TorpedoTubes(string name, HullType hulls, int power, int space, int sp, int str,
                     int capacity, RuleBook origin, byte page, Quality quality = Quality.Common, WeaponQuality wq = WeaponQuality.None,
                     string special = null, ComponentOrigin comp = ComponentOrigin.Standard, Condition cond = Condition.Intact)
     : base(name, WeaponType.TorpedoTube, hulls, WeaponSlot.Prow | WeaponSlot.Keel, power, space, sp, str, default(DiceRoll), 0, 0, origin, page,
            quality, wq, special, Quality.None, comp, cond)
 {
     this.Capacity = capacity;
     Ammo          = new List <Torpedo>(Capacity);
     Tubes         = new Torpedo[Strength];
 }
예제 #49
0
        public BaseWeapon( int itemID )
            : base(itemID)
        {
            Layer = (Layer)ItemData.Quality;

            m_Quality = WeaponQuality.Regular;
            m_StrReq = -1;
            m_DexReq = -1;
            m_IntReq = -1;
            m_MinDamage = -1;
            m_MaxDamage = -1;
            m_HitSound = -1;
            m_MissSound = -1;
            m_Speed = -1;
            m_MaxRange = -1;
            m_Skill = (SkillName)(-1);
            m_Type = (WeaponType)(-1);
            m_Animation = (WeaponAnimation)(-1);

            m_Hits = m_MaxHits = Utility.RandomMinMax( InitMinHits, InitMaxHits );

            m_Components = new List<Item>();

            m_AosAttributes = new AosAttributes( this );
            m_AosWeaponAttributes = new AosWeaponAttributes( this );
            m_AosSkillBonuses = new AosSkillBonuses( this );
            m_AosElementDamages = new AosElementAttributes( this );

            if( this is BaseRanged || this is AzhuranBoomerang ||
                this is DruidStaff || this is ProphetDiviningRod || this is ClericCrook ||
                this is QuarterStaff || this is GnarledStaff || this is SpikedClub || this is Club ||
                this is BlackStaff )
                this.Resource = CraftResource.Oak;

            else
            {
                this.Resource = CraftResource.Copper;
                this.Hue = 2413;
            }

            if( this is IBoneArmour )
                this.Hue = 0;
        }
예제 #50
0
		public override void Deserialize(GenericReader reader)
		{
			base.Deserialize(reader);

			int version = reader.ReadInt();

			switch (version)
			{
                case 12:
                    {
                        #region Runic Reforging
                        m_ReforgedPrefix = (ReforgedPrefix)reader.ReadInt();
                        m_ReforgedSuffix = (ReforgedSuffix)reader.ReadInt();
                        m_ItemPower = (ItemPower)reader.ReadInt();
                        m_BlockRepair = reader.ReadBool();
                        #endregion

                        #region Stygian Abyss
                        m_DImodded = reader.ReadBool();
                        m_SearingWeapon = reader.ReadBool();
                        goto case 11;
                    }
				case 11:
					{
						m_TimesImbued = reader.ReadInt();
                        #endregion

                        goto case 10;
					}
				case 10:
					{
						m_BlessedBy = reader.ReadMobile();
						m_EngravedText = reader.ReadString();
						m_Slayer3 = (TalismanSlayerName)reader.ReadInt();

						SetFlag flags = (SetFlag)reader.ReadEncodedInt();

						if (GetSaveFlag(flags, SetFlag.Attributes))
						{
							m_SetAttributes = new AosAttributes(this, reader);
						}
						else
						{
							m_SetAttributes = new AosAttributes(this);
						}

						if (GetSaveFlag(flags, SetFlag.WeaponAttributes))
						{
							m_SetSelfRepair = (new AosWeaponAttributes(this, reader)).SelfRepair;
						}

						if (GetSaveFlag(flags, SetFlag.SkillBonuses))
						{
							m_SetSkillBonuses = new AosSkillBonuses(this, reader);
						}
						else
						{
							m_SetSkillBonuses = new AosSkillBonuses(this);
						}

						if (GetSaveFlag(flags, SetFlag.Hue))
						{
							m_SetHue = reader.ReadInt();
						}

						if (GetSaveFlag(flags, SetFlag.LastEquipped))
						{
							m_LastEquipped = reader.ReadBool();
						}

						if (GetSaveFlag(flags, SetFlag.SetEquipped))
						{
							m_SetEquipped = reader.ReadBool();
						}

						if (GetSaveFlag(flags, SetFlag.SetSelfRepair))
						{
							m_SetSelfRepair = reader.ReadEncodedInt();
						}

						goto case 5;
					}
				case 9:
				case 8:
				case 7:
				case 6:
				case 5:
					{
						SaveFlag flags = (SaveFlag)reader.ReadInt();

						if (GetSaveFlag(flags, SaveFlag.DamageLevel))
						{
							m_DamageLevel = (WeaponDamageLevel)reader.ReadInt();

							if (m_DamageLevel > WeaponDamageLevel.Vanq)
							{
								m_DamageLevel = WeaponDamageLevel.Ruin;
							}
						}

						if (GetSaveFlag(flags, SaveFlag.AccuracyLevel))
						{
							m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt();

							if (m_AccuracyLevel > WeaponAccuracyLevel.Supremely)
							{
								m_AccuracyLevel = WeaponAccuracyLevel.Accurate;
							}
						}

						if (GetSaveFlag(flags, SaveFlag.DurabilityLevel))
						{
							m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt();

							if (m_DurabilityLevel > WeaponDurabilityLevel.Indestructible)
							{
								m_DurabilityLevel = WeaponDurabilityLevel.Durable;
							}
						}

						if (GetSaveFlag(flags, SaveFlag.Quality))
						{
							m_Quality = (WeaponQuality)reader.ReadInt();
						}
						else
						{
							m_Quality = WeaponQuality.Regular;
						}

						if (GetSaveFlag(flags, SaveFlag.Hits))
						{
							m_Hits = reader.ReadInt();
						}

						if (GetSaveFlag(flags, SaveFlag.MaxHits))
						{
							m_MaxHits = reader.ReadInt();
						}

						if (GetSaveFlag(flags, SaveFlag.Slayer))
						{
							m_Slayer = (SlayerName)reader.ReadInt();
						}

						if (GetSaveFlag(flags, SaveFlag.Poison))
						{
							m_Poison = Poison.Deserialize(reader);
						}

						if (GetSaveFlag(flags, SaveFlag.PoisonCharges))
						{
							m_PoisonCharges = reader.ReadInt();
						}

						if (GetSaveFlag(flags, SaveFlag.Crafter))
						{
							m_Crafter = reader.ReadMobile();
						}

						if (GetSaveFlag(flags, SaveFlag.Identified))
						{
							m_Identified = (version >= 6 || reader.ReadBool());
						}

						if (GetSaveFlag(flags, SaveFlag.StrReq))
						{
							m_StrReq = reader.ReadInt();
						}
						else
						{
							m_StrReq = -1;
						}

						if (GetSaveFlag(flags, SaveFlag.DexReq))
						{
							m_DexReq = reader.ReadInt();
						}
						else
						{
							m_DexReq = -1;
						}

						if (GetSaveFlag(flags, SaveFlag.IntReq))
						{
							m_IntReq = reader.ReadInt();
						}
						else
						{
							m_IntReq = -1;
						}

						if (GetSaveFlag(flags, SaveFlag.MinDamage))
						{
							m_MinDamage = reader.ReadInt();
						}
						else
						{
							m_MinDamage = -1;
						}

						if (GetSaveFlag(flags, SaveFlag.MaxDamage))
						{
							m_MaxDamage = reader.ReadInt();
						}
						else
						{
							m_MaxDamage = -1;
						}

						if (GetSaveFlag(flags, SaveFlag.HitSound))
						{
							m_HitSound = reader.ReadInt();
						}
						else
						{
							m_HitSound = -1;
						}

						if (GetSaveFlag(flags, SaveFlag.MissSound))
						{
							m_MissSound = reader.ReadInt();
						}
						else
						{
							m_MissSound = -1;
						}

						if (GetSaveFlag(flags, SaveFlag.Speed))
						{
							if (version < 9)
							{
								m_Speed = reader.ReadInt();
							}
							else
							{
								m_Speed = reader.ReadFloat();
							}
						}
						else
						{
							m_Speed = -1;
						}

						if (GetSaveFlag(flags, SaveFlag.MaxRange))
						{
							m_MaxRange = reader.ReadInt();
						}
						else
						{
							m_MaxRange = -1;
						}

						if (GetSaveFlag(flags, SaveFlag.Skill))
						{
							m_Skill = (SkillName)reader.ReadInt();
						}
						else
						{
							m_Skill = (SkillName)(-1);
						}

						if (GetSaveFlag(flags, SaveFlag.Type))
						{
							m_Type = (WeaponType)reader.ReadInt();
						}
						else
						{
							m_Type = (WeaponType)(-1);
						}

						if (GetSaveFlag(flags, SaveFlag.Animation))
						{
							m_Animation = (WeaponAnimation)reader.ReadInt();
						}
						else
						{
							m_Animation = (WeaponAnimation)(-1);
						}

						if (GetSaveFlag(flags, SaveFlag.Resource))
						{
							m_Resource = (CraftResource)reader.ReadInt();
						}
						else
						{
							m_Resource = CraftResource.Iron;
						}

						if (GetSaveFlag(flags, SaveFlag.xAttributes))
						{
							m_AosAttributes = new AosAttributes(this, reader);
						}
						else
						{
							m_AosAttributes = new AosAttributes(this);
						}

						if (GetSaveFlag(flags, SaveFlag.xWeaponAttributes))
						{
							m_AosWeaponAttributes = new AosWeaponAttributes(this, reader);
						}
						else
						{
							m_AosWeaponAttributes = new AosWeaponAttributes(this);
						}

						if (UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile)
						{
							m_SkillMod = new DefaultSkillMod(AccuracySkill, true, (int)m_AccuracyLevel * 5);
							((Mobile)Parent).AddSkillMod(m_SkillMod);
						}

						if (version < 7 && m_AosWeaponAttributes.MageWeapon != 0)
						{
							m_AosWeaponAttributes.MageWeapon = 30 - m_AosWeaponAttributes.MageWeapon;
						}

						if (Core.AOS && m_AosWeaponAttributes.MageWeapon != 0 && m_AosWeaponAttributes.MageWeapon != 30 &&
							Parent is Mobile)
						{
							m_MageMod = new DefaultSkillMod(SkillName.Magery, true, -30 + m_AosWeaponAttributes.MageWeapon);
							((Mobile)Parent).AddSkillMod(m_MageMod);
						}

						if (GetSaveFlag(flags, SaveFlag.PlayerConstructed))
						{
							m_PlayerConstructed = true;
						}

						if (GetSaveFlag(flags, SaveFlag.SkillBonuses))
						{
							m_AosSkillBonuses = new AosSkillBonuses(this, reader);
						}
						else
						{
							m_AosSkillBonuses = new AosSkillBonuses(this);
						}

						if (GetSaveFlag(flags, SaveFlag.Slayer2))
						{
							m_Slayer2 = (SlayerName)reader.ReadInt();
						}

						if (GetSaveFlag(flags, SaveFlag.ElementalDamages))
						{
							m_AosElementDamages = new AosElementAttributes(this, reader);
						}
						else
						{
							m_AosElementDamages = new AosElementAttributes(this);
						}

						if (GetSaveFlag(flags, SaveFlag.EngravedText))
						{
							m_EngravedText = reader.ReadString();
						}

						#region Stygian Abyss
						if (version > 9 && GetSaveFlag(flags, SaveFlag.xAbsorptionAttributes))
						{
							m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this, reader);
						}
						else
						{
							m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this);
						}
						#endregion

						break;
					}
				case 4:
					{
						m_Slayer = (SlayerName)reader.ReadInt();

						goto case 3;
					}
				case 3:
					{
						m_StrReq = reader.ReadInt();
						m_DexReq = reader.ReadInt();
						m_IntReq = reader.ReadInt();

						goto case 2;
					}
				case 2:
					{
						m_Identified = reader.ReadBool();

						goto case 1;
					}
				case 1:
					{
						m_MaxRange = reader.ReadInt();

						goto case 0;
					}
				case 0:
					{
						if (version == 0)
						{
							m_MaxRange = 1; // default
						}

						if (version < 5)
						{
							m_Resource = CraftResource.Iron;
							m_AosAttributes = new AosAttributes(this);
							m_AosWeaponAttributes = new AosWeaponAttributes(this);
							m_AosElementDamages = new AosElementAttributes(this);
							m_AosSkillBonuses = new AosSkillBonuses(this);
						}

						m_MinDamage = reader.ReadInt();
						m_MaxDamage = reader.ReadInt();

						m_Speed = reader.ReadInt();

						m_HitSound = reader.ReadInt();
						m_MissSound = reader.ReadInt();

						m_Skill = (SkillName)reader.ReadInt();
						m_Type = (WeaponType)reader.ReadInt();
						m_Animation = (WeaponAnimation)reader.ReadInt();
						m_DamageLevel = (WeaponDamageLevel)reader.ReadInt();
						m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt();
						m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt();
						m_Quality = (WeaponQuality)reader.ReadInt();

						m_Crafter = reader.ReadMobile();

						m_Poison = Poison.Deserialize(reader);
						m_PoisonCharges = reader.ReadInt();

						if (m_StrReq == OldStrengthReq)
						{
							m_StrReq = -1;
						}

						if (m_DexReq == OldDexterityReq)
						{
							m_DexReq = -1;
						}

						if (m_IntReq == OldIntelligenceReq)
						{
							m_IntReq = -1;
						}

						if (m_MinDamage == OldMinDamage)
						{
							m_MinDamage = -1;
						}

						if (m_MaxDamage == OldMaxDamage)
						{
							m_MaxDamage = -1;
						}

						if (m_HitSound == OldHitSound)
						{
							m_HitSound = -1;
						}

						if (m_MissSound == OldMissSound)
						{
							m_MissSound = -1;
						}

						if (m_Speed == OldSpeed)
						{
							m_Speed = -1;
						}

						if (m_MaxRange == OldMaxRange)
						{
							m_MaxRange = -1;
						}

						if (m_Skill == OldSkill)
						{
							m_Skill = (SkillName)(-1);
						}

						if (m_Type == OldType)
						{
							m_Type = (WeaponType)(-1);
						}

						if (m_Animation == OldAnimation)
						{
							m_Animation = (WeaponAnimation)(-1);
						}

						if (UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile)
						{
							m_SkillMod = new DefaultSkillMod(AccuracySkill, true, (int)m_AccuracyLevel * 5);
							((Mobile)Parent).AddSkillMod(m_SkillMod);
						}

						break;
					}
			}

			#region Mondain's Legacy Sets
			if (m_SetAttributes == null)
			{
				m_SetAttributes = new AosAttributes(this);
			}

			if (m_SetSkillBonuses == null)
			{
				m_SetSkillBonuses = new AosSkillBonuses(this);
			}
			#endregion

			if (Core.AOS && Parent is Mobile)
			{
				m_AosSkillBonuses.AddTo((Mobile)Parent);
			}

			int strBonus = m_AosAttributes.BonusStr;
			int dexBonus = m_AosAttributes.BonusDex;
			int intBonus = m_AosAttributes.BonusInt;

			if (Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0))
			{
				Mobile m = (Mobile)Parent;

				string modName = Serial.ToString();

				if (strBonus != 0)
				{
					m.AddStatMod(new StatMod(StatType.Str, modName + "Str", strBonus, TimeSpan.Zero));
				}

				if (dexBonus != 0)
				{
					m.AddStatMod(new StatMod(StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero));
				}

				if (intBonus != 0)
				{
					m.AddStatMod(new StatMod(StatType.Int, modName + "Int", intBonus, TimeSpan.Zero));
				}
			}

			if (Parent is Mobile)
			{
				((Mobile)Parent).CheckStatTimers();
			}

			if (m_Hits <= 0 && m_MaxHits <= 0)
			{
				m_Hits = m_MaxHits = Utility.RandomMinMax(InitMinHits, InitMaxHits);
			}

			if (version < 6)
			{
				m_PlayerConstructed = true; // we don't know, so, assume it's crafted
			}
		}
예제 #51
0
        public BaseWeapon( int itemID )
            : base(itemID)
        {
            Layer = (Layer)ItemData.Quality;

            m_Quality = WeaponQuality.Regular;
            m_StrReq = -1;
            m_DexReq = -1;
            m_IntReq = -1;
            m_MinDamage = -1;
            m_MaxDamage = -1;
            m_HitSound = -1;
            m_MissSound = -1;
            m_Speed = -1;
            m_MaxRange = -1;
            m_Skill = (SkillName)(-1);
            m_Type = (WeaponType)(-1);
            m_Animation = (WeaponAnimation)(-1);

            m_Hits = m_MaxHits = Utility.RandomMinMax(InitMinHits, InitMaxHits);

            m_Resource = CraftResource.Iron;

            m_AosAttributes = new AosAttributes(this);
            m_AosWeaponAttributes = new AosWeaponAttributes(this);
            m_AosSkillBonuses = new AosSkillBonuses(this);
        }
예제 #52
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            switch ( version )
            {
                case 27:
                case 26: m_BetaNerf = reader.ReadBool(); goto case 25;
                case 25: m_Components = reader.ReadStrongItemList(); goto case 24;
                case 24: m_NewCrafting = reader.ReadBool(); m_QualityDefense = reader.ReadInt(); goto case 23;
                case 23: m_HasHalo = reader.ReadBool(); goto case 22;
                case 22:
                case 21:
                case 20:
                {
                    m_QualityDamage = reader.ReadInt();
                    m_QualitySpeed = reader.ReadInt();
                    m_QualityAccuracy = reader.ReadInt();
                    goto case 19;
                }
                case 19:
                case 18:
                case 17:
                case 16:
                case 15:
                case 14:
                case 13:
                case 12:
                case 11:
                case 10:
                {
                    m_CraftersOriginalName = reader.ReadString();
                    goto case 9;
                }
                case 9:
                {
                    m_Engraved1 = reader.ReadString();
                    m_Engraved2 = reader.ReadString();
                    m_Engraved3 = reader.ReadString();
                    goto case 5;
                }
                case 8:
                case 7:
                case 6:
                case 5:
                {
                    SaveFlag flags = (SaveFlag)reader.ReadInt();

                    if ( GetSaveFlag( flags, SaveFlag.DamageLevel ) )
                    {
                        m_DamageLevel = (WeaponDamageLevel)reader.ReadInt();

                        if ( m_DamageLevel > WeaponDamageLevel.Vanq )
                            m_DamageLevel = WeaponDamageLevel.Ruin;
                    }

                    if ( GetSaveFlag( flags, SaveFlag.AccuracyLevel ) )
                    {
                        m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt();

                        if ( m_AccuracyLevel > WeaponAccuracyLevel.Supremely )
                            m_AccuracyLevel = WeaponAccuracyLevel.Accurate;
                    }

                    if ( GetSaveFlag( flags, SaveFlag.DurabilityLevel ) )
                    {
                        m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt();

                        if ( m_DurabilityLevel > WeaponDurabilityLevel.Indestructible )
                            m_DurabilityLevel = WeaponDurabilityLevel.Durable;
                    }

                    if ( GetSaveFlag( flags, SaveFlag.Quality ) )
                        m_Quality = (WeaponQuality)reader.ReadInt();
                    else
                        m_Quality = WeaponQuality.Regular;

                    if ( GetSaveFlag( flags, SaveFlag.Hits ) )
                        m_Hits = reader.ReadInt();

                    if ( GetSaveFlag( flags, SaveFlag.MaxHits ) )
                        m_MaxHits = reader.ReadInt();

                    if ( GetSaveFlag( flags, SaveFlag.Slayer ) )
                        m_Slayer = (SlayerName)reader.ReadInt();

                    if ( GetSaveFlag( flags, SaveFlag.Poison ) )
                        m_Poison = Poison.Deserialize( reader );

                    if ( GetSaveFlag( flags, SaveFlag.PoisonCharges ) )
                        m_PoisonCharges = reader.ReadInt();

                    if ( GetSaveFlag( flags, SaveFlag.Crafter ) )
                        m_Crafter = reader.ReadMobile();

                    if ( GetSaveFlag( flags, SaveFlag.Identified ) )
                        m_Identified = ( version >= 6 || reader.ReadBool() );

                    if ( GetSaveFlag( flags, SaveFlag.StrReq ) )
                        m_StrReq = reader.ReadInt();
                    else
                        m_StrReq = -1;

                    if ( GetSaveFlag( flags, SaveFlag.DexReq ) )
                        m_DexReq = reader.ReadInt();
                    else
                        m_DexReq = -1;

                    if ( GetSaveFlag( flags, SaveFlag.IntReq ) )
                        m_IntReq = reader.ReadInt();
                    else
                        m_IntReq = -1;

                    if ( GetSaveFlag( flags, SaveFlag.MinDamage ) )
                        m_MinDamage = reader.ReadInt();
                    else
                        m_MinDamage = -1;

                    if ( GetSaveFlag( flags, SaveFlag.MaxDamage ) )
                        m_MaxDamage = reader.ReadInt();
                    else
                        m_MaxDamage = -1;

                    if ( GetSaveFlag( flags, SaveFlag.HitSound ) )
                        m_HitSound = reader.ReadInt();
                    else
                        m_HitSound = -1;

                    if ( GetSaveFlag( flags, SaveFlag.MissSound ) )
                        m_MissSound = reader.ReadInt();
                    else
                        m_MissSound = -1;

                    if ( GetSaveFlag( flags, SaveFlag.Speed ) )
                        m_Speed = reader.ReadInt();
                    else
                        m_Speed = -1;

                    if ( GetSaveFlag( flags, SaveFlag.MaxRange ) )
                        m_MaxRange = reader.ReadInt();
                    else
                        m_MaxRange = -1;

                    if ( GetSaveFlag( flags, SaveFlag.Skill ) )
                        m_Skill = (SkillName)reader.ReadInt();
                    else
                        m_Skill = (SkillName)(-1);

                    if ( GetSaveFlag( flags, SaveFlag.Type ) )
                        m_Type = (WeaponType)reader.ReadInt();
                    else
                        m_Type = (WeaponType)(-1);

                    if ( GetSaveFlag( flags, SaveFlag.Animation ) )
                        m_Animation = (WeaponAnimation)reader.ReadInt();
                    else
                        m_Animation = (WeaponAnimation)(-1);

                    if ( GetSaveFlag( flags, SaveFlag.Resource ) )
                        m_Resource = (CraftResource)reader.ReadInt();
                    else
                        m_Resource = CraftResource.Iron;

                    if ( GetSaveFlag( flags, SaveFlag.xAttributes ) )
                        m_AosAttributes = new AosAttributes( this, reader );
                    else
                        m_AosAttributes = new AosAttributes( this );

                    if ( GetSaveFlag( flags, SaveFlag.xWeaponAttributes ) )
                        m_AosWeaponAttributes = new AosWeaponAttributes( this, reader );
                    else
                        m_AosWeaponAttributes = new AosWeaponAttributes( this );

                    if ( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile )
                    {
                        m_SkillMod = new DefaultSkillMod( AccuracySkill, true, (int)m_AccuracyLevel * 5 );
                        ((Mobile)Parent).AddSkillMod( m_SkillMod );
                    }

                    if ( version < 7 && m_AosWeaponAttributes.MageWeapon != 0 )
                        m_AosWeaponAttributes.MageWeapon = 30 - m_AosWeaponAttributes.MageWeapon;

                    if ( Core.AOS && m_AosWeaponAttributes.MageWeapon != 0 && m_AosWeaponAttributes.MageWeapon != 30 && Parent is Mobile )
                    {
                        m_MageMod = new DefaultSkillMod( SkillName.Magery, true, -30 + m_AosWeaponAttributes.MageWeapon );
                        ((Mobile)Parent).AddSkillMod( m_MageMod );
                    }

                    if ( GetSaveFlag( flags, SaveFlag.PlayerConstructed ) )
                        m_PlayerConstructed = true;

                    if( GetSaveFlag( flags, SaveFlag.SkillBonuses ) )
                        m_AosSkillBonuses = new AosSkillBonuses( this, reader );
                    else
                        m_AosSkillBonuses = new AosSkillBonuses( this );

                    if( GetSaveFlag( flags, SaveFlag.Slayer2 ) )
                        m_Slayer2 = (SlayerName)reader.ReadInt();

                    if( GetSaveFlag( flags, SaveFlag.ElementalDamages ) )
                        m_AosElementDamages = new AosElementAttributes( this, reader );
                    else
                        m_AosElementDamages = new AosElementAttributes( this );

                    break;
                }
                case 4:
                {
                    m_Slayer = (SlayerName)reader.ReadInt();

                    goto case 3;
                }
                case 3:
                {
                    m_StrReq = reader.ReadInt();
                    m_DexReq = reader.ReadInt();
                    m_IntReq = reader.ReadInt();

                    goto case 2;
                }
                case 2:
                {
                    m_Identified = reader.ReadBool();

                    goto case 1;
                }
                case 1:
                {
                    m_MaxRange = reader.ReadInt();

                    goto case 0;
                }
                case 0:
                {
                    if ( version == 0 )
                        m_MaxRange = 1; // default

                    if ( version < 5 )
                    {
                        m_Resource = CraftResource.Iron;
                        m_AosAttributes = new AosAttributes( this );
                        m_AosWeaponAttributes = new AosWeaponAttributes( this );
                        m_AosElementDamages = new AosElementAttributes( this );
                        m_AosSkillBonuses = new AosSkillBonuses( this );
                    }

                    m_MinDamage = reader.ReadInt();
                    m_MaxDamage = reader.ReadInt();

                    m_Speed = reader.ReadInt();

                    m_HitSound = reader.ReadInt();
                    m_MissSound = reader.ReadInt();

                    m_Skill = (SkillName)reader.ReadInt();
                    m_Type = (WeaponType)reader.ReadInt();
                    m_Animation = (WeaponAnimation)reader.ReadInt();
                    m_DamageLevel = (WeaponDamageLevel)reader.ReadInt();
                    m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt();
                    m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt();
                    m_Quality = (WeaponQuality)reader.ReadInt();

                    m_Crafter = reader.ReadMobile();

                    m_Poison = Poison.Deserialize( reader );
                    m_PoisonCharges = reader.ReadInt();

                    if ( m_StrReq == OldStrengthReq )
                        m_StrReq = -1;

                    if ( m_DexReq == OldDexterityReq )
                        m_DexReq = -1;

                    if ( m_IntReq == OldIntelligenceReq )
                        m_IntReq = -1;

                    if ( m_MinDamage == OldMinDamage )
                        m_MinDamage = -1;

                    if ( m_MaxDamage == OldMaxDamage )
                        m_MaxDamage = -1;

                    if ( m_HitSound == OldHitSound )
                        m_HitSound = -1;

                    if ( m_MissSound == OldMissSound )
                        m_MissSound = -1;

                    if ( m_Speed == OldSpeed )
                        m_Speed = -1;

                    if ( m_MaxRange == OldMaxRange )
                        m_MaxRange = -1;

                    if ( m_Skill == OldSkill )
                        m_Skill = (SkillName)(-1);

                    if ( m_Type == OldType )
                        m_Type = (WeaponType)(-1);

                    if ( m_Animation == OldAnimation )
                        m_Animation = (WeaponAnimation)(-1);

                    if ( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile )
                    {
                        m_SkillMod = new DefaultSkillMod( AccuracySkill, true, (int)m_AccuracyLevel * 5);
                        ((Mobile)Parent).AddSkillMod( m_SkillMod );
                    }

                    break;
                }
            }

            if ( Core.AOS && Parent is Mobile )
                m_AosSkillBonuses.AddTo( (Mobile)Parent );

            int strBonus = m_AosAttributes.BonusStr;
            int dexBonus = m_AosAttributes.BonusDex;
            int intBonus = m_AosAttributes.BonusInt;

            if ( this.Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0) )
            {
                Mobile m = (Mobile)this.Parent;

                string modName = this.Serial.ToString();

                if ( strBonus != 0 )
                    m.AddStatMod( new StatMod( StatType.Str, modName + "Str", strBonus, TimeSpan.Zero ) );

                if ( dexBonus != 0 )
                    m.AddStatMod( new StatMod( StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero ) );

                if ( intBonus != 0 )
                    m.AddStatMod( new StatMod( StatType.Int, modName + "Int", intBonus, TimeSpan.Zero ) );
            }

            if ( Parent is Mobile )
                ((Mobile)Parent).CheckStatTimers();

            if ( m_Hits <= 0 && m_MaxHits <= 0 )
            {
                m_Hits = m_MaxHits = Utility.RandomMinMax( InitMinHits, InitMaxHits );
            }

            if( version < 15 && this is IBoneArmour )
                this.Attributes.WeaponSpeed -= 4;

            if( version < 16 )
                FixResource();

            if( version < 17 )
            {
                this.m_Speed = -1;
                this.m_MinDamage = -1;
                this.m_MaxDamage = -1;

                if( this.Hue == 2413 )
                    this.Resource = CraftResource.Copper;

                if( this.Hue == 2418 )
                    this.Resource = CraftResource.Bronze;
            }

            if( version < 18 )
                this.DurabilityLevel = WeaponDurabilityLevel.Regular;

            if( version < 19 )
            {
                if( this.HitPoints > 175 )
                    this.HitPoints = 175;

                if( this.MaxHitPoints > 175 )
                    this.MaxHitPoints = 175;
            }

            if( version < 20 )
                FixBonuses();

            if( version < 21 )
            {
                if( this is IBoneArmour )
                    Hue = 0;

                else
                    Hue = CraftResources.GetHue( this.Resource );
            }

            if( version < 22 )
            {
                Speed = -1;
                MinDamage = -1;
                MaxDamage = -1;
            }

            if ( version == 26 )
                BetaNerf = false;
        }
예제 #53
0
		public BaseWeapon(int itemID)
			: base(itemID)
		{
			Layer = (Layer)ItemData.Quality;

			m_Quality = WeaponQuality.Regular;
			m_StrReq = -1;
			m_DexReq = -1;
			m_IntReq = -1;
			m_MinDamage = -1;
			m_MaxDamage = -1;
			m_HitSound = -1;
			m_MissSound = -1;
			m_Speed = -1;
			m_MaxRange = -1;
			m_Skill = (SkillName)(-1);
			m_Type = (WeaponType)(-1);
			m_Animation = (WeaponAnimation)(-1);

			m_Hits = m_MaxHits = Utility.RandomMinMax(InitMinHits, InitMaxHits);

			m_Resource = CraftResource.Iron;

			m_AosAttributes = new AosAttributes(this);
			m_AosWeaponAttributes = new AosWeaponAttributes(this);
			m_AosSkillBonuses = new AosSkillBonuses(this);
			m_AosElementDamages = new AosElementAttributes(this);

			#region Stygian Abyss
			m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this);
			#endregion

			#region Mondain's Legacy Sets
			m_SetAttributes = new AosAttributes(this);
			m_SetSkillBonuses = new AosSkillBonuses(this);
			#endregion

			m_AosSkillBonuses = new AosSkillBonuses(this);
			// Xml Spawner XmlSockets - SOF
			// mod to randomly add sockets and socketability features to armor. These settings will yield
			// 2% drop rate of socketed/socketable items
			// 0.1% chance of 5 sockets
			// 0.5% of 4 sockets
			// 3% chance of 3 sockets
			// 15% chance of 2 sockets
			// 50% chance of 1 socket
			// the remainder will be 0 socket (31.4% in this case)
			if(XmlSpawner.SocketsEnabled)
				XmlSockets.ConfigureRandom(this, 2.0, 0.1, 0.5, 3.0, 15.0, 50.0);
		}
예제 #54
0
        public virtual int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue)
        {
            Quality = (WeaponQuality)quality;

            if (makersMark) // Add to CraftItem.cs mark table
            {
                Crafter = from;
            }

            Type resourceType = typeRes;

            if (resourceType == null)
            {
                resourceType = craftItem.Resources.GetAt(0).ItemType;
            }

            if (!craftItem.ForceNonExceptional)
            {
                Resource = CraftResources.GetFromType(resourceType);
            }

            CraftContext context = craftSystem.GetContext(from);

            if (context != null && context.DoNotColor)
            {
                Hue = 0;
            }

            if (craftItem != null)
            {
                if (tool is BaseRunicTool)
                {
                    ((BaseRunicTool)tool).ApplyAttributesTo(this);
                }

                CraftResourceInfo resInfo = CraftResources.GetInfo(m_Resource);

                if (resInfo == null)
                {
                    return(quality);
                }

                CraftAttributeInfo attrInfo = resInfo.AttributeInfo;

                if (attrInfo == null)
                {
                    return(quality);
                }

                if (m_Resource != CraftResource.Heartwood)
                {
                    m_AosAttributes.WeaponDamage += attrInfo.WeaponDamage;
                    m_AosAttributes.WeaponSpeed  += attrInfo.WeaponSwingSpeed;
                    m_AosAttributes.AttackChance += attrInfo.WeaponHitChance;
                    m_AosAttributes.RegenHits    += attrInfo.WeaponRegenHits;
                }
                else
                {
                    switch (Utility.Random(6))
                    {
                    case 0: m_AosAttributes.WeaponDamage += attrInfo.WeaponDamage; break;

                    case 1: m_AosAttributes.WeaponSpeed += attrInfo.WeaponSwingSpeed; break;

                    case 2: m_AosAttributes.AttackChance += attrInfo.WeaponHitChance; break;

                    case 3: m_AosAttributes.Luck += attrInfo.WeaponLuck; break;
                    }
                }

                if ((m_Resource == CraftResource.Frostwood || m_Resource == CraftResource.Heartwood) && m_AosAttributes.SpellChanneling == 0)
                {
                    Attributes.SpellChanneling = 1;
                    Attributes.CastSpeed      -= 1;
                }
            }

            return(quality);
        }