From 5718b66fded42815a8cb7974d4b03d1cd30f1c39 Mon Sep 17 00:00:00 2001 From: xavier Date: Sun, 20 Jan 2013 01:26:51 +0000 Subject: [PATCH] --- .../Items/Weapons/Abilities/MortalStrike.cs | 6 +--- .../Items/Weapons/Abilities/WeaponAbility.cs | 7 ++++- Scripts/Mobiles/BaseCreature.cs | 30 ++++++++++++++++--- .../Mobiles/Monsters/ML/Labyrinth/Miasma.cs | 6 ++-- 4 files changed, 36 insertions(+), 13 deletions(-) diff --git a/Scripts/Items/Weapons/Abilities/MortalStrike.cs b/Scripts/Items/Weapons/Abilities/MortalStrike.cs index 3c9180bb7..1d5f4e365 100644 --- a/Scripts/Items/Weapons/Abilities/MortalStrike.cs +++ b/Scripts/Items/Weapons/Abilities/MortalStrike.cs @@ -1,6 +1,5 @@ using System; using System.Collections; -using Server.Mobiles; namespace Server.Items { @@ -24,10 +23,7 @@ namespace Server.Items { if( !Validate( attacker ) || !CheckMana( attacker, true ) ) { - if( !( defender is BaseCreature ) || !( defender as BaseCreature ).HasManaOveride ) - { - return; - } + return; } ClearCurrentAbility( attacker ); diff --git a/Scripts/Items/Weapons/Abilities/WeaponAbility.cs b/Scripts/Items/Weapons/Abilities/WeaponAbility.cs index 66e43ac89..76d73b2b7 100644 --- a/Scripts/Items/Weapons/Abilities/WeaponAbility.cs +++ b/Scripts/Items/Weapons/Abilities/WeaponAbility.cs @@ -3,7 +3,7 @@ using System.Collections; using Server; using Server.Network; using Server.Spells; - +using Server.Mobiles; namespace Server.Items { @@ -141,6 +141,11 @@ namespace Server.Items if ( from.Mana < mana ) { + if( ( from is BaseCreature ) && ( from as BaseCreature ).HasManaOveride ) + { + return true; + } + from.SendLocalizedMessage( 1060181, mana.ToString() ); // You need ~1_MANA_REQUIREMENT~ mana to perform that attack return false; } diff --git a/Scripts/Mobiles/BaseCreature.cs b/Scripts/Mobiles/BaseCreature.cs index a875ce43c..b155e129b 100644 --- a/Scripts/Mobiles/BaseCreature.cs +++ b/Scripts/Mobiles/BaseCreature.cs @@ -5239,9 +5239,10 @@ namespace Server.Mobiles m_NextHealTime = DateTime.Now + TimeSpan.FromSeconds( HealInterval ); } } - else if( ( this.FightMode != FightMode.None ) && ( Home != Point3D.Zero ) && ( RangeHome >= 0 ) && !InRange( Home, ( RangeHome ) ) ) + + if( ReturnsToHome && ( this.FightMode != FightMode.None ) && ( Home != Point3D.Zero ) && ( RangeHome >= 0 ) && !InRange( Home, ( RangeHome ) ) ) { - if( Utility.RandomDouble() < .05 ) /* some throttling */ + if( ( Combatant == null ) && ( Warmode == false ) && Utility.RandomDouble() < .05 ) /* some throttling */ { m_FailedReturnHome = !this.Move( GetDirectionTo( Home.X, Home.Y ) ) ? m_FailedReturnHome + 1 : 0; @@ -5486,11 +5487,17 @@ namespace Server.Mobiles /* until we are sure about who should be getting deleted, move them instead */ /* On OSI, they despawn */ + public virtual bool ReturnsToHome { get { return true; } } + + private bool m_ReturnQueued; + public override void OnSectorDeactivate() { - if( ( this.FightMode != FightMode.None ) && ( Home != Point3D.Zero ) && ( RangeHome >= 0 ) && !this.InRange( Home, ( RangeHome + 10 ) ) ) + if( ReturnsToHome && !m_ReturnQueued && ( this.FightMode != FightMode.None ) && ( Home != Point3D.Zero ) && ( RangeHome >= 0 ) && !this.InRange( Home, ( RangeHome + 5 ) ) ) { - this.SetLocation( Home, true ); + Timer.DelayCall( TimeSpan.FromSeconds( Utility.Random( 10 ) ), new TimerCallback( GoHome_Callback ) ); + + m_ReturnQueued = true; } else if( PlayerRangeSensitive && m_AI != null ) { @@ -5500,6 +5507,21 @@ namespace Server.Mobiles base.OnSectorDeactivate(); } + public void GoHome_Callback() + { + if( !( ( Map.GetSector( X, Y ) ).Active ) ) + { + this.SetLocation( Home, true ); + + if( !( ( Map.GetSector( X, Y ) ).Active ) && m_AI != null ) + { + m_AI.Deactivate(); + } + } + + m_ReturnQueued = false; + } + public override void OnSectorActivate() { if( PlayerRangeSensitive && m_AI != null ) diff --git a/Scripts/Mobiles/Monsters/ML/Labyrinth/Miasma.cs b/Scripts/Mobiles/Monsters/ML/Labyrinth/Miasma.cs index 34cfce127..20f48cefe 100644 --- a/Scripts/Mobiles/Monsters/ML/Labyrinth/Miasma.cs +++ b/Scripts/Mobiles/Monsters/ML/Labyrinth/Miasma.cs @@ -43,10 +43,10 @@ namespace Server.Mobiles } /* yes, this is OSI style */ - public override double WeaponAbilityChance { get { return .5; } } - public override double HitPoisonChance { get { return 0.1; } } + public override double WeaponAbilityChance { get { return 0.6; } } + public override double HitPoisonChance { get { return 0.25; } } public override Poison HitPoison { get { return ( Poison.Lethal ); } } - public override bool HasManaOveride { get { return false; } } + public override bool HasManaOveride { get { return true; } } public override bool GivesMLMinorArtifact { get { return true; } } public override int TreasureMapLevel { get { return 5; } }