//BEGIN ANTI ARCHERY

		public static void DoAntiArchery(BaseCreature mobile, Mobile player)
		{
			if ( mobile.Combatant != null )
				if ( !player.InRange( mobile, 5 ) )
				{                 
					Point3D from = mobile.Location;
					Point3D to = player.Location;

					if ( mobile.Mana >= 10 )
					{
						mobile.Location = to;
						
						mobile.Mana -= 10;

						mobile.Say( "Grrrr" );

						Effects.SendLocationParticles( EffectItem.Create( from, mobile.Map, EffectItem.DefaultDuration ), 0x3728, 10, 10, 2023 );
						Effects.SendLocationParticles( EffectItem.Create(   to, mobile.Map, EffectItem.DefaultDuration ), 0x3728, 10, 10, 5023 );

						mobile.PlaySound( 0x1FE );
					}
				}
		}
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (Core.UOAI || Core.UOAR || Core.UOMO || Core.Publish >= 13.6)
                {
                    from.RevealingAction();
                }

                if (targeted is Mobile)
                {
                    if (targeted is BaseCreature)
                    {
                        BaseCreature creature = (BaseCreature)targeted;

                        if (!creature.Tamable)
                        {
                            from.SendLocalizedMessage(502469);                             // That being can not be tamed.
                        }
                        else if (creature.Controlled)
                        {
                            from.SendLocalizedMessage(502467);                             // That animal looks tame already.
                        }
                        else if (from.Female ? !creature.AllowFemaleTamer : !creature.AllowMaleTamer)
                        {
                            from.SendLocalizedMessage(502801);                             // You can't tame that!
                        }
                        else if (from.Followers + creature.ControlSlots > from.FollowersMax)
                        {
                            from.SendLocalizedMessage(1049611);                             // You have too many followers to tame that creature.
                        }
                        else if (creature.Owners.Count >= BaseCreature.MaxOwners && !creature.Owners.Contains(from))
                        {
                            from.SendLocalizedMessage(1005615);                             // This animal has had too many owners and is too upset for you to tame.
                        }
                        else if (MustBeSubdued(creature))
                        {
                            from.SendLocalizedMessage(1054025);                             // You must subdue this creature before you can tame it!
                        }
                        else if (creature.BardProvoked)
                        {
                            from.SendMessage("That creature is too angry to tame.");
                        }
                        else if (CheckMastery(from, creature) || from.Skills[SkillName.AnimalTaming].Value >= creature.MinTameSkill)
                        {
                            if (m_BeingTamed.Contains(targeted))
                            {
                                from.SendLocalizedMessage(502802);                                 // Someone else is already taming this.
                            }
                            else if ((creature is Dragon || creature is Nightmare || creature is SwampDragon || creature is WhiteWyrm) && 0.95 >= Utility.RandomDouble())
                            {
                                from.SendLocalizedMessage(502805);                                 // You seem to anger the beast!
                                creature.PlaySound(creature.GetAngerSound());
                                creature.Direction = creature.GetDirectionTo(from);
                                creature.Combatant = from;
                            }
                            else
                            {
                                m_BeingTamed[targeted] = from;

                                from.LocalOverheadMessage(MessageType.Emote, 0x59, 1010597);                                 // You start to tame the creature.
                                from.NonlocalOverheadMessage(MessageType.Emote, 0x59, 1010598);                              // *begins taming a creature.*

                                new InternalTimer(from, creature, Utility.Random(3, 2)).Start();

                                m_SetSkillTime = false;
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(502806);                             // You have no chance of taming this creature.
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(502469);                         // That being can not be tamed.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502801);                     // You can't tame that!
                }
            }
		public static void DoMoves( BaseCreature from, Mobile target )
		{
			switch ( Utility.Random( 3 ) )
			{
				case 0:
				
				if ( Utility.Random( 500 ) <= from.RoarAttack )
				{
					int power;
					int mindam;
					int maxdam;

					if ( from.RoarAttack > 3 )
					{
						mindam = from.RoarAttack / 3;
						maxdam = from.RoarAttack / 2;
					}
					else
					{
						mindam = 1;
						maxdam = 3;
					}

					if ( from.RoarAttack > 10 )
						power = from.RoarAttack / 10;
					else
						power = 1;

					ArrayList targets = new ArrayList();

					foreach ( Mobile m in from.GetMobilesInRange( power ) )
					{
						if ( m != from )
							targets.Add( m );
					}
								
					for ( int i = 0; i < targets.Count; ++i )
					{
						Mobile m = (Mobile)targets[i];

						if ( m is BaseCreature )
						{
							BaseCreature bc = (BaseCreature)m;

							bc.BeginFlee( TimeSpan.FromSeconds( 30.0 ) );
							AOS.Damage( target, from, Utility.RandomMinMax( mindam, maxdam ), 20, 20, 20, 20, 20 );
						}
					}	
				}
				
				break;

				case 1:
				
				if ( Utility.Random( 500 ) <= from.PetPoisonAttack )
				{
					Effects.SendLocationParticles( EffectItem.Create( target.Location, target.Map, EffectItem.DefaultDuration ), 0x36B0, 1, 14, 63, 7, 9915, 0 );
					Effects.PlaySound( target.Location, target.Map, 0x229 );

					int mindam;
					int maxdam;

					if ( from.PetPoisonAttack > 3 )
					{
						mindam = from.PetPoisonAttack / 3;
						maxdam = from.PetPoisonAttack / 2;
					}
					else
					{
						mindam = 1;
						maxdam = 3;
					}

					int level = from.PetPoisonAttack / 20;

					if ( level > 5 )
						level = 5;

					target.ApplyPoison( from.ControlMaster, Poison.GetPoison( level ) );
					AOS.Damage( target, from, Utility.RandomMinMax( mindam, maxdam ), 0, 0, 0, 0, 100 );
				}
				
				break;

				case 2:
				
				if ( Utility.Random( 500 ) <= from.FireBreathAttack )
				{
					int mindam;
					int maxdam;

					if ( from.PetPoisonAttack > 3 )
					{
						mindam = from.PetPoisonAttack / 3;
						maxdam = from.PetPoisonAttack / 2;
					}
					else
					{
						mindam = 1;
						maxdam = 3;
					}

					from.MovingParticles( target, 0x36D4, 7, 0, false, true, 9502, 4019, 0x160 );
					from.PlaySound( Core.AOS ? 0x15E : 0x44B );
					target.FixedParticles( 0x3709, 10, 30, 5052, EffectLayer.LeftFoot );
					target.PlaySound( 0x208 );

					AOS.Damage( target, from, Utility.RandomMinMax( mindam, maxdam ), 0, 0, 0, 0, 100 );
						
					Timer t = new FireBreathDOT( target, from, from.FireBreathAttack );
					t.Start();
				}
				
				break;
			}
		}
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (m_Pet.Deleted || !m_Pet.IsBonded || !m_Pet.IsDeadPet)
            {
                return;
            }

            Mobile from = state.Mobile;

            if (info.ButtonID == 1)
            {
                if (m_Pet.Map == null || !m_Pet.Map.CanFit(m_Pet.Location, 16, false, false))
                {
                    from.SendLocalizedMessage(503256);                       // You fail to resurrect the creature.
                    return;
                }
                else if (m_Pet.Region != null && m_Pet.Region.IsPartOf("Khaldun")) //TODO: Confirm for pets, as per Bandage's script.
                {
                    from.SendLocalizedMessage(1010395);                            // The veil of death in this area is too strong and resists thy efforts to restore life.
                    return;
                }

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

                #region SA
                if (m_Healer != null)
                {
                    int         toheal = 0;
                    VirtueLevel level  = VirtueHelper.GetLevel(m_Healer, VirtueName.Compassion);

                    switch (level)
                    {
                    case VirtueLevel.Seeker: toheal = AOS.Scale(m_Pet.HitsMax, 5); break;

                    case VirtueLevel.Follower: toheal = AOS.Scale(m_Pet.HitsMax, 10); break;

                    case VirtueLevel.Knight: toheal = AOS.Scale(m_Pet.HitsMax, 20); break;
                    }

                    if (toheal > 200)
                    {
                        toheal = 200;
                    }

                    m_Pet.Hits = toheal;
                }
                #endregion

                double decreaseAmount;

                if (from == m_Pet.ControlMaster)
                {
                    decreaseAmount = 0.1;
                }
                else
                {
                    decreaseAmount = 0.2;
                }

                for (int i = 0; i < m_Pet.Skills.Length; ++i)                   //Decrease all skills on pet.
                {
                    m_Pet.Skills[i].Base -= decreaseAmount;
                }

                if (!m_Pet.IsDeadPet && m_HitsScalar > 0)
                {
                    m_Pet.Hits = (int)(m_Pet.HitsMax * m_HitsScalar);
                }
            }
        }
Exemple #5
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                from.RevealingAction();

                if (targeted is Mobile)
                {
                    if (targeted is BaseCreature)
                    {
                        BaseCreature creature = (BaseCreature)targeted;

                        if (!creature.Tamable)
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049655, from.NetState);                               // That creature cannot be tamed.
                        }
                        else if (creature.Controlled)
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502804, from.NetState);                               // That animal looks tame already.
                        }
                        else if (from.Female && !creature.AllowFemaleTamer)
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049653, from.NetState);                               // That creature can only be tamed by males.
                        }
                        else if (!from.Female && !creature.AllowMaleTamer)
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049652, from.NetState);                               // That creature can only be tamed by females.
                        }
                        else if (from.Followers + creature.ControlSlots > from.FollowersMax)
                        {
                            from.SendLocalizedMessage(1049611);                               // You have too many followers to tame that creature.
                        }
                        else if (creature.Owners.Count >= BaseCreature.MaxOwners && !creature.Owners.Contains(from))
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1005615, from.NetState);                               // This animal has had too many owners and is too upset for you to tame.
                        }
                        else if (MustBeSubdued(creature))
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1054025, from.NetState);                               // You must subdue this creature before you can tame it!
                        }
                        else if (CheckMastery(from, creature) || from.Skills[SkillName.AnimalTaming].Value >= creature.MinTameSkill)
                        {
                            if (m_BeingTamed.Contains(targeted))
                            {
                                creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502802, from.NetState);                                   // Someone else is already taming this.
                            }
                            else if (creature.CanAngerOnTame && 0.95 >= Utility.RandomDouble())
                            {
                                creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502805, from.NetState);                                   // You seem to anger the beast!
                                creature.PlaySound(creature.GetAngerSound());
                                creature.Direction = creature.GetDirectionTo(from);

                                if (creature.BardPacified && Utility.RandomDouble() > .24)
                                {
                                    Timer.DelayCall(TimeSpan.FromSeconds(2.0), new TimerStateCallback(ResetPacify), creature);
                                }
                                else
                                {
                                    creature.BardEndTime = DateTime.UtcNow;
                                }

                                creature.BardPacified = false;

                                if (creature.AIObject != null)
                                {
                                    creature.AIObject.DoMove(creature.Direction);
                                }
                            }
                            else
                            {
                                m_BeingTamed[targeted] = from;

                                from.LocalOverheadMessage(MessageType.Emote, 0x59, 1010597);                                   // You start to tame the creature.
                                from.NonlocalOverheadMessage(MessageType.Emote, 0x59, 1010598);                                // *begins taming a creature.*

                                new InternalTimer(from, creature, Utility.Random(3, 2)).Start();

                                m_SetSkillTime = false;
                            }
                        }
                        else
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502806, from.NetState);                               // You have no chance of taming this creature.
                        }
                    }
                    else
                    {
                        ((Mobile)targeted).PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502469, from.NetState);                           // That being cannot be tamed.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502801);                       // You can't tame that!
                }
            }
Exemple #6
0
        public virtual void Exit(Mobile fighter)
        {
            // teleport fighter
            if (fighter.NetState == null && MobileIsInBossArea(fighter.LogoutLocation))
            {
                fighter.LogoutMap      = this is CitadelAltar ? Map.Tokuno : this.Map;
                fighter.LogoutLocation = m_ExitDest;
            }
            else if (MobileIsInBossArea(fighter) && fighter.Map == this.Map)
            {
                fighter.FixedParticles(0x376A, 9, 32, 0x13AF, EffectLayer.Waist);
                fighter.PlaySound(0x1FE);

                if (this is CitadelAltar)
                {
                    fighter.MoveToWorld(m_ExitDest, Map.Tokuno);
                }
                else
                {
                    fighter.MoveToWorld(m_ExitDest, Map);
                }
            }

            // teleport his pets
            if (m_Pets.ContainsKey(fighter))
            {
                for (int i = 0; i < m_Pets[fighter].Count; i++)
                {
                    BaseCreature pet = m_Pets[fighter][i] as BaseCreature;

                    if (pet != null && (pet.Alive || pet.IsBonded) && pet.Map != Map.Internal && MobileIsInBossArea(pet))
                    {
                        if (pet is BaseMount)
                        {
                            BaseMount mount = (BaseMount)pet;

                            if (mount.Rider != null && mount.Rider != fighter)
                            {
                                mount.Rider.FixedParticles(0x376A, 9, 32, 0x13AF, EffectLayer.Waist);
                                mount.Rider.PlaySound(0x1FE);

                                if (this is CitadelAltar)
                                {
                                    mount.Rider.MoveToWorld(m_ExitDest, Map.Tokuno);
                                }
                                else
                                {
                                    mount.Rider.MoveToWorld(m_ExitDest, Map);
                                }

                                continue;
                            }
                            else if (mount.Rider != null)
                            {
                                continue;
                            }
                        }

                        pet.FixedParticles(0x376A, 9, 32, 0x13AF, EffectLayer.Waist);
                        pet.PlaySound(0x1FE);

                        if (this is CitadelAltar)
                        {
                            pet.MoveToWorld(m_ExitDest, Map.Tokuno);
                        }
                        else
                        {
                            pet.MoveToWorld(m_ExitDest, Map);
                        }
                    }
                }

                m_Pets.Remove(fighter);
            }

            m_Fighters.Remove(fighter);
            fighter.SendLocalizedMessage(1072677); // You have been transported out of this room.
        }
