Working Self Repair for Shields
Since self repair was missed on shields in 1.0.0, and I've seen a few bash their brains trying to turn it back on, I figured I'd post thats A: It's not even in BaseShield.
It's in BaseWeapon.cs:
Hope that helps those who couldn't find it.
Since self repair was missed on shields in 1.0.0, and I've seen a few bash their brains trying to turn it back on, I figured I'd post thats A: It's not even in BaseShield.
It's in BaseWeapon.cs:
Code:
public virtual int AbsorbDamageAOS( Mobile attacker, Mobile defender, int damage )
{
double positionChance = Utility.RandomDouble();
BaseArmor armor;
if ( positionChance < 0.07 )
armor = defender.NeckArmor as BaseArmor;
else if ( positionChance < 0.14 )
armor = defender.HandArmor as BaseArmor;
else if ( positionChance < 0.28 )
armor = defender.ArmsArmor as BaseArmor;
else if ( positionChance < 0.43 )
armor = defender.HeadArmor as BaseArmor;
else if ( positionChance < 0.65 )
armor = defender.LegsArmor as BaseArmor;
else
armor = defender.ChestArmor as BaseArmor;
if ( armor != null )
armor.OnHit( this, damage ); // call OnHit to lose durability
if ( defender.Player || defender.Body.IsHuman )
{
BaseShield shield = defender.FindItemOnLayer( Layer.TwoHanded ) as BaseShield;
bool blocked = false;
// Dexterity below 80 reduces the chance to parry
double chance = ( defender.Skills[SkillName.Parry].Value * 0.0030 );
if ( defender.Dex < 80 )
chance = chance * (20 + defender.Dex) / 100;
if ( shield != null )
{
blocked = defender.CheckSkill( SkillName.Parry, chance );
}
else if ( !(defender.Weapon is Fists) && !(defender.Weapon is BaseRanged) )
{
chance /= 2;
blocked = ( chance > Utility.RandomDouble() ); // Only skillcheck if wielding a shield
}
if ( blocked )
{
defender.FixedEffect( 0x37B9, 10, 16 );
damage = 0;
if ( shield != null )
{
double halfArmor = shield.ArmorRating / 2.0;
int absorbed = (int)(halfArmor + (halfArmor*Utility.RandomDouble()));
if ( absorbed < 2 )
absorbed = 2;
int wear;
if ( Type == WeaponType.Bashing )
wear = (absorbed / 2);
else
wear = Utility.Random( 2 );
/*------------- Missing Self Repair for Shields --------------*/
if ( Core.AOS && shield.ArmorAttributes.SelfRepair > Utility.Random( 10 ) )
shield.HitPoints += 2;
else if ( wear > 0 && shield.MaxHitPoints > 0 )
{
if ( shield.HitPoints >= wear )
{
shield.HitPoints -= wear;
wear = 0;
}
else
{
wear -= shield.HitPoints;
shield.HitPoints = 0;
}
if ( wear > 0 )
{
if ( shield.MaxHitPoints > wear )
{
shield.MaxHitPoints -= wear;
if ( shield.Parent is Mobile )
((Mobile)shield.Parent).LocalOverheadMessage( MessageType.Regular, 0x3B2, 1061121 ); // Your equipment is severely damaged.
}
else
{
shield.Delete();
}
}
}
}
}
}
return damage;
}