changes to support Flying, Dragon AI re-targeting, tamed pets have 10% chance to stop following master when hit by other mobiles..

This commit is contained in:
xavier 2012-11-10 16:47:47 +00:00
parent bca9a25c75
commit 37d52194bd

View file

@ -663,6 +663,8 @@ namespace Server.Mobiles
#endregion
public virtual bool CanFly { get { return false; } }
#region Spill Acid
public void SpillAcid( int Amount )
@ -1292,6 +1294,17 @@ namespace Server.Mobiles
public HonorContext ReceivedHonorContext{ get{ return m_ReceivedHonorContext; } set{ m_ReceivedHonorContext = value; } }
public virtual void CheckStopFollow( Mobile from )
{
if( ControlOrder == OrderType.Follow && Utility.RandomDouble() < .10 )
{
ControlTarget = from;
ControlOrder = OrderType.Attack;
Combatant = from;
Warmode = true;
}
}
public override void OnDamage( int amount, Mobile from, bool willKill )
{
if ( BardPacified && (HitsMax - Hits) * 0.001 > Utility.RandomDouble() )
@ -1327,14 +1340,21 @@ namespace Server.Mobiles
if ( m_ReceivedHonorContext != null )
m_ReceivedHonorContext.OnTargetDamaged( from, amount );
if ( willKill && from is PlayerMobile )
Timer.DelayCall( TimeSpan.FromSeconds( 10 ), new TimerCallback( ((PlayerMobile) from).RecoverAmmo ) );
if( !willKill )
{
CheckStopFollow( from );
}
else if( from is PlayerMobile )
{
Timer.DelayCall( TimeSpan.FromSeconds( 10 ), new TimerCallback( ( ( PlayerMobile )from ).RecoverAmmo ) );
}
base.OnDamage( amount, from, willKill );
}
public virtual void OnDamagedBySpell( Mobile from )
{
CheckStopFollow( from );
}
public virtual void OnHarmfulSpell( Mobile from )
@ -3391,6 +3411,18 @@ namespace Server.Mobiles
m_AI.Activate();
}
public override void OnCombatantChange()
{
base.OnCombatantChange();
Warmode = ( Combatant != null && !Combatant.Deleted && Combatant.Alive );
if( CanFly && Warmode )
{
Flying = false;
}
}
protected override void OnMapChange( Map oldMap )
{
CheckAIActive();
@ -3405,12 +3437,32 @@ namespace Server.Mobiles
base.OnLocationChange( oldLocation );
}
public virtual void ForceReacquire()
{
m_NextReacquireTime = DateTime.MinValue;
}
public override void OnMovement( Mobile m, Point3D oldLocation )
{
base.OnMovement( m, oldLocation );
if( AcquireOnApproach )
{
if( InRange( m.Location, AcquireOnApproachRange ) && !InRange( oldLocation, AcquireOnApproachRange ) )
{
if( CanBeHarmful( m ) )
{
Combatant = FocusMob = m;
if ( ReacquireOnMovement || m_Paragon )
ForceReacquire();
if( AIObject != null )
{
AIObject.MoveTo( m, true, 1 );
}
}
}
}
else if( ReacquireOnMovement )
{
m_NextReacquireTime = DateTime.MinValue;
}
InhumanSpeech speechType = this.SpeechType;
@ -4727,11 +4779,8 @@ namespace Server.Mobiles
public virtual TimeSpan ReacquireDelay{ get{ return TimeSpan.FromSeconds( 10.0 ); } }
public virtual bool ReacquireOnMovement{ get{ return false; } }
public void ForceReacquire()
{
m_NextReacquireTime = DateTime.MinValue;
}
public virtual bool AcquireOnApproach{ get { return m_Paragon; } }
public virtual int AcquireOnApproachRange { get { return 10; } }
public override void OnDelete()
{