public BuffType GetRandomBuff(Mobile target) { List <BuffType> buffs = new List <BuffType>(); if (MagicReflectSpell.HasReflect(target)) { buffs.Add(BuffType.MagicReflect); } if (ReactiveArmorSpell.HasArmor(target)) { buffs.Add(BuffType.ReactiveArmor); } if (ProtectionSpell.HasProtection(target)) { buffs.Add(BuffType.Protection); } TransformContext context = TransformationSpellHelper.GetContext(target); if (context != null && context.Type != typeof(AnimalForm)) { buffs.Add(BuffType.Transformation); } StatMod mod = target.GetStatMod("[Magic] Str Offset"); if (mod != null && mod.Offset > 0) { buffs.Add(BuffType.StrBonus); } mod = target.GetStatMod("[Magic] Dex Offset"); if (mod != null && mod.Offset > 0) { buffs.Add(BuffType.DexBonus); } mod = target.GetStatMod("[Magic] Int Offset"); if (mod != null && mod.Offset > 0) { buffs.Add(BuffType.IntBonus); } if (buffs.Count == 0) { return(BuffType.None); } BuffType type = buffs[Utility.Random(buffs.Count)]; buffs.Clear(); return(type); }
protected override void OnTarget(Mobile from, object o) { if (m_Talisman == null || m_Talisman.Deleted) { return; } Mobile target = o as Mobile; if (from.Talisman != m_Talisman) { from.SendLocalizedMessage(502641); // You must equip this item to use it. } else if (target == null) { from.SendLocalizedMessage(1046439); // That is not a valid target. } else if (m_Talisman.ChargeTime > 0) { from.SendLocalizedMessage(1074882, m_Talisman.ChargeTime.ToString()); // You must wait ~1_val~ seconds for this to recharge. } else if (m_Talisman.Charges == 0 && m_Talisman.MaxCharges > 0) { from.SendLocalizedMessage(1042544); // This item is out of charges. } else { switch (m_Talisman.Removal) { case TalismanRemoval.Curse: target.PlaySound(0xF6); target.PlaySound(0x1F7); target.FixedParticles(0x3709, 1, 30, 9963, 13, 3, EffectLayer.Head); IEntity mfrom = new Entity(Serial.Zero, new Point3D(target.X, target.Y, target.Z - 10), from.Map); IEntity mto = new Entity(Serial.Zero, new Point3D(target.X, target.Y, target.Z + 50), from.Map); Effects.SendMovingParticles(mfrom, mto, 0x2255, 1, 0, false, false, 13, 3, 9501, 1, 0, EffectLayer.Head, 0x100); StatMod mod; mod = target.GetStatMod("[Magic] Str Offset"); if (mod != null && mod.Offset < 0) { target.RemoveStatMod("[Magic] Str Offset"); } mod = target.GetStatMod("[Magic] Dex Offset"); if (mod != null && mod.Offset < 0) { target.RemoveStatMod("[Magic] Dex Offset"); } mod = target.GetStatMod("[Magic] Int Offset"); if (mod != null && mod.Offset < 0) { target.RemoveStatMod("[Magic] Int Offset"); } target.Paralyzed = false; EvilOmenSpell.TryEndEffect(target); StrangleSpell.RemoveCurse(target); CorpseSkinSpell.RemoveCurse(target); CurseSpell.RemoveEffect(target); BuffInfo.RemoveBuff(target, BuffIcon.Clumsy); BuffInfo.RemoveBuff(target, BuffIcon.FeebleMind); BuffInfo.RemoveBuff(target, BuffIcon.Weaken); BuffInfo.RemoveBuff(target, BuffIcon.MassCurse); target.SendLocalizedMessage(1072408); // Any curses on you have been lifted if (target != from) { from.SendLocalizedMessage(1072409); // Your targets curses have been lifted } break; case TalismanRemoval.Damage: target.PlaySound(0x201); Effects.SendLocationParticles(EffectItem.Create(target.Location, target.Map, EffectItem.DefaultDuration), 0x3728, 1, 13, 0x834, 0, 0x13B2, 0); BleedAttack.EndBleed(target, true); MortalStrike.EndWound(target); BuffInfo.RemoveBuff(target, BuffIcon.Bleed); BuffInfo.RemoveBuff(target, BuffIcon.MortalStrike); target.SendLocalizedMessage(1072405); // Your lasting damage effects have been removed! if (target != from) { from.SendLocalizedMessage(1072406); // Your Targets lasting damage effects have been removed! } break; case TalismanRemoval.Ward: target.PlaySound(0x201); Effects.SendLocationParticles(EffectItem.Create(target.Location, target.Map, EffectItem.DefaultDuration), 0x3728, 1, 13, 0x834, 0, 0x13B2, 0); MagicReflectSpell.EndReflect(target); ReactiveArmorSpell.EndArmor(target); ProtectionSpell.EndProtection(target); target.SendLocalizedMessage(1072402); // Your wards have been removed! if (target != from) { from.SendLocalizedMessage(1072403); // Your target's wards have been removed! } break; case TalismanRemoval.Wildfire: // TODO break; } m_Talisman.OnAfterUse(from); } }
public override void OnTarget(Object o) { Mobile target = o as Mobile; if (target == null) { return; } if (m_CurseTable.ContainsKey(Caster)) { Caster.SendLocalizedMessage(1154212); //You may not use the Purge Magic spell while you are under its curse. } else if (m_ImmuneTable.ContainsKey(target) || m_CurseTable.ContainsKey(target)) { Caster.SendMessage("You may not use the Purge Magic spell while they are under its curse."); } else if (CheckHSequence(target)) { if (CheckResisted(target)) { target.SendLocalizedMessage(501783); // You feel yourself resisting magical energy. Caster.SendLocalizedMessage(1080119); //Your Purge Magic has been resisted! } else { Caster.PlaySound(0x655); Effects.SendLocationParticles(EffectItem.Create(target.Location, target.Map, EffectItem.DefaultDuration), 0x3728, 1, 13, 0x834, 0, 0x13B2, 0); BuffType type = GetRandomBuff(target); if (type != BuffType.None) { string arg = ""; switch (type) { case BuffType.MagicReflect: MagicReflectSpell.EndReflect(target); arg = "magic reflect"; break; case BuffType.ReactiveArmor: ReactiveArmorSpell.EndArmor(target); arg = "reactive armor"; break; case BuffType.Protection: ProtectionSpell.EndProtection(target); arg = "protection"; break; case BuffType.Transformation: TransformationSpellHelper.RemoveContext(target, true); arg = "transformation spell"; break; case BuffType.StrBonus: arg = "strength bonus"; target.RemoveStatMod("[Magic] Str Offset"); BuffInfo.RemoveBuff(target, BuffIcon.Bless); BuffInfo.RemoveBuff(target, BuffIcon.Strength); break; case BuffType.DexBonus: arg = "dexterity bonus"; target.RemoveStatMod("[Magic] Dex Offset"); BuffInfo.RemoveBuff(target, BuffIcon.Bless); BuffInfo.RemoveBuff(target, BuffIcon.Agility); break; case BuffType.IntBonus: arg = "intelligence bonus"; target.RemoveStatMod("[Magic] Int Offset"); BuffInfo.RemoveBuff(target, BuffIcon.Bless); BuffInfo.RemoveBuff(target, BuffIcon.Cunning); break; } target.SendLocalizedMessage(1080117, arg); //Your ~1_ABILITY_NAME~ has been purged. Caster.SendLocalizedMessage(1080118, arg); //Your target's ~1_ABILITY_NAME~ has been purged. int duration = (int)((Caster.Skills[CastSkill].Value + Caster.Skills[DamageSkill].Value) / 15); if (duration <= 0) { duration = 1; } m_ImmuneTable.Add(target, new ImmuneTimer(target, TimeSpan.FromSeconds(duration))); } else { Caster.SendLocalizedMessage(1080120); //Your target has no magic that can be purged. int duration = (int)((Caster.Skills[CastSkill].Value + Caster.Skills[DamageSkill].Value) / 28); if (duration <= 0) { duration = 1; } m_CurseTable.Add(target, new CurseTimer(target, Caster, TimeSpan.FromSeconds(duration))); } } } FinishSequence(); }
public BuffType GetRandomBuff(Mobile target) { List <BuffType> buffs = new List <BuffType>(); if (MagicReflectSpell.HasReflect(target)) { buffs.Add(BuffType.MagicReflect); } if (ReactiveArmorSpell.HasArmor(target)) { buffs.Add(BuffType.ReactiveArmor); } if (ProtectionSpell.HasProtection(target)) { buffs.Add(BuffType.Protection); } TransformContext context = TransformationSpellHelper.GetContext(target); if (context != null && context.Type != typeof(AnimalForm)) { buffs.Add(BuffType.Transformation); } StatMod mod = target.GetStatMod("[Magic] Str Buff"); if (mod != null) { buffs.Add(BuffType.StrBonus); } mod = target.GetStatMod("[Magic] Dex Buff"); if (mod != null) { buffs.Add(BuffType.DexBonus); } mod = target.GetStatMod("[Magic] Int Buff"); if (mod != null) { buffs.Add(BuffType.IntBonus); } if (EodonianPotion.IsUnderEffects(target, PotionEffect.Barrab)) { buffs.Add(BuffType.BarrabHemolymph); } if (EodonianPotion.IsUnderEffects(target, PotionEffect.Urali)) { buffs.Add(BuffType.UraliTrance); } if (buffs.Count == 0) { return(BuffType.None); } BuffType type = buffs[Utility.Random(buffs.Count)]; buffs.Clear(); return(type); }
public void Target(BaseTalisman talis, Mobile owner, Mobile m) { if (this.Parent == owner) { //Curse Removal if (talis.m_TalismanType == TalismanType.CurseRemoval) { m.PlaySound(0xF6); m.PlaySound(0x1F7); m.FixedParticles(0x3709, 1, 30, 9963, 13, 3, EffectLayer.Head); StatMod mod; mod = m.GetStatMod("[Magic] Str Malus"); if (mod != null && mod.Offset < 0) { m.RemoveStatMod("[Magic] Str Malus"); } mod = m.GetStatMod("[Magic] Dex Malus"); if (mod != null && mod.Offset < 0) { m.RemoveStatMod("[Magic] Dex Malus"); } mod = m.GetStatMod("[Magic] Int Malus"); if (mod != null && mod.Offset < 0) { m.RemoveStatMod("[Magic] Int Malus"); } m.Paralyzed = false; EvilOmenSpell.CheckEffect(m); StrangleSpell.RemoveCurse(m); CorpseSkinSpell.RemoveCurse(m); CurseSpell.RemoveEffect(m); BuffInfo.RemoveBuff(m, BuffIcon.Clumsy); BuffInfo.RemoveBuff(m, BuffIcon.FeebleMind); BuffInfo.RemoveBuff(m, BuffIcon.Weaken); BuffInfo.RemoveBuff(m, BuffIcon.MassCurse); BuffInfo.RemoveBuff(m, BuffIcon.Curse); BuffInfo.RemoveBuff(m, BuffIcon.EvilOmen); StrangleSpell.RemoveCurse(m); CorpseSkinSpell.RemoveCurse(m); if (owner != m) { owner.SendLocalizedMessage(1072409); // Your targets curses have been lifted } m.SendLocalizedMessage(1072408); // Any curses on you have been lifted } //Damage Removal if (talis.m_TalismanType == TalismanType.DamageRemoval) { Effects.SendLocationEffect(m.Location, m.Map, 0x3728, 8); Effects.PlaySound(m, m.Map, 0x201); BleedAttack.EndBleed(m, false); MortalStrike.EndWound(m); m.CurePoison(m); BuffInfo.RemoveBuff(m, BuffIcon.Bleed); BuffInfo.RemoveBuff(m, BuffIcon.MortalStrike); if (owner != m) { owner.SendLocalizedMessage(1072406); // Your Targets lasting damage effects have been removed! } m.SendLocalizedMessage(1072405); // Your lasting damage effects have been removed! } //Ward Removal if (talis.m_TalismanType == TalismanType.WardRemoval) { Effects.SendLocationEffect(m.Location, m.Map, 0x3728, 8); Effects.PlaySound(m, m.Map, 0x201); ProtectionSpell.RemoveWard(m); ReactiveArmorSpell.RemoveWard(m); MagicReflectSpell.RemoveWard(m); TransformationSpell.RemoveContext(m, true); ReaperFormSpell.RemoveEffects(m); if (StoneFormSpell.UnderEffect(m)) { StoneFormSpell.RemoveEffects(m); } if (owner != m) { owner.SendLocalizedMessage(1072403); // Your target's wards have been removed! } m.SendLocalizedMessage(1072402); // Your wards have been removed! } //Wildfire Removal if (talis.m_TalismanType == TalismanType.WildfireRemoval) { owner.SendLocalizedMessage(1042753, "Wildfire Removal"); // ~1_SOMETHING~ has been temporarily disabled. } //CARGE TIMER ChargeTimeLeft = 1200; m_ChargeTimer = new ChargeTimeLeftTimer(this); m_ChargeTimer.Start(); m_ChargeTimeLeft3 = DateTime.Now; } else if (m_TalismanType != 0) { m.SendLocalizedMessage(502641); // You must equip this item to use it. } }
public static void NegateEffects(Mobile target, bool curses, bool buffs, bool damage, bool morph) { if (target == null) { return; } if (damage) { if (target.Poisoned) { var p = target.Poison; target.Poison = null; target.OnCured(target, p); } target.Frozen = false; target.Paralyzed = false; target.SetPropertyValue("Asleep", false); BuffInfo.RemoveBuff(target, BuffIcon.Paralyze); BuffInfo.RemoveBuff(target, BuffIcon.Sleep); } if (buffs) { ReactiveArmorSpell.EndArmor(target); MagicReflectSpell.EndReflect(target); } if (curses) { #region Pain Spike IDictionary table; if (typeof(PainSpikeSpell).GetFieldValue("m_Table", out table) && table.Contains(target)) { var t = table[target] as Timer; if (t != null) { t.Stop(); } table.Remove(target); BuffInfo.RemoveBuff(target, BuffIcon.PainSpike); } #endregion CurseSpell.RemoveEffect(target); EvilOmenSpell.TryEndEffect(target); StrangleSpell.RemoveCurse(target); CorpseSkinSpell.RemoveCurse(target); BloodOathSpell.RemoveCurse(target); MindRotSpell.ClearMindRotScalar(target); } if (damage) { MortalStrike.EndWound(target); BleedAttack.EndBleed(target, target.Alive); MeerMage.StopEffect(target, target.Alive); } if (morph) { AnimalForm.RemoveContext(target, true); PolymorphSpell.StopTimer(target); IncognitoSpell.StopTimer(target); target.Send(SpeedControl.Disable); target.EndAction(typeof(PolymorphSpell)); target.EndAction(typeof(IncognitoSpell)); BuffInfo.RemoveBuff(target, BuffIcon.AnimalForm); BuffInfo.RemoveBuff(target, BuffIcon.Polymorph); BuffInfo.RemoveBuff(target, BuffIcon.Incognito); } if (buffs) { RemoveStatBonus(target, StatType.All); } if (curses) { RemoveStatCurse(target, StatType.All); } }