예제 #1
0
        public void Target(IPoint3D p)
        {
            IPoint3D orig = p;
            Map      map  = Caster.Map;

            SpellHelper.GetSurfaceTop(ref p);

            Point3D from = Caster.Location;
            Point3D to   = new Point3D(p);

            if (Sigil.ExistsOn(Caster))
            {
                Caster.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil.
            }
            else if (WeightOverloading.IsOverloaded(Caster))
            {
                Caster.SendLocalizedMessage(502359, "", 0x22); // Thou art too encumbered to move.
            }
            else if (!SpellHelper.CheckTravel(Caster, TravelCheckType.TeleportFrom))
            {
            }
            else if (!SpellHelper.CheckTravel(Caster, map, to, TravelCheckType.TeleportTo))
            {
            }
            else if (map?.CanSpawnMobile(p.X, p.Y, p.Z) != true)
            {
                Caster.SendLocalizedMessage(501942); // That location is blocked.
            }
            else if (SpellHelper.CheckMulti(to, map))
            {
                Caster.SendLocalizedMessage(502831); // Cannot teleport to that spot.
            }
            else if (Region.Find(to, map).IsPartOf <HouseRegion>())
            {
                Caster.SendLocalizedMessage(502829); // Cannot teleport to that spot.
            }
            else if (CheckSequence())
            {
                SpellHelper.Turn(Caster, orig);

                Mobile m = Caster;

                m.Location = to;
                m.ProcessDelta();

                if (m.Player)
                {
                    Effects.SendLocationParticles(EffectItem.Create(from, m.Map, EffectItem.DefaultDuration), 0x3728, 10, 10,
                                                  2023);
                    Effects.SendLocationParticles(EffectItem.Create(to, m.Map, EffectItem.DefaultDuration), 0x3728, 10, 10,
                                                  5023);
                }
                else
                {
                    m.FixedParticles(0x376A, 9, 32, 0x13AF, EffectLayer.Waist);
                }

                m.PlaySound(0x1FE);

                IPooledEnumerable <Item> eable = m.GetItemsInRange(0);

                foreach (Item item in eable)
                {
                    if (item is ParalyzeFieldSpell.InternalItem || item is PoisonFieldSpell.InternalItem ||
                        item is FireFieldSpell.FireFieldItem)
                    {
                        item.OnMoveOver(m);
                    }
                }

                eable.Free();
            }

            FinishSequence();
        }
예제 #2
0
        public void Effect(Point3D loc, Map map, bool checkMulti, bool isboatkey = false)
        {
            if (Factions.Sigil.ExistsOn(this.Caster))
            {
                this.Caster.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil.
            }
            else if (map == null || (!Core.AOS && this.Caster.Map != map))
            {
                this.Caster.SendLocalizedMessage(1005570); // You can not gate to another facet.
            }
            else if (!SpellHelper.CheckTravel(this.Caster, TravelCheckType.GateFrom))
            {
            }
            else if (!SpellHelper.CheckTravel(this.Caster, map, loc, TravelCheckType.GateTo))
            {
            }
            else if (map == Map.Felucca && this.Caster is PlayerMobile && ((PlayerMobile)this.Caster).Young)
            {
                this.Caster.SendLocalizedMessage(1049543); // You decide against traveling to Felucca while you are still young.
            }
            else if (this.Caster.Murderer && map.Rules != MapRules.FeluccaRules && !Siege.SiegeShard)
            {
                this.Caster.SendLocalizedMessage(1019004); // You are not allowed to travel there.
            }
            else if (this.Caster.Criminal)
            {
                this.Caster.SendLocalizedMessage(1005561, "", 0x22); // Thou'rt a criminal and cannot escape so easily.
            }
            else if (SpellHelper.CheckCombat(this.Caster))
            {
                this.Caster.SendLocalizedMessage(1005564, "", 0x22); // Wouldst thou flee during the heat of battle??
            }
            else if (!map.CanSpawnMobile(loc.X, loc.Y, loc.Z) && !isboatkey)
            {
                this.Caster.SendLocalizedMessage(501942); // That location is blocked.
            }
            else if ((checkMulti && SpellHelper.CheckMulti(loc, map)) && !isboatkey)
            {
                this.Caster.SendLocalizedMessage(501942);                                                                  // That location is blocked.
            }
            else if (Core.SE && (this.GateExistsAt(map, loc) || this.GateExistsAt(this.Caster.Map, this.Caster.Location))) // SE restricted stacking gates
            {
                this.Caster.SendLocalizedMessage(1071242);                                                                 // There is already a gate there.
            }
            else if (Server.Engines.CityLoyalty.CityTradeSystem.HasTrade(Caster))
            {
                Caster.SendLocalizedMessage(1151733); // You cannot do that while carrying a Trade Order.
            }
            else if (this.CheckSequence())
            {
                Timer.DelayCall(TimeSpan.FromSeconds(1), () =>
                {
                    Caster.SendLocalizedMessage(501024); // You open a magical gate to another location

                    Effects.PlaySound(this.Caster.Location, this.Caster.Map, 0x20E);

                    InternalItem firstGate = new InternalItem(loc, map);
                    firstGate.MoveToWorld(this.Caster.Location, this.Caster.Map);

                    Effects.PlaySound(loc, map, 0x20E);

                    InternalItem secondGate = new InternalItem(this.Caster.Location, this.Caster.Map);
                    secondGate.MoveToWorld(loc, map);

                    firstGate.LinkedGate  = secondGate;
                    secondGate.LinkedGate = firstGate;

                    firstGate.BoatGate  = BaseBoat.FindBoatAt(firstGate, firstGate.Map) != null;
                    secondGate.BoatGate = BaseBoat.FindBoatAt(secondGate, secondGate.Map) != null;
                });
            }

            this.FinishSequence();
        }
