- Fixed HelpInfo not displaying the availability of the Global modifier.
- The Most Knowledge Person, The Robe Of Britannia "Ari" and Embroidered Oak Leaf Cloak can now be repaired. - Added TimeoutTeleporter. - Fixed weapon attributes on elven glasses not being counted. - Added Labyrinth to the ML regions list. - Fixed a bug in Ilhenir's StainedOoze causing the effect to never stop. - StainedOoze will now only damage equipment until the equipment's hitpoints reaches single digits. - Added an overhead message to the corrosive effect of StainedOoze. - Remaining StainedOoze will now decay properly after a server reboot. - General rewriting of the StainedOoze code. - Fixed Changeling sounds. - Fixed Irk, Guile and Spite morphing back into a paragon hue. - Changeling cloned items are now deleted upon the Changeling's deletion, instead of being cleaned up at a server boot. - Fixed talisman protection property.
This commit is contained in:
parent
06975930b9
commit
9023acf7b4
9 changed files with 289 additions and 170 deletions
|
|
@ -318,8 +318,10 @@ namespace Server.Mobiles
|
|||
public class StainedOoze : Item
|
||||
{
|
||||
private bool m_Corrosive;
|
||||
private Timer m_Timer;
|
||||
private int m_Ticks;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool Corrosive
|
||||
{
|
||||
get { return m_Corrosive; }
|
||||
|
|
@ -328,183 +330,116 @@ namespace Server.Mobiles
|
|||
|
||||
[Constructable]
|
||||
public StainedOoze()
|
||||
: this(false)
|
||||
: this( false )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public StainedOoze(bool corrosive)
|
||||
: base(0x122A)
|
||||
public StainedOoze( bool corrosive )
|
||||
: base( 0x122A )
|
||||
{
|
||||
Movable = false;
|
||||
Hue = 0x95;
|
||||
|
||||
m_Corrosive = corrosive;
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(30), new TimerCallback(Morph));
|
||||
m_Timer = Timer.DelayCall( TimeSpan.Zero, TimeSpan.FromSeconds( 1 ), OnTick );
|
||||
m_Ticks = 0;
|
||||
}
|
||||
|
||||
private Hashtable m_Table;
|
||||
|
||||
public override bool OnMoveOver(Mobile m)
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
if( m != null && !m.Deleted )
|
||||
if ( m_Timer != null )
|
||||
{
|
||||
if( m_Table == null )
|
||||
m_Timer.Stop();
|
||||
m_Timer = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTick()
|
||||
{
|
||||
List<Mobile> toDamage = new List<Mobile>();
|
||||
|
||||
foreach ( Mobile m in GetMobilesInRange( 0 ) )
|
||||
{
|
||||
if ( m is BaseCreature )
|
||||
{
|
||||
m_Table = new Hashtable();
|
||||
BaseCreature bc = (BaseCreature)m;
|
||||
|
||||
if ( !bc.Controlled && !bc.Summoned )
|
||||
continue;
|
||||
}
|
||||
else if ( !m.Player )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if( ( m is BaseCreature && ( (BaseCreature)m ).Controlled ) || m.Player )
|
||||
if ( m.Alive && !m.IsDeadBondedPet && m.CanBeDamaged() )
|
||||
toDamage.Add( m );
|
||||
}
|
||||
|
||||
for ( int i = 0; i < toDamage.Count; ++i )
|
||||
Damage( toDamage[i] );
|
||||
|
||||
++m_Ticks;
|
||||
|
||||
if ( m_Ticks >= 35 )
|
||||
Delete();
|
||||
else if ( m_Ticks == 30 )
|
||||
ItemID = 0x122B;
|
||||
}
|
||||
|
||||
public void Damage( Mobile m )
|
||||
{
|
||||
if ( m_Corrosive )
|
||||
{
|
||||
List<Item> items = m.Items;
|
||||
bool damaged = false;
|
||||
|
||||
for ( int i = 0; i < items.Count; ++i )
|
||||
{
|
||||
m_Table[ m ] = Timer.DelayCall( TimeSpan.FromSeconds( 1 ), TimeSpan.FromSeconds( 1 ), new TimerStateCallback( Damage_Callback ), m );
|
||||
IDurability wearable = items[i] as IDurability;
|
||||
|
||||
if ( wearable != null && wearable.HitPoints >= 10 && Utility.RandomDouble() < 0.25 )
|
||||
{
|
||||
wearable.HitPoints -= ( wearable.HitPoints == 10 ) ? Utility.Random( 1, 5 ) : 10;
|
||||
damaged = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( damaged )
|
||||
{
|
||||
m.LocalOverheadMessage( MessageType.Regular, 0x21, 1072070 ); // The infernal ooze scorches you, setting you and your equipment ablaze!
|
||||
return;
|
||||
}
|
||||
}
|
||||
return base.OnMoveOver( m );
|
||||
|
||||
AOS.Damage( m, 40, 0, 0, 0, 100, 0 );
|
||||
}
|
||||
|
||||
public override bool OnMoveOff(Mobile m)
|
||||
{
|
||||
if (m_Table == null)
|
||||
m_Table = new Hashtable();
|
||||
|
||||
if (m_Table[m] is Timer)
|
||||
{
|
||||
Timer timer = (Timer)m_Table[m];
|
||||
|
||||
timer.Stop();
|
||||
|
||||
m_Table[m] = null;
|
||||
}
|
||||
|
||||
return base.OnMoveOff(m);
|
||||
}
|
||||
|
||||
public StainedOoze(Serial serial)
|
||||
: base(serial)
|
||||
public StainedOoze( Serial serial )
|
||||
: base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize(writer);
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write((int)0); // version
|
||||
writer.Write( (int) 0 ); // version
|
||||
|
||||
writer.Write((bool)m_Corrosive);
|
||||
writer.Write( m_Corrosive );
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
m_Corrosive = reader.ReadBool();
|
||||
}
|
||||
|
||||
private void Damage_Callback(object state)
|
||||
{
|
||||
if (state is Mobile)
|
||||
Damage((Mobile)state);
|
||||
}
|
||||
|
||||
/* Ode to ASayre .. perhaps a lil voodoo will summon his ghost :D */
|
||||
|
||||
private bool DamageSelector( ref bool z, ref int hp, ref int mhp )
|
||||
{
|
||||
return ( ( ( mhp -= ( z ) ? ( ( mhp > 10 ) ? 10 : 1 ) : 0 ) > 0 ) && ( hp -= ( ( z ) ? 0 : ( ( hp > 10 ) ? 10 : 1 ) ) ) > 0 );
|
||||
}
|
||||
|
||||
private bool ValidMobile( Mobile m )
|
||||
{
|
||||
return ( !m.Deleted && m.Alive && m.AccessLevel == AccessLevel.Player );
|
||||
}
|
||||
|
||||
private bool IsUsingDurability( IDurability item )
|
||||
{
|
||||
return ( (item.HitPoints + item.MaxHitPoints ) > 0 );
|
||||
}
|
||||
|
||||
private IDurability ValidDurabilityEquipment( Mobile m, Item item )
|
||||
{
|
||||
return ( ( item != null && !item.Deleted && item.Parent == m && item is IDurability ) ? item as IDurability : null );
|
||||
}
|
||||
|
||||
public virtual void Damage( Mobile m )
|
||||
{
|
||||
if( m == null || m.Deleted || !m.Alive || m.Map == null || m.Map == Map.Internal ) /* cant have that happen again */
|
||||
{
|
||||
StopTimer( m );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( ValidMobile( m ) )
|
||||
{
|
||||
if( m_Corrosive && ( m.Items.Count > 0 ) )
|
||||
{
|
||||
for( int i = 0; i < m.Items.Count; i++ )
|
||||
{
|
||||
Item m_Item; IDurability item = ValidDurabilityEquipment( m, ( m_Item = m.Items[ i ] as Item ) );
|
||||
|
||||
if( item != null && ( IsUsingDurability( item ) ) && ( Utility.RandomDouble() < 0.25 ) )
|
||||
{
|
||||
int hp; bool z = ( ( hp = item.HitPoints ) < 1 ); int mhp = item.MaxHitPoints;
|
||||
|
||||
if( !( DamageSelector( ref z, ref hp, ref mhp ) ) && z )
|
||||
{
|
||||
m.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1061121 ); // Your equipment is severely damaged.
|
||||
|
||||
if( ( item.MaxHitPoints = mhp ) < 1 )
|
||||
{
|
||||
m_Item.Delete();
|
||||
}
|
||||
}
|
||||
|
||||
item.HitPoints = hp;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AOS.Damage( m, 40, 0, 0, 0, 100, 0 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
StopTimer( m );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void Morph()
|
||||
{
|
||||
ItemID += 1;
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(5), new TimerCallback(Decay));
|
||||
}
|
||||
|
||||
public virtual void StopTimer(Mobile m)
|
||||
{
|
||||
if (m_Table[m] is Timer)
|
||||
{
|
||||
Timer timer = (Timer)m_Table[m];
|
||||
timer.Stop();
|
||||
m_Table[m] = null;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void Decay()
|
||||
{
|
||||
if (m_Table == null)
|
||||
m_Table = new Hashtable();
|
||||
|
||||
foreach (DictionaryEntry entry in m_Table)
|
||||
if (entry.Value is Timer)
|
||||
((Timer)entry.Value).Stop();
|
||||
|
||||
m_Table.Clear();
|
||||
|
||||
Delete();
|
||||
m_Timer = Timer.DelayCall( TimeSpan.Zero, TimeSpan.FromSeconds( 1 ), OnTick );
|
||||
m_Ticks = ( ItemID == 0x122A ) ? 0 : 30;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ namespace Server.Mobiles
|
|||
Name = DefaultName;
|
||||
Body = 264;
|
||||
Hue = DefaultHue;
|
||||
BaseSoundID = 0x470;
|
||||
|
||||
SetStr( 36, 105 );
|
||||
SetDex( 212, 262 );
|
||||
|
|
@ -70,6 +69,12 @@ namespace Server.Mobiles
|
|||
AddLoot( LootPack.AosRich, 3 );
|
||||
}
|
||||
|
||||
public override int GetAngerSound() { return 0x46E; }
|
||||
public override int GetIdleSound() { return 0x470; }
|
||||
public override int GetAttackSound() { return 0x46D; }
|
||||
public override int GetHurtSound() { return 0x471; }
|
||||
public override int GetDeathSound() { return 0x46F; }
|
||||
|
||||
private Mobile m_MorphedInto;
|
||||
private DateTime m_LastMorph;
|
||||
private DateTime m_NextFireRing;
|
||||
|
|
@ -189,7 +194,7 @@ namespace Server.Mobiles
|
|||
protected virtual void Revert()
|
||||
{
|
||||
Body = 264;
|
||||
Hue = IsParagon ? Paragon.Hue : DefaultHue;
|
||||
Hue = ( IsParagon && DefaultHue == 0 ) ? Paragon.Hue : DefaultHue;
|
||||
Female = false;
|
||||
Name = DefaultName;
|
||||
NameHue = -1;
|
||||
|
|
@ -200,6 +205,14 @@ namespace Server.Mobiles
|
|||
FacialHairItemID = 0;
|
||||
FacialHairHue = 0;
|
||||
|
||||
DeleteClonedItems();
|
||||
|
||||
PlaySound( 0x511 );
|
||||
FixedParticles( 0x376A, 1, 14, 5045, EffectLayer.Waist );
|
||||
}
|
||||
|
||||
public void DeleteClonedItems()
|
||||
{
|
||||
for ( int i = Items.Count - 1; i >= 0; --i )
|
||||
{
|
||||
Item item = Items[i];
|
||||
|
|
@ -218,9 +231,13 @@ namespace Server.Mobiles
|
|||
item.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PlaySound( 0x511 );
|
||||
FixedParticles( 0x376A, 1, 14, 5045, EffectLayer.Waist );
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
DeleteClonedItems();
|
||||
|
||||
base.OnAfterDelete();
|
||||
}
|
||||
|
||||
public override void ClearHands()
|
||||
|
|
|
|||
|
|
@ -2592,8 +2592,8 @@ namespace Server.Mobiles
|
|||
{
|
||||
Type type = talisman.Protection.Type;
|
||||
|
||||
if ( type == from.GetType() )
|
||||
amount *= 1 - (int) ( ( (double) talisman.Protection.Amount ) / 100 );
|
||||
if ( type.IsAssignableFrom( from.GetType() ) )
|
||||
amount = (int)( amount * ( 1 - (double)talisman.Protection.Amount / 100 ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue