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))); }
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. } }); } }