Exemple #7
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            int index = info.ButtonID - 1;

            if (index >= 0 && index < m_Entries.Length)
            {
                FamilierEntry entry = m_Entries[index];

                double necro  = m_From.Skills[SkillName.ArtMagique].Base;
                double spirit = m_From.Skills[SkillName.Animisme].Base;

                //BaseCreature check = (BaseCreature)FamilierSpell.Table[m_From];

                //if ( check != null && !check.Deleted )
                //{
                //    m_From.SendLocalizedMessage( 1061605 ); // You already have a familiar.
                //}
                //else
                if ((m_From.Followers + 2) > m_From.FollowersMax)
                {
                    m_From.SendLocalizedMessage(1049645); // You have too many followers to summon that creature.
                }
                else if (necro < entry.ReqNecromancy || spirit < entry.ReqSpiritSpeak)
                {
                    // That familiar requires ~1_NECROMANCY~ Necromancy and ~2_SPIRIT~ Spirit Speak.
                    m_From.SendLocalizedMessage(1061606, String.Format("{0:F1}\t{1:F1}", entry.ReqNecromancy, entry.ReqSpiritSpeak));

                    m_From.CloseGump(typeof(FamilierGump));
                    m_From.SendGump(new FamilierGump(m_From, FamilierSpell.Entries));
                }
                else if (entry.Type == null)
                {
                    m_From.SendMessage("That familiar has not yet been defined.");

                    m_From.CloseGump(typeof(FamilierGump));
                    m_From.SendGump(new FamilierGump(m_From, FamilierSpell.Entries));
                }
                else
                {
                    try
                    {
                        BaseCreature bc = (BaseCreature)Activator.CreateInstance(entry.Type);

                        bc.Skills.Concentration = m_From.Skills.Concentration;

                        if (BaseCreature.Summon(bc, m_From, m_From.Location, -1, TimeSpan.FromSeconds(10 + m_From.Skills[SkillName.Animisme].Base * 2.4)))
                        {
                            Effects.SendTargetParticles(m_From, 0x3728, 1, 10, 9910, EffectLayer.Head);
                            bc.PlaySound(bc.GetIdleSound());
                            FamilierSpell.Table[m_From] = bc;
                        }
                    }
                    catch
                    {
                    }
                }
            }
            else
            {
                m_From.SendLocalizedMessage(1061825);                   // You decide not to summon a familiar.
            }
        }
Exemple #8
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                bool releaseLock = true;

                if (targeted is Dragon || targeted is Drake || targeted is AncientWyrm || targeted is SwampDragon || targeted is Ridgeback || targeted is WhiteWyrm || targeted is Wyvern || targeted is Daemon)
                {
                    if (from is PlayerMobile)
                    {
                        ((PlayerMobile)from).EndPlayerAction();
                    }

                    from.SendAsciiMessage("You can't tame that!");
                    return;
                }

                if (targeted is GoodMustang)
                {
                    if (from.Karma < 7499)
                    {
                        if (from is PlayerMobile)
                        {
                            ((PlayerMobile)from).EndPlayerAction();
                        }

                        from.SendAsciiMessage("You are not righteous enough to tame this animal");
                        return;
                    }
                }

                if (targeted is EvilMustang)
                {
                    if (from.Karma > -7499)
                    {
                        if (from is PlayerMobile)
                        {
                            ((PlayerMobile)from).EndPlayerAction();
                        }

                        from.SendAsciiMessage("You are not wicked enough to tame this animal");
                        return;
                    }
                }

                if (targeted is Mobile)
                {
                    if (targeted is BaseCreature)
                    {
                        BaseCreature creature     = (BaseCreature)targeted;
                        bool         alreadyOwned = creature.Owners.Contains(from);

                        if (!creature.Tamable)
                        {
                            from.SendAsciiMessage(CliLoc.LocToString(1049655)); // That creature cannot be tamed.
                        }
                        else if (creature.Controlled)
                        {
                            from.SendAsciiMessage(CliLoc.LocToString(502804)); // That animal looks tame already.
                        }
                        else if (from.Female && !creature.AllowFemaleTamer)
                        {
                            from.SendAsciiMessage(CliLoc.LocToString(1049653)); // That creature can only be tamed by males.
                        }
                        else if (!from.Female && !creature.AllowMaleTamer)
                        {
                            from.SendAsciiMessage(CliLoc.LocToString(1049652)); // That creature can only be tamed by females.
                        }
                        else if (creature.Owners.Count >= BaseCreature.MaxOwners && !creature.Owners.Contains(from))
                        {
                            from.SendAsciiMessage(CliLoc.LocToString(1005615)); // This animal has had too many owners and is too upset for you to tame.
                        }
                        else if (MustBeSubdued(creature))
                        {
                            from.SendAsciiMessage(CliLoc.LocToString(1054025)); // You must subdue this creature before you can tame it!
                        }
                        else if (alreadyOwned)
                        {
                            from.SendAsciiMessage("{0} remembers you and accepts you once more as its master.", creature.Name);
                            creature.SetControlMaster(from);
                        }
                        else if (CheckMastery(from, creature) || from.Skills[SkillName.AnimalTaming].Value >= creature.MinTameSkill)
                        {
                            FactionWarHorse warHorse = creature as FactionWarHorse;

                            if (warHorse != null)
                            {
                                Faction faction = Faction.Find(from);

                                if (faction == null || faction != warHorse.Faction)
                                {
                                    if (from is PlayerMobile)
                                    {
                                        ((PlayerMobile)from).EndPlayerAction();
                                    }

                                    from.SendAsciiMessage(CliLoc.LocToString(1042590)); // You cannot tame this creature.
                                    return;
                                }
                            }

                            if (creature.CanAngerOnTame && 0.95 >= Utility.RandomDouble())
                            {
                                from.SendAsciiMessage(CliLoc.LocToString(502805)); // You seem to anger the beast!
                                creature.PlaySound(creature.GetAngerSound());
                                from.Direction = creature.GetDirectionTo(from);

                                if (creature.BardPacified && Utility.RandomDouble() > .24)
                                {
                                    Timer.DelayCall(TimeSpan.FromSeconds(2.0), new TimerStateCallback(ResetPacify), creature);
                                }
                                else
                                {
                                    creature.BardEndTime = DateTime.Now;
                                }

                                creature.BardPacified = false;

                                creature.Move(creature.Direction);

                                if (from is PlayerMobile && !((PlayerMobile)from).HonorActive)
                                {
                                    creature.Combatant = from;
                                }
                            }
                            else
                            {
                                releaseLock            = false;
                                m_BeingTamed[targeted] = from;
                                from.SendAsciiMessage("You start to tame the creature.");
                                new InternalTimer(from, creature, Utility.Random(4, 4)).Start();

                                m_SetSkillTime = false;
                            }
                        }
                        else if (CheckMastery(from, creature) || from.Skills[SkillName.AnimalTaming].Value <= creature.MinTameSkill)
                        {
                            FactionWarHorse warHorse = creature as FactionWarHorse;

                            if (warHorse != null)
                            {
                                Faction faction = Faction.Find(from);

                                if (faction == null || faction != warHorse.Faction)
                                {
                                    if (from is PlayerMobile)
                                    {
                                        ((PlayerMobile)from).EndPlayerAction();
                                    }

                                    from.SendAsciiMessage(CliLoc.LocToString(1042590)); // You cannot tame this creature.
                                    return;
                                }
                            }

                            if (creature.CanAngerOnTame && 0.95 >= Utility.RandomDouble())
                            {
                                from.SendAsciiMessage(CliLoc.LocToString(502805)); // You seem to anger the beast!
                                creature.PlaySound(creature.GetAngerSound());
                                from.Direction     = creature.GetDirectionTo(from);
                                creature.Combatant = from;
                            }
                            else
                            {
                                releaseLock            = false;
                                m_BeingTamed[targeted] = from;
                                from.SendAsciiMessage("You start to tame the creature.");
                                new InternalTimer(from, creature, Utility.Random(4, 4)).Start();

                                m_SetSkillTime = false;
                            }
                        }
                        else
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502806, from.NetState); // You have no chance of taming this creature.
                        }
                    }
                    else
                    {
                        ((Mobile)targeted).PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502469, from.NetState); // That being cannot be tamed.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502801); // You can't tame that!
                }

                if (releaseLock && from is PlayerMobile)
                {
                    ((PlayerMobile)from).EndPlayerAction();
                }
            }
            protected override void OnTarget(Mobile from, object targeted)
            {
                from.RevealingAction();

                if (targeted is Mobile)
                {
                    if (targeted is BaseCreature)
                    {
                        BaseCreature creature = (BaseCreature)targeted;

                        if (!creature.Tamable)
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049655, from.NetState);                               // That creature cannot be tamed.
                        }
                        else if (creature.Controled)
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502804, from.NetState);                               // That animal looks tame already.
                        }
                        else if (from.Female && !creature.AllowFemaleTamer)
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049653, from.NetState);                               // That creature can only be tamed by males.
                        }
                        else if (!from.Female && !creature.AllowMaleTamer)
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049652, from.NetState);                               // That creature can only be tamed by females.
                        }
                        //else if ( from.Followers + creature.ControlSlots > from.FollowersMax )
                        //{
                        //from.SendLocalizedMessage( 1049611 ); // You have too many //followers //to tame that creature.
                        //}
                        else if (creature.Owners.Count >= BaseCreature.MaxOwners && !creature.Owners.Contains(from))
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1005615, from.NetState);                               // This animal has had too many owners and is too upset for you to tame.
                        }
                        else if (MustBeSubdued(creature))
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1054025, from.NetState);                               // You must subdue this creature before you can tame it!
                        }
                        else if (CheckMastery(from, creature) || from.Skills[SkillName.AnimalTaming].Value >= creature.MinTameSkill)
                        {
                            FactionWarHorse warHorse = creature as FactionWarHorse;

                            if (warHorse != null)
                            {
                                Faction faction = Faction.Find(from);

                                if (faction == null || faction != warHorse.Faction)
                                {
                                    creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1042590, from.NetState);                                       // You cannot tame this creature.
                                    return;
                                }
                            }

                            if (m_BeingTamed.Contains(targeted))
                            {
                                creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502802, from.NetState);                                   // Someone else is already taming this.
                            }
                            else if ((creature is Dragon || creature is Nightmare || creature is SwampDragon || creature is WhiteWyrm) && 0.95 >= Utility.RandomDouble())
                            {
                                creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502805, from.NetState);                                   // You seem to anger the beast!
                                creature.PlaySound(creature.GetAngerSound());
                                creature.Direction = creature.GetDirectionTo(from);
                                creature.Combatant = from;
                            }
                            else
                            {
                                m_BeingTamed[targeted] = from;

                                from.LocalOverheadMessage(MessageType.Emote, 0x59, 1010597);                                   // You start to tame the creature.
                                from.NonlocalOverheadMessage(MessageType.Emote, 0x59, 1010598);                                // *begins taming a creature.*

                                new InternalTimer(from, creature, Utility.Random(3, 2)).Start();

                                m_SetSkillTime = false;
                            }
                        }
                        else
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502806, from.NetState);                               // You have no chance of taming this creature.
                        }
                    }
                    else
                    {
                        ((Mobile)targeted).PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502469, from.NetState);                           // That being cannot be tamed.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502801);                       // You can't tame that!
                }
            }
Exemple #10
0
        public override void OnCast()
        {
            if (CheckSequence())
            {
                List <Mobile> targets = new List <Mobile>();

                foreach (Mobile m in Caster.GetMobilesInRange(8))
                {
                    if (Caster != m && SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false))
                    {
                        targets.Add(m);
                    }
                }

                Caster.PlaySound(0x245);
                Caster.PlaySound(0x3EA);
                Caster.FixedParticles(0x2109, 1, 25, 9922, 14, 3, EffectLayer.Head);
                IEntity from = new Entity(Serial.Zero, new Point3D(Caster.X, Caster.Y, Caster.Z), Caster.Map);
                IEntity to   = new Entity(Serial.Zero, new Point3D(Caster.X, Caster.Y, Caster.Z + 32), Caster.Map);
                Effects.SendMovingParticles(from, to, 0x3192, 1, 0, false, false, 33, 3, 9501, 1, 0, EffectLayer.Head, 0x100);


                int dispelSkill = Caster.Int;

                double mag = Caster.Skills.Magery.Value;

                for (int i = 0; i < targets.Count; ++i)
                {
                    if (targets[i] is BaseCreature)
                    {
                        BaseCreature m = targets[i] as BaseCreature;

                        if (m != null)
                        {
                            bool dispellable = m.Summoned && !m.IsAnimatedDead;

                            if (dispellable)
                            {
                                double dispelChance = (50.0 + ((100 * (mag - m.DispelDifficulty)) / (m.DispelFocus * 2))) / 100;
                                dispelChance *= dispelSkill / 100.0;

                                if (dispelChance > Utility.RandomDouble())
                                {
                                    Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
                                    Effects.PlaySound(m, m.Map, 0x201);

                                    m.Delete();
                                    continue;
                                }
                            }

                            bool evil = !m.Controlled && !m.Blessed;

                            if (evil)
                            {
                                double fleeChance = (100 - Math.Sqrt(m.Fame / 2)) * mag * dispelSkill;
                                fleeChance /= 1000000;

                                if (fleeChance > Utility.RandomDouble())
                                {
                                    m.PlaySound(m.Female ? 814 : 1088);
                                    m.BeginFlee(TimeSpan.FromSeconds(15.0));
                                }
                            }
                        }
                    }
                }
            }

            FinishSequence();
        }
