public static void AddBerserk(Mobile m) { if (_Table == null) { _Table = new Dictionary <Mobile, BerserkTimer>(); } _Table[m] = new BerserkTimer(m); }
public override void OnDamage( int amount, Mobile from, bool willKill ) { int disruptThreshold; if ( from != null && from.IsPlayer ) disruptThreshold = 18; else disruptThreshold = 25; if ( amount > disruptThreshold ) { BandageContext c = BandageContext.GetContext( this ); if ( c != null ) c.Slip(); } if ( FloorTrapKit.IsAssembling( this ) ) FloorTrapKit.StopAssembling( this, 1113512 ); // You are hit and cease trap assembly. if ( ExplodingTarPotion.IsSlept( this ) ) ExplodingTarPotion.RemoveEffect( this ); if ( Confidence.IsRegenerating( this ) ) Confidence.StopRegenerating( this ); WeightOverloading.FatigueOnDamage( this, amount ); if ( m_ReceivedHonorContext != null ) m_ReceivedHonorContext.OnTargetDamaged( from, amount ); if ( m_SentHonorContext != null ) m_SentHonorContext.OnSourceDamaged( from, amount ); if ( amount > 0 && ParalyzingBlow.UnderEffect( this ) ) { this.Frozen = false; ParalyzingBlow.m_Table.Remove( this ); } #region Gargoyle Berserk if ( Race == Race.Gargoyle && !willKill && !Berserk ) { if ( ( (float) ( Hits - amount ) / HitsMax ) < 0.8 ) { if ( m_BerserkTimer != null ) m_BerserkTimer.Stop(); m_BerserkTimer = new BerserkTimer( this ); m_BerserkTimer.Start(); } } #endregion int soulCharge = ArmorAttributes.GetValue( this, ArmorAttribute.SoulCharge ); if ( soulCharge > 0 && Mana < ManaMax ) { int mana = (int) ( amount * soulCharge / 100.0 ); if ( mana > 0 ) { Mana += mana; Effects.SendPacket( this, Map, new TargetParticleEffect( this, 0x375A, 1, 10, 0x71, 2, 0x1AE9, 0, 0 ) ); SendLocalizedMessage( 1113636 ); // The soul charge effect converts some of the damage you received into mana. } } GainBattleLust(); #region Durability Layer layer; switch ( Utility.Random( 18 ) ) { default: case 0: layer = Layer.Shoes; break; case 1: layer = Layer.Pants; break; case 2: layer = Layer.Shirt; break; case 3: layer = Layer.Helm; break; case 4: layer = Layer.Gloves; break; case 5: layer = Layer.Ring; break; case 6: layer = Layer.Talisman; break; case 7: layer = Layer.Neck; break; case 8: layer = Layer.Waist; break; case 9: layer = Layer.InnerTorso; break; case 10: layer = Layer.Bracelet; break; case 11: layer = Layer.MiddleTorso; break; case 12: layer = Layer.Earrings; break; case 13: layer = Layer.Arms; break; case 14: layer = Layer.Cloak; break; case 15: layer = Layer.OuterTorso; break; case 16: layer = Layer.OuterLegs; break; case 17: layer = Layer.InnerLegs; break; } IWearableDurability armor = this.FindItemOnLayer( layer ) as IWearableDurability; if ( armor != null && armor.CanLoseDurability ) armor.OnHit( amount ); // call OnHit to lose durability #endregion base.OnDamage( amount, from, willKill ); }