public override void OnEnter( Mobile m )
		{
			base.OnEnter( m );
			
			if ( m is PlayerMobile )
			{
				PlayerMobile player = (PlayerMobile) m;
				
				for ( int i = 0; i < player.Quests.Count; i ++ )
				{
					BaseQuest quest = player.Quests[ i ];
					
					for ( int j = 0; j < quest.Objectives.Count; j ++ )
					{
						BaseObjective objective = quest.Objectives[ j ];
						
						if ( objective is ApprenticeObjective && !objective.Completed )
						{
							ApprenticeObjective apprentice = (ApprenticeObjective) objective;		
							
							if ( IsPartOf( apprentice.Region ) )
							{
								if ( apprentice.Enter is int )
									player.SendLocalizedMessage( (int) apprentice.Enter );
								else if ( apprentice.Enter is string )
									player.SendMessage( (string) apprentice.Enter );

								BuffInfo info = new BuffInfo(BuffIcon.ArcaneEmpowerment, 1078511, 1078512, apprentice.Skill.ToString()); // Accelerated Skillgain Skill: ~1_val~
								BuffInfo.AddBuff( m, info );
								m_Table[ m ] = info;
							}
						}
					}
				}
			}
		}
Beispiel #2
0
 public AddBuffPacket( Mobile m, BuffInfo info )
     : this(m, info.ID, info.TitleCliloc, info.SecondaryCliloc, info.Args, (info.TimeStart != DateTime.MinValue) ? ((info.TimeStart + info.TimeLength) - DateTime.Now) : TimeSpan.Zero)
 {
 }
Beispiel #3
0
 public RemoveBuffPacket( Mobile mob, BuffInfo info )
     : this(mob, info.ID)
 {
 }
Beispiel #4
0
        public static void RemoveBuff( Mobile m, BuffInfo b )
        {
            PlayerMobile pm = m as PlayerMobile;

            if( pm != null )
                pm.RemoveBuff( b );
        }
Beispiel #5
0
        public void ApplyEffect(FoodEffect effect, Boolean silent)
        {
            if (FoodEffectsCore.Core == null || !FoodEffectsCore.Core.Enabled || !Core.AOS)
            {
                EffectExpired(true);
                return;
            }

            if (LinkedMobile != null)
            {
                if (m_Timer != null)
                {
                    m_Timer.Stop();
                    m_Timer = null;
                }

                LinkedMobile.RemoveStatMod("Food-StrBonus");
                LinkedMobile.RemoveStatMod("Food-DexBonus");
                LinkedMobile.RemoveStatMod("Food-IntBonus");

                if (m_BuffInfo != null)
                    BuffInfo.RemoveBuff(LinkedMobile, m_BuffInfo);

                if (m_FoodEffect != null)
                    FoodEffectsCore.InvokeOnEffectCanceled(LinkedMobile, m_FoodEffect);

                m_FoodEffect = new FoodEffect(effect.RegenHits, effect.RegenStam, effect.RegenMana, effect.StrBonus, effect.DexBonus, effect.IntBonus, effect.Duration);

                if (m_FoodEffect.StrBonus != 0)
                    LinkedMobile.AddStatMod(new StatMod(StatType.Str, "Food-StrBonus", m_FoodEffect.StrBonus, m_FoodEffect.EffectTimeSpan));

                if (m_FoodEffect.DexBonus != 0)
                    LinkedMobile.AddStatMod(new StatMod(StatType.Dex, "Food-DexBonus", m_FoodEffect.DexBonus, m_FoodEffect.EffectTimeSpan));

                if (m_FoodEffect.IntBonus != 0)
                    LinkedMobile.AddStatMod(new StatMod(StatType.Int, "Food-IntBonus", m_FoodEffect.IntBonus, m_FoodEffect.EffectTimeSpan));

                if (!silent)
                {
                    LinkedMobile.FixedEffect(0x375A, 10, 15);
                    LinkedMobile.PlaySound(0x1EE);

                    LinkedMobile.SendMessage(12, "The food you ate is now affecting your performance...");
                }

                m_Timer = new EffectTimer(this);

                FoodEffectsCore.InvokeOnEffectActivated(LinkedMobile, m_FoodEffect);

                m_BuffInfo = new BuffInfo(BuffIcon.ActiveMeditation, 1074240, 1114057, m_FoodEffect.EffectTimeSpan, LinkedMobile, m_FoodEffect.GetBuffInfoText());
                BuffInfo.AddBuff(LinkedMobile, m_BuffInfo);
            }
        }