Exemple #11
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                from.RevealingAction();

                if (targeted is Mobile)
                {
                    if (targeted is BaseCreature)
                    {
                        BaseCreature creature = (BaseCreature)targeted;

                        if (!creature.Tamable)
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049655, from.NetState);
                            // That creature cannot be tamed.
                        }
                        else if (creature.Controlled)
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502804, from.NetState);
                            // That animal looks tame already.
                        }
                        else if (from.Female && !creature.AllowFemaleTamer)
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049653, from.NetState);
                            // That creature can only be tamed by males.
                        }
                        else if (!from.Female && !creature.AllowMaleTamer)
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049652, from.NetState);
                            // That creature can only be tamed by females.
                        }
                        else if (creature is CuSidhe && from.Race != Race.Elf)
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502801, from.NetState); // You can't tame that!
                        }
                        else if (from.Followers + creature.ControlSlots > from.FollowersMax)
                        {
                            from.SendLocalizedMessage(1049611); // You have too many followers to tame that creature.
                        }
                        else if (creature.Owners.Count >= BaseCreature.MaxOwners && !creature.Owners.Contains(from))
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1005615, from.NetState);
                            // This animal has had too many owners and is too upset for you to tame.
                        }
                        else if (MustBeSubdued(creature))
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1054025, from.NetState);
                            // You must subdue this creature before you can tame it!
                        }
                        else if (DarkWolfFamiliar.CheckMastery(from, creature) || from.Skills[SkillName.AnimalTaming].Value >= creature.CurrentTameSkill)
                        {
                            if (m_BeingTamed.Contains(targeted))
                            {
                                creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502802, from.NetState);
                                // Someone else is already taming this.
                            }
                            else if (creature.CanAngerOnTame && 0.95 >= Utility.RandomDouble())
                            {
                                creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502805, from.NetState);
                                // You seem to anger the beast!
                                creature.PlaySound(creature.GetAngerSound());
                                creature.Direction = creature.GetDirectionTo(from);

                                if (creature.AIObject != null)
                                {
                                    creature.AIObject.DoMove(creature.Direction);
                                }

                                if (from is PlayerMobile &&
                                    !(((PlayerMobile)from).HonorActive ||
                                      TransformationSpellHelper.UnderTransformation(from, typeof(EtherealVoyageSpell))))
                                {
                                    creature.Combatant = from;
                                }
                            }
                            else
                            {
                                m_SetSkillTime = false;

                                m_BeingTamed[targeted] = from;

                                from.LocalOverheadMessage(MessageType.Emote, 0x59, 1010597);    // You start to tame the creature.
                                from.NonlocalOverheadMessage(MessageType.Emote, 0x59, 1010598); // *begins taming a creature.*

                                new InternalTimer(from, creature, Utility.Random(3, 2)).Start();
                            }
                        }
                        else
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502806, from.NetState);
                            // You have no chance of taming this creature.
                        }
                    }
                    else
                    {
                        ((Mobile)targeted).PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502469, from.NetState);
                        // That being cannot be tamed.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502801); // You can't tame that!
                }
            }
Exemple #12
0
            protected override void OnTarget(Mobile from, object target)
            {
                if (m_ParagonWand.Deleted || m_ParagonWand.RootParent != from)
                {
                    return;
                }

                PlayerMobile player = from as PlayerMobile;

                if (player == null)
                {
                    return;
                }

                BaseCreature bc_Target = target as BaseCreature;

                if (bc_Target == null)
                {
                    from.SendMessage("That is not a valid creature.");
                    return;
                }

                if (!bc_Target.AllowParagon)
                {
                    from.SendMessage("That creature is not capable of becoming a paragon.");
                    return;
                }

                if (bc_Target.IsParagon)
                {
                    from.SendMessage("That creature is already a paragon.");
                    return;
                }

                if (bc_Target.Controlled)
                {
                    from.SendMessage("That creature is currently controlled.");
                    return;
                }

                if (player.AccessLevel == AccessLevel.Player)
                {
                    if (!bc_Target.Map.InLOS(from.Location, bc_Target.Location))
                    {
                        from.SendMessage("You must have a valid line-of-sight to the creature you wish to target.");
                        return;
                    }

                    if (bc_Target.Combatant != null)
                    {
                        from.SendMessage("You may not target creatures currently engaged in combat.");
                        return;
                    }

                    if (bc_Target.Hits < bc_Target.HitsMax)
                    {
                        from.SendMessage("You may not target creatures that are currently injured.");
                        return;
                    }

                    /*
                     * if (bc_Target.CreationTime + SpawnCooldown >= DateTime.UtcNow)
                     * {
                     *  string timeRemaining = Utility.CreateTimeRemainingString(DateTime.UtcNow, bc_Target.CreationTime + SpawnCooldown, false, false, true, true, true);
                     *
                     *  from.SendMessage("That has spawned too recently to be converted. You must wait another + " + timeRemaining + ".");
                     *  return;
                     * }
                     */

                    if (bc_Target.LastCombatTime + CombatCooldown >= DateTime.UtcNow)
                    {
                        string timeRemaining = Utility.CreateTimeRemainingString(DateTime.UtcNow, bc_Target.LastCombatTime + CombatCooldown, false, false, true, true, true);

                        from.SendMessage("That has been in combat too recently. You must wait another " + timeRemaining + ".");
                        return;
                    }

                    if (!from.CanBeginAction(typeof(ParagonWand)))
                    {
                        from.SendMessage("You may only use a single paragon wand per hour.");
                        return;
                    }
                }

                bool targetValid = true;

                IPooledEnumerable mobilesNearby = bc_Target.Map.GetMobilesInRange(bc_Target.Location, 12);

                if (player.AccessLevel == AccessLevel.Player)
                {
                    foreach (Mobile mobile in mobilesNearby)
                    {
                        if (mobile.Combatant == bc_Target)
                        {
                            targetValid = false;
                            from.SendMessage("That creature is currently being engaged in combat by someone.");

                            break;
                        }

                        BaseCreature nearbyCreature = mobile as BaseCreature;
                        PlayerMobile nearbyPlayer   = mobile as PlayerMobile;

                        if (mobile != from)
                        {
                            if (nearbyCreature != null)
                            {
                                if (nearbyCreature.Controlled && nearbyCreature.ControlMaster is PlayerMobile && nearbyCreature.ControlMaster != from)
                                {
                                    targetValid = false;
                                    from.SendMessage("That target is too near another player's follower.");
                                    break;
                                }
                            }

                            if (nearbyPlayer != null)
                            {
                                targetValid = false;
                                from.SendMessage("That target is too near another player.");
                                break;
                            }
                        }
                    }
                }

                mobilesNearby.Free();

                if (targetValid)
                {
                    bc_Target.PlaySound(0x652);

                    Effects.SendLocationEffect(bc_Target.Location, bc_Target.Map, 0x3967, 30, 15, 2586, 0);

                    bc_Target.IsParagon        = true;
                    bc_Target.ConvertedParagon = true;

                    from.SendMessage("You transform the creature into a mighty paragon.");

                    m_ParagonWand.m_Charges--;

                    if (from.AccessLevel == AccessLevel.Player)
                    {
                        from.BeginAction(typeof(ParagonDevolveWand));

                        Timer.DelayCall(ParagonDevolveWand.UsageCooldown, delegate
                        {
                            if (from != null)
                            {
                                from.EndAction(typeof(ParagonDevolveWand));
                            }
                        });
                    }

                    if (m_ParagonWand.m_Charges == 0)
                    {
                        m_ParagonWand.Delete();
                    }
                }
            }
        public bool OnUsed( Mobile from, BaseCreature pet )
        {
            if ( m_UnderEffect.Contains( pet ) )
            {
                from.SendLocalizedMessage( 1113075 ); // Your pet is still under the effect of armor essence.
                return false;
            }
            else if ( DateTime.Now < pet.NextArmorEssence )
            {
                from.SendLocalizedMessage( 1113076 ); // Your pet is still recovering from the last armor essence it consumed.
                return false;
            }
            else
            {
                pet.SayTo( from, 1113050 ); // Your pet looks much happier.

                pet.FixedEffect( 0x375A, 10, 15 );
                pet.PlaySound( 0x1E7 );

                List<ResistanceMod> mods = new List<ResistanceMod>();

                mods.Add( new ResistanceMod( ResistanceType.Physical, 15 ) );
                mods.Add( new ResistanceMod( ResistanceType.Fire, 10 ) );
                mods.Add( new ResistanceMod( ResistanceType.Cold, 10 ) );
                mods.Add( new ResistanceMod( ResistanceType.Poison, 10 ) );
                mods.Add( new ResistanceMod( ResistanceType.Energy, 10 ) );

                for ( int i = 0; i < mods.Count; i++ )
                    pet.AddResistanceMod( mods[i] );

                m_UnderEffect.Add( pet );

                Timer.DelayCall( Duration, new TimerCallback(
                    delegate
                    {
                        for ( int i = 0; i < mods.Count; i++ )
                            pet.RemoveResistanceMod( mods[i] );

                        m_UnderEffect.Remove( pet );
                    } ) );

                pet.NextArmorEssence = DateTime.Now + Duration + Cooldown;

                Delete();

                return true;
            }
        }
Exemple #14
0
 private void ResurrectPet()
 {
     m_Follower.PlaySound(0x214);
     m_Follower.FixedEffect(0x376A, 10, 16);
     m_Follower.ResurrectPet();
 }
		public static void CheckLevel( Mobile defender, BaseCreature attacker, int count )
		{
			bool nolevel = false;
			Type typ = attacker.GetType();
			string nam = attacker.Name;

			foreach ( string check in FSATS.NoLevelCreatures )
			{
  				if ( check == nam )
    					nolevel = true;
			}

			if ( nolevel != false )
				return;

			int expgainmin, expgainmax;

			if ( attacker is BaseBioCreature || attacker is BioCreature || attacker is BioMount )
			{
			}
			else if ( defender is BaseCreature )
			{
				if ( attacker.Controlled == true && attacker.ControlMaster != null && attacker.Summoned == false )
				{
					BaseCreature bc = (BaseCreature)defender;

					expgainmin = bc.HitsMax * 25;
					expgainmax = bc.HitsMax * 50;

					int xpgain = Utility.RandomMinMax( expgainmin, expgainmax );
					
					if ( count > 1 )
						xpgain = xpgain / count;

					if ( attacker.Level <= attacker.MaxLevel - 1 )
					{
						attacker.Exp += xpgain;
						attacker.ControlMaster.SendMessage( "Your pet has gained {0} experience points.", xpgain );
					}
			
					int nextLevel = attacker.NextLevel * attacker.Level;

					if ( attacker.Exp >= nextLevel && attacker.Level <= attacker.MaxLevel - 1 )
					{
						DoLevelBonus( attacker );

						Mobile cm = attacker.ControlMaster;
						attacker.Level += 1;
						attacker.Exp = 0;
						attacker.FixedParticles( 0x373A, 10, 15, 5012, EffectLayer.Waist );
						attacker.PlaySound( 503 );
						cm.SendMessage( 38, "Your pets level has increased to {0}.", attacker.Level );

						int gain = Utility.RandomMinMax( 10, 50 );

						attacker.AbilityPoints += gain;

						if ( attacker.ControlMaster != null )
						{
							attacker.ControlMaster.SendMessage( 38, "Your pet {0} has gained some ability points.", gain );
						}

						if ( attacker.Level == 9 )
						{
							attacker.AllowMating = true;
							cm.SendMessage( 1161, "Your pet is now at the level to mate." );
						}
						if ( attacker.Evolves == true )
						{
							if ( attacker.UsesForm1 == true && attacker.F0 == true )
							{
								DoEvoCheck( attacker );

								attacker.BodyValue = attacker.Form1;
								attacker.BaseSoundID = attacker.Sound1;
								attacker.F1 = true;
								attacker.F2 = false;
								attacker.F3 = false;
								attacker.F4 = false;
								attacker.F5 = false;
								attacker.F6 = false;
								attacker.F7 = false;
								attacker.F8 = false;
								attacker.F9 = false;
								attacker.UsesForm1 = false;
								cm.SendMessage( 64, "Your pet has evoloved." );
							}
							else if ( attacker.UsesForm2 == true && attacker.F1 == true )
							{
								DoEvoCheck( attacker );

								attacker.BodyValue = attacker.Form2;
								attacker.BaseSoundID = attacker.Sound2;
								attacker.F1 = false;
								attacker.F2 = true;
								attacker.F3 = false;
								attacker.F4 = false;
								attacker.F5 = false;
								attacker.F6 = false;
								attacker.F7 = false;
								attacker.F8 = false;
								attacker.F9 = false;
								attacker.UsesForm2 = false;
								cm.SendMessage( 64, "Your pet has evoloved." );
							}
							else if ( attacker.UsesForm3 == true && attacker.F2 == true )
							{
								DoEvoCheck( attacker );

								attacker.BodyValue = attacker.Form3;
								attacker.BaseSoundID = attacker.Sound3;
								attacker.F1 = false;
								attacker.F2 = false;
								attacker.F3 = true;
								attacker.F4 = false;
								attacker.F5 = false;
								attacker.F6 = false;
								attacker.F7 = false;
								attacker.F8 = false;
								attacker.F9 = false;
								attacker.UsesForm3 = false;
								cm.SendMessage( 64, "Your pet has evoloved." );
							}
							else if ( attacker.UsesForm4 == true && attacker.F3 == true )
							{
								DoEvoCheck( attacker );

								attacker.BodyValue = attacker.Form4;
								attacker.BaseSoundID = attacker.Sound4;
								attacker.F1 = false;
								attacker.F2 = false;
								attacker.F3 = false;
								attacker.F4 = true;
								attacker.F5 = false;
								attacker.F6 = false;
								attacker.F7 = false;
								attacker.F8 = false;
								attacker.F9 = false;
								attacker.UsesForm4 = false;
								cm.SendMessage( 64, "Your pet has evoloved." );
							}
							else if ( attacker.UsesForm5 == true && attacker.F4 == true )
							{
								DoEvoCheck( attacker );

								attacker.BodyValue = attacker.Form5;
								attacker.BaseSoundID = attacker.Sound5;
								attacker.F1 = false;
								attacker.F2 = false;
								attacker.F3 = false;
								attacker.F4 = false;
								attacker.F5 = true;
								attacker.F6 = false;
								attacker.F7 = false;
								attacker.F8 = false;
								attacker.F9 = false;
								attacker.UsesForm5 = false;
								cm.SendMessage( 64, "Your pet has evoloved." );
							}
							else if ( attacker.UsesForm6 == true && attacker.F5 == true )
							{
								DoEvoCheck( attacker );

								attacker.BodyValue = attacker.Form6;
								attacker.BaseSoundID = attacker.Sound6;
								attacker.F1 = false;
								attacker.F2 = false;
								attacker.F3 = false;
								attacker.F4 = false;
								attacker.F5 = false;
								attacker.F6 = true;
								attacker.F7 = false;
								attacker.F8 = false;
								attacker.F9 = false;
								attacker.UsesForm6 = false;
								cm.SendMessage( 64, "Your pet has evoloved." );
							}
							else if ( attacker.UsesForm7 == true && attacker.F6 == true )
							{
								DoEvoCheck( attacker );

								attacker.BodyValue = attacker.Form7;
								attacker.BaseSoundID = attacker.Sound7;
								attacker.F1 = false;
								attacker.F2 = false;
								attacker.F3 = false;
								attacker.F4 = false;
								attacker.F5 = false;
								attacker.F6 = false;
								attacker.F7 = true;
								attacker.F8 = false;
								attacker.F9 = false;
								attacker.UsesForm7 = false;
								cm.SendMessage( 64, "Your pet has evoloved." );
							}
							else if ( attacker.UsesForm8 == true && attacker.F7 == true )
							{
								DoEvoCheck( attacker );

								attacker.BodyValue = attacker.Form8;
								attacker.BaseSoundID = attacker.Sound8;
								attacker.F1 = false;
								attacker.F2 = false;
								attacker.F3 = false;
								attacker.F4 = false;
								attacker.F5 = false;
								attacker.F6 = false;
								attacker.F7 = false;
								attacker.F8 = true;
								attacker.F9 = false;
								attacker.UsesForm8 = false;
								cm.SendMessage( 64, "Your pet has evoloved." );
							}
							else if ( attacker.UsesForm9 == true && attacker.F8 == true )
							{
								DoEvoCheck( attacker );

								attacker.BodyValue = attacker.Form9;
								attacker.BaseSoundID = attacker.Sound9;
								attacker.F1 = false;
								attacker.F2 = false;
								attacker.F3 = false;
								attacker.F4 = false;
								attacker.F5 = false;
								attacker.F6 = false;
								attacker.F7 = false;
								attacker.F8 = false;
								attacker.F9 = true;
								attacker.UsesForm9 = false;
								cm.SendMessage( 64, "Your pet has evoloved." );
							}	
						}
					}
				}
			}
		}
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            int index = info.ButtonID - 1;

            if (index >= 0 && index < m_Entries.Length)
            {
                SummonFamiliarEntry entry = m_Entries[index];

                double necro  = m_From.Skills[SkillName.Necromancy].Value;
                double spirit = m_From.Skills[SkillName.SpiritSpeak].Value;

                BaseCreature check = (BaseCreature)SummonFamiliarSpell.Table[m_From];

                #region Dueling
                if (m_From is PlayerMobile && ((PlayerMobile)m_From).DuelContext != null && !((PlayerMobile)m_From).DuelContext.AllowSpellCast(m_From, m_Spell))
                {
                }
                #endregion
                else if (check != null && !check.Deleted)
                {
                    m_From.SendLocalizedMessage(1061605);                       // You already have a familiar.
                }
                else if (necro < entry.ReqNecromancy || spirit < entry.ReqSpiritSpeak)
                {
                    // That familiar requires ~1_NECROMANCY~ Necromancy and ~2_SPIRIT~ Spirit Speak.
                    m_From.SendLocalizedMessage(1061606, String.Format("{0:F1}\t{1:F1}", entry.ReqNecromancy, entry.ReqSpiritSpeak));

                    m_From.CloseGump(typeof(SummonFamiliarGump));
                    m_From.SendGump(new SummonFamiliarGump(m_From, SummonFamiliarSpell.Entries, m_Spell));
                }
                else if (entry.Type == null)
                {
                    m_From.SendMessage("That familiar has not yet been defined.");

                    m_From.CloseGump(typeof(SummonFamiliarGump));
                    m_From.SendGump(new SummonFamiliarGump(m_From, SummonFamiliarSpell.Entries, m_Spell));
                }
                else
                {
                    try
                    {
                        BaseCreature bc = (BaseCreature)Activator.CreateInstance(entry.Type);

                        bc.Skills.MagicResist = m_From.Skills.MagicResist;

                        if (BaseCreature.Summon(bc, m_From, m_From.Location, -1, TimeSpan.FromDays(1.0)))
                        {
                            m_From.FixedParticles(0x3728, 1, 10, 9910, EffectLayer.Head);
                            bc.PlaySound(bc.GetIdleSound());
                            SummonFamiliarSpell.Table[m_From] = bc;
                        }
                    }
                    catch
                    {
                    }
                }
            }
            else
            {
                m_From.SendLocalizedMessage(1061825);                   // You decide not to summon a familiar.
            }
        }
