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

@ -52,13 +52,13 @@ namespace Server.Mobiles
public override void OnDoubleClick( Mobile from )
{
if( from.AccessLevel >= AccessLevel.GameMaster )
if ( from.AccessLevel >= AccessLevel.GameMaster )
Jump();
}
public virtual void Jump()
{
if( Utility.RandomBool() )
if ( Utility.RandomBool() )
Animate( 3, 16, 1, true, false, 0 );
else
Animate( 4, 20, 1, true, false, 0 );
@ -66,7 +66,7 @@ namespace Server.Mobiles
public override void OnThink()
{
if( Utility.RandomDouble() < .005 ) // slim chance to jump
if ( Utility.RandomDouble() < .005 ) // slim chance to jump
Jump();
base.OnThink();

View file

@ -247,7 +247,7 @@ namespace Server.Mobiles
}
else
{
if( m_Rider != null )
if ( m_Rider != null )
{
Dismount( m_Rider );
}
@ -261,7 +261,7 @@ namespace Server.Mobiles
Internalize();
if( value.Target is Bola.BolaTarget )
if ( value.Target is Bola.BolaTarget )
{
Target.Cancel( value );
}
@ -292,16 +292,16 @@ namespace Server.Mobiles
public virtual void OnRiderDamaged( int amount, Mobile from, bool willKill )
{
if( m_Rider == null )
if ( m_Rider == null )
return;
Mobile attacker = from;
if( attacker == null )
if ( attacker == null )
attacker = m_Rider.FindMostRecentDamager( true );
if( !(attacker == this || attacker == m_Rider || willKill || DateTime.UtcNow < m_NextMountAbility) )
if ( !(attacker == this || attacker == m_Rider || willKill || DateTime.UtcNow < m_NextMountAbility) )
{
if( DoMountAbility( amount, from ) )
if ( DoMountAbility( amount, from ) )
m_NextMountAbility = DateTime.UtcNow + MountAbilityDelay;
}

View file

@ -50,12 +50,12 @@ namespace Server.Mobiles
{
base.GetProperties( list );
if( m_IsDonationItem )
if ( m_IsDonationItem )
{
list.Add( "Donation Ethereal" );
list.Add( "7.5 sec slower cast time if not a 9mo. Veteran" );
}
if( Core.ML && m_IsRewardItem )
if ( Core.ML && m_IsRewardItem )
list.Add( RewardSystem.GetRewardYearLabel( this, new object[] { } ) ); // X Year Veteran Reward
}
@ -68,11 +68,11 @@ namespace Server.Mobiles
}
set
{
if( m_MountedID != value )
if ( m_MountedID != value )
{
m_MountedID = value;
if( m_Rider != null )
if ( m_Rider != null )
ItemID = value;
}
}
@ -87,11 +87,11 @@ namespace Server.Mobiles
}
set
{
if( m_RegularID != value )
if ( m_RegularID != value )
{
m_RegularID = value;
if( m_Rider == null )
if ( m_Rider == null )
ItemID = value;
}
}
@ -108,57 +108,57 @@ namespace Server.Mobiles
public void RemoveFollowers()
{
if( m_Rider != null )
if ( m_Rider != null )
m_Rider.Followers -= FollowerSlots;
if( m_Rider != null && m_Rider.Followers < 0 )
if ( m_Rider != null && m_Rider.Followers < 0 )
m_Rider.Followers = 0;
}
public void AddFollowers()
{
if( m_Rider != null )
if ( m_Rider != null )
m_Rider.Followers += FollowerSlots;
}
public virtual bool Validate( Mobile from )
{
if( Parent == null )
if ( Parent == null )
{
from.SayTo( from, 1010095 ); // This must be on your person to use.
return false;
}
else if( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) )
else if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) )
{
// CheckIsUsableBy sends the message
return false;
}
else if( !BaseMount.CheckMountAllowed( from ) )
else if ( !BaseMount.CheckMountAllowed( from ) )
{
// CheckMountAllowed sends the message
return false;
}
else if( from.Mounted )
else if ( from.Mounted )
{
from.SendLocalizedMessage( 1005583 ); // Please dismount first.
return false;
}
else if( from.IsBodyMod && !from.Body.IsHuman )
else if ( from.IsBodyMod && !from.Body.IsHuman )
{
from.SendLocalizedMessage( 1061628 ); // You can't do that while polymorphed.
return false;
}
else if( from.HasTrade )
else if ( from.HasTrade )
{
from.SendLocalizedMessage( 1042317, "", 0x41 ); // You may not ride at this time
return false;
}
else if( ( from.Followers + FollowerSlots ) > from.FollowersMax )
else if ( ( from.Followers + FollowerSlots ) > from.FollowersMax )
{
from.SendLocalizedMessage( 1049679 ); // You have too many followers to summon your mount.
return false;
}
else if( !Multis.DesignContext.Check( from ) )
else if ( !Multis.DesignContext.Check( from ) )
{
// Check sends the message
return false;
@ -169,7 +169,7 @@ namespace Server.Mobiles
public override void OnDoubleClick( Mobile from )
{
if( Validate( from ) )
if ( Validate( from ) )
new EtherealSpell( this, from ).Cast();
}
@ -223,7 +223,7 @@ namespace Server.Mobiles
m_RegularID = reader.ReadInt();
m_Rider = reader.ReadMobile();
if( m_MountedID == 0x3EA2 )
if ( m_MountedID == 0x3EA2 )
m_MountedID = 0x3EAA;
break;
@ -232,7 +232,7 @@ namespace Server.Mobiles
AddFollowers();
if( version < 3 && Weight == 0 )
if ( version < 3 && Weight == 0 )
Weight = -1;
}
@ -247,7 +247,7 @@ namespace Server.Mobiles
{
IMount mount = m.Mount;
if( mount != null )
if ( mount != null )
mount.Rider = null;
}
@ -260,9 +260,9 @@ namespace Server.Mobiles
}
set
{
if( value != m_Rider )
if ( value != m_Rider )
{
if( value == null )
if ( value == null )
{
Internalize();
UnmountMe();
@ -272,7 +272,7 @@ namespace Server.Mobiles
}
else
{
if( m_Rider != null )
if ( m_Rider != null )
Dismount( m_Rider );
Dismount( value );
@ -297,10 +297,10 @@ namespace Server.Mobiles
Layer = Layer.Invalid;
Movable = true;
if( Hue == EtherealHue )
if ( Hue == EtherealHue )
Hue = 0;
if( bp != null )
if ( bp != null )
{
bp.DropItem( this );
}
@ -309,7 +309,7 @@ namespace Server.Mobiles
Point3D loc = m_Rider.Location;
Map map = m_Rider.Map;
if( map == null || map == Map.Internal )
if ( map == null || map == Map.Internal )
{
loc = m_Rider.LogoutLocation;
map = m_Rider.LogoutMap;
@ -325,7 +325,7 @@ namespace Server.Mobiles
Layer = Layer.Mount;
Movable = false;
if( Hue == 0 )
if ( Hue == 0 )
Hue = EtherealHue;
ProcessDelta();
@ -345,7 +345,7 @@ namespace Server.Mobiles
public static void StopMounting( Mobile mob )
{
if( mob.Spell is EtherealSpell )
if ( mob.Spell is EtherealSpell )
( (EtherealSpell)mob.Spell ).Stop();
}
@ -410,7 +410,7 @@ namespace Server.Mobiles
public override bool CheckDisturb( DisturbType type, bool checkFirst, bool resistable )
{
if( type == DisturbType.EquipRequest || type == DisturbType.UseRequest/* || type == DisturbType.Hurt*/ )
if ( type == DisturbType.EquipRequest || type == DisturbType.UseRequest/* || type == DisturbType.Hurt*/ )
return false;
return true;
@ -418,19 +418,19 @@ namespace Server.Mobiles
public override void DoHurtFizzle()
{
if( !m_Stop )
if ( !m_Stop )
base.DoHurtFizzle();
}
public override void DoFizzle()
{
if( !m_Stop )
if ( !m_Stop )
base.DoFizzle();
}
public override void OnDisturb( DisturbType type, bool message )
{
if( message && !m_Stop )
if ( message && !m_Stop )
Caster.SendLocalizedMessage( 1049455 ); // You have been disrupted while attempting to summon your ethereal mount!
//m_Mount.UnmountMe();
@ -438,7 +438,7 @@ namespace Server.Mobiles
public override void OnCast()
{
if( !m_Mount.Deleted && m_Mount.Rider == null && m_Mount.Validate( m_Rider ) )
if ( !m_Mount.Deleted && m_Mount.Rider == null && m_Mount.Validate( m_Rider ) )
m_Mount.Rider = m_Rider;
FinishSequence();
@ -474,10 +474,10 @@ namespace Server.Mobiles
int version = reader.ReadInt();
if( Name == "an ethereal horse" )
if ( Name == "an ethereal horse" )
Name = null;
if( ItemID == 0x2124 )
if ( ItemID == 0x2124 )
ItemID = 0x20DD;
}
}
@ -510,7 +510,7 @@ namespace Server.Mobiles
int version = reader.ReadInt();
if( Name == "an ethereal llama" )
if ( Name == "an ethereal llama" )
Name = null;
}
}
@ -543,7 +543,7 @@ namespace Server.Mobiles
int version = reader.ReadInt();
if( Name == "an ethereal ostard" )
if ( Name == "an ethereal ostard" )
Name = null;
}
}
@ -576,7 +576,7 @@ namespace Server.Mobiles
int version = reader.ReadInt();
if( Name == "an ethereal ridgeback" )
if ( Name == "an ethereal ridgeback" )
Name = null;
}
}
@ -609,7 +609,7 @@ namespace Server.Mobiles
int version = reader.ReadInt();
if( Name == "an ethereal unicorn" )
if ( Name == "an ethereal unicorn" )
Name = null;
}
}
@ -642,7 +642,7 @@ namespace Server.Mobiles
int version = reader.ReadInt();
if( Name == "an ethereal beetle" )
if ( Name == "an ethereal beetle" )
Name = null;
}
}
@ -675,7 +675,7 @@ namespace Server.Mobiles
int version = reader.ReadInt();
if( Name == "an ethereal kirin" )
if ( Name == "an ethereal kirin" )
Name = null;
}
}
@ -708,7 +708,7 @@ namespace Server.Mobiles
int version = reader.ReadInt();
if( Name == "an ethereal swamp dragon" )
if ( Name == "an ethereal swamp dragon" )
Name = null;
}
}
@ -864,7 +864,7 @@ namespace Server.Mobiles
int version = reader.ReadInt();
if( version <= 1 && Hue != 0 )
if ( version <= 1 && Hue != 0 )
{
Hue = 0;
}