Beispiel #6
0
		public static void AddBuff(Mobile m, BuffInfo b)
		{
			var pm = m as PlayerMobile;

			if (pm != null)
			{
				pm.AddBuff(b);
			}
		}
Beispiel #7
0
        public static void OnVirtueUsed(Mobile from)
        {
            if (!from.Alive)
            {
                return;
            }

            if (VirtueHelper.GetLevel(from, VirtueName.Spirituality) < VirtueLevel.Seeker)
            {
                from.SendLocalizedMessage(1155829); // You must be a Seeker of Spirituality to invoke this Virtue.
            }
            else
            {
                from.SendLocalizedMessage(1155827); // Target whom you wish to embrace with your Spirituality
                from.BeginTarget(10, false, TargetFlags.None, (mobile, targeted) =>
                {
                    if (targeted is Mobile)
                    {
                        Mobile m = targeted as Mobile;

                        if (VirtueHelper.GetLevel(from, VirtueName.Spirituality) < VirtueLevel.Seeker)
                        {
                            from.SendLocalizedMessage(1155812); // You must be at least a Seeker of Humility to Invoke this ability.
                        }
                        else if (!m.Alive)
                        {
                            from.SendLocalizedMessage(1155828); // Thy target must be among the living.
                        }
                        else if (m is BaseCreature && !((BaseCreature)m).Controlled && !((BaseCreature)m).Summoned)
                        {
                            from.SendLocalizedMessage(1155837); // You can only embrace players and pets with Spirituality.
                        }
                        else if (IsEmbracee(m))
                        {
                            from.SendLocalizedMessage(1155836); // They are already embraced by Spirituality.
                        }
                        else if (m.MeleeDamageAbsorb > 0)
                        {
                            from.SendLocalizedMessage(1156039); // You may not use the Spirituality Virtue while the Attunement spell is active.
                        }
                        else if (m is BaseCreature || m is PlayerMobile)
                        {
                            SpiritualityContext context = new SpiritualityContext(from, m);
                            ActiveTable[from]           = context;

                            m.SendLocalizedMessage(1155839);                                                                                                                              // Your spirit has been embraced! You feel more powerful!
                            from.SendLocalizedMessage(1155835);                                                                                                                           // You have lost some Spirituality.

                            BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Spirituality, 1155824, 1155825, String.Format("{0}\t{1}", context.Reduction.ToString(), context.Pool.ToString()))); // ~1_VAL~% Reduction to Incoming Damage<br>~2_VAL~ Shield HP Remaining

                            VirtueHelper.Atrophy(from, VirtueName.Spirituality, 3200);

                            Timer.DelayCall(TimeSpan.FromMinutes(20), () =>
                            {
                                if (ActiveTable != null && ActiveTable.ContainsKey(from))
                                {
                                    ActiveTable.Remove(from);
                                    m.SendLocalizedMessage(1155840); // Your spirit is no longer embraced. You feel less powerful.
                                    BuffInfo.RemoveBuff(m, BuffIcon.Spirituality);
                                }
                            });
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1155837); // You can only embrace players and pets with Spirituality.
                    }
                });
            }
        }
