From 1a0242229914668bfb528ffdfa4871f76a90d7f0 Mon Sep 17 00:00:00 2001 From: xavier Date: Sun, 28 Aug 2011 01:23:55 +0000 Subject: [PATCH] --- Scripts/Gumps/ConfirmBreakCrystalGump.cs | 4 +- Scripts/Gumps/SetSecureLevelGump.cs | 2 +- Scripts/Mobiles/AI/BaseAI.cs | 4 +- Scripts/Mobiles/AI/MageAI.cs | 598 ++++++++++-------- Scripts/Mobiles/BaseCreature.cs | 2 + Scripts/Mobiles/Monsters/AOS/DemonKnight.cs | 3 + .../Mobiles/Monsters/Humanoid/Magic/Lich.cs | 4 + .../Monsters/Humanoid/Magic/LichLord.cs | 3 + Scripts/Spells/Necromancy/PoisonStrike.cs | 7 +- Scripts/Spells/Necromancy/Wither.cs | 33 +- 10 files changed, 368 insertions(+), 292 deletions(-) diff --git a/Scripts/Gumps/ConfirmBreakCrystalGump.cs b/Scripts/Gumps/ConfirmBreakCrystalGump.cs index c86193606..d5ee878e4 100644 --- a/Scripts/Gumps/ConfirmBreakCrystalGump.cs +++ b/Scripts/Gumps/ConfirmBreakCrystalGump.cs @@ -26,7 +26,9 @@ namespace Server.Gumps if ( summon != null ) { if ( !summon.SetControlMaster( from ) ) - from.SendLocalizedMessage( 1049607 ); // You have too many followers to control that creature. + { + summon.Delete(); + } else { from.SendLocalizedMessage( 1049666 ); // Your pet has bonded with you! diff --git a/Scripts/Gumps/SetSecureLevelGump.cs b/Scripts/Gumps/SetSecureLevelGump.cs index 779d6e700..cb1935c29 100644 --- a/Scripts/Gumps/SetSecureLevelGump.cs +++ b/Scripts/Gumps/SetSecureLevelGump.cs @@ -85,7 +85,7 @@ namespace Server.Gumps } else { - m_Info.Level = level; + m_Info.Level = level; state.Mobile.SendLocalizedMessage( 1061280 ); // New access level set. } } diff --git a/Scripts/Mobiles/AI/BaseAI.cs b/Scripts/Mobiles/AI/BaseAI.cs index 113eab9e8..a8e3fe46f 100644 --- a/Scripts/Mobiles/AI/BaseAI.cs +++ b/Scripts/Mobiles/AI/BaseAI.cs @@ -1619,10 +1619,12 @@ namespace Server.Mobiles { Name = creature.Name; } - else if( this.ItemID == ShrinkTable.DefaultItemID || creature.GetType().IsDefined( typeof( FriendlyNameAttribute ), false ) ) + else if( this.ItemID == ShrinkTable.DefaultItemID || creature.GetType().IsDefined( typeof( FriendlyNameAttribute ), false ) || creature is Reptalon ) Name = FriendlyNameAttribute.GetFriendlyNameFor( creature.GetType() ).ToString(); //(As Per OSI)No name. Normally, set by the ItemID of the Shrink Item unless we either explicitly set it with an Attribute, or, no lookup found + + Hue = creature.Hue; } public TransferItem( Serial serial ) diff --git a/Scripts/Mobiles/AI/MageAI.cs b/Scripts/Mobiles/AI/MageAI.cs index 6c8be3b4a..9d8586073 100644 --- a/Scripts/Mobiles/AI/MageAI.cs +++ b/Scripts/Mobiles/AI/MageAI.cs @@ -1,21 +1,16 @@ using System; using System.Collections; using System.Collections.Generic; -using Server.Targeting; -using Server.Network; -using Server.Mobiles; -using Server.Items; using Server.Spells; -using Server.Spells.First; -using Server.Spells.Second; -using Server.Spells.Third; -using Server.Spells.Fourth; using Server.Spells.Fifth; -using Server.Spells.Sixth; +using Server.Spells.First; +using Server.Spells.Fourth; +using Server.Spells.Necromancy; +using Server.Spells.Second; using Server.Spells.Seventh; -using Server.Misc; -using Server.Regions; -using Server.SkillHandlers; +using Server.Spells.Sixth; +using Server.Spells.Third; +using Server.Targeting; namespace Server.Mobiles { @@ -24,16 +19,17 @@ namespace Server.Mobiles private DateTime m_NextCastTime; private DateTime m_NextHealTime; - public MageAI( BaseCreature m ) : base( m ) + public MageAI( BaseCreature m ) + : base( m ) { } public override bool Think() { - if ( m_Mobile.Deleted ) + if( m_Mobile.Deleted ) return false; - if ( ProcessTarget() ) + if( ProcessTarget() ) return true; else return base.Think(); @@ -41,7 +37,7 @@ namespace Server.Mobiles public virtual bool SmartAI { - get{ return ( m_Mobile is BaseVendor || m_Mobile is BaseEscortable ); } + get { return ( m_Mobile is BaseVendor || m_Mobile is BaseEscortable ); } } private const double HealChance = 0.10; // 10% chance to heal at gm magery @@ -50,21 +46,21 @@ namespace Server.Mobiles public virtual double ScaleByMagery( double v ) { - return m_Mobile.Skills[SkillName.Magery].Value * v * 0.01; + return m_Mobile.Skills[ SkillName.Magery ].Value * v * 0.01; } public override bool DoActionWander() { - if ( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) ) + if( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) ) { - if ( m_Mobile.Debug ) + if( m_Mobile.Debug ) m_Mobile.DebugSay( "I am going to attack {0}", m_Mobile.FocusMob.Name ); m_Mobile.Combatant = m_Mobile.FocusMob; Action = ActionType.Combat; m_NextCastTime = DateTime.Now; } - else if ( SmartAI && m_Mobile.Mana < m_Mobile.ManaMax ) + else if( SmartAI && m_Mobile.Mana < m_Mobile.ManaMax ) { m_Mobile.DebugSay( "I am going to meditate" ); @@ -78,11 +74,11 @@ namespace Server.Mobiles base.DoActionWander(); - if ( (Utility.RandomDouble() < .05) ) + if( ( Utility.RandomDouble() < .05 ) ) { Spell spell = CheckCastHealingSpell(); - if ( spell != null ) + if( spell != null ) spell.Cast(); } } @@ -93,45 +89,45 @@ namespace Server.Mobiles private Spell CheckCastHealingSpell() { // If I'm poisoned, always attempt to cure. - if ( m_Mobile.Poisoned ) + if( m_Mobile.Poisoned ) return new CureSpell( m_Mobile, null ); // Summoned creatures never heal themselves. - if ( m_Mobile.Summoned ) + if( m_Mobile.Summoned ) return null; - if ( m_Mobile.Controlled ) + if( m_Mobile.Controlled ) { - if ( DateTime.Now < m_NextHealTime ) + if( DateTime.Now < m_NextHealTime ) return null; } - if ( !SmartAI ) + if( !SmartAI ) { - if ( ScaleByMagery( HealChance ) < Utility.RandomDouble() ) + if( ScaleByMagery( HealChance ) < Utility.RandomDouble() ) return null; } else { - if ( Utility.Random( 0, 4 + (m_Mobile.Hits == 0 ? m_Mobile.HitsMax : (m_Mobile.HitsMax / m_Mobile.Hits)) ) < 3 ) + if( Utility.Random( 0, 4 + ( m_Mobile.Hits == 0 ? m_Mobile.HitsMax : ( m_Mobile.HitsMax / m_Mobile.Hits ) ) ) < 3 ) return null; } Spell spell = null; - if ( m_Mobile.Hits < (m_Mobile.HitsMax - 50) ) + if( m_Mobile.Hits < ( m_Mobile.HitsMax - 50 ) ) { spell = new GreaterHealSpell( m_Mobile, null ); - if ( spell == null ) + if( spell == null ) spell = new HealSpell( m_Mobile, null ); } - else if ( m_Mobile.Hits < (m_Mobile.HitsMax - 10) ) + else if( m_Mobile.Hits < ( m_Mobile.HitsMax - 10 ) ) spell = new HealSpell( m_Mobile, null ); double delay; - if ( m_Mobile.Int >= 500 ) + if( m_Mobile.Int >= 500 ) delay = Utility.RandomMinMax( 7, 10 ); else delay = Math.Sqrt( 600 - m_Mobile.Int ); @@ -143,29 +139,29 @@ namespace Server.Mobiles public void RunTo( Mobile m ) { - if ( !SmartAI ) + if( !SmartAI ) { - if ( !MoveTo( m, true, m_Mobile.RangeFight ) ) + if( !MoveTo( m, true, m_Mobile.RangeFight ) ) OnFailedMove(); return; } - if ( m.Paralyzed || m.Frozen ) + if( m.Paralyzed || m.Frozen ) { - if ( m_Mobile.InRange( m, 1 ) ) + if( m_Mobile.InRange( m, 1 ) ) RunFrom( m ); - else if ( !m_Mobile.InRange( m, m_Mobile.RangeFight > 2 ? m_Mobile.RangeFight : 2 ) && !MoveTo( m, true, 1 ) ) + else if( !m_Mobile.InRange( m, m_Mobile.RangeFight > 2 ? m_Mobile.RangeFight : 2 ) && !MoveTo( m, true, 1 ) ) OnFailedMove(); } else { - if ( !m_Mobile.InRange( m, m_Mobile.RangeFight ) ) + if( !m_Mobile.InRange( m, m_Mobile.RangeFight ) ) { - if ( !MoveTo( m, true, 1 ) ) + if( !MoveTo( m, true, 1 ) ) OnFailedMove(); } - else if ( m_Mobile.InRange( m, m_Mobile.RangeFight - 1 ) ) + else if( m_Mobile.InRange( m, m_Mobile.RangeFight - 1 ) ) { RunFrom( m ); } @@ -174,23 +170,23 @@ namespace Server.Mobiles public void RunFrom( Mobile m ) { - Run( (m_Mobile.GetDirectionTo( m ) - 4) & Direction.Mask ); + Run( ( m_Mobile.GetDirectionTo( m ) - 4 ) & Direction.Mask ); } public void OnFailedMove() { - if ( !m_Mobile.DisallowAllMoves && (SmartAI ? Utility.Random( 4 ) == 0 : ScaleByMagery( TeleportChance ) > Utility.RandomDouble()) ) + if( !m_Mobile.DisallowAllMoves && ( SmartAI ? Utility.Random( 4 ) == 0 : ScaleByMagery( TeleportChance ) > Utility.RandomDouble() ) ) { - if ( m_Mobile.Target != null ) + if( m_Mobile.Target != null ) m_Mobile.Target.Cancel( m_Mobile, TargetCancelType.Canceled ); new TeleportSpell( m_Mobile, null ).Cast(); m_Mobile.DebugSay( "I am stuck, I'm going to try teleporting away" ); } - else if ( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) ) + else if( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) ) { - if ( m_Mobile.Debug ) + if( m_Mobile.Debug ) m_Mobile.DebugSay( "My move is blocked, so I am going to attack {0}", m_Mobile.FocusMob.Name ); m_Mobile.Combatant = m_Mobile.FocusMob; @@ -204,44 +200,102 @@ namespace Server.Mobiles public void Run( Direction d ) { - if ( (m_Mobile.Spell != null && m_Mobile.Spell.IsCasting) || m_Mobile.Paralyzed || m_Mobile.Frozen || m_Mobile.DisallowAllMoves ) + if( ( m_Mobile.Spell != null && m_Mobile.Spell.IsCasting ) || m_Mobile.Paralyzed || m_Mobile.Frozen || m_Mobile.DisallowAllMoves ) return; m_Mobile.Direction = d | Direction.Running; - if ( !DoMove( m_Mobile.Direction, true ) ) + if( !DoMove( m_Mobile.Direction, true ) ) OnFailedMove(); } + public virtual bool CanCastNecro() + { + return ( Utility.RandomBool() && ( m_Mobile is BaseCreature ) && ( (BaseCreature)m_Mobile ).IsNecromancer ); + } + + public virtual bool CanCastNecroBias( int bias ) + { + return ( CanCastNecro() && Utility.Random( bias ) == 1 ); + } + + public virtual Spell GetRandomDamage() + { + return ( CanCastNecroBias( 2 ) ) ? GetRandomDamageNecroSpell() : GetRandomDamageSpell(); + } + + public virtual Spell GetRandomDamageNecroSpell() + { + int possibles = 3; + + if( myNecro >= 100 ) + { + possibles = 4; + } + switch( Utility.Random( possibles ) ) + { + default: m_Mobile.DebugSay( "Vengeful Spriti" ); return new VengefulSpiritSpell( m_Mobile, null ); + + case 0: m_Mobile.DebugSay( "Pain Spike" ); return new PainSpikeSpell( m_Mobile, null ); + case 1: m_Mobile.DebugSay( "Poison Strike" ); return new PoisonStrikeSpell( m_Mobile, null ); + case 2: m_Mobile.DebugSay( "Strangle" ); return new StrangleSpell( m_Mobile, null ); + case 3: m_Mobile.DebugSay( "Wither" ); return new WitherSpell( m_Mobile, null ); + } + } + public virtual Spell GetRandomDamageSpell() { - int maxCircle = (int)((m_Mobile.Skills[SkillName.Magery].Value + 20.0) / (100.0 / 7.0)); + int maxCircle = (int)( ( myMagery + 20.0 ) / ( 100.0 / 7.0 ) ); - if ( maxCircle < 1 ) + if( maxCircle < 1 ) maxCircle = 1; - switch ( Utility.Random( maxCircle*2 ) ) + switch( Utility.Random( maxCircle * 2 ) ) { - case 0: case 1: return new MagicArrowSpell( m_Mobile, null ); - case 2: case 3: return new HarmSpell( m_Mobile, null ); - case 4: case 5: return new FireballSpell( m_Mobile, null ); - case 6: case 7: return new LightningSpell( m_Mobile, null ); - case 8: case 9: return new MindBlastSpell( m_Mobile, null ); + case 0: + case 1: return new MagicArrowSpell( m_Mobile, null ); + case 2: + case 3: return new HarmSpell( m_Mobile, null ); + case 4: + case 5: return new FireballSpell( m_Mobile, null ); + case 6: + case 7: return new LightningSpell( m_Mobile, null ); + case 8: + case 9: return new MindBlastSpell( m_Mobile, null ); case 10: return new EnergyBoltSpell( m_Mobile, null ); case 11: return new ExplosionSpell( m_Mobile, null ); default: return new FlameStrikeSpell( m_Mobile, null ); } } + public virtual Spell GetRandomCurse() + { + return ( CanCastNecro() ) ? GetRandomCurseSpell() : GetRandomNecroCurseSpell(); + } + + public virtual Spell GetRandomNecroCurseSpell() + { + switch( Utility.Random( 4 ) ) + { + default: + case 0: m_Mobile.DebugSay( "Blood Oath" ); return new BloodOathSpell( m_Mobile, null ); + case 1: m_Mobile.DebugSay( "Corpse Skin" ); return new CorpseSkinSpell( m_Mobile, null ); + case 2: m_Mobile.DebugSay( "Evil Omen" ); return new EvilOmenSpell( m_Mobile, null ); + case 3: m_Mobile.DebugSay( "Mind Rot" ); return new MindRotSpell( m_Mobile, null ); + } + } + public virtual Spell GetRandomCurseSpell() { - if ( Utility.RandomBool() ) + if( Utility.Random( 4 ) == 3 ) { - if ( m_Mobile.Skills[SkillName.Magery].Value >= 40.0 ) + if( myMagery >= 40.0 ) + { return new CurseSpell( m_Mobile, null ); + } } - switch ( Utility.Random( 3 ) ) + switch( Utility.Random( 3 ) ) { default: case 0: return new WeakenSpell( m_Mobile, null ); @@ -252,9 +306,9 @@ namespace Server.Mobiles public virtual Spell GetRandomManaDrainSpell() { - if ( Utility.RandomBool() ) + if( Utility.RandomBool() ) { - if ( m_Mobile.Skills[SkillName.Magery].Value >= 80.0 ) + if( myMagery >= 80.0 ) return new ManaVampireSpell( m_Mobile, null ); } @@ -263,9 +317,9 @@ namespace Server.Mobiles public virtual Spell DoDispel( Mobile toDispel ) { - if ( !SmartAI ) + if( !SmartAI ) { - if ( ScaleByMagery( DispelChance ) > Utility.RandomDouble() ) + if( ScaleByMagery( DispelChance ) > Utility.RandomDouble() ) return new DispelSpell( m_Mobile, null ); return ChooseSpell( toDispel ); @@ -273,11 +327,11 @@ namespace Server.Mobiles Spell spell = CheckCastHealingSpell(); - if ( spell == null ) + if( spell == null ) { - if ( !m_Mobile.DisallowAllMoves && Utility.Random( (int)m_Mobile.GetDistanceToSqrt( toDispel ) ) == 0 ) + if( !m_Mobile.DisallowAllMoves && Utility.Random( (int)m_Mobile.GetDistanceToSqrt( toDispel ) ) == 0 ) spell = new TeleportSpell( m_Mobile, null ); - else if ( Utility.Random( 3 ) == 0 && !m_Mobile.InRange( toDispel, 3 ) && !toDispel.Paralyzed && !toDispel.Frozen ) + else if( Utility.Random( 3 ) == 0 && !m_Mobile.InRange( toDispel, 3 ) && !toDispel.Paralyzed && !toDispel.Frozen ) spell = new ParalyzeSpell( m_Mobile, null ); else spell = new DispelSpell( m_Mobile, null ); @@ -286,82 +340,86 @@ namespace Server.Mobiles return spell; } + public virtual double myNecro { get { return m_Mobile.Skills[ SkillName.Magery ].Value; } } + + public virtual double myMagery { get { return m_Mobile.Skills[ SkillName.Magery ].Value; } } + + public virtual double mySpiritSpeak { get { return m_Mobile.Skills[ SkillName.SpiritSpeak ].Value; } } + public virtual Spell ChooseSpell( Mobile c ) { Spell spell = null; - if ( !SmartAI ) + if( !SmartAI ) { spell = CheckCastHealingSpell(); - if ( spell != null ) + if( spell != null ) return spell; - switch ( Utility.Random( 13 ) ) + switch( Utility.Random( 16 ) ) { case 0: - case 1: - case 2: // Poison them - { - m_Mobile.DebugSay( "Attempting to poison" ); - - if ( !c.Poisoned ) - spell = new PoisonSpell( m_Mobile, null ); - - break; - } - case 3: // Bless ourselves. - { - m_Mobile.DebugSay( "Blessing myself" ); - - spell = new BlessSpell( m_Mobile, null ); - break; - } - case 4: - case 5: - case 6: // Curse them. - { - m_Mobile.DebugSay( "Attempting to curse" ); - - spell = GetRandomCurseSpell(); - break; - } - case 7: // Paralyze them. - { - m_Mobile.DebugSay( "Attempting to paralyze" ); - - if ( m_Mobile.Skills[SkillName.Magery].Value > 50.0 ) - spell = new ParalyzeSpell( m_Mobile, null ); - - break; - } - case 8: // Drain mana - { - m_Mobile.DebugSay( "Attempting to drain mana" ); - - spell = GetRandomManaDrainSpell(); - break; - } - - case 9: - { - m_Mobile.DebugSay( "Attempting to Invis" ); - - if (spell == null ) + case 1: // Poison them { - spell = new InvisibilitySpell( m_Mobile, null ); + //m_Mobile.DebugSay( "Attempting to poison" ); + + if( !c.Poisoned ) + spell = new PoisonSpell( m_Mobile, null ); + + break; + } + case 2: // Bless ourselves. + { + //m_Mobile.DebugSay( "Blessing myself" ); + + spell = new BlessSpell( m_Mobile, null ); + break; + } + case 3: + case 4: // Curse them. + { + //m_Mobile.DebugSay( "Attempting to curse" ); + + spell = GetRandomCurse(); + break; + } + case 5: // Paralyze them. + { + //m_Mobile.DebugSay( "Attempting to paralyze" ); + + if( m_Mobile.Skills[ SkillName.Magery ].Value > 50.0 ) + spell = new ParalyzeSpell( m_Mobile, null ); + + break; + } + case 6: // Drain mana + { + //m_Mobile.DebugSay( "Attempting to drain mana" ); + + spell = GetRandomManaDrainSpell(); + break; + } + case 7: + case 8: + { + //m_Mobile.DebugSay( "Attempting to Invis" ); + + if( spell == null ) + { + spell = new InvisibilitySpell( m_Mobile, null ); + } + + break; } - break; - } - default: // Damage them. - { - m_Mobile.DebugSay( "Just doing damage" ); + { + //m_Mobile.DebugSay( "Just doing damage" ); - spell = GetRandomDamageSpell(); - break; - } + spell = GetRandomDamage(); + break; + } } return spell; @@ -369,56 +427,56 @@ namespace Server.Mobiles spell = CheckCastHealingSpell(); - if ( spell != null ) + if( spell != null ) return spell; - switch ( Utility.Random( 3 ) ) + switch( Utility.Random( 3 ) ) { default: case 0: // Poison them - { - if ( !c.Poisoned ) - spell = new PoisonSpell( m_Mobile, null ); + { + if( !c.Poisoned ) + spell = new PoisonSpell( m_Mobile, null ); - break; - } + break; + } case 1: // Deal some damage - { - spell = GetRandomDamageSpell(); + { + spell = GetRandomDamageSpell(); - break; - } + break; + } case 2: // Set up a combo - { - if ( m_Mobile.Mana < 40 && m_Mobile.Mana > 15 ) { - if ( c.Paralyzed && !c.Poisoned ) + if( m_Mobile.Mana < 40 && m_Mobile.Mana > 15 ) { - m_Mobile.DebugSay( "I am going to meditate" ); + if( c.Paralyzed && !c.Poisoned ) + { + m_Mobile.DebugSay( "I am going to meditate" ); - m_Mobile.UseSkill( SkillName.Meditation ); + m_Mobile.UseSkill( SkillName.Meditation ); + } + else if( !c.Poisoned ) + { + spell = new ParalyzeSpell( m_Mobile, null ); + } } - else if ( !c.Poisoned ) + else if( m_Mobile.Mana > 60 ) { - spell = new ParalyzeSpell( m_Mobile, null ); + if( Utility.Random( 2 ) == 0 && !c.Paralyzed && !c.Frozen && !c.Poisoned ) + { + m_Combo = 0; + spell = new ParalyzeSpell( m_Mobile, null ); + } + else + { + m_Combo = 1; + spell = new ExplosionSpell( m_Mobile, null ); + } } - } - else if ( m_Mobile.Mana > 60 ) - { - if ( Utility.Random( 2 ) == 0 && !c.Paralyzed && !c.Frozen && !c.Poisoned ) - { - m_Combo = 0; - spell = new ParalyzeSpell( m_Mobile, null ); - } - else - { - m_Combo = 1; - spell = new ExplosionSpell( m_Mobile, null ); - } - } - break; - } + break; + } } return spell; @@ -430,55 +488,55 @@ namespace Server.Mobiles { Spell spell = null; - if ( m_Combo == 0 ) + if( m_Combo == 0 ) { spell = new ExplosionSpell( m_Mobile, null ); ++m_Combo; // Move to next spell } - else if ( m_Combo == 1 ) + else if( m_Combo == 1 ) { spell = new WeakenSpell( m_Mobile, null ); ++m_Combo; // Move to next spell } - else if ( m_Combo == 2 ) + else if( m_Combo == 2 ) { - if ( !c.Poisoned ) + if( !c.Poisoned ) spell = new PoisonSpell( m_Mobile, null ); ++m_Combo; // Move to next spell } - if ( m_Combo == 3 && spell == null ) + if( m_Combo == 3 && spell == null ) { - switch ( Utility.Random( 3 ) ) + switch( Utility.Random( 3 ) ) { default: case 0: - { - if ( c.Int < c.Dex ) - spell = new FeeblemindSpell( m_Mobile, null ); - else - spell = new ClumsySpell( m_Mobile, null ); + { + if( c.Int < c.Dex ) + spell = new FeeblemindSpell( m_Mobile, null ); + else + spell = new ClumsySpell( m_Mobile, null ); - ++m_Combo; // Move to next spell + ++m_Combo; // Move to next spell - break; - } + break; + } case 1: - { - spell = new EnergyBoltSpell( m_Mobile, null ); - m_Combo = -1; // Reset combo state - break; - } + { + spell = new EnergyBoltSpell( m_Mobile, null ); + m_Combo = -1; // Reset combo state + break; + } case 2: - { - spell = new FlameStrikeSpell( m_Mobile, null ); - m_Combo = -1; // Reset combo state - break; - } + { + spell = new FlameStrikeSpell( m_Mobile, null ); + m_Combo = -1; // Reset combo state + break; + } } } - else if ( m_Combo == 4 && spell == null ) + else if( m_Combo == 4 && spell == null ) { spell = new MindBlastSpell( m_Mobile, null ); m_Combo = -1; @@ -490,10 +548,10 @@ namespace Server.Mobiles private TimeSpan GetDelay() { double del = ScaleByMagery( 3.0 ); - double min = 6.0 - (del * 0.75); - double max = 6.0 - (del * 1.25); + double min = 6.0 - ( del * 0.75 ); + double max = 6.0 - ( del * 1.25 ); - return TimeSpan.FromSeconds( min + ((max - min) * Utility.RandomDouble()) ); + return TimeSpan.FromSeconds( min + ( ( max - min ) * Utility.RandomDouble() ) ); } public override bool DoActionCombat() @@ -501,14 +559,14 @@ namespace Server.Mobiles Mobile c = m_Mobile.Combatant; m_Mobile.Warmode = true; - if ( c == null || c.Deleted || !c.Alive || c.IsDeadBondedPet || !m_Mobile.CanSee( c ) || !m_Mobile.CanBeHarmful( c, false ) || c.Map != m_Mobile.Map ) + if( c == null || c.Deleted || !c.Alive || c.IsDeadBondedPet || !m_Mobile.CanSee( c ) || !m_Mobile.CanBeHarmful( c, false ) || c.Map != m_Mobile.Map ) { // Our combatant is deleted, dead, hidden, or we cannot hurt them // Try to find another combatant - if ( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) ) + if( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) ) { - if ( m_Mobile.Debug ) + if( m_Mobile.Debug ) m_Mobile.DebugSay( "Something happened to my combatant, so I am going to fight {0}", m_Mobile.FocusMob.Name ); m_Mobile.Combatant = c = m_Mobile.FocusMob; @@ -522,11 +580,11 @@ namespace Server.Mobiles } } - if ( !m_Mobile.InLOS( c ) ) + if( !m_Mobile.InLOS( c ) ) { m_Mobile.DebugSay( "I can't see my target" ); - if ( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) ) + if( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) ) { m_Mobile.DebugSay( "Nobody else is around" ); m_Mobile.Combatant = c = m_Mobile.FocusMob; @@ -534,26 +592,26 @@ namespace Server.Mobiles } } - if ( SmartAI && !m_Mobile.StunReady && m_Mobile.Skills[SkillName.Wrestling].Value >= 80.0 && m_Mobile.Skills[SkillName.Anatomy].Value >= 80.0 ) + if( SmartAI && !m_Mobile.StunReady && m_Mobile.Skills[ SkillName.Wrestling ].Value >= 80.0 && m_Mobile.Skills[ SkillName.Anatomy ].Value >= 80.0 ) EventSink.InvokeStunRequest( new StunRequestEventArgs( m_Mobile ) ); - if ( !m_Mobile.InRange( c, m_Mobile.RangePerception ) ) + if( !m_Mobile.InRange( c, m_Mobile.RangePerception ) ) { // They are somewhat far away, can we find something else? - if ( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) ) + if( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) ) { m_Mobile.Combatant = m_Mobile.FocusMob; m_Mobile.FocusMob = null; } - else if ( !m_Mobile.InRange( c, m_Mobile.RangePerception * 3 ) ) + else if( !m_Mobile.InRange( c, m_Mobile.RangePerception * 3 ) ) { m_Mobile.Combatant = null; } c = m_Mobile.Combatant; - if ( c == null ) + if( c == null ) { m_Mobile.DebugSay( "My combatant has fled, so I am on guard" ); Action = ActionType.Guard; @@ -562,30 +620,30 @@ namespace Server.Mobiles } } - if ( !m_Mobile.Controlled && !m_Mobile.Summoned && !m_Mobile.IsParagon ) + if( !m_Mobile.Controlled && !m_Mobile.Summoned && !m_Mobile.IsParagon ) { - if ( m_Mobile.Hits < m_Mobile.HitsMax * 20/100 ) + if( m_Mobile.Hits < m_Mobile.HitsMax * 20 / 100 ) { // We are low on health, should we flee? bool flee = false; - if ( m_Mobile.Hits < c.Hits ) + if( m_Mobile.Hits < c.Hits ) { // We are more hurt than them int diff = c.Hits - m_Mobile.Hits; - flee = ( Utility.Random( 0, 100 ) > (10 + diff) ); // (10 + diff)% chance to flee + flee = ( Utility.Random( 0, 100 ) > ( 10 + diff ) ); // (10 + diff)% chance to flee } else { flee = Utility.Random( 0, 100 ) > 10; // 10% chance to flee } - - if ( flee ) + + if( flee ) { - if ( m_Mobile.Debug ) + if( m_Mobile.Debug ) m_Mobile.DebugSay( "I am going to flee from {0}", c.Name ); Action = ActionType.Flee; @@ -594,30 +652,30 @@ namespace Server.Mobiles } } - if ( m_Mobile.Spell == null && DateTime.Now > m_NextCastTime && m_Mobile.InRange( c, Core.ML ? 10 : 12 ) ) + if( m_Mobile.Spell == null && DateTime.Now > m_NextCastTime && m_Mobile.InRange( c, Core.ML ? 10 : 12 ) ) { // We are ready to cast a spell Spell spell = null; Mobile toDispel = FindDispelTarget( true ); - if ( m_Mobile.Poisoned ) // Top cast priority is cure + if( m_Mobile.Poisoned ) // Top cast priority is cure { m_Mobile.DebugSay( "I am going to cure myself" ); spell = new CureSpell( m_Mobile, null ); } - else if ( toDispel != null ) // Something dispellable is attacking us + else if( toDispel != null ) // Something dispellable is attacking us { m_Mobile.DebugSay( "I am going to dispel {0}", toDispel ); spell = DoDispel( toDispel ); } - else if ( SmartAI && m_Combo != -1 ) // We are doing a spell combo + else if( SmartAI && m_Combo != -1 ) // We are doing a spell combo { spell = DoCombo( c ); } - else if ( SmartAI && (c.Spell is HealSpell || c.Spell is GreaterHealSpell) && !c.Poisoned ) // They have a heal spell out + else if( SmartAI && ( c.Spell is HealSpell || c.Spell is GreaterHealSpell ) && !c.Poisoned ) // They have a heal spell out { spell = new PoisonSpell( m_Mobile, null ); } @@ -629,11 +687,11 @@ namespace Server.Mobiles // Now we have a spell picked // Move first before casting - if ( SmartAI && toDispel != null ) + if( SmartAI && toDispel != null ) { - if ( m_Mobile.InRange( toDispel, 10 ) ) + if( m_Mobile.InRange( toDispel, 10 ) ) RunFrom( toDispel ); - else if ( !m_Mobile.InRange( toDispel, Core.ML ? 10 : 12 ) ) + else if( !m_Mobile.InRange( toDispel, Core.ML ? 10 : 12 ) ) RunTo( toDispel ); } else @@ -641,19 +699,19 @@ namespace Server.Mobiles RunTo( c ); } - if ( spell != null ) + if( spell != null ) spell.Cast(); TimeSpan delay; - if ( SmartAI || ( spell is DispelSpell ) ) + if( SmartAI || ( spell is DispelSpell ) ) delay = TimeSpan.FromSeconds( m_Mobile.ActiveSpeed ); else delay = GetDelay(); - m_NextCastTime = DateTime.Now + delay; + m_NextCastTime = DateTime.Now; } - else if ( m_Mobile.Spell == null || !m_Mobile.Spell.IsCasting ) + else if( m_Mobile.Spell == null || !m_Mobile.Spell.IsCasting ) { RunTo( c ); } @@ -663,7 +721,7 @@ namespace Server.Mobiles public override bool DoActionGuard() { - if ( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) ) + if( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) ) { m_Mobile.DebugSay( "I am going to attack {0}", m_Mobile.FocusMob.Name ); @@ -672,13 +730,13 @@ namespace Server.Mobiles } else { - if ( !m_Mobile.Controlled ) + if( !m_Mobile.Controlled ) { ProcessTarget(); Spell spell = CheckCastHealingSpell(); - if ( spell != null ) + if( spell != null ) spell.Cast(); } @@ -692,20 +750,20 @@ namespace Server.Mobiles { Mobile c = m_Mobile.Combatant; - if ( (m_Mobile.Mana > 20 || m_Mobile.Mana == m_Mobile.ManaMax) && m_Mobile.Hits > (m_Mobile.HitsMax / 2) ) + if( ( m_Mobile.Mana > 20 || m_Mobile.Mana == m_Mobile.ManaMax ) && m_Mobile.Hits > ( m_Mobile.HitsMax / 2 ) ) { m_Mobile.DebugSay( "I am stronger now, my guard is up" ); Action = ActionType.Guard; } - else if ( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) ) + else if( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) ) { - if ( m_Mobile.Debug ) + if( m_Mobile.Debug ) m_Mobile.DebugSay( "I am scared of {0}", m_Mobile.FocusMob.Name ); RunFrom( m_Mobile.FocusMob ); m_Mobile.FocusMob = null; - if ( m_Mobile.Poisoned && Utility.Random( 0, 5 ) == 0 ) + if( m_Mobile.Poisoned && Utility.Random( 0, 5 ) == 0 ) new CureSpell( m_Mobile, null ).Cast(); } else @@ -721,10 +779,10 @@ namespace Server.Mobiles public Mobile FindDispelTarget( bool activeOnly ) { - if ( m_Mobile.Deleted || m_Mobile.Int < 95 || CanDispel( m_Mobile ) || m_Mobile.AutoDispel ) + if( m_Mobile.Deleted || m_Mobile.Int < 95 || CanDispel( m_Mobile ) || m_Mobile.AutoDispel ) return null; - if ( activeOnly ) + if( activeOnly ) { List aggressed = m_Mobile.Aggressed; List aggressors = m_Mobile.Aggressors; @@ -734,50 +792,50 @@ namespace Server.Mobiles Mobile comb = m_Mobile.Combatant; - if ( comb != null && !comb.Deleted && comb.Alive && !comb.IsDeadBondedPet && m_Mobile.InRange( comb, Core.ML ? 10 : 12 ) && CanDispel( comb ) ) + if( comb != null && !comb.Deleted && comb.Alive && !comb.IsDeadBondedPet && m_Mobile.InRange( comb, Core.ML ? 10 : 12 ) && CanDispel( comb ) ) { active = comb; activePrio = m_Mobile.GetDistanceToSqrt( comb ); - if ( activePrio <= 2 ) + if( activePrio <= 2 ) return active; } - for ( int i = 0; i < aggressed.Count; ++i ) + for( int i = 0; i < aggressed.Count; ++i ) { - AggressorInfo info = aggressed[i]; + AggressorInfo info = aggressed[ i ]; Mobile m = info.Defender; - if ( m != comb && m.Combatant == m_Mobile && m_Mobile.InRange( m, Core.ML ? 10 : 12 ) && CanDispel( m ) ) + if( m != comb && m.Combatant == m_Mobile && m_Mobile.InRange( m, Core.ML ? 10 : 12 ) && CanDispel( m ) ) { double prio = m_Mobile.GetDistanceToSqrt( m ); - if ( active == null || prio < activePrio ) + if( active == null || prio < activePrio ) { active = m; activePrio = prio; - if ( activePrio <= 2 ) + if( activePrio <= 2 ) return active; } } } - for ( int i = 0; i < aggressors.Count; ++i ) + for( int i = 0; i < aggressors.Count; ++i ) { - AggressorInfo info = aggressors[i]; + AggressorInfo info = aggressors[ i ]; Mobile m = info.Attacker; - if ( m != comb && m.Combatant == m_Mobile && m_Mobile.InRange( m, Core.ML ? 10 : 12 ) && CanDispel( m ) ) + if( m != comb && m.Combatant == m_Mobile && m_Mobile.InRange( m, Core.ML ? 10 : 12 ) && CanDispel( m ) ) { double prio = m_Mobile.GetDistanceToSqrt( m ); - if ( active == null || prio < activePrio ) + if( active == null || prio < activePrio ) { active = m; activePrio = prio; - if ( activePrio <= 2 ) + if( activePrio <= 2 ) return active; } } @@ -789,32 +847,32 @@ namespace Server.Mobiles { Map map = m_Mobile.Map; - if ( map != null ) + if( map != null ) { Mobile active = null, inactive = null; double actPrio = 0.0, inactPrio = 0.0; Mobile comb = m_Mobile.Combatant; - if ( comb != null && !comb.Deleted && comb.Alive && !comb.IsDeadBondedPet && CanDispel( comb ) ) + if( comb != null && !comb.Deleted && comb.Alive && !comb.IsDeadBondedPet && CanDispel( comb ) ) { active = inactive = comb; actPrio = inactPrio = m_Mobile.GetDistanceToSqrt( comb ); } - foreach ( Mobile m in m_Mobile.GetMobilesInRange( Core.ML ? 10 : 12 ) ) + foreach( Mobile m in m_Mobile.GetMobilesInRange( Core.ML ? 10 : 12 ) ) { - if ( m != m_Mobile && CanDispel( m ) ) + if( m != m_Mobile && CanDispel( m ) ) { double prio = m_Mobile.GetDistanceToSqrt( m ); - if ( !activeOnly && (inactive == null || prio < inactPrio) ) + if( !activeOnly && ( inactive == null || prio < inactPrio ) ) { inactive = m; inactPrio = prio; } - if ( (m_Mobile.Combatant == m || m.Combatant == m_Mobile) && (active == null || prio < actPrio) ) + if( ( m_Mobile.Combatant == m || m.Combatant == m_Mobile ) && ( active == null || prio < actPrio ) ) { active = m; actPrio = prio; @@ -831,7 +889,7 @@ namespace Server.Mobiles public bool CanDispel( Mobile m ) { - return ( m is BaseCreature && ((BaseCreature)m).Summoned && m_Mobile.CanBeHarmful( m, false ) && !((BaseCreature)m).IsAnimatedDead ); + return ( m is BaseCreature && ( (BaseCreature)m ).Summoned && m_Mobile.CanBeHarmful( m, false ) && !( (BaseCreature)m ).IsAnimatedDead ); } private static int[] m_Offsets = new int[] @@ -867,7 +925,7 @@ namespace Server.Mobiles { Target targ = m_Mobile.Target; - if ( targ == null ) + if( targ == null ) return false; bool isDispel = ( targ is DispelSpell.InternalTarget ); @@ -882,27 +940,27 @@ namespace Server.Mobiles { toTarget = m_Mobile; } - else if ( isDispel ) + else if( isDispel ) { toTarget = FindDispelTarget( false ); - if ( !SmartAI && toTarget != null ) + if( !SmartAI && toTarget != null ) RunTo( toTarget ); - else if ( toTarget != null && m_Mobile.InRange( toTarget, 10 ) ) + else if( toTarget != null && m_Mobile.InRange( toTarget, 10 ) ) RunFrom( toTarget ); } - else if ( SmartAI && (isParalyze || isTeleport) ) + else if( SmartAI && ( isParalyze || isTeleport ) ) { toTarget = FindDispelTarget( true ); - if ( toTarget == null ) + if( toTarget == null ) { toTarget = m_Mobile.Combatant; - if ( toTarget != null ) + if( toTarget != null ) RunTo( toTarget ); } - else if ( m_Mobile.InRange( toTarget, 10 ) ) + else if( m_Mobile.InRange( toTarget, 10 ) ) { RunFrom( toTarget ); teleportAway = true; @@ -916,30 +974,30 @@ namespace Server.Mobiles { toTarget = m_Mobile.Combatant; - if ( toTarget != null ) + if( toTarget != null ) RunTo( toTarget ); } - if ( (targ.Flags & TargetFlags.Harmful) != 0 && toTarget != null ) + if( ( targ.Flags & TargetFlags.Harmful ) != 0 && toTarget != null ) { - if ( (targ.Range == -1 || m_Mobile.InRange( toTarget, targ.Range )) && m_Mobile.CanSee( toTarget ) && m_Mobile.InLOS( toTarget ) ) + if( ( targ.Range == -1 || m_Mobile.InRange( toTarget, targ.Range ) ) && m_Mobile.CanSee( toTarget ) && m_Mobile.InLOS( toTarget ) ) { targ.Invoke( m_Mobile, toTarget ); } - else if ( isDispel ) + else if( isDispel ) { targ.Cancel( m_Mobile, TargetCancelType.Canceled ); } } - else if ( (targ.Flags & TargetFlags.Beneficial) != 0 ) + else if( ( targ.Flags & TargetFlags.Beneficial ) != 0 ) { targ.Invoke( m_Mobile, m_Mobile ); } - else if ( isTeleport && toTarget != null ) + else if( isTeleport && toTarget != null ) { Map map = m_Mobile.Map; - if ( map == null ) + if( map == null ) { targ.Cancel( m_Mobile, TargetCancelType.Canceled ); return true; @@ -947,15 +1005,15 @@ namespace Server.Mobiles int px, py; - if ( teleportAway ) + if( teleportAway ) { int rx = m_Mobile.X - toTarget.X; int ry = m_Mobile.Y - toTarget.Y; double d = m_Mobile.GetDistanceToSqrt( toTarget ); - px = toTarget.X + (int)(rx * (10 / d)); - py = toTarget.Y + (int)(ry * (10 / d)); + px = toTarget.X + (int)( rx * ( 10 / d ) ); + py = toTarget.Y + (int)( ry * ( 10 / d ) ); } else { @@ -963,15 +1021,15 @@ namespace Server.Mobiles py = toTarget.Y; } - for ( int i = 0; i < m_Offsets.Length; i += 2 ) + for( int i = 0; i < m_Offsets.Length; i += 2 ) { - int x = m_Offsets[i], y = m_Offsets[i + 1]; + int x = m_Offsets[ i ], y = m_Offsets[ i + 1 ]; Point3D p = new Point3D( px + x, py + y, 0 ); LandTarget lt = new LandTarget( p, map ); - if ( (targ.Range == -1 || m_Mobile.InRange( p, targ.Range )) && m_Mobile.InLOS( lt ) && map.CanSpawnMobile( px + x, py + y, lt.Z ) && !SpellHelper.CheckMulti( p, map ) ) + if( ( targ.Range == -1 || m_Mobile.InRange( p, targ.Range ) ) && m_Mobile.InLOS( lt ) && map.CanSpawnMobile( px + x, py + y, lt.Z ) && !SpellHelper.CheckMulti( p, map ) ) { targ.Invoke( m_Mobile, lt ); return true; @@ -980,16 +1038,16 @@ namespace Server.Mobiles int teleRange = targ.Range; - if ( teleRange < 0 ) + if( teleRange < 0 ) teleRange = Core.ML ? 11 : 12; - for ( int i = 0; i < 10; ++i ) + for( int i = 0; i < 10; ++i ) { Point3D randomPoint = new Point3D( m_Mobile.X - teleRange + Utility.Random( teleRange * 2 + 1 ), m_Mobile.Y - teleRange + Utility.Random( teleRange * 2 + 1 ), 0 ); LandTarget lt = new LandTarget( randomPoint, map ); - if ( m_Mobile.InLOS( lt ) && map.CanSpawnMobile( lt.X, lt.Y, lt.Z ) && !SpellHelper.CheckMulti( randomPoint, map ) ) + if( m_Mobile.InLOS( lt ) && map.CanSpawnMobile( lt.X, lt.Y, lt.Z ) && !SpellHelper.CheckMulti( randomPoint, map ) ) { targ.Invoke( m_Mobile, new LandTarget( randomPoint, map ) ); return true; @@ -1006,4 +1064,4 @@ namespace Server.Mobiles return true; } } -} +} \ No newline at end of file diff --git a/Scripts/Mobiles/BaseCreature.cs b/Scripts/Mobiles/BaseCreature.cs index 67d30176c..f02a9e782 100644 --- a/Scripts/Mobiles/BaseCreature.cs +++ b/Scripts/Mobiles/BaseCreature.cs @@ -278,6 +278,8 @@ namespace Server.Mobiles #region Bonding public const bool BondingEnabled = true; + public virtual bool IsNecromancer { get { return ( Skills[ SkillName.Necromancy ].Value > 50 ); } } + public virtual bool IsBondable{ get{ return ( BondingEnabled && !Summoned ); } } public virtual TimeSpan BondingDelay{ get{ return TimeSpan.FromDays( 7.0 ); } } public virtual TimeSpan BondingAbandonDelay{ get{ return TimeSpan.FromDays( 1.0 ); } } diff --git a/Scripts/Mobiles/Monsters/AOS/DemonKnight.cs b/Scripts/Mobiles/Monsters/AOS/DemonKnight.cs index 17efdd3af..3fe5aea13 100644 --- a/Scripts/Mobiles/Monsters/AOS/DemonKnight.cs +++ b/Scripts/Mobiles/Monsters/AOS/DemonKnight.cs @@ -191,6 +191,9 @@ namespace Server.Mobiles SetResistance( ResistanceType.Poison, 30 ); SetResistance( ResistanceType.Energy, 30 ); + SetSkill( SkillName.Necromancy, 120, 120.0 ); + SetSkill( SkillName.SpiritSpeak, 120.0, 120.0 ); + SetSkill( SkillName.DetectHidden, 80.0 ); SetSkill( SkillName.EvalInt, 100.0 ); SetSkill( SkillName.Magery, 100.0 ); diff --git a/Scripts/Mobiles/Monsters/Humanoid/Magic/Lich.cs b/Scripts/Mobiles/Monsters/Humanoid/Magic/Lich.cs index 845921607..f5f6071a1 100644 --- a/Scripts/Mobiles/Monsters/Humanoid/Magic/Lich.cs +++ b/Scripts/Mobiles/Monsters/Humanoid/Magic/Lich.cs @@ -32,6 +32,10 @@ namespace Server.Mobiles SetResistance( ResistanceType.Poison, 55, 65 ); SetResistance( ResistanceType.Energy, 40, 50 ); + + SetSkill( SkillName.Necromancy, 120, 120.0 ); + SetSkill( SkillName.SpiritSpeak, 120.0, 120.0 ); + SetSkill( SkillName.EvalInt, 100.0 ); SetSkill( SkillName.Magery, 70.1, 80.0 ); SetSkill( SkillName.Meditation, 85.1, 95.0 ); diff --git a/Scripts/Mobiles/Monsters/Humanoid/Magic/LichLord.cs b/Scripts/Mobiles/Monsters/Humanoid/Magic/LichLord.cs index 69a1ba76b..807945fc1 100644 --- a/Scripts/Mobiles/Monsters/Humanoid/Magic/LichLord.cs +++ b/Scripts/Mobiles/Monsters/Humanoid/Magic/LichLord.cs @@ -32,6 +32,9 @@ namespace Server.Mobiles SetResistance( ResistanceType.Poison, 50, 60 ); SetResistance( ResistanceType.Energy, 40, 50 ); + SetSkill( SkillName.Necromancy, 120, 120.0 ); + SetSkill( SkillName.SpiritSpeak, 120.0, 120.0 ); + SetSkill( SkillName.EvalInt, 90.1, 100.0 ); SetSkill( SkillName.Magery, 90.1, 100.0 ); SetSkill( SkillName.MagicResist, 150.5, 200.0 ); diff --git a/Scripts/Spells/Necromancy/PoisonStrike.cs b/Scripts/Spells/Necromancy/PoisonStrike.cs index 07a4fcc7b..7c09aebfc 100644 --- a/Scripts/Spells/Necromancy/PoisonStrike.cs +++ b/Scripts/Spells/Necromancy/PoisonStrike.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using Server.Network; using Server.Items; using Server.Targeting; +using Server.Mobiles; namespace Server.Spells.Necromancy { @@ -67,13 +68,13 @@ namespace Server.Spells.Necromancy targets.Add( m ); foreach( Mobile targ in m.GetMobilesInRange( 2 ) ) - if( ( targ != Caster && m != targ ) && ( SpellHelper.ValidIndirectTarget( Caster, targ ) && Caster.CanBeHarmful( targ, false) ) ) - targets.Add( targ ); + if(Caster is BaseCreature && targ is BaseCreature && !((BaseCreature)targ).Controlled && !((BaseCreature)targ).Summoned ) + if( ( targ != Caster && m != targ ) && ( SpellHelper.ValidIndirectTarget( Caster, targ ) && Caster.CanBeHarmful( targ, false) ) ) + targets.Add( targ ); for( int i = 0; i < targets.Count; ++i ) { Mobile targ = targets[i]; - int num; if( targ.InRange( m.Location, 0 ) ) diff --git a/Scripts/Spells/Necromancy/Wither.cs b/Scripts/Spells/Necromancy/Wither.cs index bc2062228..7d16b8d00 100644 --- a/Scripts/Spells/Necromancy/Wither.cs +++ b/Scripts/Spells/Necromancy/Wither.cs @@ -1,8 +1,7 @@ using System; using System.Collections.Generic; -using Server.Network; using Server.Items; -using Server.Targeting; +using Server.Mobiles; namespace Server.Spells.Necromancy { @@ -19,18 +18,20 @@ namespace Server.Spells.Necromancy public override TimeSpan CastDelayBase { get { return TimeSpan.FromSeconds( 1.5 ); } } - public override double RequiredSkill{ get{ return 60.0; } } - public override int RequiredMana{ get{ return 23; } } + public override double RequiredSkill { get { return 60.0; } } - public WitherSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info ) + public override int RequiredMana { get { return 23; } } + + public WitherSpell( Mobile caster, Item scroll ) + : base( caster, scroll, m_Info ) { } - public override bool DelayedDamage{ get{ return false; } } + public override bool DelayedDamage { get { return false; } } public override void OnCast() { - if ( CheckSequence() ) + if( CheckSequence() ) { /* Creates a withering frost around the Caster, * which deals Cold Damage to all valid targets in a radius of 5 tiles. @@ -38,36 +39,36 @@ namespace Server.Spells.Necromancy Map map = Caster.Map; - if ( map != null ) + if( map != null ) { List targets = new List(); - foreach ( Mobile m in Caster.GetMobilesInRange( Core.ML ? 4 : 5 ) ) - if ( Caster != m && Caster.InLOS( m ) && SpellHelper.ValidIndirectTarget( Caster, m ) && Caster.CanBeHarmful( m, false ) ) + foreach( Mobile m in Caster.GetMobilesInRange( Core.ML ? 4 : 5 ) ) + if( Caster != m && Caster.InLOS( m ) && SpellHelper.ValidIndirectTarget( Caster, m ) && Caster.CanBeHarmful( m, false ) ) targets.Add( m ); Effects.PlaySound( Caster.Location, map, 0x1FB ); Effects.PlaySound( Caster.Location, map, 0x10B ); Effects.SendLocationParticles( EffectItem.Create( Caster.Location, map, EffectItem.DefaultDuration ), 0x37CC, 1, 40, 97, 3, 9917, 0 ); - for ( int i = 0; i < targets.Count; ++i ) + for( int i = 0; i < targets.Count; ++i ) { - Mobile m = targets[i]; + Mobile m = targets[ i ]; Caster.DoHarmful( m ); m.FixedParticles( 0x374A, 1, 15, 9502, 97, 3, (EffectLayer)255 ); double damage = Utility.RandomMinMax( 30, 35 ); - damage *= (300 + (m.Karma / 100) + (GetDamageSkill( Caster ) * 10)); + damage *= ( 300 + ( m.Karma / 100 ) + ( GetDamageSkill( Caster ) * 10 ) ); damage /= 1000; int sdiBonus = AosAttributes.GetValue( Caster, AosAttribute.SpellDamage ); - + // PvP spell damage increase cap of 15% from an item’s magic property in Publish 33(SE) - if ( Core.SE && m.Player && Caster.Player && sdiBonus > 15 ) + if( Core.SE && m.Player && Caster.Player && sdiBonus > 15 ) sdiBonus = 15; - + damage *= ( 100 + sdiBonus ); damage /= 100;