示例#1
0
 public void AddNewbied(BaseRing item)
 {
     item.LootType             = LootType.Newbied;
     item.Attributes.CastSpeed = 6;
     AddItem(item);
 }
示例#2
0
        public Item Mutate(Item item)
        {
            if (item == null)
            {
                return(null);
            }

            int stop = 0;

            if (item is MagicWand)
            {
                MagicWand wand = (MagicWand)item;

                while (wand.SpellEffect == SpellEffect.None && stop < 500)
                {
                    stop++;
                    double dr = Utility.RandomDouble() * 100.0;

                    if (dr < 8.0)
                    {
                        if (dr < 0.2 && m_MaxIntensity >= 80)
                        {
                            wand.SpellEffect = SpellEffect.ManaDrain;
                        }
                        else if (dr < 0.8 && m_MaxIntensity >= 80)
                        {
                            wand.SpellEffect = SpellEffect.Lightning;
                        }
                        else if (dr < 1.3 && m_MaxIntensity >= 60)
                        {
                            wand.SpellEffect = SpellEffect.Fireball;
                        }
                        else if (dr < 1.8 && m_MaxIntensity >= 60)
                        {
                            wand.SpellEffect = SpellEffect.GHeal;
                        }
                        else if (dr < 2.8 && m_MaxIntensity >= 40)
                        {
                            wand.SpellEffect = SpellEffect.Harm;
                        }
                        else if (dr < 3.8 && m_MaxIntensity >= 40)
                        {
                            wand.SpellEffect = SpellEffect.MagicArrow;
                        }
                        else if (dr < 4.8 && m_MaxIntensity >= 20)
                        {
                            wand.SpellEffect = SpellEffect.Feeblemind;
                        }
                        else if (dr < 5.8 && m_MaxIntensity >= 20)
                        {
                            wand.SpellEffect = SpellEffect.Clumsy;
                        }
                        else if (dr < 6.8 && m_MaxIntensity >= 20)
                        {
                            wand.SpellEffect = SpellEffect.MiniHeal;
                        }
                        else                         //if ( dr < 8.0 )
                        {
                            wand.SpellEffect = SpellEffect.ItemID;
                        }
                    }
                }

                if (wand.SpellEffect != SpellEffect.None)
                {
                    wand.SpellCharges = SpellCastEffect.GetChargesFor(wand.SpellEffect);
                }
                else
                {
                    wand.Delete();
                }
            }
            else if (item is BaseWeapon)
            {
                BaseWeapon weapon = (BaseWeapon)item;

                while (weapon.AccuracyLevel == WeaponAccuracyLevel.Regular &&
                       weapon.DamageLevel == WeaponDamageLevel.Regular &&
                       weapon.DurabilityLevel == DurabilityLevel.Regular &&
                       weapon.Slayer == SlayerName.None &&
                       weapon.SpellEffect == SpellEffect.None && stop < 500)
                {
                    stop++;

                    if (45 > Utility.Random(100))
                    {
                        weapon.AccuracyLevel = (WeaponAccuracyLevel)GetRandomBonus();
                    }
                    if (40 > Utility.Random(100))
                    {
                        weapon.DamageLevel = (WeaponDamageLevel)GetRandomBonus();
                    }
                    if (35 > Utility.Random(100))
                    {
                        weapon.DurabilityLevel = (DurabilityLevel)GetRandomBonus();
                    }
                    if (5 > Utility.Random(100))
                    {
                        weapon.Slayer = SlayerName.Silver;
                    }

                    double dr = Utility.RandomDouble() * 100.0;
                    if (dr < 7.8)
                    {
                        if (dr < 0.2 && m_MaxIntensity >= 80)
                        {
                            weapon.SpellEffect = SpellEffect.Lightning;
                        }
                        else if (dr < 0.8 && m_MaxIntensity >= 80)
                        {
                            weapon.SpellEffect = SpellEffect.ManaDrain;
                        }
                        else if (dr < 1.3 && m_MaxIntensity >= 60)
                        {
                            weapon.SpellEffect = SpellEffect.Curse;
                        }
                        else if (dr < 1.8 && m_MaxIntensity >= 60)
                        {
                            weapon.SpellEffect = SpellEffect.Fireball;
                        }
                        else if (dr < 2.8 && m_MaxIntensity >= 40)
                        {
                            weapon.SpellEffect = SpellEffect.Paralyze;
                        }
                        else if (dr < 3.8 && m_MaxIntensity >= 40)
                        {
                            weapon.SpellEffect = SpellEffect.Harm;
                        }
                        else if (dr < 4.8 && m_MaxIntensity >= 20)
                        {
                            weapon.SpellEffect = SpellEffect.Weaken;
                        }
                        else if (dr < 5.8 && m_MaxIntensity >= 20)
                        {
                            weapon.SpellEffect = SpellEffect.MagicArrow;
                        }
                        else if (dr < 6.8)
                        {
                            weapon.SpellEffect = SpellEffect.Feeblemind;
                        }
                        else                         //if ( dr < 7.8 )
                        {
                            weapon.SpellEffect = SpellEffect.Clumsy;
                        }
                    }
                }

                if (weapon.SpellEffect != SpellEffect.None)
                {
                    weapon.SpellCharges = SpellCastEffect.GetChargesFor(weapon.SpellEffect);
                }
            }
            else if (item is BaseArmor)
            {
                BaseArmor armor = (BaseArmor)item;

                while (armor.ProtectionLevel == ArmorProtectionLevel.Regular && armor.Durability == DurabilityLevel.Regular && stop < 500)
                {
                    stop++;

                    if (75 > Utility.Random(100))
                    {
                        armor.ProtectionLevel = (ArmorProtectionLevel)GetRandomBonus();
                    }

                    if (35 > Utility.Random(100))
                    {
                        armor.Durability = (DurabilityLevel)GetRandomBonus();
                    }
                }
            }
            else if (item is BaseInstrument)
            {
                ((BaseInstrument)item).Quality = InstrumentQuality.Regular;
            }
            else if (item is BaseRing)
            {
                BaseRing ring = (BaseRing)item;

                if (GetRandomBonus() >= 5)
                {
                    if (Utility.RandomBool())
                    {
                        ring.SpellEffect = SpellEffect.Invis;
                    }
                    else
                    {
                        ring.SpellEffect = SpellEffect.Teleportation;
                    }
                    ring.SpellCharges = SpellCastEffect.GetChargesFor(ring.SpellEffect);
                }
                else
                {
                    ring.Delete();
                }
            }
            else if (item is BaseClothing)
            {
                BaseClothing clothes = (BaseClothing)item;

                while (clothes.SpellEffect == SpellEffect.None && stop < 1)
                {
                    stop++;
                    double dr = Utility.RandomDouble() * 100.0;
                    if (dr < 10.0)
                    {
                        if (dr < 0.2 && m_MaxIntensity >= 80)
                        {
                            clothes.SpellEffect = SpellEffect.Curse;
                        }
                        else if (dr < 0.8 && m_MaxIntensity >= 80)
                        {
                            clothes.SpellEffect = SpellEffect.Bless;
                        }
                        else if (dr < 1.3 && m_MaxIntensity >= 60)
                        {
                            clothes.SpellEffect = SpellEffect.Weaken;
                        }
                        else if (dr < 1.8 && m_MaxIntensity >= 60)
                        {
                            clothes.SpellEffect = SpellEffect.Clumsy;
                        }
                        else if (dr < 2.8 && m_MaxIntensity >= 60)
                        {
                            clothes.SpellEffect = SpellEffect.Feeblemind;
                        }
                        else if (dr < 3.8 && m_MaxIntensity >= 50)
                        {
                            clothes.SpellEffect = SpellEffect.Reflect;
                        }
                        else if (dr < 4.8 && m_MaxIntensity >= 50)
                        {
                            clothes.SpellEffect = SpellEffect.Invis;
                        }
                        else if (dr < 5.8 && m_MaxIntensity >= 20)
                        {
                            clothes.SpellEffect = SpellEffect.Strength;
                        }
                        else if (dr < 6.8 && m_MaxIntensity >= 20)
                        {
                            clothes.SpellEffect = SpellEffect.Cunning;
                        }
                        else if (dr < 7.8 && m_MaxIntensity >= 20)
                        {
                            clothes.SpellEffect = SpellEffect.Agility;
                        }
                        else if (dr < 8.9)
                        {
                            clothes.SpellEffect = SpellEffect.Protection;
                        }
                        else
                        {
                            clothes.SpellEffect = SpellEffect.NightSight;
                        }
                    }
                }

                if (clothes.SpellEffect != SpellEffect.None)
                {
                    clothes.SpellCharges = SpellCastEffect.GetChargesFor(clothes.SpellEffect);
                }
            }

            if (item.Stackable)
            {
                item.Amount = m_Quantity.Generate();
            }

            return(item);
        }