discard Spawner setter. various fixes to dismount, pets, bolas, specials, spells...

This commit is contained in:
xavier 2013-02-09 23:57:01 +00:00
parent 3b94a24a9a
commit 91273d85d6
8 changed files with 137 additions and 143 deletions

View file

@ -247,8 +247,10 @@ namespace Server.Mobiles
}
else
{
if ( m_Rider != null )
if( m_Rider != null )
{
Dismount( m_Rider );
}
Dismount( value );
@ -259,8 +261,10 @@ namespace Server.Mobiles
Internalize();
if ( value.Target is Bola.BolaTarget )
if( value.Target is Bola.BolaTarget )
{
Target.Cancel( value );
}
}
m_Rider = value;
@ -276,9 +280,9 @@ namespace Server.Mobiles
{
bool result = true;
if( ( mob is PlayerMobile ) && ( mob as PlayerMobile ).BlockReason != BlockMountType.None )
if ((mob is PlayerMobile) && (mob as PlayerMobile).MountBlockReason != BlockMountType.None)
{
mob.SendLocalizedMessage( ( int )( mob as PlayerMobile ).BlockReason );
mob.SendLocalizedMessage((int)(mob as PlayerMobile).MountBlockReason);
result = false;
}

View file

@ -8,6 +8,8 @@ namespace Server.Mobiles
[CorpseName( "a hiryu corpse" )]
public class Hiryu : BaseMount
{
public override double WeaponAbilityChance { get { return 0.07; } } /* 1 in 15 chance of using per landed hit */
public override WeaponAbility GetWeaponAbility()
{
return WeaponAbility.Dismount;

View file

@ -8,6 +8,8 @@ namespace Server.Mobiles
[CorpseName( "a hiryu corpse" )]
public class LesserHiryu : BaseMount
{
public override double WeaponAbilityChance { get { return 0.07; } } /* 1 in 15 chance of using; 1 in 5 chance of success */
public override WeaponAbility GetWeaponAbility()
{
return WeaponAbility.Dismount;

View file

@ -425,10 +425,6 @@ namespace Server.Mobiles
}
set
{
if( value is ISpawner )
{
Spawner = value as ISpawner;
}
}
}

View file

@ -667,72 +667,57 @@ namespace Server.Mobiles
}
}
private List<MountBlock> m_Blocks;
private MountBlock m_MountBlock;
public BlockMountType BlockReason { get { return ( CheckList() ) ? m_Blocks[ 0 ].type : BlockMountType.None; } }
public BlockMountType MountBlockReason
{
get
{
return ( CheckBlock( m_MountBlock ) ) ? m_MountBlock.m_Type : BlockMountType.None;
}
}
private static bool CheckBlock( MountBlock block )
{
return ( !( block is MountBlock ) || !block.m_Timer.Running );
}
private class MountBlock
{
public BlockMountType type;
public BlockMountType m_Type;
public Timer m_Timer;
public MountBlock( TimeSpan duration, BlockMountType Type, List<MountBlock> list )
public MountBlock( TimeSpan duration, BlockMountType type, Mobile mobile )
{
type = Type;
m_Type = type;
m_Timer = Timer.DelayCall( duration, new TimerStateCallback<List<MountBlock>>( RemoveBlock ), list );
m_Timer = Timer.DelayCall( duration, new TimerStateCallback<Mobile>( RemoveBlock ), mobile );
}
private void RemoveBlock( List<MountBlock> list )
private void RemoveBlock( Mobile mobile )
{
if( list != null )
{
list.Remove( this );
}
( mobile as PlayerMobile ).m_MountBlock = null;
}
}
public void AddMountBlock( BlockMountType type, TimeSpan duration )
public void SetMountBlock( BlockMountType type, TimeSpan duration, bool dismount )
{
CheckList();
m_Blocks.Add( new MountBlock( duration, type, m_Blocks ) );
IMount mount = this.Mount;
if( mount != null )
if( dismount )
{
mount.Rider = null;
}
}
private bool CheckList()
{
if( m_Blocks == null )
{
m_Blocks = new List<MountBlock>();
}
else if( m_Blocks.Count > 0 )
{
List<MountBlock> toRemove = new List<MountBlock>();
int count = m_Blocks.Count;
for( int i = 0; i < count; i++ )
if (this.Mount != null)
{
if( !m_Blocks[ i ].m_Timer.Running )
{
toRemove.Add( m_Blocks[ i ] );
}
this.Mount.Rider = null;
}
foreach( MountBlock block in toRemove )
else if (AnimalForm.UnderTransformation(this))
{
m_Blocks.Remove( block );
AnimalForm.RemoveContext(this, true);
}
}
return m_Blocks.Count > 0;
if( ( m_MountBlock == null ) || !m_MountBlock.m_Timer.Running || ( m_MountBlock.m_Timer.Next < ( DateTime.UtcNow + duration ) ) )
{
m_MountBlock = new MountBlock( duration, type, this );
}
}
public override void OnSkillInvalidated( Skill skill )