Пример #1
0
 public override void Damage(int amount, Mobile from, bool informmount, bool checkfizzle)
 {
     if (from == null || (ShadowguardController.GetEncounter(this.Location, this.Map) != null && this.Z == from.Z))
     {
         base.Damage(amount, from, informmount, checkfizzle);
     }
 }
Пример #2
0
        public void CheckPlayerStatus(Mobile m)
        {
            if (m is PlayerMobile)
            {
                Party p = Party.Get(m);
                bool  aliveandconnectedandpresent = false;

                if (p != null)
                {
                    foreach (PartyMemberInfo info in p.Members)
                    {
                        if (info.Mobile.Alive && info.Mobile.NetState != null && ShadowguardController.GetEncounter(m.Location, m.Map) == this)
                        {
                            aliveandconnectedandpresent = true;
                        }
                    }
                }

                if (!aliveandconnectedandpresent)
                {
                    Expire(false);

                    if (p != null)
                    {
                        p.Members.ForEach(info => info.Mobile.SendLocalizedMessage(1156267));                         // All members of your party are dead, have logged off, or have chosen to exit Shadowguard. You will be removed from the encounter shortly.
                    }
                    else
                    {
                        m.SendLocalizedMessage(1156267); // All members of your party are dead, have logged off, or have chosen to exit Shadowguard. You will be removed from the encounter shortly.
                    }
                }
            }
        }
Пример #3
0
        public virtual void Summon()
        {
            int max = MaxSummons;

            ShadowguardEncounter inst = ShadowguardController.GetEncounter(this.Location, this.Map);

            if (inst != null)
            {
                max += inst.PartySize() * 2;
            }

            if (this.Map == null || this.SummonTypes == null || this.SummonTypes.Length == 0 || TotalSummons() > max)
            {
                return;
            }

            int count = Utility.RandomList(1, 2, 2, 2, 3, 3, 4, 5);

            for (int i = 0; i < count; i++)
            {
                Point3D p = Combatant.Location;

                for (int j = 0; j < 10; j++)
                {
                    int x = Utility.RandomMinMax(p.X - 3, p.X + 3);
                    int y = Utility.RandomMinMax(p.Y - 3, p.Y + 3);
                    int z = this.Map.GetAverageZ(x, y);

                    if (this.Map.CanSpawnMobile(x, y, z))
                    {
                        p = new Point3D(x, y, z);
                        break;
                    }
                }

                BaseCreature spawn = Activator.CreateInstance(SummonTypes[Utility.Random(SummonTypes.Length)]) as BaseCreature;

                if (spawn != null)
                {
                    spawn.MoveToWorld(p, this.Map);
                    spawn.Team         = this.Team;
                    spawn.SummonMaster = this;

                    Timer.DelayCall(TimeSpan.FromSeconds(1), (o) =>
                    {
                        BaseCreature s = o as BaseCreature;

                        if (s != null)
                        {
                            s.Combatant = this.Combatant;
                        }
                    }, spawn);

                    AddHelper(spawn);
                }
            }

            _NextSummon = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(20, 40));
        }
Пример #4
0
        private static void OnDisconnected(DisconnectedEventArgs e)
        {
            ShadowguardEncounter encounter = ShadowguardController.GetEncounter(e.Mobile.Location, e.Mobile.Map);

            if (encounter != null)
            {
                encounter.CheckPlayerStatus(e.Mobile);
            }
        }
Пример #5
0
        public override int Damage(int amount, Mobile from, bool informmount, bool checkfizzle)
        {
            if (from == null || (ShadowguardController.GetEncounter(Location, Map) != null && Z == from.Z))
            {
                return(base.Damage(amount, from, informmount, checkfizzle));
            }

            return(0);
        }
Пример #6
0
        public override void OnDoubleClick(Mobile m)
        {
            FountainEncounter encounter = ShadowguardController.GetEncounter(this.Location, this.Map) as FountainEncounter;

            if (m.InRange(this.Location, 2) && encounter != null && this.ItemID != 17294 && this.ItemID != 17278)
            {
                encounter.UseSpigot(this, m);
            }
        }
