Fixes casting checks

This commit is contained in:
Kamron Batman 2018-08-19 01:38:55 +08:00
parent 7ea00fbf4f
commit 03dd5f1926
431 changed files with 5616 additions and 6250 deletions

View file

@ -60,9 +60,9 @@ namespace Server.Items
public override int OnHit( BaseWeapon weapon, int damage )
{
if( Core.AOS )
if ( Core.AOS )
{
if( ArmorAttributes.SelfRepair > Utility.Random( 10 ) )
if ( ArmorAttributes.SelfRepair > Utility.Random( 10 ) )
{
HitPoints += 2;
}
@ -71,19 +71,19 @@ namespace Server.Items
double halfArmor = ArmorRating / 2.0;
int absorbed = (int)(halfArmor + (halfArmor*Utility.RandomDouble()));
if( absorbed < 2 )
if ( absorbed < 2 )
absorbed = 2;
int wear;
if( weapon.Type == WeaponType.Bashing )
if ( weapon.Type == WeaponType.Bashing )
wear = (absorbed / 2);
else
wear = Utility.Random( 2 );
if( wear > 0 && MaxHitPoints > 0 )
if ( wear > 0 && MaxHitPoints > 0 )
{
if( HitPoints >= wear )
if ( HitPoints >= wear )
{
HitPoints -= wear;
wear = 0;
@ -94,13 +94,13 @@ namespace Server.Items
HitPoints = 0;
}
if( wear > 0 )
if ( wear > 0 )
{
if( MaxHitPoints > wear )
if ( MaxHitPoints > wear )
{
MaxHitPoints -= wear;
if( Parent is Mobile )
if ( Parent is Mobile )
((Mobile)Parent).LocalOverheadMessage( MessageType.Regular, 0x3B2, 1061121 ); // Your equipment is severely damaged.
}
else
@ -116,13 +116,13 @@ namespace Server.Items
else
{
Mobile owner = this.Parent as Mobile;
if( owner == null )
if ( owner == null )
return damage;
double ar = this.ArmorRating;
double chance = (owner.Skills[SkillName.Parry].Value - (ar * 2.0)) / 100.0;
if( chance < 0.01 )
if ( chance < 0.01 )
chance = 0.01;
/*
FORMULA: Displayed AR = ((Parrying Skill * Base AR of Shield) <EFBFBD> 200) + 1
@ -131,25 +131,25 @@ namespace Server.Items
FORMULA: Melee Damage Absorbed = (AR of Shield) / 2 | Archery Damage Absorbed = AR of Shield
*/
if( owner.CheckSkill( SkillName.Parry, chance ) )
if ( owner.CheckSkill( SkillName.Parry, chance ) )
{
if( weapon.Skill == SkillName.Archery )
if ( weapon.Skill == SkillName.Archery )
damage -= (int)ar;
else
damage -= (int)(ar / 2.0);
if( damage < 0 )
if ( damage < 0 )
damage = 0;
owner.FixedEffect( 0x37B9, 10, 16 );
if( 25 > Utility.Random( 100 ) ) // 25% chance to lower durability
if ( 25 > Utility.Random( 100 ) ) // 25% chance to lower durability
{
int wear = Utility.Random( 2 );
if( wear > 0 && MaxHitPoints > 0 )
if ( wear > 0 && MaxHitPoints > 0 )
{
if( HitPoints >= wear )
if ( HitPoints >= wear )
{
HitPoints -= wear;
wear = 0;
@ -160,13 +160,13 @@ namespace Server.Items
HitPoints = 0;
}
if( wear > 0 )
if ( wear > 0 )
{
if( MaxHitPoints > wear )
if ( MaxHitPoints > wear )
{
MaxHitPoints -= wear;
if( Parent is Mobile )
if ( Parent is Mobile )
((Mobile)Parent).LocalOverheadMessage( MessageType.Regular, 0x3B2, 1061121 ); // Your equipment is severely damaged.
}
else