View file

@ -76,7 +76,7 @@ namespace Server.Mobiles
if ( BaseSoundID <= 0 )
BaseSoundID = 0xA8;
if( version < 1 )
if ( version < 1 )
{
for ( int i = 0; i < Skills.Length; ++i )
{

View file

@ -41,31 +41,31 @@ namespace Server.Mobiles
1 1075 Strong Green 0.09% 0x855C
* */
if( rand <= 0 )
if ( rand <= 0 )
return 0x855C;
else if( rand <= 1 )
else if ( rand <= 1 )
return 0x8490;
else if( rand <= 3 )
else if ( rand <= 3 )
return 0x8030;
else if( rand <= 5 )
else if ( rand <= 5 )
return 0x8037;
else if( rand <= 8 )
else if ( rand <= 8 )
return 0x8295;
else if( rand <= 11 )
else if ( rand <= 11 )
return 0x8123;
else if( rand <= 16 )
else if ( rand <= 16 )
return 0x8482;
else if( rand <= 24 )
else if ( rand <= 24 )
return 0x8487;
else if( rand <= 34 )
else if ( rand <= 34 )
return 0x8032;
else if( rand <= 44 )
else if ( rand <= 44 )
return 0x8899;
else if( rand <= 54 )
else if ( rand <= 54 )
return 0x8495;
else if( rand <= 64 )
else if ( rand <= 64 )
return 0x848D;
else if( rand <= 74 )
else if ( rand <= 74 )
return 0x847F;
@ -107,7 +107,7 @@ namespace Server.Mobiles
ControlSlots = 4;
MinTameSkill = 98.7;
if( Utility.RandomDouble() < .33 )
if ( Utility.RandomDouble() < .33 )
PackItem( Engines.Plants.Seed.RandomBonsaiSeed() );
if ( Core.ML && Utility.RandomDouble() < .33 )
@ -156,7 +156,7 @@ namespace Server.Mobiles
{
base.OnGaveMeleeAttack( defender );
if( 0.1 > Utility.RandomDouble() )
if ( 0.1 > Utility.RandomDouble() )
{
/* Grasping Claw
* Start cliloc: 1070836
@ -167,7 +167,7 @@ namespace Server.Mobiles
ExpireTimer timer = (ExpireTimer)m_Table[defender];
if( timer != null )
if ( timer != null )
{
timer.DoExpire();
defender.SendLocalizedMessage( 1070837 ); // The creature lands another blow in your weakened state.
@ -233,13 +233,13 @@ namespace Server.Mobiles
base.Deserialize( reader );
int version = reader.ReadInt();
if( version == 0 )
if ( version == 0 )
Timer.DelayCall( TimeSpan.Zero, delegate { Hue = GetHue(); } );
if( version <= 1 )
Timer.DelayCall( TimeSpan.Zero, delegate { if( InternalItem != null ) { InternalItem.Hue = this.Hue; } } );
if ( version <= 1 )
Timer.DelayCall( TimeSpan.Zero, delegate { if ( InternalItem != null ) { InternalItem.Hue = this.Hue; } } );
if( version < 2 )
if ( version < 2 )
{
for ( int i = 0; i < Skills.Length; ++i )
{

View file

@ -22,10 +22,10 @@ namespace Server.Mobiles
public override bool DoMountAbility( int damage, Mobile attacker )
{
if( Rider == null || attacker == null ) //sanity
if ( Rider == null || attacker == null ) //sanity
return false;
if( (Rider.Hits - damage) < 30 && Rider.Map == attacker.Map && Rider.InRange( attacker, 18 ) ) //Range and map checked here instead of other base fuction because of abiliites that don't need to check this
if ( (Rider.Hits - damage) < 30 && Rider.Map == attacker.Map && Rider.InRange( attacker, 18 ) ) //Range and map checked here instead of other base fuction because of abiliites that don't need to check this
{
attacker.BoltEffect( 0 );
// 35~100 damage, unresistable, by the Ki-rin.

View file

@ -29,15 +29,15 @@ namespace Server.Mobiles
* */
if( rand <= 0 )
if ( rand <= 0 )
return 0x8258;
else if( rand <= 1 )
else if ( rand <= 1 )
return 0x88AB;
else if( rand <= 6 )
else if ( rand <= 6 )
return 0x87D4;
else if( rand <= 16 )
else if ( rand <= 16 )
return 0x8163;
else if( rand <= 26 )
else if ( rand <= 26 )
return 0x8295;
@ -79,7 +79,7 @@ namespace Server.Mobiles
ControlSlots = 3;
MinTameSkill = 98.7;
if( Utility.RandomDouble() < .33 )
if ( Utility.RandomDouble() < .33 )
PackItem( Engines.Plants.Seed.RandomBonsaiSeed() );
}
@ -126,21 +126,21 @@ namespace Server.Mobiles
{
double tamingChance = base.GetControlChance( m, useBaseSkill );
if( tamingChance >= 0.95 )
if ( tamingChance >= 0.95 )
{
return tamingChance;
}
double skill = (useBaseSkill? m.Skills.Bushido.Base : m.Skills.Bushido.Value);
if( skill < 90.0 )
if ( skill < 90.0 )
{
return tamingChance;
}
double bushidoChance = ( skill - 30.0 ) / 100;
if( m.Skills.Bushido.Base >= 120 )
if ( m.Skills.Bushido.Base >= 120 )
bushidoChance += 0.05;
return bushidoChance > tamingChance ? bushidoChance : tamingChance;
@ -156,7 +156,7 @@ namespace Server.Mobiles
{
base.OnGaveMeleeAttack( defender );
if( 0.1 > Utility.RandomDouble() )
if ( 0.1 > Utility.RandomDouble() )
{
/* Grasping Claw
* Start cliloc: 1070836
@ -167,7 +167,7 @@ namespace Server.Mobiles
ExpireTimer timer = (ExpireTimer)m_Table[defender];
if( timer != null )
if ( timer != null )
{
timer.DoExpire();
defender.SendLocalizedMessage( 1070837 ); // The creature lands another blow in your weakened state.
@ -233,13 +233,13 @@ namespace Server.Mobiles
base.Deserialize( reader );
int version = reader.ReadInt();
if( version == 0 )
if ( version == 0 )
Timer.DelayCall( TimeSpan.Zero, delegate { Hue = GetHue(); } );
if( version <= 1 )
Timer.DelayCall( TimeSpan.Zero, delegate { if( InternalItem != null ) { InternalItem.Hue = this.Hue; } } );
if ( version <= 1 )
Timer.DelayCall( TimeSpan.Zero, delegate { if ( InternalItem != null ) { InternalItem.Hue = this.Hue; } } );
if( version < 2 )
if ( version < 2 )
{
for ( int i = 0; i < Skills.Length; ++i )
{

View file

@ -22,21 +22,21 @@ namespace Server.Mobiles
public override bool DoMountAbility( int damage, Mobile attacker )
{
if( Rider == null || attacker == null ) //sanity
if ( Rider == null || attacker == null ) //sanity
return false;
if( Rider.Poisoned && ((Rider.Hits - damage) < 40) )
if ( Rider.Poisoned && ((Rider.Hits - damage) < 40) )
{
Poison p = Rider.Poison;
if( p != null )
if ( p != null )
{
int chanceToCure = 10000 + (int)(this.Skills[SkillName.Magery].Value * 75) - ((p.Level + 1) * (Core.AOS ? (p.Level < 4 ? 3300 : 3100) : 1750));
chanceToCure /= 100;
if( chanceToCure > Utility.Random( 100 ) )
if ( chanceToCure > Utility.Random( 100 ) )
{
if( Rider.CurePoison( this ) ) //TODO: Confirm if mount is the one flagged for curing it or the rider is
if ( Rider.CurePoison( this ) ) //TODO: Confirm if mount is the one flagged for curing it or the rider is
{
Rider.LocalOverheadMessage( Server.Network.MessageType.Regular, 0x3B2, true, "Your mount senses you are in danger and aids you with magic." );
Rider.FixedParticles( 0x373A, 10, 15, 5012, EffectLayer.Waist );