예제 #3
0
        protected virtual bool ProcessTarget()
        {
            Target targ = m_Mobile.Target;

            if (targ == null)
            {
                return(false);
            }

            bool isDispel      = (targ is DispelSpell.InternalTarget || targ is MassDispelSpell.InternalTarget);
            bool isParalyze    = (targ is ParalyzeSpell.InternalTarget);
            bool isTeleport    = (targ is TeleportSpell.InternalTarget);
            bool isSummon      = (targ is EnergyVortexSpell.InternalTarget || targ is BladeSpiritsSpell.InternalTarget || targ is NatureFurySpell.InternalTarget);
            bool isField       = (targ is FireFieldSpell.InternalTarget || targ is PoisonFieldSpell.InternalTarget || targ is ParalyzeFieldSpell.InternalTarget);
            bool isAnimate     = (targ is AnimateDeadSpell.InternalTarget);
            bool isDispelField = (targ is DispelFieldSpell.InternalTarget);
            bool teleportAway  = false;
            bool harmful       = (targ.Flags & TargetFlags.Harmful) != 0 || targ is HailStormSpell.InternalTarget || targ is WildfireSpell.InternalTarget;
            bool beneficial    = (targ.Flags & TargetFlags.Beneficial) != 0 || targ is ArchCureSpell.InternalTarget;

            if (isTeleport && m_Mobile.CanSwim)
            {
                targ.Cancel(m_Mobile, TargetCancelType.Canceled);
            }

            IDamageable toTarget = null;

            if (isDispel)
            {
                toTarget = FindDispelTarget(false);

                if (toTarget != null)
                {
                    RunTo(toTarget);
                }
            }
            else if (isDispelField)
            {
                Item field = GetHarmfulFieldItem();

                if (field != null)
                {
                    targ.Invoke(m_Mobile, field);
                }
                else
                {
                    targ.Cancel(m_Mobile, TargetCancelType.Canceled);
                }
            }
            else if (SmartAI && (isParalyze || isTeleport))
            {
                toTarget = FindDispelTarget(true);

                if (toTarget == null)
                {
                    toTarget = m_Mobile.Combatant as Mobile;

                    if (toTarget != null)
                    {
                        RunTo(toTarget);
                    }
                }
                else if (m_Mobile.InRange(toTarget, 10))
                {
                    RunFrom(toTarget);
                    teleportAway = true;
                }
                else
                {
                    teleportAway = true;
                }
            }
            else if (isAnimate)
            {
                Item corpse = FindCorpseToAnimate();

                if (corpse != null)
                {
                    targ.Invoke(m_Mobile, corpse);
                }
            }
            else
            {
                toTarget = m_Mobile.Combatant;

                if (toTarget != null)
                {
                    RunTo(toTarget);
                }
            }

            if (isSummon && toTarget != null)
            {
                int failSafe = 0;
                Map map      = toTarget.Map;

                while (failSafe <= 25)
                {
                    int x = Utility.RandomMinMax(toTarget.X - 2, toTarget.X + 2);
                    int y = Utility.RandomMinMax(toTarget.Y - 2, toTarget.Y + 2);
                    int z = toTarget.Z;

                    LandTarget lt = new LandTarget(new Point3D(x, y, z), map);

                    if (map.CanSpawnMobile(x, y, z))
                    {
                        targ.Invoke(m_Mobile, lt);
                        break;
                    }

                    failSafe++;
                }
            }
            else if (isField && toTarget != null)
            {
                Map map = toTarget.Map;

                int x = m_Mobile.X;
                int y = m_Mobile.Y;
                int z = m_Mobile.Z;

                if (toTarget == null || m_Mobile.InRange(toTarget.Location, 3))
                {
                    targ.Invoke(m_Mobile, toTarget);
                    return(true);
                }

                Direction d    = Utility.GetDirection(m_Mobile, toTarget);
                int       dist = (int)m_Mobile.GetDistanceToSqrt(toTarget.Location) / 2;
                Point3D   p    = m_Mobile.Location;

                switch ((int)d)
                {
                case (int)Direction.Running:
                case (int)Direction.North:
                    y = p.Y - dist;
                    break;

                case 129:
                case (int)Direction.Right:
                    x = p.X + dist;
                    y = p.Y - dist;
                    break;

                case 130:
                case (int)Direction.East:
                    x = p.X + dist;
                    break;

                case 131:
                case (int)Direction.Down:
                    x = p.X + dist;
                    y = p.Y + dist;
                    break;

                case 132:
                case (int)Direction.South:
                    y = p.Y + dist;
                    break;

                case 133:
                case (int)Direction.Left:
                    x = p.X - dist;
                    y = p.Y + dist;
                    break;

                case 134:
                case (int)Direction.West:
                    x = p.X - dist;
                    break;

                case (int)Direction.ValueMask:
                case (int)Direction.Up:
                    x = p.X - dist;
                    y = p.Y - dist;
                    break;
                }

                LandTarget lt = new LandTarget(new Point3D(x, y, z), map);
                targ.Invoke(m_Mobile, lt);
            }

            if (harmful && toTarget != null)
            {
                if ((targ.Range == -1 || m_Mobile.InRange(toTarget, targ.Range)) && m_Mobile.CanSee(toTarget) && m_Mobile.InLOS(toTarget))
                {
                    targ.Invoke(m_Mobile, toTarget);
                }
                else if (isDispel)
                {
                    targ.Cancel(m_Mobile, TargetCancelType.Canceled);
                }
            }
            else if (beneficial)
            {
                targ.Invoke(m_Mobile, m_Mobile);
            }
            else if (isTeleport && toTarget != null)
            {
                Map map = m_Mobile.Map;

                if (map == null)
                {
                    targ.Cancel(m_Mobile, TargetCancelType.Canceled);
                    return(true);
                }

                int px, py;

                if (teleportAway)
                {
                    int rx = m_Mobile.X - toTarget.X;
                    int ry = m_Mobile.Y - toTarget.Y;

                    double d = m_Mobile.GetDistanceToSqrt(toTarget);

                    px = toTarget.X + (int)(rx * (10 / d));
                    py = toTarget.Y + (int)(ry * (10 / d));
                }
                else
                {
                    px = toTarget.X;
                    py = toTarget.Y;
                }

                for (int i = 0; i < m_Offsets.Length; i += 2)
                {
                    int x = m_Offsets[i], y = m_Offsets[i + 1];

                    Point3D p = new Point3D(px + x, py + y, 0);

                    LandTarget lt = new LandTarget(p, map);

                    if ((targ.Range == -1 || m_Mobile.InRange(p, targ.Range)) && m_Mobile.InLOS(lt) && map.CanSpawnMobile(px + x, py + y, lt.Z) && !SpellHelper.CheckMulti(p, map))
                    {
                        targ.Invoke(m_Mobile, lt);
                        return(true);
                    }
                }

                int teleRange = targ.Range;

                if (teleRange < 0)
                {
                    teleRange = Core.ML ? 11 : 12;
                }

                for (int i = 0; i < 10; ++i)
                {
                    Point3D randomPoint = new Point3D(m_Mobile.X - teleRange + Utility.Random(teleRange * 2 + 1), m_Mobile.Y - teleRange + Utility.Random(teleRange * 2 + 1), 0);

                    LandTarget lt = new LandTarget(randomPoint, map);

                    if (m_Mobile.InLOS(lt) && map.CanSpawnMobile(lt.X, lt.Y, lt.Z) && !SpellHelper.CheckMulti(randomPoint, map))
                    {
                        targ.Invoke(m_Mobile, new LandTarget(randomPoint, map));
                        return(true);
                    }
                }

                targ.Cancel(m_Mobile, TargetCancelType.Canceled);
            }
            else
            {
                targ.Cancel(m_Mobile, TargetCancelType.Canceled);
            }

            return(true);
        }
