public static void RemoveFromList(Mobile from, SpellPlagueTimer timer) { if (m_Table.ContainsKey(from) && m_Table[from].Count > 0) { Mobile caster = m_Table[from][0].Caster; m_Table[from].Remove(m_Table[from][0]); if (m_Table[from].Count == 0) { m_Table.Remove(from); BuffInfo.RemoveBuff(from, BuffIcon.SpellPlague); } foreach (KeyValuePair <Mobile, List <SpellPlagueTimer> > kvp in m_Table) { foreach (SpellPlagueTimer Ttimer in kvp.Value) { if (Ttimer.Caster == caster) { return; } } } BuffInfo.RemoveBuff(caster, BuffIcon.SpellPlague); } }
public static void OnMobileDamaged(Mobile from) { if (m_Table.ContainsKey(from) && m_Table[from].Count > 0 && m_Table[from][0].NextUse < DateTime.Now) { int amount = m_Table[from][0].Amount; bool doExplosion = false; double mod = from.Skills[SkillName.MagicResist].Value >= 70.0 ? (from.Skills[SkillName.MagicResist].Value / 1000 * 3) : 0.0; if (mod < 0) { mod = .01; } if (amount == 0 && .90 - mod > Utility.RandomDouble()) { doExplosion = true; } else if (amount == 1 && .60 - mod > Utility.RandomDouble()) { doExplosion = true; } else if (amount == 2 && .30 - mod > Utility.RandomDouble()) { doExplosion = true; } if (doExplosion) { SpellPlagueTimer timer = m_Table[from][0]; timer.NextUse = DateTime.Now + TimeSpan.FromSeconds(1.5); DoExplosion(from, timer.Caster, false); timer.Amount++; } } }
public static void RemoveFromList(Mobile from, SpellPlagueTimer timer) { if (m_Table.ContainsKey(from) && m_Table[from].Count > 0) { Mobile caster = m_Table[from][0].Caster; m_Table[from].Remove(m_Table[from][0]); if (m_Table[from].Count == 0) { m_Table.Remove(from); BuffInfo.RemoveBuff(from, BuffIcon.SpellPlague); } foreach (KeyValuePair<Mobile, List<SpellPlagueTimer>> kvp in m_Table) { foreach (SpellPlagueTimer Ttimer in kvp.Value) { if (Ttimer.Caster == caster) return; } } BuffInfo.RemoveBuff(caster, BuffIcon.SpellPlague); } }