Exemple #17
0
        public void Target(BaseCreature bc)
        {
            if (!Caster.CanSee(bc.Location) || !Caster.InLOS(bc))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (!IsValidTarget(bc))
            {
                Caster.SendLocalizedMessage(1074379);                   // You cannot charm that!
            }
            else if (Caster.Followers + 3 > Caster.FollowersMax)
            {
                Caster.SendLocalizedMessage(1049607);                   // You have too many followers to control that creature.
            }
            else if (bc.Allured)
            {
                Caster.SendLocalizedMessage(1074380);                   // This humanoid is already controlled by someone else.
            }
            else if (CheckSequence())
            {
                int    level = GetFocusLevel(Caster);
                double skill = Caster.Skills[CastSkill].Value;

                double chance = (skill / 150.0) + (level / 50.0);

                if (chance > Utility.RandomDouble())
                {
                    bc.ControlSlots = 3;
                    bc.Combatant    = null;

                    if (Caster.Combatant == bc)
                    {
                        Caster.Combatant = null;
                        Caster.Warmode   = false;
                    }

                    if (bc.SetControlMaster(Caster))
                    {
                        bc.PlaySound(0x5C4);
                        bc.Allured = true;

                        Container pack = bc.Backpack;

                        if (pack != null)
                        {
                            for (int i = pack.Items.Count - 1; i >= 0; --i)
                            {
                                if (i >= pack.Items.Count)
                                {
                                    continue;
                                }

                                pack.Items[i].Delete();
                            }
                        }

                        Caster.SendLocalizedMessage(1074377);                           // You allure the humanoid to follow and protect you.
                    }
                }
                else
                {
                    bc.PlaySound(0x5C5);
                    bc.ControlTarget = Caster;
                    bc.ControlOrder  = OrderType.Attack;
                    bc.Combatant     = Caster;

                    Caster.SendLocalizedMessage(1074378);                       // The humanoid becomes enraged by your charming attempt and attacks you.
                }
            }

            FinishSequence();
        }
Exemple #18
0
        public override void OnDoubleClick(Mobile from)
        {
            base.OnDoubleClick(from);

            PlayerMobile player = from as PlayerMobile;

            if (player == null)
            {
                return;
            }

            UOACZPersistance.CheckAndCreateUOACZAccountEntry(player);

            if (!UOACZSystem.IsUOACZValidMobile(player))
            {
                return;
            }

            if (player.IsUOACZHuman)
            {
                player.SendMessage("You decide against consuming this.");
                return;
            }

            if (!IsChildOf(from.Backpack))
            {
                from.SendMessage("That item must be in your pack in order to use it.");
                return;
            }

            if (DateTime.UtcNow < player.m_UOACZAccountEntry.UndeadProfile.NextUndeadItemAllowed)
            {
                string timeRemaining = Utility.CreateTimeRemainingString(DateTime.UtcNow, player.m_UOACZAccountEntry.UndeadProfile.NextUndeadItemAllowed, false, false, false, true, true);
                player.SendMessage("You may not use another undead item for " + timeRemaining + ".");

                return;
            }

            player.m_UOACZAccountEntry.UndeadProfile.NextUndeadItemAllowed = DateTime.UtcNow + TimeSpan.FromSeconds(UOACZSystem.UndeadItemCooldownSeconds);

            player.PlaySound(Utility.RandomList(0x5DA, 0x5A9, 0x5AB, 0x03A, 0x03B, 0x03C));

            TypeOfBrain brainType = m_BrainType;

            Timer.DelayCall(TimeSpan.FromSeconds(.25), delegate
            {
                switch (brainType)
                {
                case TypeOfBrain.Healing:
                    int hitsRegained = (int)(Math.Round((double)player.HitsMax * .33));
                    player.Heal(hitsRegained);

                    player.FixedParticles(0x376A, 9, 32, 5030, 0, 0, EffectLayer.Waist);
                    player.PlaySound(0x202);
                    break;

                case TypeOfBrain.Mana:
                    int manaRegained = (int)(Math.Round((double)player.ManaMax * .66));
                    player.Mana     += manaRegained;

                    player.FixedParticles(0x376A, 9, 32, 5030, 1364, 0, EffectLayer.Waist);
                    player.PlaySound(0x1EB);
                    break;

                case TypeOfBrain.SwarmHeal:
                    Queue m_Queue = new Queue();

                    foreach (BaseCreature follower in player.AllFollowers)
                    {
                        if (!UOACZSystem.IsUOACZValidMobile(follower))
                        {
                            continue;
                        }
                        if (Utility.GetDistance(player.Location, follower.Location) > 12)
                        {
                            continue;
                        }
                        if (follower.Hits == follower.HitsMax)
                        {
                            continue;
                        }

                        m_Queue.Enqueue(follower);
                    }

                    while (m_Queue.Count > 0)
                    {
                        BaseCreature follower = (BaseCreature)m_Queue.Dequeue();

                        int healingAmount = (int)(Math.Round((double)follower.HitsMax * .25));

                        follower.Heal(healingAmount);

                        follower.FixedParticles(0x376A, 9, 32, 5030, 0, 0, EffectLayer.Waist);
                        follower.PlaySound(0x202);
                    }
                    break;

                case TypeOfBrain.CooldownReduction:
                    player.FixedParticles(0x373A, 10, 15, 5036, EffectLayer.Head);
                    player.PlaySound(0x3BD);

                    foreach (UOACZUndeadAbilityEntry abilityEntry in player.m_UOACZAccountEntry.UndeadProfile.m_Abilities)
                    {
                        DateTime cooldown = abilityEntry.m_NextUsageAllowed;

                        double cooldownReduction = abilityEntry.m_CooldownMinutes * .20;

                        abilityEntry.m_NextUsageAllowed = abilityEntry.m_NextUsageAllowed.Subtract(TimeSpan.FromMinutes(cooldownReduction));
                    }

                    UOACZSystem.RefreshAllGumps(player);
                    break;
                }
            });

            Delete();
        }
        public static void FireBreathAttack(BaseCreature from, Mobile target)
        {
            if (from.FireBreathAttack < 10 || from == null || target == null)
                return;

            // Scale FireBreath Attack, IE 100 points = 100% of the standard 25% breath scaler, then drop to 75% since it later reburns them.
            // Confused yet? 100 points is equal to 75% of the damage of every other fire breathing monster.
            int damage = (int)((from.Hits * (0.01 * ((28 * from.FireBreathAttack) / 100))) * 0.75);

            from.MovingParticles(target, 0x36D4, 7, 0, false, true, 9502, 4019, 0x160);
            from.PlaySound(Core.AOS ? 0x15E : 0x44B);
            from.Say("Fire Breath");
            target.FixedParticles(0x3709, 10, 30, 5052, EffectLayer.LeftFoot);
            target.PlaySound(0x208);

            AOS.Damage(target, from, damage, 0, 0, 0, 0, 100);

            new FireBreathDOT(target, from, from.FireBreathAttack).Start();
        }
Exemple #20
0
        public static void Pause_OnCommand(CommandEventArgs e)
        {
            Pause pauseatt = (Pause)XmlAttach.FindAttachment(e.Mobile, typeof(Pause));

            if (pauseatt == null)
            {
                XmlAttach.AttachTo(e.Mobile, new Pause());

                return;
            }

            if (pauseatt.Paused == true)
            {
                pauseatt.Paused    = false;
                e.Mobile.Hidden    = false;
                e.Mobile.Paralyzed = false;
                e.Mobile.Frozen    = false;
                e.Mobile.Blessed   = false;

                if (e.Mobile.HasGump(typeof(Pausegump)))
                {
                    ;
                }
                {
                    e.Mobile.CloseGump(typeof(Pausegump));
                }


                PlayerMobile pm = (PlayerMobile)e.Mobile;
                ((PlayerMobile)pm).ClaimAutoStabledPets();
            }

            else
            {
                // region check only requires player to be about 30 steps away from the altar. this still puts them too close to the altar and could allow players to "steal" a champion spawn from another player. so I've used range check instead.
                //if (e.Mobile.Region.IsPartOf(typeof(ChampionSpawnRegion)) )
                foreach (Item item in e.Mobile.GetItemsInRange(50))                     // 50 = range.
                {
                    if (item is ChampionAltar)
                    {
                        // if you change the range above or if you use Region check instead of range, you'll want to change the message below
                        e.Mobile.SendMessage("You must be more than 50 steps away from the Champion's altar to use Pause.");
                        return;
                    }
                }
                // prevents players from using pause if they're paralyzed, frozen, holding a faction sigil, "holding" a spell target, in the middle of casting a spell, or currently attacking something.

                if (e.Mobile.Paralyzed == true || e.Mobile.Frozen == true || Factions.Sigil.ExistsOn(e.Mobile) || Server.Spells.SpellHelper.CheckCombat(e.Mobile) || e.Mobile.Spell != null || e.Mobile.Combatant != null)
                {
                    e.Mobile.SendMessage("You cannot pause at this time.");
                    return;
                }

                if (e.Mobile is PlayerMobile && (e.Mobile as PlayerMobile).DuelContext != null)
                {
                    e.Mobile.SendMessage("You cannot pause while duelling!");
                    return;
                }
                if (e.Mobile.Region.IsPartOf(typeof(Engines.ConPVP.SafeZone)))
                {
                    e.Mobile.SendMessage("You cannot pause while duelling!");
                    return;
                }
                if (pauseatt.CanPause == false)
                {
                    e.Mobile.SendMessage("Your ability to Pause has been deactivated.");
                    return;
                }

                pauseatt.Paused    = true;
                e.Mobile.Hidden    = true;
                e.Mobile.Paralyzed = true;
                e.Mobile.Frozen    = true;
                e.Mobile.Warmode   = false;
                e.Mobile.Blessed   = true;

                e.Mobile.SendGump(new Pausegump(e.Mobile));

                PlayerMobile pm = (PlayerMobile)e.Mobile;

                if (((!pm.Mounted || (pm.Mount != null && pm.Mount is EtherealMount)) && (pm.AllFollowers.Count > pm.AutoStabled.Count)) || (pm.Mounted && (pm.AllFollowers.Count > (pm.AutoStabled.Count + 1))))
                {
                    pm.AutoStablePets();                             /* autostable checks summons, et al: no need here */
                }

                for (int i = pm.AllFollowers.Count - 1; i >= 0; --i)
                {
                    BaseCreature pet = pm.AllFollowers[i] as BaseCreature;
                    if (pet.Summoned)
                    {
                        //if (pet.Map != Map)
                        //{
                        pet.PlaySound(pet.GetAngerSound());
                        Timer.DelayCall(TimeSpan.Zero, pet.Delete);
                        //}
                    }
                }
            }
        }
