More casting fixes
This commit is contained in:
parent
f211efc3bd
commit
20a80ea2f3
40 changed files with 125 additions and 211 deletions
|
|
@ -231,8 +231,8 @@ namespace Server.Mobiles
|
|||
|
||||
private void EndCacophonic_Callback( object state )
|
||||
{
|
||||
if ( state is Mobile )
|
||||
CacophonicEnd( (Mobile)state );
|
||||
if ( state is Mobile mobile )
|
||||
CacophonicEnd( mobile );
|
||||
}
|
||||
|
||||
public virtual void CacophonicEnd( Mobile from )
|
||||
|
|
@ -362,10 +362,8 @@ namespace Server.Mobiles
|
|||
|
||||
foreach ( Mobile m in GetMobilesInRange( 0 ) )
|
||||
{
|
||||
if ( m is BaseCreature )
|
||||
if ( m is BaseCreature bc )
|
||||
{
|
||||
BaseCreature bc = (BaseCreature)m;
|
||||
|
||||
if ( !bc.Controlled && !bc.Summoned )
|
||||
continue;
|
||||
}
|
||||
|
|
@ -398,9 +396,7 @@ namespace Server.Mobiles
|
|||
|
||||
for ( int i = 0; i < items.Count; ++i )
|
||||
{
|
||||
IDurability wearable = items[i] as IDurability;
|
||||
|
||||
if ( wearable != null && wearable.HitPoints >= 10 && Utility.RandomDouble() < 0.25 )
|
||||
if ( items[i] is IDurability wearable && wearable.HitPoints >= 10 && Utility.RandomDouble() < 0.25 )
|
||||
{
|
||||
wearable.HitPoints -= ( wearable.HitPoints == 10 ) ? Utility.Random( 1, 5 ) : 10;
|
||||
damaged = true;
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
if (m == this || !CanBeHarmful(m))
|
||||
continue;
|
||||
if (m is BaseCreature && (((BaseCreature)m).Controlled || ((BaseCreature)m).Summoned || ((BaseCreature)m).Team != this.Team))
|
||||
if (m is BaseCreature creature && (creature.Controlled || creature.Summoned || creature.Team != this.Team))
|
||||
targets.Add(m);
|
||||
else if (m.Player)
|
||||
targets.Add(m);
|
||||
|
|
@ -187,15 +187,14 @@ namespace Server.Mobiles
|
|||
for (int i = 0; i < targets.Count; ++i)
|
||||
{
|
||||
Mobile m = (Mobile)targets[i];
|
||||
if ( m != null && !m.Deleted && m is PlayerMobile )
|
||||
if ( m != null && !m.Deleted && m is PlayerMobile pm )
|
||||
{
|
||||
PlayerMobile pm = m as PlayerMobile;
|
||||
if (pm != null && pm.Mounted)
|
||||
if (pm.Mounted)
|
||||
{
|
||||
pm.Mount.Rider=null;
|
||||
pm.Mount.Rider = null;
|
||||
}
|
||||
}
|
||||
double damage = m.Hits * 0.6;//was .6
|
||||
double damage = m.Hits * 0.6; //was .6
|
||||
if (damage < 10.0)
|
||||
damage = 10.0;
|
||||
else if (damage > 75.0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue