OnBeforeSpawn() public method

public OnBeforeSpawn ( Point3D location, Map m ) : void
location Point3D
m Map
return void
Beispiel #1
0
        public void SpawnFollowers(Mobile from)
        {
            if (Map == null)
            {
                return;
            }

            Point3D loc  = Map.GetSpawnPosition(Location, 8);
            Type    type = m_SummonTypes[Utility.Random(m_SummonTypes.Length)];

            PlaySound(0x218);

            for (int i = 0; i < 4; i++)
            {
                BaseCreature summon = (BaseCreature)Activator.CreateInstance(type);

                if (summon != null)
                {
                    summon.SetHits(summon.HitsMax / 2);
                    summon.Team = Team;
                    summon.OnBeforeSpawn(loc, Map);
                    summon.MoveToWorld(loc, Map);
                    summon.Combatant = from;
                }
            }
        }
Beispiel #2
0
        public override void OnBeforeSpawn(Point3D location, Map map)
        {
            base.OnBeforeSpawn(location, map);

            for (int i = 0; i < InitialStatueAmount; i++)
            {
                BaseCreature statue = CreateStatue();

                if (statue != null)
                {
                    Point3D loc = map.GetSpawnPosition(location, 40);

                    statue.MoveToWorld(loc, map);
                    statue.OnBeforeSpawn(loc, map);

                    m_Statues.Add(statue);
                }
            }
        }
Beispiel #3
0
        public override void OnDamage(int amount, Mobile from, bool willKill)
        {
            base.OnDamage(amount, from, willKill);

            if (willKill || Map == null || from == null)
            {
                return;
            }

            if (0.05 > Utility.RandomDouble())
            {
                Point3D loc  = Map.GetSpawnPosition(Location, 8);
                Type    type = m_SummonTypes[Utility.Random(m_SummonTypes.Length)];

                for (int i = 0; i < 4; i++)
                {
                    BaseCreature summon = (BaseCreature)Activator.CreateInstance(type);

                    if (summon != null)
                    {
                        summon.SetHits(summon.HitsMax / 2);

                        summon.OnBeforeSpawn(loc, Map);
                        summon.MoveToWorld(loc, Map);

                        summon.Combatant = from;
                    }
                }
            }

            if (0.1 > Utility.RandomDouble() && DateTime.UtcNow > m_NextAbilityTime)
            {
                Say(1112362);                   // You will burn to a pile of ash!

                from.PlaySound(0x349);

                for (int i = 0; i < m_ColumnOffset.Length; i++)
                {
                    Point2D offset = m_ColumnOffset[i];

                    Point3D effectLocation = new Point3D(Location.X + offset.X, Location.Y + offset.Y, Location.Z);

                    Effects.SendPacket(effectLocation, Map,
                                       new LocationEffect(effectLocation, 0x3709, 10, 30, 0, 0));
                }

                Timer.DelayCall(TimeSpan.FromSeconds(1.0), new TimerCallback(
                                    delegate
                {
                    // TODO: Based on OSI taken videos, not accurate, but an aproximation

                    Effects.SendPacket(this.Location, this.Map, new FlashEffect(FlashType.LightFlash));

                    PlaySound(0x44B);

                    int range = 8;

                    Point3D loc = this.Location;
                    Map map     = this.Map;

                    for (int x = -range; x <= range; x++)
                    {
                        for (int y = -range; y <= range; y++)
                        {
                            Point3D p = new Point3D(loc.X + x, loc.Y + y, loc.Z - 5);
                            int dist  = (int)Math.Round(Utility.GetDistanceToSqrt(loc, p));

                            if (dist <= range)
                            {
                                int itemId, renderMode, duration;

                                if (dist >= 8)
                                {
                                    itemId     = 0x36CB;
                                    duration   = 9;
                                    renderMode = 4;
                                }
                                else if (dist >= 6)
                                {
                                    itemId     = 0x3728;
                                    duration   = 13;
                                    renderMode = 4;
                                }
                                else
                                {
                                    itemId     = 0x3728;
                                    duration   = 13;
                                    renderMode = 3;
                                }

                                Effects.SendPacket(loc, map, new HuedEffect(EffectType.FixedXYZ, Serial.Zero, Serial.Zero, itemId, p, p, 1, duration, true, false, 1150, renderMode));
                            }
                        }
                    }

                    foreach (Mobile m in this.GetMobilesInRange(8).ToArray())
                    {
                        if (this != m && this.GetDistanceToSqrt(m) <= 8 && CanBeHarmful(m))
                        {
                            if (m is BaseCreature && !((BaseCreature)m).Controlled && !((BaseCreature)m).Summoned)
                            {
                                continue;
                            }

                            DoHarmful(m);

                            // TODO: Where do we freeze target and teleport them away?

                            AOS.Damage(m, this, Utility.RandomMinMax(90, 110), 0, 100, 0, 0, 0);
                        }
                    }
                }));

                m_NextAbilityTime = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(35, 45));
            }
        }