Example #1
0
        public Weapon(double min = 1, double max = 2, double speed = 1, bool twoHanded = true, WeaponType type = WeaponType.Axe, Attributes attributes = null, int id = 0, string name = "New Item", Enchantment enchantment = null, Enchantment buff = null, ItemEffect effect = null, School school = School.Physical)
            : base(Slot.Weapon, attributes, id, name, enchantment, effect)
        {
            DamageMin = min;
            DamageMax = max;
            Speed     = speed;
            TwoHanded = twoHanded;
            Type      = type;
            Buff      = buff;
            School    = school;

            if (Buff != null && Buff.Attributes.GetValue(Attribute.WeaponDamage) > 0)
            {
                double bonus = Buff.Attributes.GetValue(Attribute.WeaponDamage);
                DamageMin += bonus;
                DamageMax += bonus;
            }

            BaseMin = DamageMin;
            BaseMax = DamageMax;
        }
Example #2
0
        public Weapon(Player p = null, int min = 1, int max = 2, double speed = 1, bool twoHanded = true, WeaponType type = WeaponType.Axe, Attributes attributes = null, int id = 0, string name = "New Item", Enchantment enchantment = null, Enchantment buff = null, ItemEffect effect = null)
            : base(p, Slot.Weapon, attributes, id, name, enchantment, effect)
        {
            DamageMin = min;
            DamageMax = max;
            Speed     = speed;
            TwoHanded = twoHanded;
            Type      = type;
            Buff      = buff;

            if (Buff != null && Buff.Attributes.GetValue(Attribute.WeaponDamage) > 0)
            {
                int bonus = (int)Math.Round(Buff.Attributes.GetValue(Attribute.WeaponDamage));
                DamageMin += bonus;
                DamageMax += bonus;
            }
        }
Example #3
0
 public Weapon(int min, int max, double speed, bool twoHanded, WeaponType type, Attributes attributes = null, int id = 0, string name = "New Item", Enchantment enchantment = null, Enchantment buff = null, ItemEffect effect = null)
     : this(null, min, max, speed, twoHanded, type, attributes, id, name, enchantment, buff, effect)
 {
 }
Example #4
0
 public Attributes(Attributes a)
     : this(a.Values)
 {
 }
Example #5
0
 public static JsonItem FromItem(Item i)
 {
     if (i == null)
     {
         return(null);
     }
     else
     {
         JsonItem res = new JsonItem(i.Id, i.Name, SlotUtil.ToString(i.Slot), Attributes.ToStringDic(i.Attributes), ClassicCraft.Enchantment.FromEnchantment(i.Enchantment));
         if (res.Stats != null)
         {
             if (res.Stats.ContainsKey("Crit"))
             {
                 res.Stats["Crit"] *= 100;
             }
             if (res.Stats.ContainsKey("Hit"))
             {
                 res.Stats["Hit"] *= 100;
             }
             if (res.Stats.ContainsKey("AS"))
             {
                 res.Stats["AS"] *= 100;
             }
             if (res.Stats.ContainsKey("SpellHit"))
             {
                 res.Stats["SpellHit"] *= 100;
             }
             if (res.Stats.ContainsKey("SpellCrit"))
             {
                 res.Stats["SpellCrit"] *= 100;
             }
         }
         if (res.Enchantment != null)
         {
             if (res.Enchantment.Stats.ContainsKey("Crit"))
             {
                 res.Enchantment.Stats["Crit"] *= 100;
             }
             if (res.Enchantment.Stats.ContainsKey("Hit"))
             {
                 res.Enchantment.Stats["Hit"] *= 100;
             }
             if (res.Enchantment.Stats.ContainsKey("AS"))
             {
                 res.Enchantment.Stats["AS"] *= 100;
             }
             if (res.Enchantment.Stats.ContainsKey("SpellHit"))
             {
                 res.Enchantment.Stats["SpellHit"] *= 100;
             }
             if (res.Enchantment.Stats.ContainsKey("SpellCrit"))
             {
                 res.Enchantment.Stats["SpellCrit"] *= 100;
             }
         }
         return(res);
     }
 }
Example #6
0
 public static JsonWeapon FromWeapon(Weapon w)
 {
     if (w == null)
     {
         return(null);
     }
     else
     {
         JsonWeapon res = new JsonWeapon(w.DamageMin, w.DamageMax, w.Speed, w.TwoHanded, Weapon.TypeToString(w.Type), w.Id, w.Name, Attributes.ToStringDic(w.Attributes), ClassicCraft.Enchantment.FromEnchantment(w.Enchantment), ClassicCraft.Enchantment.FromEnchantment(w.Buff));
         if (res.Stats != null)
         {
             if (res.Stats.ContainsKey("Crit"))
             {
                 res.Stats["Crit"] *= 100;
             }
             if (res.Stats.ContainsKey("Hit"))
             {
                 res.Stats["Hit"] *= 100;
             }
             if (res.Stats.ContainsKey("AS"))
             {
                 res.Stats["AS"] *= 100;
             }
             if (res.Stats.ContainsKey("SpellHit"))
             {
                 res.Stats["SpellHit"] *= 100;
             }
             if (res.Stats.ContainsKey("SpellCrit"))
             {
                 res.Stats["SpellCrit"] *= 100;
             }
         }
         if (res.Enchantment != null)
         {
             if (res.Enchantment.Stats.ContainsKey("Crit"))
             {
                 res.Enchantment.Stats["Crit"] *= 100;
             }
             if (res.Enchantment.Stats.ContainsKey("Hit"))
             {
                 res.Enchantment.Stats["Hit"] *= 100;
             }
             if (res.Enchantment.Stats.ContainsKey("AS"))
             {
                 res.Enchantment.Stats["AS"] *= 100;
             }
             if (res.Enchantment.Stats.ContainsKey("SpellHit"))
             {
                 res.Enchantment.Stats["SpellHit"] *= 100;
             }
             if (res.Enchantment.Stats.ContainsKey("SpellCrit"))
             {
                 res.Enchantment.Stats["SpellCrit"] *= 100;
             }
         }
         if (res.Buff != null)
         {
             if (res.Buff.Stats.ContainsKey("Crit"))
             {
                 res.Buff.Stats["Crit"] *= 100;
             }
             if (res.Buff.Stats.ContainsKey("Hit"))
             {
                 res.Buff.Stats["Hit"] *= 100;
             }
             if (res.Buff.Stats.ContainsKey("AS"))
             {
                 res.Buff.Stats["AS"] *= 100;
             }
             if (res.Buff.Stats.ContainsKey("SpellHit"))
             {
                 res.Buff.Stats["SpellHit"] *= 100;
             }
             if (res.Buff.Stats.ContainsKey("SpellCrit"))
             {
                 res.Buff.Stats["SpellCrit"] *= 100;
             }
         }
         return(res);
     }
 }