Exemple #21
0
        public override void Execute(CommandEventArgs e, object obj)
        {
            Mobile mob  = (Mobile)obj;
            Mobile from = e.Mobile;

            if (m_Value)
            {
                if (!mob.Alive)
                {
                    LogFailure("They are already dead.");
                }
                else if (!mob.CanBeDamaged())
                {
                    LogFailure("They cannot be harmed.");
                }
                else
                {
                    CommandLogging.WriteLine(
                        from,
                        "{0} {1} killing {2}",
                        from.AccessLevel,
                        CommandLogging.Format(from),
                        CommandLogging.Format(mob));
                    mob.Kill();

                    AddResponse("They have been killed.");
                }
            }
            else
            {
                if (mob.IsDeadBondedPet)
                {
                    BaseCreature bc = mob as BaseCreature;

                    if (bc != null)
                    {
                        CommandLogging.WriteLine(
                            from,
                            "{0} {1} resurrecting {2}",
                            from.AccessLevel,
                            CommandLogging.Format(from),
                            CommandLogging.Format(mob));

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

                        bc.ResurrectPet();

                        AddResponse("It has been resurrected.");
                    }
                }
                else if (!mob.Alive)
                {
                    CommandLogging.WriteLine(
                        from,
                        "{0} {1} resurrecting {2}",
                        from.AccessLevel,
                        CommandLogging.Format(from),
                        CommandLogging.Format(mob));

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

                    mob.Resurrect();

                    AddResponse("They have been resurrected.");
                }
                else
                {
                    LogFailure("They are not dead.");
                }
            }
        }
Exemple #22
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                from.RevealingAction();

                if (targeted is Mobile)
                {
                    if (targeted is BaseCreature)
                    {
                        BaseCreature creature = (BaseCreature)targeted;

                        if (!creature.Tamable)
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Cette créature ne peut être apprivoisée", from.NetState);                               // That creature cannot be tamed.
                        }
                        else if (creature.Controlled)
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Cet animal a déjà un maître", from.NetState);                               // That animal looks tame already.
                        }
                        else if (from.Female && !creature.AllowFemaleTamer)
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Seul un homme peut approcher cette créature", from.NetState);                               // That creature can only be tamed by males.
                        }
                        else if (!from.Female && !creature.AllowMaleTamer)
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Seule une femme peut approcher cette créature", from.NetState);                               // That creature can only be tamed by females.
                        }
                        else if (creature is CuSidhe && from.Race != Race.Elf)
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Vous ne pouvez apprivoiser cela!", from.NetState);                               // You can't tame that!
                        }
                        else if (from.Followers + creature.ControlSlots > from.FollowersMax)
                        {
                            from.SendMessage("Vous avez trop d'animaux domestiques pour en apprivoiser un nouveau");                               // You have too many followers to tame that creature.
                        }
                        else if (creature.Owners.Count >= BaseCreature.MaxOwners && !creature.Owners.Contains(from))
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Cet animal a eu suffisamment de maître dans le passé et souhaite qu'on le laisse tranquille", from.NetState); // This animal has had too many owners and is too upset for you to tame.
                        }
                        else if (MustBeSubdued(creature))
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Vous devez assujetir cette créature avant de l'apprivoiser", from.NetState);                               // You must subdue this creature before you can tame it!
                        }
                        else if (CheckMastery(from, creature) || from.Skills[SkillName.AnimalTaming].Value >= creature.MinTameSkill)
                        {
                            FactionWarHorse warHorse = creature as FactionWarHorse;

                            if (warHorse != null)
                            {
                                Faction faction = Faction.Find(from);

                                if (faction == null || faction != warHorse.Faction)
                                {
                                    creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Vous ne pouvez apprivoiser cette créature", from.NetState);                                       // You cannot tame this creature.
                                    return;
                                }
                            }

                            if (m_BeingTamed.Contains(targeted))
                            {
                                creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Quelqu'un tente déjà de l'apprivoiser", from.NetState);                                   // Someone else is already taming this.
                            }
                            else if (creature.CanAngerOnTame && 0.95 >= Utility.RandomDouble())
                            {
                                creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Vous irritez la créature!", from.NetState);                                   // You seem to anger the beast!
                                creature.PlaySound(creature.GetAngerSound());
                                creature.Direction = creature.GetDirectionTo(from);
                                if (creature.BardPacified && Utility.RandomDouble() > .24)
                                {
                                    Timer.DelayCall(TimeSpan.FromSeconds(2.0), new TimerStateCallback(ResetPacify), creature);
                                }
                                else
                                {
                                    creature.BardEndTime = DateTime.Now;
                                }

                                creature.BardPacified = false;

                                if (creature.AIObject != null)
                                {
                                    creature.AIObject.DoMove(creature.Direction);
                                }


                                if (from is PlayerMobile && !(((PlayerMobile)from).HonorActive || TransformationSpellHelper.UnderTransformation(from, typeof(EtherealVoyageSpell))))
                                {
                                    creature.Combatant = from;
                                }
                            }
                            else
                            {
                                m_BeingTamed[targeted] = from;

                                from.LocalOverheadMessage(MessageType.Emote, 0x59, false, "Vous tentez d'apprivoiser la créature");                                   // You start to tame the creature.
                                from.NonlocalOverheadMessage(MessageType.Emote, 0x59, false, "*tente d'apprivoiser une créature*");                                   // *begins taming a creature.*

                                new InternalTimer(from, creature, Utility.Random(3, 2)).Start();

                                m_SetSkillTime = false;
                            }
                        }
                        else
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Vous n'avez aucune chance d'apprivoiser cette créature", from.NetState);                               // You have no chance of taming this creature.
                        }
                    }
                    else
                    {
                        ((Mobile)targeted).PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Cela ne peut être apprivoisé", from.NetState);                           // That being cannot be tamed.
                    }
                }
                else
                {
                    from.SendMessage("Vous ne pouvez apprivoiser cela!");                       // You can't tame that!
                }
            }
Exemple #23
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            int index = info.ButtonID - 1;

            if (index >= 0 && index < m_Entries.Length)
            {
                SummonFamiliarEntry entry = m_Entries[index];

                double necro  = m_From.Skills[SkillName.ArtMagique].Base;
                double spirit = m_From.Skills[SkillName.Animisme].Base;

                //BaseCreature check = (BaseCreature)SummonFamiliarSpell.Table[m_From];

                /*if ( check != null && !check.Deleted )
                 * {
                 *      m_From.SendLocalizedMessage( 1061605 ); // You already have a familiar.
                 * }*/
                if (necro < entry.ReqNecromancy || spirit < entry.ReqSpiritSpeak)
                {
                    // That familiar requires ~1_NECROMANCY~ Necromancy and ~2_SPIRIT~ Spirit Speak.
                    m_From.SendLocalizedMessage(1061606, String.Format("{0:F1}\t{1:F1}", entry.ReqNecromancy, entry.ReqSpiritSpeak));

                    m_From.CloseGump(typeof(SummonFamiliarGump));
                    m_From.SendGump(new SummonFamiliarGump(m_From, SummonFamiliarSpell.Entries));
                }
                else if (entry.Type == null)
                {
                    m_From.SendMessage("That familiar has not yet been defined.");

                    m_From.CloseGump(typeof(SummonFamiliarGump));
                    m_From.SendGump(new SummonFamiliarGump(m_From, SummonFamiliarSpell.Entries));
                }
                else
                {
                    try
                    {
                        BaseCreature bc = (BaseCreature)Activator.CreateInstance(entry.Type);

                        //bc.Skills.Concentration = m_From.Skills.Concentration;

                        if (m_From is PlayerMobile)
                        {
                            PlayerMobile tmob = (PlayerMobile)m_From;

                            double duration = (2 * m_From.Skills.Animisme.Fixed) / 5;

                            if (BaseCreature.Summon(bc, m_From, m_From.Location, -1, TimeSpan.FromMinutes(duration)))
                            {
                                Effects.SendTargetParticles(m_From, 0x3728, 1, 10, 9910, EffectLayer.Head);
                                bc.PlaySound(bc.GetIdleSound());
                                SummonFamiliarSpell.Table[m_From] = bc;

                                /*if( m_From is PlayerMobile )
                                 *  CombatManager.get().ConfigureCreature(bc,
                                 *      Math.Max(1, ((PlayerMobile)m_From).Niveau - 3 ));*/

                                //Console.WriteLine("{0} damage {1}:{2} speed:{3}", bc.Name, bc.DamageMin, bc.DamageMax, bc.AttackSpeed);
                            }
                        }
                    }
                    catch
                    {
                    }
                }
            }
            else
            {
                m_From.SendLocalizedMessage(1061825);                   // You decide not to summon a familiar.
            }
        }
Exemple #24
0
        public void Target(Mobile m)
        {
            //STARTMOD
            if (m is BaseCreature)
            {
                BaseCreature m_Pet = (BaseCreature)m;

                if (m_Pet.IsDeadBondedPet)
                {
                    m_Pet.PlaySound(0x214);
                    m_Pet.FixedEffect(0x376A, 10, 16);
                    m_Pet.ResurrectPet();
                    Misc.Titles.AwardFame(Caster, 500, true);
                    return;
                }
            }
            //ENDMOD

            if (!Caster.CanSee(m))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (m == Caster)
            {
                Caster.SendLocalizedMessage(501039);                   // Thou can not resurrect thyself.
            }
            else if (!Caster.Alive)
            {
                Caster.SendLocalizedMessage(501040);                   // The resurrecter must be alive.
            }
            else if (m.Alive)
            {
                Caster.SendLocalizedMessage(501041);                   // Target is not dead.
            }
            else if (!Caster.InRange(m, 1))
            {
                Caster.SendLocalizedMessage(501042);                   // Target is not close enough.
            }
            else if (!m.Player)
            {
                Caster.SendLocalizedMessage(501043);                   // Target is not a being.
            }
            else if (m.Map == null || !m.Map.CanFit(m.Location, 16, false, false))
            {
                Caster.SendLocalizedMessage(501042);              // Target can not be resurrected at that location.
                m.SendLocalizedMessage(502391);                   // Thou can not be resurrected there!
            }
            else if (m.Region != null && m.Region.Name == "Khaldun")
            {
                Caster.SendLocalizedMessage(1010395);                   // The veil of death in this area is too strong and resists thy efforts to restore life.
            }
            else if (CheckBSequence(m, true))
            {
                SpellHelper.Turn(Caster, m);

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

                TAVUtilities.FindCorpse(m);

                if (Caster is TeiravonMobile)
                {
                    TeiravonMobile TAV = (TeiravonMobile)Caster;

                    int expTo = m.HitsMax * TAV.PlayerLevel / 2;

                    if (TAV.HasFeat(TeiravonMobile.Feats.HealersOath))
                    {
                        expTo *= 3;
                    }

                    if (Misc.Titles.AwardExp(TAV, expTo))
                    {
                        TAV.SendMessage("You have gained {0} experience.", expTo);
                    }
                    Misc.Titles.AwardFame(Caster, (int)(m.Fame * .1), true);
                }

                m.Resurrect();
                Misc.Titles.AwardFame(m, -(int)(m.Fame * .1), true);
            }

            FinishSequence();
        }
Exemple #25
0
        public override void OnDoubleClick(Mobile m)
        {
            if (m_TalismanType == TalismanType.None)
            {
                return;
            }

            if (this.Parent != m)
            {
                m.SendLocalizedMessage(502641);                   // You must equip this item to use it.
            }
            else if (m_ChargeTimeLeft > 0)
            {
                int tmptime = (m_ChargeTimeLeft2 - (DateTime.Now.Second - m_ChargeTimeLeft3.Second) + 1);

                if (tmptime > (m_ChargeTimeLeft2 + 1))
                {
                    tmptime -= 60;
                }
                if (tmptime > m_ChargeTimeLeft2)
                {
                    tmptime = m_ChargeTimeLeft2;
                }

                m.SendLocalizedMessage(1074882, tmptime.ToString());                   // You must wait ~1_val~ seconds for this to recharge.
            }
            else if (m_Charges == 0)
            {
                m.SendLocalizedMessage(501250);                   // This magic item is out of charges.
            }
            else
            {
                if ((int)m_TalismanType <= 4)
                {
                    //Removal
                    m.Target = new InternalTarget(this);
                }
                //Mana Phase
                else if (m_TalismanType == TalismanType.ManaPhase)
                {
                    ManaPhase.OnUse(m, this);
                }
                else if ((int)m_TalismanType >= 9)
                {
                    //Summon creature
                    BaseCreature bc = (BaseCreature)Activator.CreateInstance(SummonEntry.GetNPC(m_TalismanType));
                    if (BaseCreature.Summon(bc, m, m.Location, -1, TimeSpan.FromMinutes(10.0)))
                    {
                        bc.FixedParticles(0x3728, 1, 10, 9910, EffectLayer.Head);
                        bc.PlaySound(bc.GetIdleSound());
                        m_SummonedCreature = bc;
                        m_Charges--;
                        InvalidateProperties();
                        ChargeTimeLeft = 1800;
                        m_ChargeTimer  = new ChargeTimeLeftTimer(this);
                        m_ChargeTimer.Start();
                        m_ChargeTimeLeft3 = DateTime.Now;
                    }
                }
                else if (m_TalismanType == TalismanType.SummonRandom)
                {
                    //Summon Random
                    TalismanType tmpbc = SummonEntry.GetRandom();
                    BaseCreature bc    = (BaseCreature)Activator.CreateInstance(SummonEntry.GetNPC(tmpbc));
                    if (BaseCreature.Summon(bc, m, m.Location, -1, TimeSpan.FromMinutes(10.0)))
                    {
                        bc.FixedParticles(0x3728, 1, 10, 9910, EffectLayer.Head);
                        bc.PlaySound(bc.GetIdleSound());
                        m_SummonedCreature = bc;
                        m_Charges--;
                        InvalidateProperties();
                        ChargeTimeLeft = 1800;
                        m_ChargeTimer  = new ChargeTimeLeftTimer(this);
                        m_ChargeTimer.Start();
                        m_ChargeTimeLeft3 = DateTime.Now;
                    }
                }
                else
                {
                    Item summonitem;
                    int  message;

                    // Summon item
                    if (m_TalismanType == TalismanType.SummonBandage)
                    {
                        summonitem        = new Bandage(10);
                        summonitem.ItemID = 0x0EE9;
                        summonitem.Hue    = 0xA3;
                        message           = 1075002;               // You have been given some clean bandages.
                    }
                    else if (m_TalismanType == TalismanType.SummonBoard)
                    {
                        summonitem     = new Board(10);
                        summonitem.Hue = 0xA3;
                        message        = 1075000; // You have been given some wooden boards.
                    }
                    else                          // if ( m_TalismanType == TalismanType.SummonIngot )
                    {
                        summonitem     = new IronIngot(10);
                        summonitem.Hue = 0xA3;
                        message        = 1075001;                  // You have been given some ingots.
                    }

                    m.AddToBackpack(summonitem);
                    m.SendLocalizedMessage(message);

                    m_Charges--;
                    InvalidateProperties();
                    ChargeTimeLeft = 60;

                    m_ChargeTimer = new ChargeTimeLeftTimer(this);
                    m_ChargeTimer.Start();
                    m_ChargeTimeLeft3 = DateTime.Now;
                }
            }
        }
