CODE |
public virtual int OnHit( BaseWeapon weapon, int damageTaken ) { double HalfAr = ArmorRating / 2.0; int Absorbed = (int)(HalfAr + HalfAr*Utility.RandomDouble()); damageTaken -= Absorbed; if ( damageTaken < 0 ) damageTaken = 0; if ( Absorbed < 2 ) Absorbed = 2; //was 25 changed to 90 if ( 90 > Utility.Random( 100 ) ) // 25% chance to lower durability now set to 90% chance to lower { if ( Core.AOS && m_AosArmorAttributes.SelfRepair > Utility.Random( 10 ) ) { HitPoints += 2; } else { int wear; if ( weapon.Type == WeaponType.Bashing ) wear = Absorbed / 2; else wear = Utility.Random( 2 ); if ( wear > 0 && m_MaxHitPoints > 0 ) { if ( m_HitPoints >= wear ) { HitPoints -= wear; wear = 0; } else { wear -= HitPoints; HitPoints = 0; } if ( wear > 0 ) { if ( m_MaxHitPoints > wear ) { MaxHitPoints -= wear; if ( Parent is Mobile ) ((Mobile)Parent).LocalOverheadMessage( MessageType.Regular, 0x3B2, 1061121 ); // Your equipment is severely damaged. } else { Delete(); } } } } } return damageTaken; } |