public static void SetValue( Mobile m, AosAttribute att, int value, string title ) { if ( !EnhancementList.ContainsKey( m ) ) AddMobile( m, title ); if ( att == AosAttribute.BonusStr ) { m.RemoveStatMod( "MagicalEnhancementStr" ); m.AddStatMod( new StatMod( StatType.Str, "MagicalEnhancementStr", value, TimeSpan.Zero ) ); } else if ( att == AosAttribute.BonusDex ) { m.RemoveStatMod( "MagicalEnhancementDex" ); m.AddStatMod( new StatMod( StatType.Dex, "MagicalEnhancementDex", value, TimeSpan.Zero ) ); } else if ( att == AosAttribute.BonusInt ) { m.RemoveStatMod( "MagicalEnhancementInt" ); m.AddStatMod( new StatMod( StatType.Int, "MagicalEnhancementInt", value, TimeSpan.Zero ) ); } if ( title != EnhancementList[m].Title ) EnhancementList[m].Attributes[att] = value; else EnhancementList[m].Attributes[att] += value; }
public override bool Use( Mobile from ) { if ( from.BeginAction( typeof( ClarityPotion ) ) ) { int amount = Utility.Dice( 3, 3, 3 ); int time = Utility.RandomMinMax( 5, 30 ); from.PlaySound( 0x2D6 ); if ( from.Body.IsHuman ) { from.Animate( 34, 5, 1, true, false, 0 ); } from.FixedParticles( 0x375A, 10, 15, 5011, EffectLayer.Head ); from.PlaySound( 0x1EB ); StatMod mod = from.GetStatMod( "Concussion" ); if ( mod != null ) { from.RemoveStatMod( "Concussion" ); from.Mana -= mod.Offset; } from.PlaySound( 0x1EE ); from.AddStatMod( new StatMod( StatType.Int, "clarity-potion", amount, TimeSpan.FromMinutes( time ) ) ); Timer.DelayCall( TimeSpan.FromMinutes( time ), delegate() { from.EndAction( typeof( ClarityPotion ) ); } ); return true; } return false; }
public override bool Eat( Mobile from ) { if ( base.Eat( from ) ) { from.PlaySound( 0xF6 ); from.PlaySound( 0x1F7 ); from.FixedParticles( 0x3709, 1, 30, 9963, 13, 3, EffectLayer.Head ); IEntity mfrom = new Entity( Serial.Zero, new Point3D( from.X, from.Y, from.Z - 10 ), from.Map ); IEntity mto = new Entity( Serial.Zero, new Point3D( from.X, from.Y, from.Z + 50 ), from.Map ); Effects.SendMovingParticles( mfrom, mto, 0x2255, 1, 0, false, false, 13, 3, 9501, 1, 0, EffectLayer.Head, 0x100 ); StatMod mod; mod = from.GetStatMod( "[Magic] Str Offset" ); if ( mod != null && mod.Offset < 0 ) from.RemoveStatMod( "[Magic] Str Offset" ); mod = from.GetStatMod( "[Magic] Dex Offset" ); if ( mod != null && mod.Offset < 0 ) from.RemoveStatMod( "[Magic] Dex Offset" ); mod = from.GetStatMod( "[Magic] Int Offset" ); if ( mod != null && mod.Offset < 0 ) from.RemoveStatMod( "[Magic] Int Offset" ); from.Paralyzed = false; from.Sleep = false; // SA Mysticism Edit EvilOmenSpell.TryEndEffect( from ); StrangleSpell.RemoveCurse( from ); CorpseSkinSpell.RemoveCurse( from ); CurseSpell.RemoveEffect( from ); BuffInfo.RemoveBuff( from, BuffIcon.Clumsy ); BuffInfo.RemoveBuff( from, BuffIcon.FeebleMind ); BuffInfo.RemoveBuff( from, BuffIcon.Weaken ); BuffInfo.RemoveBuff( from, BuffIcon.MassCurse ); return true; } return false; }
public static void SetValue(Mobile m, AosAttribute att, int value, string title) { if (!EnhancementList.ContainsKey(m)) { AddMobile(m); } if (att == AosAttribute.BonusStr) { m.RemoveStatMod("MagicalEnhancementStr"); m.AddStatMod(new StatMod(StatType.Str, "MagicalEnhancementStr", value, TimeSpan.Zero)); } else if (att == AosAttribute.BonusDex) { m.RemoveStatMod("MagicalEnhancementDex"); m.AddStatMod(new StatMod(StatType.Dex, "MagicalEnhancementDex", value, TimeSpan.Zero)); } else if (att == AosAttribute.BonusInt) { m.RemoveStatMod("MagicalEnhancementInt"); m.AddStatMod(new StatMod(StatType.Int, "MagicalEnhancementInt", value, TimeSpan.Zero)); } EnhancementAttributes match = EnhancementList[m].FirstOrDefault(attrs => attrs.Title == title); if (match != null) { match.Attributes[att] = value; } else { match = new EnhancementAttributes(title); match.Attributes[att] = value; EnhancementList[m].Add(match); } m.CheckStatTimers(); m.UpdateResistances(); m.Delta(MobileDelta.Stat | MobileDelta.WeaponDamage | MobileDelta.Hits | MobileDelta.Stam | MobileDelta.Mana); }
public static void RemoveEffect(Mobile m) { if (m_Table.ContainsKey(m)) { object[] mods = (object[])m_Table[m]; if (mods != null) { m.RemoveStatMod(((StatMod)mods[0]).Name); m.RemoveStatMod(((StatMod)mods[1]).Name); m.RemoveSkillMod((SkillMod)mods[2]); m.RemoveSkillMod((SkillMod)mods[3]); m.RemoveSkillMod((SkillMod)mods[4]); m.RemoveSkillMod((SkillMod)mods[5]); m.RemoveSkillMod((SkillMod)mods[6]); } m_Table.Remove(m); m.EndAction(typeof(RogueIntimidationSpell)); } }
public static void SetValue(Mobile m, AosAttribute att, int value, string title) { if (!EnhancementList.ContainsKey(m)) { AddMobile(m, title); } if (EnhancementList[m].Attributes[att] > value) { return; } if (att == AosAttribute.BonusStr) { m.RemoveStatMod("MagicalEnhancementStr"); m.AddStatMod(new StatMod(StatType.Str, "MagicalEnhancementStr", value, TimeSpan.Zero)); } else if (att == AosAttribute.BonusDex) { m.RemoveStatMod("MagicalEnhancementDex"); m.AddStatMod(new StatMod(StatType.Dex, "MagicalEnhancementDex", value, TimeSpan.Zero)); } else if (att == AosAttribute.BonusInt) { m.RemoveStatMod("MagicalEnhancementInt"); m.AddStatMod(new StatMod(StatType.Int, "MagicalEnhancementInt", value, TimeSpan.Zero)); } if (title != EnhancementList[m].Title) { EnhancementList[m].Attributes[att] = value; } else { EnhancementList[m].Attributes[att] += value; } }
public static void RemoveEffect(Mobile m) { if (m_Table.ContainsKey(m)) { object[] mods = m_Table[m]; if (mods != null) { m.RemoveStatMod(((StatMod)mods[0]).Name); m.RemoveSkillMod((SkillMod)mods[1]); m.RemoveSkillMod((SkillMod)mods[2]); } m_Table.Remove(m); m.BodyMod = 0; m.EndAction(typeof(RogueSlyFoxSpell)); } }
public override bool Use(Mobile from) { if (from.BeginAction(typeof(ClarityPotion))) { int amount = Utility.Dice(3, 3, 3); int time = Utility.RandomMinMax(5, 30); from.PlaySound(0x2D6); if (from.Body.IsHuman) { from.Animate(34, 5, 1, true, false, 0); } from.FixedParticles(0x375A, 10, 15, 5011, EffectLayer.Head); from.PlaySound(0x1EB); StatMod mod = from.GetStatMod("Concussion"); if (mod != null) { from.RemoveStatMod("Concussion"); from.Mana -= mod.Offset; } from.PlaySound(0x1EE); from.AddStatMod(new StatMod(StatType.Int, "clarity-potion", amount, TimeSpan.FromMinutes(time))); Timer.DelayCall(TimeSpan.FromMinutes(time), delegate() { from.EndAction(typeof(ClarityPotion)); }); return(true); } return(false); }
public static void RemoveCurses( Mobile m ) { // play the sound m.PlaySound( 0xF6 ); m.PlaySound( 0x1F7 ); // do the effects m.FixedParticles( 0x3709, 1, 30, 9963, 13, 3, EffectLayer.Head ); IEntity from = new DummyEntity( Serial.Zero, new Point3D( m.X, m.Y, m.Z - 10 ), m.Map ); IEntity to = new DummyEntity( Serial.Zero, new Point3D( m.X, m.Y, m.Z + 50 ), m.Map ); Effects.SendMovingParticles( from, to, 0x2255, 1, 0, false, false, 13, 3, 9501, 1, 0, EffectLayer.Head, 0x100 ); // remove stat mods StatMod mod; foreach ( string statModName in StatModNames ) { mod = m.GetStatMod( statModName ); if ( mod != null && mod.Offset < 0 ) m.RemoveStatMod( statModName ); } m.Paralyzed = false; EvilOmenSpell.CheckEffect( m ); StrangleSpell.RemoveCurse( m ); CorpseSkinSpell.RemoveCurse( m ); CurseSpell.RemoveEffect( m ); MortalStrike.EndWound( m ); BloodOathSpell.EndEffect( m ); SpellPlagueSpell.RemoveEffect( m ); SleepSpell.RemoveEffect( m ); MindRotSpell.ClearMindRotScalar( 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 ); BuffInfo.RemoveBuff( m, BuffIcon.MortalStrike ); BuffInfo.RemoveBuff( m, BuffIcon.Sleep ); BuffInfo.RemoveBuff( m, BuffIcon.MassSleep ); BuffInfo.RemoveBuff( m, BuffIcon.Mindrot ); }
protected override bool OnDeactivate(Mobile m, Tuple<EquipmentSetPart, Item>[] equipped) { if (m == null || m.Deleted || equipped == null) { return false; } if (EquipmentSets.CMOptions.ModuleDebug) { EquipmentSets.CMOptions.ToConsole( "OnDeactivate: '{0}', '{1}', '{2}', '{3}', '{4}'", m, UID, _Stat, _Offset, _Duration.ToSimpleString()); } m.RemoveStatMod(UID); return true; }
public static void DrugBonus(Mobile from, string type, int degree, int duration) { if (from == null || from.Deleted) return; if (type == null) return; if (!(from is PlayerMobile)) return; if (degree < 1) degree = 1; if (duration < 10) duration = 10; from.RemoveStatMod("Severe Withdrawal"); if (type == "Tobacco") { from.RemoveStatMod("Tobacco Withdrawal"); from.RemoveStatMod("Tobacco"); degree = (int)(degree * (1 - (0.05 * ( degree / 10 )))); if(degree < 0) degree = 0; XmlDex drugBonus = new XmlDex(degree, duration); drugBonus.Name = "Tobacco"; XmlAttach.AttachTo(from, new XmlDex(degree, duration)); } else if (type == "Swampweed") { from.RemoveStatMod("Swampweed Withdrawal"); from.RemoveStatMod("Swampweed"); degree = (int)(degree * (1 - (0.05 * (degree / 10)))); if (degree < 0) degree = 0; XmlDex drugBonus = new XmlDex(degree, duration); drugBonus.Name = "Swampweed"; XmlAttach.AttachTo(from, new XmlInt(degree, duration)); } else if (type == "Qat") { from.RemoveStatMod("Qat Withdrawal"); from.RemoveStatMod("Qat"); degree = (int)(degree * (1 - (0.05 * (degree / 10)))); if (degree < 0) degree = 0; XmlDex drugBonus = new XmlDex(degree, duration); drugBonus.Name = "Qat"; XmlAttach.AttachTo(from, new XmlStr(degree, duration)); } else if (type == "Banestone") { from.RemoveStatMod("Banestone Withdrawal"); from.RemoveStatMod("Banestone"); degree = (int)(degree * (1 - (0.05 * (degree / 10)))); if (degree < 0) degree = 0; XmlDex drugBonus = new XmlDex(degree, duration); drugBonus.Name = "Banestone"; XmlAttach.AttachTo(from, new XmlMana(degree, duration)); } else if (type == "Opium") { from.RemoveStatMod("Opium Withdrawal"); from.RemoveStatMod("Opium"); degree = (int)(degree * (1 - (0.05 * (degree / 10)))); if (degree < 0) degree = 0; XmlDex drugBonus = new XmlDex(degree, duration); drugBonus.Name = "Opium"; XmlAttach.AttachTo(from, new XmlHits(degree, duration)); } }
private static void ClearMods( Mobile from, ArrayList mods ) { for ( int i = 0; i < mods.Count; ++i ) { object mod = mods[i]; if ( mod is ResistanceMod ) from.RemoveResistanceMod( (ResistanceMod) mod ); else if ( mod is StatMod ) from.RemoveStatMod( ( (StatMod) mod ).Name ); else if ( mod is SkillMod ) from.RemoveSkillMod( (SkillMod) mod ); } }
public override void CureEffect( Mobile mobile ) { mobile.RemoveStatMod( ModName ); }
public void RemoveStatBonuses( Mobile from ) { string modName = Owner.Serial.ToString(); from.RemoveStatMod( modName + "Str" ); from.RemoveStatMod( modName + "Dex" ); from.RemoveStatMod( modName + "Int" ); from.CheckStatTimers(); }
public static void RemoveEffect( Mobile m ) { object[] mods = (object[])m_Table[m]; if ( mods != null ) { m.RemoveStatMod( ((StatMod)mods[0]).Name ); m.RemoveStatMod( ((StatMod)mods[1]).Name ); m.RemoveSkillMod( (SkillMod)mods[2] ); m.RemoveSkillMod( (SkillMod)mods[3] ); } m_Table.Remove( m ); m.EndAction( typeof( RangerHuntersAimSpell ) ); m.BodyMod = 0; }
private void RemoveCurses( Mobile m ) { StatMod mod; foreach ( string statModName in StatModNames ) { mod = m.GetStatMod( statModName ); if ( mod != null && mod.Offset < 0 ) m.RemoveStatMod( statModName ); } m.Paralyzed = false; EvilOmenSpell.CheckEffect( m ); StrangleSpell.RemoveCurse( m ); CorpseSkinSpell.RemoveCurse( m ); CurseSpell.RemoveEffect( m ); MortalStrike.EndWound( m ); BloodOathSpell.EndEffect( m ); SpellPlagueSpell.RemoveEffect( m ); SleepSpell.RemoveEffect( m ); MindRotSpell.ClearMindRotScalar( 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 ); BuffInfo.RemoveBuff( m, BuffIcon.MortalStrike ); BuffInfo.RemoveBuff( m, BuffIcon.Sleep ); BuffInfo.RemoveBuff( m, BuffIcon.MassSleep ); BuffInfo.RemoveBuff( m, BuffIcon.Mindrot ); }
public void ApplyStatBonuses(Mobile wearer, StatType stat) { // BE CAREFUL! This function is an event handler for Mobile.StatChange. AddStatMod invokes StatChange - ie, the potential here for an // infinite recursion loop is VERY real. Make sure that you do not make stats interdependant on bonuses!!! // ie when calculating DexBonus, you can use Str or Int but using Dex will cause a loop. // using Str in calc'ing DexBonus and ALSO using Dex in calc'ing StrBonus will also cause a loop. // See examples. wearer.CheckStatTimers(); string modName = this.Serial.ToString(); /* EXAMPLES * * if ((stat & StatType.Dex) != 0) * { * Here I can add statmods for Str and Int but not Dex. * } * if ((stat & StatType.Int) != 0 && (stat & StatType.Str) != 0) * { * Here I can only add statmods for Dex, because the calculation is using Int and Str * } */ if ((stat & StatType.Str) != 0) // since we're handling Str, we're not allowed to modify it { double dexBonus = ComputeStatBonus( StatType.Dex, wearer ); if (dexBonus != 0 && (wearer.GetStatMod(modName + "Dex") == null || wearer.GetStatMod(modName + "Dex").Offset != dexBonus)) wearer.AddStatMod( new StatMod( StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero ) ); if (dexBonus == 0) wearer.RemoveStatMod(modName + "Dex"); } }
public static bool ClearSkillLoss( Mobile mob ) { SkillLossContext context; m_SkillLoss.TryGetValue( mob, out context ); if ( context != null ) { m_SkillLoss.Remove( mob ); List<SkillMod> mods = context.m_SkillMods; for ( int i = 0; i < mods.Count; ++i ) mob.RemoveSkillMod( mods[i] ); context.m_Timer.Stop(); return true; } mob.RemoveStatMod( "Murder Penalty Str" ); mob.RemoveStatMod( "Murder Penalty Dex" ); mob.RemoveStatMod( "Murder Penalty Int" ); return false; }
public static void WipeMods(Mobile m) { PlayerMobile pm = m as PlayerMobile; m.DisruptiveAction(); foreach (StatType Stat in Enum.GetValues(typeof(StatType))) { string name = String.Format("[Magic] {0} Offset", Stat); if (m.GetStatMod(name) != null) m.RemoveStatMod(name); } if (TransformationSpellHelper.UnderTransformation(m)) TransformationSpellHelper.RemoveContext(m, true); m.HueMod = -1; m.NameMod = null; PolymorphSpell.StopTimer(m); IncognitoSpell.StopTimer(m); DisguiseGump.StopTimer(m); foreach (Type T in DispelActions) m.EndAction(T); m.BodyMod = 0; m.HueMod = -1; if (pm != null) { if (pm.BuffTable != null) { List<BuffInfo> list = new List<BuffInfo>(); foreach (BuffInfo buff in pm.BuffTable.Values) { if (!buff.RetainThroughDeath) { list.Add(buff); } } for (int i = 0; i < list.Count; i++) { pm.RemoveBuff(list[i]); } } pm.SavagePaintExpiration = TimeSpan.Zero; pm.SetHairMods(-1, -1); pm.ResendBuffs(); } m.VirtualArmorMod = 0; BaseArmor.ValidateMobile(m); BaseClothing.ValidateMobile(m); }
protected override void OnTargetRemoved( Mobile m ) { BuffInfo.RemoveBuff( m, this.BuffIcon ); foreach ( AttributeMod mod in m_Mods ) { m.RemoveAttributeMod( mod ); } foreach ( StatMod mod in m_StatMods ) { m.RemoveStatMod( mod.Name ); } }
public override void OnDoubleClick( Mobile from ) { VampGloves gloves = from.FindItemOnLayer( Layer.Gloves ) as VampGloves; VampHelm helm = from.FindItemOnLayer( Layer.Helm ) as VampHelm; VampLegs legs = from.FindItemOnLayer( Layer.Pants ) as VampLegs; VampArms arms = from.FindItemOnLayer( Layer.Arms ) as VampArms; VampGorget gorget = from.FindItemOnLayer( Layer.Neck ) as VampGorget; VampEarrings earrings = from.FindItemOnLayer( Layer.Earrings ) as VampEarrings; VampRing ring = from.FindItemOnLayer( Layer.Ring ) as VampRing; VampBracelet bracelet = from.FindItemOnLayer( Layer.Bracelet ) as VampBracelet; if ( Parent != from ) { from.SendMessage( "The Shroud of Dracula must be equiped to be used." ); } else if ( from.Mounted == true ) { from.SendMessage( "You cannot be mounted while trying to transform!" ); } else if ( gloves == null || helm == null || legs == null || arms == null || gorget == null || earrings == null || ring == null || bracelet == null ) { from.SendMessage( "You must have all the pieces of the Vampire equiped to transform!" ); } else if ( this.Transformed == false ) { LootType = LootType.Blessed; from.SendMessage( "You pull the hood over your head." ); from.PlaySound( 0x220 ); //from.Title = "the True Vampire"; from.BodyMod = 146; from.NameHue = 39; from.HueMod = 1; from.DisplayGuildTitle = false; this.Transformed = true; ItemID = 9860; from.RemoveItem(this); from.EquipItem(this); m_StatMod0 = new StatMod( StatType.Str, "MOD0", 25, TimeSpan.Zero ); m_StatMod1 = new StatMod( StatType.Int, "MOD1", 25, TimeSpan.Zero ); m_StatMod2 = new StatMod( StatType.Dex, "MOD2", 25, TimeSpan.Zero ); from.AddStatMod( m_StatMod0 ); from.AddStatMod( m_StatMod1 ); from.AddStatMod( m_StatMod2 ); } else { from.SendMessage( "You lower the hood." ); from.PlaySound( 0x220 ); //from.Title = null; from.BodyMod = 0x0; from.NameHue = -1; from.HueMod = -1; from.DisplayGuildTitle = true; this.Transformed = false; ItemID = 0x1F03; from.RemoveItem(this); from.EquipItem(this); from.RemoveStatMod( "MOD0" ); from.RemoveStatMod( "MOD1" ); from.RemoveStatMod( "MOD2" ); } }
public override void RemoveBuff( Mobile m ) { m.RemoveStatMod( "[BalmOrLotion] Int Offset" ); }
public bool DoPrayerEffect(PlayerMobile from, Mobile target) { if (target == null || target.Deleted || !target.Alive || target.IsDeadBondedPet) return false; if (from == null || from.Deleted) return false; if (!String.IsNullOrEmpty(m_Message)) target.SendMessage(m_Message); target.SendSound(SoundID); int offset = m_Intensity + PowerBonus(from); switch (m_Effect) { case PrayerEffect.Strength: { #region Strength string name = String.Format("[Prayer] {0} Offset", m_Effect); StatMod mod = target.GetStatMod(name); //one is negative and the other is positive, so adding up if (mod != null && ((mod.Offset <= 0 && offset > 0) || (offset < 0 && mod.Offset >= 0))) { target.RemoveStatMod(name); target.AddStatMod(new StatMod(StatType.Str, name, mod.Offset + offset, TimeSpan.FromSeconds(m_Duration))); return true; } //nothing to replace, just adding else if (mod == null) { target.AddStatMod(new StatMod(StatType.Str, name, offset, TimeSpan.FromSeconds(m_Duration))); return true; } //replacing the current mod with a larger one else if (mod != null && ((mod.Offset <= 0 && offset < mod.Offset) || (mod.Offset >= 0 && mod.Offset < offset))) { target.RemoveStatMod(name); target.AddStatMod(new StatMod(StatType.Str, name, offset, TimeSpan.FromSeconds(m_Duration))); return true; } return false; #endregion } case PrayerEffect.Dexterity: { #region Dexterity string name = String.Format("[Prayer] {0} Offset", m_Effect); StatMod mod = target.GetStatMod(name); //one is negative and the other is positive, so adding up if (mod != null && ((mod.Offset <= 0 && offset > 0) || (offset < 0 && mod.Offset >= 0))) { target.RemoveStatMod(name); target.AddStatMod(new StatMod(StatType.Dex, name, mod.Offset + offset, TimeSpan.FromSeconds(m_Duration))); return true; } //nothing to replace, just adding else if (mod == null) { target.AddStatMod(new StatMod(StatType.Dex, name, offset, TimeSpan.FromSeconds(m_Duration))); return true; } //replacing the current mod with a larger one else if (mod != null && ((mod.Offset <= 0 && offset < mod.Offset) || (mod.Offset >= 0 && mod.Offset < offset))) { target.RemoveStatMod(name); target.AddStatMod(new StatMod(StatType.Dex, name, offset, TimeSpan.FromSeconds(m_Duration))); return true; } return false; #endregion } case PrayerEffect.Intelligence: { #region Intelligence string name = String.Format("[Prayer] {0} Offset", m_Effect); StatMod mod = target.GetStatMod(name); //one is negative and the other is positive, so adding up if (mod != null && ((mod.Offset <= 0 && offset > 0) || (offset < 0 && mod.Offset >= 0))) { target.RemoveStatMod(name); target.AddStatMod(new StatMod(StatType.Int, name, mod.Offset + offset, TimeSpan.FromSeconds(m_Duration))); return true; } //nothing to replace, just adding else if (mod == null) { target.AddStatMod(new StatMod(StatType.Int, name, offset, TimeSpan.FromSeconds(m_Duration))); return true; } //replacing the current mod with a larger one else if (mod != null && ((mod.Offset <= 0 && offset < mod.Offset) || (mod.Offset >= 0 && mod.Offset < offset))) { target.RemoveStatMod(name); target.AddStatMod(new StatMod(StatType.Int, name, offset, TimeSpan.FromSeconds(m_Duration))); return true; } return false; #endregion } case PrayerEffect.RawHitPoints: { #region RawHits string name = String.Format("[Prayer] {0} Offset", m_Effect); StatMod mod = target.GetStatMod(name); //one is negative and the other is positive, so adding up if (mod != null && ((mod.Offset <= 0 && offset > 0) || (offset < 0 && mod.Offset >= 0))) { target.RemoveStatMod(name); target.AddStatMod(new StatMod(StatType.HitsMax, name, mod.Offset + offset, TimeSpan.FromSeconds(m_Duration))); return true; } //nothing to replace, just adding else if (mod == null) { target.AddStatMod(new StatMod(StatType.HitsMax, name, offset, TimeSpan.FromSeconds(m_Duration))); return true; } //replacing the current mod with a larger one else if (mod != null && ((mod.Offset <= 0 && offset < mod.Offset) || (mod.Offset >= 0 && mod.Offset < offset))) { target.RemoveStatMod(name); target.AddStatMod(new StatMod(StatType.HitsMax, name, offset, TimeSpan.FromSeconds(m_Duration))); return true; } return false; #endregion } case PrayerEffect.CurrentHitPoints: { target.Hits += offset; return true; } case PrayerEffect.RawStamina: { #region RawStam string name = String.Format("[Prayer] {0} Offset", m_Effect); StatMod mod = target.GetStatMod(name); //one is negative and the other is positive, so adding up if (mod != null && ((mod.Offset <= 0 && offset > 0) || (offset < 0 && mod.Offset >= 0))) { target.RemoveStatMod(name); target.AddStatMod(new StatMod(StatType.StamMax, name, mod.Offset + offset, TimeSpan.FromSeconds(m_Duration))); return true; } //nothing to replace, just adding else if (mod == null) { target.AddStatMod(new StatMod(StatType.StamMax, name, offset, TimeSpan.FromSeconds(m_Duration))); return true; } //replacing the current mod with a larger one else if (mod != null && ((mod.Offset <= 0 && offset < mod.Offset) || (mod.Offset >= 0 && mod.Offset < offset))) { target.RemoveStatMod(name); target.AddStatMod(new StatMod(StatType.StamMax, name, offset, TimeSpan.FromSeconds(m_Duration))); return true; } return false; #endregion } case PrayerEffect.CurrentStamina: { target.Stam += offset; return true; } case PrayerEffect.RawMana: { #region RawMana string name = String.Format("[Prayer] {0} Offset", m_Effect); StatMod mod = target.GetStatMod(name); //one is negative and the other is positive, so adding up if (mod != null && ((mod.Offset <= 0 && offset > 0) || (offset < 0 && mod.Offset >= 0))) { target.RemoveStatMod(name); target.AddStatMod(new StatMod(StatType.ManaMax, name, mod.Offset + offset, TimeSpan.FromSeconds(m_Duration))); return true; } //nothing to replace, just adding else if (mod == null) { target.AddStatMod(new StatMod(StatType.ManaMax, name, offset, TimeSpan.FromSeconds(m_Duration))); return true; } //replacing the current mod with a larger one else if (mod != null && ((mod.Offset <= 0 && offset < mod.Offset) || (mod.Offset >= 0 && mod.Offset < offset))) { target.RemoveStatMod(name); target.AddStatMod(new StatMod(StatType.ManaMax, name, offset, TimeSpan.FromSeconds(m_Duration))); return true; } return false; #endregion } case PrayerEffect.CurrentMana: { target.Mana += offset; return true; } case PrayerEffect.BluntResistance: { ResistancePrayerTimer timer = new ResistancePrayerTimer(target, ResistanceType.Blunt, offset, m_Duration); timer.Start(); return true; } case PrayerEffect.PiercingResistance: { ResistancePrayerTimer timer = new ResistancePrayerTimer(target, ResistanceType.Piercing, offset, m_Duration); timer.Start(); return true; } case PrayerEffect.SlashingResistance: { ResistancePrayerTimer timer = new ResistancePrayerTimer(target, ResistanceType.Slashing, offset, m_Duration); timer.Start(); return true; } case PrayerEffect.ColdResistance: { ResistancePrayerTimer timer = new ResistancePrayerTimer(target, ResistanceType.Cold, offset, m_Duration); timer.Start(); return true; } case PrayerEffect.FireResistance: { ResistancePrayerTimer timer = new ResistancePrayerTimer(target, ResistanceType.Fire, offset, m_Duration); timer.Start(); return true; } case PrayerEffect.PoisonResistance: { ResistancePrayerTimer timer = new ResistancePrayerTimer(target, ResistanceType.Poison, offset, m_Duration); timer.Start(); return true; } case PrayerEffect.EnergyResistance: { ResistancePrayerTimer timer = new ResistancePrayerTimer(target, ResistanceType.Energy, offset, m_Duration); timer.Start(); return true; } case PrayerEffect.AttackChance: { XmlAosAttribute att = new XmlAosAttribute(AosAttribute.AttackChance, offset, m_Duration); att.Name = String.Format("[Prayer] {0} Offset", m_Effect); XmlAttach.AttachTo(target, att); return true; } case PrayerEffect.DefendChance: { XmlAosAttribute att = new XmlAosAttribute(AosAttribute.DefendChance, offset, m_Duration); att.Name = String.Format("[Prayer] {0} Offset", m_Effect); XmlAttach.AttachTo(target, att); return true; } default: return false; } }
public static void CalculatePenalty( Mobile m ) { if( m is PlayerMobile && ( (PlayerMobile)m ).IsVampire ) return; double percentagePenalty; int strOffset, dexOffset; if ( m.Thirst < 5 ) { percentagePenalty = ((5-m.Thirst)*2)*0.01; strOffset = (int)(m.RawStr*percentagePenalty); dexOffset = (int)(m.RawDex*percentagePenalty); m.AddStatMod( new StatMod( StatType.Str, "[Dehydration] STR", -strOffset, TimeSpan.Zero ) ); m.AddStatMod( new StatMod( StatType.Dex, "[Dehydration] DEX", -dexOffset, TimeSpan.Zero ) ); } else { m.RemoveStatMod( "[Dehydration] STR" ); m.RemoveStatMod( "[Dehydration] DEX" ); } if ( m.Hunger < 5 ) { percentagePenalty = ((5-m.Hunger)*2)*0.01; strOffset = (int)(m.RawStr*percentagePenalty); dexOffset = (int)(m.RawDex*percentagePenalty); m.AddStatMod( new StatMod( StatType.Str, "[Starvation] STR", -strOffset, TimeSpan.Zero ) ); m.AddStatMod( new StatMod( StatType.Dex, "[Starvation] DEX", -dexOffset, TimeSpan.Zero ) ); } else { m.RemoveStatMod( "[Starvation] STR" ); m.RemoveStatMod( "[Starvation] DEX" ); } }
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. }
private void Refresh(Mobile m) { List<StatMod> toRemove = new List<StatMod>(); foreach(StatMod mod in m.StatMods) { if(mod.Name.Contains("[Magic]")) toRemove.Add(mod); } foreach(StatMod mod in toRemove) { m.RemoveStatMod(mod.Name); } m.Hits = m.HitsMax; m.Stam = m.StamMax; m.Mana = m.ManaMax; m.Poison = null; m.Combatant = null; }
public static void RemoveStatBonuses( Mobile from, Item item ) { string modName = item.Serial.ToString(); from.RemoveStatMod( modName + "SetStr" ); from.RemoveStatMod( modName + "SetDex" ); from.RemoveStatMod( modName + "SetInt" ); from.Delta( MobileDelta.Armor ); from.CheckStatTimers(); }
public override void OnGaveMeleeAttack( Mobile defender ) { base.OnGaveMeleeAttack( defender ); if ( Utility.RandomBool() ) { if ( Rotworm.IsDiseased( defender ) ) { // * The bloodworm is repulsed by your diseased blood. * defender.SendLocalizedMessage( 1111668, "", 0x25 ); } else { // *The bloodworm drains some of your blood to replenish its health.* defender.SendLocalizedMessage( 1111698, "", 0x25 ); Hits += ( defender.HitsMax - defender.Hits ); } } if ( 0.1 > Utility.RandomDouble() && !IsAnemic( defender ) && !FontOfFortune.HasBlessing( defender, FontOfFortune.BlessingType.Protection ) ) { defender.SendLocalizedMessage( 1111669 ); // The bloodworm's attack weakens you. You have become anemic. defender.AddStatMod( new StatMod( StatType.Str, "[Bloodworm] Str Malus", -40, TimeSpan.FromSeconds( 15.0 ) ) ); defender.AddStatMod( new StatMod( StatType.Dex, "[Bloodworm] Dex Malus", -40, TimeSpan.FromSeconds( 15.0 ) ) ); defender.AddStatMod( new StatMod( StatType.Int, "[Bloodworm] Int Malus", -40, TimeSpan.FromSeconds( 15.0 ) ) ); Effects.SendPacket( defender, defender.Map, new GraphicalEffect( EffectType.FixedFrom, defender.Serial, Serial.Zero, 0x375A, defender.Location, defender.Location, 9, 20, true, false ) ); Effects.SendTargetParticles( defender, 0x373A, 1, 15, 0x26B9, EffectLayer.Head ); Effects.SendLocationParticles( defender, 0x11A6, 9, 32, 0x253A ); defender.PlaySound( 0x1ED ); Timer.DelayCall( TimeSpan.FromSeconds( 15.0 ), new TimerCallback( delegate { // You recover from your anemia. defender.SendLocalizedMessage( 1111670 ); defender.RemoveStatMod( "[Bloodworm] Str Malus" ); defender.RemoveStatMod( "[Bloodworm] Dex Malus" ); defender.RemoveStatMod( "[Bloodworm] Int Malus" ); } ) ); } }
public override void Remove( Mobile m ) { base.Remove( m ); m.RemoveStatMod( "[FontOfFortune] Stat Offset" ); }
/// <summary> /// Fully refreshes the targetted player. /// Prevents any type of pre-casting or other advantages. /// </summary> /// <param name="targ"> The target to be refreshed</param> private void Refresh(Mobile targ) { try { targ.Mana = targ.ManaMax; targ.Hits = targ.HitsMax; targ.Stam = targ.StamMax; targ.Poison = null; targ.Say("*Refreshed!*"); targ.Say("*Debuffed!*"); Server.Targeting.Target.Cancel(targ); if (targ.MeleeDamageAbsorb > 0) { targ.MeleeDamageAbsorb = 0; //targ.EndAction(typeof(RechargeSpell)); //ReactiveArmorSpell.EndArmor(targ); targ.SendMessage("Reactive armor has been nullified."); } if (targ.MagicDamageAbsorb > 0) { targ.MagicDamageAbsorb = 0; targ.SendMessage("Magic Reflection has been nullified."); } StatMod mod; mod = targ.GetStatMod("[Magic] Str Offset"); if (mod != null) targ.RemoveStatMod("[Magic] Str Offset"); mod = targ.GetStatMod("[Magic] Dex Offset"); if (mod != null) targ.RemoveStatMod("[Magic] Dex Offset"); mod = targ.GetStatMod("[Magic] Int Offset"); if (mod != null) targ.RemoveStatMod("[Magic] Int Offset"); targ.Paralyzed = false; BuffInfo.RemoveBuff(targ, BuffIcon.Clumsy); BuffInfo.RemoveBuff(targ, BuffIcon.FeebleMind); BuffInfo.RemoveBuff(targ, BuffIcon.Weaken); BuffInfo.RemoveBuff(targ, BuffIcon.MassCurse); BuffInfo.RemoveBuff(targ, BuffIcon.Agility); BuffInfo.RemoveBuff(targ, BuffIcon.Cunning); BuffInfo.RemoveBuff(targ, BuffIcon.Strength); BuffInfo.RemoveBuff(targ, BuffIcon.Bless); } catch (Exception e) { Console.WriteLine("Error : " + e.Message); Console.WriteLine("Location : " + e.InnerException); } }
public static void Debuff( Mobile mob ) { mob.RemoveStatMod( "[Magic] Str Offset" ); mob.RemoveStatMod( "[Magic] Dex Offset" ); mob.RemoveStatMod( "[Magic] Int Offset" ); mob.RemoveStatMod( "Concussion" ); mob.RemoveStatMod( "blood-rose" ); mob.RemoveStatMod( "clarity-potion" ); OrangePetals.RemoveContext( mob ); mob.Paralyzed = false; mob.Hidden = false; if ( !Core.AOS ) { mob.MagicDamageAbsorb = 0; mob.MeleeDamageAbsorb = 0; Spells.Second.ProtectionSpell.Registry.Remove( mob ); Spells.Fourth.ArchProtectionSpell.RemoveEntry( mob ); mob.EndAction( typeof( DefensiveSpell ) ); } TransformationSpellHelper.RemoveContext( mob, true ); AnimalForm.RemoveContext( mob, true ); if( DisguiseTimers.IsDisguised( mob ) ) DisguiseTimers.StopTimer( mob ); if( !mob.CanBeginAction( typeof( PolymorphSpell ) ) ) { mob.BodyMod = 0; mob.HueMod = -1; mob.EndAction( typeof( PolymorphSpell ) ); } BaseArmor.ValidateMobile( mob ); BaseClothing.ValidateMobile( mob ); mob.Hits = mob.HitsMax; mob.Stam = mob.StamMax; mob.Mana = mob.ManaMax; mob.Poison = null; }
protected override void OnTargetRemoved( Mobile m ) { base.OnTargetRemoved( m ); foreach ( StatMod mod in m_StatMods ) m.RemoveStatMod( mod.Name ); }
public static void CleanUp(Mobile m) { if (m == null || m.Deleted) return; XmlAddiction addAtt = XmlAttach.FindAttachment(m, typeof(XmlAddiction)) as XmlAddiction; if (addAtt == null || addAtt.Deleted) return; m.RemoveStatMod("Tobacco Withdrawal"); m.RemoveStatMod("Tobacco"); m.RemoveStatMod("Swampweed Withdrawal"); m.RemoveStatMod("Swampweed"); m.RemoveStatMod("Qat Withdrawal"); m.RemoveStatMod("Qat"); m.RemoveStatMod("Banestone Withdrawal"); m.RemoveStatMod("Banestone"); m.RemoveStatMod("Opium Withdrawal"); m.RemoveStatMod("Opium"); }
/// <summary> /// Removes the mobile and/or attributes from the dictionary /// </summary> /// <param name="m"></param> /// <param name="title">null or default value will remove the entire entry. Add the title arg to remove only that element from the list.</param> /// <returns></returns> public static bool RemoveMobile(Mobile m, string title = null) { if (EnhancementList.ContainsKey(m)) { if (title != null) { EnhancementAttributes match = null; for (var index = 0; index < EnhancementList[m].Count; index++) { var attrs = EnhancementList[m][index]; if (attrs.Title == title) { match = attrs; break; } } if (match != null && EnhancementList[m].Contains(match)) { if (match.Attributes.BonusStr > 0) { m.RemoveStatMod("MagicalEnhancementStr"); } if (match.Attributes.BonusDex > 0) { m.RemoveStatMod("MagicalEnhancementDex"); } if (match.Attributes.BonusInt > 0) { m.RemoveStatMod("MagicalEnhancementInt"); } EnhancementList[m].Remove(match); } } if (EnhancementList[m].Count == 0 || title == null) { EnhancementList.Remove(m); } m.CheckStatTimers(); m.UpdateResistances(); m.Delta(MobileDelta.Stat | MobileDelta.WeaponDamage | MobileDelta.Hits | MobileDelta.Stam | MobileDelta.Mana); for (var index = 0; index < m.Items.Count; index++) { var i = m.Items[index]; i.InvalidateProperties(); } return(true); } return(false); }