Exemple #26
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            int index = info.ButtonID - 1;

            if (index >= 0 && index < m_Entries.Length)
            {
                SummonFamiliarEntry entry = m_Entries[index];

                double necro  = m_From.Skills.Necromancy.Value;
                double spirit = m_From.Skills.SpiritSpeak.Value;

                #region Dueling
                if ((m_From as PlayerMobile)?.DuelContext?.AllowSpellCast(m_From, m_Spell) == false)
                {
                }
                #endregion
                else if (SummonFamiliarSpell.Table.TryGetValue(m_From, out BaseCreature check) && check?.Deleted == false)
                {
                    m_From.SendLocalizedMessage(1061605); // You already have a familiar.
                }
                else if (necro < entry.ReqNecromancy || spirit < entry.ReqSpiritSpeak)
                {
                    // That familiar requires ~1_NECROMANCY~ Necromancy and ~2_SPIRIT~ Spirit Speak.
                    m_From.SendLocalizedMessage(1061606, $"{entry.ReqNecromancy:F1}\t{entry.ReqSpiritSpeak:F1}");

                    m_From.CloseGump <SummonFamiliarGump>();
                    m_From.SendGump(new SummonFamiliarGump(m_From, SummonFamiliarSpell.Entries, m_Spell));
                }
                else if (entry.Type == null)
                {
                    m_From.SendMessage("That familiar has not yet been defined.");

                    m_From.CloseGump <SummonFamiliarGump>();
                    m_From.SendGump(new SummonFamiliarGump(m_From, SummonFamiliarSpell.Entries, m_Spell));
                }
                else
                {
                    try
                    {
                        BaseCreature bc = (BaseCreature)Activator.CreateInstance(entry.Type);

                        // TODO: Is this right?
                        bc.Skills.MagicResist.Base = m_From.Skills.MagicResist.Base;

                        if (BaseCreature.Summon(bc, m_From, m_From.Location, -1, TimeSpan.FromDays(1.0)))
                        {
                            m_From.FixedParticles(0x3728, 1, 10, 9910, EffectLayer.Head);
                            bc.PlaySound(bc.GetIdleSound());
                            SummonFamiliarSpell.Table[m_From] = bc;
                        }
                    }
                    catch
                    {
                        // ignored
                    }
                }
            }
            else
            {
                m_From.SendLocalizedMessage(1061825); // You decide not to summon a familiar.
            }
        }
Exemple #27
0
        public bool OnUsed( Mobile from, BaseCreature pet )
        {
            if ( pet.GetStatMod( "[Tasty Treat] Str" ) != null )
            {
                from.SendLocalizedMessage( 1113051 ); // Your pet is still enjoying the last tasty treat!
                return false;
            }
            else if ( DateTime.Now < pet.NextTastyTreat )
            {
                from.SendLocalizedMessage( 1113049 ); // Your pet is still recovering from the last tasty treat.
                return false;
            }
            else
            {
                pet.SayTo( from, 1113050 ); // Your pet looks much happier.

                pet.FixedEffect( 0x375A, 10, 15 );
                pet.PlaySound( 0x1E7 );

                AddEffect( pet );

                pet.NextTastyTreat = DateTime.Now + Duration + Cooldown;

                if ( this.Amount > 1 )
                {
                    this.Amount -= 1;
                    from.Backpack.DropItem( this );
                }
                else
                {
                    Delete();
                }

                return true;
            }
        }
Exemple #28
0
        public void Target(object o)
        {
            if (o is Item)
            {
                Item targ = (Item)o;

                if (targ is LockableContainer)
                {
                    LockableContainer box = (LockableContainer)targ;
                    if (Multis.BaseHouse.CheckLockedDownOrSecured(box))
                    {
                        // You cannot cast this on a locked down item.
                        Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 501761);
                    }
                    else if (box.Locked || box.LockLevel == 0 || box is ParagonChest)
                    {
                        // Target must be an unlocked chest.
                        Caster.SendLocalizedMessage(501762);
                    }
                    else if (CheckSequence())
                    {
                        SpellHelper.Turn(Caster, box);

                        Point3D loc = box.GetWorldLocation();

                        Effects.SendLocationParticles(
                            EffectItem.Create(loc, box.Map, EffectItem.DefaultDuration),
                            0x376A, 9, 32, Server.Items.CharacterDatabase.GetMySpellHue(Caster, 0), 0, 5020, 0);

                        Effects.PlaySound(loc, box.Map, 0x1FA);

                        // The chest is now locked!
                        Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 501763);

                        box.LockLevel = (int)(Caster.Skills[SkillName.Magery].Value);
                        if (box.LockLevel > 90)
                        {
                            box.LockLevel = 90;
                        }
                        if (box.LockLevel < 0)
                        {
                            box.LockLevel = 0;
                        }
                        box.MaxLockLevel  = box.LockLevel + 20;
                        box.RequiredSkill = box.LockLevel;

                        //box.LockLevel = -255; // signal magic lock
                        box.Locked = true;
                    }
                }
                else if (targ is BaseDoor)
                {
                    BaseDoor door = (BaseDoor)targ;
                    if (Server.Items.DoorType.IsDungeonDoor(door))
                    {
                        if (door.Locked == true)
                        {
                            Caster.SendMessage("That door is already locked!");
                        }
                        else
                        {
                            SpellHelper.Turn(Caster, door);

                            Point3D loc = door.GetWorldLocation();

                            Effects.SendLocationParticles(
                                EffectItem.Create(loc, door.Map, EffectItem.DefaultDuration),
                                0x376A, 9, 32, Server.Items.CharacterDatabase.GetMySpellHue(Caster, 0), 0, 5020, 0);

                            Effects.PlaySound(loc, door.Map, 0x1FA);

                            Caster.SendMessage("That door is now locked!");

                            door.Locked = true;
                            Server.Items.DoorType.LockDoors(door);

                            new InternalTimer(door, Caster).Start();
                        }
                    }
                    else
                    {
                        Caster.SendMessage("This spell has no effect on that!");
                    }
                }
                else
                {
                    Caster.SendMessage("This spell has no effect on that!");
                }
            }
            else if (o is PlayerMobile)
            {
                Caster.SendMessage("That soul seems too strong to trap in the flask!");
            }
            else if (o is BaseCreature)
            {
                BaseCreature bc = (BaseCreature)o;

                if (!bc.Alive)
                {
                    Caster.SendMessage("You cannot trap something that is dead!");
                }
                else if (bc.Controlled is LockedCreature)
                {
                    Caster.SendMessage("That creature cannot be trapped again!");
                }
                else if (bc.Controlled == true)
                {
                    Caster.SendMessage("That is under the control of another!");
                }
                else if (bc.EmoteHue == 505 || bc.ControlSlots >= 100)                   // SUMMON QUEST AND QUEST MONSTERS
                {
                    Server.Misc.IntelligentAction.FizzleSpell(Caster);
                    Caster.SendMessage("You are not powerful enough to trap that!");
                }
                else if (Caster.Backpack.FindItemByType(typeof(IronFlask)) == null)
                {
                    Caster.SendMessage("You need an empty iron flask to trap them!");
                }
                else
                {
                    int level  = Server.Misc.DifficultyLevel.GetCreatureLevel((Mobile)o) + 10;
                    int magery = (int)(Caster.Skills[SkillName.Magery].Value);

                    if (magery >= level)
                    {
                        int success = 10 + (magery - level);

                        if (Utility.RandomMinMax(1, 100) > success)
                        {
                            Server.Misc.IntelligentAction.FizzleSpell(Caster);
                            Caster.SendMessage("You fail to trap them in the flask!");
                        }
                        else
                        {
                            Item flask = Caster.Backpack.FindItemByType(typeof(IronFlask));
                            if (flask != null)
                            {
                                flask.Consume();
                            }

                            Caster.SendMessage("You trap " + bc.Name + " in the flask!");

                            IronFlaskFilled bottle = new IronFlaskFilled();

                            int hitpoison = 0;

                            if (bc.HitPoison == Poison.Lesser)
                            {
                                hitpoison = 1;
                            }
                            else if (bc.HitPoison == Poison.Regular)
                            {
                                hitpoison = 2;
                            }
                            else if (bc.HitPoison == Poison.Greater)
                            {
                                hitpoison = 3;
                            }
                            else if (bc.HitPoison == Poison.Deadly)
                            {
                                hitpoison = 4;
                            }
                            else if (bc.HitPoison == Poison.Lethal)
                            {
                                hitpoison = 5;
                            }

                            int immune = 0;

                            if (bc.PoisonImmune == Poison.Lesser)
                            {
                                immune = 1;
                            }
                            else if (bc.PoisonImmune == Poison.Regular)
                            {
                                immune = 2;
                            }
                            else if (bc.PoisonImmune == Poison.Greater)
                            {
                                immune = 3;
                            }
                            else if (bc.PoisonImmune == Poison.Deadly)
                            {
                                immune = 4;
                            }
                            else if (bc.PoisonImmune == Poison.Lethal)
                            {
                                immune = 5;
                            }

                            bottle.TrappedName        = bc.Name;
                            bottle.TrappedTitle       = bc.Title;
                            bottle.TrappedBody        = bc.Body;
                            bottle.TrappedBaseSoundID = bc.BaseSoundID;
                            bottle.TrappedHue         = bc.Hue;

                            // TURN HUMANOIDS TO GHOSTS SO I DON'T NEED TO WORRY ABOUT CLOTHES AND GEAR
                            if (bc.Body == 400 || bc.Body == 401 || bc.Body == 605 || bc.Body == 606)
                            {
                                bottle.TrappedBody        = 0x3CA;
                                bottle.TrappedHue         = 0x9C4;
                                bottle.TrappedBaseSoundID = 0x482;
                            }

                            bottle.TrappedAI = 2; if (bc.AI == AIType.AI_Mage)
                            {
                                bottle.TrappedAI = 1;
                            }
                            bottle.TrappedStr          = bc.RawStr;
                            bottle.TrappedDex          = bc.RawDex;
                            bottle.TrappedInt          = bc.RawInt;
                            bottle.TrappedHits         = bc.HitsMax;
                            bottle.TrappedStam         = bc.StamMax;
                            bottle.TrappedMana         = bc.ManaMax;
                            bottle.TrappedDmgMin       = bc.DamageMin;
                            bottle.TrappedDmgMax       = bc.DamageMax;
                            bottle.TrappedColdDmg      = bc.ColdDamage;
                            bottle.TrappedEnergyDmg    = bc.EnergyDamage;
                            bottle.TrappedFireDmg      = bc.FireDamage;
                            bottle.TrappedPhysicalDmg  = bc.PhysicalDamage;
                            bottle.TrappedPoisonDmg    = bc.PoisonDamage;
                            bottle.TrappedColdRst      = bc.ColdResistSeed;
                            bottle.TrappedEnergyRst    = bc.EnergyResistSeed;
                            bottle.TrappedFireRst      = bc.FireResistSeed;
                            bottle.TrappedPhysicalRst  = bc.PhysicalResistanceSeed;
                            bottle.TrappedPoisonRst    = bc.PoisonResistSeed;
                            bottle.TrappedVirtualArmor = bc.VirtualArmor;
                            bottle.TrappedCanSwim      = bc.CanSwim;
                            bottle.TrappedCantWalk     = bc.CantWalk;
                            bottle.TrappedSkills       = level + 5;
                            bottle.TrappedPoison       = hitpoison;
                            bottle.TrappedImmune       = immune;
                            bottle.TrappedAngerSound   = bc.GetAngerSound();
                            bottle.TrappedIdleSound    = bc.GetIdleSound();
                            bottle.TrappedDeathSound   = bc.GetDeathSound();
                            bottle.TrappedAttackSound  = bc.GetAttackSound();
                            bottle.TrappedHurtSound    = bc.GetHurtSound();

                            Caster.BoltEffect(0);
                            Caster.PlaySound(0x665);

                            Caster.AddToBackpack(bottle);

                            bc.BoltEffect(0);
                            bc.PlaySound(0x665);
                            bc.Delete();
                        }
                    }
                    else
                    {
                        Server.Misc.IntelligentAction.FizzleSpell(Caster);
                        Caster.SendMessage("You are not powerful enough to trap that!");
                    }
                }
            }

            FinishSequence();
        }
Exemple #29
0
 public override void OnClick()
 {
     m_Creature.PlaySound(0x214);
     m_Creature.FixedEffect(0x376A, 10, 16);
     m_Creature.ResurrectPet();
 }
