Example #1
0
        public override void OnDelete()
        {
            base.OnDelete();

            if (!_Thrown && Encounter != null)
            {
                foreach (var pm in Encounter.Region.GetEnumeratedMobiles().OfType <PlayerMobile>())
                {
                    if (!pm.Alive)
                    {
                        continue;
                    }

                    var p        = pm.Location;
                    var map      = pm.Map;
                    var creature = new VileTreefellow();

                    for (int i = 0; i < 10; i++)
                    {
                        int x = Utility.RandomMinMax(p.X - 1, p.X + 1);
                        int y = Utility.RandomMinMax(p.Y - 1, p.Y + 1);
                        int z = p.Z;

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

                    creature.MoveToWorld(p, map);
                    Timer.DelayCall(() => creature.Combatant = pm);

                    Encounter.AddSpawn(creature);
                }
            }
        }
Example #2
0
        public override void OnDoubleClick(Mobile m)
        {
            if (IsChildOf(m.Backpack) && Tree != null)
            {
                m.SendLocalizedMessage(1010086);                 // What do you want to use this on?
                m.BeginTarget(10, false, Server.Targeting.TargetFlags.None, (from, targeted) =>
                {
                    _Thrown = true;

                    if (targeted is ShadowguardCypress || targeted is ShadowguardCypress.ShadowguardCypressFoilage)
                    {
                        ShadowguardCypress tree = null;

                        if (targeted is ShadowguardCypress)
                        {
                            tree = targeted as ShadowguardCypress;
                        }
                        else if (targeted is ShadowguardCypress.ShadowguardCypressFoilage)
                        {
                            tree = ((ShadowguardCypress.ShadowguardCypressFoilage)targeted).Tree;
                        }

                        if (tree != null)
                        {
                            Point3D p = tree.Location;
                            Map map   = tree.Map;

                            from.Animate(31, 7, 1, true, false, 0);
                            m.MovingParticles(tree, this.ItemID, 10, 0, false, true, 0, 0, 9502, 6014, 0x11D, EffectLayer.Waist, 0);

                            Timer.DelayCall(TimeSpan.FromSeconds(.7), () =>
                            {
                                if (tree.IsOppositeVirtue(Tree.VirtueType))
                                {
                                    tree.Delete();

                                    Effects.SendLocationParticles(EffectItem.Create(p, map, EffectItem.DefaultDuration), 0x3709, 10, 30, 5052);
                                    Effects.PlaySound(p, map, 0x243);

                                    m.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1156213, m.NetState);     // *Your throw releases powerful magics and destroys the tree!*

                                    if (Tree != null)
                                    {
                                        p = Tree.Location;
                                        Tree.Delete();

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

                                    tree.Encounter.CheckEncounter();
                                    Delete();
                                }
                                else if (Encounter != null)
                                {
                                    foreach (var pm in Encounter.Region.GetEnumeratedMobiles().OfType <PlayerMobile>())
                                    {
                                        if (!pm.Alive)
                                        {
                                            continue;
                                        }

                                        p            = pm.Location;
                                        var creature = new VileTreefellow();

                                        for (int i = 0; i < 10; i++)
                                        {
                                            int x = Utility.RandomMinMax(p.X - 1, p.X + 1);
                                            int y = Utility.RandomMinMax(p.Y - 1, p.Y + 1);
                                            int z = p.Z;

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

                                        creature.MoveToWorld(p, map);
                                        Timer.DelayCall(() => creature.Combatant = pm);

                                        Encounter.AddSpawn(creature);
                                    }

                                    m.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1156212, m.NetState);     // *Your throw seems to have summoned an ambush!*
                                    Delete();
                                }
                            });
                        }
                    }
                });
            }
        }