예제 #4
0
        private bool ProcessTarget()
        {
            Target targ = m_Mobile.Target;

            if (targ == null)
            {
                return(false);
            }

            bool isReveal     = (targ is RevealSpell.InternalTarget);
            bool isDispel     = (targ is DispelSpell.InternalTarget);
            bool isParalyze   = (targ is ParalyzeSpell.InternalTarget);
            bool isTeleport   = (targ is TeleportSpell.InternalTarget);
            bool isInvisible  = (targ is InvisibilitySpell.InternalTarget);
            bool teleportAway = false;

            Mobile toTarget;

            if (isInvisible)
            {
                toTarget = m_Mobile;
            }
            else if (isDispel)
            {
                toTarget = FindDispelTarget(false);

                if (!SmartAI && toTarget != null)
                {
                    RunTo(toTarget);
                }
                else if (toTarget != null && m_Mobile.InRange(toTarget, 10))
                {
                    RunFrom(toTarget);
                }
            }
            else if (SmartAI && (isParalyze || isTeleport))
            {
                toTarget = FindDispelTarget(true);

                if (toTarget == null)
                {
                    toTarget = m_Mobile.Combatant;

                    if (toTarget != null)
                    {
                        RunTo(toTarget);
                    }
                }
                else if (m_Mobile.InRange(toTarget, 10))
                {
                    RunFrom(toTarget);
                    teleportAway = true;
                }
                else
                {
                    teleportAway = true;
                }
            }
            else
            {
                toTarget = m_Mobile.Combatant;

                if (toTarget != null)
                {
                    RunTo(toTarget);
                }
            }

            if ((targ.Flags & TargetFlags.Harmful) != 0 && toTarget != null)
            {
                if ((targ.Range == -1 || m_Mobile.InRange(toTarget, targ.Range)) && m_Mobile.CanSee(toTarget) && m_Mobile.InLOS(toTarget))
                {
                    targ.Invoke(m_Mobile, toTarget);
                }
                else if (isDispel)
                {
                    targ.Cancel(m_Mobile, TargetCancelType.Canceled);
                }
            }
            else if ((targ.Flags & TargetFlags.Beneficial) != 0)
            {
                targ.Invoke(m_Mobile, m_Mobile);
            }
            else if (isReveal && m_RevealTarget != null)
            {
                targ.Invoke(m_Mobile, m_RevealTarget);
            }
            else if (isTeleport && toTarget != null)
            {
                Map map = m_Mobile.Map;

                if (map == null)
                {
                    targ.Cancel(m_Mobile, TargetCancelType.Canceled);
                    return(true);
                }

                int px, py;

                if (teleportAway)
                {
                    int rx = m_Mobile.X - toTarget.X;
                    int ry = m_Mobile.Y - toTarget.Y;

                    double d = m_Mobile.GetDistanceToSqrt(toTarget);

                    px = toTarget.X + (int)(rx * (10 / d));
                    py = toTarget.Y + (int)(ry * (10 / d));
                }
                else
                {
                    px = toTarget.X;
                    py = toTarget.Y;
                }

                for (int i = 0; i < m_Offsets.Length; i += 2)
                {
                    int x = m_Offsets[i], y = m_Offsets[i + 1];

                    Point3D p = new Point3D(px + x, py + y, 0);

                    LandTarget lt = new LandTarget(p, map);

                    if ((targ.Range == -1 || m_Mobile.InRange(p, targ.Range)) && m_Mobile.InLOS(lt) && map.CanSpawnMobile(px + x, py + y, lt.Z) && !SpellHelper.CheckMulti(p, map))
                    {
                        targ.Invoke(m_Mobile, lt);
                        return(true);
                    }
                }

                int teleRange = targ.Range;

                if (teleRange < 0)
                {
                    teleRange = 12;
                }

                for (int i = 0; i < 10; ++i)
                {
                    Point3D randomPoint = new Point3D(m_Mobile.X - teleRange + Utility.Random(teleRange * 2 + 1), m_Mobile.Y - teleRange + Utility.Random(teleRange * 2 + 1), 0);

                    LandTarget lt = new LandTarget(randomPoint, map);

                    if (m_Mobile.InLOS(lt) && map.CanSpawnMobile(lt.X, lt.Y, lt.Z) && !SpellHelper.CheckMulti(randomPoint, map))
                    {
                        targ.Invoke(m_Mobile, new LandTarget(randomPoint, map));
                        return(true);
                    }
                }

                targ.Cancel(m_Mobile, TargetCancelType.Canceled);
            }
            else
            {
                targ.Cancel(m_Mobile, TargetCancelType.Canceled);
            }

            return(true);
        }
