public override void OnGaveMeleeAttack(Mobile defender) { base.OnGaveMeleeAttack(defender); if (Utility.RandomDouble() < .1) { double damage = (double)(Utility.RandomMinMax(DamageMin, DamageMax)) * 2; PublicOverheadMessage(MessageType.Regular, 0, false, "*unleashes gust of air*"); Effects.PlaySound(this.Location, this.Map, 0x64C); Animate(12, 6, 1, true, false, 0); SpecialAbilities.KnockbackSpecialAbility(1.0, Location, this, defender, damage, 5, -1, "", "The creature knocks you back with a gust of air!"); } }
public override void OnGaveMeleeAttack(Mobile defender) { base.OnGaveMeleeAttack(defender); double knockbackChance = .20; if (Utility.RandomDouble() <= knockbackChance) { PublicOverheadMessage(MessageType.Regular, 0, false, "*flings them aside*"); double damage = DamageMax; SpecialAbilities.KnockbackSpecialAbility(1.0, Location, this, defender, damage, 10, -1, "", "The creature flings you aside!"); Combatant = null; } }
public override void OnGaveMeleeAttack(Mobile defender) { base.OnGaveMeleeAttack(defender); if (Utility.RandomDouble() <= .20) { PublicOverheadMessage(MessageType.Regular, 0, false, "*swings wildly*"); double damage = DamageMin; if (defender is BaseCreature) { damage *= 1.5; } SpecialAbilities.KnockbackSpecialAbility(1.0, Location, this, defender, damage, 3, -1, "", "The creature flings you aside!"); Combatant = null; } }
public void WingBuffet() { if (!SpecialAbilities.Exists(this)) { return; } int wingFlaps = 3; double flapDuration = 0.5; double minRange = 10; double maxRange = 30; double spawnPercent = (double)intervalCount / (double)totalIntervals; int range = (int)(minRange + ((maxRange - minRange) * spawnPercent)); double totalDelay = 3; Combatant = null; SpecialAbilities.HinderSpecialAbility(1.0, null, this, 1.0, totalDelay, true, 0, false, "", "", "-1"); AbilityInProgress = true; DamageIntervalInProgress = true; m_NextAbilityAllowed = DateTime.UtcNow + NextAbilityDelay + TimeSpan.FromSeconds(.5); Timer.DelayCall(TimeSpan.FromSeconds(totalDelay), delegate { if (!SpecialAbilities.Exists(this)) { return; } AbilityInProgress = false; DamageIntervalInProgress = false; m_NextAbilityAllowed = DateTime.UtcNow + NextAbilityDelay; }); PublicOverheadMessage(MessageType.Regular, 0, false, "*furiously beats wings*"); for (int a = 0; a < wingFlaps; a++) { Timer.DelayCall(TimeSpan.FromSeconds(a * flapDuration), delegate { if (!SpecialAbilities.Exists(this)) { return; } Effects.PlaySound(Location, Map, GetAngerSound()); Animate(19, 10, 2, true, false, 0); }); } Timer.DelayCall(TimeSpan.FromSeconds((double)wingFlaps * flapDuration), delegate { if (!SpecialAbilities.Exists(this)) { return; } Point3D location = Location; Map map = Map; Queue m_Queue = new Queue(); IPooledEnumerable nearbyMobiles = map.GetMobilesInRange(location, range); foreach (Mobile mobile in nearbyMobiles) { if (mobile == this) { continue; } if (!SpecialAbilities.MonsterCanDamage(this, mobile)) { continue; } m_Queue.Enqueue(mobile); } nearbyMobiles.Free(); while (m_Queue.Count > 0) { Mobile mobile = (Mobile)m_Queue.Dequeue(); int distance = range - Utility.GetDistance(location, mobile.Location); if (distance < 1) { distance = 1; } double damage = (double)(Utility.RandomMinMax(DamageMin, DamageMax)) * 2; SpecialAbilities.KnockbackSpecialAbility(1.0, location, this, mobile, damage, distance, -1, "", "The beast buffets you with its wings!"); } }); }
public void Knockback() { if (!SpecialAbilities.Exists(Combatant)) { return; } if (!SpecialAbilities.MonsterCanDamage(this, Combatant)) { return; } Point3D targetLocation = Combatant.Location; Map map = Combatant.Map; double spawnPercent = (double)intervalCount / (double)totalIntervals; double initialDelay = 1; double totalDelay = 1 + initialDelay; Animate(14, 12, 1, true, false, 0); PlaySound(GetAngerSound()); PublicOverheadMessage(MessageType.Regular, 0, false, "*lashes out violently*"); SpecialAbilities.HinderSpecialAbility(1.0, null, this, 1.0, totalDelay, true, 0, false, "", "", "-1"); m_NextKnockbackAllowed = DateTime.UtcNow + NextKnockbackDelay + TimeSpan.FromSeconds(totalDelay); m_NextAbilityAllowed = DateTime.UtcNow + NextAbilityDelay + TimeSpan.FromSeconds(totalDelay); AbilityInProgress = true; Timer.DelayCall(TimeSpan.FromSeconds(totalDelay), delegate { if (SpecialAbilities.Exists(this)) { AbilityInProgress = false; Combatant = null; } }); Timer.DelayCall(TimeSpan.FromSeconds(initialDelay), delegate { if (!SpecialAbilities.Exists(this)) { return; } double damage = (double)(Utility.RandomMinMax(DamageMin, DamageMax)) * 2; Queue m_Queue = new Queue(); IPooledEnumerable nearbyMobiles = Map.GetMobilesInRange(targetLocation, 1); foreach (Mobile mobile in nearbyMobiles) { if (mobile == this) { continue; } if (!SpecialAbilities.MonsterCanDamage(this, mobile)) { continue; } m_Queue.Enqueue(mobile); } nearbyMobiles.Free(); while (m_Queue.Count > 0) { Mobile mobile = (Mobile)m_Queue.Dequeue(); if (mobile is BaseCreature) { damage *= 2; } SpecialAbilities.KnockbackSpecialAbility(1.0, Location, this, mobile, damage, 15, -1, "", "The beast flings you aside!"); } }); }
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; } } }); }
public void Swallow() { if (!SpecialAbilities.Exists(this)) { return; } if (!SpecialAbilities.Exists(Combatant)) { return; } if (m_SwallowedMobiles.Contains(Combatant)) { return; } Mobile mobileTarget = Combatant; Combatant = null; double directionDelay = .25; double initialDelay = 1; double totalDelay = 1 + directionDelay + initialDelay; Direction direction = Utility.GetDirection(Location, mobileTarget.Location); PlaySound(0x5DA); SpecialAbilities.HinderSpecialAbility(1.0, null, this, 1, totalDelay, true, 0, false, "", "", "-1"); m_NextSwallowAllowed = DateTime.UtcNow + NextSwallowDelay + TimeSpan.FromSeconds(totalDelay); m_NextAbilityAllowed = DateTime.UtcNow + NextAbilityDelay + TimeSpan.FromSeconds(totalDelay); AbilityInProgress = true; Timer.DelayCall(TimeSpan.FromSeconds(totalDelay), delegate { if (SpecialAbilities.Exists(this)) { AbilityInProgress = false; } }); Timer.DelayCall(TimeSpan.FromSeconds(directionDelay), delegate { if (!SpecialAbilities.Exists(this)) { return; } Animate(11, 15, 1, true, false, 0); PlaySound(0x5DA); double spawnPercent = (double)intervalCount / (double)totalIntervals; int maxExtraSwallowDuration = 10; double swallowDuration = 10 + (Math.Ceiling((double)maxExtraSwallowDuration * spawnPercent)); PublicOverheadMessage(MessageType.Regular, 0, false, "*swallows " + mobileTarget.Name + "*"); m_SwallowedMobiles.Add(mobileTarget); mobileTarget.Location = Location; double extraDamage = DamageMax; double damage = (double)DamageMin + (extraDamage * spawnPercent); if (mobileTarget is BaseCreature) { damage *= 1.5; } if (mobileTarget is PlayerMobile) { damage *= .5; } SpecialAbilities.BleedSpecialAbility(1.0, this, mobileTarget, damage, swallowDuration, 0, true, "", "", "-1"); SpecialAbilities.HinderSpecialAbility(1.0, null, mobileTarget, 1.0, swallowDuration, false, -1, false, "", "You have been 'engulfed' and cannot move or speak!", "-1"); mobileTarget.Squelched = true; mobileTarget.Hidden = true; Timer.DelayCall(TimeSpan.FromSeconds(swallowDuration), delegate { if (mobileTarget == null) { return; } if (mobileTarget.Deleted) { return; } mobileTarget.Squelched = false; mobileTarget.Hidden = false; if (!SpecialAbilities.Exists(this)) { return; } if (m_SwallowedMobiles.Contains(mobileTarget)) { m_SwallowedMobiles.Remove(mobileTarget); } if (!mobileTarget.Alive) { return; } PlaySound(0x56C); PublicOverheadMessage(MessageType.Regular, 0, false, "*spits out " + mobileTarget.Name + "*"); int knockbackDistance = 10; damage = 10; SpecialAbilities.KnockbackSpecialAbility(1.0, Location, this, mobileTarget, damage, knockbackDistance, -1, "", "Maggot spits you out!"); for (int a = 0; a < 6; a++) { TimedStatic ichor = new TimedStatic(Utility.RandomList(4650, 4651, 4652, 4653, 4654, 4655), 5); ichor.Hue = 2051; ichor.Name = "ichor"; Point3D newPoint = new Point3D(mobileTarget.Location.X + Utility.RandomList(-1, 1), mobileTarget.Location.Y + Utility.RandomList(-1, 1), mobileTarget.Location.Z); SpellHelper.AdjustField(ref newPoint, mobileTarget.Map, 12, false); ichor.MoveToWorld(newPoint, mobileTarget.Map); } }); }); }
public void Charge() { if (!SpecialAbilities.Exists(this)) { return; } m_NextChargeAllowed = DateTime.UtcNow + NextChargeDelay; int range = 18; Dictionary <Mobile, int> DictPossibleNewCombatants = new Dictionary <Mobile, int>(); IPooledEnumerable m_NearbyMobiles = Map.GetMobilesInRange(Location, range); foreach (Mobile mobile in m_NearbyMobiles) { if (mobile == this) { continue; } if (!SpecialAbilities.MonsterCanDamage(this, mobile)) { continue; } if (!mobile.InLOS(this)) { continue; } if (mobile.Hidden) { continue; } int distance = Utility.GetDistance(mobile.Location, Location); if (mobile == Combatant && distance <= 4) { continue; } DictPossibleNewCombatants.Add(mobile, distance); } m_NearbyMobiles.Free(); if (DictPossibleNewCombatants.Count == 0) { return; } int TotalValues = 0; foreach (KeyValuePair <Mobile, int> pair in DictPossibleNewCombatants) { TotalValues += pair.Value; } double ItemCheck = Utility.RandomDouble(); double CumulativeAmount = 0.0; double AdditionalAmount = 0.0; bool foundNewCombatant = false; //Determine Combatant foreach (KeyValuePair <Mobile, int> pair in DictPossibleNewCombatants) { AdditionalAmount = (double)pair.Value / (double)TotalValues; if (ItemCheck >= CumulativeAmount && ItemCheck < (CumulativeAmount + AdditionalAmount)) { Combatant = pair.Key; foundNewCombatant = true; break; } CumulativeAmount += AdditionalAmount; } if (Combatant != null && foundNewCombatant) { double directionDelay = .25; double initialDelay = .5; double totalDelay = directionDelay + initialDelay; SpecialAbilities.HinderSpecialAbility(1.0, null, this, 1.0, totalDelay, true, 0, false, "", "", "-1"); Point3D location = Location; Map map = Map; Point3D targetLocation = Combatant.Location; Map targetMap = Combatant.Map; Direction = Utility.GetDirection(Location, targetLocation); Timer.DelayCall(TimeSpan.FromSeconds(directionDelay), delegate { if (!SpecialAbilities.Exists(this)) { return; } PublicOverheadMessage(MessageType.Regular, 0, false, "*charges*"); Animate(5, 5, 1, true, false, 0); PlaySound(GetAngerSound()); Timer.DelayCall(TimeSpan.FromSeconds(initialDelay), delegate { if (!SpecialAbilities.Exists(this)) { return; } bool validCombatant = true; if (Combatant == null) { validCombatant = false; } else { if (!SpecialAbilities.MonsterCanDamage(this, Combatant)) { validCombatant = false; } if (Combatant.Hidden) { validCombatant = false; } if (!Map.InLOS(Location, Combatant.Location)) { validCombatant = false; } if (Utility.GetDistance(Location, Combatant.Location) > range + 10) { validCombatant = false; } } if (validCombatant) { targetLocation = Combatant.Location; } Point3D effectStep = Location; int distance = Utility.GetDistance(effectStep, targetLocation); double stepDelay = .04; Queue m_Queue; IPooledEnumerable nearbyMobiles; for (int a = 0; a < distance; a++) { if (!SpecialAbilities.Exists(this)) { return; } Direction direction = Utility.GetDirection(effectStep, targetLocation); effectStep = SpecialAbilities.GetPointByDirection(effectStep, direction); Point3D effectLocation = effectStep; int index = a; Timer.DelayCall(TimeSpan.FromSeconds(index * stepDelay), delegate { Effects.SendLocationParticles(EffectItem.Create(effectLocation, map, EffectItem.DefaultDuration), 0x3728, 10, 10, 2117, 0, 2023, 0); Effects.PlaySound(effectLocation, map, 0x5C6); Point3D adjustedLocation = effectLocation; adjustedLocation.Z++; new Blood().MoveToWorld(adjustedLocation, map); }); m_Queue = new Queue(); nearbyMobiles = map.GetMobilesInRange(effectStep, 0); foreach (Mobile mobile in nearbyMobiles) { if (mobile == this) { continue; } if (!SpecialAbilities.MonsterCanDamage(this, mobile)) { continue; } m_Queue.Enqueue(mobile); } nearbyMobiles.Free(); while (m_Queue.Count > 0) { Mobile mobile = (Mobile)m_Queue.Dequeue(); double damage = (double)DamageMin; if (mobile is BaseCreature) { damage *= 2; } int finalDamage = (int)(Math.Ceiling(damage)); DoHarmful(mobile); mobile.PlaySound(mobile.GetHurtSound()); new Blood().MoveToWorld(mobile.Location, mobile.Map); AOS.Damage(mobile, this, finalDamage, 100, 0, 0, 0, 0); } } Location = targetLocation; m_Queue = new Queue(); nearbyMobiles = map.GetMobilesInRange(targetLocation, 0); foreach (Mobile mobile in nearbyMobiles) { if (mobile == this) { continue; } if (!SpecialAbilities.MonsterCanDamage(this, mobile)) { continue; } m_Queue.Enqueue(mobile); } nearbyMobiles.Free(); while (m_Queue.Count > 0) { Mobile mobile = (Mobile)m_Queue.Dequeue(); double damage = (double)DamageMin; if (mobile is BaseCreature) { damage *= 2; } int finalDamage = (int)(Math.Ceiling(damage)); double knockbackDamage = 25; DoHarmful(mobile); mobile.PlaySound(mobile.GetHurtSound()); SpecialAbilities.KnockbackSpecialAbility(1.0, location, this, mobile, knockbackDamage, 2, -1, "", "You are knocked back by their charge!"); new Blood().MoveToWorld(mobile.Location, mobile.Map); AOS.Damage(mobile, this, finalDamage, 100, 0, 0, 0, 0); } }); }); } }
public static void Trick(BaseCreature creature, PlayerMobile player) { if (creature == null || player == null) { return; } int trickTextHue = 0x22; creature.PublicOverheadMessage(MessageType.Regular, trickTextHue, false, "Trick it is then!"); creature.PlaySound(0x246); double damageAmount = 0; int duration = 0; switch (Utility.RandomMinMax(1, 15)) { case 1: SpecialAbilities.BacklashSpecialAbility(1.0, null, player, .75, 60, -1, true, "", ""); if (player.NetState != null) { player.PrivateOverheadMessage(MessageType.Regular, 0, false, "Ack! A curse! Causing your spellcasting proficiency to suffer!", player.NetState); } break; case 2: double bleedAmount = (double)player.HitsMax * .66; for (int a = 0; a < 5; a++) { Point3D newLocation = new Point3D(player.Location.X + Utility.RandomList(-1, 1), player.Location.Y + Utility.RandomList(-1, 1), player.Location.Z); new Blood().MoveToWorld(newLocation, player.Map); } SpecialAbilities.BleedSpecialAbility(1.0, null, player, bleedAmount, 8, -1, true, "", "", "-1"); if (player.NetState != null) { player.PrivateOverheadMessage(MessageType.Regular, 0, false, "Curses! A dagger hidden in an apple!", player.NetState); } break; case 3: Point3D creatureLocation = creature.Location; Point3D playerLocation = player.Location; int projectiles = 15; int particleSpeed = 8; for (int a = 0; a < projectiles; a++) { Point3D newLocation = new Point3D(player.X + Utility.RandomList(-5, -4, -3, -2, -1, 1, 2, 3, 4, 5), player.Y + Utility.RandomList(-5, -4, -3, -2, -1, 1, 2, 3, 4, 5), player.Z); SpellHelper.AdjustField(ref newLocation, player.Map, 12, false); IEntity effectStartLocation = new Entity(Serial.Zero, new Point3D(newLocation.X, newLocation.Y, newLocation.Z + 10), player.Map); IEntity effectEndLocation = new Entity(Serial.Zero, new Point3D(player.X, player.Y, player.Z + 10), player.Map); Effects.SendMovingParticles(effectStartLocation, effectEndLocation, 0x3818, particleSpeed, 0, false, false, 2603, 0, 9501, 0, 0, 0x100); } player.FixedParticles(0x3967, 10, 40, 5036, 2603, 0, EffectLayer.CenterFeet); int damage = (int)(Math.Round((double)player.HitsMax * .33)); duration = 5; SpecialAbilities.HinderSpecialAbility(1.0, null, player, 1.0, duration, false, -1, false, "", "", "-1"); new Blood().MoveToWorld(player.Location, player.Map); AOS.Damage(player, damage, 0, 100, 0, 0, 0); if (player.NetState != null) { player.PrivateOverheadMessage(MessageType.Regular, 0, false, "Electric candy! What an age we live in!", player.NetState); } break; case 4: SpecialAbilities.DiseaseSpecialAbility(1.0, null, player, 3, 60, -1, true, "", ""); if (player.NetState != null) { player.PrivateOverheadMessage(MessageType.Regular, 0, false, "Blast! Expired candy!", player.NetState); } break; case 5: TimedStatic glue = new TimedStatic(4650, 30); glue.Name = "glue"; glue.Hue = 2067; glue.MoveToWorld(player.Location, player.Map); SpecialAbilities.EntangleSpecialAbility(1.0, null, player, 1.0, 30, -1, true, "", "", "-1"); if (player.NetState != null) { player.PrivateOverheadMessage(MessageType.Regular, 0, false, "Your feet have been glued to the floor!", player.NetState); } break; case 6: damageAmount = (double)player.HitsMax * .5; SpecialAbilities.FlamestrikeSpecialAbility(1.0, null, player, damageAmount, 1, -1, true, "", "Spicy candy! So hot!"); if (player.NetState != null) { player.PrivateOverheadMessage(MessageType.Regular, 0, false, "Spicy candy! So hot!", player.NetState); } break; case 7: damageAmount = (double)player.HitsMax * .5; Direction direction = Utility.GetDirection(creature.Location, player.Location); int windItemId = 8099; switch (direction) { case Direction.North: windItemId = 8099; break; case Direction.Right: windItemId = 8099; break; case Direction.West: windItemId = 8104; break; case Direction.Up: windItemId = 8104; break; case Direction.East: windItemId = 8109; break; case Direction.Down: windItemId = 8109; break; case Direction.South: windItemId = 8114; break; case Direction.Left: windItemId = 8114; break; } creature.MovingEffect(player, windItemId, 5, 1, false, false, 0, 0); player.PlaySound(0x64C); if (player.NetState != null) { player.PrivateOverheadMessage(MessageType.Regular, 0, false, "This candy totally blows...", player.NetState); } SpecialAbilities.KnockbackSpecialAbility(1.0, creature.Location, null, player, damageAmount, 20, -1, "", ""); break; case 8: SpecialAbilities.PetrifySpecialAbility(1.0, null, player, 1.0, 15, -1, true, "", "", "-1"); if (player.NetState != null) { player.PrivateOverheadMessage(MessageType.Regular, 0, false, "Rock candy!", player.NetState); } break; case 9: if (player.Poison == null) { Poison poison = Poison.GetPoison(2); player.ApplyPoison(null, poison); } player.FixedEffect(0x372A, 10, 30, 2208, 0); Effects.PlaySound(player.Location, player.Map, 0x22F); int residueCount = Utility.RandomMinMax(3, 4); for (int a = 0; a < residueCount; a++) { Point3D poisonPoint = new Point3D(player.Location.X + Utility.RandomList(-1, 1), player.Location.Y + Utility.RandomList(-1, 1), player.Location.Z); SpellHelper.AdjustField(ref poisonPoint, player.Map, 12, false); TimedStatic poisonResidue = new TimedStatic(Utility.RandomList(0x1645, 0x122A, 0x122B, 0x122C, 0x122D, 0x122E, 0x122F), 5); poisonResidue.Hue = 2208; poisonResidue.Name = "poison residue"; poisonResidue.MoveToWorld(poisonPoint, player.Map); } if (player.NetState != null) { player.PrivateOverheadMessage(MessageType.Regular, 0, false, "Poisoned candy! Who would do such a thing!", player.NetState); } break; case 10: bool canPolymorph = true; if (!player.CanBeginAction(typeof(PolymorphSpell))) { canPolymorph = false; } if (!player.CanBeginAction(typeof(PolymorphPotion))) { canPolymorph = false; } if (!player.CanBeginAction(typeof(IncognitoSpell)) || player.IsBodyMod) { canPolymorph = false; } if (DisguiseTimers.IsDisguised(player)) { canPolymorph = false; } if (KinPaint.IsWearingKinPaint(player)) { canPolymorph = false; } if (!canPolymorph) { player.SendMessage("Hmm...Nothing seems to have happened. Or did it?"); return; } player.FixedParticles(0x373A, 10, 15, 5036, EffectLayer.Head); List <int> m_PossibleBodyValues = new List <int>(); m_PossibleBodyValues.Add(3); //Zombie m_PossibleBodyValues.Add(50); //Skeleton m_PossibleBodyValues.Add(56); //Skeleton m_PossibleBodyValues.Add(153); //Ghoul m_PossibleBodyValues.Add(302); //Skeletal Critter m_PossibleBodyValues.Add(309); //Patchwork Skeleton m_PossibleBodyValues.Add(148); //Necromancer m_PossibleBodyValues.Add(793); //Skeletal Horse m_PossibleBodyValues.Add(317); //Giant Bat m_PossibleBodyValues.Add(252); //Corpse Bride m_PossibleBodyValues.Add(57); //Skeletal Knight m_PossibleBodyValues.Add(116); //Nightmare m_PossibleBodyValues.Add(24); //Lich m_PossibleBodyValues.Add(154); //Mummy m_PossibleBodyValues.Add(104); //Skeletal Drake m_PossibleBodyValues.Add(740); //Skeletal Drake m_PossibleBodyValues.Add(308); //Giant Skeleton player.BodyMod = m_PossibleBodyValues[Utility.RandomMinMax(0, m_PossibleBodyValues.Count - 1)]; player.HueMod = 0; player.PlaySound(0x3BD); BaseArmor.ValidateMobile(player); duration = 120; player.BeginAction(typeof(PolymorphPotion)); Timer.DelayCall(TimeSpan.FromSeconds(duration), delegate { if (player == null) { return; } player.EndAction(typeof(PolymorphPotion)); }); player.BeginAction(typeof(PolymorphSpell)); Timer.DelayCall(TimeSpan.FromSeconds(duration), delegate { if (player == null) { return; } player.BodyMod = 0; player.HueMod = -1; player.EndAction(typeof(PolymorphSpell)); BaseArmor.ValidateMobile(player); }); if (player.NetState != null) { player.PrivateOverheadMessage(MessageType.Regular, 0, false, "Hmm, something tastes odd about this candy.", player.NetState); } break; case 11: Item innerLegs = player.FindItemOnLayer(Layer.InnerLegs); Item outerLegs = player.FindItemOnLayer(Layer.OuterLegs); Item pants = player.FindItemOnLayer(Layer.Pants); int layersFound = 0; if (innerLegs != null) { player.Backpack.DropItem(innerLegs); layersFound++; } if (outerLegs != null) { player.Backpack.DropItem(outerLegs); layersFound++; } if (pants != null) { player.Backpack.DropItem(pants); layersFound++; } if (layersFound > 0) { player.PlaySound(0x503); if (player.NetState != null) { player.PrivateOverheadMessage(MessageType.Regular, 0, false, "Your pants appear to have fallen down. How embarrassing!", player.NetState); } } else { player.SendMessage("Nothing seems to have happened. Or did it?..."); } break; case 12: player.FixedParticles(0x374A, 10, 15, 5028, 2604, 0, EffectLayer.Waist); player.PlaySound(0x5DA); player.Animate(22, 6, 1, true, false, 0); //Fall Forward player.Stam = 0; if (player.NetState != null) { player.PrivateOverheadMessage(MessageType.Regular, 0, false, "You feel drowsy and fall on your face!", player.NetState); } break; case 13: player.BAC = 60; player.PlaySound(0x5A9); BaseBeverage.CheckHeaveTimer(player); player.Animate(34, 5, 1, true, false, 0); if (player.NetState != null) { player.PrivateOverheadMessage(MessageType.Regular, 0, false, "What was in that candy??? *hic*", player.NetState); } break; case 14: Warp(creature, player); break; case 15: Warp(creature, player); break; } }
public void IntervalEffect() { if (Deleted || !Alive) { return; } double spawnPercent = (double)intervalCount / (double)totalIntervals; AbilityInProgress = true; int summonMotions = 5 - (int)(Math.Ceiling(4 * spawnPercent)); double summonDuration = 1; int creaturesToSummon = 2 + (int)(Math.Ceiling(8 * spawnPercent)); double stationaryDelay = summonMotions * summonDuration + 1; double minRange = 8; double maxRange = 24; Point3D location = Location; Map map = Map; int range = 10 + (int)(Math.Ceiling(20 * spawnPercent)); int effectHue = Hue - 1; Combatant = null; NextDecisionTime = DateTime.UtcNow + TimeSpan.FromSeconds(stationaryDelay); AIObject.NextMove = AIObject.NextMove + 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); SpecialAbilities.HinderSpecialAbility(1.0, null, this, 1, stationaryDelay, true, 0, false, "", "", "-1"); PublicOverheadMessage(MessageType.Regular, 0, false, "*draws upon the breath of the living*"); for (int a = 0; a < summonMotions; a++) { Timer.DelayCall(TimeSpan.FromSeconds(a * summonDuration), delegate { if (Deleted || !Alive) { return; } CantWalk = true; Frozen = true; Effects.PlaySound(Location, Map, GetAngerSound()); Animate(12, 12, 1, true, false, 0); Queue m_Queue = new Queue(); IPooledEnumerable mobilesInRange = map.GetMobilesInRange(location, range); foreach (Mobile mobile in mobilesInRange) { if (mobile.Deleted) { continue; } if (!mobile.Alive) { continue; } if (mobile == this) { continue; } if (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); } } mobilesInRange.Free(); while (m_Queue.Count > 0) { Mobile mobile = (Mobile)m_Queue.Dequeue(); mobile.MovingEffect(this, 0x3728, 5, 1, false, false, effectHue, 0); } }); } Timer.DelayCall(TimeSpan.FromSeconds((double)summonMotions * summonDuration), delegate { if (Deleted || !Alive) { return; } CantWalk = false; Frozen = false; AbilityInProgress = false; PlaySound(0x64F); Queue m_Queue = new Queue(); IPooledEnumerable mobilesInRange = map.GetMobilesInRange(location, range); foreach (Mobile mobile in mobilesInRange) { if (mobile.Deleted) { continue; } if (!mobile.Alive) { continue; } if (mobile == this) { continue; } if (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); } } mobilesInRange.Free(); while (m_Queue.Count > 0) { Mobile mobile = (Mobile)m_Queue.Dequeue(); Point3D mobileLocation = mobile.Location; int distance = range - (int)GetDistanceToSqrt(mobile); double damage = DamageMax; if (mobile is BaseCreature) { damage *= 2; } Direction direction = Utility.GetDirection(location, mobileLocation); int windId = GetWindItemId(direction, false); MovingEffect(mobile, windId, 5, 1, false, false, effectHue, 0); SpecialAbilities.KnockbackSpecialAbility(1.0, Location, this, mobile, damage, distance, -1, "", "You are knocked back by the breath of life!"); } Timer.DelayCall(TimeSpan.FromSeconds(.5), delegate { if (Deleted || !Alive) { return; } for (int a = 0; a < creaturesToSummon; a++) { Point3D spawnLocation = Location; List <Point3D> m_ValidLocations = SpecialAbilities.GetSpawnableTiles(Location, true, false, Location, Map, 1, 15, 1, 10, true); if (m_ValidLocations.Count > 0) { spawnLocation = m_ValidLocations[Utility.RandomMinMax(0, m_ValidLocations.Count - 1)]; } int particleSpeed = 5; IEntity effectStartLocation = new Entity(Serial.Zero, new Point3D(Location.X, Location.Y, Location.Z + 3), Map); IEntity effectEndLocation = new Entity(Serial.Zero, new Point3D(spawnLocation.X, spawnLocation.Y, spawnLocation.Z + 3), map); Effects.SendMovingEffect(effectStartLocation, effectEndLocation, 0x3728, particleSpeed, 0, false, false, 0, 0); double distance = Utility.GetDistanceToSqrt(Location, spawnLocation); double destinationDelay = (double)distance * .08; Timer.DelayCall(TimeSpan.FromSeconds(destinationDelay), delegate { if (Deleted || !Alive) { return; } Effects.PlaySound(spawnLocation, map, 0x653); Effects.SendLocationParticles(effectEndLocation, 0x3709, 10, 20, effectHue, 0, 5029, 0); Effects.SendLocationParticles(effectEndLocation, 0x3779, 10, 60, effectHue, 0, 5029, 0); Effects.SendLocationParticles(effectEndLocation, 0x3996, 10, 60, effectHue, 0, 5029, 0); Timer.DelayCall(TimeSpan.FromSeconds(.5), delegate { if (this == null) { return; } if (Deleted || !Alive) { return; } BaseCreature monsterToSpawn = null; int maxCreatureValue = 1 + (int)(Math.Ceiling(10 * spawnPercent)); if (maxCreatureValue > 10) { maxCreatureValue = 10; } switch (Utility.RandomMinMax(1, maxCreatureValue)) { case 1: monsterToSpawn = new Zombie(); break; case 2: monsterToSpawn = new Skeleton(); break; case 3: monsterToSpawn = new Ghoul(); break; case 4: monsterToSpawn = new PatchworkSkeleton(); break; case 5: monsterToSpawn = new ZombieMagi(); break; case 6: monsterToSpawn = new SkeletalMage(); break; case 7: monsterToSpawn = new SkeletalKnight(); break; case 8: monsterToSpawn = new Mummy(); break; case 9: monsterToSpawn = new SkeletalDrake(); break; case 10: monsterToSpawn = new RottingCorpse(); break; } if (monsterToSpawn != null) { monsterToSpawn.BossMinion = true; monsterToSpawn.MoveToWorld(spawnLocation, map); m_Creatures.Add(monsterToSpawn); } }); }); } }); }); }
public void DamageEffect(Mobile from) { if (Deleted || !Alive) { return; } if (from == null) { return; } if (from.Deleted || !from.Alive) { return; } if (AbilityInProgress) { return; } double spawnPercent = (double)intervalCount / (double)totalIntervals; Mobile mobile = from; Point3D location = Location; Map map = Map; int effectHue = Hue - 1; if (InLOS(mobile) && GetDistanceToSqrt(mobile) <= 16) { Animate(4, 4, 1, true, false, 0); double stationaryDelay = 2; Combatant = null; NextDecisionTime = DateTime.UtcNow + TimeSpan.FromSeconds(stationaryDelay); AIObject.NextMove = AIObject.NextMove + 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); SpecialAbilities.HinderSpecialAbility(1.0, null, this, 1, stationaryDelay, true, 0, false, "", "", "-1"); IEntity startLocation = new Entity(Serial.Zero, new Point3D(location.X, location.Y, location.Z + 8), map); Animate(15, 8, 1, true, false, 0); //Staff Effects.PlaySound(mobile.Location, mobile.Map, 0x64C); Direction direction = Utility.GetDirection(location, mobile.Location); int windId = GetWindItemId(direction, true); MovingEffect(mobile, windId, 5, 1, false, false, effectHue, 0); double distance = Utility.GetDistanceToSqrt(location, mobile.Location); double destinationDelay = (double)distance * .08; Timer.DelayCall(TimeSpan.FromSeconds(destinationDelay), delegate { if (Deleted || !Alive) { return; } if (mobile == null) { return; } if (mobile.Deleted || !mobile.Alive) { return; } Point3D mobileLocation = mobile.Location; int damage = DamageMin; if (mobile is BaseCreature) { damage = (int)((double)damage * 2); } int knockbackDistance = 4 + (int)(Math.Ceiling(8 * spawnPercent)); SpecialAbilities.KnockbackSpecialAbility(1.0, Location, this, mobile, damage, knockbackDistance, -1, "", "You are knocked back!"); Timer.DelayCall(TimeSpan.FromSeconds(.5), delegate { if (Deleted || !Alive) { return; } int particleSpeed = 5; IEntity effectStartLocation = new Entity(Serial.Zero, new Point3D(Location.X, Location.Y, Location.Z + 3), Map); IEntity effectEndLocation = new Entity(Serial.Zero, new Point3D(mobileLocation.X, mobileLocation.Y, mobileLocation.Z + 3), map); Effects.SendMovingEffect(effectStartLocation, effectEndLocation, 0x3728, particleSpeed, 0, false, false, 0, 0); double newDistance = Utility.GetDistanceToSqrt(Location, mobileLocation); double newDestinationDelay = (double)newDistance * .08; Timer.DelayCall(TimeSpan.FromSeconds(newDestinationDelay), delegate { if (Deleted || !Alive) { return; } Effects.PlaySound(mobileLocation, map, 0x653); Effects.SendLocationParticles(effectEndLocation, 0x3709, 10, 20, effectHue, 0, 5029, 0); Effects.SendLocationParticles(effectEndLocation, 0x3779, 10, 60, effectHue, 0, 5029, 0); Effects.SendLocationParticles(effectEndLocation, 0x3996, 10, 60, effectHue, 0, 5029, 0); Timer.DelayCall(TimeSpan.FromSeconds(.5), delegate { if (Deleted || !Alive) { return; } BaseCreature monsterToSpawn = null; int maxCreatureValue = 1 + (int)(Math.Ceiling(10 * spawnPercent)); if (maxCreatureValue > 10) { maxCreatureValue = 10; } switch (Utility.RandomMinMax(1, maxCreatureValue)) { case 1: monsterToSpawn = new Zombie(); break; case 2: monsterToSpawn = new Skeleton(); break; case 3: monsterToSpawn = new Ghoul(); break; case 4: monsterToSpawn = new PatchworkSkeleton(); break; case 5: monsterToSpawn = new ZombieMagi(); break; case 6: monsterToSpawn = new SkeletalMage(); break; case 7: monsterToSpawn = new SkeletalKnight(); break; case 8: monsterToSpawn = new Mummy(); break; case 9: monsterToSpawn = new SkeletalDrake(); break; case 10: monsterToSpawn = new RottingCorpse(); break; } if (monsterToSpawn != null) { monsterToSpawn.EventMinion = true; monsterToSpawn.MoveToWorld(mobileLocation, map); m_Creatures.Add(monsterToSpawn); } }); }); }); }); } }