Example #1
0
        public override void OnTrigger( Mobile from )
        {
            if( from is PlayerMobile )
            {
                PlayerMobile m = from as PlayerMobile;

                if( m.Friendship.Undead < 1 )
                {
                    int randomchance = Utility.RandomMinMax( 1, 10 );

                    if( randomchance > 8 )
                    {
                        Mobile skeleton = skeleton = new Skeleton();

                        if( randomchance > 9 )
                            skeleton = new SkeletalSoldier();

                        skeleton.MoveToWorld( this.Location, this.Map );
                        skeleton.PlaySound( 1169 );
                        skeleton.Combatant = m;
                        this.Delete();
                    }
                }
            }
        }
Example #2
0
            protected override void OnTick()
            {
                if ( m_Item.Deleted )
                    return;

                Mobile spawn;

                switch ( Utility.Random( 12 ) )
                {
                    default:
                    case 0: spawn = new Skeleton(); break;
                    case 1: spawn = new Zombie(); break;
                    case 2: spawn = new Wraith(); break;
                    case 3: spawn = new Spectre(); break;
                    case 4: spawn = new Spectre(); break;
                    case 5: spawn = new Mummy(); break;
                    case 6: spawn = new Zombie(); break;
                    case 7: spawn = new Zombie(); break;
                    case 8: spawn = new Zombie(); break;
                    case 9: spawn = new SkeletalSoldier(); break;
                    case 10: spawn = new Zombie(); break;
                    case 11: spawn = new Zombie(); break;
                }

                spawn.MoveToWorld( m_Item.Location, m_Item.Map );

                m_Item.Delete();
            }
        public override void OnDoubleClick( Mobile from )
        {
            if( !from.Alive || from.Paralyzed || !from.InRange( this, 2 ) || !from.InLOS( this ) )
            {
                from.SendMessage( "That is too far away." );
                return;
            }

            if( this.CoffinSlave == null && from.AccessLevel > AccessLevel.Player )
            {
                from.SendMessage( "Creating a slave for the coffin." );
                DiabloDungeonCoffinSlave slave = new DiabloDungeonCoffinSlave();
                slave.Map = this.Map;
                slave.Location = new Point3D( this.X - 1, this.Y, this.Z );
                this.CoffinSlave = slave;
                slave.CoffinMaster = this;
                return;
            }

            if( this.CanBeOpened )
            {
                this.m_LastTimeOpened = DateTime.Now;

                int chance = Utility.RandomMinMax( 1, 100 );

                if( chance > 70 )
                {
                    from.SendMessage( "You have found some copper coins inside the coffin!" );
                    chance = Utility.RandomMinMax( 3, 6 );
                    Copper copper = new Copper( chance );
                    Container pack = from.Backpack;
                    pack.DropItem( copper );
                }

                else
                {
                    from.SendMessage( "You have disturbed the undead!" );

                    BaseCreature skeleton = new Skeleton() as BaseCreature;

                    if( chance < 20 )
                        skeleton = new SkeletalSoldier() as BaseCreature;

                    skeleton.FightMode = FightMode.Closest;

                    bool validLocation = false;
                    Point3D loc = this.Location;

                    for ( int j = 0; !validLocation && j < 10; ++j )
                    {
                        int x = X + Utility.Random( 3 ) - 1;
                        int y = Y + Utility.Random( 3 ) - 1;
                        int z = this.Map.GetAverageZ( x, y );

                        if ( validLocation = this.Map.CanFit( x, y, this.Z, 16, false, false ) )
                            loc = new Point3D( x, y, Z );
                        else if ( validLocation = this.Map.CanFit( x, y, z, 16, false, false ) )
                            loc = new Point3D( x, y, z );
                    }

                    skeleton.MoveToWorld( loc, this.Map );
                    skeleton.Combatant = from;
                    skeleton.VanishTime = DateTime.Now + TimeSpan.FromHours( 1 );
                    skeleton.VanishEmote = "*crumbles into dust*";
                    skeleton.PlaySound( 1169 );
                }
            }

            else
                from.SendMessage( "The coffin appears to be empty." );
        }