FindValidSpawnLocation() public static méthode

public static FindValidSpawnLocation ( Map map, Point3D &p, bool surroundingsOnly ) : bool
map Map
p Point3D
surroundingsOnly bool
Résultat bool
Exemple #1
0
        public static void Summon(BaseCreature creature, Mobile caster, int sound, TimeSpan duration, bool scaleDuration, bool scaleStats)
        {
            Map map = caster.Map;

            if (map == null)
            {
                return;
            }

            double scale = 1.0 + (caster.Skills[SkillName.Magery].Value - 100.0) / 200.0;

            if (scaleDuration)
            {
                duration = TimeSpan.FromSeconds(duration.TotalSeconds * scale);
            }

            if (scaleStats)
            {
                creature.RawStr = (int)(creature.RawStr * scale);
                creature.Hits   = creature.HitsMax;

                creature.RawDex = (int)(creature.RawDex * scale);
                creature.Stam   = creature.StamMax;

                creature.RawInt = (int)(creature.RawInt * scale);
                creature.Mana   = creature.ManaMax;
            }

            Point3D p = new Point3D(caster);

            if (SpellHelper.FindValidSpawnLocation(map, ref p, true))
            {
                BaseCreature.Summon(creature, caster, p, sound, duration);
                return;
            }


            creature.Delete();
            caster.SendLocalizedMessage(501942);               // That location is blocked.
        }
Exemple #2
0
        public static void Summon(BaseCreature creature, Mobile caster, int sound, TimeSpan duration, bool scaleDuration, bool scaleStats)
        {
            Map map = caster.Map;

            if (map == null)
            {
                return;
            }

            double scale = 1.0 + ((caster.Skills[SkillName.Magery].Value - 100.0) / 200.0);

            if (scaleDuration)
            {
                duration = TimeSpan.FromSeconds(duration.TotalSeconds * scale);
            }

            if (scaleStats)
            {
                creature.RawStr = (int)(creature.RawStr * scale);
                creature.Hits   = creature.HitsMax;

                creature.RawDex = (int)(creature.RawDex * scale);
                creature.Stam   = creature.StamMax;

                creature.RawInt = (int)(creature.RawInt * scale);
                creature.Mana   = creature.ManaMax;
            }

            Point3D p = new Point3D(caster);

            if (SpellHelper.FindValidSpawnLocation(map, ref p, true))
            {
                BaseCreature.Summon(creature, caster, p, sound, duration);
                return;
            }


            /*
             * int offset = Utility.Random( 8 ) * 2;
             *
             * for( int i = 0; i < m_Offsets.Length; i += 2 )
             * {
             *      int x = caster.X + m_Offsets[(offset + i) % m_Offsets.Length];
             *      int y = caster.Y + m_Offsets[(offset + i + 1) % m_Offsets.Length];
             *
             *      if( map.CanSpawnMobile( x, y, caster.Z ) )
             *      {
             *              BaseCreature.Summon( creature, caster, new Point3D( x, y, caster.Z ), sound, duration );
             *              return;
             *      }
             *      else
             *      {
             *              int z = map.GetAverageZ( x, y );
             *
             *              if( map.CanSpawnMobile( x, y, z ) )
             *              {
             *                      BaseCreature.Summon( creature, caster, new Point3D( x, y, z ), sound, duration );
             *                      return;
             *              }
             *      }
             * }
             * */

            creature.Delete();
            caster.SendLocalizedMessage(501942);               // That location is blocked.
        }
Exemple #3
0
        public static void Summon(BaseCreature creature, Mobile caster, int sound, TimeSpan duration, bool scaleDuration, bool scaleStats)
        {
            Map map = caster.Map;

            if (map == null)
            {
                return;
            }

            double scale = 1.0 + ((caster.Skills[SkillName.Magery].Value - 100.0) / 200.0);

            if (scaleDuration)
            {
                duration = TimeSpan.FromSeconds(duration.TotalSeconds * scale);
            }

            if (creature != null && creature.ControlMaster != null && creature.ControlMaster is Player)
            {
                Summoner sum = Perk.GetByType <Summoner>((Player)creature.ControlMaster);

                if (sum != null && sum.Remanence())
                {
                    duration += TimeSpan.FromSeconds(90.0);
                }
            }

            Point3D p = new Point3D(caster);

            if (SpellHelper.FindValidSpawnLocation(map, ref p, true))
            {
                BaseCreature.Summon(creature, caster, p, sound, duration);

                if (creature != null && creature.ControlMaster != null && creature.ControlMaster is Player)
                {
                    Summoner sum = Perk.GetByType <Summoner>((Player)creature.ControlMaster);

                    if (sum != null && sum.IntelligentDesign())
                    {
                        creature.SetSkill(SkillName.Wrestling, creature.Skills.Wrestling.Value + Utility.RandomMinMax(15, 20));
                        creature.SetSkill(SkillName.Tactics, creature.Skills.Tactics.Value + Utility.RandomMinMax(20, 25));
                        creature.SetSkill(SkillName.MagicResist, creature.Skills.MagicResist.Value + Utility.RandomMinMax(30, 40));
                        creature.SetSkill(SkillName.Meditation, creature.Skills.Meditation.Value + Utility.RandomMinMax(30, 40));
                        creature.SetSkill(SkillName.Magery, creature.Skills.Magery.Value + Utility.RandomMinMax(15, 20));
                        creature.SetSkill(SkillName.EvalInt, creature.Skills.EvalInt.Value + Utility.RandomMinMax(15, 20));
                    }

                    if (sum != null && sum.SecondNature())
                    {
                        creature.HitsMaxSeed += (int)(creature.HitsMaxSeed * 0.33) + Utility.RandomMinMax(20, 40);
                        creature.Hits         = creature.HitsMax;
                    }

                    if (sum != null && sum.Horde())
                    {
                        for (int x = 1; x <= 3; x++)
                        {
                            if (creature.ControlMaster.Followers + creature.ControlSlots <= creature.ControlMaster.FollowersMax)
                            {
                                BaseCreature newSummon;
                                newSummon = Activator.CreateInstance(creature.GetType()) as BaseCreature;

                                if (SpellHelper.FindValidSpawnLocation(map, ref p, true))
                                {
                                    BaseCreature.Summon(newSummon, caster, p, sound, duration);
                                }

                                if (sum != null && sum.IntelligentDesign())
                                {
                                    newSummon.SetSkill(SkillName.Wrestling, creature.Skills.Wrestling.Value + Utility.RandomMinMax(15, 20));
                                    newSummon.SetSkill(SkillName.Tactics, creature.Skills.Tactics.Value + Utility.RandomMinMax(20, 25));
                                    newSummon.SetSkill(SkillName.MagicResist, creature.Skills.MagicResist.Value + Utility.RandomMinMax(30, 40));
                                    newSummon.SetSkill(SkillName.Meditation, creature.Skills.Meditation.Value + Utility.RandomMinMax(30, 40));
                                    newSummon.SetSkill(SkillName.Magery, creature.Skills.Magery.Value + Utility.RandomMinMax(15, 20));
                                    newSummon.SetSkill(SkillName.EvalInt, creature.Skills.EvalInt.Value + Utility.RandomMinMax(15, 20));
                                }

                                if (sum != null && sum.SecondNature())
                                {
                                    newSummon.HitsMaxSeed += (int)(newSummon.HitsMaxSeed * 0.33) + Utility.RandomMinMax(20, 40);
                                    newSummon.Hits         = newSummon.HitsMax;
                                }
                            }
                        }
                    }
                }

                return;
            }

            creature.Delete();
            caster.SendLocalizedMessage(501942); // That location is blocked.
        }