public override void OnResponse( NetState sender, RelayInfo info ) { int idx = info.ButtonID - 1; if ( idx < 0 || idx >= m_Entries.Length ) return; Spell spell = new PolymorphSpell( m_Caster, m_Scroll, m_Entries[idx].BodyID ); spell.Cast(); }
public override void OnResponse( NetState state, RelayInfo info ) { if ( info.ButtonID == 1 && info.Switches.Length > 0 ) { int cnum = info.Switches[0]; int cat = cnum%256; int ent = cnum>>8; if ( cat >= 0 && cat < Categories.Length ) { if ( ent >= 0 && ent < Categories[cat].Entries.Length ) { Spell spell = new PolymorphSpell( m_Caster, m_Scroll, Categories[cat].Entries[ent].BodyID ); spell.Cast(); } } } }
public override void OnResponse(NetState state, RelayInfo info) { if (info.ButtonID == 1 && info.Switches.Length > 0) { int cnum = info.Switches[0]; int cat = cnum % 256; int ent = cnum >> 8; if (cat >= 0 && cat < Categories.Length) { if (ent >= 0 && ent < Categories[cat].Entries.Length) { if (m_Caster.Skills[SkillName.Magery].Base < Categories[cat].Entries[ent].SkillRequired) m_Caster.SendAsciiMessage("You are not skilled enough to polymorph into this"); else { Spell spell = new PolymorphSpell(m_Caster, m_Scroll, Categories[cat].Entries[ent]); spell.Cast(); } } } } }
public override void OnResponse(NetState state, RelayInfo info) { int buttonID = info.ButtonID; if (buttonID < 100) return; int page = (buttonID > 110) ? 1 : 0; switch (page) { case 1: { PolymorphEntry pe = SecondPageEntries[buttonID - 111] as PolymorphEntry; Spell spell = new PolymorphSpell(m_Caster, m_Scroll, pe.BodyID); spell.Cast(); break; } case 0: { PolymorphEntry pe = FirstPageEntries[buttonID - 101] as PolymorphEntry; Spell spell = new PolymorphSpell(m_Caster, m_Scroll, pe.BodyID); spell.Cast(); break; } } }
public void Target(IPoint3D p) { if (!Caster.CanSee(p)) { Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (CheckSequence()) { SpellHelper.Turn(Caster, p); SpellHelper.GetSurfaceTop(ref p); List <Mobile> targets = new List <Mobile>(); Map map = Caster.Map; if (map != null) { IPooledEnumerable eable = map.GetMobilesInRange(new Point3D(p), 8); foreach (Mobile m in eable) { if ((m is BaseCreature) && (m as BaseCreature).IsDispellable && Caster.CanBeHarmful(m, false) || TransformationSpellHelper.UnderTransformation(m) || !m.CanBeginAction(typeof(PolymorphSpell)) || AnimalForm.UnderTransformation(Caster) || (TransformationSpellHelper.GetContext(m) != null)) { targets.Add(m); } } eable.Free(); } for (int i = 0; i < targets.Count; ++i) { Mobile m = targets[i]; BaseCreature bc = m as BaseCreature; if (TransformationSpellHelper.UnderTransformation(m)) { double dispelChance = Math.Pow((((Caster.Hunger + Caster.Thirst) / 2 + Caster.Skills.Magery.Value) / ((m.Hunger - m.Thirst) / 2 + m.Skills.Necromancy.Value + m.Skills.MagicResist.Value + 1)), 4) / 2; if (dispelChance < 0) { dispelChance = 0.01; } if (dispelChance > 1) { dispelChance = 1; } if (dispelChance > Utility.RandomDouble()) { Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042); Effects.PlaySound(m, m.Map, 0x201); Caster.DoHarmful(m); TransformationSpellHelper.RemoveContext(m, true); } else { m.FixedEffect(0x3779, 10, 20); Caster.SendLocalizedMessage(1010084); // The creature resisted the attempt to dispel it! Caster.DoHarmful(m); } } else if (!m.CanBeginAction(typeof(PolymorphSpell))) { double dispelChance = Math.Pow((((Caster.Hunger + Caster.Thirst) / 2 + Caster.Skills.Magery.Value) / ((m.Hunger - m.Thirst) / 2 + m.Skills.Magery.Value + m.Skills.MagicResist.Value + 1)), 4) / 2; if (dispelChance < 0) { dispelChance = 0.01; } if (dispelChance > 1) { dispelChance = 1; } if (dispelChance > Utility.RandomDouble()) { Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042); Effects.PlaySound(m, m.Map, 0x201); PolymorphSpell.EndPolymorph(m); //TransformationSpellHelper.RemoveContext(m, true); Caster.DoHarmful(m); } else { Caster.DoHarmful(m); m.FixedEffect(0x3779, 10, 20); Caster.SendLocalizedMessage(1010084); // The creature resisted the attempt to dispel it! } } else if (AnimalForm.UnderTransformation(Caster)) { double dispelChance = Math.Pow((((Caster.Hunger + Caster.Thirst) / 2 + Caster.Skills.Magery.Value) / ((m.Hunger - m.Thirst) / 2 + m.Skills.Ninjitsu.Value + m.Skills.MagicResist.Value + 1)), 4) / 2; if (dispelChance < 0) { dispelChance = 0.01; } if (dispelChance > 1) { dispelChance = 1; } if (dispelChance > Utility.RandomDouble()) { Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042); Effects.PlaySound(m, m.Map, 0x201); AnimalForm.RemoveContext(m, true); Caster.DoHarmful(m); } else { Caster.DoHarmful(m); m.FixedEffect(0x3779, 10, 20); Caster.SendLocalizedMessage(1010084); // The creature resisted the attempt to dispel it! } } else if (TransformationSpellHelper.GetContext(m) != null) { double dispelChance = Math.Pow((((Caster.Hunger + Caster.Thirst) / 2 + Caster.Skills.Magery.Value) / ((m.Hunger - m.Thirst) / 2 + m.Skills.Spellweaving.Value + m.Skills.MagicResist.Value + 1)), 4) / 2; if (dispelChance < 0) { dispelChance = 0.01; } if (dispelChance > 1) { dispelChance = 1; } if (dispelChance > Utility.RandomDouble()) { Caster.DoHarmful(m); Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042); Effects.PlaySound(m, m.Map, 0x201); TransformationSpellHelper.RemoveContext(m, true); } else { Caster.DoHarmful(m); m.FixedEffect(0x3779, 10, 20); Caster.SendLocalizedMessage(1010084); // The creature resisted the attempt to dispel it! } } else { if (bc == null) { continue; } double dispelChance = (50.0 + ((100 * (Caster.Skills.Magery.Value - bc.DispelDifficulty)) / (bc.DispelFocus * 2))) / 100; if (dispelChance > Utility.RandomDouble()) { Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042); Effects.PlaySound(m, m.Map, 0x201); m.Delete(); } else { Caster.DoHarmful(m); m.FixedEffect(0x3779, 10, 20); } } } } FinishSequence(); }
public override void OnResponse(NetState state, int index) { Spell spell = new PolymorphSpell(m_Caster, m_Scroll, Categories[0].Entries[index].BodyID); spell.Cast(); }