public EffectParameters(int __id, string __name, object[] __data) : base(__id, __name) { _effectItems = new EffectItem[__data.Length]; _lifeTime = 0; for (int i = 0; i < _effectItems.Length; i++) { object[] effectData = __data[i] as object[]; EffectItem ei = new EffectItem(); ei._lifeTime = Convert.ToDouble(effectData[1].ToString().Replace('.', ',')); if (ei._lifeTime > _lifeTime) _lifeTime = ei._lifeTime; string name = effectData[2].ToString(); if (name.CompareTo("Object") == 0) { ei._type = EffectItemType.Object; string name1 = effectData[3] as string; if (!name1.EndsWith("\0")) name1 += "\0"; ei._parameters.Add("objectName", name1); } else if (name.CompareTo("Billboard") == 0) { ei._type = EffectItemType.Billboard; } else if (name.CompareTo("ConstrainedBillboard") == 0) { ei._type = EffectItemType.ConstrainedBillboard; } else if (name.CompareTo("Particles") == 0) { ei._type = EffectItemType.Particles; ei._parameters = StaticObjects.StringToDictionary(effectData[5] as string); string name1 = effectData[3] as string; if (!name1.EndsWith("\0")) name1 += "\0"; ei._parameters.Add("objectName", name1); ei._isBillboards = ei._parameters["elementtype"].ToString().CompareTo("1") == 0; } _effectItems[i] = ei; } }
public override void OnCast() { if (CheckSequence()) { Caster.PlaySound(0xF5); Caster.PlaySound(0x299); Caster.FixedParticles(0x37C4, 1, 25, 9922, 14, 3, EffectLayer.Head); int dispelSkill = ComputePowerValue(2); double chiv = Caster.Skills.Chivalry.Value; IEnumerable <Mobile> targets = Caster.GetMobilesInRange(8) .Where(m => Caster != m && SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false)); foreach (Mobile m in targets) { if (m is BaseCreature bc) { if (bc.Summoned && !bc.IsAnimatedDead) { double dispelChance = (50.0 + 100 * (chiv - bc.DispelDifficulty) / (bc.DispelFocus * 2)) / 100; dispelChance *= dispelSkill / 100.0; 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(); continue; } } bool evil = !bc.Controlled && bc.Karma < 0; if (evil) { // TODO: Is this right? double fleeChance = (100 - Math.Sqrt(m.Fame / 2.0)) * chiv * dispelSkill; fleeChance /= 1000000; if (fleeChance > Utility.RandomDouble()) { bc.BeginFlee(TimeSpan.FromSeconds(30.0)); } } } TransformContext context = TransformationSpellHelper.GetContext(m); if (context?.Spell is NecromancerSpell) // Trees are not evil! TODO: OSI confirm? { // transformed .. double drainChance = 0.5 * (Caster.Skills.Chivalry.Value / Math.Max(m.Skills.Necromancy.Value, 1)); if (drainChance > Utility.RandomDouble()) { int drain = 5 * dispelSkill / 100; m.Stam -= drain; m.Mana -= drain; } } } } FinishSequence(); }
public void Effect(Point3D loc, Map map, bool checkMulti, bool isboatkey = false) { if (Server.Engines.VvV.VvVSigil.ExistsOn(Caster)) { Caster.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil. } else if (map == null) { Caster.SendLocalizedMessage(1005569); // You can not recall to another facet. } else if (!SpellHelper.CheckTravel(Caster, TravelCheckType.RecallFrom)) { } else if (!SpellHelper.CheckTravel(Caster, map, loc, TravelCheckType.RecallTo)) { } else if (map == Map.Felucca && Caster is PlayerMobile && ((PlayerMobile)Caster).Young) { Caster.SendLocalizedMessage(1049543); // You decide against traveling to Felucca while you are still young. } else if (SpellHelper.RestrictRedTravel && Caster.Murderer && map.Rules != MapRules.FeluccaRules) { Caster.SendLocalizedMessage(1019004); // You are not allowed to travel there. } else if (Caster.Criminal) { Caster.SendLocalizedMessage(1005561, "", 0x22); // Thou'rt a criminal and cannot escape so easily. } else if (SpellHelper.CheckCombat(Caster)) { Caster.SendLocalizedMessage(1061282); // You cannot use the Sacred Journey ability to flee from combat. } else if (Misc.WeightOverloading.IsOverloaded(Caster)) { Caster.SendLocalizedMessage(502359, "", 0x22); // Thou art too encumbered to move. } else if (!map.CanSpawnMobile(loc.X, loc.Y, loc.Z) && !isboatkey) { Caster.SendLocalizedMessage(501942); // That location is blocked. } else if ((checkMulti && SpellHelper.CheckMulti(loc, map)) && !isboatkey) { Caster.SendLocalizedMessage(501942); // That location is blocked. } else if (m_Book != null && m_Book.CurCharges <= 0) { Caster.SendLocalizedMessage(502412); // There are no charges left on that item. } else if (Engines.CityLoyalty.CityTradeSystem.HasTrade(Caster)) { Caster.SendLocalizedMessage(1151733); // You cannot do that while carrying a Trade Order. } else if (CheckSequence()) { BaseCreature.TeleportPets(Caster, loc, map, true); if (m_Book != null) { --m_Book.CurCharges; } Effects.SendLocationParticles(EffectItem.Create(Caster.Location, Caster.Map, EffectItem.DefaultDuration), 0, 0, 0, 5033); Caster.PlaySound(0x1FC); Caster.MoveToWorld(loc, map); Caster.PlaySound(0x1FC); } FinishSequence(); }
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 Buff"); BuffInfo.RemoveBuff(target, BuffIcon.Bless); BuffInfo.RemoveBuff(target, BuffIcon.Strength); break; case BuffType.DexBonus: arg = "dexterity bonus"; target.RemoveStatMod("[Magic] Dex Buff"); BuffInfo.RemoveBuff(target, BuffIcon.Bless); BuffInfo.RemoveBuff(target, BuffIcon.Agility); break; case BuffType.IntBonus: arg = "intelligence bonus"; target.RemoveStatMod("[Magic] Int Buff"); BuffInfo.RemoveBuff(target, BuffIcon.Bless); BuffInfo.RemoveBuff(target, BuffIcon.Cunning); break; case BuffType.BarrabHemolymph: arg = "Barrab hemolymph"; EodonianPotion.RemoveEffects(target, PotionEffect.Barrab); break; case BuffType.UraliTrance: arg = "Urali Trance"; EodonianPotion.RemoveEffects(target, PotionEffect.Urali); 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(); }
protected override void OnTick() { var z = m_Map.GetAverageZ(m_X, m_Y); var canFit = m_Map.CanFit(m_X, m_Y, z, 6, false, false); for (var i = -3; !canFit && i <= 3; ++i) { canFit = m_Map.CanFit(m_X, m_Y, z + i, 6, false, false); if (canFit) { z += i; } } if (!canFit) { return; } var g = new Gold(750, 1250); g.MoveToWorld(new Point3D(m_X, m_Y, z), m_Map); if (Utility.RandomDouble() <= 0.5) { switch (Utility.Random(3)) { case 0: // Fire column { Effects.SendLocationParticles( EffectItem.Create(g.Location, g.Map, EffectItem.DefaultDuration), 0x3709, 10, 30, 5052 ); Effects.PlaySound(g, 0x208); break; } case 1: // Explosion { Effects.SendLocationParticles( EffectItem.Create(g.Location, g.Map, EffectItem.DefaultDuration), 0x36BD, 20, 10, 5044 ); Effects.PlaySound(g, 0x307); break; } case 2: // Ball of fire { Effects.SendLocationParticles( EffectItem.Create(g.Location, g.Map, EffectItem.DefaultDuration), 0x36FE, 10, 10, 5052 ); break; } } } }
protected override void OnTick() { if (m_Owner.Deleted) { Stop(); return; } Map map = m_Owner.Map; if (map == null) { return; } if (0.5 < Utility.RandomDouble()) { return; } Mobile toTeleport = null; foreach (Mobile m in m_Owner.GetMobilesInRange(16)) { if (m != m_Owner && m.Player && m_Owner.CanBeHarmful(m) && m_Owner.CanSee(m)) { toTeleport = m; break; } } if (toTeleport != null) { int offset = Utility.Random(8) * 2; Point3D to = m_Owner.Location; for (int i = 0; i < m_Offsets.Length; i += 2) { int x = m_Owner.X + m_Offsets[(offset + i) % m_Offsets.Length]; int y = m_Owner.Y + m_Offsets[(offset + i + 1) % m_Offsets.Length]; if (map.CanSpawnMobile(x, y, m_Owner.Z)) { to = new Point3D(x, y, m_Owner.Z); break; } else { int z = map.GetAverageZ(x, y); if (map.CanSpawnMobile(x, y, z)) { to = new Point3D(x, y, z); break; } } } Mobile m = toTeleport; Point3D from = m.Location; m.Location = to; Server.Spells.SpellHelper.Turn(m_Owner, toTeleport); Server.Spells.SpellHelper.Turn(toTeleport, m_Owner); m.ProcessDelta(); Effects.SendLocationParticles(EffectItem.Create(from, m.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 2023); Effects.SendLocationParticles(EffectItem.Create(to, m.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 5023); m.PlaySound(0x1FE); m_Owner.Combatant = toTeleport; } }
public override void OnThink() { if (!m_Target.Alive || DateTime.UtcNow > m_ExpireTime) { Kill(); return; } if (Map != m_Target.Map || !InRange(m_Target, 15)) { Map fromMap = Map; Point3D from = Location; Map toMap = m_Target.Map; Point3D to = m_Target.Location; if (toMap != null) { for (int i = 0; i < 5; ++i) { Point3D loc = new Point3D(to.X - 4 + Utility.Random(9), to.Y - 4 + Utility.Random(9), to.Z); if (toMap.CanSpawnMobile(loc)) { to = loc; break; } loc.Z = toMap.GetAverageZ(loc.X, loc.Y); if (toMap.CanSpawnMobile(loc)) { to = loc; break; } } } Map = toMap; Location = to; ProcessDelta(); Effects.SendLocationParticles( EffectItem.Create(from, fromMap, EffectItem.DefaultDuration), 0x3728, 1, 13, 37, 7, 5023, 0); FixedParticles(0x3728, 1, 13, 5023, 37, 7, EffectLayer.Waist); PlaySound(0x37D); } if (m_Target.Hidden && InRange(m_Target, 3) && Core.TickCount >= NextSkillTime && UseSkill(SkillName.DetectHidden)) { Target targ = Target; if (targ != null) { targ.Invoke(this, this); } } Combatant = m_Target; FocusMob = m_Target; if (AIObject != null) { AIObject.Action = ActionType.Combat; } base.OnThink(); }
public override void OnDelete() { Effects.SendLocationParticles(EffectItem.Create(Location, Map, EffectItem.DefaultDuration), 0x3728, 10, 15, 5042); base.OnDelete(); }
public void DoNuke() { if (!Alive || Map == null) { return; } Say(1112362); // You will burn to a pile of ash! int range = 8; Effects.PlaySound(Location, Map, 0x349); //Flame Columns for (int i = 0; i < 2; i++) { Misc.Geometry.Circle2D(Location, Map, i, (pnt, map) => { Effects.SendLocationParticles(EffectItem.Create(pnt, map, EffectItem.DefaultDuration), 0x3709, 10, 30, 5052); }); } //Flash then boom Timer.DelayCall(TimeSpan.FromSeconds(1), () => { if (Alive && Map != null) { Effects.PlaySound(Location, Map, 0x44B); Packet flash = ScreenLightFlash.Instance; IPooledEnumerable e = Map.GetClientsInRange(Location, (range * 4) + 5); foreach (NetState ns in e) { if (ns.Mobile != null) { ns.Mobile.Send(flash); } } e.Free(); for (int i = 0; i < range; i++) { Misc.Geometry.Circle2D(Location, Map, i, (pnt, map) => { Effects.SendLocationEffect(pnt, map, 14000, 14, 10, Utility.RandomMinMax(2497, 2499), 2); }); } } }); IPooledEnumerable eable = GetMobilesInRange(range); foreach (Mobile m in eable) { if ((m is PlayerMobile || (m is BaseCreature && ((BaseCreature)m).GetMaster() is PlayerMobile)) && CanBeHarmful(m)) { Timer.DelayCall(TimeSpan.FromSeconds(1.75), new TimerStateCallback(DoDamage_Callback), m); } } eable.Free(); }
public void Target(IPoint3D p) { IPoint3D orig = p; Map map = Caster.Map; SpellHelper.GetSurfaceTop(ref p); Point3D from = Caster.Location; Point3D to = new Point3D(p); if (Server.Misc.WeightOverloading.IsOverloaded(Caster)) { Caster.SendLocalizedMessage(502359, "", 0x22); // Thou art too encumbered to move. } else if (!SpellHelper.CheckTravel(Caster, TravelCheckType.TeleportFrom)) { } else if (!SpellHelper.CheckTravel(Caster, map, to, TravelCheckType.TeleportTo)) { } else if (map == null || !map.CanSpawnMobile(p.X, p.Y, p.Z)) { Caster.SendLocalizedMessage(501942); // That location is blocked. } else if (SpellHelper.CheckMulti(to, map)) { Caster.SendLocalizedMessage(502831); // Cannot teleport to that spot. } else if (Region.Find(to, map).GetRegion(typeof(HouseRegion)) != null) { Caster.SendLocalizedMessage(502829); // Cannot teleport to that spot. } else if (CheckSequence()) { SpellHelper.Turn(Caster, orig); Mobile m = Caster; m.Location = to; m.ProcessDelta(); if (m.Player) { Effects.SendLocationParticles(EffectItem.Create(from, m.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 2023); Effects.SendLocationParticles(EffectItem.Create(to, m.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 5023); } else { m.FixedParticles(0x376A, 9, 32, 0x13AF, EffectLayer.Waist); } m.PlaySound(0x1FE); IPooledEnumerable eable = m.GetItemsInRange(0); foreach (Item item in eable) { if (item is Server.Spells.Sixth.ParalyzeFieldSpell.InternalItem || item is Server.Spells.Fifth.PoisonFieldSpell.InternalItem || item is Server.Spells.Fourth.FireFieldSpell.FireFieldItem) { item.OnMoveOver(m); } } eable.Free(); } FinishSequence(); }
public void Target(object obj) { MaabusCoffinComponent comp = obj as MaabusCoffinComponent; if (comp != null) { MaabusCoffin addon = comp.Addon as MaabusCoffin; if (addon != null) { PlayerMobile pm = Caster as PlayerMobile; if (pm != null) { QuestSystem qs = pm.Quest; if (qs is DarkTidesQuest) { QuestObjective objective = qs.FindObjective(typeof(AnimateMaabusCorpseObjective)); if (objective != null && !objective.Completed) { addon.Awake(Caster); objective.Complete(); } } } return; } } Corpse c = obj as Corpse; if (c == null) { Caster.SendLocalizedMessage(1061084); // You cannot animate that. } else { Type type = null; if (c.Owner != null) { type = c.Owner.GetType(); } if (c.ItemID != 0x2006 || c.Channeled || type == typeof(PlayerMobile) || type == null || (c.Owner != null && c.Owner.Fame < 100) || ((c.Owner != null) && (c.Owner is BaseCreature) && (((BaseCreature)c.Owner).Summoned || ((BaseCreature)c.Owner).IsBonded))) { Caster.SendLocalizedMessage(1061085); // There's not enough life force there to animate. } else { CreatureGroup group = FindGroup(type); if (group != null) { if (group.m_Entries.Length == 0 || type == typeof(DemonKnight)) { Caster.SendLocalizedMessage(1061086); // You cannot animate undead remains. } else if (CheckSequence()) { Point3D p = c.GetWorldLocation(); Map map = c.Map; if (map != null) { Effects.PlaySound(p, map, 0x1FB); Effects.SendLocationParticles(EffectItem.Create(p, map, EffectItem.DefaultDuration), 0x3789, 1, 40, 0x3F, 3, 9907, 0); Timer.DelayCall(TimeSpan.FromSeconds(2.0), new TimerStateCallback(SummonDelay_Callback), new object[] { Caster, c, p, map, group }); } } } } } FinishSequence(); }
protected override void OnTarget(Mobile from, object o) { IPoint3D loc = o as IPoint3D; if (loc == null) { return; } if (this.m_Owner.CheckSequence()) { SpellHelper.Turn(from, o); Effects.SendLocationParticles(EffectItem.Create(new Point3D(loc), from.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, 5024); Effects.PlaySound(loc, from.Map, 0x1FF); if (o is Mobile) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503101); // That did not need to be unlocked. } else if (o is IMageUnlockable) { ((IMageUnlockable)o).OnMageUnlock(from); } else if (!(o is LockableContainer)) { from.SendLocalizedMessage(501666); // You can't unlock that! } else { LockableContainer cont = (LockableContainer)o; if (Multis.BaseHouse.CheckSecured(cont)) { from.SendLocalizedMessage(503098); // You cannot cast this on a secure item. } else if (!cont.Locked) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503101); // That did not need to be unlocked. } else if (cont.LockLevel == 0) { from.SendLocalizedMessage(501666); // You can't unlock that! } else if (cont is TreasureMapChest && ((TreasureMapChest)cont).Level > 2) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503099); // My spell does not seem to have an effect on that lock. } else { int level; int reqSkill; if (cont is TreasureMapChest && TreasureMapInfo.NewSystem) { level = (int)from.Skills[SkillName.Magery].Value; switch (((TreasureMapChest)cont).Level) { default: case 0: reqSkill = 50; break; case 1: reqSkill = 80; break; case 2: reqSkill = 100; break; } } else { level = (int)(from.Skills[SkillName.Magery].Value * 0.8) - 4; reqSkill = cont.RequiredSkill; } if (level >= reqSkill) { cont.Locked = false; if (cont.LockLevel == -255) { cont.LockLevel = cont.RequiredSkill - 10; } } else { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503099); // My spell does not seem to have an effect on that lock. } } } } this.m_Owner.FinishSequence(); }
public void Target(Mobile m) { Type t = m.GetType(); bool dispellable = false; if (m is BaseCreature) { dispellable = ((BaseCreature)m).Summoned && !((BaseCreature)m).IsAnimatedDead; } if (m is PlayerMobile) { dispellable = true; } if (!Caster.CanSee(m)) { Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (!dispellable) { Caster.SendLocalizedMessage(1005049); // That cannot be dispelled. } else if (CheckHSequence(m)) { SpellHelper.Turn(Caster, m); if (m is BaseCreature) { BaseCreature bc = m as BaseCreature; double dispelChance = 0; if (bc != null) { dispelChance = (50.0 + ((100 * (Caster.Skills.ArtMagique.Value - bc.DispelDifficulty)) / (bc.DispelFocus * 2))) / 120; } dispelChance = SpellHelper.AdjustValue(Caster, dispelChance); 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 { Effects.SendTargetEffect(m, 0x3779, 10, 20); Caster.SendLocalizedMessage(1010084); // The creature resisted the attempt to dispel it! } } else if (m is PlayerMobile) { PlayerMobile pm = m as PlayerMobile; double dispelChance = 0; if (pm != null) { dispelChance = (Caster.Skills.ArtMagique.Value - pm.Skills[SkillName.Concentration].Value + 1) / 120; } dispelChance = SpellHelper.AdjustValue(Caster, dispelChance); if (m == Caster) { 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); pm.Transformation.DispelAllTransformations(); } else { Effects.SendTargetEffect(m, 0x3779, 10, 20); Caster.SendLocalizedMessage(1010084); // The creature resisted the attempt to dispel it! } } } FinishSequence(); }
public void Target(Mobile m) { if (CheckHSequence(m)) { SpellHelper.Turn(Caster, m); /* Creates a blast of poisonous energy centered on the target. * The main target is inflicted with a large amount of Poison damage, and all valid targets in a radius of 2 tiles around the main target are inflicted with a lesser effect. * One tile from main target receives 50% damage, two tiles from target receives 33% damage. */ Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x36B0, 1, 14, 63, 7, 9915, 0); Effects.PlaySound(m.Location, m.Map, 0x229); double damage = Utility.RandomMinMax(32, 40) * ((300 + (GetDamageSkill(Caster) * 9)) / 1000); damage += damage * (SpellHelper.GetSpellDamage(Caster, m.Player) / 100.0); Map map = m.Map; if (map != null) { ArrayList targets = new ArrayList(); foreach (Mobile targ in m.GetMobilesInRange(2)) { if ((Caster == targ || SpellHelper.ValidIndirectTarget(Caster, targ)) && Caster.CanBeHarmful(targ, false)) { targets.Add(targ); } } for (int i = 0; i < targets.Count; ++i) { Mobile targ = (Mobile)targets[i]; int num; if (targ.InRange(m.Location, 0)) { num = 1; } else if (targ.InRange(m.Location, 1)) { num = 2; } else { num = 3; } Caster.DoHarmful(targ); SpellHelper.Damage(this, targ, damage / num, 0, 0, 0, 100, 0); } } // Necromancers with greater than 60 poisoning skill will have a 3% to 9% chance // (Scales with poison skill) to poison their target. double poisoning = Caster.Skills.Poisoning.Value; if (poisoning >= 60.0) { double chance = (3.0 + (poisoning - 60.0) * 0.15) / 100.0; if (chance > Utility.RandomDouble()) { int level = PoisonSpell.GetPoisonLevel(Caster, m, SkillName.Poisoning, SkillName.Necromancy); m.ApplyPoison(Caster, Poison.GetPoison(level)); } } } FinishSequence(); }
public override void OnCast() { if (this.CheckSequence()) { /* Creates a withering frost around the Caster, * which deals Cold Damage to all valid targets in a radius of 5 tiles. */ Map map = this.Caster.Map; if (map != null) { List <IDamageable> targets = new List <IDamageable>(); BaseCreature cbc = this.Caster as BaseCreature; bool isMonster = (cbc != null && !cbc.Controlled && !cbc.Summoned); IPooledEnumerable eable = this.Caster.GetObjectsInRange(Core.ML ? 4 : 5); foreach (object o in eable) { IDamageable id = o as IDamageable; if (id == null || id is Mobile && (Mobile)id == this.Caster) { continue; } if (this.Caster.InLOS(id) && (!(id is Mobile) || isMonster || SpellHelper.ValidIndirectTarget(this.Caster, (Mobile)id)) && this.Caster.CanBeHarmful(id, false)) { if (isMonster) { if (id is BaseCreature) { BaseCreature bc = (BaseCreature)id; if (!bc.Controlled && !bc.Summoned && bc.Team == cbc.Team) { continue; } } else if (!(id is PlayerMobile)) { continue; } } targets.Add(id); } } eable.Free(); Effects.PlaySound(this.Caster.Location, map, 0x1FB); Effects.PlaySound(this.Caster.Location, map, 0x10B); Effects.SendLocationParticles(EffectItem.Create(this.Caster.Location, map, EffectItem.DefaultDuration), 0x37CC, 1, 40, 97, 3, 9917, 0); for (int i = 0; i < targets.Count; ++i) { IDamageable id = targets[i]; Mobile m = id as Mobile; this.Caster.DoHarmful(id); if (m != null) { m.FixedParticles(0x374A, 1, 15, 9502, 97, 3, (EffectLayer)255); } else { Effects.SendLocationParticles(id, 0x374A, 1, 30, 97, 3, 9502, 0); } double damage = Utility.RandomMinMax(30, 35); int karma = m != null ? m.Karma / 100 : 0; damage *= 300 + karma + (this.GetDamageSkill(this.Caster) * 10); damage /= 1000; int sdiBonus = AosAttributes.GetValue(this.Caster, AosAttribute.SpellDamage); if (Caster is PlayerMobile && Caster.Race == Race.Gargoyle) { double perc = ((double)Caster.Hits / (double)Caster.HitsMax) * 100; perc = 100 - perc; perc /= 20; if (perc > 4) { sdiBonus += 12; } else if (perc >= 3) { sdiBonus += 9; } else if (perc >= 2) { sdiBonus += 6; } else if (perc >= 1) { sdiBonus += 3; } } // PvP spell damage increase cap of 15% from an item’s magic property in Publish 33(SE) if (Core.SE && id is PlayerMobile && this.Caster.Player && sdiBonus > 15) { sdiBonus = 15; } damage *= (100 + sdiBonus); damage /= 100; // TODO: cap? //if ( damage > 40 ) // damage = 40; SpellHelper.Damage(this, id, damage, 0, 0, 100, 0, 0); } } } this.FinishSequence(); }
public void Target(IPoint3D p) { if (!Caster.CanSee(p)) { Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (CheckSequence()) { // Scriptiz : si monstre, il ne perd pas de Mana ! if (!(Caster is PlayerMobile)) { Caster.Mana += 70; } 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)) { targets.Add(m); } } eable.Free(); } for (int i = 0; i < targets.Count; ++i) { Mobile m = targets[i]; BaseCreature bc = m as BaseCreature; 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 OnTrigger(object activator, Mobile m) { if (m == null || Word == null || (RequireIdentification && !m_Identified)) { return; } if (DateTime.Now < m_EndTime) { return; } string msgstr = "Activating the power of " + Word; // assign powers to certain words switch (Word) { case "Shoda": m.AddStatMod(new StatMod(StatType.Int, "Shoda", 20, Duration)); m.SendMessage("Your mind expands!"); break; case "Malik": m.AddStatMod(new StatMod(StatType.Str, "Malik", 20, Duration)); m.SendMessage("Your strength surges!"); break; case "Lepto": m.AddStatMod(new StatMod(StatType.Dex, "Lepto", 20, Duration)); m.SendMessage("You are more nimble!"); break; case "Velas": Timer.DelayCall(TimeSpan.Zero, new TimerStateCallback(Hide_Callback), new object[] { m }); m.SendMessage("You disappear!"); break; case "Tarda": m.AddSkillMod(new TimedSkillMod(SkillName.Tactics, true, 20, Duration)); m.SendMessage("You are more skillful warrior!"); break; case "Marda": m.AddSkillMod(new TimedSkillMod(SkillName.Magery, true, 20, Duration)); m.SendMessage("You are more skillful mage!"); break; case "Vas Malik": m.AddStatMod(new StatMod(StatType.Str, "Vas Malik", 40, Duration)); m.SendMessage("You are exceptionally strong!"); break; case "Nartor": BaseCreature b = new Drake(); b.MoveToWorld(m.Location, m.Map); b.Owners.Add(m); b.SetControlMaster(m); if (b.Controlled) { m.SendMessage("You master the beast!"); } break; case "Santor": b = new Horse(); b.MoveToWorld(m.Location, m.Map); b.Owners.Add(m); b.SetControlMaster(m); if (b.Controlled) { m.SendMessage("You master the beast!"); } break; default: m.SendMessage("There is no effect."); break; } // display activation effects Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042); Effects.PlaySound(m, m.Map, 0x201); // display a message over the item it was attached to if (AttachedTo is Item) { ((Item)AttachedTo).PublicOverheadMessage(MessageType.Regular, 0x3B2, true, msgstr); } Charges--; // remove the attachment after the charges run out if (Charges == 0) { Delete(); } else { m_EndTime = DateTime.Now + Refractory; } }
public override void SpellEffect(Mobile target) { if (Caster.Backpack == null || !(Caster.Backpack is Container)) { Caster.SendMessage("You need a backpack to use this spell."); return; } if (AosAttributes.GetValue(Caster, AosAttribute.LowerRegCost) < 100) // Nothing less than 100% will do { Item item = Caster.Backpack.FindItemByType(typeof(RefreshPotion)); if (item == null) { Caster.SendMessage("You do not have enough Refresh Potions"); return; } item = Caster.Backpack.FindItemByType(typeof(LesserHealPotion)); if (item == null) { Caster.SendMessage("You do not have enough Heal Potions"); return; } item = Caster.Backpack.FindItemByType(typeof(LesserCurePotion)); if (item == null) { Caster.SendMessage("You do not have enough Cure Potions"); return; } // We just checked for the items. Caster.Backpack.ConsumeTotal(typeof(RefreshPotion), 1); Caster.Backpack.ConsumeTotal(typeof(LesserHealPotion), 1); Caster.Backpack.ConsumeTotal(typeof(LesserCurePotion), 1); } 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"); } BuffInfo.RemoveBuff(target, BuffIcon.Clumsy); BuffInfo.RemoveBuff(target, BuffIcon.FeebleMind); BuffInfo.RemoveBuff(target, BuffIcon.Weaken); BuffInfo.RemoveBuff(target, BuffIcon.MassCurse); target.Paralyzed = false; // Don't cure others of Lethal Poison if (target.Poison != Poison.Lethal || target == Caster) { target.CurePoison(Caster); } EvilOmenSpell.TryEndEffect(target); StrangleSpell.RemoveCurse(target); CorpseSkinSpell.RemoveCurse(target); CurseSpell.RemoveEffect(target); // Cure Status aliments (is the system being used?) BlindSpell.EndBlind(target); SilenceSpell.EndSilence(target); SlowSpell.EndSlow(target); StillSpell.EndStill(target); Effects.SendLocationParticles( EffectItem.Create(new Point3D(target.X, target.Y, target.Z), target.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, 5020); // Play a random eating sound target.PlaySound(Utility.Random(0x3A, 3)); int bonus = AosAttributes.GetValue(Caster, AosAttribute.EnhancePotions) / 2; if (bonus > 20) { bonus = 20; } target.Hits += bonus; target.Stam += bonus; target.SendMessage("You have been cured of all ailments"); Caster.SendMessage("You have cured " + target.Name + " of all alignments."); // It is a party effect, no way to ever get hit by it. // BlueMageControl.CheckKnown( target, this, CanTeach( target ) ); }
public override void OnGaveMeleeAttack(Mobile defender) { base.OnGaveMeleeAttack(defender); if (defender == null) { return; } if (defender.Deleted || !defender.Alive) { return; } Point3D location = defender.Location; Map map = defender.Map; double belowDuration = 15; SpecialAbilities.HinderSpecialAbility(1.0, null, defender, 1.0, belowDuration, false, -1, false, "", "You have been 'taken below' and cannot move or speak!", "-1"); defender.Squelched = true; defender.Hidden = true; Timer.DelayCall(TimeSpan.FromSeconds(15), delegate { if (defender == null) { return; } if (defender.Deleted) { return; } defender.Squelched = false; defender.Hidden = false; }); Squelched = true; Blessed = true; Effects.PlaySound(location, defender.Map, 0x246); //0x0FB PublicOverheadMessage(MessageType.Regular, 0, false, "*takes them down below...*"); SpecialAbilities.HinderSpecialAbility(1.0, null, this, 1.0, belowDuration, false, -1, false, "", "", "-1"); Effects.SendLocationParticles(EffectItem.Create(location, defender.Map, TimeSpan.FromSeconds(0.25)), 0x3709, 10, 30, 2051, 0, 5029, 0); TimedStatic floorHole = new TimedStatic(7025, belowDuration + 1); floorHole.Name = "pit to below"; floorHole.MoveToWorld(location, defender.Map); for (int a = 0; a < 6; a++) { TimedStatic pitPlasm = new TimedStatic(Utility.RandomList(4650, 4651, 4653, 4654, 4655), belowDuration - 1); pitPlasm.Name = "pit plasm"; pitPlasm.Hue = 2052; Point3D pitPlasmLocation = new Point3D(location.X + Utility.RandomList(-2, 2), location.Y + Utility.RandomList(-2, 2), location.Z); SpellHelper.AdjustField(ref pitPlasmLocation, defender.Map, 12, false); pitPlasm.MoveToWorld(pitPlasmLocation, defender.Map); } IEntity pitLocationEntity = new Entity(Serial.Zero, new Point3D(defender.X, defender.Y, defender.Z), defender.Map); Effects.SendLocationParticles(pitLocationEntity, 0x3709, 10, 60, 2053, 0, 5052, 0); Timer.DelayCall(TimeSpan.FromSeconds(.5), delegate { if (this == null) { return; } if (Deleted || !Alive) { return; } MoveToWorld(location, map); for (int a = 0; a < 20; a++) { Timer.DelayCall(TimeSpan.FromSeconds(a * .1), delegate { if (this == null) { return; } if (Deleted || !Alive) { return; } Z--; }); } Timer.DelayCall(TimeSpan.FromSeconds(2.1), delegate { if (this == null) { return; } if (Deleted) { return; } Delete(); }); }); }
public override void OnCast() { if (CheckSequence()) { /* Creates a withering frost around the Caster, * which deals Cold Damage to all valid targets in a radius of 5 tiles. */ Map map = Caster.Map; if (map != null) { List <Mobile> targets = new List <Mobile>(); BaseCreature cbc = Caster as BaseCreature; bool isMonster = (cbc != null && !cbc.Controlled && !cbc.Summoned); foreach (Mobile m in Caster.GetMobilesInRange(Core.ML ? 4 : 5)) { if (Caster != m && Caster.InLOS(m) && (isMonster || SpellHelper.ValidIndirectTarget(Caster, m)) && Caster.CanBeHarmful(m, false)) { if (isMonster) { if (m is BaseCreature) { BaseCreature bc = (BaseCreature)m; if (!bc.Controlled && !bc.Summoned && bc.Team == cbc.Team) { continue; } } else if (!m.Player) { continue; } } targets.Add(m); } } Effects.PlaySound(Caster.Location, map, 0x1FB); Effects.PlaySound(Caster.Location, map, 0x10B); Effects.SendLocationParticles(EffectItem.Create(Caster.Location, map, EffectItem.DefaultDuration), 0x37CC, 1, 40, 97, 3, 9917, 0); for (int i = 0; i < targets.Count; ++i) { Mobile m = targets[i]; Caster.DoHarmful(m); m.FixedParticles(0x374A, 1, 15, 9502, 97, 3, (EffectLayer)255); double damage = Utility.RandomMinMax(30, 35); damage *= (300 + (m.Karma / 100) + (GetDamageSkill(Caster) * 10)); damage /= 1000; int sdiBonus = AosAttributes.GetValue(Caster, AosAttribute.SpellDamage); // PvP spell damage increase cap of 15% from an item’s magic property in Publish 33(SE) if (Core.SE && m.Player && Caster.Player && sdiBonus > 15) { sdiBonus = 15; } damage *= (100 + sdiBonus); damage /= 100; // TODO: cap? //if ( damage > 40 ) // damage = 40; SpellHelper.Damage(this, m, damage, 0, 0, 100, 0, 0); } } } FinishSequence(); }
public override void OnCast() { if (CheckSequence()) { List <Mobile> targets = new List <Mobile>(); foreach (Mobile m in Caster.GetMobilesInRange(8)) { if (m is BaseCreature) { BaseCreature mn = m as BaseCreature; if (mn.ControlSlots == 666) { targets.Add(m); } else if (Caster != m && SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false)) { targets.Add(m); } } else if (Caster != m && SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false)) { targets.Add(m); } } Caster.PlaySound(0xF5); Caster.PlaySound(0x299); Caster.FixedParticles(0x37C4, 1, 25, 9922, 14, 3, EffectLayer.Head); int dispelSkill = ComputePowerValue(2); double chiv = Caster.Skills.Chivalry.Value; for (int i = 0; i < targets.Count; ++i) { Mobile m = targets[i]; BaseCreature bc = m as BaseCreature; if (bc != null) { bool dispellable = bc.Summoned && !bc.IsAnimatedDead; if (dispellable) { double dispelChance = (50.0 + ((100 * (chiv - bc.DispelDifficulty)) / (bc.DispelFocus * 2))) / 100; dispelChance *= dispelSkill / 100.0; 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(); continue; } } else if (bc.ControlSlots == 666) // FOR SPECIAL SUMMONED WIZARD CREATURES { if (chiv > Utility.RandomMinMax(1, 100)) { Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042); Effects.PlaySound(m, m.Map, 0x201); m.Delete(); continue; } } bool evil = !bc.Controlled && bc.Karma < 0; if (evil) { // TODO: Is this right? double fleeChance = (100 - Math.Sqrt(m.Fame / 2)) * chiv * dispelSkill; fleeChance /= 1000000; if (fleeChance > Utility.RandomDouble()) { // guide says 2 seconds, it's longer bc.BeginFlee(TimeSpan.FromSeconds(30.0)); } } } TransformContext context = TransformationSpellHelper.GetContext(m); if (context != null && context.Spell is NecromancerSpell) //Trees are not evil! TODO: OSI confirm? { // transformed .. double drainChance = 0.5 * (Caster.Skills.Chivalry.Value / Math.Max(m.Skills.Necromancy.Value, 1)); if (drainChance > Utility.RandomDouble()) { int drain = (5 * dispelSkill) / 100; m.Stam -= drain; m.Mana -= drain; } } } } FinishSequence(); }
protected override void OnTick() { if (m_Item.Deleted) { return; } if (!m_Item.Visible) { if (m_InLOS && m_CanFit) { m_Item.Visible = true; } else { m_Item.Delete(); } if (!m_Item.Deleted) { m_Item.ProcessDelta(); Effects.SendLocationParticles(EffectItem.Create(m_Item.Location, m_Item.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 5040); } } else if (DateTime.UtcNow > m_Item.m_End) { m_Item.Delete(); Stop(); } else { Map map = m_Item.Map; Mobile caster = m_Item.m_Caster; if (map != null && caster != null) { bool eastToWest = (m_Item.ItemID == 0x3915); IPooledEnumerable eable = map.GetMobilesInBounds(new Rectangle2D(m_Item.X - (eastToWest ? 0 : 1), m_Item.Y - (eastToWest ? 1 : 0), (eastToWest ? 1 : 2), (eastToWest ? 2 : 1))); foreach (Mobile m in eable) { if ((m.Z + 16) > m_Item.Z && (m_Item.Z + 12) > m.Z && (!Core.AOS || m != caster) && SpellHelper.ValidIndirectTarget(caster, m) && caster.CanBeHarmful(m, false)) { m_Queue.Enqueue(m); } } eable.Free(); while (m_Queue.Count > 0) { Mobile m = (Mobile)m_Queue.Dequeue(); caster.DoHarmful(m); m_Item.ApplyPoisonTo(m); m.PlaySound(0x474); } } } }
protected override void OnTick() { if (m_Owner.Deleted) { Stop(); return; } var map = m_Owner.Map; if (map == null) { return; } if (Utility.RandomDouble() > 0.25) { return; } var toTeleport = m_Owner.GetMobilesInRange(16) .FirstOrDefault(mob => mob != m_Owner && mob.Player && m_Owner.CanBeHarmful(mob) && m_Owner.CanSee(mob)); if (toTeleport == null) { return; } var offset = Utility.Random(8) * 2; var to = m_Owner.Location; for (var i = 0; i < m_Offsets.Length; i += 2) { var x = m_Owner.X + m_Offsets[(offset + i) % m_Offsets.Length]; var y = m_Owner.Y + m_Offsets[(offset + i + 1) % m_Offsets.Length]; if (map.CanSpawnMobile(x, y, m_Owner.Z)) { to = new Point3D(x, y, m_Owner.Z); break; } var z = map.GetAverageZ(x, y); if (map.CanSpawnMobile(x, y, z)) { to = new Point3D(x, y, z); break; } } var m = toTeleport; var from = m.Location; m.Location = to; SpellHelper.Turn(m_Owner, toTeleport); SpellHelper.Turn(toTeleport, m_Owner); m.ProcessDelta(); Effects.SendLocationParticles( EffectItem.Create(from, m.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 2023 ); Effects.SendLocationParticles( EffectItem.Create(to, m.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 5023 ); m.PlaySound(0x1FE); m_Owner.Combatant = toTeleport; }
protected override void OnTick() { if (m_Item.Deleted) { return; } if (!m_Item.Visible) { //if ( m_InLOS && m_CanFit ) // m_Item.Visible = true; //else // m_Item.Delete(); if (!m_Item.Deleted) { m_Item.ProcessDelta(); Effects.SendLocationParticles(EffectItem.Create(m_Item.Location, m_Item.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 5029); } } else if (DateTime.Now > m_Item.m_End) { m_Item.Delete(); Stop(); } else { Map map = m_Item.Map; Mobile caster = m_Item.m_Caster; if (map != null && caster != null) { foreach (Mobile m in m_Item.GetMobilesInRange(0)) { if (m.AccessLevel != AccessLevel.Player || !m.Alive) { continue; } if ((m.Z + 16) > m_Item.Z && (m_Item.Z + 12) > m.Z) // && SpellHelper.ValidIndirectTarget( caster, m ) && caster.CanBeHarmful( m, false ) ) { m_Queue.Enqueue(m); } } while (m_Queue.Count > 0) { Mobile m = (Mobile)m_Queue.Dequeue(); //if (SpellHelper.CanRevealCaster(m)) // caster.RevealingAction(); int damage = 2; if (!Core.AOS && m.CheckSkill(SkillName.MagicResist, 0.0, 30.0)) { damage = 1; m.SendMessage("You feel yourself resisting magic"); // You feel yourself resisting magical energy. } AOS.Damage(m, caster, damage, 0, 100, 0, 0, 0); m.PlaySound(0x208); } } } }
public void Target(Mobile m) { if (CheckHSequence(m)) { SpellHelper.Turn(Caster, m); /* Creates a blast of poisonous energy centered on the target. * The main target is inflicted with a large amount of Poison damage, and all valid targets in a radius of 2 tiles around the main target are inflicted with a lesser effect. * One tile from main target receives 50% damage, two tiles from target receives 33% damage. */ //CheckResisted( m ); // Check magic resist for skill, but do not use return value //reports from OSI: Necro spells don't give Resist gain Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x36B0, 1, 14, 63, 7, 9915, 0); Effects.PlaySound(m.Location, m.Map, 0x229); double damage = Utility.RandomMinMax((Core.ML ? 32 : 36), 40) * ((300 + (GetDamageSkill(Caster) * 9)) / 1000); double sdiBonus = (double)AosAttributes.GetValue(Caster, AosAttribute.SpellDamage) / 100; double pvmDamage = damage * (1 + sdiBonus); if (Core.ML && sdiBonus > 0.15) { sdiBonus = 0.15; } double pvpDamage = damage * (1 + sdiBonus); Map map = m.Map; if (map != null) { List <Mobile> targets = new List <Mobile>(); if (Caster.CanBeHarmful(m, false)) { targets.Add(m); } foreach (Mobile targ in m.GetMobilesInRange(2)) { if (!(Caster is BaseCreature && targ is BaseCreature)) { if ((targ != Caster && m != targ) && (SpellHelper.ValidIndirectTarget(Caster, targ) && Caster.CanBeHarmful(targ, false))) { targets.Add(targ); } } } for (int i = 0; i < targets.Count; ++i) { Mobile targ = targets[i]; int num; if (targ.InRange(m.Location, 0)) { num = 1; } else if (targ.InRange(m.Location, 1)) { num = 2; } else { num = 3; } //Caster.DoHarmful( targ ); SpellHelper.Damage(this, targ, ((m.Player && Caster.Player) ? pvpDamage : pvmDamage) / num, 0, 0, 0, 100, 0); HarmfulSpell(targ); } } } FinishSequence(); }
public void Target(IPoint3D p) { if (!Caster.CanSee(p)) { Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (SpellHelper.CheckTown(p, Caster) && CheckSequence()) { SpellHelper.Turn(Caster, p); SpellHelper.GetSurfaceTop(ref p); var dx = Caster.Location.X - p.X; var dy = Caster.Location.Y - p.Y; var rx = (dx - dy) * 44; var ry = (dx + dy) * 44; bool eastToWest; if (rx >= 0 && ry >= 0) { eastToWest = false; } else if (rx >= 0) { eastToWest = true; } else if (ry >= 0) { eastToWest = true; } else { eastToWest = false; } Effects.PlaySound((Point3D)p, Caster.Map, 0x20B); var itemID = eastToWest ? 0x3967 : 0x3979; var duration = TimeSpan.FromSeconds(3.0 + Caster.Skills[SkillName.Magery].Value / 3.0); for (var i = -2; i <= 2; ++i) { var loc = new Point3D(eastToWest ? p.X + i : p.X, eastToWest ? p.Y : p.Y + i, p.Z); var canFit = SpellHelper.AdjustField(ref loc, Caster.Map, 12, false); if (!canFit) { continue; } Item item = new InternalItem(Caster, itemID, loc, Caster.Map, duration); item.ProcessDelta(); Effects.SendLocationParticles(EffectItem.Create(loc, Caster.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 5048); } } FinishSequence(); }
/// <summary> /// Animates the appearance of the gate /// </summary> private void AnimateGate() { Effects.SendLocationParticles(EffectItem.Create(Location, Map, EffectItem.DefaultDuration), 0x3709, 10, 30, 5052); Effects.PlaySound(Location, Map, 0x225); Visible = true; }
protected override void OnTick() { if (this.m_Item.Deleted) { return; } if (!this.m_Item.Visible) { if (this.m_InLOS && this.m_CanFit) { this.m_Item.Visible = true; } else { this.m_Item.Delete(); } if (!this.m_Item.Deleted) { this.m_Item.ProcessDelta(); Effects.SendLocationParticles(EffectItem.Create(this.m_Item.Location, this.m_Item.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 5029); } } else if (DateTime.UtcNow > this.m_Item.m_End) { this.m_Item.Delete(); this.Stop(); } else { Map map = this.m_Item.Map; Mobile caster = this.m_Item.m_Caster; if (map != null && caster != null) { foreach (Mobile m in this.m_Item.GetMobilesInRange(0)) { if ((m.Z + 16) > this.m_Item.Z && (this.m_Item.Z + 12) > m.Z && (!Core.AOS || m != caster) && SpellHelper.ValidIndirectTarget(caster, m) && caster.CanBeHarmful(m, false)) { m_Queue.Enqueue(m); } } while (m_Queue.Count > 0) { Mobile m = (Mobile)m_Queue.Dequeue(); if (SpellHelper.CanRevealCaster(m)) { caster.RevealingAction(); } caster.DoHarmful(m); int damage = this.m_Item.m_Damage; if (!Core.AOS && m.CheckSkill(SkillName.MagicResist, 0.0, 30.0)) { damage = 1; m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy. } AOS.Damage(m, caster, damage, 0, 100, 0, 0, 0); m.PlaySound(0x208); if (m is BaseCreature) { ((BaseCreature)m).OnHarmfulSpell(caster); } } } } }
public override void OnThink() { // TODO: Can the shadow knight teleport twice? What if it heals completely and enough time has passed? if (!m_HasTeleportedAway && Hits < HitsMax / 2) { var map = Map; if (map != null) { for (var i = 0; i < 10; ++i) { var x = X + Utility.RandomMinMax(5, 10) * (Utility.RandomBool() ? 1 : -1); var y = Y + Utility.RandomMinMax(5, 10) * (Utility.RandomBool() ? 1 : -1); var z = Z; if (!map.CanFit(x, y, z, 16, false, false)) { continue; } var from = Location; var to = new Point3D(x, y, z); if (!InLOS(to)) { continue; } Location = to; ProcessDelta(); Hidden = true; Combatant = null; Effects.SendLocationParticles( EffectItem.Create(from, map, EffectItem.DefaultDuration), 0x3728, 10, 10, 2023 ); Effects.SendLocationParticles( EffectItem.Create(to, map, EffectItem.DefaultDuration), 0x3728, 10, 10, 5023 ); Effects.PlaySound(to, map, 0x1FE); m_HasTeleportedAway = true; Timer.StartTimer( TimeSpan.FromSeconds(5.0), TimeSpan.FromSeconds(2.5), SendTrackingSound, out _soundTimerToken ); Frozen = true; break; } } } base.OnThink(); }
public void Activate(Mobile from) { if (this == null) { return; } if (from == null) { return; } Point3D m_RuneLocation = from.Location; //Necromancer Rune m_RuneType = (RuneType)Utility.RandomMinMax(0, 5); int runeHue = fireHue; switch (m_RuneType) { case RuneType.Fire: runeHue = fireHue; break; case RuneType.Ice: runeHue = iceHue; break; case RuneType.Earth: runeHue = earthHue; break; case RuneType.Energy: runeHue = energyHue; break; case RuneType.Poison: runeHue = poisonHue; break; case RuneType.Curse: runeHue = curseHue; break; } Dictionary <Point3D, int> m_RunePieces = new Dictionary <Point3D, int>(); m_RunePieces.Add(new Point3D(m_RuneLocation.X - 1, m_RuneLocation.Y - 1, m_RuneLocation.Z), 0x3083); m_RunePieces.Add(new Point3D(m_RuneLocation.X - 1, m_RuneLocation.Y, m_RuneLocation.Z), 0x3080); m_RunePieces.Add(new Point3D(m_RuneLocation.X, m_RuneLocation.Y - 1, m_RuneLocation.Z), 0x3082); m_RunePieces.Add(new Point3D(m_RuneLocation.X + 1, m_RuneLocation.Y - 1, m_RuneLocation.Z), 0x3081); m_RunePieces.Add(new Point3D(m_RuneLocation.X - 1, m_RuneLocation.Y + 1, m_RuneLocation.Z), 0x307D); m_RunePieces.Add(new Point3D(m_RuneLocation.X, m_RuneLocation.Y, m_RuneLocation.Z), 0x307F); m_RunePieces.Add(new Point3D(m_RuneLocation.X + 1, m_RuneLocation.Y, m_RuneLocation.Z), 0x307E); m_RunePieces.Add(new Point3D(m_RuneLocation.X, m_RuneLocation.Y + 1, m_RuneLocation.Z), 0x307C); m_RunePieces.Add(new Point3D(m_RuneLocation.X + 1, m_RuneLocation.Y + 1, m_RuneLocation.Z), 0x307B); foreach (KeyValuePair <Point3D, int> pair in m_RunePieces) { Blood runePiece = new Blood(); runePiece.ItemID = pair.Value; runePiece.Name = "a rune"; runePiece.Hue = runeHue; runePiece.MoveToWorld(pair.Key, Map); } Blood flame = new Blood(); flame.ItemID = 0x19AB; flame.Name = "a runeflame"; flame.Hue = runeHue; flame.MoveToWorld(new Point3D(m_RuneLocation.X, m_RuneLocation.Y, m_RuneLocation.Z), Map); Effects.SendLocationParticles(EffectItem.Create(m_RuneLocation, Map, TimeSpan.FromSeconds(0.25)), 0x3709, 10, 125, runeHue, 0, 5029, 0); int projectiles = 20; int minRadius = 1; int maxRadius = 8; List <Point3D> m_ValidLocations = SpecialAbilities.GetSpawnableTiles(m_RuneLocation, true, false, m_RuneLocation, Map, projectiles, 20, minRadius, maxRadius, false); if (m_ValidLocations.Count == 0) { return; } m_NextUseAllowed = DateTime.UtcNow + UsageCooldown; int particleSpeed = 5; //10 double distanceDelayInterval = .12; //.08 for (int a = 0; a < projectiles; a++) { double distance; double destinationDelay; Timer.DelayCall(TimeSpan.FromSeconds(a * .25), delegate { if (this == null) { return; } if (this.Deleted) { return; } Point3D newLocation = m_ValidLocations[Utility.RandomMinMax(0, m_ValidLocations.Count - 1)]; IEntity effectStartLocation = new Entity(Serial.Zero, new Point3D(m_RuneLocation.X, m_RuneLocation.Y, m_RuneLocation.Z + 3), Map); IEntity effectEndLocation = new Entity(Serial.Zero, new Point3D(newLocation.X, newLocation.Y, newLocation.Z + 6), Map); newLocation.Z += 5; switch (m_RuneType) { case RuneType.Fire: Effects.PlaySound(m_RuneLocation, Map, 0x359); Effects.SendMovingEffect(effectStartLocation, effectEndLocation, 0x36D4, particleSpeed, 0, false, false, 0, 0); distance = Utility.GetDistanceToSqrt(m_RuneLocation, newLocation); destinationDelay = (double)distance * distanceDelayInterval; Timer.DelayCall(TimeSpan.FromSeconds(destinationDelay), delegate { if (this == null) { return; } Effects.PlaySound(newLocation, Map, 0x591); Effects.SendLocationParticles(EffectItem.Create(newLocation, Map, TimeSpan.FromSeconds(0.5)), 0x36BD, 20, 10, 5044); }); break; case RuneType.Ice: Effects.PlaySound(m_RuneLocation, Map, 0x64F); Effects.SendMovingEffect(effectStartLocation, effectEndLocation, 0x36D4, particleSpeed, 0, false, false, 1153, 0); distance = Utility.GetDistanceToSqrt(m_RuneLocation, newLocation); destinationDelay = (double)distance * .08; Timer.DelayCall(TimeSpan.FromSeconds(destinationDelay), delegate { if (this == null) { return; } Effects.PlaySound(newLocation, Map, 0x208); Effects.SendLocationParticles(EffectItem.Create(newLocation, Map, TimeSpan.FromSeconds(0.25)), 0x3779, 10, 20, 1153, 0, 5029, 0); }); break; case RuneType.Earth: int itemId = Utility.RandomList(4963, 4964, 4965, 4966, 4968, 4969, 4971, 4972); Effects.PlaySound(m_RuneLocation, Map, 0x5D3); Effects.SendMovingEffect(effectStartLocation, effectEndLocation, itemId, particleSpeed, 0, false, false, 0, 0); distance = Utility.GetDistanceToSqrt(m_RuneLocation, newLocation); destinationDelay = (double)distance * distanceDelayInterval; Timer.DelayCall(TimeSpan.FromSeconds(destinationDelay), delegate { if (this == null) { return; } Effects.PlaySound(newLocation, Map, 0x11D); int mudItems = Utility.RandomMinMax(1, 2); //Rubble Blood dirt = new Blood(); dirt.Name = "rubble"; dirt.ItemID = Utility.RandomList(7681, 7682); Point3D dirtLocation = new Point3D(newLocation.X, newLocation.Y, newLocation.Z); dirt.MoveToWorld(dirtLocation, Map); }); break; case RuneType.Energy: Effects.PlaySound(m_RuneLocation, Map, 0x211); Effects.SendMovingEffect(effectStartLocation, effectEndLocation, 0x3818, particleSpeed, 0, false, false, runeHue, 0); distance = Utility.GetDistanceToSqrt(m_RuneLocation, newLocation); destinationDelay = (double)distance * distanceDelayInterval; Timer.DelayCall(TimeSpan.FromSeconds(destinationDelay), delegate { if (this == null) { return; } Effects.PlaySound(newLocation, Map, 0x211); Effects.SendLocationParticles(EffectItem.Create(newLocation, Map, TimeSpan.FromSeconds(5)), 0x3973, 10, 125, 5029); }); break; case RuneType.Poison: Effects.PlaySound(m_RuneLocation, Map, 0x22F); Effects.SendMovingEffect(effectStartLocation, effectEndLocation, 0x372A, particleSpeed, 0, false, false, runeHue, 0); distance = Utility.GetDistanceToSqrt(m_RuneLocation, newLocation); destinationDelay = (double)distance * distanceDelayInterval; Timer.DelayCall(TimeSpan.FromSeconds(destinationDelay), delegate { if (this == null) { return; } Effects.PlaySound(newLocation, Map, 0x22F); Effects.SendLocationParticles(EffectItem.Create(newLocation, Map, TimeSpan.FromSeconds(0.25)), 0x372A, 10, 20, runeHue, 0, 5029, 0); }); break; case RuneType.Curse: Effects.PlaySound(m_RuneLocation, Map, 0x56E); Effects.SendMovingEffect(effectStartLocation, effectEndLocation, 0x573E, particleSpeed, 0, false, false, 0, 0); distance = Utility.GetDistanceToSqrt(m_RuneLocation, newLocation); destinationDelay = (double)distance * distanceDelayInterval; Timer.DelayCall(TimeSpan.FromSeconds(destinationDelay), delegate { if (this == null) { return; } Effects.PlaySound(newLocation, Map, 0x56E); Effects.SendLocationParticles(EffectItem.Create(newLocation, Map, TimeSpan.FromSeconds(0.25)), 0x376A, 10, 20, runeHue, 0, 5029, 0); }); break; } }); } }
private void playEffect(EffectItem effectItem) { if (effectItem.follow) { effectItem.play(); } else if (effectItem.isRootEffect) { GameObject clone = Instantiate(effectItem.gameObject); clone.SetActive(true); clone.transform.position = effectItem.transform.position; clone.transform.rotation = effectItem.transform.rotation; Destroy(clone, effectItem.lastTime /*+ 0.1f*/); } }
public void OnTarget(object o) { IPoint3D p = o as IPoint3D; if (p != null && CheckSequence()) { SpellHelper.Turn(Caster, p); SpellHelper.GetSurfaceTop(ref p); Map map = Caster.Map; if (map != null) { List <Mobile> targets = new List <Mobile>(); Rectangle2D effectArea = new Rectangle2D(p.X - 3, p.Y - 3, 6, 6); IPooledEnumerable eable = map.GetMobilesInBounds(effectArea); foreach (Mobile m in eable) { if (Caster != m && Caster.InLOS(m) && SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false)) { targets.Add(m); } } eable.Free(); Effects.PlaySound(p, map, 0x64F); for (int x = effectArea.X; x <= effectArea.X + effectArea.Width; x++) { for (int y = effectArea.Y; y <= effectArea.Y + effectArea.Height; y++) { if (x == effectArea.X && y == effectArea.Y || x >= effectArea.X + effectArea.Width - 1 && y >= effectArea.Y + effectArea.Height - 1 || y >= effectArea.Y + effectArea.Height - 1 && x == effectArea.X || y == effectArea.Y && x >= effectArea.X + effectArea.Width - 1) { continue; } IPoint3D pnt = new Point3D(x, y, p.Z); SpellHelper.GetSurfaceTop(ref pnt); Timer.DelayCall <Point3D>(TimeSpan.FromMilliseconds(Utility.RandomMinMax(100, 300)), point => { Effects.SendLocationEffect(point, map, 0x375A, 8, 11, 0x49A, 0); }, new Point3D(pnt)); } } for (int i = 0; i < targets.Count; ++i) { Mobile m = targets[i]; m.FixedParticles(0x374A, 1, 15, 9502, 97, 3, (EffectLayer)255); double damage = (((Caster.Skills[CastSkill].Value + (Caster.Skills[DamageSkill].Value / 2)) * .66) + Utility.RandomMinMax(1, 6)); SpellHelper.Damage(this, m, damage, 0, 0, 0, 0, 0, 100, 0); double stamSap = (damage / 3); double manaSap = (damage / 3); double mod = m.Skills[SkillName.MagicResist].Value - ((Caster.Skills[CastSkill].Value + Caster.Skills[DamageSkill].Value) / 2); if (mod > 0) { mod /= 100; stamSap *= mod; manaSap *= mod; } m.Stam -= (int)stamSap; m.Mana -= (int)manaSap; Timer.DelayCall(TimeSpan.FromSeconds(10), () => { if (m.Alive) { m.Stam += (int)stamSap; m.Mana += (int)manaSap; } }); Effects.SendLocationParticles(EffectItem.Create(m.Location, map, EffectItem.DefaultDuration), 0x37CC, 1, 40, 97, 3, 9917, 0); } } } FinishSequence(); }