예제 #5
0
        public void EndHeal()
        {
            StopHeal();

            int  healerNumber = -1, patientNumber = -1;
            bool playSound   = true;
            bool checkSkills = false;

            SkillName primarySkill   = GetPrimarySkill(m_Patient);
            SkillName secondarySkill = GetSecondarySkill(m_Patient);

            BaseCreature petPatient = m_Patient as BaseCreature;

            bool   healDamage        = true;
            bool   healThroughPoison = true;
            double BandageHealThroughPoisonScalar = SpellHelper.HealThroughPoisonScalar;

            int effectHue = 0;

            DungeonArmor.PlayerDungeonArmorProfile bandagerDungeonArmor = new DungeonArmor.PlayerDungeonArmorProfile(m_Healer, null);

            if (bandagerDungeonArmor.MatchingSet && !bandagerDungeonArmor.InPlayerCombat)
            {
                BandageHealThroughPoisonScalar += bandagerDungeonArmor.DungeonArmorDetail.BandageHealThroughPoisonScalar;
                effectHue = bandagerDungeonArmor.DungeonArmorDetail.EffectHue;
            }

            if (!m_Healer.Alive)
            {
                healDamage = false;

                healerNumber  = 500962; // You were unable to finish your work before you died.
                patientNumber = -1;
                playSound     = false;
            }

            else if (Engines.ConPVP.DuelContext.CheckSuddenDeath(m_Patient))
            {
                healDamage = false;

                m_Healer.SendMessage(0x22, "You cannot use this item when in sudden death.");

                return;
            }

            else if (m_Patient.Hidden && m_Patient != m_Healer)
            {
                healDamage = false;

                m_Healer.SendMessage("You can no longer see your patient.");

                return;
            }

            else if (!m_Healer.InRange(m_Patient, Bandage.Range))
            {
                healDamage = false;

                healerNumber  = 500963; // You did not stay close enough to heal your target.
                patientNumber = -1;
                playSound     = false;
            }

            else if ((SpellHelper.CheckMulti(m_Healer.Location, m_Healer.Map) || SpellHelper.CheckMulti(m_Patient.Location, m_Patient.Map)) && !m_Healer.InLOS(m_Patient))
            {
                healDamage = false;

                healerNumber  = 500963; // You did not stay close enough to heal your target.
                patientNumber = -1;
                playSound     = false;
            }

            else if (!m_Patient.Alive || (petPatient != null && petPatient.IsDeadPet))
            {
                healDamage = false;

                double healing = m_Healer.Skills[primarySkill].Value;
                double anatomy = m_Healer.Skills[secondarySkill].Value;
                double chance  = ((healing - 68.0) / 50.0) - (m_Slips * 0.02);

                if (((checkSkills = (healing >= 80.0 && anatomy >= 80.0)) && chance > Utility.RandomDouble()) ||
                    (Core.SE && petPatient.ControlMaster == m_Healer))          //TODO: Dbl check doesn't check for faction of the horse here?
                {
                    if (m_Patient.Map == null || !m_Patient.Map.CanFit(m_Patient.Location, 16, false, false))
                    {
                        healerNumber  = 501042; // Target can not be resurrected at that location.
                        patientNumber = 502391; // Thou can not be resurrected there!
                    }

                    else
                    {
                        healerNumber  = 500965; // You are able to resurrect your patient.
                        patientNumber = -1;

                        m_Patient.PlaySound(0x214);
                        m_Patient.FixedEffect(0x376A, 10, 16);

                        if (petPatient != null && petPatient.IsDeadPet)
                        {
                            Mobile master = petPatient.ControlMaster;

                            /*
                             * if (!petPatient.CanBeResurrectedThroughVeterinary)
                             * {
                             *  m_Healer.SendMessage("Another item is required to resurrect this creature");
                             *  healerNumber = 500966; // You are unable to resurrect your patient.
                             * }
                             * */

                            if (master != null && master.InRange(petPatient, 3))
                            {
                                healerNumber = 503255; // You are able to resurrect the creature.

                                master.CloseGump(typeof(PetResurrectGump));
                                master.SendGump(new PetResurrectGump(m_Healer, petPatient));
                            }

                            else
                            {
                                bool found = false;

                                if (!found)
                                {
                                    healerNumber = 1049670; // The pet's owner must be nearby to attempt resurrection.
                                }
                            }
                        }

                        else
                        {
                            m_Patient.CloseGump(typeof(ResurrectGump));
                            m_Patient.SendGump(new ResurrectGump(m_Patient, m_Healer));
                        }
                    }
                }

                else
                {
                    if (petPatient != null && petPatient.IsDeadPet)
                    {
                        healerNumber = 503256; // You fail to resurrect the creature.
                    }
                    else
                    {
                        healerNumber = 500966; // You are unable to resurrect your patient.
                    }
                    patientNumber = -1;
                }
            }

            else if (m_Patient.Poisoned)
            {
                healDamage = false;

                m_Healer.SendLocalizedMessage(500969); // You finish applying the bandages.

                double healing = m_Healer.Skills[primarySkill].Value;
                double anatomy = m_Healer.Skills[secondarySkill].Value;
                double chance  = ((healing - 30.0) / 50.0) - (m_Patient.Poison.Level * 0.05) - (m_Slips * 0.02);

                if ((checkSkills = (healing >= 60.0 && anatomy >= 60.0)) && chance > Utility.RandomDouble())
                {
                    if (m_Patient.CurePoison(m_Healer))
                    {
                        healerNumber  = (m_Healer == m_Patient) ? -1 : 1010058; // You have cured the target of all poisons.
                        patientNumber = 1010059;                                // You have been cured of all poisons.
                    }

                    else
                    {
                        healerNumber  = -1;
                        patientNumber = -1;
                    }
                }

                else
                {
                    healerNumber  = 1010060; // You have failed to cure your target!
                    patientNumber = -1;
                }
            }

            else if (m_Patient.Hits == m_Patient.HitsMax)
            {
                healDamage = false;

                healerNumber  = 500967; // You heal what little damage your patient had.
                patientNumber = -1;
            }

            if (healDamage)
            {
                checkSkills   = true;
                patientNumber = -1;

                double healing = m_Healer.Skills[primarySkill].Value;
                double anatomy = m_Healer.Skills[secondarySkill].Value;
                double chance  = ((healing + 20.0) / 100.0) - (m_Slips * 0.02);

                if (chance >= Utility.RandomDouble())
                {
                    healerNumber = 500969; // You finish applying the bandages.

                    double min, max;

                    if (Core.AOS)
                    {
                        min = (anatomy / 8.0) + (healing / 5.0) + 4.0;
                        max = (anatomy / 6.0) + (healing / 2.5) + 4.0;
                    }
                    else
                    {
                        min = (anatomy / 5.0) + (healing / 5.0) + 3.0;
                        max = (anatomy / 5.0) + (healing / 2.0) + 10.0;
                    }

                    double toHeal = min + (Utility.RandomDouble() * (max - min));

                    if (m_Patient.Body.IsMonster || m_Patient.Body.IsAnimal)
                    {
                        toHeal += m_Patient.HitsMax / 100;
                    }

                    toHeal -= m_Slips * 2.5;

                    if (healThroughPoison)
                    {
                        toHeal *= BandageHealThroughPoisonScalar;
                    }

                    PlayerMobile playerHealer = m_Healer as PlayerMobile;

                    if (playerHealer != null)
                    {
                        if (UOACZSystem.IsUOACZValidMobile(playerHealer))
                        {
                            if (playerHealer.IsUOACZHuman)
                            {
                                toHeal += 20;
                            }
                        }

                        double superiorHealing = playerHealer.GetSpecialAbilityEntryValue(SpecialAbilityEffect.SuperiorHealing);

                        if (superiorHealing > 0)
                        {
                            toHeal *= superiorHealing;
                        }
                    }

                    if (toHeal < 1)
                    {
                        toHeal       = 1;
                        healerNumber = 500968; // You apply the bandages, but they barely help.
                    }

                    int finalHeal = (int)toHeal;

                    m_Patient.Heal(finalHeal, m_Healer, false);
                }

                else
                {
                    healerNumber = 500968; // You apply the bandages, but they barely help.
                    playSound    = false;
                }
            }

            if (healerNumber != -1)
            {
                m_Healer.SendLocalizedMessage(healerNumber);
            }

            if (patientNumber != -1)
            {
                m_Patient.SendLocalizedMessage(patientNumber);
            }

            if (healThroughPoison)
            {
                Effects.PlaySound(m_Healer.Location, m_Healer.Map, 0x64B);
                Effects.SendLocationParticles(EffectItem.Create(m_Healer.Location, m_Healer.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, effectHue, 0, 5005, 0);
            }

            if (playSound)
            {
                m_Patient.PlaySound(0x57);
            }

            if (checkSkills)
            {
                m_Healer.CheckSkill(secondarySkill, 0.0, 120.0, 1.0);
                m_Healer.CheckSkill(primarySkill, 0.0, 120.0, 1.0);
            }
        }
예제 #6
0
파일: Mark.cs 프로젝트: Pumpk1ns/outlands
        public void Target(RecallRune rune)
        {
            // IPY : Protection for DungeonMiningSystem.
            if (Caster.Map == Map.Ilshenar)
            {
                Caster.SendLocalizedMessage(501802); // Thy spell doth not appear to work...
                return;
            }

            WarpBlockerTotem recallBlocker = WarpBlockerTotem.RecallBlockerTriggered(Caster, WarpBlockerTotem.MovementMode.Mark, Caster.Location, Caster.Map);

            if (recallBlocker != null)
            {
                if (recallBlocker.PreventMarkResponse != "")
                {
                    Caster.SendMessage(recallBlocker.PreventMarkResponse);
                }
                else
                {
                    Caster.SendMessage(WarpBlockerTotem.DefaultMarkResponse);
                }
            }

            else if (!Caster.CanSee(rune))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }

            else if (!SpellHelper.CheckTravel(Caster, TravelCheckType.Mark))
            {
                Caster.SendLocalizedMessage(501802); // Thy spell doth not appear to work...
            }

            else if (Caster.Map != Map.Felucca)
            {
                Caster.SendLocalizedMessage(501802); // Thy spell doth not appear to work...
            }

            else if (SpellHelper.CheckMulti(Caster.Location, Caster.Map))
            {
                Caster.SendLocalizedMessage(501942); // That location is blocked.
            }

            else if (SpellHelper.IsSolenHiveLoc(Caster.Location))
            {
                Caster.SendLocalizedMessage(501802); // Thy spell doth not appear to work...
            }

            else if (SpellHelper.IsStarRoom(Caster.Location))
            {
                Caster.SendLocalizedMessage(501802); // Thy spell doth not appear to work...
            }

            else if (SpellHelper.IsWindLoc(Caster.Location))
            {
                Caster.SendLocalizedMessage(501802); // Thy spell doth not appear to work...
            }

            else if (BaseBoat.FindBoatAt(Caster.Location, Caster.Map) != null)
            {
                Caster.SendMessage("You cannot mark a location at sea.");
            }

            else if (CheckSequence())
            {
                rune.Mark(Caster);

                int spellHue = 0; // PlayerEnhancementPersistance.GetSpellHueFor(Caster, HueableSpell.Mark);

                Caster.PlaySound(0x1FA);
                Effects.SendLocationEffect(Caster, Caster.Map, 14201, 16, spellHue, 0);
            }

            FinishSequence();
        }
예제 #7
0
        public void Effect(Point3D loc, Map map, bool checkMulti)
        {
            //if (Factions.Sigil.ExistsOn(Caster))
            //{
            //    Caster.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil.
            //}
            if (map == null || (!Core.AOS && Caster.Map != map))
            {
                Caster.SendLocalizedMessage(1005569); // You can not recall to another facet.
            }
            else if (!SpellHelper.CheckTravel(Caster, TravelCheckType.RecallFrom))
            {
            }
            else if (!SpellHelper.CheckTravel(Caster, map, loc, TravelCheckType.RecallTo))
            {
            }
            //else if (map == Map.Felucca && Caster is PlayerMobile && ((PlayerMobile)Caster).Young)
            //{
            //    Caster.SendLocalizedMessage(1049543); // You decide against traveling to Felucca while you are still young.
            //}
            else if (Caster.Kills >= 5 && map != Map.Felucca)
            {
                Caster.SendLocalizedMessage(1019004); // You are not allowed to travel there.
            }
            else if (Caster.Criminal)
            {
                Caster.SendLocalizedMessage(1005561, "", 0x22); // Thou'rt a criminal and cannot escape so easily.
            }
            else if (SpellHelper.CheckCombat(Caster))
            {
                Caster.SendLocalizedMessage(1005564, "", 0x22); // Wouldst thou flee during the heat of battle??
            }
            else if (Server.Misc.WeightOverloading.IsOverloaded(Caster))
            {
                Caster.SendLocalizedMessage(502359, "", 0x22); // Thou art too encumbered to move.
            }
            else if (!map.CanSpawnMobile(loc.X, loc.Y, loc.Z))
            {
                Caster.SendLocalizedMessage(501942); // That location is blocked.
            }
            else if ((checkMulti && SpellHelper.CheckMulti(loc, map)))
            {
                Caster.SendLocalizedMessage(501942); // That location is blocked.
            }
            else if (m_Book != null && m_Book.CurCharges <= 0)
            {
                Caster.SendLocalizedMessage(502412); // There are no charges left on that item.
            }
            else if (CheckSequence())
            {
                BaseCreature.TeleportPets(Caster, loc, map, true);

                if (m_Book != null)
                {
                    --m_Book.CurCharges;
                }

                Caster.PlaySound(0x1FC);
                Caster.MoveToWorld(loc, map);
                Caster.PlaySound(0x1FC);
            }

            FinishSequence();
        }
