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

@ -49,7 +49,7 @@ namespace Server.Mobiles
PackItem( new ZoogiFungus( ( Utility.RandomDouble() > 0.05 )? 5 : 25 ) );
if( Utility.RandomDouble() < 0.05 )
if ( Utility.RandomDouble() < 0.05 )
PackItem( new BallOfSummoning() );
}

View file

@ -62,7 +62,7 @@ namespace Server.Mobiles
public override void OnDamagedBySpell( Mobile from )
{
if( from != null && from.Alive && 0.4 > Utility.RandomDouble() )
if ( from != null && from.Alive && 0.4 > Utility.RandomDouble() )
{
ThrowHatchet( from );
}
@ -72,7 +72,7 @@ namespace Server.Mobiles
{
base.OnGotMeleeAttack( attacker );
if( attacker != null && attacker.Alive && attacker.Weapon is BaseRanged && 0.4 > Utility.RandomDouble() )
if ( attacker != null && attacker.Alive && attacker.Weapon is BaseRanged && 0.4 > Utility.RandomDouble() )
{
ThrowHatchet( attacker );
}

View file

@ -115,7 +115,7 @@ namespace Server.Mobiles
public void BeginSavageDance()
{
if( this.Map == null )
if ( this.Map == null )
return;
ArrayList list = new ArrayList();

View file

@ -17,7 +17,7 @@ namespace Server.Mobiles
Hue = 0x8026;
Buckler buckler = new Buckler();
ChainCoif coif = new ChainCoif();
ChainCoif coif = new ChainCoif ();
PlateGloves gloves = new PlateGloves();
buckler.Hue = 0x835; buckler.Movable = false;

View file

@ -107,7 +107,7 @@ namespace Server.Mobiles
public override void OnDamagedBySpell( Mobile from )
{
if( from != null && from.Alive && 0.4 > Utility.RandomDouble() )
if ( from != null && from.Alive && 0.4 > Utility.RandomDouble() )
{
SendEBolt( from );
}
@ -139,7 +139,7 @@ namespace Server.Mobiles
attacker.SendAsciiMessage( "Your weapon cannot penetrate the creature's magical barrier" );
}
if( attacker != null && attacker.Alive && attacker.Weapon is BaseRanged && 0.4 > Utility.RandomDouble() )
if ( attacker != null && attacker.Alive && attacker.Weapon is BaseRanged && 0.4 > Utility.RandomDouble() )
{
SendEBolt( attacker );
}

View file

@ -103,7 +103,7 @@ namespace Server.Mobiles
public override void OnDamagedBySpell( Mobile from )
{
if( from != null && from.Alive && 0.4 > Utility.RandomDouble() )
if ( from != null && from.Alive && 0.4 > Utility.RandomDouble() )
{
SendEBolt( from );
}
@ -135,7 +135,7 @@ namespace Server.Mobiles
attacker.SendAsciiMessage( "Your weapon cannot penetrate the creature's magical barrier" );
}
if( attacker != null && attacker.Alive && attacker.Weapon is BaseRanged && 0.4 > Utility.RandomDouble() )
if ( attacker != null && attacker.Alive && attacker.Weapon is BaseRanged && 0.4 > Utility.RandomDouble() )
{
SendEBolt( attacker );
}
@ -185,7 +185,7 @@ namespace Server.Mobiles
m_FieldActive = CanUseField;
if( this.Name == "Exodus Overseer" )
if ( this.Name == "Exodus Overseer" )
this.Name = null;
}
}

View file

@ -197,9 +197,9 @@ namespace Server.Mobiles
less than stam.
*/
if( Str < Hits )
if ( Str < Hits )
Str = Hits;
if( Dex < Stam )
if ( Dex < Stam )
Dex = Stam;
Karma = -1000;
@ -211,7 +211,7 @@ namespace Server.Mobiles
public override void OnThink()
{
if( SummonMaster == null || SummonMaster.Deleted )
if ( SummonMaster == null || SummonMaster.Deleted )
{
Delete();
}
@ -222,9 +222,9 @@ namespace Server.Mobiles
but never actually "follow".
*/
else if( !Combat( this ))
else if ( !Combat( this ))
{
if( AIObject != null )
if ( AIObject != null )
{
AIObject.MoveTo( SummonMaster, false , 5 );
}
@ -237,14 +237,14 @@ namespace Server.Mobiles
engaged in combat.
*/
else if( !Combat( SummonMaster ))
else if ( !Combat( SummonMaster ))
{
BaseCreature bc = null;
if( Combatant is BaseCreature )
if ( Combatant is BaseCreature )
{
bc = (BaseCreature)Combatant;
}
if( Combatant.Player || ( bc != null && ( bc.Controlled || bc.SummonMaster != null )))
if ( Combatant.Player || ( bc != null && ( bc.Controlled || bc.SummonMaster != null )))
{
SummonMaster.Combatant = Combatant;
}
@ -258,7 +258,7 @@ namespace Server.Mobiles
private bool Combat( Mobile mobile )
{
Mobile combatant = mobile.Combatant;
if( combatant == null || combatant.Deleted )
if ( combatant == null || combatant.Deleted )
{
return false;
}

View file

@ -89,11 +89,11 @@ namespace Server.Mobiles
{
m_NextAbilityTime = DateTime.UtcNow + TimeSpan.FromSeconds( Utility.RandomMinMax( 20, 30 ) );
if( combatant is BaseCreature )
if ( combatant is BaseCreature )
{
BaseCreature bc = (BaseCreature)combatant;
if( bc.Controlled && bc.ControlMaster != null && !bc.ControlMaster.Deleted && bc.ControlMaster.Alive )
if ( bc.Controlled && bc.ControlMaster != null && !bc.ControlMaster.Deleted && bc.ControlMaster.Alive )
{
if ( bc.ControlMaster.Map == this.Map && bc.ControlMaster.InRange( this, 12 ) && !UnderEffect( bc.ControlMaster ) )
{
@ -102,7 +102,7 @@ namespace Server.Mobiles
}
}
if( Utility.RandomDouble() < .1 )
if ( Utility.RandomDouble() < .1 )
{
int[][] coord =
{

View file

@ -78,11 +78,11 @@ namespace Server.Mobiles
Say( m_Vocabulary[ Utility.Random( m_Vocabulary.Length ) ] );
if ( to != null && Utility.RandomBool() )
Timer.DelayCall( TimeSpan.FromSeconds( Utility.RandomMinMax( 5, 8 ) ), new TimerCallback( delegate() { to.Talk(); } ) );
Timer.DelayCall( TimeSpan.FromSeconds( Utility.RandomMinMax( 5, 8 ) ), new TimerCallback( delegate { to.Talk(); } ) );
m_CanTalk = false;
Timer.DelayCall( TimeSpan.FromSeconds( Utility.RandomMinMax( 20, 30 ) ), new TimerCallback( delegate() { m_CanTalk = true; } ) );
Timer.DelayCall( TimeSpan.FromSeconds( Utility.RandomMinMax( 20, 30 ) ), new TimerCallback( delegate { m_CanTalk = true; } ) );
}
}

View file

@ -86,7 +86,7 @@ namespace Server.Mobiles
public override void OnDamage( int amount, Mobile from, bool willKill )
{
if( Utility.RandomDouble() < 0.1 )
if ( Utility.RandomDouble() < 0.1 )
DropOoze();
base.OnDamage( amount, from, willKill );
@ -104,7 +104,7 @@ namespace Server.Mobiles
public virtual Point3D GetSpawnPosition( Point3D from, Map map, int range )
{
if( map == null )
if ( map == null )
return from;
Point3D loc = new Point3D( ( RandomPoint( X ) ), ( RandomPoint( Y ) ), Z );
@ -130,22 +130,22 @@ namespace Server.Mobiles
bool found = false;
foreach( Item item in Map.GetItemsInRange( p, 0 ) )
if( item is StainedOoze )
if ( item is StainedOoze )
{
found = true;
break;
}
if( !found )
if ( !found )
break;
}
ooze.MoveToWorld( p, Map );
}
if( Combatant != null )
if ( Combatant != null )
{
if( corrosive )
if ( corrosive )
Combatant.SendLocalizedMessage( 1072071 ); // A corrosive gas seeps out of your enemy's skin!
else
Combatant.SendLocalizedMessage( 1072072 ); // A poisonous gas seeps out of your enemy's skin!

View file

@ -90,7 +90,7 @@ namespace Server.Mobiles
SetDamage( 24, 33 );
if( version == 0 )
if ( version == 0 )
{
Server.SkillHandlers.AnimalTaming.ScaleStats( this, 0.50 );
Server.SkillHandlers.AnimalTaming.ScaleSkills( this, 0.80, 0.90 ); // 90% * 80% = 72% of original skills trainable to 90%

View file

@ -125,10 +125,10 @@ namespace Server.Mobiles
/*if ( Utility.RandomDouble() < 0.6 )
c.DropItem( new ParrotItem() ); */
if( Utility.RandomDouble() < 0.05 )
if ( Utility.RandomDouble() < 0.05 )
c.DropItem( new GrizzledMareStatuette() );
if( Utility.RandomDouble() < 0.025 )
if ( Utility.RandomDouble() < 0.025 )
c.DropItem( new CrimsonCincture() );
// TODO: Armor sets
@ -156,13 +156,13 @@ namespace Server.Mobiles
{
base.OnGaveMeleeAttack( defender );
if( Utility.RandomDouble() < 0.25 )
if ( Utility.RandomDouble() < 0.25 )
CacophonicAttack( defender );
}
public override void OnDamage( int amount, Mobile from, bool willKill )
{
if( Utility.RandomDouble() < 0.1 )
if ( Utility.RandomDouble() < 0.1 )
DropOoze();
base.OnDamage( amount, from, willKill );
@ -216,10 +216,10 @@ namespace Server.Mobiles
public virtual void CacophonicAttack( Mobile to )
{
if( m_Table == null )
if ( m_Table == null )
m_Table = new Hashtable();
if( to.Alive && to.Player && m_Table[ to ] == null )
if ( to.Alive && to.Player && m_Table[ to ] == null )
{
to.Send( SpeedControl.WalkSpeed );
to.SendLocalizedMessage( 1072069 ); // A cacophonic sound lambastes you, suppressing your ability to move.
@ -231,13 +231,13 @@ namespace Server.Mobiles
private void EndCacophonic_Callback( object state )
{
if( state is Mobile )
if ( state is Mobile )
CacophonicEnd( (Mobile)state );
}
public virtual void CacophonicEnd( Mobile from )
{
if( m_Table == null )
if ( m_Table == null )
m_Table = new Hashtable();
m_Table[ from ] = null;
@ -247,7 +247,7 @@ namespace Server.Mobiles
public static bool UnderCacophonicAttack( Mobile from )
{
if( m_Table == null )
if ( m_Table == null )
m_Table = new Hashtable();
return m_Table[ from ] != null;
@ -271,22 +271,22 @@ namespace Server.Mobiles
bool found = false;
foreach( Item item in Map.GetItemsInRange( p, 0 ) )
if( item is StainedOoze )
if ( item is StainedOoze )
{
found = true;
break;
}
if( !found )
if ( !found )
break;
}
ooze.MoveToWorld( p, Map );
}
if( Combatant != null )
if ( Combatant != null )
{
if( corrosive )
if ( corrosive )
Combatant.SendLocalizedMessage( 1072071 ); // A corrosive gas seeps out of your enemy's skin!
else
Combatant.SendLocalizedMessage( 1072072 ); // A poisonous gas seeps out of your enemy's skin!
@ -305,7 +305,7 @@ namespace Server.Mobiles
public virtual Point3D GetSpawnPosition( Point3D from, Map map, int range )
{
if( map == null )
if ( map == null )
return from;
Point3D loc = new Point3D( ( RandomPoint( X ) ), ( RandomPoint( Y ) ), Z );

View file

@ -187,10 +187,10 @@ 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 )
{
PlayerMobile pm = m as PlayerMobile;
if(pm != null && pm.Mounted)
if (pm != null && pm.Mounted)
{
pm.Mount.Rider=null;
}

View file

@ -55,11 +55,11 @@ namespace Server.Mobiles
{
base.OnGaveMeleeAttack( defender );
if( 0.1 > Utility.RandomDouble() )
if ( 0.1 > Utility.RandomDouble() )
{
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.

View file

@ -190,7 +190,7 @@ namespace Server.Mobiles
// Ensure that the corpse was killed by us
if ( item.Killer == this && item.Owner != null )
{
if( !item.DevourCorpse() && !item.Devoured )
if ( !item.DevourCorpse() && !item.Devoured )
PublicOverheadMessage( MessageType.Emote, 0x3B2, 1053032 ); // * The plague beast attempts to absorb the remains, but cannot! *
}
}
@ -201,10 +201,10 @@ namespace Server.Mobiles
public bool Devour( Corpse corpse )
{
if( corpse == null || corpse.Owner == null ) // sorry we can't devour because the corpse's owner is null
if ( corpse == null || corpse.Owner == null ) // sorry we can't devour because the corpse's owner is null
return false;
if( corpse.Owner.Body.IsHuman )
if ( corpse.Owner.Body.IsHuman )
corpse.TurnToBones(); // Not bones yet, and we are a human body therefore we turn to bones.
IncreaseHits( (int)Math.Ceiling( (double)corpse.Owner.HitsMax * 0.75 ) );
@ -212,7 +212,7 @@ namespace Server.Mobiles
PublicOverheadMessage( MessageType.Emote, 0x3B2, 1053033 ); // * The plague beast absorbs the fleshy remains of the corpse *
if( !m_HasMetalChest && m_DevourTotal >= DevourGoal )
if ( !m_HasMetalChest && m_DevourTotal >= DevourGoal )
{
PackItem( new MetalChest() );
m_HasMetalChest = true;
@ -230,10 +230,10 @@ namespace Server.Mobiles
if ( this.IsParagon )
maxhits = (int)(maxhits * Paragon.HitsBuff);
if( hp < 1000 && !Core.AOS )
if ( hp < 1000 && !Core.AOS )
hp = (hp * 100) / 60;
if( HitsMaxSeed >= maxhits )
if ( HitsMaxSeed >= maxhits )
{
HitsMaxSeed = maxhits;

View file

@ -50,7 +50,7 @@ namespace Server.Mobiles
rope.ItemID = 0x14F8;
PackItem( rope );
if( Utility.RandomDouble() < .05 )
if ( Utility.RandomDouble() < .05 )
PackItem( new MessageInABottle() );
PackItem( new SpecialFishingNet() ); //Confirm?

View file

@ -111,7 +111,7 @@ namespace Server.Mobiles
if ( combatant == null || combatant.Deleted || combatant.Map != Map || !InRange( combatant, 12 ) || !CanBeHarmful( combatant ) || !InLOS( combatant ) )
return;
if( Utility.Random( 10 ) == 0 )
if ( Utility.Random( 10 ) == 0 )
PoisonAttack( combatant );
base.OnDamage( amount, from, willKill );

View file

@ -41,7 +41,7 @@ namespace Server.Mobiles
Karma = -700;
if( Utility.RandomBool() )
if ( Utility.RandomBool() )
{
Item i = Loot.RandomReagent();
i.Amount = 3;

View file

@ -68,7 +68,7 @@ namespace Server.Mobiles
AddItem( new LeatherNinjaPants());
AddItem( new LeatherNinjaMitts());
if( Utility.RandomDouble() < 0.33 )
if ( Utility.RandomDouble() < 0.33 )
AddItem( new SmokeBomb() );
switch ( Utility.Random( 8 ))

View file

@ -118,7 +118,7 @@ namespace Server.Mobiles
int version = reader.ReadInt();
if( version == 0 )
if ( version == 0 )
Hue = 0x489;
}
}

View file

@ -58,7 +58,7 @@ namespace Server.Mobiles
{
base.OnGaveMeleeAttack( defender );
if( 0.1 > Utility.RandomDouble() )
if ( 0.1 > Utility.RandomDouble() )
{
/* Flurry of Twigs
* Start cliloc: 1070850
@ -69,7 +69,7 @@ namespace Server.Mobiles
ExpireTimer timer = (ExpireTimer)m_FlurryOfTwigsTable[defender];
if( timer != null )
if ( timer != null )
{
timer.DoExpire();
defender.SendLocalizedMessage( 1070851 ); // The creature lands another blow in your weakened state.
@ -88,7 +88,7 @@ namespace Server.Mobiles
timer.Start();
m_FlurryOfTwigsTable[defender] = timer;
}
else if( 0.05 > Utility.RandomDouble() )
else if ( 0.05 > Utility.RandomDouble() )
{
/* Chlorophyl Blast
* Start cliloc: 1070827
@ -99,7 +99,7 @@ namespace Server.Mobiles
ExpireTimer timer = (ExpireTimer)m_ChlorophylBlastTable[defender];
if( timer != null )
if ( timer != null )
{
timer.DoExpire();
defender.SendLocalizedMessage( 1070828 ); // The creature continues to hinder your energy resistance!
@ -147,7 +147,7 @@ namespace Server.Mobiles
protected override void OnTick()
{
if( m_Mod.Type == ResistanceType.Physical )
if ( m_Mod.Type == ResistanceType.Physical )
m_Mobile.SendLocalizedMessage( 1070852 ); // Your resistance to physical attacks has returned.
else
m_Mobile.SendLocalizedMessage( 1070829 ); // Your resistance to energy attacks has returned.

View file

@ -73,7 +73,7 @@ namespace Server.Mobiles
{
base.OnGaveMeleeAttack( defender );
if( 0.1 > Utility.RandomDouble() )
if ( 0.1 > Utility.RandomDouble() )
{
/* Cold Wind
* Graphics: Message - Type: "3" From: "0x57D4F5B" To: "0x0" ItemId: "0x37B9" ItemIdName: "glow" FromLocation: "(928 164, 34)" ToLocation: "(928 164, 34)" Speed: "10" Duration: "5" FixedDirection: "True" Explode: "False"
@ -85,7 +85,7 @@ namespace Server.Mobiles
ExpireTimer timer = (ExpireTimer)m_Table[defender];
if( timer != null )
if ( timer != null )
{
timer.DoExpire();
defender.SendLocalizedMessage( 1070831 ); // The freezing wind continues to blow!
@ -123,7 +123,7 @@ namespace Server.Mobiles
public void DrainLife()
{
if( m_Mobile.Alive )
if ( m_Mobile.Alive )
m_Mobile.Damage( 2, m_From );
else
DoExpire();
@ -133,7 +133,7 @@ namespace Server.Mobiles
{
DrainLife();
if( ++m_Count >= 5 )
if ( ++m_Count >= 5 )
{
DoExpire();
m_Mobile.SendLocalizedMessage( 1070830 ); // The icy wind dissipates.

View file

@ -69,7 +69,7 @@ namespace Server.Mobiles
if( Utility.RandomDouble() > .2 )
if ( Utility.RandomDouble() > .2 )
AddItem( new NoDachi() );
else
AddItem( new Halberd() );

View file

@ -220,7 +220,7 @@ namespace Server.Mobiles
base.Deserialize( reader );
int version = reader.ReadInt();
if( version < 1 )
if ( version < 1 )
{
for ( int i = 0; i < Skills.Length; ++i )
{

View file

@ -75,7 +75,7 @@ namespace Server.Mobiles
{
base.OnGaveMeleeAttack( defender );
if( 0.1 > Utility.RandomDouble() )
if ( 0.1 > Utility.RandomDouble() )
{
/* Blood Bath
* Start cliloc 1070826
@ -87,7 +87,7 @@ namespace Server.Mobiles
ExpireTimer timer = (ExpireTimer)m_Table[defender];
if( timer != null )
if ( timer != null )
{
timer.DoExpire();
defender.SendLocalizedMessage( 1070825 ); // The creature continues to rage!
@ -125,7 +125,7 @@ namespace Server.Mobiles
public void DrainLife()
{
if( m_Mobile.Alive )
if ( m_Mobile.Alive )
m_Mobile.Damage( 2, m_From );
else
DoExpire();
@ -135,7 +135,7 @@ namespace Server.Mobiles
{
DrainLife();
if( ++m_Count >= 5 )
if ( ++m_Count >= 5 )
{
DoExpire();
m_Mobile.SendLocalizedMessage( 1070824 ); // The creature's rage subsides.

View file

@ -78,7 +78,7 @@ namespace Server.Mobiles
private void DoCounter( Mobile attacker )
{
if( this.Map == null )
if ( this.Map == null )
return;
if ( attacker is BaseCreature && ((BaseCreature)attacker).BardProvoked )
@ -99,7 +99,7 @@ namespace Server.Mobiles
{
Mobile m = ((BaseCreature)attacker).GetMaster();
if( m != null )
if ( m != null )
target = m;
}

View file

@ -45,7 +45,7 @@ namespace Server.Mobiles
PackItem( new GreenGourd() );
PackItem( new ExecutionersAxe() );
if( Utility.RandomBool() )
if ( Utility.RandomBool() )
PackItem( new LongPants() );
else
PackItem( new ShortPants() );