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(); }
public void SetTimedEgg(Point3D location, Map map, EggType eggType) { int eggHue = Hue = Utility.RandomMinMax(2, 362); DecoyEasterEgg decoyEasterEgg = new DecoyEasterEgg(); decoyEasterEgg.Hue = eggHue; decoyEasterEgg.MoveToWorld(location, map); int delayTime = Utility.RandomMinMax(1, 10); Effects.SendLocationParticles(EffectItem.Create(location, map, TimeSpan.FromSeconds(0.25)), 0x9B5, 10, delayTime * 25, eggHue, 0, 5029, 0); Timer.DelayCall(TimeSpan.FromSeconds(delayTime), delegate { if (decoyEasterEgg != null) { if (!decoyEasterEgg.Deleted) { if (decoyEasterEgg.ParentEntity is PlayerMobile) { PlayerMobile pm_Owner = decoyEasterEgg.ParentEntity as PlayerMobile; pm_Owner.SendMessage("The eggs you gathered appear to be some sort of decoy, and they crumble in your backpack..."); pm_Owner.SendSound(0x134); } decoyEasterEgg.Delete(); } } int radius = 2; int effectSound = 0; switch (eggType) { case EggType.Explosive: effectSound = 0x359; break; case EggType.Entangle: effectSound = 0x211; break; case EggType.Poison: effectSound = 0x22F; break; case EggType.Ice: effectSound = 0x64F; break; case EggType.Banish: effectSound = 0x655; break; case EggType.Gust: effectSound = 0x64C; break; case EggType.Bloody: effectSound = 0x62B; break; } Effects.PlaySound(location, map, effectSound); Dictionary <Point3D, double> m_ExplosionLocations = new Dictionary <Point3D, double>(); m_ExplosionLocations.Add(location, 0); for (int a = 1; a < radius + 1; a++) { m_ExplosionLocations.Add(new Point3D(location.X - a, location.Y - a, location.Z), a); m_ExplosionLocations.Add(new Point3D(location.X, location.Y - a, location.Z), a); m_ExplosionLocations.Add(new Point3D(location.X + a, location.Y - a, location.Z), a); m_ExplosionLocations.Add(new Point3D(location.X + a, location.Y, location.Z), a); m_ExplosionLocations.Add(new Point3D(location.X + a, location.Y + a, location.Z), a); m_ExplosionLocations.Add(new Point3D(location.X, location.Y + a, location.Z), a); m_ExplosionLocations.Add(new Point3D(location.X - a, location.Y + a, location.Z), a); m_ExplosionLocations.Add(new Point3D(location.X - a, location.Y, location.Z), a); } foreach (KeyValuePair <Point3D, double> pair in m_ExplosionLocations) { Timer.DelayCall(TimeSpan.FromSeconds(pair.Value * .25), delegate { switch (eggType) { case EggType.Explosive: Effects.SendLocationParticles(EffectItem.Create(pair.Key, map, TimeSpan.FromSeconds(0.5)), 0x36BD, 20, 10, 5044); break; case EggType.Entangle: radius = 3; Effects.SendLocationParticles(EffectItem.Create(pair.Key, map, TimeSpan.FromSeconds(.5)), 0x3973, 10, 50, 5029); break; case EggType.Poison: Effects.SendLocationParticles(EffectItem.Create(pair.Key, map, TimeSpan.FromSeconds(0.5)), 0x372A, 10, 20, 59, 0, 5029, 0); break; case EggType.Ice: radius = 3; Effects.SendLocationParticles(EffectItem.Create(pair.Key, map, TimeSpan.FromSeconds(0.25)), 0x3779, 10, 20, 1153, 0, 5029, 0); break; case EggType.Banish: radius = 3; Effects.SendLocationParticles(EffectItem.Create(pair.Key, map, TimeSpan.FromSeconds(.25)), 0x3763, 10, 20, 2199, 0, 5029, 0); break; case EggType.Gust: radius = 4; Effects.SendLocationParticles(EffectItem.Create(pair.Key, map, TimeSpan.FromSeconds(.25)), 0x1FB2, 10, 20, 0, 0, 5029, 0); break; case EggType.Bloody: Effects.SendLocationParticles(EffectItem.Create(pair.Key, map, TimeSpan.FromSeconds(.25)), Utility.RandomList(0x1645, 0x122A, 0x122B, 0x122C, 0x122D, 0x122E, 0x122F), 10, 20, 0, 0, 5029, 0); break; } }); } List <Mobile> m_TargetsHit = new List <Mobile>(); IPooledEnumerable eable = map.GetMobilesInRange(location, radius); foreach (Mobile mobile in eable) { if (mobile is EasterBunny) { continue; } if (!mobile.CanBeDamaged()) { continue; } m_TargetsHit.Add(mobile); } eable.Free(); int targets = m_TargetsHit.Count; for (int a = 0; a < targets; a++) { double damage = 0; Mobile mobile = m_TargetsHit[a]; if (mobile == null) { continue; } if (!mobile.Alive || mobile.Deleted) { continue; } switch (eggType) { case EggType.Explosive: damage = (double)(Utility.RandomMinMax(20, 40)); if (mobile is BaseCreature) { damage *= 1.5; } AOS.Damage(mobile, (int)damage, 0, 100, 0, 0, 0); break; case EggType.Entangle: if (mobile != null) { SpecialAbilities.EntangleSpecialAbility(1.0, null, mobile, 1, 10, -1, true, "", "You are held in place!", "-1"); } break; case EggType.Poison: Poison poison = Poison.GetPoison(Utility.RandomMinMax(2, 4)); mobile.ApplyPoison(mobile, poison); break; case EggType.Ice: damage = (double)(Utility.RandomMinMax(10, 20)); if (mobile is BaseCreature) { damage *= 1.5; } SpecialAbilities.CrippleSpecialAbility(1.0, null, mobile, .5, 10, -1, true, "", "A blast of ice has slowed your actions!", "-1"); AOS.Damage(mobile, (int)damage, 0, 100, 0, 0, 0); break; case EggType.Gust: SpecialAbilities.KnockbackSpecialAbility(1.0, Location, null, mobile, 40, 8, -1, "", "A gust of wind knocks you off your feet!"); break; case EggType.Banish: SpecialAbilities.HinderSpecialAbility(1.0, null, mobile, 1.0, 5, false, -1, false, "", "You cannot move or speak!", "-1"); mobile.Squelched = true; mobile.Hidden = true; Timer.DelayCall(TimeSpan.FromSeconds(5), delegate { if (mobile == null) { return; } mobile.Squelched = false; mobile.Hidden = false; }); break; case EggType.Bloody: SpecialAbilities.BleedSpecialAbility(1.0, null, mobile, 40, 8.0, 0x44D, true, "", "You begin to bleed!", "-1"); break; } } }); }
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() { //This is where all the action happens for the summon switch (cycle) { case 0: { // Stage 0 -- Let the players know something is happening! Effects.PlaySound(Champ.Location, Champ.Map, 0x2F3); IPooledEnumerable eable = Champ.GetMobilesInRange(15); foreach (Mobile m in eable) { if (m is PlayerMobile) { m.SendMessage("You feel the ground begin to shake beneath your feet!"); } } eable.Free(); ++cycle; Delay = TimeSpan.FromSeconds(4); Start(); break; } case 1: { // Stage 1 -- champion considers the sacrifice Champ.m_Speaker.PublicOverheadMessage(Network.MessageType.Regular, 0x3B2, false, "The Champion considers your sacrifice..."); if (Sacrifice != null) { //flamestrike and delete sacrifice Effects.SendLocationParticles(EffectItem.Create(Sacrifice.Location, Sacrifice.Map, EffectItem.DefaultDuration), 0x3709, 30, 30, 3000); Effects.PlaySound(Sacrifice.Location, Sacrifice.Map, 0x225); Sacrifice.Delete(); } //Next cycle.. ++cycle; Delay = TimeSpan.FromSeconds(Utility.Random(5, 10)); Start(); break; } case 2: { //Show accept message Champ.m_Speaker.PublicOverheadMessage(0, 0x3B2, false, "The Champion accepts your challenge!"); // Do flame strikes on corners of altar in paris if (Champ.m_bGraphics && Champ.m_Graphics.IsHealthy()) { Effects.SendLocationParticles(EffectItem.Create(new Point3D(Champ.m_Graphics.Altar.X + 3, Champ.m_Graphics.Altar.Y + 3, Champ.m_Graphics.Altar.Z + 15), Champ.m_Graphics.Altar.Map, EffectItem.DefaultDuration), 0x3709, 10, 30, 5052); Effects.SendLocationParticles(EffectItem.Create(new Point3D(Champ.m_Graphics.Altar.X, Champ.m_Graphics.Altar.Y, Champ.m_Graphics.Altar.Z + 15), Champ.m_Graphics.Altar.Map, EffectItem.DefaultDuration), 0x3709, 10, 30, 5052); } Effects.PlaySound(Champ.Location, Champ.Map, 0x81); ++cycle; Delay = TimeSpan.FromMilliseconds(300); Start(); break; } case 3: { //Other pair... if (Champ.m_bGraphics && Champ.m_Graphics.IsHealthy()) { Effects.SendLocationParticles(EffectItem.Create(new Point3D(Champ.m_Graphics.Altar.X + 3, Champ.m_Graphics.Altar.Y, Champ.m_Graphics.Altar.Z + 15), Champ.m_Graphics.Altar.Map, EffectItem.DefaultDuration), 0x3709, 10, 30, 5052); Effects.SendLocationParticles(EffectItem.Create(new Point3D(Champ.m_Graphics.Altar.X, Champ.m_Graphics.Altar.Y + 3, Champ.m_Graphics.Altar.Z + 15), Champ.m_Graphics.Altar.Map, EffectItem.DefaultDuration), 0x3709, 10, 30, 5052); } //Clear the existing spawn out Champ.m_Summoning = false; Champ.SpawnType = ChampType; break; } } }
public override void OnThink() { base.OnThink(); if (Combatant != null && DateTime.UtcNow > m_NextMeteorRainAllowed && DateTime.UtcNow > m_NextAbilityAllowed) { double spawnPercent = (double)intervalCount / (double)totalIntervals; int meteors = 30 + (int)(Math.Ceiling(50 * spawnPercent)); int loops = (int)(Math.Ceiling((double)meteors / 10)); double stationaryDelay = loops + 2.5; m_NextMeteorRainAllowed = DateTime.UtcNow + NextMeteorRainDelay + TimeSpan.FromSeconds(stationaryDelay); m_NextAbilityAllowed = DateTime.UtcNow + NextAbilityAllowedDelay + TimeSpan.FromSeconds(stationaryDelay); PlaySound(GetAngerSound()); AIObject.NextMove = DateTime.UtcNow + TimeSpan.FromSeconds(stationaryDelay); LastSwingTime = LastSwingTime + TimeSpan.FromSeconds(stationaryDelay); NextSpellTime = NextSpellTime + TimeSpan.FromSeconds(stationaryDelay); NextCombatHealActionAllowed = NextCombatHealActionAllowed + TimeSpan.FromSeconds(stationaryDelay); NextCombatSpecialActionAllowed = NextCombatSpecialActionAllowed + TimeSpan.FromSeconds(stationaryDelay); NextCombatEpicActionAllowed = NextCombatEpicActionAllowed + TimeSpan.FromSeconds(stationaryDelay); Animate(23, 10, 1, true, false, 0); PublicOverheadMessage(MessageType.Regular, 0, false, "*rains down hellfire*"); Point3D location = Location; Map map = Map; Timer.DelayCall(TimeSpan.FromSeconds(1.0), delegate { if (this == null) { return; } if (this.Deleted) { return; } for (int a = 0; a < loops; a++) { Timer.DelayCall(TimeSpan.FromSeconds(a * 1), delegate { if (this == null) { return; } if (Deleted || !Alive) { return; } Animate(23, 10, 1, true, false, 0); PlaySound(GetAngerSound()); Effects.PlaySound(location, map, 0x5CF); }); } for (int a = 0; a < meteors; a++) { Timer.DelayCall(TimeSpan.FromSeconds(a * .1), delegate { if (this == null) { return; } if (Deleted || !Alive) { return; } Point3D meteorLocation = new Point3D(location.X + Utility.RandomMinMax(-8, 8), location.Y + Utility.RandomMinMax(-8, 8), location.Z); IEntity startLocation = new Entity(Serial.Zero, new Point3D(meteorLocation.X - 1, meteorLocation.Y - 1, meteorLocation.Z + 100), map); IEntity endLocation = new Entity(Serial.Zero, new Point3D(meteorLocation.X, meteorLocation.Y, meteorLocation.Z + 5), map); int particleSpeed = 8 + (int)(Math.Round(8 * (double)spawnPercent)); Effects.SendMovingParticles(startLocation, endLocation, 0x36D4, particleSpeed, 0, false, false, 2613, 0, 9501, 0, 0, 0x100); double impactDelay = .75 - (.375 * spawnPercent); Timer.DelayCall(TimeSpan.FromSeconds(impactDelay), delegate { if (this == null) { return; } if (Deleted || !Alive) { return; } Effects.PlaySound(endLocation, map, 0x56E); Effects.SendLocationParticles(endLocation, 0x3709, 10, 20, 2613, 0, 5029, 0); Blood rocks = new Blood(); rocks.Name = "rocks"; rocks.Hue = 2615; rocks.ItemID = Utility.RandomList(4967, 4970, 4973); Point3D rockLocation = new Point3D(meteorLocation.X, meteorLocation.Y, meteorLocation.Z); rocks.MoveToWorld(rockLocation, map); double firefieldChance = .20 + (.20 * spawnPercent); if (Utility.RandomDouble() <= firefieldChance) { Timer.DelayCall(TimeSpan.FromSeconds(.25), delegate { SingleFireField singleFireField = new SingleFireField(null, 2613, 1, 30, 3, 5, false, false, true, -1, true); singleFireField.MoveToWorld(rockLocation, map); }); } IPooledEnumerable mobilesOnTile = map.GetMobilesInRange(meteorLocation, 1); Queue m_Queue = new Queue(); foreach (Mobile mobile in mobilesOnTile) { if (!mobile.CanBeDamaged() || !mobile.Alive || mobile.AccessLevel > AccessLevel.Player) { continue; } bool validTarget = false; PlayerMobile pm_Target = mobile as PlayerMobile; BaseCreature bc_Target = mobile as BaseCreature; if (pm_Target != null) { validTarget = true; } if (bc_Target != null) { if (bc_Target.Controlled && bc_Target.ControlMaster is PlayerMobile) { validTarget = true; } } if (validTarget) { m_Queue.Enqueue(mobile); } } mobilesOnTile.Free(); while (m_Queue.Count > 0) { Mobile mobile = (Mobile)m_Queue.Dequeue(); double damage = Utility.RandomMinMax((int)(Math.Round((double)DamageMin / 2)), DamageMin); if (mobile is BaseCreature) { damage *= 1.5; } new Blood().MoveToWorld(mobile.Location, mobile.Map); AOS.Damage(mobile, (int)damage, 0, 100, 0, 0, 0); } }); }); } }); return; } if (Combatant != null && DateTime.UtcNow > m_NextFireBlastAllowed && DateTime.UtcNow > m_NextAbilityAllowed) { if (Combatant.Alive && !Combatant.Hidden && InLOS(Combatant) && GetDistanceToSqrt(Combatant) <= 12) { m_NextFireBlastAllowed = DateTime.UtcNow + NextFireBlastDelay; m_NextAbilityAllowed = DateTime.UtcNow + NextAbilityAllowedDelay; double effectTime = 1.5; double actionsCooldown = 3; PlaySound(GetAngerSound()); AIObject.NextMove = DateTime.UtcNow + TimeSpan.FromSeconds(effectTime); LastSwingTime = LastSwingTime + TimeSpan.FromSeconds(effectTime); NextSpellTime = NextSpellTime + TimeSpan.FromSeconds(actionsCooldown); NextCombatHealActionAllowed = NextCombatHealActionAllowed + TimeSpan.FromSeconds(actionsCooldown); NextCombatSpecialActionAllowed = NextCombatSpecialActionAllowed + TimeSpan.FromSeconds(actionsCooldown); NextCombatEpicActionAllowed = NextCombatEpicActionAllowed + TimeSpan.FromSeconds(actionsCooldown); Animate(6, 10, 1, true, false, 0); int itemId = 0x573E; int itemHue = 0; Point3D location = Location; Point3D targetLocation = Combatant.Location; Map map = Combatant.Map; Timer.DelayCall(TimeSpan.FromSeconds(.5), delegate { if (this == null) { return; } if (Deleted || !Alive) { return; } Effects.PlaySound(targetLocation, map, 0x5FC); IEntity startLocation = new Entity(Serial.Zero, new Point3D(location.X, location.Y, location.Z + 20), map); IEntity endLocation = new Entity(Serial.Zero, new Point3D(targetLocation.X, targetLocation.Y, targetLocation.Z + 10), map); Effects.SendMovingParticles(startLocation, endLocation, 0x36D4, 8, 0, false, false, 2613, 0, 9501, 0, 0, 0x100); double distance = GetDistanceToSqrt(targetLocation); double destinationDelay = (double)distance * .06; Timer.DelayCall(TimeSpan.FromSeconds(destinationDelay), delegate { double spawnPercent = (double)intervalCount / (double)totalIntervals; Effects.PlaySound(targetLocation, map, 0x357); Dictionary <Point3D, double> m_ExplosionLocations = new Dictionary <Point3D, double>(); m_ExplosionLocations.Add(targetLocation, 0); int radius = 2 + (int)(Math.Ceiling(6 * spawnPercent)); int minRange = -1 * radius; int maxRange = radius + 1; for (int a = minRange; a < maxRange; a++) { for (int b = minRange; b < maxRange; b++) { Point3D explosionPoint = new Point3D(targetLocation.X + a, targetLocation.Y + b, targetLocation.Z); int distanceFromCenter = Utility.GetDistance(targetLocation, explosionPoint); double fireburstChance = .25 + (.25 * spawnPercent); if (Utility.RandomDouble() <= fireburstChance) { if (!m_ExplosionLocations.ContainsKey(explosionPoint)) { m_ExplosionLocations.Add(explosionPoint, distance); } } } } foreach (KeyValuePair <Point3D, double> pair in m_ExplosionLocations) { Timer.DelayCall(TimeSpan.FromSeconds(pair.Value * .10), delegate { Point3D explosionLocation = pair.Key; SpellHelper.AdjustField(ref explosionLocation, map, 12, false); Effects.PlaySound(pair.Key, map, 0x56D); Effects.SendLocationParticles(EffectItem.Create(explosionLocation, map, TimeSpan.FromSeconds(0.5)), 0x36BD, 20, 10, 2613, 0, 5044, 0); IPooledEnumerable mobilesOnTile = map.GetMobilesInRange(pair.Key, 0); Queue m_Queue = new Queue(); foreach (Mobile mobile in mobilesOnTile) { if (!mobile.CanBeDamaged() || !mobile.Alive || mobile.AccessLevel > AccessLevel.Player) { continue; } bool validTarget = false; PlayerMobile pm_Target = mobile as PlayerMobile; BaseCreature bc_Target = mobile as BaseCreature; if (pm_Target != null) { validTarget = true; } if (bc_Target != null) { if (bc_Target.Controlled && bc_Target.ControlMaster is PlayerMobile) { validTarget = true; } } if (validTarget) { m_Queue.Enqueue(mobile); } } mobilesOnTile.Free(); while (m_Queue.Count > 0) { Mobile mobile = (Mobile)m_Queue.Dequeue(); double damage = DamageMin; if (mobile is BaseCreature) { damage *= 1.5; } new Blood().MoveToWorld(mobile.Location, mobile.Map); AOS.Damage(mobile, (int)damage, 0, 100, 0, 0, 0); } }); } }); }); } return; } if (Utility.RandomDouble() < .01 && DateTime.UtcNow > m_NextAIChangeAllowed) { Effects.PlaySound(Location, Map, GetAngerSound()); switch (Utility.RandomMinMax(1, 5)) { case 1: DictCombatTargetingWeight[CombatTargetingWeight.Player] = 0; DictCombatTargetingWeight[CombatTargetingWeight.Closest] = 0; DictCombatTargetingWeight[CombatTargetingWeight.HighestHitPoints] = 0; DictCombatTargetingWeight[CombatTargetingWeight.LowestHitPoints] = 0; break; case 2: DictCombatTargetingWeight[CombatTargetingWeight.Player] = 10; DictCombatTargetingWeight[CombatTargetingWeight.Closest] = 0; DictCombatTargetingWeight[CombatTargetingWeight.HighestHitPoints] = 0; DictCombatTargetingWeight[CombatTargetingWeight.LowestHitPoints] = 0; break; case 3: DictCombatTargetingWeight[CombatTargetingWeight.Player] = 0; DictCombatTargetingWeight[CombatTargetingWeight.Closest] = 10; DictCombatTargetingWeight[CombatTargetingWeight.HighestHitPoints] = 0; DictCombatTargetingWeight[CombatTargetingWeight.LowestHitPoints] = 0; break; case 4: DictCombatTargetingWeight[CombatTargetingWeight.Player] = 0; DictCombatTargetingWeight[CombatTargetingWeight.Closest] = 0; DictCombatTargetingWeight[CombatTargetingWeight.HighestHitPoints] = 10; DictCombatTargetingWeight[CombatTargetingWeight.LowestHitPoints] = 0; break; case 5: DictCombatTargetingWeight[CombatTargetingWeight.Player] = 0; DictCombatTargetingWeight[CombatTargetingWeight.Closest] = 0; DictCombatTargetingWeight[CombatTargetingWeight.HighestHitPoints] = 0; DictCombatTargetingWeight[CombatTargetingWeight.LowestHitPoints] = 10; break; } m_NextAIChangeAllowed = DateTime.UtcNow + NextAIChangeDelay; } }
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.IsPlayer) / 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 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.SendLocalizedMessage(1080119); // Your Purge Magic has been resisted! } 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.Strength); break; case BuffType.DexBonus: arg = "dexterity bonus"; target.RemoveStatMod("[Magic] Dex Buff"); BuffInfo.RemoveBuff(target, BuffIcon.Agility); break; case BuffType.IntBonus: arg = "intelligence bonus"; target.RemoveStatMod("[Magic] Int Buff"); 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; case BuffType.Bless: arg = "bless"; target.RemoveStatMod("[Magic] Str Buff"); target.RemoveStatMod("[Magic] Dex Buff"); target.RemoveStatMod("[Magic] Int Buff"); BuffInfo.RemoveBuff(target, BuffIcon.Bless); BlessSpell.RemoveBless(target); 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(); }
public override void OnDoubleClick(Mobile m) { if (IsChildOf(m.Backpack) && Tree != null) { m.SendLocalizedMessage(1010086); // What do you want to use this on? m.BeginTarget(10, false, Server.Targeting.TargetFlags.None, (from, targeted) => { _Thrown = true; if (targeted is ShadowguardCypress || targeted is ShadowguardCypress.ShadowguardCypressFoilage) { ShadowguardCypress tree = null; if (targeted is ShadowguardCypress) { tree = targeted as ShadowguardCypress; } else if (targeted is ShadowguardCypress.ShadowguardCypressFoilage) { tree = ((ShadowguardCypress.ShadowguardCypressFoilage)targeted).Tree; } if (tree != null) { Point3D p = tree.Location; Map map = tree.Map; from.Animate(31, 7, 1, true, false, 0); m.MovingParticles(tree, ItemID, 10, 0, false, true, 0, 0, 9502, 6014, 0x11D, EffectLayer.Waist, 0); Timer.DelayCall(TimeSpan.FromSeconds(.7), () => { if (tree.IsOppositeVirtue(Tree.VirtueType)) { tree.Delete(); Effects.SendLocationParticles(EffectItem.Create(p, map, EffectItem.DefaultDuration), 0x3709, 10, 30, 5052); Effects.PlaySound(p, map, 0x243); m.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1156213, m.NetState); // *Your throw releases powerful magics and destroys the tree!* if (Tree != null) { p = Tree.Location; Tree.Delete(); Effects.SendLocationParticles(EffectItem.Create(p, map, EffectItem.DefaultDuration), 0x3709, 10, 30, 5052); Effects.PlaySound(p, map, 0x243); //TODO: Get sound } tree.Encounter.CheckEncounter(); Delete(); } else if (Encounter != null) { foreach (PlayerMobile pm in Encounter.Region.GetEnumeratedMobiles().OfType <PlayerMobile>()) { if (!pm.Alive) { continue; } p = pm.Location; VileTreefellow creature = new VileTreefellow(); for (int i = 0; i < 10; i++) { int x = Utility.RandomMinMax(p.X - 1, p.X + 1); int y = Utility.RandomMinMax(p.Y - 1, p.Y + 1); int z = p.Z; if (map.CanSpawnMobile(x, y, z)) { p = new Point3D(x, y, z); break; } } creature.MoveToWorld(p, map); Timer.DelayCall(() => creature.Combatant = pm); Encounter.AddSpawn(creature); } m.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1156212, m.NetState); // *Your throw seems to have summoned an ambush!* Delete(); } }); } } }); } }
public override void OnDoubleClick(Mobile m) { if (IsChildOf(m.Backpack)) { m.SendLocalizedMessage(1010086); // What do you want to use this on? m.BeginTarget(3, false, Server.Targeting.TargetFlags.None, (from, targeted) => { if (targeted is PurifyingFlames) { PurifyingFlames flames = targeted as PurifyingFlames; if (!from.InLOS(flames)) { from.SendLocalizedMessage(500237); // Target cannot be seen. } else if (!Purified) { m.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1156225, m.NetState); // *You purify the phylactery!* Effects.SendLocationParticles(EffectItem.Create(flames.Location, flames.Map, EffectItem.DefaultDuration), 0x3709, 10, 30, 5052); Effects.PlaySound(flames.Location, flames.Map, 0x225); //TODO: Get sound Purified = true; InvalidateProperties(); } } else if (targeted is CursedSuitOfArmor) { CursedSuitOfArmor armor = targeted as CursedSuitOfArmor; if (!from.InLOS(armor)) { from.SendLocalizedMessage(500237); // Target cannot be seen. } else if (!_Purified) { m.SendLocalizedMessage(1156224); // *The cursed armor rejects the phylactery!* } else { m.SendLocalizedMessage(1156222); // *You throw the phylactery at the armor causing it to disintegrate!* Map map = armor.Map; Point3D p; if (armor.ItemID == 5402) { p = new Point3D(armor.X - 1, armor.Y, armor.Z); } else { p = new Point3D(armor.X, armor.Y - 1, armor.Z); } armor.Delete(); Delete(); Effects.SendLocationParticles(EffectItem.Create(p, map, EffectItem.DefaultDuration), 0x3709, 10, 30, 2720, 7, 5052, 0); Effects.PlaySound(p, map, 0x225); //TODO: Get sound Timer.DelayCall(TimeSpan.FromSeconds(1), () => { Item item = new Static(Utility.Random(8762, 16)); item.Hue = 1111; item.Name = "Broken Armor"; item.MoveToWorld(p, Map.TerMur); ArmoryEncounter encounter = ShadowguardController.GetEncounter(p, Map.TerMur) as ArmoryEncounter; if (encounter != null) { encounter.AddDestroyedArmor(item); } int ticks = 1; Timer.DelayCall(TimeSpan.FromMilliseconds(50), TimeSpan.FromMilliseconds(50), 2, () => { Server.Misc.Geometry.Circle2D(p, map, ticks, (pnt, mob) => { Effects.PlaySound(pnt, mob, 0x307); Effects.SendLocationEffect(pnt, mob, Utility.RandomBool() ? 14000 : 14013, 20, 2018, 0); }); ticks++; }); }); } } }); } }
public override void OnThink() { base.OnThink(); if (Combatant == null) { return; } if (_NextSpecial < DateTime.UtcNow) { _NextSpecial = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(45, 60)); switch (Utility.Random(Teleports ? 3 : 2)) { case 0: IPooledEnumerable eable = Map.GetMobilesInRange(Location, 10); foreach (Mobile m in eable) { if (m.Alive && m.AccessLevel == AccessLevel.Player && m is PlayerMobile && .75 > Utility.RandomDouble()) { DoDismount(m); } } eable.Free(); break; case 1: IPooledEnumerable eable2 = Map.GetMobilesInRange(Location, 10); List <Mobile> mobiles = new List <Mobile>(); foreach (Mobile m in eable2) { if (m.Alive && m.AccessLevel == AccessLevel.Player && m is PlayerMobile) { mobiles.Add(m); } } eable2.Free(); if (mobiles.Count > 0) { Mobile m = mobiles[Utility.Random(mobiles.Count)]; Point3D old2 = m.Location; Point3D p2 = _PlayerTeleList[Utility.Random(_PlayerTeleList.Length)]; m.MoveToWorld(p2, Map); m.ProcessDelta(); Effects.SendLocationParticles(EffectItem.Create(old2, Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 2023); Effects.SendLocationParticles(EffectItem.Create(p2, Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 5023); } ColUtility.Free(mobiles); break; case 2: int ran = -1; while (ran < 0 || ran > _TeleList.Length || ran == _LastTeleport) { ran = Utility.Random(_TeleList.Length); } _LastTeleport = ran; Point3D p = _TeleList[ran]; Point3D old = Location; MoveToWorld(p, Map); ProcessDelta(); Effects.SendLocationParticles(EffectItem.Create(old, Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 2023); Effects.SendLocationParticles(EffectItem.Create(p, Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 5023); break; } } else if (_NextBarrelThrow < DateTime.UtcNow && .25 > Utility.RandomDouble()) { _NextBarrelThrow = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(5, 10)); int barrel = CheckBarrel(); if (barrel >= 0) { IPooledEnumerable eable = Map.GetMobilesInRange(Location, 10); List <Mobile> mobiles = new List <Mobile>(); foreach (Mobile m in eable) { if (m.Alive && m.AccessLevel == AccessLevel.Player && m is PlayerMobile) { mobiles.Add(m); } } eable.Free(); if (mobiles.Count > 0) { Mobile m = mobiles[Utility.Random(mobiles.Count)]; DoHarmful(m); MovingParticles(m, barrel, 10, 0, false, true, 0, 0, 9502, 6014, 0x11D, EffectLayer.Waist, 0); Timer.DelayCall(TimeSpan.FromSeconds(1), () => { m.PlaySound(0x11D); AOS.Damage(m, this, Utility.RandomMinMax(70, 120), 100, 0, 0, 0, 0); }); } ColUtility.Free(mobiles); } } }
public void Target(object target) { if (!Caster.CanSee(target)) { Caster.SendLocalizedMessage(500237); // Target can not be seen. } bool singlemob = false; BaseCreature to; IPoint3D p = target as IPoint3D; if (target == null) { return; } else if (CheckSequence()) { SpellHelper.Turn(Caster, p); SpellHelper.GetSurfaceTop(ref p); ArrayList targets = new ArrayList(); Map map = Caster.Map; if (target is BaseCreature && (((BaseCreature)target).Summoned || target is Genie) && !((BaseCreature)target).IsAnimatedDead && Caster.CanBeHarmful((Mobile)target, false)) { to = (BaseCreature)p; singlemob = true; double dChance = (108 + ((100 * (Caster.Skills.Magery.Value - to.DispelDifficulty)) / (to.DispelFocus * 2))) / 100; if (dChance > 0.99) { dChance = 0.99; } //Console.WriteLine(dChance); if (dChance > Utility.RandomDouble()) { Effects.SendLocationParticles(EffectItem.Create(to.Location, to.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042); Effects.PlaySound(to, to.Map, 0x201); to.Delete(); } else { to.FixedEffect(0x3779, 10, 20); Caster.SendLocalizedMessage(1010084); // The creature resisted the attempt to dispel it! Caster.DoHarmful(to); // and now he's pissed at you } FinishSequence(); } if (map != null && singlemob == false) { IPooledEnumerable eable = map.GetMobilesInRange(new Point3D(p), 8); foreach (Mobile m in eable) { if (m is BaseCreature && ((BaseCreature)m).Summoned && !((BaseCreature)m).IsAnimatedDead && Caster.CanBeHarmful(m, false)) { targets.Add(m); } } eable.Free(); } for (int i = 0; i < targets.Count; ++i) { Mobile m = (Mobile)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 { m.FixedEffect(0x3779, 10, 20); Caster.SendLocalizedMessage(1010084); // The creature resisted the attempt to dispel it! Caster.DoHarmful(m); // and now he's pissed at you } } } FinishSequence(); }
public override void OnDelete() { Effects.SendLocationParticles(EffectItem.Create(Location, Map, EffectItem.DefaultDuration), 0x3728, 10, 15, 5042); base.OnDelete(); }
protected override void OnTick() { if (m_Owner.Deleted) { Stop(); return; } Map map = m_Owner.Map; if (map == null) { return; } if (0.25 < 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), 0x3709, 1, 30, 9904, 1108); Effects.SendLocationParticles(EffectItem.Create(to, m.Map, EffectItem.DefaultDuration), 0x3709, 1, 30, 9904, 1108); m.PlaySound(0x1FE); m_Owner.Combatant = toTeleport; m_Owner.PrivateOverheadMessage(MessageType.Regular, 1153, false, "AHHHHH!!!! Help me!!!", m_Owner.NetState); } }
public override void BeginInvoke(Player from) { if (Core.NewEthics) { if (from.IsShielded) { from.Mobile.LocalOverheadMessage(Server.Network.MessageType.Regular, 0x3B2, false, "You are already under the protection of a holy shield."); return; } from.BeginShield(); from.Mobile.LocalOverheadMessage(Server.Network.MessageType.Regular, 0x3B2, false, "You are now under the protection of a holy shield."); } else { Point3D point = from.Mobile.Location; Map map = from.Mobile.Map; int itemID = 0x1bc3; TimeSpan duration = TimeSpan.FromMinutes(2); // are we at the maps edge? if (point.X < 2 || point.X > map.Width - 2 || point.Y < 2 || point.Y > map.Height - 2) { // fizzle from.Mobile.FixedEffect(0x3735, 6, 30); from.Mobile.PlaySound(0x5C); return; } bool blockPlaced = false; // the bounding box for (int x = point.X - 2; x <= point.X + 2; x++) { for (int y = point.Y - 2; y <= point.Y + 2; y++) { Point3D loc = new Point3D(x, y, map.GetAverageZ(x, y)); Item item = null; if (SpellHelper.AdjustField(ref loc, map, 12, false)) { // can fit? if (x == point.X - 2 || x == point.X + 2 || y == point.Y - 2 || y == point.Y + 2) { blockPlaced = true; item = new BlockItem(loc, from.Mobile.Map, duration, itemID, from.Mobile); // show the border loc = item.GetWorldLocation(); Effects.SendLocationParticles(EffectItem.Create(new Point3D(loc.X + 1, loc.Y, loc.Z), item.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 9502); Effects.SendLocationParticles(EffectItem.Create(new Point3D(loc.X, loc.Y - 1, loc.Z), item.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 9502); Effects.SendLocationParticles(EffectItem.Create(new Point3D(loc.X - 1, loc.Y, loc.Z), item.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 9502); Effects.SendLocationParticles(EffectItem.Create(new Point3D(loc.X, loc.Y + 1, loc.Z), item.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 9502); Effects.SendLocationParticles(EffectItem.Create(new Point3D(loc.X, loc.Y, loc.Z), item.Map, EffectItem.DefaultDuration), 0, 0, 0, 5014); } else { item = new PassItem(loc, from.Mobile.Map, duration, itemID, from.Mobile); } } } } if (blockPlaced) { // give each mobile within the shiled a free pass flag IPooledEnumerable eable = from.Mobile.GetMobilesInRange(2); foreach (Mobile m in eable) { // we allow the shielding of enemies here since otherwise it could be exploited to box // your enemy m.ExpirationFlags.Add(new Mobile.ExpirationFlag(m, Mobile.ExpirationFlagID.ShieldIgnore, duration)); m.LocalOverheadMessage(Server.Network.MessageType.Regular, 0x3B2, 502193); // An invisible shield forms around you. } eable.Free(); Effects.PlaySound(point, map, 0x1F6); } else { from.Mobile.FixedEffect(0x3735, 6, 30); from.Mobile.PlaySound(0x5C); } } FinishInvoke(from); }
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)) { 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 OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; from.CloseGump(typeof(ResurrectGump)); if (info.ButtonID == 1 || info.ButtonID == 2) { if (from.Map == null || !from.Map.CanFit(from.Location, 16, false, false)) { from.SendLocalizedMessage(502391); // Thou can not be resurrected there! return; } if (m_Price > 0) { if (info.IsSwitched(1)) { if (Banker.Withdraw(from, m_Price)) { from.SendLocalizedMessage(1060398, m_Price.ToString()); // ~1_AMOUNT~ gold has been withdrawn from your bank box. from.SendLocalizedMessage(1060022, Banker.GetBalance(from).ToString()); // You have ~1_AMOUNT~ gold in cash remaining in your bank box. } else { from.SendLocalizedMessage(1060020); // Unfortunately, you do not have enough cash in your bank to cover the cost of the healing. return; } } else { from.SendLocalizedMessage(1060019); // You decide against paying the healer, and thus remain dead. return; } } from.PlaySound(0x214); from.Resurrect(); Effects.SendLocationParticles(EffectItem.Create(from.Location, from.Map, EffectItem.DefaultDuration), 0, 0, 0, 0, 0, 5060, 0); Effects.SendMovingParticles(new Entity(0, new Point3D(from.X - 6, from.Y - 6, from.Z + 15), from.Map), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100); Effects.SendMovingParticles(new Entity(0, new Point3D(from.X - 4, from.Y - 6, from.Z + 15), from.Map), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100); Effects.SendMovingParticles(new Entity(0, new Point3D(from.X - 6, from.Y - 4, from.Z + 15), from.Map), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100); Effects.SendTargetParticles(from, 0x375A, 35, 90, 0x00, 0x00, 9502, (EffectLayer)255, 0x100); if (m_Healer != null && from != m_Healer) { VirtueLevel level = VirtueHelper.GetLevel(m_Healer, VirtueName.Compassion); switch (level) { case VirtueLevel.Seeker: from.Hits = AOS.Scale(from.HitsMax, 20); break; case VirtueLevel.Follower: from.Hits = AOS.Scale(from.HitsMax, 40); break; case VirtueLevel.Knight: from.Hits = AOS.Scale(from.HitsMax, 80); break; } } Mobile m = from; Misc.Titles.AwardFame(from, -100, true); // TODO: Proper fame loss if (!Core.AOS && from.ShortTermMurders >= 5) { double loss = (100.0 - (4.0 + (from.ShortTermMurders / 5.0))) / 100.0; //5 to 15% loss if (loss < 0.85) { loss = 0.85; } else if (loss > 0.95) { loss = 0.95; } if (from.RawStr * loss > 10) { from.RawStr = (int)(from.RawStr * loss); } if (from.RawInt * loss > 10) { from.RawInt = (int)(from.RawInt * loss); } if (from.RawDex * loss > 10) { from.RawDex = (int)(from.RawDex * loss); } for (int s = 0; s < from.Skills.Length; s++) { if (from.Skills[s].Base * loss > 35) { from.Skills[s].Base *= loss; } } } } }
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.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) { foreach (Mobile m in m_Item.GetMobilesInRange(0)) { 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); } } while (m_Queue.Count > 0) { Mobile m = (Mobile)m_Queue.Dequeue(); if (SpellHelper.CanRevealCaster(m)) { caster.RevealingAction(); } caster.DoHarmful(m); int damage = 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 BaseMobile bm) { bm.OnHarmfulSpell(caster); } } } } }
public void OnTarget(IPoint3D p) { if (p != null && CheckSequence()) { SpellHelper.Turn(Caster, p); SpellHelper.GetSurfaceTop(ref p); Map map = Caster.Map; if (map != null) { Rectangle2D effectArea = new Rectangle2D(p.X - 3, p.Y - 3, 6, 6); 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)); } } foreach (var d in AcquireIndirectTargets(p, 3)) { Server.Effects.SendTargetParticles(d, 0x374A, 1, 15, 9502, 97, 3, (EffectLayer)255, 0); double damage = (((Caster.Skills[CastSkill].Value + (Caster.Skills[DamageSkill].Value / 2)) * .66) + Utility.RandomMinMax(1, 6)); SpellHelper.Damage(this, d, damage, 0, 0, 0, 0, 0, 100, 0); if (d is Mobile) { Mobile m = d as Mobile; 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(d.Location, map, EffectItem.DefaultDuration), 0x37CC, 1, 40, 97, 3, 9917, 0); } } } FinishSequence(); }
public void Target(IPoint3D p) { if (!Caster.CanSee(p)) { Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (CheckSequence()) { if (this.Scroll != null) { Scroll.Consume(); } SpellHelper.Turn(Caster, p); SpellHelper.GetSurfaceTop(ref p); ArrayList targets = new ArrayList(); Map map = Caster.Map; if (map != null) { IPooledEnumerable eable = map.GetMobilesInRange(new Point3D(p), 3); foreach (Mobile m in eable) { if (Caster.CanBeBeneficial(m, false)) { targets.Add(m); } } eable.Free(); } if (targets.Count > 0) { for (int i = 0; i < targets.Count; ++i) { Mobile m = (Mobile)targets[i]; Caster.DoBeneficial(m); Effects.SendLocationParticles(EffectItem.Create(new Point3D(m.X, m.Y, m.Z + 16), Caster.Map, EffectItem.DefaultDuration), 0x376A, 10, 15, 5045); m.PlaySound(0x3C4); m.Hidden = true; RemoveTimer(m); TimeSpan duration = TimeSpan.FromSeconds(Caster.Skills[SkillName.Spellweaving].Value * 1.2); Timer t = new InternalTimer(m, duration); m_Table[m] = t; t.Start(); } } } FinishSequence(); }
public override void OnThink() { if (!m_Target.Alive || DateTime.UtcNow > m_ExpireTime) { Kill(); return; } else 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; } else { 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 - this.NextSkillTime >= 0 && UseSkill(SkillName.DetectHidden)) { Target targ = this.Target; if (targ != null) { targ.Invoke(this, this); } } Combatant = m_Target; FocusMob = m_Target; if (AIObject != null) { AIObject.Action = ActionType.Combat; } base.OnThink(); }
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 OnTarget(Mobile from, object o) { IPoint3D loc = o as IPoint3D; if (loc == null) { return; } if (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 mageUnlockable) { mageUnlockable.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 chest && chest.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 mapChest && TreasureMapInfo.NewSystem) { level = (int)from.Skills[SkillName.Magery].Value; switch (mapChest.Level) { default: case 0: reqSkill = 50; break; case 1: reqSkill = 80; break; case 2: reqSkill = 100; break; } }
public void Effect(Point3D loc, Map map, bool checkMulti) { if (Factions.Sigil.ExistsOn(Caster)) { Caster.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil. } else if (map == null || (!Core.AOS && Caster.Map != map)) { 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 (Caster.Kills >= 5 && map != Map.Felucca) { 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 (Server.Misc.WeightOverloading.IsOverloaded(Caster)) { Caster.SendLocalizedMessage(502359, "", 0x22); // Thou art too encumbered to move. } else if (!map.CanSpawnMobile(loc.X, loc.Y, loc.Z)) { Caster.SendLocalizedMessage(501942); // That location is blocked. } else if ((checkMulti && SpellHelper.CheckMulti(loc, map))) { 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 (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.MoveToWorld(loc, map); } FinishSequence(); }
public void Target(Mobile m) { if (m == null) { return; } 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); var damage = Utility.RandomMinMax(Core.ML ? 32 : 36, 40) * ((300 + GetDamageSkill(Caster) * 9) / 1000); var sdiBonus = (double)AosAttributes.GetValue(Caster, AosAttribute.SpellDamage) / 100; var pvmDamage = damage * (1 + sdiBonus); if (Core.ML && sdiBonus > 0.15) { sdiBonus = 0.15; } var pvpDamage = damage * (1 + sdiBonus); var map = m.Map; if (map != null) { var targets = new List <Mobile>(); if (Caster.CanBeHarmful(m, false)) { targets.Add(m); } targets.AddRange( m.GetMobilesInRange(2) .Where( targ => !(Caster is BaseCreature && targ is BaseCreature && targ != Caster && m != targ && SpellHelper.ValidIndirectTarget(Caster, targ) && Caster.CanBeHarmful(targ, false)) ) ); for (var i = 0; i < targets.Count; ++i) { var 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 ); } } } FinishSequence(); }
public virtual void BeginTunnel() { if (this == null) { return; } if (Deleted || !Alive) { return; } int digSound = 0x247; CantWalk = true; Say("*begins to dig a tunnel back to its magical lair*"); SpecialAbilities.HinderSpecialAbility(1.0, this, this, 1.0, 1, true, digSound, false, "", "", "-1"); digging = true; //Dirt int dirtCount = Utility.RandomMinMax(2, 3); for (int b = 0; b < dirtCount; b++) { Blood dirt = new Blood(); dirt.Name = "dirt"; dirt.ItemID = Utility.RandomList(7681, 7682); Point3D dirtLocation = new Point3D(Location.X + Utility.RandomList(-2, -1, 1, 2), Location.Y + Utility.RandomList(-2, -1, 1, 2), Z); dirt.MoveToWorld(dirtLocation, Map); } new BunnyHole().MoveToWorld(Location, Map); Animate(3, 5, 1, true, false, 0); for (int a = 1; a < 5; a++) { Timer.DelayCall(TimeSpan.FromSeconds(a), delegate { if (this == null) { return; } if (Deleted || !Alive) { return; } Animate(3, 5, 1, true, false, 0); Say("*digs*"); SpecialAbilities.HinderSpecialAbility(1.0, this, this, 1.0, 1, false, digSound, false, "", "", "-1"); //Dirt int extraDirtCount = Utility.RandomMinMax(2, 3); for (int b = 0; b < extraDirtCount; b++) { Blood extraDirt = new Blood(); extraDirt.Name = "dirt"; extraDirt.ItemID = Utility.RandomList(7681, 7682); Point3D extraDirtLocation = new Point3D(Location.X + Utility.RandomList(-2, -1, 1, 2), Location.Y + Utility.RandomList(-2, -1, 1, 2), Z); extraDirt.MoveToWorld(extraDirtLocation, Map); } }); } Timer.DelayCall(TimeSpan.FromSeconds(5.0), delegate { if (this == null) { return; } if (Deleted || !Alive) { return; } Say("*poof*"); Effects.PlaySound(Location, Map, 0x657); Effects.SendLocationParticles(EffectItem.Create(Location, Map, TimeSpan.FromSeconds(5)), 0x3728, 10, 10, 2023); Delete(); }); }
public void ApplyEffects(IDamageable m, double strength = 1.0) { /* 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((Core.ML ? 32 : 36), 40) * ((300 + (GetDamageSkill(Caster) * 9)) / 1000); damage *= strength; double sdiBonus; if (Core.SE) { if (Core.SA) { sdiBonus = (double)SpellHelper.GetSpellDamageBonus(Caster, m, CastSkill, m is PlayerMobile) / 100; } else { sdiBonus = (double)AosAttributes.GetValue(Caster, AosAttribute.SpellDamage) / 100; // PvP spell damage increase cap of 15% from an item’s magic property in Publish 33(SE) if (m is PlayerMobile && Caster.Player && sdiBonus > 15) { sdiBonus = 15; } } } else { sdiBonus = (double)AosAttributes.GetValue(Caster, AosAttribute.SpellDamage) / 100; } double pvmDamage = (damage * (1 + sdiBonus)) * strength; double pvpDamage = damage * (1 + sdiBonus); Map map = m.Map; if (map != null) { List <IDamageable> targets = new List <IDamageable>(); if (Caster.CanBeHarmful(m, false)) { targets.Add(m); } IPooledEnumerable eable = m.Map.GetObjectsInRange(m.Location, 2); foreach (object o in eable) { IDamageable id = o as IDamageable; if (!(Caster is BaseCreature && id is BaseCreature)) { if ((id is Mobile && (Mobile)id == Caster) || id == m) { continue; } if ((!(id is Mobile) || SpellHelper.ValidIndirectTarget(Caster, (Mobile)id)) && Caster.CanBeHarmful(id, false)) { targets.Add(id); } } } eable.Free(); for (int i = 0; i < targets.Count; ++i) { IDamageable id = targets[i]; int num; if (Utility.InRange(id.Location, m.Location, 0)) { num = 1; } else if (Utility.InRange(id.Location, m.Location, 1)) { num = 2; } else { num = 3; } Caster.DoHarmful(id); SpellHelper.Damage(this, id, ((id is PlayerMobile && Caster.Player) ? pvpDamage : pvmDamage) / num, 0, 0, 0, 100, 0); } targets.Clear(); targets.TrimExcess(); } }
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; }
public override void OnCast() { if (CheckSequence()) { List <Mobile> targets = new List <Mobile>(); foreach (Mobile m in Caster.GetMobilesInRange(8)) { 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; } } 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(); }
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); int dx = Caster.Location.X - p.X; int dy = Caster.Location.Y - p.Y; int rx = (dx - dy) * 44; int 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(p, Caster.Map, 0x20B); int itemID = eastToWest ? 0x3967 : 0x3979; TimeSpan duration = TimeSpan.FromSeconds(3.0 + Caster.Skills[SkillName.Magery].Value / 3.0); for (int i = -2; i <= 2; ++i) { Point3D loc = new Point3D(eastToWest ? p.X + i : p.X, eastToWest ? p.Y : p.Y + i, p.Z); bool 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(); }
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>(); foreach (Mobile m in Caster.GetMobilesInRange(Core.ML ? 4 : 5)) { if (Caster != m && Caster.InLOS(m) && SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false)) { 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; int nBenefit = 0; if (Caster is PlayerMobile) { nBenefit = (int)(Caster.Skills[SkillName.Necromancy].Value / 5); } damage = damage + nBenefit; SpellHelper.Damage(this, m, damage, 0, 0, 100, 0, 0); } } } FinishSequence(); }