예제 #8
0
        public void Effect(Point3D loc, Map map, bool checkMulti)
        {
            if (Factions.Sigil.ExistsOn(this.Caster))
            {
                this.Caster.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil.
            }
            else if (map == null || (!Core.AOS && this.Caster.Map != map))
            {
                this.Caster.SendLocalizedMessage(1005569); // You can not recall to another facet.
            }
            else if (!SpellHelper.CheckTravel(this.Caster, TravelCheckType.RecallFrom))
            {
            }
            else if (!SpellHelper.CheckTravel(this.Caster, map, loc, TravelCheckType.RecallTo))
            {
            }
            else if (map == Map.Felucca && this.Caster is PlayerMobile && ((PlayerMobile)this.Caster).Young)
            {
                this.Caster.SendLocalizedMessage(1049543); // You decide against traveling to Felucca while you are still young.
            }
            else if (this.Caster.Kills >= 5 && map != Map.Felucca)
            {
                this.Caster.SendLocalizedMessage(1019004); // You are not allowed to travel there.
            }
            else if (this.Caster.Criminal)
            {
                this.Caster.SendLocalizedMessage(1005561, "", 0x22); // Thou'rt a criminal and cannot escape so easily.
            }
            else if (SpellHelper.CheckCombat(this.Caster))
            {
                this.Caster.SendLocalizedMessage(1061282); // You cannot use the Sacred Journey ability to flee from combat.
            }
            else if (Server.Misc.WeightOverloading.IsOverloaded(this.Caster))
            {
                this.Caster.SendLocalizedMessage(502359, "", 0x22); // Thou art too encumbered to move.
            }
            else if (!map.CanSpawnMobile(loc.X, loc.Y, loc.Z))
            {
                this.Caster.SendLocalizedMessage(501942); // That location is blocked.
            }
            else if ((checkMulti && SpellHelper.CheckMulti(loc, map)))
            {
                this.Caster.SendLocalizedMessage(501942); // That location is blocked.
            }
            else if (this.m_Book != null && this.m_Book.CurCharges <= 0)
            {
                this.Caster.SendLocalizedMessage(502412); // There are no charges left on that item.
            }
            else if (this.CheckSequence())
            {
                BaseCreature.TeleportPets(this.Caster, loc, map, true);

                if (this.m_Book != null)
                {
                    --this.m_Book.CurCharges;
                }

                Effects.SendLocationParticles(EffectItem.Create(this.Caster.Location, this.Caster.Map, EffectItem.DefaultDuration), 0, 0, 0, 5033);

                this.Caster.PlaySound(0x1FC);
                this.Caster.MoveToWorld(loc, map);
                this.Caster.PlaySound(0x1FC);
            }

            this.FinishSequence();
        }
예제 #9
0
        public void Effect(Point3D loc, Map map, bool checkMulti)
        {
            PlayerMobile pm = Caster as PlayerMobile;

            BaseBoat boat = BaseBoat.FindBoatAt(loc, map);

            WarpBlockerTotem recallBlocker = WarpBlockerTotem.RecallBlockerTriggered(Caster, WarpBlockerTotem.MovementMode.RecallIn, loc, map);

            if (recallBlocker != null)
            {
                if (recallBlocker.PreventRecallInResponse != "")
                {
                    Caster.SendMessage(recallBlocker.PreventRecallInResponse);
                }
                else
                {
                    Caster.SendMessage(WarpBlockerTotem.DefaultRecallInResponse);
                }
            }

            else if (map == null || (!Core.AOS && Caster.Map != map))
            {
                Caster.SendLocalizedMessage(1005569);                   // You can not recall to another facet.
            }

            else if (!SpellHelper.CheckTravel(Caster, map, loc, TravelCheckType.RecallTo))
            {
                Caster.SendLocalizedMessage(501802); // Thy spell doth not appear to work...
            }

            else if (SpellHelper.IsAnyT2A(map, loc) && pm != null)
            {
            }

            else if (Server.Misc.WeightOverloading.IsOverloaded(Caster))
            {
                Caster.SendLocalizedMessage(502359, "", 0x22); // Thou art too encumbered to move.
            }

            else if (map != Map.Felucca)
            {
                Caster.SendLocalizedMessage(1019004); // You are not allowed to travel there.
            }

            else if (Caster.ShortTermMurders >= 5 && map != Map.Felucca)
            {
                Caster.SendLocalizedMessage(1019004); // You are not allowed to travel there.
            }

            else if (!SpellHelper.CheckIfOK(Caster.Map, loc.X, loc.Y, loc.Z))
            {
                Caster.SendLocalizedMessage(501942); // That location is blocked.
            }

            else if ((checkMulti && SpellHelper.CheckMulti(loc, map)))
            {
                Caster.SendLocalizedMessage(501942); // That location is blocked.
            }

            else if (SpellHelper.IsSolenHiveLoc(loc))
            {
                Caster.SendLocalizedMessage(1019004); // You are not allowed to travel there.
            }

            else if (SpellHelper.IsStarRoom(loc))
            {
                Caster.SendLocalizedMessage(1019004); // You are not allowed to travel there.
            }

            else if (SpellHelper.IsWindLoc(loc))
            {
                Caster.SendLocalizedMessage(1019004); // You are not allowed to travel there.
            }

            else if (boat != null && boat.Owner != Caster)
            {
                Caster.SendLocalizedMessage(1019004); // You are not allowed to travel there.
            }

            else if (m_Book != null && m_Book.CurCharges <= 0)
            {
                Caster.SendLocalizedMessage(502412); // There are no charges left on that item.
            }

            else if (CheckSequence())
            {
                if (m_Book != null)
                {
                    --m_Book.CurCharges;
                }

                var astralLeash = Caster.Backpack.FindItemByType <AstralLeash>();
                if (astralLeash != null && !astralLeash.Deleted && astralLeash.CanConsume() && Caster.Followers > 0)
                {
                    if (BaseCreature.TeleportPets(Caster, loc, map, false))
                    {
                        astralLeash.Consume();
                    }
                }

                Point3D sourceLocation = Caster.Location;
                Map     sourceMap      = Caster.Map;

                Point3D targetLocation = loc;
                Map     targetMap      = map;

                //Player Enhancement Customization: PhaseShift
                bool phaseShift = PlayerEnhancementPersistance.IsCustomizationEntryActive(Caster, CustomizationType.PhaseShift);

                if (phaseShift)
                {
                    Caster.MoveToWorld(loc, map);

                    Effects.PlaySound(sourceLocation, sourceMap, 0x1FC);
                    Effects.SendLocationEffect(sourceLocation, sourceMap, 0x3967, 30, 15, 2499, 0);

                    Effects.PlaySound(targetLocation, targetMap, 0x1FC);
                    Effects.SendLocationEffect(targetLocation, targetMap, 0x3967, 30, 15, 2499, 0);
                }

                else
                {
                    Caster.PlaySound(0x1FC);
                    Caster.MoveToWorld(loc, map);
                    Caster.PlaySound(0x1FC);
                }
            }

            FinishSequence();
        }
