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); } }); }); }); }); } }