public static int GetHPBonus(Mobile m) { SkillMasterySpell spell = GetSpellForParty(m, typeof(InvigorateSpell)); if (spell != null) { return(spell.StatBonus()); } return(0); }
public static int HitChanceBonus(Mobile attacker) { SkillMasterySpell spell = GetSpell(attacker, typeof(FocusedEyeSpell)); if (spell != null) { return(spell.PropertyBonus()); } return(0); }
protected void AddToTable(Mobile from, SkillMasterySpell spell) { lock (_Lock) { if (!m_Table.ContainsKey(from)) { m_Table[from] = new List <SkillMasterySpell>(); } m_Table[from].Add(spell); } }
public override bool CheckCast() { SkillMasterySpell spell = GetSpell(Caster, GetType()); if (spell != null) { spell.Expire(); BuffInfo.RemoveBuff(Caster, BuffIcon.Shadow); return(false); } return(base.CheckCast()); }
public override void OnCast() { BardSpell spell = SkillMasterySpell.GetSpell(Caster, this.GetType()) as BardSpell; if (spell != null) { spell.Expire(); Caster.SendLocalizedMessage(1115774); //You halt your spellsong. } else { Caster.Target = new InternalTarget(this); } }
/// <summary> /// Called in Aos.cs, should include all damage types /// </summary> /// <param name="victim"></param> /// <param name="damager"></param> /// <param name="damage"></param> public static void OnDamage(Mobile victim, Mobile damager, DamageType type, ref int damage) { if (victim == null || damager == null) { return; } CheckTable(victim); foreach (SkillMasterySpell sp in EnumerateSpells(victim)) { if (sp.DamageCanDisrupt && damage > sp.DamageThreshold) { sp.Expire(true); } sp.OnDamaged(damager, victim, type, ref damage); } foreach (SkillMasterySpell sp in GetSpells(s => s.Target == victim)) { sp.OnTargetDamaged(damager, victim, type, ref damage); } SkillMasteryMove move = SpecialMove.GetCurrentMove(victim) as SkillMasteryMove; if (move != null) { move.OnDamaged(damager, victim, type, ref damage); } PerseveranceSpell preserve = SkillMasterySpell.GetSpellForParty(victim, typeof(PerseveranceSpell)) as PerseveranceSpell; if (preserve != null) { preserve.AbsorbDamage(ref damage); } InspireSpell inspire = SkillMasterySpell.GetSpellForParty(damager, typeof(InspireSpell)) as InspireSpell; if (inspire != null) { inspire.DoDamage(ref damage); } CombatTrainingSpell.CheckDamage(damager, victim, type, ref damage); }
public static bool HasHarmfulEffects(Mobile target, Type type) { foreach (Mobile m in m_Table.Keys) { for (var index = 0; index < m_Table[m].Count; index++) { SkillMasterySpell spell = m_Table[m][index]; if (spell != null && spell.GetType() == type && spell.Target == target) { return(true); } } } return(false); }
public static SkillMasterySpell GetSpellForParty(Mobile from, Type type) { //First checks the bard if (m_Table.ContainsKey(from)) { if (m_Table[from] == null || m_Table[from].Count == 0) { m_Table.Remove(from); return(null); } foreach (SkillMasterySpell spell in m_Table[from]) { if (spell != null && spell.GetType() == type) { return(spell); } } } else { Mobile check = from; if (from is BaseCreature && (((BaseCreature)from).Controlled || ((BaseCreature)from).Summoned)) { check = ((BaseCreature)from).GetMaster(); } Party p = Party.Get(check); if (p != null) { foreach (PartyMemberInfo info in p.Members) { SkillMasterySpell spell = GetSpell(info.Mobile, type); if (spell != null && spell.PartyEffects && from.InRange(info.Mobile.Location, spell.PartyRange)) { return(spell); } } } } return(null); }
public static SkillMasterySpell GetHarmfulSpell(Mobile target, Type type) { foreach (Mobile m in m_Table.Keys) { for (var index = 0; index < m_Table[m].Count; index++) { SkillMasterySpell spell = m_Table[m][index]; if (spell != null && spell.GetType() == type && spell.Target == target) { return(spell); } } } return(null); }
public static SkillMasterySpell GetSpellForParty(Mobile from, Type type) { CheckTable(from); Mobile check = from; if (from is BaseCreature bc && (bc.Controlled || bc.Summoned) && bc.GetMaster() != null) { check = bc.GetMaster(); CheckTable(check); } //First checks the caster if (m_Table.ContainsKey(check)) { for (var index = 0; index < m_Table[check].Count; index++) { SkillMasterySpell spell = m_Table[check][index]; if (spell != null && spell.GetType() == type) { return(spell); } } } else { Party p = Party.Get(check); if (p != null) { for (var index = 0; index < p.Members.Count; index++) { PartyMemberInfo info = p.Members[index]; SkillMasterySpell spell = GetSpell(info.Mobile, type); if (spell != null && spell.PartyEffects && from.InRange(info.Mobile.Location, spell.PartyRange) && spell.CheckPartyEffects(info.Mobile)) { return(spell); } } } } return(null); }
public override bool CheckCast() { SkillMasterySpell spell = GetSpell(Caster, GetType()); if (spell != null) { spell.Expire(); return(false); } if (!CheckWeapon()) { Caster.SendLocalizedMessage(1156006); // You must have a swordsmanship weapon equipped to use this ability. return(false); } return(base.CheckCast()); }
public static int GetAttributeBonus(Mobile m, SAAbsorptionAttribute attr) { int value = 0; switch (attr) { case SAAbsorptionAttribute.CastingFocus: SkillMasterySpell spell = SkillMasterySpell.GetSpellForParty(m, typeof(PerseveranceSpell)); if (spell != null) { value += spell.PropertyBonus2(); } break; } return(value); }
public override bool CheckCast() { if (Caster is PlayerMobile && !((PlayerMobile)Caster).Spellweaving) { Caster.SendLocalizedMessage(1073220); // You must have completed the epic arcanist quest to use this ability. return(false); } SkillMasterySpell spell = GetSpell(Caster, this.GetType()); if (spell != null) { spell.Expire(); return(false); } return(base.CheckCast()); }
protected override void OnTarget(object o) { Mobile m = o as Mobile; if (m != null) { if (CheckHSequence(m)) { if (CheckResisted(m)) { m.SendLocalizedMessage(1156101); // You resist the effects of death ray. Caster.SendLocalizedMessage(1156102); // Your target resists the effects of death ray. } else { SpellHelper.CheckReflect(0, Caster, ref m); SkillMasterySpell spell = GetSpell(Caster, this.GetType()); if (spell != null && spell.Target == m) { spell.Expire(); } _Location = Caster.Location; m.FixedParticles(0x374A, 1, 15, 5054, 0x7A2, 7, EffectLayer.Head); Caster.FixedParticles(0x0000, 10, 5, 2054, EffectLayer.Head); double damage = (Caster.Skills[CastSkill].Base + Caster.Skills[DamageSkill].Base) * ((double)GetMasteryLevel() * .8); damage /= Target is PlayerMobile ? 5.15 : 2.5; int mod = (int)Caster.Skills[DamageSkill].Value / 12; _Mod = new ResistanceMod(ResistanceType.Energy, -mod); m.AddResistanceMod(_Mod); BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.DeathRay, 1155896, 1156085, String.Format("{0}\t{1}", ((int)damage).ToString(), m.Name))); // Deals ~2_DAMAGE~ to ~1_NAME~ every 3 seconds while in range. Preforming any action will end spell. BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.DeathRayDebuff, 1155896, 1156086, mod.ToString())); // Energy Resist Debuff: ~1_VAL~% Target = m; BeginTimer(); } } } }
public static bool IsInCooldown(Mobile m, Type type, bool message = true) { CheckCooldown(); if (_Cooldown == null) { return(false); } bool iscooling = false; foreach (KeyValuePair <SkillMasterySpell, DateTime> kvp in _Cooldown) { SkillMasterySpell spell = kvp.Key; DateTime dt = kvp.Value; if (!iscooling && spell.GetType() == type && spell.Caster == m) { if (message) { double left = (dt - DateTime.UtcNow).TotalMinutes; if (left > 1) { m.SendLocalizedMessage(1155787, ((int)left).ToString()); // You must wait ~1_minutes~ minutes before you can use this ability. } else { left = (_Cooldown[spell] - DateTime.UtcNow).TotalSeconds; if (left > 0) { m.SendLocalizedMessage(1079335, left.ToString("F", System.Globalization.CultureInfo.InvariantCulture)); // You must wait ~1_seconds~ seconds before you can use this ability again. } } } iscooling = true; } } return(iscooling); }
public override void OnCast() { BardSpell spell = SkillMasterySpell.GetSpell(Caster, GetType()) as BardSpell; if (spell != null) { spell.Expire(); Caster.SendLocalizedMessage(1115774); //You halt your spellsong. } else if (CheckSequence()) { m_PropertyBonus = (int)((BaseSkillBonus * 2) + CollectiveBonus); // 2 - 16 (22) UpdateParty(); BeginTimer(); } FinishSequence(); }
public static void RemoveFromCooldown(Type type, Mobile m) { SkillMasterySpell spell = null; foreach (KeyValuePair <SkillMasterySpell, DateTime> kvp in _Cooldown) { if (kvp.Key.GetType() == type && kvp.Key.Caster == m) { spell = kvp.Key; } } if (spell != null) { _Cooldown.Remove(spell); } CheckCooldown(); }
public static SkillMasterySpell GetSpellForParty(Mobile from, Type type) { CheckTable(from); Mobile check = from; if (from is BaseCreature && (((BaseCreature)from).Controlled || ((BaseCreature)from).Summoned) && ((BaseCreature)from).GetMaster() != null) { check = ((BaseCreature)from).GetMaster(); CheckTable(check); } //First checks the caster if (m_Table.ContainsKey(check)) { foreach (SkillMasterySpell spell in m_Table[check]) { if (spell != null && spell.GetType() == type) { return(spell); } } } else { Party p = Party.Get(check); if (p != null) { foreach (PartyMemberInfo info in p.Members) { SkillMasterySpell spell = GetSpell(info.Mobile, type); if (spell != null && spell.PartyEffects && from.InRange(info.Mobile.Location, spell.PartyRange) && spell.CheckPartyEffects(info.Mobile)) { return(spell); } } } } return(null); }
public override bool CheckCast() { if (IsInCooldown(Caster, this.GetType())) { return(false); } if (!CheckWeapon()) { Caster.SendLocalizedMessage(1156000); // You must have an Archery weapon to use this ability! return(false); } if (SkillMasterySpell.UnderPartyEffects(Caster, typeof(PlayingTheOddsSpell))) { Caster.SendLocalizedMessage(1062945); // That ability is already in effect. return(false); } return(base.CheckCast()); }
public static TSpell GetSpell <TSpell>(Mobile caster, Mobile target) where TSpell : SkillMasterySpell { if (m_Table.ContainsKey(caster)) { SkillMasterySpell first = null; for (var index = 0; index < m_Table[caster].Count; index++) { var sms = m_Table[caster][index]; if (sms.GetType() == typeof(TSpell) && sms.Target == target) { first = sms; break; } } return(first as TSpell); } return(null); }
public static void CheckManaShield(Mobile m, ref int damage) { SkillMasterySpell spell = GetSpell(m, typeof(ManaShieldSpell)); if (spell is ManaShieldSpell) { if (((ManaShieldSpell)spell).Chance >= Utility.RandomDouble()) { int toShield = damage / 2; if (m.Mana >= toShield) { m.Mana -= toShield; damage -= toShield; } else { damage -= m.Mana; m.Mana = 0; } } } }
public static IEnumerable <SkillMasterySpell> EnumerateAllSpells() { if (m_Table == null || m_Table.Count == 0) { yield break; } List <SkillMasterySpell> list = new List <SkillMasterySpell>(); lock (_Lock) { foreach (KeyValuePair <Mobile, List <SkillMasterySpell> > kvp in m_Table) { list.AddRange(kvp.Value); } } for (var index = 0; index < list.Count; index++) { SkillMasterySpell spell = list[index]; yield return(spell); } }
public static void OnMasteryChanged(Mobile m, SkillName oldMastery) { PassiveSpell passive = GetActivePassive(m); SkillName newMastery = m.Skills.CurrentMastery; if (oldMastery != newMastery) { List <SkillMasterySpell> list = SkillMasterySpell.GetSpells(m); if (list != null) { list.ForEach(spell => { spell.Expire(); }); ColUtility.Free(list); } if (m is PlayerMobile && oldMastery == SkillName.Necromancy) { ((PlayerMobile)m).AllFollowers.IterateReverse(mob => { if (mob is BaseCreature && CommandUndeadSpell.ValidateTarget((BaseCreature)mob)) { ((BaseCreature)mob).SetControlMaster(null); } }); } SpecialMove move = SpecialMove.GetCurrentMove(m); if (move is SkillMasteryMove) { SpecialMove.ClearCurrentMove(m); } m.RemoveStatMod("SavingThrow_Str"); ColUtility.Free(list); RemovePassiveBuffs(m); } if (passive != PassiveSpell.None && passive != PassiveSpell.AnticipateHit) { switch (passive) { case PassiveSpell.EnchantedSummoning: BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.EnchantedSummoning, 1155904, 1156090, String.Format("{0}\t{0}", EnchantedSummoningBonus(m).ToString()), true)); // +~1_STAMINA~ Stamina Regeneration and +~2_HP~% Hit Points for summoned pets.<br>Increased difficulty for summoned pets to be dispelled. break; case PassiveSpell.Intuition: BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Intuition, 1155907, 1156089, IntuitionBonus(m).ToString(), true)); // Mana Increase ~1_VAL~ break; case PassiveSpell.SavingThrow: { string args = null; switch (GetMasteryLevel(m, newMastery)) { default: args = "5\t0\t0\t0"; break; case 2: args = "5\t5\t0\t0"; break; case 3: args = "5\t5\t5\t5"; break; } m.AddStatMod(new StatMod(StatType.Str, "SavingThrow_Str", 5, TimeSpan.Zero)); BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.SavingThrow, 1156031, 1156032, args, true)); // Provides a chance to block disarm attempts based on Mastery level, weapon skill level and tactics skill level. } break; case PassiveSpell.Potency: BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Potency, 1155928, 1156195, NonPoisonConsumeChance(m).ToString(), true)); // ~1_VAL~% chance to not consume poison charges when using infecting strike or injected strike. break; case PassiveSpell.Knockout: BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Knockout, 1155931, 1156030, String.Format("{0}\t{1}", GetKnockoutModifier(m).ToString(), GetKnockoutModifier(m, true).ToString(), true))); // Wrestling Damage Bonus:<br>+~1_VAL~% PvM<br>+~2_VAL~% PvP break; case PassiveSpell.Boarding: BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Boarding, 1155934, 1156194, BoardingSlotIncrease(m).ToString(), true)); // Your number of stable slots has been increased by ~1_VAL~. break; } m.Delta(MobileDelta.WeaponDamage); m.UpdateResistances(); if (m.Mana > m.ManaMax) { m.Mana = m.ManaMax; } } if (m.Backpack != null) { foreach (Item item in m.Backpack.FindItemsByType(typeof(BookOfMasteries))) { BookOfMasteries book = item as BookOfMasteries; if (book != null) { book.InvalidateProperties(); } } } foreach (Item item in m.Items.Where(i => i is BookOfMasteries)) { BookOfMasteries book = item as BookOfMasteries; if (book != null) { book.InvalidateProperties(); } } }
/*Notes: * Poison Resist 25% flat rate in spell is active - TODO: Get OSI Rate??? * Bleed, Mortal and Curse cuts time by 1/2 * Reference PlayerMobile, BleedAttack, MortalStrike and CurseSpell */ public static bool UnderEffects(Mobile m) { return(SkillMasterySpell.UnderPartyEffects(m, typeof(ResilienceSpell))); }
public UpkeepTimer(SkillMasterySpell spell) : base(TimeSpan.FromSeconds(spell.TickTime), TimeSpan.FromSeconds(spell.TickTime)) { m_Spell = spell; }
public MasteryTarget(SkillMasterySpell spell, int range = 10, bool allowGround = false, TargetFlags flags = TargetFlags.None, bool autoEnd = true) : base(range, allowGround, flags) { Owner = spell; AutoFinishSequence = autoEnd; }
public static int GetAttributeBonus(Mobile m, AosAttribute attr) { int value = 0; SkillMasterySpell spell = null; switch (attr) { case AosAttribute.AttackChance: spell = SkillMasterySpell.GetSpellForParty(m, typeof(InspireSpell)); if (spell != null) { value += spell.PropertyBonus(); } spell = SkillMasterySpell.GetSpellForParty(m, typeof(TribulationSpell)); if (spell != null) { value += spell.PropertyBonus(); } value += FocusedEyeSpell.HitChanceBonus(m); value += PlayingTheOddsSpell.HitChanceBonus(m); value += CalledShotSpell.GetHitChanceBonus(m); value += CombatTrainingSpell.GetHitChanceBonus(m); value += MasteryInfo.SavingThrowChance(m, attr); break; case AosAttribute.DefendChance: spell = SkillMasterySpell.GetSpellForParty(m, typeof(PerseveranceSpell)); if (spell != null) { value += spell.PropertyBonus(); } if (Server.Spells.SkillMasteries.WhiteTigerFormSpell.IsActive(m)) { value += 20; } value += MasteryInfo.SavingThrowChance(m, attr); break; case AosAttribute.RegenHits: spell = SkillMasterySpell.GetSpellForParty(m, typeof(ResilienceSpell)); if (spell != null) { value += spell.PropertyBonus(); } break; case AosAttribute.RegenStam: spell = SkillMasterySpell.GetSpellForParty(m, typeof(ResilienceSpell)); if (spell != null) { value += spell.PropertyBonus(); } break; case AosAttribute.RegenMana: spell = SkillMasterySpell.GetSpellForParty(m, typeof(ResilienceSpell)); if (spell != null) { value += spell.PropertyBonus(); } break; case AosAttribute.WeaponDamage: spell = SkillMasterySpell.GetSpellForParty(m, typeof(InspireSpell)); if (spell != null) { value += spell.DamageBonus(); } value += MasteryInfo.SavingThrowChance(m, attr); break; case AosAttribute.SpellDamage: spell = SkillMasterySpell.GetSpellForParty(m, typeof(InspireSpell)); if (spell != null) { value += spell.PropertyBonus(); } break; case AosAttribute.WeaponSpeed: value += RampageSpell.GetBonus(m, RampageSpell.BonusType.SwingSpeed); value += PlayingTheOddsSpell.SwingSpeedBonus(m); value -= StaggerSpell.GetStagger(m); break; case AosAttribute.BonusStr: value += MasteryInfo.SavingThrowChance(m, attr); break; } return(value); }
public static void OnMasteryChanged(Mobile m, SkillName oldMastery) { List <SkillMasterySpell> list = SkillMasterySpell.GetSpells(m); if (list != null) { list.ForEach(spell => { spell.Expire(); }); list.Clear(); list.TrimExcess(); } RemovePassiveBuffs(m); foreach (MasteryInfo info in Infos.Where(i => i.Passive)) { if (IsActivePassive(m, info.PassiveSpell)) { if (info.PassiveSpell == PassiveSpell.AnticipateHit) { continue; } //Console.WriteLine("Toggling {0} passive spell", info.PassiveSpell.ToString()); switch (info.PassiveSpell) { case PassiveSpell.EnchantedSummoning: BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.EnchantedSummoning, 1155904, 1156090, String.Format("{0}\t{0}", EnchantedSummoningBonus(m).ToString()), true)); // +~1_STAMINA~ Stamina Regeneration and +~2_HP~% Hit Points for summoned pets.<br>Increased difficulty for summoned pets to be dispelled. break; case PassiveSpell.Intuition: BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Intuition, 1155907, 1156089, IntuitionBonus(m).ToString(), true)); // Mana Increase ~1_VAL~ break; case PassiveSpell.SavingThrow: BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.SavingThrow, 1155922, 1156032, true)); // Provides a chance to block disarm attempts based on Mastery level, weapon skill level and tactics skill level. break; case PassiveSpell.Potency: BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Potency, 1155928, 1156195, NonPoisonConsumeChance(m).ToString(), true)); // ~1_VAL~% chance to not consume poison charges when using infecting strike or injected strike. break; case PassiveSpell.Knockout: BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Knockout, 1155931, 1156030, String.Format("{0}\t{1}", GetKnockoutModifier(m).ToString(), GetKnockoutModifier(m, true).ToString(), true))); // Wrestling Damage Bonus:<br>+~1_VAL~% PvM<br>+~2_VAL~% PvP break; case PassiveSpell.Boarding: BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Boarding, 1155934, 1156194, BoardingSlotIncrease(m).ToString(), true)); // Your number of stable slots has been increased by ~1_VAL~. break; } m.UpdateResistances(); PassiveTable[m] = info.SpellID; if (m.Mana > m.ManaMax) { m.Mana = m.ManaMax; } break; } } if (m.Backpack != null) { foreach (Item item in m.Backpack.FindItemsByType(typeof(BookOfMasteries))) { BookOfMasteries book = item as BookOfMasteries; if (book != null) { book.InvalidateProperties(); } } } foreach (Item item in m.Items.Where(i => i is BookOfMasteries)) { BookOfMasteries book = item as BookOfMasteries; if (book != null) { book.InvalidateProperties(); } } }