Beispiel #8
0
            protected override void OnTick()
            {
                if (CheckResistPoison())
                {
                    // Curing this way cause we don't want to trigger the PoisonCured event,
                    // so that the resistance timer is not refreshed.
                    m_Mobile.Poison = null;
                    BuffInfo.RemoveBuff(m_Mobile, BuffIcon.Poison);

                    m_Mobile.LocalOverheadMessage(MessageType.Emote, 0x3F, true, "* You feel yourself resisting the effects of the poison *");

                    m_Mobile.NonlocalOverheadMessage(MessageType.Emote, 0x3F, true, $"* {m_Mobile.Name} seems resistant to the poison *");

                    Stop();
                    return;
                }

                if (m_Index++ == m_Poison.m_Count)
                {
                    m_Mobile.SendLocalizedMessage(502136);                       // The poison seems to have worn off.
                    m_Mobile.Poison = null;

                    Stop();
                    return;
                }

                int damage = 1 + (int)(m_Mobile.Hits * m_Poison.m_Scalar);

                if (damage < m_Poison.m_Minimum)
                {
                    damage = m_Poison.m_Minimum;
                }
                else if (damage > m_Poison.m_Maximum)
                {
                    damage = m_Poison.m_Maximum;
                }

                #region Darkglow
                var poisoner = DarkglowPotion.GetPoisoner(m_Mobile);

                if (poisoner != null)
                {
                    int distance = (int)m_Mobile.GetDistanceToSqrt(poisoner.Location);

                    if (distance > 1)
                    {
                        if (distance > 20)
                        {
                            distance = 20;
                        }

                        damage += AOS.Scale(damage, distance * 5);
                        poisoner.SendLocalizedMessage(1072850);                           // Darkglow poison increases your damage!
                    }
                }
                #endregion

                var honorTarget = m_Mobile as IHonorTarget;

                if (honorTarget != null && honorTarget.ReceivedHonorContext != null)
                {
                    honorTarget.ReceivedHonorContext.OnTargetPoisoned();
                }

                AOS.Damage(m_Mobile, damage, 0, 0, 0, 100, 0);

                if ((m_Index % m_Poison.m_MessageInterval) == 0)
                {
                    m_Mobile.OnPoisoned(m_Mobile, m_Poison, m_Poison);
                }

                #region Parasitic
                poisoner = ParasiticPotion.GetPoisoner(m_Mobile);

                if (poisoner != null && m_Mobile.InRange(poisoner.Location, 1))
                {
                    int toHeal = Math.Min(damage, poisoner.HitsMax - poisoner.Hits);

                    if (toHeal > 0)
                    {
                        poisoner.SendLocalizedMessage(1060203, toHeal.ToString());                           // You have had ~1_HEALED_AMOUNT~ hit points of damage healed.
                        poisoner.Hits += toHeal;
                    }
                }
                #endregion
            }
Beispiel #9
0
        public void CheckCancelMorph(Mobile m)
        {
            if (m == null)
            {
                return;
            }

            double minSkill, maxSkill;

            AnimalFormContext acontext = AnimalForm.GetContext(m);
            TransformContext  context  = TransformationSpellHelper.GetContext(m);

            if (context != null)
            {
                Spell spell = context.Spell as Spell;
                spell.GetCastSkills(out minSkill, out maxSkill);
                if (m.Skills[spell.CastSkill].Value < minSkill)
                {
                    TransformationSpellHelper.RemoveContext(m, context, true);
                }
            }
            if (acontext != null)
            {
                int i;
                for (i = 0; i < AnimalForm.Entries.Length; ++i)
                {
                    if (AnimalForm.Entries[i].Type == acontext.Type)
                    {
                        break;
                    }
                }
                if (m.Skills[SkillName.Ninjitsu].Value < AnimalForm.Entries[i].ReqSkill)
                {
                    AnimalForm.RemoveContext(m, true);
                }
            }
            if (!m.CanBeginAction(typeof(PolymorphSpell)) && m.Skills[SkillName.Magery].Value < 66.1)
            {
                m.BodyMod = 0;
                m.HueMod  = -1;
                m.NameMod = null;
                m.EndAction(typeof(PolymorphSpell));
                BaseArmor.ValidateMobile(m);
                BaseClothing.ValidateMobile(m);
            }
            if (!m.CanBeginAction(typeof(IncognitoSpell)) && m.Skills[SkillName.Magery].Value < 38.1)
            {
                if (m is PlayerMobile)
                {
                    ((PlayerMobile)m).SetHairMods(-1, -1);
                }
                m.BodyMod = 0;
                m.HueMod  = -1;
                m.NameMod = null;
                m.EndAction(typeof(IncognitoSpell));
                BaseArmor.ValidateMobile(m);
                BaseClothing.ValidateMobile(m);
                BuffInfo.RemoveBuff(m, BuffIcon.Incognito);
            }
            return;
        }
