public Item Mutate(Mobile from, int luckChance, Item item) { if (item != null) { if (item is BaseWeapon && 1 > Utility.Random(100)) { item.Delete(); item = new FireHorn(); return item; } if (item is BaseWeapon || item is BaseArmor || item is BaseJewel || item is BaseHat) { if (Core.AOS) { // Try to generate a new random item based on the creature killed if (from is BaseCreature) { if (RandomItemGenerator.GenerateRandomItem(item, ((BaseCreature)from).LastKiller, (BaseCreature)from)) return item; } int bonusProps = GetBonusProperties(); int min = m_MinIntensity; int max = m_MaxIntensity; if (bonusProps < m_MaxProps && LootPack.CheckLuck(luckChance)) { ++bonusProps; } int props = 1 + bonusProps; // Make sure we're not spawning items with 6 properties. if (props > m_MaxProps) { props = m_MaxProps; } // Use the older style random generation if (item is BaseWeapon) { BaseRunicTool.ApplyAttributesTo((BaseWeapon)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity); } else if (item is BaseArmor) { BaseRunicTool.ApplyAttributesTo((BaseArmor)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity); } else if (item is BaseJewel) { BaseRunicTool.ApplyAttributesTo((BaseJewel)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity); } else if (item is BaseHat) { BaseRunicTool.ApplyAttributesTo((BaseHat)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity); } } else // not aos { if (item is BaseWeapon) { BaseWeapon weapon = (BaseWeapon)item; if (80 > Utility.Random(100)) { weapon.AccuracyLevel = (WeaponAccuracyLevel)GetRandomOldBonus(); } if (60 > Utility.Random(100)) { weapon.DamageLevel = (WeaponDamageLevel)GetRandomOldBonus(); } if (40 > Utility.Random(100)) { weapon.DurabilityLevel = (WeaponDurabilityLevel)GetRandomOldBonus(); } if (5 > Utility.Random(100)) { weapon.Slayer = SlayerName.Silver; } if (from != null && weapon.AccuracyLevel == 0 && weapon.DamageLevel == 0 && weapon.DurabilityLevel == 0 && weapon.Slayer == SlayerName.None && 5 > Utility.Random(100)) { weapon.Slayer = SlayerGroup.GetLootSlayerType(from.GetType()); } } else if (item is BaseArmor) { BaseArmor armor = (BaseArmor)item; if (80 > Utility.Random(100)) { armor.ProtectionLevel = (ArmorProtectionLevel)GetRandomOldBonus(); } if (40 > Utility.Random(100)) { armor.Durability = (ArmorDurabilityLevel)GetRandomOldBonus(); } } } } else if (item is BaseInstrument) { SlayerName slayer = SlayerName.None; if (Core.AOS) { slayer = BaseRunicTool.GetRandomSlayer(); } else { slayer = SlayerGroup.GetLootSlayerType(from.GetType()); } if (slayer == SlayerName.None) { item.Delete(); return null; } BaseInstrument instr = (BaseInstrument)item; instr.Quality = InstrumentQuality.Regular; instr.Slayer = slayer; } if (item.Stackable) { item.Amount = m_Quantity.Roll(); } } return item; }
public Item Mutate(Mobile from, Item item) { if (item != null && !(item is BaseWand)) { if (item is BaseWeapon && 1 > Utility.Random(100)) { item.Delete(); item = new FireHorn(); return item; } if (item is BaseWeapon || item is BaseArmor || item is BaseJewel || item is BaseHat) { if (item is BaseWeapon) { var weapon = (BaseWeapon)item; if (55 > Utility.Random(100)) { weapon.AccuracyLevel = (WeaponAccuracyLevel)GetRandomOldBonus(); } if (45 > Utility.Random(100)) { int damageLevel = GetRandomOldBonus(); if (PseudoSeerStone.Instance != null && PseudoSeerStone.Instance._HighestDamageLevelSpawn < damageLevel) { if (damageLevel == 5 && PseudoSeerStone.ReplaceVanqWithSkillScrolls) { return PuzzleChest.CreateRandomSkillScroll(); } int platAmount = PseudoSeerStone.PlatinumPerMissedDamageLevel * (damageLevel - PseudoSeerStone.Instance._HighestDamageLevelSpawn); if (platAmount > 0) { return (new Platinum(platAmount)); } damageLevel = PseudoSeerStone.Instance._HighestDamageLevelSpawn; } weapon.DamageLevel = (WeaponDamageLevel)damageLevel; } if (25 > Utility.Random(100)) { weapon.DurabilityLevel = (WeaponDurabilityLevel)GetRandomOldBonus(); } if (5 > Utility.Random(100)) { weapon.Slayer = SlayerName.Silver; } if (1 > Utility.Random(1000) || (weapon.AccuracyLevel == 0 && weapon.DamageLevel == 0 && weapon.DurabilityLevel == 0 && weapon.Slayer == SlayerName.None && 5 > Utility.Random(100))) { weapon.Slayer = from != null ? SlayerGroup.GetLootSlayerType(from.GetType()) : BaseRunicTool.GetRandomSlayer(); } if (weapon.AccuracyLevel == 0 && weapon.DamageLevel == 0 && weapon.DurabilityLevel == 0 && weapon.Slayer == SlayerName.None) { weapon.Identified = true; } } else if (item is BaseArmor) { var armor = (BaseArmor)item; if (55 > Utility.Random(100)) { armor.ProtectionLevel = (ArmorProtectionLevel)GetRandomOldBonus(); } if (25 > Utility.Random(100)) { armor.Durability = (ArmorDurabilityLevel)GetRandomOldBonus(); } if (armor.ProtectionLevel == 0 && armor.Durability == 0) { armor.Identified = true; } } } else if (item is BaseInstrument) { SlayerName slayer = from == null || from.EraAOS ? BaseRunicTool.GetRandomSlayer() : SlayerGroup.GetLootSlayerType(from.GetType()); var instr = (BaseInstrument)item; instr.Quality = InstrumentQuality.Regular; instr.Slayer = slayer; } else if (item is Spellbook) //Randomize spellbook { var book = item as Spellbook; if (MaxIntensity == 100 && MinIntensity / 1000.0 > Utility.RandomDouble()) { book.LootType = LootType.Blessed; } if (MaxIntensity == 100 && MinIntensity >= 50 && (MinIntensity / 3000.0 > Utility.RandomDouble())) { book.Dyable = true; } int rnd = Utility.RandomMinMax(MinIntensity, MaxIntensity); var circle = (int)((rnd / 12.5) + 1.0); if (circle >= 8 && 0.33 > Utility.RandomDouble()) { book.Content = ulong.MaxValue; } else { circle = Math.Min(circle, 8); //do we fill this circle? for (int i = 0; i < circle; i++) { if (Utility.RandomBool()) { book.Content |= (ulong)Utility.Random(0x100) << (i * 8); } } } } if (item.Stackable) { // Note: do not check hits max here if you want to multiply against gold // the max hits have not been set when this function is called // The inital loot is added to the BaseCreature before the attributes are set // for the specific mob type if (item is Gold) { item.Amount = (int) Math.Ceiling(Quantity.Roll() * DynamicSettingsController.GoldMulti); } else { item.Amount = Quantity.Roll(); } } } return item; }
public InternalTarget( FireHorn horn ) : base(Core.AOS ? 3 : 2, true, TargetFlags.Harmful) { m_Horn = horn; }
public Item Mutate( Mobile from, int luckChance, Item item ) { if ( item != null ) { if ( item is BaseWeapon && 1 > Utility.Random( 100 ) ) { item.Delete(); item = new FireHorn(); return item; } if ( item is BaseWeapon || item is BaseArmor || item is BaseJewel || item is BaseHat ) { if ( Core.AOS ) { int bonusProps = GetBonusProperties(); int min = m_MinIntensity; int max = m_MaxIntensity; if ( bonusProps < m_MaxProps && LootPack.CheckLuck( luckChance ) ) ++bonusProps; int props = 1 + bonusProps; if ( (item is BaseArmor || item is BaseHat) && !(item is BaseShield)) // Added by Hekate/Silver { min = (int)(min * 1.15) + 15; max = (int)(max * 1.15) + 15; if ( 0.35 > Utility.RandomDouble() ) props++; } else if( !(item is BaseShield) ) // Added by Silver { min = (int)(min * 1.1) + 10; max = (int)(max * 1.1) + 10; if ( 0.25 > Utility.RandomDouble() ) props++; } else // Added by Silver { min = (int)(min * 1.05) + 10; max = (int)(max * 1.05) + 10; if ( 0.15 > Utility.RandomDouble() ) props++; } // Silver: Make sure min and max are configured correctly if( max > 100 ) max = 100; if( min > max ) min = max; // Make sure we're not spawning items with 6 properties. if ( props > m_MaxProps ) props = m_MaxProps; if ( item is BaseWeapon ) BaseRunicTool.ApplyAttributesTo( (BaseWeapon)item, false, luckChance, props, min, max); // Silver: used to be m_MinIntensity/m_MaxIntensity else if ( item is BaseArmor ) BaseRunicTool.ApplyAttributesTo( (BaseArmor)item, false, luckChance, props, min, max ); else if ( item is BaseJewel ) BaseRunicTool.ApplyAttributesTo( (BaseJewel)item, false, luckChance, props, min, max ); else if ( item is BaseHat ) BaseRunicTool.ApplyAttributesTo( (BaseHat)item, false, luckChance, props, min, max ); } else // not aos { if ( item is BaseWeapon ) { BaseWeapon weapon = (BaseWeapon)item; if ( 80 > Utility.Random( 100 ) ) weapon.AccuracyLevel = (WeaponAccuracyLevel)GetRandomOldBonus(); if ( 60 > Utility.Random( 100 ) ) weapon.DamageLevel = (WeaponDamageLevel)GetRandomOldBonus(); if ( 40 > Utility.Random( 100 ) ) weapon.DurabilityLevel = (WeaponDurabilityLevel)GetRandomOldBonus(); if ( 5 > Utility.Random( 100 ) ) weapon.Slayer = SlayerName.Silver; if ( from != null && weapon.AccuracyLevel == 0 && weapon.DamageLevel == 0 && weapon.DurabilityLevel == 0 && weapon.Slayer == SlayerName.None && 5 > Utility.Random( 100 ) ) weapon.Slayer = SlayerGroup.GetLootSlayerType( from.GetType() ); } else if ( item is BaseArmor ) { BaseArmor armor = (BaseArmor)item; if ( 80 > Utility.Random( 100 ) ) armor.ProtectionLevel = (ArmorProtectionLevel)GetRandomOldBonus(); if ( 40 > Utility.Random( 100 ) ) armor.Durability = (ArmorDurabilityLevel)GetRandomOldBonus(); } } } else if ( item is BaseInstrument ) { SlayerName slayer = SlayerName.None; if ( Core.AOS ) slayer = BaseRunicTool.GetRandomSlayer(); else slayer = SlayerGroup.GetLootSlayerType( from.GetType() ); if ( slayer == SlayerName.None ) { item.Delete(); return null; } BaseInstrument instr = (BaseInstrument)item; instr.Quality = InstrumentQuality.Regular; instr.Slayer = slayer; } if ( item.Stackable ) item.Amount = m_Quantity.Roll(); } return item; }
public InternalTarget( FireHorn horn ) : base(3, true, TargetFlags.Harmful) { m_Horn = horn; }
public Item Mutate( Mobile from, int luckChance, Item item ) { if ( item != null ) { if ( item is BaseWeapon && 1 > Utility.Random( 100 ) ) { item.Delete(); item = new FireHorn(); return item; } if ( item is BaseWeapon || item is BaseArmor || item is BaseJewel || item is BaseHat ) { int bonusProps = GetBonusProperties(); if ( bonusProps < m_MaxProps && LootPack.CheckLuck( luckChance ) ) ++bonusProps; int props = 1 + bonusProps; // Make sure we're not spawning items with 6 properties. if ( props > m_MaxProps ) props = m_MaxProps; if ( item is BaseWeapon ) BaseRunicTool.ApplyAttributesTo( (BaseWeapon) item, false, luckChance, props, m_MinIntensity, m_MaxIntensity ); else if ( item is BaseArmor ) BaseRunicTool.ApplyAttributesTo( (BaseArmor) item, false, luckChance, props, m_MinIntensity, m_MaxIntensity ); else if ( item is BaseJewel ) BaseRunicTool.ApplyAttributesTo( (BaseJewel) item, false, luckChance, props, m_MinIntensity, m_MaxIntensity ); else if ( item is BaseHat ) BaseRunicTool.ApplyAttributesTo( (BaseHat) item, false, luckChance, props, m_MinIntensity, m_MaxIntensity ); } else if ( item is BaseInstrument ) { SlayerName slayer = SlayerName.None; slayer = BaseRunicTool.GetRandomSlayer(); if ( slayer == SlayerName.None ) { item.Delete(); return null; } BaseInstrument instr = (BaseInstrument) item; instr.Slayer = slayer; } if ( item.Stackable ) item.Amount = m_Quantity.Roll(); } return item; }
public Item Mutate(Mobile from, int luckChance, Item item) { if (item != null) { if (item is BaseWeapon && 1 > Utility.Random(100)) { item.Delete(); item = new FireHorn(); return item; } if (item is BaseWeapon || item is BaseArmor || item is BaseJewel || item is BaseHat) { if (Core.AOS) { int bonusProps = this.GetBonusProperties(); int min = this.m_MinIntensity; int max = this.m_MaxIntensity; if (bonusProps < this.m_MaxProps && LootPack.CheckLuck(luckChance)) ++bonusProps; int props = 1 + bonusProps; // Make sure we're not spawning items with 6 properties. if (props > this.m_MaxProps) props = this.m_MaxProps; if (item is BaseWeapon) BaseRunicTool.ApplyAttributesTo((BaseWeapon)item, false, luckChance, props, this.m_MinIntensity, this.m_MaxIntensity); else if (item is BaseArmor) BaseRunicTool.ApplyAttributesTo((BaseArmor)item, false, luckChance, props, this.m_MinIntensity, this.m_MaxIntensity); else if (item is BaseJewel) BaseRunicTool.ApplyAttributesTo((BaseJewel)item, false, luckChance, props, this.m_MinIntensity, this.m_MaxIntensity); else if (item is BaseHat) BaseRunicTool.ApplyAttributesTo((BaseHat)item, false, luckChance, props, this.m_MinIntensity, this.m_MaxIntensity); } else // not aos { if (item is BaseWeapon) { BaseWeapon weapon = (BaseWeapon)item; if (80 > Utility.Random(100)) weapon.AccuracyLevel = (WeaponAccuracyLevel)this.GetRandomOldBonus(); if (60 > Utility.Random(100)) weapon.DamageLevel = (WeaponDamageLevel)this.GetRandomOldBonus(); if (40 > Utility.Random(100)) weapon.DurabilityLevel = (WeaponDurabilityLevel)this.GetRandomOldBonus(); if (5 > Utility.Random(100)) weapon.Slayer = SlayerName.Silver; if (from != null && weapon.AccuracyLevel == 0 && weapon.DamageLevel == 0 && weapon.DurabilityLevel == 0 && weapon.Slayer == SlayerName.None && 5 > Utility.Random(100)) weapon.Slayer = SlayerGroup.GetLootSlayerType(from.GetType()); } else if (item is BaseArmor) { BaseArmor armor = (BaseArmor)item; if (80 > Utility.Random(100)) armor.ProtectionLevel = (ArmorProtectionLevel)this.GetRandomOldBonus(); if (40 > Utility.Random(100)) armor.Durability = (ArmorDurabilityLevel)this.GetRandomOldBonus(); } } } else if (item is BaseInstrument) { SlayerName slayer = SlayerName.None; if (Core.AOS) slayer = BaseRunicTool.GetRandomSlayer(); else slayer = SlayerGroup.GetLootSlayerType(from.GetType()); if (slayer == SlayerName.None) { item.Delete(); return null; } BaseInstrument instr = (BaseInstrument)item; instr.Quality = InstrumentQuality.Regular; instr.Slayer = slayer; } if (item.Stackable) item.Amount = this.m_Quantity.Roll(); } return item; }
public Item Mutate( Mobile from, int luckChance, Item item ) { if ( item != null ) { if ( item is BaseWeapon && 1 > Utility.Random( 100 ) ) { item.Delete(); item = new FireHorn(); return item; } if ( item is BaseWeapon || item is BaseArmor || item is BaseJewel ) { if ( Core.AOS ) { int bonusProps = GetBonusProperties(); int min = m_MinIntensity; int max = m_MaxIntensity; if ( bonusProps < m_MaxProps && LootPack.CheckLuck( luckChance ) ) ++bonusProps; int props = 1 + bonusProps; if ( item is BaseWeapon ) BaseRunicTool.ApplyAttributesTo( (BaseWeapon)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity ); else if ( item is BaseArmor ) BaseRunicTool.ApplyAttributesTo( (BaseArmor)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity ); else if ( item is BaseJewel ) BaseRunicTool.ApplyAttributesTo( (BaseJewel)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity ); } else // not aos { if ( item is BaseWeapon ) { BaseWeapon weapon = (BaseWeapon)item; if ( 80 > Utility.Random( 100 ) ) weapon.AccuracyLevel = (WeaponAccuracyLevel)GetRandomOldBonus(); if ( 60 > Utility.Random( 100 ) ) weapon.DamageLevel = (WeaponDamageLevel)GetRandomOldBonus(); if ( 40 > Utility.Random( 100 ) ) weapon.DurabilityLevel = (WeaponDurabilityLevel)GetRandomOldBonus(); if ( 5 > Utility.Random( 100 ) ) weapon.Slayer = SlayerName.Silver; if ( 100 > Utility.Random( 100 ) ) { weapon.ChargedAbility = (WeaponChargedAbility)Utility.Random(Enum.GetValues(typeof(WeaponChargedAbility)).Length - 1)+1; weapon.AbilityCharges = Utility.Random(22) + 3; } if ( weapon.AccuracyLevel == 0 && weapon.DamageLevel == 0 && weapon.DurabilityLevel == 0 && weapon.Slayer == SlayerName.None && weapon.ChargedAbility == WeaponChargedAbility.Regular && 5 > Utility.Random( 100 ) ) weapon.Slayer = SlayerGroup.GetLootSlayerType( from.GetType() ); } else if ( item is BaseArmor ) { BaseArmor armor = (BaseArmor)item; if ( 80 > Utility.Random( 100 ) ) armor.ProtectionLevel = (ArmorProtectionLevel)GetRandomOldBonus(); if ( 40 > Utility.Random( 100 ) ) armor.Durability = (ArmorDurabilityLevel)GetRandomOldBonus(); } else if (item is BaseJewel) { BaseJewel jewel = (BaseJewel)item; jewel.ChargedAbility = (JewelChargedAbility)Utility.Random(Enum.GetValues(typeof(JewelChargedAbility)).Length - 1) + 1; jewel.AbilityCharges = Utility.Random(22) + 3; } } } else if ( item is BaseInstrument ) { SlayerName slayer = SlayerName.None; if ( Core.AOS ) slayer = BaseRunicTool.GetRandomSlayer(); else slayer = SlayerGroup.GetLootSlayerType( from.GetType() ); if ( slayer == SlayerName.None ) { item.Delete(); return null; } BaseInstrument instr = (BaseInstrument)item; instr.Quality = InstrumentQuality.Regular; instr.Slayer = slayer; } if ( item.Stackable ) item.Amount = m_Quantity.Roll(); } return item; }