Exemple #30
0
        protected override void OnTarget(object o)
        {
            BaseCreature bc = o as BaseCreature;

            if (bc == null || !Caster.CanSee(bc.Location) || !Caster.InLOS(bc))
            {
                Caster.SendLocalizedMessage(500237); // Target can not be seen.
            }
            else if (ValidateTarget(bc))
            {
                if (Caster.Followers + 2 > Caster.FollowersMax)
                {
                    Caster.SendLocalizedMessage(1049607); // You have too many followers to control that creature.
                }
                else if (bc.Controlled || bc.Summoned)
                {
                    Caster.SendLocalizedMessage(1156015); // You cannot command that!
                }
                else if (CheckSequence())
                {
                    double difficulty = Items.BaseInstrument.GetBaseDifficulty(bc);
                    double skill      = ((Caster.Skills[CastSkill].Value + Caster.Skills[DamageSkill].Value) / 2) + (GetMasteryLevel() * 3) + 1;

                    double chance = (skill - (difficulty - 25)) / ((difficulty + 25) - (difficulty - 25));

                    if (chance >= Utility.RandomDouble())
                    {
                        bc.ControlSlots = 2;
                        bc.Combatant    = null;

                        if (Caster.Combatant == bc)
                        {
                            Caster.Combatant = null;
                            Caster.Warmode   = false;
                        }

                        if (bc.SetControlMaster(Caster))
                        {
                            bc.PlaySound(0x5C4);
                            bc.Allured = true;

                            Container pack = bc.Backpack;

                            if (pack != null)
                            {
                                for (int i = pack.Items.Count - 1; i >= 0; --i)
                                {
                                    if (i >= pack.Items.Count)
                                    {
                                        continue;
                                    }

                                    pack.Items[i].Delete();
                                }
                            }

                            if (bc is SkeletalDragon)
                            {
                                Server.Engines.Quests.Doom.BellOfTheDead.TryRemoveDragon((SkeletalDragon)bc);
                            }

                            Caster.PlaySound(0x5C4);
                            Caster.SendLocalizedMessage(1156013); // You command the undead to follow and protect you.
                        }
                    }
                    else
                    {
                        Caster.SendLocalizedMessage(1156014); // The undead becomes enraged by your command attempt and attacks you.
                    }
                }
            }
            else
            {
                Caster.SendLocalizedMessage(1156015); // You cannot command that!
            }
            //FinishSequence();
        }
Exemple #31
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                from.RevealingAction();

                if (targeted is Mobile)
                {
                    if (targeted is BaseCreature)
                    {
                        BaseCreature creature = (BaseCreature)targeted;

                        if (!creature.Tamable)
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, true, "That creature cannot be tamed.", from.NetState);                               // That creature cannot be tamed.
                        }
                        else if (creature.Controlled)
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, true, "That animal looks tame already.", from.NetState);                               // That animal looks tame already.
                        }
                        else if (from.Female && !creature.AllowFemaleTamer)
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049653, from.NetState);                               // That creature can only be tamed by males.
                        }
                        else if (!from.Female && !creature.AllowMaleTamer)
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049652, from.NetState);                               // That creature can only be tamed by females.
                        }
                        else if (from.Followers + creature.ControlSlots > from.FollowersMax)
                        {
                            from.SendLocalizedMessage(1049611);                               // You have too many followers to tame that creature.
                        }
                        else if (creature.Owners.Count >= BaseCreature.MaxOwners && !creature.Owners.Contains(from))
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, true, "This animal has had too many owners and is too upset for you to tame.", from.NetState);                               // This animal has had too many owners and is too upset for you to tame.
                        }
                        else if (MustBeSubdued(creature))
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, true, "You must subdue this creature before you can tame it!", from.NetState);                               // You must subdue this creature before you can tame it!
                        }
                        else if (CheckMastery(from, creature) || from.Skills[SkillName.AnimalTaming].Value >= creature.MinTameSkill)
                        {
                            FactionWarHorse warHorse = creature as FactionWarHorse;

                            if (warHorse != null)
                            {
                                Faction faction = Faction.Find(from);

                                if (faction == null || faction != warHorse.Faction)
                                {
                                    creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, true, "You cannot tame this creature.", from.NetState);                                       // You cannot tame this creature.
                                    return;
                                }
                            }

                            if (m_BeingTamed.Contains(targeted))
                            {
                                creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, true, "Someone else is already taming this.", from.NetState);                                   // Someone else is already taming this.
                            }
                            else if (creature.CanAngerOnTame && 0.95 >= Utility.RandomDouble())
                            {
                                creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, true, "You seem to anger the beast!", from.NetState);                                   // You seem to anger the beast!
                                creature.PlaySound(creature.GetAngerSound());
                                creature.Direction = creature.GetDirectionTo(from);
                                creature.Combatant = from;
                            }
                            else
                            {
                                m_BeingTamed[targeted] = from;

                                from.LocalOverheadMessage(MessageType.Emote, 0x59, true, String.Format("*You start to tame {0}.*", creature.Name));               // You start to tame the creature.
                                from.NonlocalOverheadMessage(MessageType.Emote, 0x59, true, String.Format("*{0} starts to tame {1}*", from.Name, creature.Name)); // *begins taming a creature.*

                                new InternalTimer(from, creature, 3).Start();

                                m_SetSkillTime = false;
                            }
                        }
                        else
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, true, "You have no chance of taming this creature.", from.NetState);                               // You have no chance of taming this creature.
                        }
                    }
                    else
                    {
                        ((Mobile)targeted).PrivateOverheadMessage(MessageType.Regular, 0x3B2, true, "That being cannot be tamed.", from.NetState);                           // That being cannot be tamed.
                    }
                }
                else
                {
                    from.SendAsciiMessage("You can't tame that!");                       // You can't tame that!
                }
            }
            protected override void OnTarget(Mobile from, object targeted)
            {
                PlayerMobile pm = from as PlayerMobile;

                if (this.m_Tasty.Deleted)
                {
                    return;
                }

                if (targeted is BaseCreature)
                {
                    BaseCreature creature = (BaseCreature)targeted;

                    if ((creature.Controlled || creature.Summoned) && (from == creature.ControlMaster) && !(creature.Asleep))
                    {
                        creature.FixedParticles(0x373A, 10, 15, 5018, EffectLayer.Waist);
                        creature.PlaySound(0x1EA);

                        ResistanceMod mod  = new ResistanceMod(ResistanceType.Physical, +15);
                        ResistanceMod mod1 = new ResistanceMod(ResistanceType.Fire, +10);
                        ResistanceMod mod2 = new ResistanceMod(ResistanceType.Cold, +10);
                        ResistanceMod mod3 = new ResistanceMod(ResistanceType.Poison, +10);
                        ResistanceMod mod4 = new ResistanceMod(ResistanceType.Energy, +10);
                        creature.AddResistanceMod(mod);
                        creature.AddResistanceMod(mod1);
                        creature.AddResistanceMod(mod2);
                        creature.AddResistanceMod(mod3);
                        creature.AddResistanceMod(mod4);

                        from.SendMessage("You have increased the Damage Absorption of your pet by 10% for 10 Minutes !!");
                        this.m_Tasty.m_Used = true;
                        creature.Asleep     = true;

                        Timer.DelayCall(TimeSpan.FromMinutes(10.0), delegate()
                        {
                            ResistanceMod mod5 = new ResistanceMod(ResistanceType.Physical, -15);
                            ResistanceMod mod6 = new ResistanceMod(ResistanceType.Fire, -10);
                            ResistanceMod mod7 = new ResistanceMod(ResistanceType.Cold, -10);
                            ResistanceMod mod8 = new ResistanceMod(ResistanceType.Poison, -10);
                            ResistanceMod mod9 = new ResistanceMod(ResistanceType.Energy, -10);
                            creature.AddResistanceMod(mod5);
                            creature.AddResistanceMod(mod6);
                            creature.AddResistanceMod(mod7);
                            creature.AddResistanceMod(mod8);
                            creature.AddResistanceMod(mod9);
                            creature.PlaySound(0x1EB);

                            this.m_Tasty.m_Used = true;
                            creature.Asleep     = false;
                            from.SendMessage("The effect of Vial of Armor Essence is finish !");

                            Timer.DelayCall(TimeSpan.FromMinutes(120.0), delegate()
                            {
                                this.m_Tasty.m_Used = false;
                            });
                        });
                    }
                    else if ((creature.Controlled || creature.Summoned) && (from == creature.ControlMaster) && (creature.Asleep))
                    {
                        from.SendMessage("Pet already under the influence of Vial of Armor Essence !");
                    }
                    else
                    {
                        from.SendLocalizedMessage(1113049);
                    }
                }
                else
                {
                    from.SendLocalizedMessage(500329);
                }
            }
        public static void LevelUp( BaseCreature player )
        {
            player.NextLevel += ( player.Level + 1 ) * (5000 / player.XPScale);
            player.Level++;

            if( player.Level % 2 != 0 )
                player.DamageMin++;

            else
                player.DamageMax++;

            double i = 0.5 * player.SkillScale;

            if (player is Serpent)
            {
                player.RawStr += player.StatScale;
                player.RawDex += player.StatScale;
                player.RawStam += player.StatScale;
                player.RawMana += player.StatScale;

                if (player.XPScale == 1)
                {
                    player.RawInt += 1;
                    player.RawHits += 1;
                }
                else
                {
                    player.RawInt += (player.StatScale / 2);
                    player.RawHits += (player.StatScale / 2);
                }
            }
            else if (player is BirdOfPrey)
            {
                if (player.StatScale == 1)
                {
                    player.RawStr += 1;
                    player.RawHits += 1;
                }
                else
                {
                    player.RawStr += (player.StatScale / 2);
                    player.RawHits += (player.StatScale / 2);
                }

                player.RawDex += (int)(player.StatScale * Utility.RandomMinMax(1,2));
                player.RawInt += player.StatScale;
                player.RawStam += player.StatScale;
                player.RawMana += player.StatScale;
            }
            else if (player is Bear)
            {
                int statBonus = Utility.Random(player.StatScale);
                int armorBonus = Utility.Random(5);

                if (player.XPScale == 1)
                {
                    player.RawStr += 1;
                    player.RawDex += Utility.Random(2);
                }
                else
                {
                    player.RawStr += (player.StatScale / 2);
                    player.RawDex += ((player.StatScale - (statBonus + 1)) / 2);
                }

                player.RawInt += (player.StatScale - statBonus);
                player.RawHits += (player.StatScale + (statBonus + 1));
                player.RawStam += (player.StatScale + statBonus);
                player.RawMana += (player.StatScale / 2);

                if (armorBonus == 0)
                    player.BluntResistSeed += (player.StatScale - 1);
                else if (armorBonus == 1)
                    player.SlashingResistSeed += (player.StatScale - 1);
                else if (armorBonus == 2)
                    player.PiercingResistSeed += (player.StatScale - 1);
                else if (armorBonus == 3)
                {
                    player.PoisonResistSeed += (player.StatScale - 1);
                    player.EnergyResistSeed += (player.StatScale - 1);
                }
                else
                {
                    if (player.Level % 2 != 0)
                        player.DamageMin--;
                    else
                        player.DamageMax--;
                }
            }
            else if (player is Mercenary)
            {
                int statUpgrade = Utility.RandomMinMax(1, 4);

                switch (statUpgrade)
                {
                    case 1:
                        {
                            player.RawStr += player.StatScale;
                            player.RawDex += Utility.RandomMinMax(1, player.StatScale);
                            player.RawInt += 1;
                            player.RawHits += Utility.RandomMinMax(1, player.StatScale);
                            player.RawStam += Utility.RandomMinMax(1, player.StatScale);
                            break;
                        }
                    case 2:
                        {
                            player.RawStr += Utility.RandomMinMax(1, player.StatScale);
                            player.RawDex += player.StatScale;
                            player.RawInt += 1;
                            player.RawHits += Utility.RandomMinMax(1, player.StatScale);
                            player.RawStam += Utility.RandomMinMax(1, player.StatScale);
                            break;
                        }
                    case 3:
                        {
                            player.RawStr += Utility.RandomMinMax(1, player.StatScale);
                            player.RawDex += Utility.RandomMinMax(1, player.StatScale);
                            player.RawInt += 1;
                            player.RawHits += player.StatScale;
                            player.RawStam += Utility.RandomMinMax(1, player.StatScale);
                            break;
                        }
                    case 4:
                        {
                            player.RawStr += Utility.RandomMinMax(1, player.StatScale);
                            player.RawDex += Utility.RandomMinMax(1, player.StatScale);
                            player.RawInt += 1;
                            player.RawHits += Utility.RandomMinMax(1, player.StatScale);
                            player.RawStam += player.StatScale;
                            break;
                        }
                }

                if (player.ControlMaster != null)
                {
                    switch (((PlayerMobile)player.ControlMaster).Nation)
                    {
                        case Nation.Alyrian: { if (Utility.RandomBool()) player.RawDex += Utility.Random(player.StatScale); else player.RawInt += Utility.Random(player.StatScale); break; }
                        case Nation.Azhuran: { player.RawDex += Utility.Random(player.StatScale); break; }
                        case Nation.Khemetar: { player.RawInt += Utility.Random(player.StatScale); break; }
                        case Nation.Mhordul: { player.RawStr += Utility.Random(player.StatScale); break; }
                        case Nation.Tyrean: { if (Utility.RandomBool()) player.RawStr += Utility.Random(player.StatScale); else player.RawStam += Utility.Random(player.StatScale); break; }
                        case Nation.Vhalurian: { player.RawHits += Utility.Random(player.StatScale); break; }
                    }
                }
            }
            else
            {
                player.RawStr += player.StatScale;
                player.RawDex += player.StatScale;
                player.RawInt += player.StatScale;
                player.RawHits += player.StatScale;
                player.RawStam += player.StatScale;
                player.RawMana += player.StatScale;
            }

            if( player is Dragon )
            {
                if( player.Level > 19 && player.BodyValue == 61 )
                {
                    Gold newloot = new Gold( Utility.RandomMinMax( 1, 3 ) );
                    Container pack = player.Backpack;

                    if( pack != null )
                        pack.DropItem( newloot );

                    player.BodyValue = 59;
                }

                if( player.Level > 38 && player.BodyValue == 59 )
                {
                    Gold newloot = new Gold( Utility.RandomMinMax( 3, 6 ) );
                    Container pack = player.Backpack;

                    if( pack != null )
                        pack.DropItem( newloot );

                    player.BodyValue = 46;
                }
            }

            if( player is Mercenary && ((Mercenary)player).Lives < 8 )
                ((Mercenary)player).Lives++;

            else if( player is BaseBreedableCreature )
            {
                BaseBreedableCreature bbc = player as BaseBreedableCreature;

                if( player.Level % 5 == 0 && bbc.PetEvolution > 0 )
                {
                    bbc.RaiseRandomFeat();
                    bbc.PetEvolution--;
                }

                bbc.UpdateSpeeds();

                if( ((BaseBreedableCreature)player).Lives < (8 + ((BaseBreedableCreature)player).ExtraLives) )
                    ((BaseBreedableCreature)player).Lives++;

                if (player is Serpent)
                {
                    if (player.Level == 40)
                    {
                        if (player is GrassSnake)
                        {
                            ((GrassSnake)player).SetConstrict(true);
                            player.SetDex(player.RawDex / 3);
                            player.BodyValue = 89;
                            player.Emote("*" + player.Name + " has grown more langurous but also more powerful!*");
                            player.PlaySound(0x05E);
                        }
                        else
                        {
                            player.BodyValue = 89;
                            player.Emote("*" + player.Name + " is growing!*");
                            player.PlaySound(0x05E);
                        }
                    }

                    if(player is Viper)
                        ((Viper)player).incSerpentPoison();
                    else if(player is Copperhead)
                        ((Copperhead)player).incSerpentPoison();
                    else if(player is Cobra)
                        ((Cobra)player).incSerpentPoison();
                    else if(player is BlackMamba)
                        ((BlackMamba)player).incSerpentPoison();
                }

                    if (player is WorkHorse)
                    {
                        List<Item> packItems = new List<Item>();
                        foreach (Item item in (player as WorkHorse).Backpack.Items)
                            packItems.Add(item);

                        StrongBackpack newPack = new StrongBackpack((player as WorkHorse).Backpack.MaxWeight + player.StatScale);
                        newPack.MaxItems += Utility.Random(player.StatScale);
                        foreach (Item item in packItems)
                            newPack.AddItem(item);

                        (player as WorkHorse).Backpack.Delete();
                        (player as WorkHorse).AddItem(newPack);
                    }
            }

            else if( player.Controlled && player.Lives < 8 )
                player.Lives++;

            AwardSkill( player, i );

            if( player.Level < 50 )
                CheckLevel( player );
        }
            protected override void OnTarget(Mobile from, object targeted)
            {
                PlayerMobile pm = from as PlayerMobile;

                if (this.m_Tasty.Deleted)
                {
                    return;
                }
                if (targeted is Mobile)
                {
                    if (targeted is BaseCreature)
                    {
                        BaseCreature creature = (BaseCreature)targeted;

                        this.Base1 = (creature.DamageMin);
                        this.Base2 = (creature.DamageMax);

                        this.Change1 = (int)((creature.DamageMin) * 1.10);
                        this.Change2 = (int)((creature.DamageMax) * 1.10);

                        this.Change6 = (creature.RawStr);
                        this.Change7 = (creature.RawDex);
                        this.Change8 = (creature.RawInt);

                        this.Change3 = (int)((creature.RawStr) * 1.15);
                        this.Change4 = (int)((creature.RawDex) * 1.15);
                        this.Change5 = (int)((creature.RawInt) * 1.15);

                        if ((creature.Controlled || creature.Summoned) && (from == creature.ControlMaster) && !(creature.Asleep))
                        {
                            creature.FixedParticles(0x376A, 9, 32, 5005, EffectLayer.Waist);
                            creature.PlaySound(0x1E9);

                            creature.SetDamage(this.Change1, this.Change2);

                            creature.RawStr = this.Change3;
                            creature.RawDex = this.Change4;
                            creature.RawInt = this.Change5;

                            from.SendMessage("You have increased the Stats of your pet by 15% and the Damage by 10% for 10 Minutes !!");
                            this.m_Tasty.m_Used = true;
                            creature.Asleep     = true;

                            Timer.DelayCall(TimeSpan.FromMinutes(10.0), delegate()
                            {
                                creature.SetDamage(this.Base1, this.Base2);

                                creature.RawStr = this.Change6;
                                creature.RawDex = this.Change7;
                                creature.RawInt = this.Change8;

                                this.m_Tasty.m_Used = true;
                                creature.Asleep     = false;
                                from.SendMessage("The effect of Irresistibly Tasty Treat is Finish !");

                                Timer.DelayCall(TimeSpan.FromMinutes(120.0), delegate()
                                {
                                    this.m_Tasty.m_Used = false;
                                });
                            });
                        }
                        else if ((creature.Controlled || creature.Summoned) && (from == creature.ControlMaster) && (creature.Asleep))
                        {
                            from.SendLocalizedMessage(502676);
                        }
                        else
                        {
                            from.SendLocalizedMessage(1113049);
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(500329);
                    }
                }
            }
            protected override void OnTarget(Mobile from, object targeted)
            {
                PlayerMobile pm = from as PlayerMobile;

                if (m_Tasty.Deleted)
                {
                    return;
                }

                if (targeted is BaseCreature)
                {
                    BaseCreature creature = (BaseCreature)targeted;

                    Change1 = (int)((creature.RawStr) * 1.10);
                    Change2 = (int)((creature.RawDex) * 1.10);
                    Change3 = (int)((creature.RawInt) * 1.10);

                    Change4 = (int)(creature.RawStr);
                    Change5 = (int)(creature.RawDex);
                    Change6 = (int)(creature.RawInt);

                    if ((creature.Controlled || creature.Summoned) && (from == creature.ControlMaster) && !(creature.Sleep))
                    {
                        creature.FixedParticles(0x373A, 10, 15, 5018, EffectLayer.Waist);
                        creature.PlaySound(0x1EA);

                        creature.RawStr = Change1;
                        creature.RawDex = Change2;
                        creature.RawInt = Change3;

                        from.SendMessage("You have increased the Stats of your pet by 10% for 10 Minutes !!");
                        m_Tasty.m_Used = true;
                        creature.Sleep = true;


                        Timer.DelayCall(TimeSpan.FromMinutes(10.0), delegate()
                        {
                            creature.RawStr = Change4;
                            creature.RawDex = Change5;
                            creature.RawInt = Change6;
                            creature.PlaySound(0x1EB);

                            m_Tasty.m_Used = true;
                            creature.Sleep = false;

                            from.SendMessage("The effect of Deliciously Tasty Treat is Finish !");

                            Timer.DelayCall(TimeSpan.FromMinutes(60.0), delegate()
                            {
                                m_Tasty.m_Used = false;
                            });
                        });
                    }
                    else if ((creature.Controlled || creature.Summoned) && (from == creature.ControlMaster) && (creature.Sleep))
                    {
                        from.SendLocalizedMessage(502676);
                    }
                    else
                    {
                        from.SendLocalizedMessage(1113049);
                    }
                }
                else
                {
                    from.SendLocalizedMessage(500329);
                }
            }
		public static void ActStoned(BaseCreature mobile)
		{
			mobile.Direction = (Direction)Utility.Random( 8 );
			
			if( s_HumanTalked == false ) 
			{ 
				s_HumanTalked = true; 
				SayStonedRandom( stonedsay, mobile ); 
				mobile.PlaySound( 0x420 );   // coughing
				StonedSpamTimer t = new StonedSpamTimer(); 
				t.Start(); 

				if (1 == Utility.Random(20))
					mobile.PlaySound( mobile.Female ? 794 : 1066 );
			} 	
		}
Exemple #37
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                from.RevealingAction();

                if (targeted is Mobile)
                {
                    if (targeted is BaseCreature)
                    {
                        BaseCreature creature = (BaseCreature)targeted;

                        if (from.AccessLevel >= AccessLevel.GameMaster)
                        {
                            creature.Owners.Add(from);
                            creature.SetControlMaster(from);
                            creature.IsBonded = false;
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, true, "Your godly powers allow you to force the creature to yield to your will.", from.NetState);
                        }
                        else if (!creature.Tamable)
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049655, from.NetState);                               // That creature cannot be tamed.
                        }
                        else if (creature.Controlled)
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502804, from.NetState);                               // That animal looks tame already.
                        }
                        else if (from.Female && !creature.AllowFemaleTamer)
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049653, from.NetState);                               // That creature can only be tamed by males.
                        }
                        else if (!from.Female && !creature.AllowMaleTamer)
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049652, from.NetState);                               // That creature can only be tamed by females.
                        }
                        else if (creature is CuSidhe && from.Race != Race.Elf)
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502801, from.NetState);                               // You can't tame that!
                        }
                        else if (from.Followers + creature.ControlSlots > from.FollowersMax)
                        {
                            from.SendLocalizedMessage(1049611);                               // You have too many followers to tame that creature.
                        }
                        else if (creature.Owners.Count >= BaseCreature.MaxOwners && !creature.Owners.Contains(from))
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1005615, from.NetState);                               // This animal has had too many owners and is too upset for you to tame.
                        }
                        else if (MustBeSubdued(creature))
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1054025, from.NetState);                               // You must subdue this creature before you can tame it!
                        }
                        else if (CheckMastery(from, creature) || from.Skills[SkillName.AnimalTaming].Value >= creature.MinTameSkill)
                        {
                            FactionWarHorse warHorse = creature as FactionWarHorse;

                            if (warHorse != null)
                            {
                                Faction faction = Faction.Find(from);

                                if (faction == null || faction != warHorse.Faction)
                                {
                                    creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1042590, from.NetState);                                       // You cannot tame this creature.
                                    return;
                                }
                            }

                            if (m_BeingTamed.ContainsKey(creature))
                            {
                                creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502802, from.NetState);                                   // Someone else is already taming this.
                            }
                            else if (creature.CanAngerOnTame && 0.95 >= Utility.RandomDouble())
                            {
                                creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502805, from.NetState);                                   // You seem to anger the beast!
                                creature.PlaySound(creature.GetAngerSound());
                                creature.Direction = creature.GetDirectionTo(from);

                                if (creature.BardPacified && 0.75 > Utility.RandomDouble())
                                {
                                    Timer.DelayCall <BaseCreature>(TimeSpan.FromSeconds(2.0), new TimerStateCallback <BaseCreature>(ResetPacify), creature);
                                }
                                else
                                {
                                    creature.BardEndTime  = DateTime.Now;
                                    creature.BardPacified = false;
                                    creature.Move(creature.Direction);
                                }

                                if (from is PlayerMobile && !(((PlayerMobile)from).HonorActive || TransformationSpellHelper.UnderTransformation(from, typeof(EtherealVoyageSpell))))
                                {
                                    creature.Combatant = from;
                                }
                            }
                            else
                            {
                                m_BeingTamed[creature] = from;

                                from.LocalOverheadMessage(MessageType.Emote, 0x59, 1010597);                                   // You start to tame the creature.
                                from.NonlocalOverheadMessage(MessageType.Emote, 0x59, 1010598);                                // *begins taming a creature.*

                                new InternalTimer(from, creature, Utility.Random(3, 2)).Start();

                                m_SetSkillTime = false;
                            }
                        }
                        else
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502806, from.NetState);                               // You have no chance of taming this creature.
                        }
                    }
                    else
                    {
                        ((Mobile)targeted).PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502469, from.NetState);                           // That being cannot be tamed.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502801);                       // You can't tame that!
                }
            }