예제 #10
0
        public void Effect(Point3D loc, Map map, bool checkMulti)
        {
            if (Factions.Sigil.ExistsOn(Caster))
            {
                Caster.SendLocalizedMessage(1061632);                   // You can't do that while carrying the sigil.
            }
            else if (map == null || (!Core.AOS && Caster.Map != map))
            {
                Caster.SendLocalizedMessage(1005570);                   // You can not gate to another facet.
            }
            else if (!SpellHelper.CheckTravel(Caster, TravelCheckType.GateFrom))
            {
            }
            else if (!SpellHelper.CheckTravel(Caster, map, loc, TravelCheckType.GateTo))
            {
            }
            else if (map == Map.Felucca && Caster is PlayerMobile && ((PlayerMobile)Caster).Young)
            {
                Caster.SendLocalizedMessage(1049543);                   // You decide against traveling to Felucca while you are still young.
            }
            //else if ( Caster.Kills >= 5 && map != Map.Felucca )
            //{
            //    Caster.SendLocalizedMessage( 1019004 ); // You are not allowed to travel there.
            //}
            //else if ( Caster.Criminal )
            //{
            //    Caster.SendLocalizedMessage( 1005561, "", 0x22 ); // Thou'rt a criminal and cannot escape so easily.
            //}
            else if (SpellHelper.CheckCombat(Caster))
            {
                Caster.SendLocalizedMessage(1005564, "", 0x22);                   // Wouldst thou flee during the heat of battle??
            }
            else if (!map.CanSpawnMobile(loc.X, loc.Y, loc.Z))
            {
                Caster.SendLocalizedMessage(501942);                   // That location is blocked.
            }
            else if ((checkMulti && SpellHelper.CheckMulti(loc, map)))
            {
                Caster.SendLocalizedMessage(501942);                                                   // That location is blocked.
            }
            else if (Core.SE && (GateExistsAt(map, loc) || GateExistsAt(Caster.Map, Caster.Location))) // SE restricted stacking gates
            {
                Caster.SendLocalizedMessage(1071242);                                                  // There is already a gate there.
            }
            else if (CheckSequence())
            {
                Caster.SendLocalizedMessage(501024);                   // You open a magical gate to another location

                Effects.PlaySound(Caster.Location, Caster.Map, 0x20E);

                InternalItem firstGate = new InternalItem(loc, map);
                firstGate.MoveToWorld(Caster.Location, Caster.Map);

                Effects.PlaySound(loc, map, 0x20E);

                InternalItem secondGate = new InternalItem(Caster.Location, Caster.Map);
                secondGate.MoveToWorld(loc, map);
            }

            FinishSequence();
        }
예제 #11
0
        private void TryToTeleport()
        {
            Mobile m = FindNearestAggressor();

            if (m == null || m.Map == null || m_Mobile.Map == null)
            {
                return;
            }

            if (m_Mobile.GetDistanceToSqrt(m) > m_Mobile.RangePerception + 1)
            {
                return;
            }

            int px = m_Mobile.X;
            int py = m_Mobile.Y;

            int dx = m_Mobile.X - m.X;
            int dy = m_Mobile.Y - m.Y;

            // get vector's length

            double l = Math.Sqrt((dx * dx + dy * dy));

            if (l == 0)
            {
                int rand = Utility.Random(8) + 1;
                rand *= 2;
                dx    = m_Offsets[rand];
                dy    = m_Offsets[rand + 1];
                l     = Math.Sqrt((dx * dx + dy * dy));
            }

            // normalize vector
            double dpx = (dx) / l;
            double dpy = (dy) / l;

            // move
            px += (int)(dpx * (4 + Utility.Random(3)));
            py += (int)(dpy * (4 + Utility.Random(3)));

            for (int i = 0; i < m_Offsets.Length; i += 2)
            {
                int x = m_Offsets[i], y = m_Offsets[i + 1];

                Point3D p = new Point3D(px + x, py + y, 0);

                LandTarget lt = new LandTarget(p, m_Mobile.Map);

                if (m_Mobile.InLOS(lt) && m_Mobile.Map.CanSpawnMobile(px + x, py + y, lt.Z) &&
                    !SpellHelper.CheckMulti(p, m_Mobile.Map))
                {
                    m_Mobile.FixedParticles(0x376A, 9, 32, 0x13AF, EffectLayer.Waist);
                    m_Mobile.PlaySound(0x1FE);

                    m_Mobile.Location = new Point3D(lt.X, lt.Y, lt.Z);
                    m_Mobile.ProcessDelta();

                    return;
                }
            }

            return;
        }
예제 #12
0
        // Shadowjump
        private bool PerformShadowjump(Mobile toTarget)
        {
            if (m_Mobile.Skills[SkillName.Ninjitsu].Value < 50.0)
            {
                return(false);
            }

            if (toTarget != null)
            {
                Map map = m_Mobile.Map;

                if (map == null)
                {
                    return(false);
                }

                int px, py, ioffset = 0;

                px = toTarget.X;
                py = toTarget.Y;

                if (Action == ActionType.Flee)
                {
                    double outerradius  = m_Mobile.Skills[SkillName.Ninjitsu].Value / 10.0;
                    double radiusoffset = 2.0;
                    // random point for direction vector
                    int rpx = Utility.Random(40) - 20 + toTarget.X;
                    int rpy = Utility.Random(40) - 20 + toTarget.Y;
                    // get vector
                    int dx = rpx - toTarget.X;
                    int dy = rpy - toTarget.Y;
                    // get vector's length
                    double l = Math.Sqrt((double)(dx * dx + dy * dy));

                    if (l == 0)
                    {
                        return(false);
                    }
                    // normalize vector
                    double dpx = ((double)dx) / l;
                    double dpy = ((double)dy) / l;
                    // move
                    px += (int)(dpx * (outerradius - radiusoffset) + Math.Sign(dpx) * (radiusoffset + 0.5));
                    py += (int)(dpy * (outerradius - radiusoffset) + Math.Sign(dpy) * (radiusoffset + 0.5));
                }
                else
                {
                    ioffset = 2;
                }

                for (int i = ioffset; i < m_Offsets.Length; i += 2)
                {
                    int x = m_Offsets[i], y = m_Offsets[i + 1];

                    Point3D p = new Point3D(px + x, py + y, 0);

                    LandTarget lt = new LandTarget(p, map);

                    if (m_Mobile.InLOS(lt) && map.CanSpawnMobile(px + x, py + y, lt.Z) && !SpellHelper.CheckMulti(p, map))
                    {
                        m_Mobile.Location = new Point3D(lt.X, lt.Y, lt.Z);
                        m_Mobile.ProcessDelta();

                        return(true);
                    }
                }
            }

            return(false);
        }