Beispiel #10
0
 protected override void OnTick()
 {
     m_Owner.EndAction(typeof(LightCycle));
     m_Owner.LightLevel = 0;
     BuffInfo.RemoveBuff(m_Owner, BuffIcon.NightSight);
 }
Beispiel #11
0
        private static void Honor(PlayerMobile source, Mobile target)
        {
            IHonorTarget  honorTarget = target as IHonorTarget;
            GuardedRegion reg         = (GuardedRegion)source.Region.GetRegion(typeof(GuardedRegion));
            Map           map         = source.Map;

            if (honorTarget == null)
            {
                return;
            }

            if (honorTarget.ReceivedHonorContext != null)
            {
                if (honorTarget.ReceivedHonorContext.Source == source)
                {
                    return;
                }

                if (honorTarget.ReceivedHonorContext.CheckDistance())
                {
                    source.SendLocalizedMessage(1063233); // Somebody else is honoring this opponent
                    return;
                }
            }

            if (target.Hits < target.HitsMax)
            {
                source.SendLocalizedMessage(1063166); // You cannot honor this monster because it is too damaged.
                return;
            }

            BaseCreature cret = target as BaseCreature;

            if (target.Body.IsHuman && (cret == null || (!cret.AlwaysAttackable && !cret.AlwaysMurderer)))
            {
                if (reg == null || reg.IsDisabled())
                {
                    //Allow honor on blue if Out of guardzone
                }
                else if (map != null && (map.Rules & MapRules.HarmfulRestrictions) == 0)
                {
                    //Allow honor on blue if in Fel
                }
                else
                {
                    source.SendLocalizedMessage(1001018); // You cannot perform negative acts
                    return;                               //cannot honor in trammel town on blue
                }
            }

            if (Core.ML && target is PlayerMobile)
            {
                source.SendLocalizedMessage(1075614); // You cannot honor other players.
                return;
            }

            if (source.SentHonorContext != null)
            {
                source.SentHonorContext.Cancel();
            }

            new HonorContext(source, target);

            source.Direction = source.GetDirectionTo(target);

            if (!source.Mounted)
            {
                source.Animate(32, 5, 1, true, true, 0);
            }

            BuffInfo.AddBuff(source, new BuffInfo(BuffIcon.Honored, 1075649, 1153815, String.Format("{0}", target.Name)));
            BuffInfo.AddBuff(source, new BuffInfo(BuffIcon.Perfection, 1153786, 1151394, String.Format("0\t{0}", target.Name)));
        }
Beispiel #12
0
 public RemoveBuffPacket(Mobile mob, BuffInfo info)
     : this(mob, info.ID)
 {
 }
Beispiel #13
0
 public AddBuffPacket(Mobile m, BuffInfo info)
     : this(m, info.ID, info.TitleCliloc, info.SecondaryCliloc, info.Args, (info.TimeStart != DateTime.MinValue) ? ((info.TimeStart + info.TimeLength) - DateTime.UtcNow) : TimeSpan.Zero)
 {
 }
Beispiel #14
0
        public void AddBuff(BuffInfo b)
        {
            if (!BuffInfo.Enabled || b == null)
                return;

            RemoveBuff(b);	//Check & subsequently remove the old one.

            if (m_BuffTable == null)
                m_BuffTable = new Dictionary<BuffIcon, BuffInfo>();

            m_BuffTable.Add(b.ID, b);

            NetState state = this.NetState;

            if (state != null && state.Version >= BuffInfo.RequiredClient)
            {
                state.Send(new AddBuffPacket(this, b));
            }
        }