Пример #7
0
        public override void OnDeath(Container c)
        {
            if (ShadowguardController.GetEncounter(c.Location, c.Map) is BelfryEncounter)
            {
                c.DropItem(new MagicDrakeWing());
            }

            base.OnDeath(c);
        }
Пример #8
0
        public override int Damage(int amount, Mobile from, bool informMount, bool checkfizzle)
        {
            if (ShadowguardController.GetEncounter(Location, Map) is RoofEncounter encounter && from != null)
            {
                from.SendLocalizedMessage(1156254); // Minax laughs as she deflects your puny attacks! Defeat her minions to close the Time Gate!
                return(0);
            }

            return(base.Damage(amount, from, informMount, checkfizzle));
        }
Пример #9
0
        protected override bool OnMove(Direction d)
        {
            RoofEncounter encounter = ShadowguardController.GetEncounter(this.Location, this.Map) as RoofEncounter;

            if (encounter != null)
            {
                Point3D spawn = encounter.SpawnPoints[0];

                int x = this.X;
                int y = this.Y;

                Movement.Movement.Offset(d, ref x, ref y);

                Point3D p = new Point3D(x, y, this.Map.GetAverageZ(x, y));
                int     z = p.Z;

                if (p.Y < spawn.Y - 5 || p.Y > spawn.Y + 4 || p.X > spawn.X + 4 || p.X < spawn.X - 5)
                {
                    return(false);
                }

                IPooledEnumerable eable = this.Map.GetItemsInRange(p, 0);
                Item i = null;

                foreach (Item item in eable)
                {
                    if (item.Z + item.ItemData.CalcHeight > z)
                    {
                        i = item;
                        z = item.Z + item.ItemData.CalcHeight;
                    }
                }

                StaticTile[] staticTiles = this.Map.Tiles.GetStaticTiles(x, y, true);

                foreach (StaticTile tile in staticTiles)
                {
                    ItemData itemData = TileData.ItemTable[tile.ID & TileData.MaxItemValue];

                    if (tile.Z + itemData.CalcHeight > z)
                    {
                        z = tile.Z + itemData.CalcHeight;
                    }
                }

                eable.Free();

                if (z < this.Z)
                {
                    return(false);
                }
            }

            return(base.OnMove(d));
        }
Пример #10
0
        public override void Damage(int amount, Mobile from, bool informMount, bool checkfizzle)
        {
            RoofEncounter encounter = ShadowguardController.GetEncounter(this.Location, this.Map) as RoofEncounter;

            if (encounter != null && from != null)
            {
                from.SendLocalizedMessage(1156254); // Minax laughs as she deflects your puny attacks! Defeat her minions to close the Time Gate!
                return;
            }

            base.Damage(amount, from, informMount, checkfizzle);
        }
Пример #11
0
        public override bool OnBeforeDeath()
        {
            if (ShadowguardController.GetEncounter(Location, Map) is FountainEncounter encounter)
            {
                ShadowguardCanal canal = new ShadowguardCanal();

                canal.MoveToWorld(Location, Map);
                encounter.AddShadowguardCanal(canal);
            }

            return(base.OnBeforeDeath());
        }
Пример #12
0
        public override void OnDoubleClick(Mobile from)
        {
            BelfryEncounter encounter = ShadowguardController.GetEncounter(from.Location, from.Map) as BelfryEncounter;

            if (encounter != null && IsChildOf(from.Backpack))
            {
                Point3D p = encounter.SpawnPoints[1];
                encounter.ConvertOffset(ref p);
                from.MoveToWorld(p, Map.TerMur);
                BaseCreature.TeleportPets(from, p, from.Map);
            }
        }