예제 #13
0
        public void Target(IPoint3D p)
        {
            IPoint3D orig = p;
            Map      map  = Caster.Map;

            SpellHelper.GetSurfaceTop(ref p);

            if (Server.Misc.WeightOverloading.IsOverloaded(Caster))
            {
                Caster.SendLocalizedMessage(502359, "", 0x22); // Thou art too encumbered to move.
            }
            else if (!SpellHelper.CheckTravel(Caster, TravelCheckType.TeleportFrom))
            {
            }
            else if (!SpellHelper.CheckTravel(Caster, map, new Point3D(p), TravelCheckType.TeleportTo))
            {
            }
            else if (map == null || !map.CanSpawnMobile(p.X, p.Y, p.Z))
            {
                Caster.SendLocalizedMessage(501942); // That location is blocked.
            }
            else if (SpellHelper.CheckMulti(new Point3D(p), map))
            {
                Caster.SendLocalizedMessage(501942); // That location is blocked.
            }
            else if (CheckSequence())
            {
                SpellHelper.Turn(Caster, orig);

                Mobile m = Caster;

                Point3D from = m.Location;
                Point3D to   = new Point3D(p);
                m.Location = to;
                m.ProcessDelta();

                Effects.SendLocationEffect(new Point3D(from.X + 1, from.Y, from.Z + 4), m.Map, 0x3728, 13);
                Effects.SendLocationEffect(new Point3D(from.X + 1, from.Y, from.Z), m.Map, 0x3728, 13);
                Effects.SendLocationEffect(new Point3D(from.X + 1, from.Y, from.Z - 4), m.Map, 0x3728, 13);
                Effects.SendLocationEffect(new Point3D(from.X, from.Y + 1, from.Z + 4), m.Map, 0x3728, 13);
                Effects.SendLocationEffect(new Point3D(from.X, from.Y + 1, from.Z), m.Map, 0x3728, 13);
                Effects.SendLocationEffect(new Point3D(from.X, from.Y + 1, from.Z - 4), m.Map, 0x3728, 13);
                Effects.SendLocationEffect(new Point3D(from.X + 1, from.Y + 1, from.Z + 11), m.Map, 0x3728, 13);
                Effects.SendLocationEffect(new Point3D(from.X + 1, from.Y + 1, from.Z + 7), m.Map, 0x3728, 13);
                Effects.SendLocationEffect(new Point3D(from.X + 1, from.Y + 1, from.Z + 3), m.Map, 0x3728, 13);
                Effects.SendLocationEffect(new Point3D(from.X + 1, from.Y + 1, from.Z - 1), m.Map, 0x3728, 13);
                Effects.SendLocationEffect(new Point3D(from.X + 1, from.Y, from.Z + 4), m.Map, 0x3728, 13);



                Effects.SendLocationEffect(new Point3D(to.X + 1, to.Y, to.Z), m.Map, 0x3728, 13);
                Effects.SendLocationEffect(new Point3D(to.X + 1, to.Y, to.Z - 4), m.Map, 0x3728, 13);
                Effects.SendLocationEffect(new Point3D(to.X, to.Y + 1, to.Z + 4), m.Map, 0x3728, 13);
                Effects.SendLocationEffect(new Point3D(to.X, to.Y + 1, to.Z), m.Map, 0x3728, 13);
                Effects.SendLocationEffect(new Point3D(to.X, to.Y + 1, to.Z - 4), m.Map, 0x3728, 13);
                Effects.SendLocationEffect(new Point3D(to.X + 1, to.Y + 1, to.Z + 11), m.Map, 0x3728, 13);
                Effects.SendLocationEffect(new Point3D(to.X + 1, to.Y + 1, to.Z + 7), m.Map, 0x3728, 13);
                Effects.SendLocationEffect(new Point3D(to.X + 1, to.Y + 1, to.Z + 3), m.Map, 0x3728, 13);
                Effects.SendLocationEffect(new Point3D(to.X + 1, to.Y + 1, to.Z - 1), m.Map, 0x3728, 13);

                m.PlaySound(0x1FE);
            }

            FinishSequence();
        }
예제 #14
0
        public override void ProcessTarget(Target targ)
        {
            bool isDispel     = (targ is DispelSpell.InternalTarget);
            bool isParalyze   = (targ is ParalyzeSpell.InternalTarget);
            bool isTeleport   = (targ is TeleportSpell.InternalTarget);
            bool isCrossHeal  = (targ is GreaterHealSpell.InternalTarget);
            bool isTrap       = (targ is MagicTrapSpell.InternalTarget);
            bool teleportAway = false;
            bool isReveal     = (targ is RevealSpell.InternalTarget || targ is DetectHidden.InternalTarget);

            Mobile toTarget = null;
            Mobile toHeal   = null;

            if (isReveal)
            {
                targ.Invoke(m_Mobile, m_Mobile);
            }

            if (isTrap)
            {
                Pouch p = FindPouch(m_Mobile);
                if (p != null)
                {
                    targ.Invoke(m_Mobile, p);
                }
                else
                {
                    targ.Cancel(m_Mobile, TargetCancelType.Canceled);
                }
            }

            if (isDispel)
            {
                toTarget = FindDispelTarget(false);

                if (toTarget != null && m_Mobile.InRange(toTarget, 10) && !toTarget.Paralyzed)
                {
                    RunFrom(toTarget);
                }
            }

            if (CrossHeals && isCrossHeal)
            {
                toHeal = FindHealTarget(true);

                if (toHeal != null && !m_Mobile.InRange(toHeal, 8))
                {
                    RunTo(toHeal, CanRun);
                }
            }

            else if (isParalyze || isTeleport)
            {
                toTarget = FindDispelTarget(true);

                if (toTarget == null)
                {
                    toTarget = m_Mobile.Combatant;

                    if (toTarget != null && !m_Mobile.InRange(toTarget, 8))
                    {
                        RunTo(toTarget, CanRun);
                    }
                }
                else if (m_Mobile.InRange(toTarget, 10))
                {
                    RunFrom(toTarget);
                    teleportAway = true;
                }
                else
                {
                    teleportAway = true;
                }
            }

            else
            {
                if (m_Mobile.ControlOrder == OrderType.Come && isTeleport)
                {
                    toTarget = m_Mobile.ControlMaster;
                }
                else
                {
                    toTarget = m_Mobile.Combatant;
                }

                if (toTarget != null)
                {
                    RunTo(toTarget, CanRun);
                }
            }

            if ((targ.Flags & TargetFlags.Harmful) != 0 && toTarget != null)
            {
                if ((m_Mobile.InRange(toTarget, 10)) && m_Mobile.CanSee(toTarget) && m_Mobile.InLOS(toTarget))
                {
                    targ.Invoke(m_Mobile, toTarget);
                }
                else if (isDispel)
                {
                    targ.Cancel(m_Mobile, TargetCancelType.Canceled);
                }
            }

            else if ((targ.Flags & TargetFlags.Beneficial) != 0 && toHeal != null)
            {
                if ((m_Mobile.InRange(toHeal, 10)) && m_Mobile.CanSee(toHeal) && m_Mobile.InLOS(toHeal) && NeedGHeal(toHeal))
                {
                    targ.Invoke(m_Mobile, toHeal);
                }
                else
                {
                    Targeting.Target.Cancel(m_Mobile);
                }
            }

            else if ((targ.Flags & TargetFlags.Beneficial) != 0)
            {
                if (!isCrossHeal)
                {
                    targ.Invoke(m_Mobile, m_Mobile);
                }
                if ((isCrossHeal) && (NeedGHeal(m_Mobile)))
                {
                    targ.Invoke(m_Mobile, m_Mobile);
                }
                else
                {
                    targ.Cancel(m_Mobile, TargetCancelType.Canceled);
                }
            }
            else if (isTeleport && toTarget != null)
            {
                Map map = m_Mobile.Map;

                if (map == null)
                {
                    targ.Cancel(m_Mobile, TargetCancelType.Canceled);
                    return;
                }

                int px, py;

                if (teleportAway)
                {
                    int rx = m_Mobile.X - toTarget.X;
                    int ry = m_Mobile.Y - toTarget.Y;

                    double d = m_Mobile.GetDistanceToSqrt(toTarget);

                    px = toTarget.X + (int)(rx * (10 / d));
                    py = toTarget.Y + (int)(ry * (10 / d));
                }
                else
                {
                    px = toTarget.X;
                    py = toTarget.Y;
                }

                for (int i = 0; i < m_Offsets.Length; i += 2)
                {
                    int x = m_Offsets[i], y = m_Offsets[i + 1];

                    Point3D p = new Point3D(px + x, py + y, 0);

                    LandTarget lt = new LandTarget(p, map);

                    if ((targ.Range == -1 || m_Mobile.InRange(p, targ.Range)) && m_Mobile.InLOS(lt) && map.CanSpawnMobile(px + x, py + y, lt.Z) && !SpellHelper.CheckMulti(p, map))
                    {
                        targ.Invoke(m_Mobile, lt);
                        return;
                    }
                }

                int teleRange = targ.Range;

                if (teleRange < 0)
                {
                    teleRange = 12;
                }

                for (int i = 0; i < 10; ++i)
                {
                    Point3D randomPoint = new Point3D(m_Mobile.X - teleRange + Utility.Random(teleRange * 2 + 1), m_Mobile.Y - teleRange + Utility.Random(teleRange * 2 + 1), 0);

                    LandTarget lt = new LandTarget(randomPoint, map);

                    if (m_Mobile.InLOS(lt) && map.CanSpawnMobile(lt.X, lt.Y, lt.Z) && !SpellHelper.CheckMulti(randomPoint, map))
                    {
                        targ.Invoke(m_Mobile, new LandTarget(randomPoint, map));
                        return;
                    }
                }

                targ.Cancel(m_Mobile, TargetCancelType.Canceled);
            }
            else
            {
                targ.Cancel(m_Mobile, TargetCancelType.Canceled);
            }
        }