Exemple #38
0
            protected override void OnTarget(Mobile from, object target)
            {
                if (m_ExplodingAnimal.Deleted || m_ExplodingAnimal.RootParent != from)
                {
                    return;
                }

                PlayerMobile pm = from as PlayerMobile;

                if (pm == null)
                {
                    return;
                }

                IPoint3D targetPoint = target as IPoint3D;

                if (targetPoint == null)
                {
                    return;
                }

                Map map = from.Map;

                if (map == null)
                {
                    return;
                }

                SpellHelper.GetSurfaceTop(ref targetPoint);

                if (targetPoint is Mobile)
                {
                    targetLocation = (Mobile)targetPoint;
                }

                else
                {
                    targetLocation = new Entity(Serial.Zero, new Point3D(targetPoint), map);
                }

                if (!map.CanSpawnMobile(targetLocation.Location))
                {
                    from.SendLocalizedMessage(501942); // That location is blocked.
                    return;
                }

                from.RevealingAction();

                BaseCreature bc_Creature = (BaseCreature)Activator.CreateInstance(m_ExplodingAnimal.CreatureType);

                bc_Creature.Tameable = false;
                bc_Creature.Blessed  = true;
                bc_Creature.Hue      = 2620;
                bc_Creature.Name     = m_ExplodingAnimal.CreatureName;
                bc_Creature.MoveToWorld(targetLocation.Location, targetLocation.Map);

                bc_Creature.Frozen   = true;
                bc_Creature.CantWalk = true;

                bc_Creature.PlaySound(bc_Creature.GetAngerSound());

                bc_Creature.FaceRandomDirection();

                for (int a = 0; a < 11; a++)
                {
                    int tick = a;

                    Timer.DelayCall(TimeSpan.FromSeconds(a), delegate
                    {
                        if (bc_Creature == null)
                        {
                            return;
                        }
                        if (bc_Creature.Deleted || !bc_Creature.Alive)
                        {
                            return;
                        }

                        if (tick == 10)
                        {
                            bc_Creature.Blessed = false;

                            SpecialAbilities.AnimalExplosion(from, bc_Creature.Location, bc_Creature.Map, m_ExplodingAnimal.CreatureType, m_ExplodingAnimal.Radius, m_ExplodingAnimal.MinDamage, m_ExplodingAnimal.MaxDamage, 30, -1, true, false);

                            bc_Creature.Kill();
                        }

                        else
                        {
                            int countDown = 10 - tick;
                            bc_Creature.PublicOverheadMessage(MessageType.Regular, 0, false, countDown.ToString());

                            if (Utility.RandomDouble() <= .33)
                            {
                                bc_Creature.FaceRandomDirection();
                            }

                            if (Utility.RandomMinMax(1, 10) <= tick)
                            {
                                bc_Creature.PlaySound(bc_Creature.GetIdleSound());
                            }
                        }
                    });
                }

                if (from.AccessLevel == AccessLevel.Player)
                {
                    from.BeginAction(typeof(ExplodingAnimal));

                    Timer.DelayCall(TimeSpan.FromMinutes(60), delegate
                    {
                        if (from != null)
                        {
                            from.EndAction(typeof(ExplodingAnimal));
                        }
                    });
                }

                m_ExplodingAnimal.Delete();
            }