Пример #13
0
        protected override bool OnMove(Direction d)
        {
            if (ShadowguardController.GetEncounter(Location, Map) is RoofEncounter encounter)
            {
                Point3D spawn = encounter.SpawnPoints[0];

                int x = X;
                int y = Y;

                Movement.Movement.Offset(d, ref x, ref y);

                Point3D p = new Point3D(x, y, Map.GetAverageZ(x, y));
                int     z = p.Z;

                if (p.Y < spawn.Y - 5 || p.Y > spawn.Y + 4 || p.X > spawn.X + 4 || p.X < spawn.X - 5)
                {
                    return(false);
                }

                IPooledEnumerable eable = Map.GetItemsInRange(p, 0);

                foreach (Item item in eable)
                {
                    if (item.Z + item.ItemData.CalcHeight > z)
                    {
                        z = item.Z + item.ItemData.CalcHeight;
                    }
                }

                StaticTile[] staticTiles = Map.Tiles.GetStaticTiles(x, y, true);

                for (var index = 0; index < staticTiles.Length; index++)
                {
                    StaticTile tile = staticTiles[index];

                    ItemData itemData = TileData.ItemTable[tile.ID & TileData.MaxItemValue];

                    if (tile.Z + itemData.CalcHeight > z)
                    {
                        z = tile.Z + itemData.CalcHeight;
                    }
                }

                eable.Free();

                if (z < Z)
                {
                    return(false);
                }
            }

            return(base.OnMove(d));
        }
Пример #14
0
        public override void OnThink()
        {
            base.OnThink();

            if (ShadowguardController.GetEncounter(Location, Map) is BelfryEncounter encounter && Z == -20)
            {
                Point3D p = encounter.SpawnPoints[0];
                encounter.ConvertOffset(ref p);

                MoveToWorld(p, Map);
            }
        }
Пример #15
0
        public override bool OnBeforeDeath()
        {
            FountainEncounter encounter = ShadowguardController.GetEncounter(this.Location, this.Map) as FountainEncounter;

            if (encounter != null)
            {
                var canal = new ShadowguardCanal();
                canal.MoveToWorld(this.Location, this.Map);
                encounter.AddShadowguardCanal(canal);
            }

            return(base.OnBeforeDeath());
        }
Пример #16
0
        public override void OnThink()
        {
            base.OnThink();

            BelfryEncounter encounter = ShadowguardController.GetEncounter(this.Location, this.Map) as BelfryEncounter;

            if (encounter != null && this.Z == -20)
            {
                Point3D p = encounter.SpawnPoints[0];
                encounter.ConvertOffset(ref p);

                this.MoveToWorld(p, this.Map);
            }
        }
Пример #17
0
        public override void OnThink()
        {
            base.OnThink();

            if (ShadowguardController.GetEncounter(Location, Map) is RoofEncounter encounter)
            {
                Point3D spawn = encounter.SpawnPoints[0];
                Point3D p     = Location;
                encounter.ConvertOffset(ref spawn);

                if (Z < 30 || p.Y < spawn.Y - 5 || p.Y > spawn.Y + 4 || p.X > spawn.X + 4 || p.X < spawn.X - 5)
                {
                    MoveToWorld(spawn, Map.TerMur);
                }
            }
        }
Пример #18
0
        public override void OnComponentUsed(AddonComponent c, Mobile from)
        {
            if (from.InRange(c.Location, 2) && c.ItemID == 19548)
            {
                BelfryEncounter encounter = ShadowguardController.GetEncounter(c.Location, c.Map) as BelfryEncounter;

                if (encounter != null && encounter.Drakes != null && encounter.Drakes.Count == 0)
                {
                    int toSpawn = 2 + (encounter.PartySize() * 3);

                    for (int i = 0; i < toSpawn; i++)
                    {
                        encounter.SpawnDrake(this.Location, from);
                        Effects.PlaySound(this.Location, this.Map, 0x66C);
                    }
                }
            }
        }
Пример #19
0
        public override void OnThink()
        {
            base.OnThink();

            RoofEncounter encounter = ShadowguardController.GetEncounter(this.Location, this.Map) as RoofEncounter;

            if (encounter != null)
            {
                Point3D spawn = encounter.SpawnPoints[0];
                Point3D p     = this.Location;
                encounter.ConvertOffset(ref spawn);

                if (this.Z < 30 || p.Y < spawn.Y - 5 || p.Y > spawn.Y + 4 || p.X > spawn.X + 4 || p.X < spawn.X - 5)
                {
                    this.MoveToWorld(spawn, Map.TerMur);
                }
            }
        }