Beispiel #15
0
            protected override void OnTick()
            {
                bool usingPetals = OrangePetals.UnderEffect(m_Mobile);

                if (Core.SA && usingPetals && m_Poison.RealLevel >= 3 && 0.25 > Utility.RandomDouble())
                {
                    OrangePetals.RemoveContext(m_Mobile);
                    usingPetals = false;

                    m_Mobile.LocalOverheadMessage(MessageType.Regular, 0x3F, 1053093); // * The strength of the poison overcomes your resistance! *
                }

                if ((Core.AOS && m_Poison.RealLevel < 4 && TransformationSpellHelper.UnderTransformation(m_Mobile, typeof(VampiricEmbraceSpell))) ||
                    (m_Poison.RealLevel <= 3 && usingPetals) ||
                    AnimalForm.UnderTransformation(m_Mobile, typeof(Unicorn)))
                {
                    if (m_Mobile.CurePoison(m_Mobile))
                    {
                        m_Mobile.LocalOverheadMessage(MessageType.Emote, 0x3F, 1053092);                   // * You feel yourself resisting the effects of the poison *

                        m_Mobile.NonlocalOverheadMessage(MessageType.Emote, 0x3F, 1114442, m_Mobile.Name); // * ~1_NAME~ seems resistant to the poison *

                        Stop();
                        return;
                    }
                }

                if (m_Index++ == m_Poison.m_Count)
                {
                    m_Mobile.SendLocalizedMessage(502136); // The poison seems to have worn off.
                    m_Mobile.Poison = null;

                    if (m_Mobile is PlayerMobile)
                    {
                        BuffInfo.RemoveBuff((PlayerMobile)m_Mobile, BuffIcon.Poison);
                    }

                    Stop();
                    return;
                }

                int damage;

                if (!Core.AOS && m_LastDamage != 0 && Utility.RandomBool())
                {
                    damage = m_LastDamage;
                }
                else
                {
                    damage = 1 + (int)(m_Mobile.Hits * m_Poison.m_Scalar);

                    if (damage < m_Poison.m_Minimum)
                    {
                        damage = m_Poison.m_Minimum;
                    }
                    else if (damage > m_Poison.m_Maximum)
                    {
                        damage = m_Poison.m_Maximum;
                    }

                    m_LastDamage = damage;
                }

                if (m_From != null)
                {
                    m_From.DoHarmful(m_Mobile, true);
                }

                IHonorTarget honorTarget = m_Mobile as IHonorTarget;

                if (honorTarget != null && honorTarget.ReceivedHonorContext != null)
                {
                    honorTarget.ReceivedHonorContext.OnTargetPoisoned();
                }

                #region Mondain's Legacy
                if (Core.ML)
                {
                    if (m_From != null && m_Mobile != m_From && !m_From.InRange(m_Mobile.Location, 1) && m_Poison.m_Level >= 10 && m_Poison.m_Level <= 13) // darkglow
                    {
                        m_From.SendLocalizedMessage(1072850);                                                                                              // Darkglow poison increases your damage!
                        damage = (int)Math.Floor(damage * 1.1);
                    }

                    if (m_From != null && m_Mobile != m_From && m_From.InRange(m_Mobile.Location, 1) && m_Poison.m_Level >= 14 && m_Poison.m_Level <= 18) // parasitic
                    {
                        int toHeal = Math.Min(m_From.HitsMax - m_From.Hits, damage);

                        if (toHeal > 0)
                        {
                            m_From.SendLocalizedMessage(1060203, toHeal.ToString()); // You have had ~1_HEALED_AMOUNT~ hit points of damage healed.
                            m_From.Heal(toHeal, m_Mobile, false);
                        }
                    }
                }
                #endregion

                AOS.Damage(m_Mobile, m_From, damage, 0, 0, 0, 100, 0);

                if ((m_Index % m_Poison.m_MessageInterval) == 0)
                {
                    m_Mobile.OnPoisoned(m_From, m_Poison, m_Poison);
                }
            }
Beispiel #16
0
        public void RemoveBuff(BuffInfo b)
        {
            if (b == null)
                return;

            RemoveBuff(b.ID);
        }
Beispiel #17
0
		public void AddBuff(BuffInfo b)
		{
			if (!BuffInfo.Enabled || b == null)
			{
				return;
			}

			RemoveBuff(b); //Check & subsequently remove the old one.

			if (m_BuffTable == null)
			{
				m_BuffTable = new Dictionary<BuffIcon, BuffInfo>();
			}

			m_BuffTable.Add(b.ID, b);

			NetState state = NetState;

			if (state != null && state.BuffIcon)
			{
				state.Send(new AddBuffPacket(this, b));
			}
		}