예제 #15
0
        public void Effect(Point3D loc, Map map, bool checkMulti)
        {
            if (map == null || (!Core.AOS && Caster.Map != map))
            {
                Caster.SendLocalizedMessage(1005570);                   // You can not gate to another facet.
            }
            else if (!SpellHelper.CheckTravel(Caster, TravelCheckType.GateFrom))
            {
            }
            else if (!SpellHelper.CheckTravel(Caster, map, loc, TravelCheckType.GateTo))
            {
            }
            else if (Caster.Kills >= 5 && map != Map.Felucca)
            {
                Caster.SendLocalizedMessage(1019004);                   // You are not allowed to travel there.
            }
            else if (Caster.Criminal)
            {
                Caster.SendLocalizedMessage(1005561, "", 0x22);                   // Thou'rt a criminal and cannot escape so easily.
            }
            else if (SpellHelper.CheckCombat(Caster))
            {
                Caster.SendLocalizedMessage(1005564, "", 0x22);                   // Wouldst thou flee during the heat of battle??
            }
            else if (!map.CanSpawnMobile(loc.X, loc.Y, loc.Z))
            {
                Caster.SendLocalizedMessage(501942);                   // That location is blocked.
            }
            else if ((checkMulti && SpellHelper.CheckMulti(loc, map)))
            {
                Caster.SendLocalizedMessage(501942);                   // That location is blocked.
            }
            else if (CheckSequence())
            {
                Caster.SendMessage("You open a spooky scarey portal in a graveyard circle");                   // You open a magical gate to another location

                Effects.PlaySound(Caster.Location, Caster.Map, 0x482);
                int gravx;
                int gravy;
                int gravz;


                InternalItem firstGatea = new InternalItem(loc, map);
                gravx             = Caster.X;
                gravy             = Caster.Y;
                gravz             = Caster.Z;
                firstGatea.ItemID = 0x1A0C;
                Point3D gravxyz = new Point3D(gravx, gravy, gravz);
                firstGatea.MoveToWorld(gravxyz, Caster.Map);
                InternalItem firstGateb = new InternalItem(loc, map);
                gravx             = Caster.X;
                gravy             = Caster.Y;
                firstGateb.ItemID = 0x373A;               //Moongate
                gravz             = Caster.Z + 1;
                Point3D gravxyza = new Point3D(gravx, gravy, gravz);
                firstGateb.MoveToWorld(gravxyza, Caster.Map);
                InternalItem firstGatec = new InternalItem(loc, map);
                gravx             = Caster.X - 1;
                firstGatec.ItemID = 0xEDD;
                gravy             = Caster.Y + 1;
                gravz             = Caster.Z;
                Point3D gravxyzb = new Point3D(gravx, gravy, gravz);
                firstGatec.MoveToWorld(gravxyzb, Caster.Map);
                InternalItem firstGated = new InternalItem(loc, map);
                firstGated.ItemID = 0x117B;
                gravx             = Caster.X;
                gravy             = Caster.Y + 2;
                gravz             = Caster.Z;
                Point3D gravxyzc = new Point3D(gravx, gravy, gravz);
                firstGated.MoveToWorld(gravxyzc, Caster.Map);
                InternalItem firstGatee = new InternalItem(loc, map);
                gravx             = Caster.X + 1;
                firstGatee.ItemID = 0x2203;
                gravy             = Caster.Y + 1;
                gravz             = Caster.Z;
                Point3D gravxyzd = new Point3D(gravx, gravy, gravz);
                firstGatee.MoveToWorld(gravxyzd, Caster.Map);
                InternalItem firstGatef = new InternalItem(loc, map);
                firstGatef.ItemID = 0x1178;
                gravx             = Caster.X + 2;
                gravy             = Caster.Y;
                gravz             = Caster.Z;
                Point3D gravxyze = new Point3D(gravx, gravy, gravz);
                firstGatef.MoveToWorld(gravxyze, Caster.Map);
                InternalItem firstGateg = new InternalItem(loc, map);
                gravx             = Caster.X + 1;
                firstGateg.ItemID = 0x1184;
                gravy             = Caster.Y - 1;
                gravz             = Caster.Z;
                Point3D gravxyzf = new Point3D(gravx, gravy, gravz);
                firstGateg.MoveToWorld(gravxyzf, Caster.Map);

                Effects.PlaySound(loc, map, 0x482);

                InternalItem secondGatea = new InternalItem(Caster.Location, Caster.Map);
                gravx = loc.X;
                gravy = loc.Y;
                gravz = loc.Z;
                secondGatea.ItemID = 0x1A0C;
                Point3D gravaxyz = new Point3D(gravx, gravy, gravz);
                secondGatea.MoveToWorld(gravaxyz, map);
                InternalItem secondGateb = new InternalItem(Caster.Location, Caster.Map);
                gravx = loc.X;
                gravy = loc.Y;
                secondGateb.ItemID = 0x373A;               //Moongate
                gravz = loc.Z + 1;
                Point3D gravaxyza = new Point3D(gravx, gravy, gravz);
                secondGateb.MoveToWorld(gravaxyza, map);
                InternalItem secondGatec = new InternalItem(Caster.Location, Caster.Map);
                gravx = loc.X - 1;
                secondGatec.ItemID = 0xEDD;
                gravy = loc.Y + 1;
                gravz = loc.Z - 1;
                Point3D gravaxyzb = new Point3D(gravx, gravy, gravz);
                secondGatec.MoveToWorld(gravaxyzb, map);
                InternalItem secondGated = new InternalItem(Caster.Location, Caster.Map);
                gravx = loc.X;
                gravy = loc.Y + 2;
                secondGated.ItemID = 0x117B;
                gravz = loc.Z;
                Point3D gravaxyzc = new Point3D(gravx, gravy, gravz);
                secondGated.MoveToWorld(gravaxyzc, map);
                InternalItem secondGatee = new InternalItem(Caster.Location, Caster.Map);
                gravx = loc.X + 1;
                gravy = loc.Y + 1;
                gravz = loc.Z;
                secondGatee.ItemID = 0x2203;
                Point3D gravaxyzd = new Point3D(gravx, gravy, gravz);
                secondGatee.MoveToWorld(gravaxyzd, map);
                InternalItem secondGatef = new InternalItem(Caster.Location, Caster.Map);
                gravx = loc.X + 2;
                gravy = loc.Y;
                gravz = loc.Z;
                secondGatef.ItemID = 0x1178;
                Point3D gravaxyze = new Point3D(gravx, gravy, gravz);
                secondGatef.MoveToWorld(gravaxyze, map);
                InternalItem secondGateg = new InternalItem(Caster.Location, Caster.Map);
                gravx = loc.X + 1;
                secondGateg.ItemID = 0x1184;
                gravy = loc.Y - 1;
                gravz = loc.Z;
                Point3D gravaxyzf = new Point3D(gravx, gravy, gravz);
                secondGateg.MoveToWorld(gravaxyzf, map);
            }

            FinishSequence();
        }