Пример #20
0
        protected override bool OnMove(Direction d)
        {
            if (ShadowguardController.GetEncounter(Location, Map) != null)
            {
                int x = X;
                int y = Y;

                Movement.Movement.Offset(d, ref x, ref y);

                Point3D p = new Point3D(x, y, Map.GetAverageZ(x, y));
                int     z = p.Z;

                IPooledEnumerable eable = Map.GetItemsInRange(p, 0);

                foreach (Item item in eable)
                {
                    if (item.Z + item.ItemData.CalcHeight > z)
                    {
                        z = item.Z + item.ItemData.CalcHeight;
                    }
                }

                StaticTile[] staticTiles = Map.Tiles.GetStaticTiles(x, y, true);

                foreach (StaticTile tile in staticTiles)
                {
                    ItemData itemData = TileData.ItemTable[tile.ID & TileData.MaxItemValue];

                    if (tile.Z + itemData.CalcHeight > z)
                    {
                        z = tile.Z + itemData.CalcHeight;
                    }
                }

                eable.Free();

                if (z < Z)
                {
                    return(false);
                }
            }

            return(base.OnMove(d));
        }
Пример #21
0
        public override void OnDoubleClick(Mobile m)
        {
            if (IsChildOf(m.Backpack))
            {
                m.SendLocalizedMessage(1010086);                 // What do you want to use this on?
                m.BeginTarget(3, false, Server.Targeting.TargetFlags.None, (from, targeted) =>
                {
                    if (targeted is PurifyingFlames)
                    {
                        var flames = targeted as PurifyingFlames;

                        if (!from.InLOS(flames))
                        {
                            from.SendLocalizedMessage(500237); // Target cannot be seen.
                        }
                        else if (!Purified)
                        {
                            m.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1156225, m.NetState); // *You purify the phylactery!*

                            Effects.SendLocationParticles(EffectItem.Create(flames.Location, flames.Map, EffectItem.DefaultDuration), 0x3709, 10, 30, 5052);
                            Effects.PlaySound(flames.Location, flames.Map, 0x225); //TODO: Get sound

                            Purified = true;
                            InvalidateProperties();
                        }
                    }
                    else if (targeted is CursedSuitOfArmor)
                    {
                        var armor = targeted as CursedSuitOfArmor;

                        if (!from.InLOS(armor))
                        {
                            from.SendLocalizedMessage(500237); // Target cannot be seen.
                        }
                        else if (!_Purified)
                        {
                            m.SendLocalizedMessage(1156224);                             // *The cursed armor rejects the phylactery!*
                        }
                        else
                        {
                            m.SendLocalizedMessage(1156222);                             // *You throw the phylactery at the armor causing it to disintegrate!*

                            Map map = armor.Map;
                            Point3D p;

                            if (armor.ItemID == 5402)
                            {
                                p = new Point3D(armor.X - 1, armor.Y, armor.Z);
                            }
                            else
                            {
                                p = new Point3D(armor.X, armor.Y - 1, armor.Z);
                            }

                            armor.Delete();
                            Delete();

                            Effects.SendLocationParticles(EffectItem.Create(p, map, EffectItem.DefaultDuration), 0x3709, 10, 30, 2720, 7, 5052, 0);
                            Effects.PlaySound(p, map, 0x225);                               //TODO: Get sound

                            Timer.DelayCall(TimeSpan.FromSeconds(1), () =>
                            {
                                Item item = new Static(Utility.Random(8762, 16));
                                item.Hue  = 1111;
                                item.Name = "Broken Armor";
                                item.MoveToWorld(p, Map.TerMur);

                                ArmoryEncounter encounter = ShadowguardController.GetEncounter(p, Map.TerMur) as ArmoryEncounter;

                                if (encounter != null)
                                {
                                    encounter.AddDestroyedArmor(item);
                                }

                                int ticks = 1;
                                Timer.DelayCall(TimeSpan.FromMilliseconds(50), TimeSpan.FromMilliseconds(50), 2, () =>
                                {
                                    Server.Misc.Geometry.Circle2D(p, map, ticks, (pnt, mob) =>
                                    {
                                        Effects.PlaySound(pnt, mob, 0x307);
                                        Effects.SendLocationEffect(pnt, mob, Utility.RandomBool() ? 14000 : 14013, 20, 2018, 0);
                                    });

                                    ticks++;
                                });
                            });
                        }
                    }
                });
            }
        }