public BaseQuiver( int itemID ) : base(itemID) { Weight = 2.0; Capacity = 500; Layer = Layer.Cloak; m_Attributes = new AosAttributes( this ); }
public ArmourBackpack() : base(0xE75) { Layer = Layer.Backpack; Weight = 3.0; m_AosAttributes = new AosAttributes( this ); m_AosArmorAttributes = new AosArmorAttributes( this ); m_AosSkillBonuses = new AosSkillBonuses( this ); }
private static void ApplyAttribute( AosAttributes attrs, int min, int max, AosAttribute attr, int low, int high, int scale ) { if ( attr == AosAttribute.CastSpeed ) attrs[attr] += Scale( min, max, low / scale, high / scale ) * scale; else attrs[attr] = Scale( min, max, low / scale, high / scale ) * scale; if ( attr == AosAttribute.SpellChanneling ) attrs[AosAttribute.CastSpeed] -= 1; }
public BaseQuiver(int itemID) : base(itemID) { this.Weight = 2.0; this.Capacity = 500; this.Layer = Layer.Cloak; this.m_Attributes = new AosAttributes(this); this.DamageIncrease = 10; }
public BaseJewel( int itemID, Layer layer ) : base(itemID) { m_AosAttributes = new AosAttributes( this ); m_AosResistances = new AosElementAttributes( this ); m_AosSkillBonuses = new AosSkillBonuses( this ); m_Resource = CraftResource.Iron; m_GemType = GemType.None; Layer = layer; }
public BaseOtherEquipable( int itemID ) : base(itemID) { m_Quality = CraftQuality.Regular; Resource = DefaultResource; m_AosAttributes = new AosAttributes( this ); m_AosArmorAttributes = new AosArmorAttributes( this ); m_AosSkillBonuses = new AosSkillBonuses( this ); m_OriginalWeight = Weight; }
public BaseJewel( int itemID, Layer layer ) : base(itemID) { m_AosAttributes = new AosAttributes( this ); m_AosResistances = new AosElementAttributes( this ); m_AosSkillBonuses = new AosSkillBonuses( this ); m_Resource = CraftResource.Iron; m_GemType = GemType.None; Layer = layer; m_HitPoints = m_MaxHitPoints = Utility.RandomMinMax( InitMinHits, InitMaxHits ); }
public BaseArmor( int itemID ) : base(itemID) { m_Quality = CraftQuality.Regular; m_Durability = DurabilityLevel.Regular; m_Crafter = null; m_HitPoints = m_MaxHitPoints = Utility.RandomMinMax( InitMinHits, InitMaxHits ); this.Layer = (Layer)ItemData.Quality; m_AosAttributes = new AosAttributes( this ); m_AosArmorAttributes = new AosArmorAttributes( this ); m_AosSkillBonuses = new AosSkillBonuses( this ); }
public BaseJewel(int itemID, Layer layer, JewelEffect effect, int minCharges, int maxCharges) : base(itemID) { m_AosAttributes = new AosAttributes( this ); m_AosResistances = new AosElementAttributes( this ); m_AosSkillBonuses = new AosSkillBonuses( this ); m_Resource = CraftResource.Iron; m_GemType = GemType.None; m_IDList = new List<Mobile>(); Layer = layer; Weight = 1.0; Effect = effect; Charges = Utility.RandomMinMax( minCharges, maxCharges ); m_Identified = false; }
public BaseClothing(int itemID, Layer layer, int hue) : base(itemID) { this.Layer = layer; this.Hue = hue; this.m_Resource = this.DefaultResource; this.m_Quality = ClothingQuality.Regular; this.m_HitPoints = this.m_MaxHitPoints = Utility.RandomMinMax(this.InitMinHits, this.InitMaxHits); this.m_AosAttributes = new AosAttributes(this); this.m_AosClothingAttributes = new AosArmorAttributes(this); this.m_AosSkillBonuses = new AosSkillBonuses(this); this.m_AosResistances = new AosElementAttributes(this); }
public BaseArmor(int itemID) : base(itemID) { this.m_Quality = ArmorQuality.Regular; this.m_Durability = ArmorDurabilityLevel.Regular; this.m_Crafter = null; this.m_Resource = this.DefaultResource; this.Hue = CraftResources.GetHue(this.m_Resource); this.m_HitPoints = this.m_MaxHitPoints = Utility.RandomMinMax(this.InitMinHits, this.InitMaxHits); this.Layer = (Layer)this.ItemData.Quality; this.m_AosAttributes = new AosAttributes(this); this.m_AosArmorAttributes = new AosArmorAttributes(this); this.m_AosSkillBonuses = new AosSkillBonuses(this); }
public BaseArmor( int itemID ) : base(itemID) { m_Quality = ArmorQuality.Regular; m_Durability = ArmorDurabilityLevel.Regular; m_Crafter = null; m_Resource = DefaultResource; Hue = CraftResources.GetHue( m_Resource ); m_HitPoints = m_MaxHitPoints = Utility.RandomMinMax( InitMinHits, InitMaxHits ); this.Layer = (Layer)ItemData.Quality; m_AosAttributes = new AosAttributes( this ); m_AosArmorAttributes = new AosArmorAttributes( this ); m_AosSkillBonuses = new AosSkillBonuses( this ); m_OriginalWeight = Weight; }
public BaseJewel( int itemID, Layer layer ) : base( itemID ) { m_AosAttributes = new AosAttributes( this ); m_AosResistances = new AosElementAttributes( this ); m_AosSkillBonuses = new AosSkillBonuses( this ); m_Resource = CraftResource.Iron; m_GemType = GemType.None; Layer = layer; // 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); }
public override void Deserialize(GenericReader reader) { base.Deserialize( reader ); int version = reader.ReadInt(); switch( version ) { case 12: case 11: case 10: case 9: case 8: case 7: case 6: case 5: { SaveFlag flags = (SaveFlag)reader.ReadEncodedInt(); if( GetSaveFlag( flags, SaveFlag.Attributes ) ) m_AosAttributes = new AosAttributes( this, reader ); else m_AosAttributes = new AosAttributes( this ); if( GetSaveFlag( flags, SaveFlag.ArmorAttributes ) ) m_AosArmorAttributes = new AosArmorAttributes( this, reader ); else m_AosArmorAttributes = new AosArmorAttributes( this ); if( GetSaveFlag( flags, SaveFlag.BluntBonus ) ) m_BluntBonus = reader.ReadEncodedInt(); if( GetSaveFlag( flags, SaveFlag.SlashingBonus ) ) m_SlashingBonus = reader.ReadEncodedInt(); if( GetSaveFlag( flags, SaveFlag.PiercingBonus ) ) m_PiercingBonus = reader.ReadEncodedInt(); if( GetSaveFlag( flags, SaveFlag.PhysicalBonus ) ) m_PhysicalBonus = reader.ReadEncodedInt(); if( GetSaveFlag( flags, SaveFlag.FireBonus ) ) m_FireBonus = reader.ReadEncodedInt(); if( GetSaveFlag( flags, SaveFlag.ColdBonus ) ) m_ColdBonus = reader.ReadEncodedInt(); if( GetSaveFlag( flags, SaveFlag.PoisonBonus ) ) m_PoisonBonus = reader.ReadEncodedInt(); if( GetSaveFlag( flags, SaveFlag.EnergyBonus ) ) m_EnergyBonus = reader.ReadEncodedInt(); if( GetSaveFlag( flags, SaveFlag.Identified ) ) m_Identified = ( version >= 7 || reader.ReadBool() ); if( GetSaveFlag( flags, SaveFlag.Protection ) ) { m_Protection = (ArmorProtectionLevel)reader.ReadEncodedInt(); if( m_Protection > ArmorProtectionLevel.Invulnerability ) m_Protection = ArmorProtectionLevel.Defense; } if( GetSaveFlag( flags, SaveFlag.BaseArmor ) ) m_ArmorBase = reader.ReadEncodedInt(); else m_ArmorBase = -1; if( GetSaveFlag( flags, SaveFlag.HitsMaxBonus ) ) m_HitsMaxBonus = reader.ReadEncodedInt(); else m_HitsMaxBonus = -1; if( GetSaveFlag( flags, SaveFlag.StamMaxBonus ) ) m_StamMaxBonus = reader.ReadEncodedInt(); else m_StamMaxBonus = -1; if( GetSaveFlag( flags, SaveFlag.ManaMaxBonus ) ) m_ManaMaxBonus = reader.ReadEncodedInt(); else m_ManaMaxBonus = -1; if( GetSaveFlag( flags, SaveFlag.StrBonus ) ) m_StrBonus = reader.ReadEncodedInt(); else m_StrBonus = -1; if( GetSaveFlag( flags, SaveFlag.DexBonus ) ) m_DexBonus = reader.ReadEncodedInt(); else m_DexBonus = -1; if( GetSaveFlag( flags, SaveFlag.IntBonus ) ) m_IntBonus = reader.ReadEncodedInt(); else m_IntBonus = -1; if( GetSaveFlag( flags, SaveFlag.StrReq ) ) m_StrReq = reader.ReadEncodedInt(); else m_StrReq = -1; if( GetSaveFlag( flags, SaveFlag.DexReq ) ) m_DexReq = reader.ReadEncodedInt(); else m_DexReq = -1; if( GetSaveFlag( flags, SaveFlag.IntReq ) ) m_IntReq = reader.ReadEncodedInt(); else m_IntReq = -1; if( GetSaveFlag( flags, SaveFlag.MedAllowance ) ) m_Meditate = (AMA)reader.ReadEncodedInt(); else m_Meditate = (AMA)( -1 ); if( GetSaveFlag( flags, SaveFlag.SkillBonuses ) ) m_AosSkillBonuses = new AosSkillBonuses( this, reader ); break; } case 4: { m_AosAttributes = new AosAttributes( this, reader ); m_AosArmorAttributes = new AosArmorAttributes( this, reader ); goto case 3; } case 3: { m_PhysicalBonus = reader.ReadInt(); m_FireBonus = reader.ReadInt(); m_ColdBonus = reader.ReadInt(); m_PoisonBonus = reader.ReadInt(); m_EnergyBonus = reader.ReadInt(); goto case 2; } case 2: case 1: { m_Identified = reader.ReadBool(); goto case 0; } case 0: { m_ArmorBase = reader.ReadInt(); m_Protection = (ArmorProtectionLevel)reader.ReadInt(); if( m_ArmorBase == RevertArmorBase ) m_ArmorBase = -1; reader.ReadInt(); if( version < 4 ) { m_AosAttributes = new AosAttributes( this ); m_AosArmorAttributes = new AosArmorAttributes( this ); } m_HitsMaxBonus = reader.ReadInt(); m_StamMaxBonus = reader.ReadInt(); m_ManaMaxBonus = reader.ReadInt(); m_StrBonus = reader.ReadInt(); m_DexBonus = reader.ReadInt(); m_IntBonus = reader.ReadInt(); m_StrReq = reader.ReadInt(); m_DexReq = reader.ReadInt(); m_IntReq = reader.ReadInt(); if( m_HitsMaxBonus == OldHitsMaxBonus ) m_HitsMaxBonus = -1; if( m_StamMaxBonus == OldStamMaxBonus ) m_StamMaxBonus = -1; if( m_ManaMaxBonus == OldManaMaxBonus ) m_ManaMaxBonus = -1; if( m_StrBonus == OldStrBonus ) m_StrBonus = -1; if( m_DexBonus == OldDexBonus ) m_DexBonus = -1; if( m_IntBonus == OldIntBonus ) m_IntBonus = -1; if( m_StrReq == OldStrReq ) m_StrReq = -1; if( m_DexReq == OldDexReq ) m_DexReq = -1; if( m_IntReq == OldIntReq ) m_IntReq = -1; m_Meditate = (AMA)reader.ReadInt(); if( m_Meditate == OldMedAllowance ) m_Meditate = (AMA)( -1 ); break; } } if( m_AosSkillBonuses == null ) m_AosSkillBonuses = new AosSkillBonuses( this ); if( Core.AOS && Parent is Mobile ) m_AosSkillBonuses.AddTo( (Mobile)Parent ); int hitsmaxBonus = ComputeStatBonus( StatType.HitsMax ); int stammaxBonus = ComputeStatBonus( StatType.StamMax ); int manamaxBonus = ComputeStatBonus( StatType.ManaMax ); int strBonus = ComputeStatBonus( StatType.Str ); int dexBonus = ComputeStatBonus( StatType.Dex ); int intBonus = ComputeStatBonus( StatType.Int ); if( Parent is Mobile && ( strBonus != 0 || dexBonus != 0 || intBonus != 0 || hitsmaxBonus != 0 || stammaxBonus != 0 || manamaxBonus != 0 ) ) { Mobile m = (Mobile)Parent; string modName = Serial.ToString(); if( hitsmaxBonus != 0 ) m.AddStatMod( new StatMod( StatType.HitsMax, modName + "HitsMax", hitsmaxBonus, TimeSpan.Zero ) ); if( stammaxBonus != 0 ) m.AddStatMod( new StatMod( StatType.StamMax, modName + "StamMax", stammaxBonus, TimeSpan.Zero ) ); if( manamaxBonus != 0 ) m.AddStatMod( new StatMod( StatType.ManaMax, modName + "ManaMax", manamaxBonus, TimeSpan.Zero ) ); 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( version < 12 ) { if( this.ParentEntity != null && this.ParentEntity is PlayerMobile ) { PlayerMobile pm = this.ParentEntity as PlayerMobile; Attributes.WeaponSpeed = 0; Attributes.WeaponDamage = 0; Attributes.AttackChance = 0; Attributes.DefendChance = 0; } } }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 5: { m_Quality = (BookQuality)reader.ReadByte(); goto case 4; } case 4: { m_EngravedText = reader.ReadString(); goto case 3; } case 3: { m_Crafter = reader.ReadMobile(); goto case 2; } case 2: { m_Slayer = (SlayerName)reader.ReadInt(); m_Slayer2 = (SlayerName)reader.ReadInt(); goto case 1; } case 1: { m_AosAttributes = new AosAttributes(this, reader); m_AosSkillBonuses = new AosSkillBonuses(this, reader); goto case 0; } case 0: { m_Content = reader.ReadULong(); m_Count = reader.ReadInt(); break; } } if (m_AosAttributes == null) { m_AosAttributes = new AosAttributes(this); } if (m_AosSkillBonuses == null) { m_AosSkillBonuses = new AosSkillBonuses(this); } 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(); } }
public BaseTalisman(int itemID) : base(itemID) { this.Layer = Layer.Talisman; this.Weight = 1.0; this.m_HitPoints = this.m_MaxHitPoints = Utility.RandomMinMax(this.InitMinHits, this.InitMaxHits); this.m_Protection = new TalismanAttribute(); this.m_Killer = new TalismanAttribute(); this.m_Summoner = new TalismanAttribute(); this.m_AosAttributes = new AosAttributes(this); this.m_AosSkillBonuses = new AosSkillBonuses(this); }
public static void ApplyAttributesTo(BaseArmor armor, bool isRunicTool, int luckChance, int attributeCount, int min, int max) { m_IsRunicTool = isRunicTool; m_LuckChance = luckChance; AosAttributes primary = armor.Attributes; AosArmorAttributes secondary = armor.ArmorAttributes; m_Props.SetAll(false); bool isShield = (armor is BaseShield); int baseCount = (isShield ? 7 : 20); int baseOffset = (isShield ? 0 : 4); if (!isShield && armor.MeditationAllowance == ArmorMeditationAllowance.All) { m_Props.Set(3, true); // remove mage armor from possible properties } for (int i = 0; i < attributeCount; ++i) { int random = GetUniqueRandom(baseCount); if (random == -1) { break; } random += baseOffset; switch (random) { /* Begin Sheilds */ case 0: ApplyAttribute(primary, min, max, AosAttribute.SpellChanneling, 1, 1); break; case 1: ApplyAttribute(primary, min, max, AosAttribute.DefendChance, 1, 15); break; case 2: ApplyAttribute(primary, min, max, AosAttribute.AttackChance, 1, 15); break; case 3: ApplyAttribute(primary, min, max, AosAttribute.CastSpeed, 1, 1); break; /* Begin Armor */ case 4: ApplyAttribute(secondary, min, max, AosArmorAttribute.LowerStatReq, 10, 100, 10); break; case 5: ApplyAttribute(secondary, min, max, AosArmorAttribute.SelfRepair, 1, 5); break; case 6: ApplyAttribute(secondary, min, max, AosArmorAttribute.DurabilityBonus, 10, 100, 10); break; /* End Shields */ case 7: ApplyAttribute(secondary, min, max, AosArmorAttribute.MageArmor, 1, 1); break; case 8: ApplyAttribute(primary, min, max, AosAttribute.RegenHits, 1, 2); break; case 9: ApplyAttribute(primary, min, max, AosAttribute.RegenStam, 1, 3); break; case 10: ApplyAttribute(primary, min, max, AosAttribute.RegenMana, 1, 2); break; case 11: ApplyAttribute(primary, min, max, AosAttribute.NightSight, 1, 1); break; case 12: ApplyAttribute(primary, min, max, AosAttribute.BonusHits, 1, 5); break; case 13: ApplyAttribute(primary, min, max, AosAttribute.BonusStam, 1, 8); break; case 14: ApplyAttribute(primary, min, max, AosAttribute.BonusMana, 1, 8); break; case 15: ApplyAttribute(primary, min, max, AosAttribute.LowerManaCost, 1, 8); break; case 16: ApplyAttribute(primary, min, max, AosAttribute.LowerRegCost, 1, 20); break; case 17: ApplyAttribute(primary, min, max, AosAttribute.Luck, 1, 100); break; case 18: ApplyAttribute(primary, min, max, AosAttribute.ReflectPhysical, 1, 15); break; case 19: ApplyResistance(armor, min, max, ResistanceType.Physical, 1, 15); break; case 20: ApplyResistance(armor, min, max, ResistanceType.Fire, 1, 15); break; case 21: ApplyResistance(armor, min, max, ResistanceType.Cold, 1, 15); break; case 22: ApplyResistance(armor, min, max, ResistanceType.Poison, 1, 15); break; case 23: ApplyResistance(armor, min, max, ResistanceType.Energy, 1, 15); break; /* End Armor */ } } }
public static void ApplyAttributesTo(BaseWeapon weapon, bool playerMade, int luckChance, int attributeCount, int min, int max) { int delta; if (min > max) { delta = min; min = max; max = delta; } if (!playerMade && RandomItemGenerator.Enabled) { RandomItemGenerator.GenerateRandomItem(weapon, luckChance, attributeCount, min, max); return; } m_PlayerMade = playerMade; m_LuckChance = luckChance; AosAttributes primary = weapon.Attributes; AosWeaponAttributes secondary = weapon.WeaponAttributes; m_Props.SetAll(false); if (weapon is BaseRanged) { m_Props.Set(2, true); // ranged weapons cannot be ubws or mageweapon } else { m_Props.Set(25, true); // Only bows can be Balanced m_Props.Set(26, true); // Only bows have Velocity } for (int i = 0; i < attributeCount; ++i) { int random = GetUniqueRandom(27); if (random == -1) { break; } switch (random) { case 0: { switch (Utility.Random(5)) { case 0: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitPhysicalArea, 2, 50, 2); break; case 1: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitFireArea, 2, 50, 2); break; case 2: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitColdArea, 2, 50, 2); break; case 3: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitPoisonArea, 2, 50, 2); break; case 4: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitEnergyArea, 2, 50, 2); break; } break; } case 1: { switch (Utility.Random(4)) { case 0: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitMagicArrow, 2, 50, 2); break; case 1: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitHarm, 2, 50, 2); break; case 2: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitFireball, 2, 50, 2); break; case 3: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLightning, 2, 50, 2); break; } break; } case 2: { switch (Utility.Random(2)) { case 0: ApplyAttribute(secondary, min, max, AosWeaponAttribute.UseBestSkill, 1, 1); break; case 1: ApplyAttribute(secondary, min, max, AosWeaponAttribute.MageWeapon, 1, 10); break; } break; } case 3: int dmgMin = primary.WeaponDamage; int dmgMax = Math.Max(dmgMin, 50); primary.WeaponDamage = 0; ApplyAttribute(primary, min, max, AosAttribute.WeaponDamage, dmgMin, dmgMax); break; case 4: ApplyAttribute(primary, min, max, AosAttribute.DefendChance, 1, 15); break; case 5: ApplyAttribute(primary, min, max, AosAttribute.CastSpeed, 1, 1); break; case 6: ApplyAttribute(primary, min, max, AosAttribute.AttackChance, 1, 15); break; case 7: ApplyAttribute(primary, min, max, AosAttribute.Luck, 1, 100); break; case 8: ApplyAttribute(primary, min, max, AosAttribute.WeaponSpeed, 5, 30, 5); break; case 9: ApplyAttribute(primary, min, max, AosAttribute.SpellChanneling, 1, 1); break; case 10: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitDispel, 2, 50, 2); break; case 11: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLeechHits, 2, ItemPropertyInfo.GetMaxIntensity(weapon, AosWeaponAttribute.HitLeechHits), 2); break; case 12: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLowerAttack, 2, 50, 2); break; case 13: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLowerDefend, 2, 50, 2); break; case 14: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLeechMana, 2, ItemPropertyInfo.GetMaxIntensity(weapon, AosWeaponAttribute.HitLeechMana), 2); break; case 15: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLeechStam, 2, 50, 2); break; case 16: ApplyAttribute(secondary, min, max, AosWeaponAttribute.LowerStatReq, 10, 100, 10); break; case 17: ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistPhysicalBonus, 1, 15); break; case 18: ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistFireBonus, 1, 15); break; case 19: ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistColdBonus, 1, 15); break; case 20: ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistPoisonBonus, 1, 15); break; case 21: ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistEnergyBonus, 1, 15); break; case 22: ApplyAttribute(secondary, min, max, AosWeaponAttribute.DurabilityBonus, 10, 100, 10); break; case 23: weapon.Slayer = GetRandomSlayer(); break; case 24: ApplyElementalDamage(weapon, min, max); break; case 25: ((BaseRanged)weapon).Balanced = true; break; case 26: ApplyVelocityAttribute((BaseRanged)weapon, min, max, 2, 50, 2); break; } } }
public BaseTalisman(int itemID) : base(itemID) { Layer = Layer.Talisman; Weight = 1.0; m_Protection = new TalismanAttribute(); m_Killer = new TalismanAttribute(); m_Summoner = new TalismanAttribute(); m_AosAttributes = new AosAttributes(this); m_AosSkillBonuses = new AosSkillBonuses(this); }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 0: { SaveFlag flags = (SaveFlag)reader.ReadEncodedInt(); if (GetSaveFlag(flags, SaveFlag.Attributes)) { this.m_AosAttributes = new AosAttributes(this, reader); } else { this.m_AosAttributes = new AosAttributes(this); } if (GetSaveFlag(flags, SaveFlag.SkillBonuses)) { this.m_AosSkillBonuses = new AosSkillBonuses(this, reader); } else { this.m_AosSkillBonuses = new AosSkillBonuses(this); } // Backward compatibility if (GetSaveFlag(flags, SaveFlag.Owner)) { this.BlessedFor = reader.ReadMobile(); } if (GetSaveFlag(flags, SaveFlag.Protection)) { this.m_Protection = new TalismanAttribute(reader); } else { this.m_Protection = new TalismanAttribute(); } if (GetSaveFlag(flags, SaveFlag.Killer)) { this.m_Killer = new TalismanAttribute(reader); } else { this.m_Killer = new TalismanAttribute(); } if (GetSaveFlag(flags, SaveFlag.Summoner)) { this.m_Summoner = new TalismanAttribute(reader); } else { this.m_Summoner = new TalismanAttribute(); } if (GetSaveFlag(flags, SaveFlag.Removal)) { this.m_Removal = (TalismanRemoval)reader.ReadEncodedInt(); } if (GetSaveFlag(flags, SaveFlag.OldKarmaLoss)) { this.m_AosAttributes.IncreasedKarmaLoss = reader.ReadEncodedInt(); } if (GetSaveFlag(flags, SaveFlag.Skill)) { this.m_Skill = (SkillName)reader.ReadEncodedInt(); } if (GetSaveFlag(flags, SaveFlag.SuccessBonus)) { this.m_SuccessBonus = reader.ReadEncodedInt(); } if (GetSaveFlag(flags, SaveFlag.ExceptionalBonus)) { this.m_ExceptionalBonus = reader.ReadEncodedInt(); } if (GetSaveFlag(flags, SaveFlag.MaxCharges)) { this.m_MaxCharges = reader.ReadEncodedInt(); } if (GetSaveFlag(flags, SaveFlag.Charges)) { this.m_Charges = reader.ReadEncodedInt(); } if (GetSaveFlag(flags, SaveFlag.MaxChargeTime)) { this.m_MaxChargeTime = reader.ReadEncodedInt(); } if (GetSaveFlag(flags, SaveFlag.ChargeTime)) { this.m_ChargeTime = reader.ReadEncodedInt(); } if (GetSaveFlag(flags, SaveFlag.Slayer)) { this.m_Slayer = (TalismanSlayerName)reader.ReadEncodedInt(); } this.m_Blessed = GetSaveFlag(flags, SaveFlag.Blessed); break; } } if (this.Parent is Mobile) { Mobile m = (Mobile)this.Parent; this.m_AosAttributes.AddStatBonuses(m); this.m_AosSkillBonuses.AddTo(m); if (this.m_ChargeTime > 0) { this.StartTimer(); } } }
private static TimeSpan Mobile_HitsRegenRate(Mobile from) { int points = AosAttributes.GetValue(from, AosAttribute.RegenHits); if (from is BaseCreature && !((BaseCreature)from).IsAnimatedDead) { points += 4; } if ((from is BaseCreature && ((BaseCreature)from).IsParagon) || from is Leviathan) { points += 40; } if (Core.ML && from.Race == Race.Human) //Is this affected by the cap? { points += 2; } if (points < 0) { points = 0; } if (Core.ML && from is PlayerMobile) //does racial bonus go before/after? { points = Math.Min(points, 18); } if (CheckTransform(from, typeof(HorrificBeastSpell))) { points += 20; } if (from is BaseCreature && ((BaseCreature)from).HumilityBuff > 0) { switch (((BaseCreature)@from).HumilityBuff) { case 1: points += 10; break; case 2: points += 20; break; case 3: points += 30; break; } } if (CheckAnimal(from, typeof(Dog)) || CheckAnimal(from, typeof(Cat))) { points += from.Skills[SkillName.Ninjitsu].Fixed / 30; } if (Core.AOS) { foreach (RegenBonusHandler handler in HitsBonusHandlers) { points += handler(from); } } return(TimeSpan.FromSeconds(1.0 / (0.1 * (1 + points)))); }
private static TimeSpan Mobile_ManaRegenRate(Mobile from) { if (from.Skills == null) { return(Mobile.DefaultManaRate); } if (!from.Meditating) { CheckBonusSkill(from, from.Mana, from.ManaMax, SkillName.Meditation); } double rate; double armorPenalty = GetArmorOffset(from); if (Core.AOS) { double medPoints = from.Int + (from.Skills[SkillName.Meditation].Value * 3); medPoints *= (from.Skills[SkillName.Meditation].Value < 100.0) ? 0.025 : 0.0275; CheckBonusSkill(from, from.Mana, from.ManaMax, SkillName.Focus); double focusPoints = (from.Skills[SkillName.Focus].Value * 0.05); if (armorPenalty > 0) { medPoints = 0; // In AOS, wearing any meditation-blocking armor completely removes meditation bonus } double totalPoints = focusPoints + medPoints + (from.Meditating ? (medPoints > 13.0 ? 13.0 : medPoints) : 0.0); if ((from is BaseCreature && ((BaseCreature)from).IsParagon) || from is Leviathan) { totalPoints += 40; } int cappedPoints = AosAttributes.GetValue(from, AosAttribute.RegenMana); if (CheckTransform(from, typeof(VampiricEmbraceSpell))) { cappedPoints += 3; } else if (CheckTransform(from, typeof(LichFormSpell))) { cappedPoints += 13; } if (Core.ML && from is PlayerMobile) { cappedPoints = Math.Min(cappedPoints, 18); } totalPoints += cappedPoints; if (from is PlayerMobile && ((PlayerMobile)from).Race == Race.Gargoyle) { totalPoints += 2; } if (totalPoints < -1) { totalPoints = -1; } if (Core.ML) { totalPoints = Math.Floor(totalPoints); } foreach (RegenBonusHandler handler in ManaBonusHandlers) { totalPoints += handler(from); } rate = 1.0 / (0.1 * (2 + totalPoints)); } else { double medPoints = (from.Int + from.Skills[SkillName.Meditation].Value) * 0.5; if (medPoints <= 0) { rate = 7.0; } else if (medPoints <= 100) { rate = 7.0 - (239 * medPoints / 2400) + (19 * medPoints * medPoints / 48000); } else if (medPoints < 120) { rate = 1.0; } else { rate = 0.75; } rate += armorPenalty; if (from.Meditating) { rate *= 0.5; } if (rate < 0.5) { rate = 0.5; } else if (rate > 7.0) { rate = 7.0; } } return(TimeSpan.FromSeconds(rate)); }
public static void ApplyAttributesTo(Spellbook spellbook, bool playerMade, int luckChance, int attributeCount, int min, int max) { int delta; if (min > max) { delta = min; min = max; max = delta; } m_PlayerMade = playerMade; m_LuckChance = luckChance; AosAttributes primary = spellbook.Attributes; AosSkillBonuses skills = spellbook.SkillBonuses; m_Props.SetAll(false); for (int i = 0; i < attributeCount; ++i) { int random = GetUniqueRandom(16); if (random == -1) { break; } switch (random) { case 0: case 1: case 2: case 3: { ApplyAttribute(primary, min, max, AosAttribute.BonusInt, 1, 8); for (int j = 0; j < 4; ++j) { m_Props.Set(j, true); } break; } case 4: ApplyAttribute(primary, min, max, AosAttribute.BonusMana, 1, 8); break; case 5: ApplyAttribute(primary, min, max, AosAttribute.CastSpeed, 1, 1); break; case 6: ApplyAttribute(primary, min, max, AosAttribute.CastRecovery, 1, 3); break; case 7: ApplyAttribute(primary, min, max, AosAttribute.SpellDamage, 1, 12); break; case 8: ApplySkillBonus(skills, min, max, 0, 1, 15); break; case 9: ApplySkillBonus(skills, min, max, 1, 1, 15); break; case 10: ApplySkillBonus(skills, min, max, 2, 1, 15); break; case 11: ApplySkillBonus(skills, min, max, 3, 1, 15); break; case 12: ApplyAttribute(primary, min, max, AosAttribute.LowerRegCost, 1, 20); break; case 13: ApplyAttribute(primary, min, max, AosAttribute.LowerManaCost, 1, 8); break; case 14: ApplyAttribute(primary, min, max, AosAttribute.RegenMana, 1, 2); break; case 15: spellbook.Slayer = GetRandomSlayer(); break; } } }
public static void ApplyAttributesTo(BaseJewel jewelry, bool playerMade, int luckChance, int attributeCount, int min, int max) { int delta; if (min > max) { delta = min; min = max; max = delta; } if (!playerMade && RandomItemGenerator.Enabled) { RandomItemGenerator.GenerateRandomItem(jewelry, luckChance, attributeCount, min, max); return; } m_PlayerMade = playerMade; m_LuckChance = luckChance; AosAttributes primary = jewelry.Attributes; AosElementAttributes resists = jewelry.Resistances; AosSkillBonuses skills = jewelry.SkillBonuses; m_Props.SetAll(false); for (int i = 0; i < attributeCount; ++i) { int random = GetUniqueRandom(24); if (random == -1) { break; } switch (random) { case 0: ApplyAttribute(resists, min, max, AosElementAttribute.Physical, 1, 15); break; case 1: ApplyAttribute(resists, min, max, AosElementAttribute.Fire, 1, 15); break; case 2: ApplyAttribute(resists, min, max, AosElementAttribute.Cold, 1, 15); break; case 3: ApplyAttribute(resists, min, max, AosElementAttribute.Poison, 1, 15); break; case 4: ApplyAttribute(resists, min, max, AosElementAttribute.Energy, 1, 15); break; case 5: ApplyAttribute(primary, min, max, AosAttribute.WeaponDamage, 1, 25); break; case 6: ApplyAttribute(primary, min, max, AosAttribute.DefendChance, 1, 15); break; case 7: ApplyAttribute(primary, min, max, AosAttribute.AttackChance, 1, 15); break; case 8: ApplyAttribute(primary, min, max, AosAttribute.BonusStr, 1, 8); break; case 9: ApplyAttribute(primary, min, max, AosAttribute.BonusDex, 1, 8); break; case 10: ApplyAttribute(primary, min, max, AosAttribute.BonusInt, 1, 8); break; case 11: ApplyAttribute(primary, min, max, AosAttribute.EnhancePotions, 5, 25, 5); break; case 12: ApplyAttribute(primary, min, max, AosAttribute.CastSpeed, 1, 1); break; case 13: ApplyAttribute(primary, min, max, AosAttribute.CastRecovery, 1, 3); break; case 14: ApplyAttribute(primary, min, max, AosAttribute.LowerManaCost, 1, 8); break; case 15: ApplyAttribute(primary, min, max, AosAttribute.LowerRegCost, 1, 20); break; case 16: ApplyAttribute(primary, min, max, AosAttribute.Luck, 1, 100); break; case 17: ApplyAttribute(primary, min, max, AosAttribute.SpellDamage, 1, 12); break; case 18: ApplyAttribute(primary, min, max, AosAttribute.NightSight, 1, 1); break; case 19: ApplySkillBonus(skills, min, max, 0, 1, 15); break; case 20: ApplySkillBonus(skills, min, max, 1, 1, 15); break; case 21: ApplySkillBonus(skills, min, max, 2, 1, 15); break; case 22: ApplySkillBonus(skills, min, max, 3, 1, 15); break; case 23: ApplySkillBonus(skills, min, max, 4, 1, 15); break; } } }
public static void ApplyAttributesTo(BaseHat hat, bool playerMade, int luckChance, int attributeCount, int min, int max) { int delta; if (min > max) { delta = min; min = max; max = delta; } if (!playerMade && RandomItemGenerator.Enabled) { RandomItemGenerator.GenerateRandomItem(hat, luckChance, attributeCount, min, max); return; } m_PlayerMade = playerMade; m_LuckChance = luckChance; AosAttributes primary = hat.Attributes; AosArmorAttributes secondary = hat.ClothingAttributes; AosElementAttributes resists = hat.Resistances; m_Props.SetAll(false); for (int i = 0; i < attributeCount; ++i) { int random = GetUniqueRandom(19); if (random == -1) { break; } switch (random) { case 0: ApplyAttribute(primary, min, max, AosAttribute.ReflectPhysical, 1, 15); break; case 1: ApplyAttribute(primary, min, max, AosAttribute.RegenHits, 1, 2); break; case 2: ApplyAttribute(primary, min, max, AosAttribute.RegenStam, 1, 3); break; case 3: ApplyAttribute(primary, min, max, AosAttribute.RegenMana, 1, 2); break; case 4: ApplyAttribute(primary, min, max, AosAttribute.NightSight, 1, 1); break; case 5: ApplyAttribute(primary, min, max, AosAttribute.BonusHits, 1, 5); break; case 6: ApplyAttribute(primary, min, max, AosAttribute.BonusStam, 1, 8); break; case 7: ApplyAttribute(primary, min, max, AosAttribute.BonusMana, 1, 8); break; case 8: ApplyAttribute(primary, min, max, AosAttribute.LowerManaCost, 1, 8); break; case 9: ApplyAttribute(primary, min, max, AosAttribute.LowerRegCost, 1, 20); break; case 10: ApplyAttribute(primary, min, max, AosAttribute.Luck, 1, 100); break; case 11: ApplyAttribute(secondary, min, max, AosArmorAttribute.LowerStatReq, 10, 100, 10); break; case 12: ApplyAttribute(secondary, min, max, AosArmorAttribute.SelfRepair, 1, 5); break; case 13: ApplyAttribute(secondary, min, max, AosArmorAttribute.DurabilityBonus, 10, 100, 10); break; case 14: ApplyAttribute(resists, min, max, AosElementAttribute.Physical, 1, 15); break; case 15: ApplyAttribute(resists, min, max, AosElementAttribute.Fire, 1, 15); break; case 16: ApplyAttribute(resists, min, max, AosElementAttribute.Cold, 1, 15); break; case 17: ApplyAttribute(resists, min, max, AosElementAttribute.Poison, 1, 15); break; case 18: ApplyAttribute(resists, min, max, AosElementAttribute.Energy, 1, 15); break; } } }
public static void ApplyAttributesTo(BaseArmor armor, bool playerMade, int luckChance, int attributeCount, int min, int max) { int delta; if (min > max) { delta = min; min = max; max = delta; } if (!playerMade && RandomItemGenerator.Enabled) { RandomItemGenerator.GenerateRandomItem(armor, luckChance, attributeCount, min, max); return; } m_PlayerMade = playerMade; m_LuckChance = luckChance; AosAttributes primary = armor.Attributes; AosArmorAttributes secondary = armor.ArmorAttributes; m_Props.SetAll(false); bool isShield = (armor is BaseShield); int baseCount = (isShield ? 7 : 20); int baseOffset = (isShield ? 0 : 4); if (!isShield && armor.MeditationAllowance == ArmorMeditationAllowance.All) { m_Props.Set(3, true); // remove mage armor from possible properties } if (armor.Resource >= CraftResource.RegularLeather && armor.Resource <= CraftResource.BarbedLeather) { m_Props.Set(0, true); // remove lower requirements from possible properties for leather armor m_Props.Set(2, true); // remove durability bonus from possible properties } if (Race.Elf.ValidateEquipment(armor)) { m_Props.Set(7, true); // elves inherently have night sight and elf only armor doesn't get night sight as a mod } for (int i = 0; i < attributeCount; ++i) { int random = GetUniqueRandom(baseCount); if (random == -1) { break; } random += baseOffset; switch (random) { /* Begin Sheilds */ case 0: ApplyAttribute(primary, min, max, AosAttribute.SpellChanneling, 1, 1); break; case 1: ApplyAttribute(primary, min, max, AosAttribute.DefendChance, 1, 15); break; case 2: ApplyAttribute(primary, min, max, AosAttribute.ReflectPhysical, 1, 15); break; case 3: ApplyAttribute(primary, min, max, AosAttribute.CastSpeed, 1, 1); break; /* Begin Armor */ case 4: ApplyAttribute(secondary, min, max, AosArmorAttribute.LowerStatReq, 10, 100, 10); break; case 5: ApplyAttribute(secondary, min, max, AosArmorAttribute.SelfRepair, 1, 5); break; case 6: ApplyAttribute(secondary, min, max, AosArmorAttribute.DurabilityBonus, 10, 100, 10); break; /* End Shields */ case 7: ApplyAttribute(secondary, min, max, AosArmorAttribute.MageArmor, 1, 1); break; case 8: ApplyAttribute(primary, min, max, AosAttribute.RegenHits, 1, 2); break; case 9: ApplyAttribute(primary, min, max, AosAttribute.RegenStam, 1, 3); break; case 10: ApplyAttribute(primary, min, max, AosAttribute.RegenMana, 1, 2); break; case 11: ApplyAttribute(primary, min, max, AosAttribute.NightSight, 1, 1); break; case 12: ApplyAttribute(primary, min, max, AosAttribute.BonusHits, 1, 5); break; case 13: ApplyAttribute(primary, min, max, AosAttribute.BonusStam, 1, 8); break; case 14: ApplyAttribute(primary, min, max, AosAttribute.BonusMana, 1, 8); break; case 15: ApplyAttribute(primary, min, max, AosAttribute.LowerManaCost, 1, 8); break; case 16: ApplyAttribute(primary, min, max, AosAttribute.LowerRegCost, 1, 20); break; case 17: ApplyAttribute(primary, min, max, AosAttribute.Luck, 1, 100); break; case 18: ApplyAttribute(primary, min, max, AosAttribute.ReflectPhysical, 1, 15); break; case 19: ApplyResistance(armor, min, max, ResistanceType.Physical, 1, 15); break; case 20: ApplyResistance(armor, min, max, ResistanceType.Fire, 1, 15); break; case 21: ApplyResistance(armor, min, max, ResistanceType.Cold, 1, 15); break; case 22: ApplyResistance(armor, min, max, ResistanceType.Poison, 1, 15); break; case 23: ApplyResistance(armor, min, max, ResistanceType.Energy, 1, 15); break; /* End Armor */ } } }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 7: { this.m_IsImbued = reader.ReadBool(); goto case 6; } case 6: { m_NegativeAttributes = new NegativeAttributes(this, reader); goto case 5; } case 5: { #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_GorgonLenseCharges = reader.ReadInt(); m_GorgonLenseType = (LenseType)reader.ReadInt(); goto case 4; } case 4: { this.m_TimesImbued = reader.ReadEncodedInt(); this.m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this, reader); #endregion this.m_BlessedBy = reader.ReadMobile(); this.m_LastEquipped = reader.ReadBool(); this.m_SetEquipped = reader.ReadBool(); this.m_SetHue = reader.ReadEncodedInt(); this.m_SetAttributes = new AosAttributes(this, reader); this.m_SetSkillBonuses = new AosSkillBonuses(this, reader); this.m_Crafter = reader.ReadMobile(); this.m_Quality = (ArmorQuality)reader.ReadInt(); goto case 3; } case 3: { this.m_MaxHitPoints = reader.ReadEncodedInt(); this.m_HitPoints = reader.ReadEncodedInt(); goto case 2; } case 2: { this.m_Resource = (CraftResource)reader.ReadEncodedInt(); this.m_GemType = (GemType)reader.ReadEncodedInt(); goto case 1; } case 1: { this.m_AosAttributes = new AosAttributes(this, reader); this.m_AosResistances = new AosElementAttributes(this, reader); this.m_AosSkillBonuses = new AosSkillBonuses(this, reader); if (Core.AOS && this.Parent is Mobile) this.m_AosSkillBonuses.AddTo((Mobile)this.Parent); int strBonus = this.m_AosAttributes.BonusStr; int dexBonus = this.m_AosAttributes.BonusDex; int intBonus = this.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 (this.Parent is Mobile) ((Mobile)this.Parent).CheckStatTimers(); break; } case 0: { this.m_AosAttributes = new AosAttributes(this); this.m_AosResistances = new AosElementAttributes(this); this.m_AosSkillBonuses = new AosSkillBonuses(this); break; } } if (m_NegativeAttributes == null) m_NegativeAttributes = new NegativeAttributes(this); #region Mondain's Legacy Sets if (this.m_SetAttributes == null) this.m_SetAttributes = new AosAttributes(this); if (this.m_SetSkillBonuses == null) this.m_SetSkillBonuses = new AosSkillBonuses(this); #endregion if (version < 2) { this.m_Resource = CraftResource.Iron; this.m_GemType = GemType.None; } }
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); }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 3: { m_AosAttributes = new AosAttributes(this, reader); m_AosClothingAttributes = new AosArmorAttributes(this, reader); m_AosSkillBonuses = new AosSkillBonuses(this, reader); m_AosResistances = new AosElementAttributes(this, reader); goto case 2; } case 2: { m_PlayerConstructed = reader.ReadBool(); goto case 1; } case 1: { m_Crafter = reader.ReadMobile(); m_Quality = (ClothingQuality)reader.ReadInt(); break; } case 0: { m_Crafter = null; m_Quality = ClothingQuality.Regular; break; } } if (version < 2) { m_PlayerConstructed = true; // we don't know, so, assume it's crafted } if (version < 3) { m_AosAttributes = new AosAttributes(this); m_AosClothingAttributes = new AosArmorAttributes(this); m_AosSkillBonuses = new AosSkillBonuses(this); m_AosResistances = new AosElementAttributes(this); } Mobile parent = Parent as Mobile; if (parent != null) { if (Core.AOS) { m_AosSkillBonuses.AddTo(parent); } AddStatBonuses(parent); parent.CheckStatTimers(); } }
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 } }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 2: m_OriginalHue = reader.ReadInt(); int idx = reader.ReadInt(); m_BaitType = FishInfo.GetTypeFromIndex(idx); m_HookType = (HookType)reader.ReadInt(); m_HookUses = reader.ReadInt(); m_BaitUses = reader.ReadInt(); m_EnhancedBait = reader.ReadBool(); SaveFlag flags = (SaveFlag)reader.ReadInt(); if (GetSaveFlag(flags, SaveFlag.xAttributes)) { m_AosAttributes = new AosAttributes(this, reader); } else { m_AosAttributes = new AosAttributes(this); } if (GetSaveFlag(flags, SaveFlag.SkillBonuses)) { m_AosSkillBonuses = new AosSkillBonuses(this, reader); } else { m_AosSkillBonuses = new AosSkillBonuses(this); } break; case 1: m_AosAttributes = new AosAttributes(this); m_AosSkillBonuses = new AosSkillBonuses(this); 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_BaitType != null && m_BaitUses <= 0) { BaitType = null; } if (m_HookType != HookType.None && m_HookUses <= 0) { HookType = HookType.None; } }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 5: { SaveFlag flags = (SaveFlag)reader.ReadEncodedInt(); if (GetSaveFlag(flags, SaveFlag.Resource)) { m_Resource = (CraftResource)reader.ReadEncodedInt(); } else { m_Resource = DefaultResource; } if (GetSaveFlag(flags, SaveFlag.Attributes)) { m_AosAttributes = new AosAttributes(this, reader); } else { m_AosAttributes = new AosAttributes(this); } if (GetSaveFlag(flags, SaveFlag.ClothingAttributes)) { m_AosClothingAttributes = new AosArmorAttributes(this, reader); } else { m_AosClothingAttributes = new AosArmorAttributes(this); } if (GetSaveFlag(flags, SaveFlag.SkillBonuses)) { m_AosSkillBonuses = new AosSkillBonuses(this, reader); } else { m_AosSkillBonuses = new AosSkillBonuses(this); } if (GetSaveFlag(flags, SaveFlag.Resistances)) { m_AosResistances = new AosElementAttributes(this, reader); } else { m_AosResistances = new AosElementAttributes(this); } if (GetSaveFlag(flags, SaveFlag.MaxHitPoints)) { m_MaxHitPoints = reader.ReadEncodedInt(); } if (GetSaveFlag(flags, SaveFlag.HitPoints)) { m_HitPoints = reader.ReadEncodedInt(); } if (GetSaveFlag(flags, SaveFlag.Crafter)) { m_Crafter = reader.ReadMobile(); } if (GetSaveFlag(flags, SaveFlag.Quality)) { m_Quality = (ClothingQuality)reader.ReadEncodedInt(); } else { m_Quality = ClothingQuality.Regular; } if (GetSaveFlag(flags, SaveFlag.StrReq)) { m_StrReq = reader.ReadEncodedInt(); } else { m_StrReq = -1; } if (GetSaveFlag(flags, SaveFlag.PlayerConstructed)) { m_PlayerConstructed = true; } break; } case 4: { m_Resource = (CraftResource)reader.ReadInt(); goto case 3; } case 3: { m_AosAttributes = new AosAttributes(this, reader); m_AosClothingAttributes = new AosArmorAttributes(this, reader); m_AosSkillBonuses = new AosSkillBonuses(this, reader); m_AosResistances = new AosElementAttributes(this, reader); goto case 2; } case 2: { m_PlayerConstructed = reader.ReadBool(); goto case 1; } case 1: { m_Crafter = reader.ReadMobile(); m_Quality = (ClothingQuality)reader.ReadInt(); break; } case 0: { m_Crafter = null; m_Quality = ClothingQuality.Regular; break; } } if (version < 2) { m_PlayerConstructed = true; // we don't know, so, assume it's crafted } if (version < 3) { m_AosAttributes = new AosAttributes(this); m_AosClothingAttributes = new AosArmorAttributes(this); m_AosSkillBonuses = new AosSkillBonuses(this); m_AosResistances = new AosElementAttributes(this); } if (version < 4) { m_Resource = DefaultResource; } if (m_MaxHitPoints == 0 && m_HitPoints == 0) { m_HitPoints = m_MaxHitPoints = Utility.RandomMinMax(InitMinHits, InitMaxHits); } Mobile parent = Parent as Mobile; if (parent != null) { if (Core.AOS) { m_AosSkillBonuses.AddTo(parent); } AddStatBonuses(parent); parent.CheckStatTimers(); } }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 7: { this.m_IsImbued = reader.ReadBool(); goto case 6; } case 6: { m_NegativeAttributes = new NegativeAttributes(this, reader); goto case 5; } case 5: { #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_GorgonLenseCharges = reader.ReadInt(); m_GorgonLenseType = (LenseType)reader.ReadInt(); goto case 4; } case 4: { this.m_TimesImbued = reader.ReadEncodedInt(); this.m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this, reader); #endregion this.m_BlessedBy = reader.ReadMobile(); this.m_LastEquipped = reader.ReadBool(); this.m_SetEquipped = reader.ReadBool(); this.m_SetHue = reader.ReadEncodedInt(); this.m_SetAttributes = new AosAttributes(this, reader); this.m_SetSkillBonuses = new AosSkillBonuses(this, reader); this.m_Crafter = reader.ReadMobile(); this.m_Quality = (ArmorQuality)reader.ReadInt(); goto case 3; } case 3: { this.m_MaxHitPoints = reader.ReadEncodedInt(); this.m_HitPoints = reader.ReadEncodedInt(); goto case 2; } case 2: { this.m_Resource = (CraftResource)reader.ReadEncodedInt(); this.m_GemType = (GemType)reader.ReadEncodedInt(); goto case 1; } case 1: { this.m_AosAttributes = new AosAttributes(this, reader); this.m_AosResistances = new AosElementAttributes(this, reader); this.m_AosSkillBonuses = new AosSkillBonuses(this, reader); if (Core.AOS && this.Parent is Mobile) { this.m_AosSkillBonuses.AddTo((Mobile)this.Parent); } int strBonus = this.m_AosAttributes.BonusStr; int dexBonus = this.m_AosAttributes.BonusDex; int intBonus = this.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 (this.Parent is Mobile) { ((Mobile)this.Parent).CheckStatTimers(); } break; } case 0: { this.m_AosAttributes = new AosAttributes(this); this.m_AosResistances = new AosElementAttributes(this); this.m_AosSkillBonuses = new AosSkillBonuses(this); break; } } if (m_NegativeAttributes == null) { m_NegativeAttributes = new NegativeAttributes(this); } #region Mondain's Legacy Sets if (this.m_SetAttributes == null) { this.m_SetAttributes = new AosAttributes(this); } if (this.m_SetSkillBonuses == null) { this.m_SetSkillBonuses = new AosSkillBonuses(this); } #endregion if (version < 2) { this.m_Resource = CraftResource.Iron; this.m_GemType = GemType.None; } }
private static void ApplyAttribute( AosAttributes attrs, int min, int max, AosAttribute attr, int low, int high ) { ApplyAttribute( attrs, min, max, attr, low, high, 1 ); }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 6: { OriginalItemID = reader.ReadInt(); OriginalHue = reader.ReadInt(); goto case 5; } case 5: { m_Quality = (BookQuality)reader.ReadByte(); goto case 4; } case 4: { m_EngravedText = reader.ReadString(); goto case 3; } case 3: { m_Crafter = reader.ReadMobile(); goto case 2; } case 2: { m_Slayer = (SlayerName)reader.ReadInt(); m_Slayer2 = (SlayerName)reader.ReadInt(); goto case 1; } case 1: { m_AosAttributes = new AosAttributes(this, reader); m_AosSkillBonuses = new AosSkillBonuses(this, reader); goto case 0; } case 0: { m_Content = reader.ReadULong(); m_Count = reader.ReadInt(); break; } } if (m_AosAttributes == null) { m_AosAttributes = new AosAttributes(this); } if (m_AosSkillBonuses == null) { m_AosSkillBonuses = new AosSkillBonuses(this); } if (EraAOS && 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)) { var 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(); } }
public Spellbook(ulong content, int itemID) : base(itemID) { m_AosAttributes = new AosAttributes(this); m_AosSkillBonuses = new AosSkillBonuses(this); Weight = 3.0; Layer = Layer.OneHanded; LootType = LootType.Blessed; Content = content; }
private static void ApplyAttribute(AosAttributes attrs, int min, int max, AosAttribute attr, int low, int high) { ApplyAttribute(attrs, min, max, attr, low, high, 1); }
public void Target(Mobile m) { if (CheckHSequence(m)) { SpellHelper.Turn(Caster, m); /* Creates a blast of poisonous energy centered on the target. * The main target is inflicted with a large amount of Poison damage, and all valid targets in a radius of 2 tiles around the main target are inflicted with a lesser effect. * One tile from main target receives 50% damage, two tiles from target receives 33% damage. */ //CheckResisted( m ); // Check magic resist for skill, but do not use return value //reports from OSI: Necro spells don't give Resist gain Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x36B0, 1, 14, 63, 7, 9915, 0); Effects.PlaySound(m.Location, m.Map, 0x229); double damage = Utility.RandomMinMax((Core.ML ? 32 : 36), 40) * ((300 + (GetDamageSkill(Caster) * 9)) / 1000); double sdiBonus = (double)AosAttributes.GetValue(Caster, AosAttribute.SpellDamage) / 100; double inscribeSkill = GetInscribeSkill(Caster);//0-100 double inscribeBonus = (inscribeSkill + (100 * (int)(inscribeSkill / 100))) / 1000; double intBonus = Caster.Int / 1000; double ArcaneEmpowermentBonus = Spellweaving.ArcaneEmpowermentSpell.GetSpellBonus(Caster, m.Player && Caster.Player) / 100; TransformContext context = TransformationSpellHelper.GetContext(Caster); double pvmDamage = damage * (1 + sdiBonus + inscribeBonus + intBonus + ArcaneEmpowermentBonus); if (Core.ML && sdiBonus > 0.15 + inscribeSkill / 1000) { sdiBonus = 0.15 + inscribeSkill / 1000; } if (context != null && context.Spell is ReaperFormSpell) { sdiBonus += ((ReaperFormSpell)context.Spell).SpellDamageBonus; } double pvpDamage = damage * (1 + sdiBonus + inscribeBonus + intBonus + ArcaneEmpowermentBonus); Map map = m.Map; if (map != null) { List <Mobile> targets = new List <Mobile>(); if (Caster.CanBeHarmful(m, false)) { targets.Add(m); } if (Caster.Skills.Poisoning.Value / 200.0 >= Utility.RandomDouble()) { m.ApplyPoison(Caster, Poison.Lesser); } foreach (Mobile targ in m.GetMobilesInRange(2)) { if ((targ != Caster && m != targ) && (SpellHelper.ValidIndirectTarget(Caster, targ) && Caster.CanBeHarmful(targ, false))) { targets.Add(targ); } } for (int i = 0; i < targets.Count; ++i) { Mobile targ = targets[i]; int num; if (targ.InRange(m.Location, 0)) { num = 1; } else if (targ.InRange(m.Location, 1)) { num = 2; } else { num = 3; } Caster.DoHarmful(targ); SpellHelper.Damage(this, targ, ((m.Player && Caster.Player) ? pvpDamage : pvmDamage) / num, 0, 0, 0, 100, 0); } } } FinishSequence(); }
public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); switch ( version ) { #region Personal Bless Deed case 9: { m_BlessedBy = reader.ReadMobile(); goto case 8; } #endregion #region Mondain's Legacy Sets case 8: SetFlag sflags = (SetFlag) reader.ReadEncodedInt(); if ( GetSaveFlag( sflags, SetFlag.Attributes ) ) m_SetAttributes = new AosAttributes( this, reader ); else m_SetAttributes = new AosAttributes( this ); if ( GetSaveFlag( sflags, SetFlag.ArmorAttributes ) ) m_SetSelfRepair = (new AosArmorAttributes( this, reader )).SelfRepair; if ( GetSaveFlag( sflags, SetFlag.SkillBonuses ) ) m_SetSkillBonuses = new AosSkillBonuses( this, reader ); else m_SetSkillBonuses = new AosSkillBonuses( this ); if ( GetSaveFlag( sflags, SetFlag.PhysicalBonus ) ) m_SetPhysicalBonus = reader.ReadEncodedInt(); if ( GetSaveFlag( sflags, SetFlag.FireBonus ) ) m_SetFireBonus = reader.ReadEncodedInt(); if ( GetSaveFlag( sflags, SetFlag.ColdBonus ) ) m_SetColdBonus = reader.ReadEncodedInt(); if ( GetSaveFlag( sflags, SetFlag.PoisonBonus ) ) m_SetPoisonBonus = reader.ReadEncodedInt(); if ( GetSaveFlag( sflags, SetFlag.EnergyBonus ) ) m_SetEnergyBonus = reader.ReadEncodedInt(); if ( GetSaveFlag( sflags, SetFlag.Hue ) ) m_SetHue = reader.ReadEncodedInt(); if ( GetSaveFlag( sflags, SetFlag.LastEquipped ) ) m_LastEquipped = reader.ReadBool(); if ( GetSaveFlag( sflags, SetFlag.SetEquipped ) ) m_SetEquipped = reader.ReadBool(); if ( GetSaveFlag( sflags, SetFlag.SetSelfRepair ) ) m_SetSelfRepair = reader.ReadEncodedInt(); goto case 7; #endregion case 7: case 6: case 5: { SaveFlag flags = (SaveFlag)reader.ReadEncodedInt(); if ( GetSaveFlag( flags, SaveFlag.Attributes ) ) m_AosAttributes = new AosAttributes( this, reader ); else m_AosAttributes = new AosAttributes( this ); if ( GetSaveFlag( flags, SaveFlag.ArmorAttributes ) ) m_AosArmorAttributes = new AosArmorAttributes( this, reader ); else m_AosArmorAttributes = new AosArmorAttributes( this ); if ( GetSaveFlag( flags, SaveFlag.PhysicalBonus ) ) m_PhysicalBonus = reader.ReadEncodedInt(); if ( GetSaveFlag( flags, SaveFlag.FireBonus ) ) m_FireBonus = reader.ReadEncodedInt(); if ( GetSaveFlag( flags, SaveFlag.ColdBonus ) ) m_ColdBonus = reader.ReadEncodedInt(); if ( GetSaveFlag( flags, SaveFlag.PoisonBonus ) ) m_PoisonBonus = reader.ReadEncodedInt(); if ( GetSaveFlag( flags, SaveFlag.EnergyBonus ) ) m_EnergyBonus = reader.ReadEncodedInt(); if ( GetSaveFlag( flags, SaveFlag.Identified ) ) m_Identified = ( version >= 7 || reader.ReadBool() ); if ( GetSaveFlag( flags, SaveFlag.MaxHitPoints ) ) m_MaxHitPoints = reader.ReadEncodedInt(); if ( GetSaveFlag( flags, SaveFlag.HitPoints ) ) m_HitPoints = reader.ReadEncodedInt(); if ( GetSaveFlag( flags, SaveFlag.Crafter ) ) m_Crafter = reader.ReadMobile(); if ( GetSaveFlag( flags, SaveFlag.Quality ) ) m_Quality = (ArmorQuality)reader.ReadEncodedInt(); else m_Quality = ArmorQuality.Regular; if ( version == 5 && m_Quality == ArmorQuality.Low ) m_Quality = ArmorQuality.Regular; if ( GetSaveFlag( flags, SaveFlag.Durability ) ) { m_Durability = (ArmorDurabilityLevel)reader.ReadEncodedInt(); if ( m_Durability > ArmorDurabilityLevel.Indestructible ) m_Durability = ArmorDurabilityLevel.Durable; } if ( GetSaveFlag( flags, SaveFlag.Protection ) ) { m_Protection = (ArmorProtectionLevel)reader.ReadEncodedInt(); if ( m_Protection > ArmorProtectionLevel.Invulnerability ) m_Protection = ArmorProtectionLevel.Defense; } if ( GetSaveFlag( flags, SaveFlag.Resource ) ) m_Resource = (CraftResource)reader.ReadEncodedInt(); else m_Resource = DefaultResource; if ( m_Resource == CraftResource.None ) m_Resource = DefaultResource; if ( GetSaveFlag( flags, SaveFlag.BaseArmor ) ) m_ArmorBase = reader.ReadEncodedInt(); else m_ArmorBase = -1; if ( GetSaveFlag( flags, SaveFlag.StrBonus ) ) m_StrBonus = reader.ReadEncodedInt(); else m_StrBonus = -1; if ( GetSaveFlag( flags, SaveFlag.DexBonus ) ) m_DexBonus = reader.ReadEncodedInt(); else m_DexBonus = -1; if ( GetSaveFlag( flags, SaveFlag.IntBonus ) ) m_IntBonus = reader.ReadEncodedInt(); else m_IntBonus = -1; if ( GetSaveFlag( flags, SaveFlag.StrReq ) ) m_StrReq = reader.ReadEncodedInt(); else m_StrReq = -1; if ( GetSaveFlag( flags, SaveFlag.DexReq ) ) m_DexReq = reader.ReadEncodedInt(); else m_DexReq = -1; if ( GetSaveFlag( flags, SaveFlag.IntReq ) ) m_IntReq = reader.ReadEncodedInt(); else m_IntReq = -1; if ( GetSaveFlag( flags, SaveFlag.MedAllowance ) ) m_Meditate = (AMA)reader.ReadEncodedInt(); else m_Meditate = (AMA)(-1); if ( GetSaveFlag( flags, SaveFlag.SkillBonuses ) ) m_AosSkillBonuses = new AosSkillBonuses( this, reader ); if ( GetSaveFlag( flags, SaveFlag.PlayerConstructed ) ) m_PlayerConstructed = true; #region SA if ( version > 7 && GetSaveFlag( flags, SaveFlag.xAbsorptionAttributes ) ) m_SAAbsorptionAttributes = new SAAbsorptionAttributes( this, reader ); else m_SAAbsorptionAttributes = new SAAbsorptionAttributes( this ); #endregion break; } case 4: { m_AosAttributes = new AosAttributes( this, reader ); m_AosArmorAttributes = new AosArmorAttributes( this, reader ); goto case 3; } case 3: { m_PhysicalBonus = reader.ReadInt(); m_FireBonus = reader.ReadInt(); m_ColdBonus = reader.ReadInt(); m_PoisonBonus = reader.ReadInt(); m_EnergyBonus = reader.ReadInt(); goto case 2; } case 2: case 1: { m_Identified = reader.ReadBool(); goto case 0; } case 0: { m_ArmorBase = reader.ReadInt(); m_MaxHitPoints = reader.ReadInt(); m_HitPoints = reader.ReadInt(); m_Crafter = reader.ReadMobile(); m_Quality = (ArmorQuality)reader.ReadInt(); m_Durability = (ArmorDurabilityLevel)reader.ReadInt(); m_Protection = (ArmorProtectionLevel)reader.ReadInt(); AMT mat = (AMT)reader.ReadInt(); if ( m_ArmorBase == RevertArmorBase ) m_ArmorBase = -1; /*m_BodyPos = (ArmorBodyType)*/reader.ReadInt(); if ( version < 4 ) { m_AosAttributes = new AosAttributes( this ); m_AosArmorAttributes = new AosArmorAttributes( this ); } if ( version < 3 && m_Quality == ArmorQuality.Exceptional ) DistributeBonuses( 6 ); if ( version >= 2 ) { m_Resource = (CraftResource)reader.ReadInt(); } else { OreInfo info; switch ( reader.ReadInt() ) { default: case 0: info = OreInfo.Iron; break; case 1: info = OreInfo.DullCopper; break; case 2: info = OreInfo.ShadowIron; break; case 3: info = OreInfo.Copper; break; case 4: info = OreInfo.Bronze; break; case 5: info = OreInfo.Gold; break; case 6: info = OreInfo.Agapite; break; case 7: info = OreInfo.Verite; break; case 8: info = OreInfo.Valorite; break; } m_Resource = CraftResources.GetFromOreInfo( info, mat ); } m_StrBonus = reader.ReadInt(); m_DexBonus = reader.ReadInt(); m_IntBonus = reader.ReadInt(); m_StrReq = reader.ReadInt(); m_DexReq = reader.ReadInt(); m_IntReq = reader.ReadInt(); if ( m_StrBonus == OldStrBonus ) m_StrBonus = -1; if ( m_DexBonus == OldDexBonus ) m_DexBonus = -1; if ( m_IntBonus == OldIntBonus ) m_IntBonus = -1; if ( m_StrReq == OldStrReq ) m_StrReq = -1; if ( m_DexReq == OldDexReq ) m_DexReq = -1; if ( m_IntReq == OldIntReq ) m_IntReq = -1; m_Meditate = (AMA)reader.ReadInt(); if ( m_Meditate == OldMedAllowance ) m_Meditate = (AMA)(-1); if ( m_Resource == CraftResource.None ) { if ( mat == ArmorMaterialType.Studded || mat == ArmorMaterialType.Leather ) m_Resource = CraftResource.RegularLeather; else if ( mat == ArmorMaterialType.Spined ) m_Resource = CraftResource.SpinedLeather; else if ( mat == ArmorMaterialType.Horned ) m_Resource = CraftResource.HornedLeather; else if ( mat == ArmorMaterialType.Barbed ) m_Resource = CraftResource.BarbedLeather; else m_Resource = CraftResource.Iron; } if ( m_MaxHitPoints == 0 && m_HitPoints == 0 ) m_HitPoints = m_MaxHitPoints = Utility.RandomMinMax( InitMinHits, InitMaxHits ); 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 ( m_AosSkillBonuses == null ) m_AosSkillBonuses = new AosSkillBonuses( this ); if ( Core.AOS && Parent is Mobile ) m_AosSkillBonuses.AddTo( (Mobile)Parent ); int strBonus = ComputeStatBonus( StatType.Str ); int dexBonus = ComputeStatBonus( StatType.Dex ); int intBonus = ComputeStatBonus( StatType.Int ); 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 ( version < 7 ) m_PlayerConstructed = true; // we don't know, so, assume it's crafted }
public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); switch ( version ) { #region ItemID_Mods case (3): { m_Identified = reader.ReadBool(); goto case 2; } #endregion 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; } }
public static void ApplyAttributesTo(BaseHat hat, bool isRunicTool, int luckChance, int attributeCount, int min, int max) { m_IsRunicTool = isRunicTool; m_LuckChance = luckChance; AosAttributes primary = hat.Attributes; AosArmorAttributes secondary = hat.ClothingAttributes; AosElementAttributes resists = hat.Resistances; m_Props.SetAll(false); for (int i = 0; i < attributeCount; ++i) { int random = GetUniqueRandom(19); if (random == -1) { break; } switch (random) { case 0: ApplyAttribute(primary, min, max, AosAttribute.ReflectPhysical, 1, 15); break; case 1: ApplyAttribute(primary, min, max, AosAttribute.RegenHits, 1, 2); break; case 2: ApplyAttribute(primary, min, max, AosAttribute.RegenStam, 1, 3); break; case 3: ApplyAttribute(primary, min, max, AosAttribute.RegenMana, 1, 2); break; case 4: ApplyAttribute(primary, min, max, AosAttribute.NightSight, 1, 1); break; case 5: ApplyAttribute(primary, min, max, AosAttribute.BonusHits, 1, 5); break; case 6: ApplyAttribute(primary, min, max, AosAttribute.BonusStam, 1, 8); break; case 7: ApplyAttribute(primary, min, max, AosAttribute.BonusMana, 1, 8); break; case 8: ApplyAttribute(primary, min, max, AosAttribute.LowerManaCost, 1, 8); break; case 9: ApplyAttribute(primary, min, max, AosAttribute.LowerRegCost, 1, 20); break; case 10: ApplyAttribute(primary, min, max, AosAttribute.Luck, 1, 100); break; case 11: ApplyAttribute(secondary, min, max, AosArmorAttribute.LowerStatReq, 10, 100, 10); break; case 12: ApplyAttribute(secondary, min, max, AosArmorAttribute.SelfRepair, 1, 5); break; case 13: ApplyAttribute(secondary, min, max, AosArmorAttribute.DurabilityBonus, 10, 100, 10); break; case 14: ApplyAttribute(resists, min, max, AosElementAttribute.Physical, 1, 15); break; case 15: ApplyAttribute(resists, min, max, AosElementAttribute.Fire, 1, 15); break; case 16: ApplyAttribute(resists, min, max, AosElementAttribute.Cold, 1, 15); break; case 17: ApplyAttribute(resists, min, max, AosElementAttribute.Poison, 1, 15); break; case 18: ApplyAttribute(resists, min, max, AosElementAttribute.Energy, 1, 15); break; } } }
public BaseJewel(int itemID, Layer layer) : base(itemID) { this.m_AosAttributes = new AosAttributes(this); this.m_AosResistances = new AosElementAttributes(this); this.m_AosSkillBonuses = new AosSkillBonuses(this); this.m_Resource = CraftResource.Iron; this.m_GemType = GemType.None; this.Layer = layer; this.m_HitPoints = this.m_MaxHitPoints = Utility.RandomMinMax(this.InitMinHits, this.InitMaxHits); this.m_SetAttributes = new AosAttributes(this); this.m_SetSkillBonuses = new AosSkillBonuses(this); this.m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this); m_NegativeAttributes = new NegativeAttributes(this); }
public static void ApplyAttributesTo(BaseWeapon weapon, bool isRunicTool, int luckChance, int attributeCount, int min, int max) { m_IsRunicTool = isRunicTool; m_LuckChance = luckChance; AosAttributes primary = weapon.Attributes; AosWeaponAttributes secondary = weapon.WeaponAttributes; m_Props.SetAll(false); if (weapon is BaseRanged) { m_Props.Set(2, true); // ranged weapons cannot be ubws or mageweapon } for (int i = 0; i < attributeCount; ++i) { int random = GetUniqueRandom(24); if (random == -1) { break; } switch (random) { case 0: { switch (Utility.Random(5)) { case 0: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitPhysicalArea, 2, 50, 2); break; case 1: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitFireArea, 2, 50, 2); break; case 2: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitColdArea, 2, 50, 2); break; case 3: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitPoisonArea, 2, 50, 2); break; case 4: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitEnergyArea, 2, 50, 2); break; } break; } case 1: { switch (Utility.Random(4)) { case 0: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitMagicArrow, 2, 50, 2); break; case 1: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitHarm, 2, 50, 2); break; case 2: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitFireball, 2, 50, 2); break; case 3: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLightning, 2, 50, 2); break; } break; } case 2: { switch (Utility.Random(2)) { case 0: ApplyAttribute(secondary, min, max, AosWeaponAttribute.UseBestSkill, 1, 1); break; case 1: ApplyAttribute(secondary, min, max, AosWeaponAttribute.MageWeapon, 1, 10); break; } break; } case 3: ApplyAttribute(primary, min, max, AosAttribute.WeaponDamage, 1, 50); break; case 4: ApplyAttribute(primary, min, max, AosAttribute.DefendChance, 1, 15); break; case 5: ApplyAttribute(primary, min, max, AosAttribute.CastSpeed, 1, 1); break; case 6: ApplyAttribute(primary, min, max, AosAttribute.AttackChance, 1, 15); break; case 7: ApplyAttribute(primary, min, max, AosAttribute.Luck, 1, 100); break; case 8: ApplyAttribute(primary, min, max, AosAttribute.WeaponSpeed, 5, 30, 5); break; case 9: ApplyAttribute(primary, min, max, AosAttribute.SpellChanneling, 1, 1); break; case 10: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitDispel, 2, 50, 2); break; case 11: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLeechHits, 2, 50, 2); break; case 12: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLowerAttack, 2, 50, 2); break; case 13: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLowerDefend, 2, 50, 2); break; case 14: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLeechMana, 2, 50, 2); break; case 15: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLeechStam, 2, 50, 2); break; case 16: ApplyAttribute(secondary, min, max, AosWeaponAttribute.LowerStatReq, 10, 100, 10); break; case 17: ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistPhysicalBonus, 1, 15); break; case 18: ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistFireBonus, 1, 15); break; case 19: ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistColdBonus, 1, 15); break; case 20: ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistPoisonBonus, 1, 15); break; case 21: ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistEnergyBonus, 1, 15); break; case 22: ApplyAttribute(secondary, min, max, AosWeaponAttribute.DurabilityBonus, 10, 100, 10); break; case 23: weapon.Slayer = GetRandomSlayer(); break; } } }
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 }
private static bool CombatCheck(Mobile attacker, Mobile defender) /* mod'd from baseweapon */ { BaseWeapon defWeapon = defender.Weapon as BaseWeapon; Skill atkSkill = defender.Skills.Ninjitsu; Skill defSkill = defender.Skills[defWeapon.Skill]; double atSkillValue = attacker.Skills.Ninjitsu.Value; double defSkillValue = defWeapon.GetDefendSkillValue(attacker, defender); double attackValue = AosAttributes.GetValue(attacker, AosAttribute.AttackChance); if (defSkillValue <= -20.0) { defSkillValue = -19.9; } if (Spells.Chivalry.DivineFurySpell.UnderEffect(attacker)) { attackValue += 10; } if (AnimalForm.UnderTransformation(attacker, typeof(GreyWolf)) || AnimalForm.UnderTransformation(attacker, typeof(BakeKitsune))) { attackValue += 20; } if (HitLower.IsUnderAttackEffect(attacker)) { attackValue -= 25; } if (attackValue > 45) { attackValue = 45; } attackValue = (atSkillValue + 20.0) * (100 + attackValue); double defenseValue = AosAttributes.GetValue(defender, AosAttribute.DefendChance); if (Spells.Chivalry.DivineFurySpell.UnderEffect(defender)) { defenseValue -= 20; } if (HitLower.IsUnderDefenseEffect(defender)) { defenseValue -= 25; } defenseValue += Block.GetBonus(defender); int refBonus = 0; if (SkillHandlers.Discordance.GetEffect(attacker, ref refBonus)) { defenseValue -= refBonus; } if (defenseValue > 45) { defenseValue = 45; } defenseValue = (defSkillValue + 20.0) * (100 + defenseValue); double chance = attackValue / (defenseValue * 2.0); if (chance < 0.02) { chance = 0.02; } return(attacker.CheckSkill(atkSkill.SkillName, chance)); }
public BaseArmor(int itemID) : base(itemID) { this.m_Quality = ArmorQuality.Regular; this.m_Durability = ArmorDurabilityLevel.Regular; this.m_Crafter = null; this.m_Resource = this.DefaultResource; this.Hue = CraftResources.GetHue(this.m_Resource); this.m_HitPoints = this.m_MaxHitPoints = Utility.RandomMinMax(this.InitMinHits, this.InitMaxHits); this.Layer = (Layer)this.ItemData.Quality; this.m_AosAttributes = new AosAttributes(this); this.m_AosArmorAttributes = new AosArmorAttributes(this); this.m_AosSkillBonuses = new AosSkillBonuses(this); this.m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this); #region Mondain's Legacy Sets this.m_SetAttributes = new AosAttributes(this); this.m_SetSkillBonuses = new AosSkillBonuses(this); #endregion this.m_AosSkillBonuses = new AosSkillBonuses(this); // 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) // 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); }
public static void AwardKarma(Mobile m, int offset, bool message) { #region Mondain's Legacy if (m.Talisman is BaseTalisman) { BaseTalisman talisman = (BaseTalisman)m.Talisman; if (talisman.KarmaLoss > 0) { offset *= (1 + (int)(((double)talisman.KarmaLoss) / 100)); } else if (talisman.KarmaLoss < 0) { offset *= (1 - (int)(((double)-talisman.KarmaLoss) / 100)); } } #endregion #region Heritage Items int karmaLoss = AosAttributes.GetValue(m, AosAttribute.IncreasedKarmaLoss); if (karmaLoss != 0 && offset < 0) { offset -= (int)(offset * (karmaLoss / 100.0)); } #endregion if (offset > 0) { if (m is PlayerMobile && ((PlayerMobile)m).KarmaLocked) { return; } if (m.Karma >= MaxKarma) { return; } offset -= m.Karma / 100; if (offset < 0) { offset = 0; } } else if (offset < 0) { if (m.Karma <= MinKarma) { return; } offset -= m.Karma / 100; if (offset > 0) { offset = 0; } } if ((m.Karma + offset) > MaxKarma) { offset = MaxKarma - m.Karma; } else if ((m.Karma + offset) < MinKarma) { offset = MinKarma - m.Karma; } bool wasPositiveKarma = (m.Karma >= 0); m.Karma += offset; if (message) { if (offset > 40) { m.SendLocalizedMessage(1019062); // You have gained a lot of karma. } else if (offset > 20) { m.SendLocalizedMessage(1019061); // You have gained a good amount of karma. } else if (offset > 10) { m.SendLocalizedMessage(1019060); // You have gained some karma. } else if (offset > 0) { m.SendLocalizedMessage(1019059); // You have gained a little karma. } else if (offset < -40) { m.SendLocalizedMessage(1019066); // You have lost a lot of karma. } else if (offset < -20) { m.SendLocalizedMessage(1019065); // You have lost a good amount of karma. } else if (offset < -10) { m.SendLocalizedMessage(1019064); // You have lost some karma. } else if (offset < 0) { m.SendLocalizedMessage(1019063); // You have lost a little karma. } } if (!Core.AOS && wasPositiveKarma && m.Karma < 0 && m is PlayerMobile && !((PlayerMobile)m).KarmaLocked) { ((PlayerMobile)m).KarmaLocked = true; m.SendLocalizedMessage(1042511, "", 0x22); // Karma is locked. A mantra spoken at a shrine will unlock it again. } }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 0: { SaveFlag flags = (SaveFlag)reader.ReadEncodedInt(); if (GetSaveFlag(flags, SaveFlag.Attributes)) m_AosAttributes = new AosAttributes(this, reader); else m_AosAttributes = new AosAttributes(this); if (GetSaveFlag(flags, SaveFlag.SkillBonuses)) m_AosSkillBonuses = new AosSkillBonuses(this, reader); else m_AosSkillBonuses = new AosSkillBonuses(this); // Backward compatibility if (GetSaveFlag(flags, SaveFlag.Owner)) BlessedFor = reader.ReadMobile(); if (GetSaveFlag(flags, SaveFlag.Protection)) m_Protection = new TalismanAttribute(reader); else m_Protection = new TalismanAttribute(); if (GetSaveFlag(flags, SaveFlag.Killer)) m_Killer = new TalismanAttribute(reader); else m_Killer = new TalismanAttribute(); if (GetSaveFlag(flags, SaveFlag.Summoner)) m_Summoner = new TalismanAttribute(reader); else m_Summoner = new TalismanAttribute(); if (GetSaveFlag(flags, SaveFlag.Removal)) m_Removal = (TalismanRemoval)reader.ReadEncodedInt(); if (GetSaveFlag(flags, SaveFlag.OldKarmaLoss)) m_AosAttributes.IncreasedKarmaLoss = reader.ReadEncodedInt(); if (GetSaveFlag(flags, SaveFlag.Skill)) m_Skill = (SkillName)reader.ReadEncodedInt(); if (GetSaveFlag(flags, SaveFlag.SuccessBonus)) m_SuccessBonus = reader.ReadEncodedInt(); if (GetSaveFlag(flags, SaveFlag.ExceptionalBonus)) m_ExceptionalBonus = reader.ReadEncodedInt(); if (GetSaveFlag(flags, SaveFlag.MaxCharges)) m_MaxCharges = reader.ReadEncodedInt(); if (GetSaveFlag(flags, SaveFlag.Charges)) m_Charges = reader.ReadEncodedInt(); if (GetSaveFlag(flags, SaveFlag.MaxChargeTime)) m_MaxChargeTime = reader.ReadEncodedInt(); if (GetSaveFlag(flags, SaveFlag.ChargeTime)) m_ChargeTime = reader.ReadEncodedInt(); if (GetSaveFlag(flags, SaveFlag.Slayer)) m_Slayer = (TalismanSlayerName)reader.ReadEncodedInt(); m_Blessed = GetSaveFlag(flags, SaveFlag.Blessed); break; } } if (Parent is Mobile) { Mobile m = (Mobile)Parent; m_AosAttributes.AddStatBonuses(m); m_AosSkillBonuses.AddTo(m); if (m_ChargeTime > 0) StartTimer(); } }
public void Target(Mobile m) { if (m == null) { return; } if (CheckHSequence(m)) { SpellHelper.Turn(Caster, m); /* Creates a blast of poisonous energy centered on the target. * The main target is inflicted with a large amount of Poison damage, and all valid targets in a radius of 2 tiles around the main target are inflicted with a lesser effect. * One tile from main target receives 50% damage, two tiles from target receives 33% damage. */ // CheckResisted( m ); // Check magic resist for skill, but do not use return value // reports from OSI: Necro spells don't give Resist gain Effects.SendLocationParticles( EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x36B0, 1, 14, 63, 7, 9915, 0 ); Effects.PlaySound(m.Location, m.Map, 0x229); var damage = Utility.RandomMinMax(Core.ML ? 32 : 36, 40) * ((300 + GetDamageSkill(Caster) * 9) / 1000); var sdiBonus = (double)AosAttributes.GetValue(Caster, AosAttribute.SpellDamage) / 100; var pvmDamage = damage * (1 + sdiBonus); if (Core.ML && sdiBonus > 0.15) { sdiBonus = 0.15; } var pvpDamage = damage * (1 + sdiBonus); var map = m.Map; if (map != null) { var targets = new List <Mobile>(); if (Caster.CanBeHarmful(m, false)) { targets.Add(m); } targets.AddRange( m.GetMobilesInRange(2) .Where( targ => !(Caster is BaseCreature && targ is BaseCreature && targ != Caster && m != targ && SpellHelper.ValidIndirectTarget(Caster, targ) && Caster.CanBeHarmful(targ, false)) ) ); for (var i = 0; i < targets.Count; ++i) { var targ = targets[i]; int num; if (targ.InRange(m.Location, 0)) { num = 1; } else if (targ.InRange(m.Location, 1)) { num = 2; } else { num = 3; } Caster.DoHarmful(targ); SpellHelper.Damage( this, targ, (m.Player && Caster.Player ? pvpDamage : pvmDamage) / num, 0, 0, 0, 100, 0 ); } } } FinishSequence(); }
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); }
public static void ApplyAttributesTo(FishingPole pole, bool playerMade, int luckChance, int attributeCount, int min, int max) { int delta; if (min > max) { delta = min; min = max; max = delta; } m_PlayerMade = playerMade; m_LuckChance = luckChance; AosAttributes primary = pole.Attributes; AosSkillBonuses skills = pole.SkillBonuses; m_Props.SetAll(false); for (int i = 0; i < attributeCount; ++i) { int random = GetUniqueRandom(21); switch (random) { case 0: ApplyAttribute(primary, min, max, AosAttribute.DefendChance, 1, 15); break; case 1: ApplyAttribute(primary, min, max, AosAttribute.CastSpeed, 1, 1); break; case 2: ApplyAttribute(primary, min, max, AosAttribute.CastRecovery, 1, 1); break; case 3: ApplyAttribute(primary, min, max, AosAttribute.AttackChance, 1, 15); break; case 4: ApplyAttribute(primary, min, max, AosAttribute.Luck, 1, 100); break; case 5: ApplyAttribute(primary, min, max, AosAttribute.SpellChanneling, 1, 1); break; case 6: ApplyAttribute(primary, min, max, AosAttribute.RegenHits, 1, 2); break; case 7: ApplyAttribute(primary, min, max, AosAttribute.RegenMana, 1, 2); break; case 8: ApplyAttribute(primary, min, max, AosAttribute.RegenStam, 1, 3); break; case 9: ApplyAttribute(primary, min, max, AosAttribute.BonusHits, 1, 8); break; case 10: ApplyAttribute(primary, min, max, AosAttribute.BonusMana, 1, 8); break; case 11: ApplyAttribute(primary, min, max, AosAttribute.BonusStam, 1, 8); break; case 12: ApplyAttribute(primary, min, max, AosAttribute.BonusStr, 1, 8); break; case 13: ApplyAttribute(primary, min, max, AosAttribute.BonusDex, 1, 8); break; case 14: ApplyAttribute(primary, min, max, AosAttribute.BonusInt, 1, 8); break; case 15: ApplyAttribute(primary, min, max, AosAttribute.SpellDamage, 1, 12); break; case 16: ApplySkillBonus(skills, min, max, 0, 1, 15); break; case 17: ApplySkillBonus(skills, min, max, 1, 1, 15); break; case 18: ApplySkillBonus(skills, min, max, 2, 1, 15); break; case 19: ApplySkillBonus(skills, min, max, 3, 1, 15); break; case 20: ApplySkillBonus(skills, min, max, 4, 1, 15); break; } } }
public BaseArmor( int itemID ) : base( itemID ) { m_Quality = ArmorQuality.Regular; m_Durability = ArmorDurabilityLevel.Regular; m_Crafter = null; m_Resource = DefaultResource; Hue = CraftResources.GetHue( m_Resource ); m_HitPoints = m_MaxHitPoints = Utility.RandomMinMax( InitMinHits, InitMaxHits ); this.Layer = (Layer)ItemData.Quality; m_AosAttributes = new AosAttributes( this ); m_AosArmorAttributes = new AosArmorAttributes( this ); m_AosSkillBonuses = new AosSkillBonuses( this ); m_SAAbsorptionAttributes = new SAAbsorptionAttributes( this ); #region Mondain's Legacy Sets m_SetAttributes = new AosAttributes( this ); m_SetSkillBonuses = new AosSkillBonuses( this ); #endregion }
public static void ApplyAttributesTo(BaseWeapon weapon, bool isRunicTool, int luckChance, int attributeCount, int min, int max) { m_IsRunicTool = isRunicTool; m_LuckChance = luckChance; AosAttributes primary = weapon.Attributes; AosWeaponAttributes secondary = weapon.WeaponAttributes; m_Props.SetAll(false); if (weapon is BaseRanged) { m_Props.Set(2, true); // ranged weapons cannot be ubws or mageweapon } else { m_Props.Set(25, true); // Only bows can be Balanced m_Props.Set(26, true); // Only bows have Velocity } for (int i = 0; i < attributeCount; ++i) { int random = GetUniqueRandom(27); if (random == -1) { break; } switch (random) { case 0: { switch (Utility.Random(5)) { case 0: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitPhysicalArea, 2, 50, 2); break; case 1: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitFireArea, 2, 50, 2); break; case 2: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitColdArea, 2, 50, 2); break; case 3: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitPoisonArea, 2, 50, 2); break; case 4: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitEnergyArea, 2, 50, 2); break; } break; } case 1: { switch (Utility.Random(4)) { case 0: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitMagicArrow, 2, 50, 2); break; case 1: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitHarm, 2, 50, 2); break; case 2: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitFireball, 2, 50, 2); break; case 3: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLightning, 2, 50, 2); break; } break; } case 2: { switch (Utility.Random(2)) { case 0: ApplyAttribute(secondary, min, max, AosWeaponAttribute.UseBestSkill, 1, 1); break; case 1: ApplyAttribute(secondary, min, max, AosWeaponAttribute.MageWeapon, 1, 10); break; } break; } case 3: int dmgMin = primary.WeaponDamage; int dmgMax = Math.Max(dmgMin, 50); primary.WeaponDamage = 0; ApplyAttribute(primary, min, max, AosAttribute.WeaponDamage, dmgMin, dmgMax); break; case 4: ApplyAttribute(primary, min, max, AosAttribute.DefendChance, 1, 15); break; case 5: ApplyAttribute(primary, min, max, AosAttribute.CastSpeed, 1, 1); break; case 6: ApplyAttribute(primary, min, max, AosAttribute.AttackChance, 1, 15); break; case 7: ApplyAttribute(primary, min, max, AosAttribute.Luck, 1, 100); break; case 8: ApplyAttribute(primary, min, max, AosAttribute.WeaponSpeed, 5, 30, 5); break; case 9: ApplyAttribute(primary, min, max, AosAttribute.SpellChanneling, 1, 1); break; case 10: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitDispel, 2, 50, 2); break; case 11: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLeechHits, 2, Server.SkillHandlers.Imbuing.GetPropRange(weapon, AosWeaponAttribute.HitLeechHits)[1], 2); break; case 12: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLowerAttack, 2, 50, 2); break; case 13: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLowerDefend, 2, 50, 2); break; case 14: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLeechMana, 2, Server.SkillHandlers.Imbuing.GetPropRange(weapon, AosWeaponAttribute.HitLeechMana)[1], 2); break; case 15: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLeechStam, 2, 50, 2); break; case 16: ApplyAttribute(secondary, min, max, AosWeaponAttribute.LowerStatReq, 10, 100, 10); break; case 17: ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistPhysicalBonus, 1, 15); break; case 18: ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistFireBonus, 1, 15); break; case 19: ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistColdBonus, 1, 15); break; case 20: ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistPoisonBonus, 1, 15); break; case 21: ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistEnergyBonus, 1, 15); break; case 22: ApplyAttribute(secondary, min, max, AosWeaponAttribute.DurabilityBonus, 10, 100, 10); break; case 23: weapon.Slayer = GetRandomSlayer(); break; case 24: GetElementalDamages(weapon); break; case 25: BaseRanged brb = weapon as BaseRanged; brb.Balanced = true; break; case 26: BaseRanged brv = weapon as BaseRanged; brv.Velocity = (Utility.RandomMinMax(2, 50)); break; } } }